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. To get the default configuration (data mask, check-bit mask and enable status) of a channel in EIM, just call EIM_DRV_GetDefaultConfig(). Make sure that the operation is not execute in target RAM where EIM inject the error
    /* Get default configuration of EIM channel 1*/
    EIM_DRV_GetDefaultConfig(1U, &channelConfig);
  3. 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...
 

Macros

#define EIM_CHECKBITMASK_DEFAULT   (0x01U)
 The value default of EIM check-bit mask. More...
 
#define EIM_DATAMASK_DEFAULT   (0x00U)
 The value default of EIM data mask. 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)
 Configures 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...
 
void EIM_DRV_GetDefaultConfig (uint8_t channel, eim_user_channel_config_t *channelConfig)
 Gets the EIM channel configuration default. More...
 

Macro Definition Documentation

#define EIM_CHECKBITMASK_DEFAULT   (0x01U)

The value default of EIM check-bit mask.

Definition at line 48 of file eim_driver.h.

#define EIM_DATAMASK_DEFAULT   (0x00U)

The value default of EIM data mask.

Definition at line 50 of file eim_driver.h.

Function Documentation

void EIM_DRV_ConfigChannel ( uint32_t  instance,
const eim_user_channel_config_t userChannelConfig 
)

Configures 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 118 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 95 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 144 of file eim_driver.c.

void EIM_DRV_GetDefaultConfig ( uint8_t  channel,
eim_user_channel_config_t channelConfig 
)

Gets the EIM channel configuration default.

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

Parameters
[in]channelEIM channel number
[out]channelConfigPointer to EIM channel configuration structure default

Definition at line 171 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 65 of file eim_driver.c.