S32 SDK

Detailed Description

Error Injection Module Peripheral Driver.
EIM PD provides a set of high-level APIs/services to configure the Error Injection Module (EIM) module.

Basic Operations of EIM

  1. To initialize EIM, call EIM_DRV_Init() with an user channel configuration array. In the following code, EIM is initialized with default settings (after reset) for check-bit mask and data mask and both channels is enabled.
    #define INST_EIM1 (0U)
    /* Configuration structure array */
    eim_user_channel_config_t userChannelConfigArr[] =
    {
    /* Configuration channel 0 */
    {
    .channel = 0x0U,
    .checkBitMask = 0x00U,
    .dataMask = 0x00U,
    .enable = true
    },
    /* Configuration channel 1 */
    {
    .channel = 0x1U,
    .checkBitMask = 0x00U,
    .dataMask = 0x00U,
    .enable = true
    }
    };
    /* Initialize the EIM instance 0 with configured channel number of 2 and userChannelConfigArr */
    EIM_DRV_Init(INST_EIM1, 2U, userChannelConfigArr);
  2. Check-bit mask defines a bit-mapped mask that specifies whether the corresponding bit of the check-bit bus from the target RAM should be inverted or remain unmodified. Data mask defines a bit-mapped mask that specifies whether the corresponding bit of the read data bus from the target RAM should be inverted or remain unmodified. To reconfigure check-bit mask or data mask:
    1. The first make sure that EIM module is disabled by call EIM_HAL_Disable().
    2. After that, call EIM_DRV_ConfigChannel() with a new check-bit mask or data mask wants to change.
    3. And finally, call EIM_HAL_Enable() to re-enable EIM module. The following sample code reconfigures EIM to invert bit 0, 2, 5, 7 of check-bit bus for channel 0 and invert bit 7, 15, 23, 31 of bytes 0-3 of the read data bus for channel 1.
      /* Disable EIM module */
      /* Change user configuration of EIM channel 0 */
      userChannelConfigArr[0].checkBitMask = 0b10100101U;
      /* Set new user configuration for channel 0*/
      EIM_DRV_ConfigChannel(INST_EIM1, userChannelConfigArr[0]);
      /* Change user configuration of EIM channel 1 */
      userChannelConfigArr[1].dataMask = 0x80808080U;
      /* Set new user configuration for channel 1*/
      EIM_DRV_ConfigChannel(INST_EIM1, userChannelConfigArr[1]);
      /* Enable EIM module */
  3. To get the current register configuration (data mask, check-bit mask and enable status) of a channel in EIM, just call EIM_DRV_GetChannelConfig(). Make sure that the operation is not execute in target RAM where EIM inject the error
    /* Get configuration of EIM channel 1*/
    EIM_DRV_GetChannelConfig(INST_EIM1, 1U, &channelConfig);
  4. To de-initialize EIM, just call the EIM_DRV_Deinit() function. This function sets all registers to reset values and disables EIM.
    /* De-initializes the EIM module */
    EIM_DRV_Deinit(INST_EIM1);

Data Structures

struct  eim_user_channel_config_t
 EIM channel configuration structure. More...
 

Variables

EIM_Type *const g_eimBase [EIM_INSTANCE_COUNT]
 Table of base addresses for EIM instances. More...
 

EIM Driver API

void EIM_DRV_Init (uint32_t instance, uint8_t channelCnt, const eim_user_channel_config_t *channelConfigArr)
 Initializes the EIM module. More...
 
void EIM_DRV_Deinit (uint32_t instance)
 De-initializes the EIM module. More...
 
void EIM_DRV_ConfigChannel (uint32_t instance, const eim_user_channel_config_t *userChannelConfig)
 Initializes the EIM channel. More...
 
void EIM_DRV_GetChannelConfig (uint32_t instance, uint8_t channel, eim_user_channel_config_t *channelConfig)
 Gets the EIM channel configuration. More...
 

Function Documentation

void EIM_DRV_ConfigChannel ( uint32_t  instance,
const eim_user_channel_config_t userChannelConfig 
)

Initializes the EIM channel.

This function configures check bit mask, data mask and operation status(enable/disable) for EIM channel. The EIM channel configuration structure shall be passed as arguments.

This is an example demonstrating how to define a EIM channel configuration structure:

1 eim_user_channel_config_t eimTestInit = {
2  .channel = 0x1U,
3  .checkBitMask = 0x25U,
4  .dataMask = 0x11101100U,
5  .enable = true
6 };
Parameters
[in]instanceEIM module instance number
[in]userChannelConfigPointer to EIM channel configuration structure

Definition at line 126 of file eim_driver.c.

void EIM_DRV_Deinit ( uint32_t  instance)

De-initializes the EIM module.

This function sets all registers to reset value and disables EIM module. In order to use the EIM module again, EIM_DRV_Init must be called.

Parameters
[in]instanceEIM module instance number

Definition at line 101 of file eim_driver.c.

void EIM_DRV_GetChannelConfig ( uint32_t  instance,
uint8_t  channel,
eim_user_channel_config_t channelConfig 
)

Gets the EIM channel configuration.

This function gets check bit mask, data mask and operation status of EIM channel.

Parameters
[in]instanceEIM module instance number
[in]channelEIM channel number
[out]channelConfigPointer to EIM channel configuration structure

Definition at line 155 of file eim_driver.c.

void EIM_DRV_Init ( uint32_t  instance,
uint8_t  channelCnt,
const eim_user_channel_config_t channelConfigArr 
)

Initializes the EIM module.

This function configures for EIM channels. The EIM channel configuration structure array and number of configured channels shall be passed as arguments. This function should be called before calling any other EIM driver function.

This is an example demonstrating how to define a EIM channel configuration structure array:

1 eim_user_channel_config_t channelConfigArr[] =
2 {
3  {
4  .channel = 0x0U,
5  .checkBitMask = 0x12U,
6  .dataMask = 0x01234567U,
7  .enable = true
8  },
9  {
10  .channel = 0x1U,
11  .checkBitMask = 0x22U,
12  .dataMask = 0x01234444U,
13  .enable = false
14  }
15 };
Parameters
[in]instanceEIM module instance number.
[in]channelCntNumber of configured channels
[in]channelConfigArrEIM channel configuration structure array

Definition at line 66 of file eim_driver.c.

Variable Documentation

EIM_Type* const g_eimBase[EIM_INSTANCE_COUNT]

Table of base addresses for EIM instances.

Definition at line 48 of file eim_driver.c.