ERAD Module

C2000 MCU’s have an IP called Embedded Real Time Analysis And Diagnostics (ERAD) that provides unique hardware capabilities for real time analysis, monitoring and diagnostics of the systems. The ERAD module is accessible both by the debugger and the application software, which significantly increases the debug capabilities of many real-time systems, especially in situations where the debugger is not connected The ERAD driver includes high level APIs for various use cases like profiling functions, detecting stack overflow, counting memory accesses etc.

group erad_api

Defines

ERAD_HWBP_CNTL_STOP_S 0x05U
ERAD_HWBP_CNTL_RTOSINT_S 0x06U
ERAD_CTM_CNTL_EVENT_MODE_S 0x03U
ERAD_CTM_CNTL_RST_ON_MATCH_S 0x04U
ERAD_CTM_CNTL_STOP_S 0x06U
ERAD_CTM_CNTL_RTOSINT_S 0x07U
ERAD_getBusCompInstance(base) (1UL << ((base >> 3U) & 0x7U))
ERAD_getCounterInstance(base) ((1UL << ((base >> 4U) & 0x3U)) << 8U)
ERAD_getCRCInstance(base) (1U << (((base >> 4U) & 0xFU) - 1U))
ERAD_BUSCOMP_BASE_TO_EVENT(base) ((base >> 3U) & 0x07U)
ERAD_INST_BUSCOMP1 0x00000001UL

Instance for bus comparator 1.

Values that can be passed to ERAD_enableModules() or ERAD_disableModules() as instances parameter.

ERAD_INST_BUSCOMP2 0x00000002UL

Instance for bus comparator 2.

ERAD_INST_BUSCOMP3 0x00000004UL

Instance for bus comparator 3.

ERAD_INST_BUSCOMP4 0x00000008UL

Instance for bus comparator 4.

ERAD_INST_BUSCOMP5 0x00000010UL

Instance for bus comparator 5.

ERAD_INST_BUSCOMP6 0x00000020UL

Instance for bus comparator 6.

ERAD_INST_BUSCOMP7 0x00000040UL

Instance for bus comparator 7.

ERAD_INST_BUSCOMP8 0x00000080UL

Instance for bus comparator 8.

ERAD_INST_COUNTER1 0x00000100UL

Instance for counter 1.

ERAD_INST_COUNTER2 0x00000200UL

Instance for counter 2.

ERAD_INST_COUNTER3 0x00000400UL

Instance for counter 3.

ERAD_INST_COUNTER4 0x00000800UL

Instance for counter 4.

ERAD_INST_CRC1 0x00000001UL

Instance for CRC unit 1.

ERAD_INST_CRC2 0x00000002UL

Instance for CRC unit 2.

ERAD_INST_CRC3 0x00000004UL

Instance for CRC unit 3.

ERAD_INST_CRC4 0x00000008UL

Instance for CRC unit 4.

ERAD_INST_CRC5 0x00000010UL

Instance for CRC unit 5.

ERAD_INST_CRC6 0x00000020UL

Instance for CRC unit 6.

ERAD_INST_CRC7 0x00000040UL

Instance for CRC unit 7.

ERAD_INST_CRC8 0x00000080UL

Instance for CRC unit 8.

ERAD_INPUT_INVERT_DISABLE 0x00U

Do not invert the input.

Values that can be passed to ERAD_setCounterInputConditioning() as options parameter.

ERAD_INPUT_INVERT_ENABLE 0x01U

Invert the input.

ERAD_INPUT_SYNC_DISABLE 0x00U

Disable 2-stage synchronizer.

ERAD_INPUT_SYNC_ENABLE 0x02U

Enable 2-stage synchronizer.

Enums

enum ERAD_Owner

Values that can be passed to ERAD_initModule() as owner parameter to set owner of ERAD.

Values:

enumerator ERAD_OWNER_NOOWNER = 0

No owner.

enumerator ERAD_OWNER_APPLICATION = 1

Application owned.

enumerator ERAD_OWNER_DEBUGGER = 2

Debugger owned.

enum ERAD_Status

Values that can are returned by ERAD_getBusCompStatus() and ERAD_getCounterStatus() to indicate the state of the respective module.

Values:

enumerator ERAD_STATE_IDLE = 0

Module is idle.

enumerator ERAD_STATE_ENABLED = 2

Module is enabled.

enumerator ERAD_STATE_COMPLETED = 3

Module was enabled and an event occurred.

enum ERAD_BusComp_Bus_Select

Values that can be passed to ERAD_configBusComp() and ERAD_profile() as config_params.bus_sel parameter to choose which CPU bus to monitor.

Values:

enumerator ERAD_BUSCOMP_BUS_PAB = 0

Use the Program Address Bus.

enumerator ERAD_BUSCOMP_BUS_VPC = 1

Use the Virtual Program Counter.

enumerator ERAD_BUSCOMP_BUS_DWAB = 2

Use the Data Write Address Bus.

enumerator ERAD_BUSCOMP_BUS_DRAB = 3

Use the Data Read Address Bus.

enumerator ERAD_BUSCOMP_BUS_DWDB = 4

Use the Data Write Data Bus.

enumerator ERAD_BUSCOMP_BUS_DRDB = 5

Use the Data Read Data Bus.

enumerator ERAD_BUSCOMP_BUS_VPC_I_ALIGNED = 6

Use VPC Instruction aligned match.

enumerator ERAD_BUSCOMP_BUS_VPC_R1_ALIGNED = 7

Use VPC R1 aligned match.

enumerator ERAD_BUSCOMP_BUS_VPC_R2_ALIGNED = 8

Use VPC R2 aligned match.

enumerator ERAD_BUSCOMP_BUS_VPC_W_ALIGNED = 9

Use VPC Word aligned match.

enum ERAD_BusComp_Comp_Mode

Values that can be passed to ERAD_configBusComp() and ERAD_profile() as config_params.comp_mode to indicate what kind of comparison to use for the bus comparators.

Values:

enumerator ERAD_BUSCOMP_COMPMODE_GT = 4

Check for greater than.

enumerator ERAD_BUSCOMP_COMPMODE_GE = 5

Check for greater than equal to.

enumerator ERAD_BUSCOMP_COMPMODE_LT = 6

Check for lesser than.

enumerator ERAD_BUSCOMP_COMPMODE_LE = 7

Check for lesser than equal to.

enumerator ERAD_BUSCOMP_COMPMODE_EQ = 0

Check for only equality.

enum ERAD_Counter_Event_Mode

Values that can be passed to ERAD_configCounterInStartStopMode() and ERAD_configCounterInCountingMode() as config_params.event_mode to indicate whether to count rising edges or the number of CPU clock cycles an is active.

Values:

enumerator ERAD_COUNTER_MODE_ACTIVE = 0

Count number of CPU Cycles event is active for

enumerator ERAD_COUNTER_MODE_RISING_EDGE = 1

Count number of Rising Edges of event

enum ERAD_Counter_Input_Event

Values that can be passed to ERAD_configCounterInStartStopMode() and ERAD_configCounterInCountingMode() as config_params.event to indicate what event to consider as input. Also may be passed to ERAD_configCounterInStartStopMode() as start_event and stop_event to indicate start and stop events for the counter.

Values:

enumerator ERAD_EVENT_HWBP1 = 0
enumerator ERAD_EVENT_HWBP2 = 1
enumerator ERAD_EVENT_HWBP3 = 2
enumerator ERAD_EVENT_HWBP4 = 3
enumerator ERAD_EVENT_HWBP5 = 4
enumerator ERAD_EVENT_HWBP6 = 5
enumerator ERAD_EVENT_HWBP7 = 6
enumerator ERAD_EVENT_HWBP8 = 7
enumerator ERAD_EVENT_COUNTER1_EVENT = 8
enumerator ERAD_EVENT_COUNTER2_EVENT = 9
enumerator ERAD_EVENT_COUNTER3_EVENT = 10
enumerator ERAD_EVENT_COUNTER4_EVENT = 11
enumerator ERAD_EVENT_ERAD_OR_MASK0 = 12
enumerator ERAD_EVENT_ERAD_OR_MASK1 = 13
enumerator ERAD_EVENT_ERAD_OR_MASK2 = 14
enumerator ERAD_EVENT_ERAD_OR_MASK3 = 15
enumerator ERAD_EVENT_ERAD_AND_MASK0 = 16
enumerator ERAD_EVENT_ERAD_AND_MASK1 = 17
enumerator ERAD_EVENT_ERAD_AND_MASK2 = 18
enumerator ERAD_EVENT_ERAD_AND_MASK3 = 19
enumerator ERAD_EVENT_PIE_INT1 = 20
enumerator ERAD_EVENT_PIE_INT2 = 21
enumerator ERAD_EVENT_PIE_INT3 = 22
enumerator ERAD_EVENT_PIE_INT4 = 23
enumerator ERAD_EVENT_PIE_INT5 = 24
enumerator ERAD_EVENT_PIE_INT6 = 25
enumerator ERAD_EVENT_PIE_INT7 = 26
enumerator ERAD_EVENT_PIE_INT8 = 27
enumerator ERAD_EVENT_PIE_INT9 = 28
enumerator ERAD_EVENT_PIE_INT10 = 29
enumerator ERAD_EVENT_PIE_INT11 = 30
enumerator ERAD_EVENT_PIE_INT12 = 31
enumerator ERAD_EVENT_TIMER0_TINT0 = 32
enumerator ERAD_EVENT_TIMER1_TINT1 = 33
enumerator ERAD_EVENT_TIMER2_TINT2 = 34
enumerator ERAD_EVENT_DMACH1INT = 35
enumerator ERAD_EVENT_DMACH2INT = 36
enumerator ERAD_EVENT_DMACH3INT = 37
enumerator ERAD_EVENT_DMACH4INT = 38
enumerator ERAD_EVENT_DMACH5INT = 39
enumerator ERAD_EVENT_DMACH6INT = 40
enumerator ERAD_EVENT_FSI_DATA_PKT_RCVD = 41
enumerator ERAD_EVENT_FSI_ERROR_PKT_RCVD = 42
enumerator ERAD_EVENT_FSI_PING_PKT_RCVD = 43
enumerator ERAD_EVENT_FSI_PING_FRAME_TAG_MATCH = 44
enumerator ERAD_EVENT_FSI_DATA_FRAME_TAG_MATCH = 45
enumerator ERAD_EVENT_FSI_ERROR_FRAME_TAG_MATCH = 46
enumerator ERAD_EVENT_FSI_FRAME_DONE = 47
enumerator ERAD_EVENT_ADCAEVTINT = 48
enumerator ERAD_EVENT_ADCCEVTINT = 49
enumerator ERAD_EVENT_MCANA_EVT0 = 50
enumerator ERAD_EVENT_MCANA_EVT1 = 51
enumerator ERAD_EVENT_MCANA_EVT2 = 52
enumerator ERAD_EVENT_ADCSOCA = 53
enumerator ERAD_EVENT_ADCSOCB = 54
enumerator ERAD_EVENT_CLATASKRUN1 = 55
enumerator ERAD_EVENT_CLATASKRUN2 = 56
enumerator ERAD_EVENT_CLATASKRUN3 = 57
enumerator ERAD_EVENT_CLATASKRUN4 = 58
enumerator ERAD_EVENT_CLATASKRUN5 = 59
enumerator ERAD_EVENT_CLATASKRUN6 = 60
enumerator ERAD_EVENT_CLATASKRUN7 = 61
enumerator ERAD_EVENT_CLATASKRUN8 = 62
enumerator ERAD_EVENT_EPWMXBAR_OUT1 = 63
enumerator ERAD_EVENT_EPWMXBAR_OUT2 = 64
enumerator ERAD_EVENT_EPWMXBAR_OUT3 = 65
enumerator ERAD_EVENT_EPWMXBAR_OUT4 = 66
enumerator ERAD_EVENT_EPWMXBAR_OUT5 = 67
enumerator ERAD_EVENT_EPWMXBAR_OUT6 = 68
enumerator ERAD_EVENT_EPWMXBAR_OUT7 = 69
enumerator ERAD_EVENT_EPWMXBAR_OUT8 = 70
enumerator ERAD_EVENT_INPUTXBAR0 = 71
enumerator ERAD_EVENT_INPUTXBAR1 = 72
enumerator ERAD_EVENT_INPUTXBAR2 = 73
enumerator ERAD_EVENT_INPUTXBAR3 = 74
enumerator ERAD_EVENT_INPUTXBAR4 = 75
enumerator ERAD_EVENT_INPUTXBAR5 = 76
enumerator ERAD_EVENT_INPUTXBAR6 = 77
enumerator ERAD_EVENT_INPUTXBAR7 = 78
enumerator ERAD_EVENT_INPUTXBAR8 = 79
enumerator ERAD_EVENT_INPUTXBAR9 = 80
enumerator ERAD_EVENT_INPUTXBAR10 = 81
enumerator ERAD_EVENT_INPUTXBAR11 = 82
enumerator ERAD_EVENT_INPUTXBAR12 = 83
enumerator ERAD_EVENT_INPUTXBAR13 = 84
enumerator ERAD_EVENT_INPUTXBAR14 = 85
enumerator ERAD_EVENT_INPUTXBAR15 = 86
enumerator ERAD_EVENT_CPUx_CPUSTAT = 87
enumerator ERAD_EVENT_CPUx_DBGACK = 88
enumerator ERAD_EVENT_CPUx_NMI = 89
enumerator ERAD_EVENT_CMPSS1_CTRIPH_OR_CTRIPL = 90
enumerator ERAD_EVENT_CMPSS2_CTRIPH_OR_CTRIPL = 91
enumerator ERAD_EVENT_CMPSS3_CTRIPH_OR_CTRIPL = 92
enumerator ERAD_EVENT_CMPSS4_CTRIPH_OR_CTRIPL = 93
enumerator ERAD_EVENT_SD1FLT1_COMPH_OR_COMPL = 98
enumerator ERAD_EVENT_SD1FLT2_COMPH_OR_COMPL = 99
enumerator ERAD_EVENT_SD1FLT3_COMPH_OR_COMPL = 100
enumerator ERAD_EVENT_SD1FLT4_COMPH_OR_COMPL = 101
enumerator ERAD_EVENT_SD2FLT1_COMPH_OR_COMPL = 102
enumerator ERAD_EVENT_SD2FLT2_COMPH_OR_COMPL = 103
enumerator ERAD_EVENT_SD2FLT3_COMPH_OR_COMPL = 104
enumerator ERAD_EVENT_SD2FLT4_COMPH_OR_COMPL = 105
enumerator ERAD_EVENT_ADCAINT1 = 106
enumerator ERAD_EVENT_ADCAINT2 = 107
enumerator ERAD_EVENT_ADCAINT3 = 108
enumerator ERAD_EVENT_ADCAINT4 = 109
enumerator ERAD_EVENT_ADCBINT1 = 110
enumerator ERAD_EVENT_ADCBINT2 = 111
enumerator ERAD_EVENT_ADCBINT3 = 112
enumerator ERAD_EVENT_ADCBINT4 = 113
enumerator ERAD_EVENT_ADCCINT1 = 114
enumerator ERAD_EVENT_ADCCINT2 = 115
enumerator ERAD_EVENT_ADCCINT3 = 116
enumerator ERAD_EVENT_ADCCINT4 = 117
enumerator ERAD_EVENT_HIC_nOE = 122
enumerator ERAD_EVENT_HIC_nWE = 123
enumerator ERAD_EVENT_HIC_nRDY = 124
enumerator ERAD_EVENT_ADCBEVTINT = 125
enumerator ERAD_EVENT_NO_EVENT = 256
enum ERAD_Mask

Values:

enumerator ERAD_AND_MASK1 = 0
enumerator ERAD_AND_MASK2 = 1
enumerator ERAD_AND_MASK3 = 2
enumerator ERAD_AND_MASK4 = 3
enumerator ERAD_OR_MASK1 = 4
enumerator ERAD_OR_MASK2 = 5
enumerator ERAD_OR_MASK3 = 6
enumerator ERAD_OR_MASK4 = 7
enum ERAD_CRC_Qualifiers

Values that can be passed to ERAD_setCRCQualifier() as the qualifier paramter to specify which events to set as the qualifier for the CRC unit.

Values:

enumerator ERAD_CRC_QUAL_NONE = 0

Use every valid event as qualifier for CRC computation

enumerator ERAD_CRC_QUAL_HWBP1 = 1

CRC Compute Qualified by HWBP_EVENT1.

enumerator ERAD_CRC_QUAL_HWBP2 = 2

CRC Compute Qualified by HWBP_EVENT2.

enumerator ERAD_CRC_QUAL_HWBP3 = 3

CRC Compute Qualified by HWBP_EVENT3.

enumerator ERAD_CRC_QUAL_HWBP4 = 4

CRC Compute Qualified by HWBP_EVENT4.

enumerator ERAD_CRC_QUAL_HWBP5 = 5

CRC Compute Qualified by HWBP_EVENT5.

enumerator ERAD_CRC_QUAL_HWBP6 = 6

CRC Compute Qualified by HWBP_EVENT6.

enumerator ERAD_CRC_QUAL_HWBP7 = 7

CRC Compute Qualified by HWBP_EVENT7.

enumerator ERAD_CRC_QUAL_HWBP8 = 8

CRC Compute Qualified by HWBP_EVENT8.

enumerator ERAD_CRC_QUAL_HWBP_OR1 = 9

CRC Compute Qualified by HWBP_EVENT_OR1.

enumerator ERAD_CRC_QUAL_HWBP_OR2 = 10

CRC Compute Qualified by HWBP_EVENT_OR1.

enumerator ERAD_CRC_QUAL_HWBP_OR3 = 11

CRC Compute Qualified by HWBP_EVENT_OR1.

enumerator ERAD_CRC_QUAL_HWBP_OR4 = 12

CRC Compute Qualified by HWBP_EVENT_OR1.

enumerator ERAD_CRC_QUAL_HWBP_AND1 = 13

CRC Compute Qualified by HWBP_EVENT_AND2.

enumerator ERAD_CRC_QUAL_HWBP_AND2 = 14

CRC Compute Qualified by HWBP_EVENT_AND2.

enumerator ERAD_CRC_QUAL_HWBP_AND3 = 15

CRC Compute Qualified by HWBP_EVENT_AND2.

enumerator ERAD_CRC_QUAL_HWBP_AND4 = 16

CRC Compute Qualified by HWBP_EVENT_AND2.

enum ERAD_Counter_Input_Type

Values that can be passed to ERAD_setCounterInputConditioning() as input_type parameter. To specify which input to condition.

Values:

enumerator ERAD_COUNTER_COUNT_INPUT = 0
enumerator ERAD_COUNTER_START_INPUT = 1
enumerator ERAD_COUNTER_STOP_INPUT = 2
enumerator ERAD_COUNTER_RESET_INPUT = 3

Functions

ERAD_Owner ERAD_getOwnership(void)

Gets the current owner of ERAD.

Return

Owner of ERAD.

Parameters
  • None.: This function returns the current owner of ERAD.

void ERAD_setOwnership(ERAD_Owner owner)

Sets the current owner of ERAD.

This function sets the current owner of ERAD.

Parameters
  • owner: is the Owner of ERAD that is to be set

Return

None.

void ERAD_resetCounter(uint16_t instances)

Resets the counter using the global registers.

This function resets the selected counters using the global registers.

Parameters
  • instances: is the OR’d value of counter instances to be reset. Following macros can be used:

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

Return

None.

void ERAD_enableModules(uint16_t instances)

Enables counters and bus comparators.

This function enables bus comparators and counters whose instances are passed.

Parameters
  • instances: is the OR’d value of instances of the counters and bus comparators. Following macros can be used:

    • ERAD_INST_BUSCOMP1

    • ERAD_INST_BUSCOMP2

    • ERAD_INST_BUSCOMP3

    • ERAD_INST_BUSCOMP4

    • ERAD_INST_BUSCOMP5

    • ERAD_INST_BUSCOMP6

    • ERAD_INST_BUSCOMP7

    • ERAD_INST_BUSCOMP8

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

Return

None.

void ERAD_disableModules(uint16_t instances)

Disables counters and bus comparators.

This function disables bus comparators and counters whose instances are passed.

Parameters
  • instances: is the OR’d value of instances of the counters and bus comparators. Following macros can be used:

    • ERAD_INST_BUSCOMP1

    • ERAD_INST_BUSCOMP2

    • ERAD_INST_BUSCOMP3

    • ERAD_INST_BUSCOMP4

    • ERAD_INST_BUSCOMP5

    • ERAD_INST_BUSCOMP6

    • ERAD_INST_BUSCOMP7

    • ERAD_INST_BUSCOMP8

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

Return

None.

void ERAD_initModule(ERAD_Owner owner)

Initialises ERAD.

This function resets all the counters and disables all bus comparators and counters. Also sets the owner of the ERAD to the required owner.

Parameters
  • owner: is the owner of ERAD that is to be set.

Return

None.

uint16_t ERAD_getHaltStatus(void)

Returns the completed status of any of the modules.

Return

Completed status of all the modules as stored in the global register.

Parameters
  • None.: This function returns the completed status of the counters and bus comparators as stored in the global registers. This allows us to read just one register and see if any of the modules are in a completed state.

uint16_t ERAD_getEventStatus(void)

Returns the event fired status of any of the modules.

Return

Event fired status of all the modules as stored in the global register.

Parameters
  • None.: This function returns the event fired status of the counters and bus comparators as stored in the global registers. This allows us to read just one register and see if any of the modules have fired.

void ERAD_enableNMI(uint16_t instances)

Enables an NMI for the specified modules.

This function enables an NMI to be generated whenever any of the specified counters or bus comparator units generate and event.

Parameters
  • instances: is the OR’d value of the instances of the counters and bus comparator units that need to have an NMI enabled. Following macros can be used:

    • ERAD_INST_BUSCOMP1

    • ERAD_INST_BUSCOMP2

    • ERAD_INST_BUSCOMP3

    • ERAD_INST_BUSCOMP4

    • ERAD_INST_BUSCOMP5

    • ERAD_INST_BUSCOMP6

    • ERAD_INST_BUSCOMP7

    • ERAD_INST_BUSCOMP8

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

Return

None.

void ERAD_disableNMI(uint16_t instances)

Disables an NMI for the specified modules.

This function disables the NMI for the specified counters and bus comparator units.

Parameters
  • instances: is the OR’d value of the instances of the counters and bus comparator units that need to have an NMI disabled. Following macros can be used:

    • ERAD_INST_BUSCOMP1

    • ERAD_INST_BUSCOMP2

    • ERAD_INST_BUSCOMP3

    • ERAD_INST_BUSCOMP4

    • ERAD_INST_BUSCOMP5

    • ERAD_INST_BUSCOMP6

    • ERAD_INST_BUSCOMP7

    • ERAD_INST_BUSCOMP8

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

Return

None.

ERAD_Status ERAD_getBusCompStatus(uint32_t base)

Returns the status of a bus comparator.

This function returns the status of the bus comparator whose base was passed. It may be either

ERAD_STATE_IDLE, ERAD_STATE_ENABLED or ERAD_STATE_COMPLETED.
Parameters
  • base: is the base of the bus comparator.

Return

Status of bus comparator.

void ERAD_clearBusCompEvent(uint32_t base)

Clears the event fired status of any of the modules.

This function clears the event fired status of the bus comparator and brings the module and brings the module back to

ERAD_STATE_IDLE .
Parameters
  • base: is the base of the bus comparator.

Return

None

ERAD_Status ERAD_getCounterStatus(uint32_t base)

Returns the status of a counter.

This function returns the status of the counter whose base was passed. It may be either

ERAD_STATE_IDLE, ERAD_STATE_ENABLED or ERAD_STATE_COMPLETED.
Parameters
  • base: is the base of the counter.

Return

Status of counter.

void ERAD_configBusComp(uint32_t base, ERAD_BusComp_Config config_params)

Configures the bus comparators.

This function configures the bus comparator with the given parameters.

Parameters
  • base: is the base of the bus comparator to be configured.

  • config_params: are the configuration parameters to be used to configure the bus comparator.

Return

None.

void ERAD_configCounterInCountingMode(uint32_t base, ERAD_Counter_Config config_params)

Configures the counter in Counting mode.

This function configures the counter with the given parameters. The counter is setup in Counting mode, which means counting begins as soon as the counter is enabled. NOTE: This function does not enable the counter. The counter must be enabled using the

ERAD_enableModules method to begin counting.
Parameters
  • base: is the base of the counter to be configured.

  • config_params: are the configuration parameters to be used to configure the counter.

Return

None.

void ERAD_configCounterInStartStopMode(uint32_t base, ERAD_Counter_Config config_params, ERAD_Counter_Input_Event start_event, ERAD_Counter_Input_Event stop_event)

Configures the counter in Start-Stop mode.

This function configures the counter with the given parameters. The counter is setup in Start-Stop mode, which means counting will happen only between two specified events. The event that will be counted can be any of the

ERAD_Counter_Input_Event and not only CPU cycles. NOTE: ERAD_EVENT_NO_EVENT causes the counter to use the CPU cycles. NOTE: This function does not enable the counter. The counter must be enabled using the ERAD_enableModules method to begin counting.
Parameters
  • base: is the base of the counter to be configured.

  • config_params: are the configuration parameters to be used to configure the counter.

  • start_event: is the event that starts the counter

  • stop_event: is the event which stops that counter

Return

None.

void ERAD_configCounterInCumulativeMode(uint32_t base, ERAD_Counter_Config config_params, ERAD_Counter_Input_Event start_event, ERAD_Counter_Input_Event stop_event)

Configures the counter in Start-Stop Cumulative mode.

This function configures the counter with the given parameters. The counter is setup in Cumulative mode, which means counting will happen only between two specified events and the counter will not reset on

stop_event. The event that will be counted can be any of the ERAD_Counter_Input_Event and not only CPU cycles. NOTE: ERAD_EVENT_NO_EVENT causes the counter to use the CPU cycles. NOTE: This function does not enable the counter. The counter must be enabled using the ERAD_enableModules method to begin counting.
Parameters
  • base: is the base of the counter to be configured.

  • config_params: are the configuration parameters to be used to configure the counter.

  • start_event: is the event that starts the counter

  • stop_event: is the event which stops that counter

Return

None.

void ERAD_configMask(ERAD_Mask mask, uint32_t instances, bool enable_int)

Configures the AND and OR masks

This function enables the event generated from the specified bus comparator units to be used for the specified Mask. It also configures the interrupt generation when the mask event occurs.

Parameters
  • mask: is the Mask to be used.

  • instances: is the OR’d value of the instances of the bus comparator units whose events need to be used for the mask. Following macros can be used:

    • ERAD_INST_BUSCOMP1

    • ERAD_INST_BUSCOMP2

    • ERAD_INST_BUSCOMP3

    • ERAD_INST_BUSCOMP4

    • ERAD_INST_BUSCOMP5

    • ERAD_INST_BUSCOMP6

    • ERAD_INST_BUSCOMP7

    • ERAD_INST_BUSCOMP8

    • ERAD_INST_COUNTER1

    • ERAD_INST_COUNTER2

    • ERAD_INST_COUNTER3

    • ERAD_INST_COUNTER4

  • enable_int: True if interrupt needs to be enabled, False if not

Return

None.

void ERAD_enableCounterResetInput(uint32_t base, ERAD_Counter_Input_Event reset_event)

Configures the reset event of the counter.

This function sets the event upon which the counter must reset and enables reset upon such an event.

Parameters
  • base: is the base of the counter to be configured.

  • reset_event: is the event upon which the counter must be reset.

Return

None.

void ERAD_disableCounterResetInput(uint32_t base)

Disables the reset event of the counter.

This function disables the reset event that may have been set earlier

Parameters
  • base: is the base of the counter.

Return

None.

void ERAD_clearCounterEvent(uint32_t base)

Clears an event that may have fired in the counter upon match.

This function clears a counter event that may have fired when the counter hit a match.

Parameters
  • base: is the base of the counter.

Return

None.

void ERAD_clearCounterOverflow(uint32_t base)

Clears an overflow that may have occured in the counter.

This function clears the overflow bit that may have got set when the counter may have crossed 0xFFFFFFFF.

Parameters
  • base: is the base of the counter.

Return

None.

uint32_t ERAD_getCurrentCount(uint32_t base)

Gets the current count of a counter.

This function returns the current count of the counter which was configured earlier.

Parameters
  • base: is the base of the counter.

Return

Returns the value of the current count of the counter.

void ERAD_setCurrentCount(uint32_t base, uint32_t value)

Sets the current count of a counter.

This function sets the current count of the counter which was configured earlier. This can be used to reset the counter or start at a value other than 0.

Parameters
  • base: is the base of the counter.

  • value: is the value to be written as the current count.

Return

None.

uint32_t ERAD_getMaxCount(uint32_t base)

Gets the maximum count of a counter.

This function returns the current maximum count of the counter which was configured earlier.

Parameters
  • base: is the base of the counter.

Return

Returns the value of the current maximum count of the counter.

void ERAD_setMaxCount(uint32_t base, uint32_t value)

Sets the maximum count of a counter.

This function sets the current maximum count of the counter which was configured earlier.

Parameters
  • base: is the base of the counter.

  • value: is the value to be written as the maximum count.

Return

None.

void ERAD_setCounterInputConditioning(uint32_t base, ERAD_Counter_Input_Type input_type, uint16_t options)

Sets conditioning on the inputs to the counter.

This function conditions the inputs to the counter specified. This includes inverting the input and enabling a 2-stage synchronizer for any 4 of the inputs:

reset, stop, start, count_input.
Parameters
  • base: is the base value of the counter to be configured

  • input_type: defines which input needs to be conditioned

  • options: is the kind of conditioning that needs to applied. This will be an OR’d value of ERAD_INVERT_ENABLE, ERAD_INVERT_DISABLE, ERAD_SYNC_ENABLE or ERAD_SYNC_DISABLE.

Return

None.

void ERAD_initCRC(uint16_t instances)

Initialises the CRC unit.

This function initialises the specified CRC units.

Parameters
  • instances: is the OR’d value of CRC instances. Following macros can be used:

    • ERAD_INST_CRC1

    • ERAD_INST_CRC2

    • ERAD_INST_CRC3

    • ERAD_INST_CRC4

    • ERAD_INST_CRC5

    • ERAD_INST_CRC6

    • ERAD_INST_CRC7

    • ERAD_INST_CRC8

Return

None.

void ERAD_enableCRC(uint16_t instances)

Enables the CRC unit.

This function enables the specified CRC units.

Parameters
  • instances: is the OR’d value of CRC instances. Following macros can be used:

    • ERAD_INST_CRC1

    • ERAD_INST_CRC2

    • ERAD_INST_CRC3

    • ERAD_INST_CRC4

    • ERAD_INST_CRC5

    • ERAD_INST_CRC6

    • ERAD_INST_CRC7

    • ERAD_INST_CRC8

Return

None.

void ERAD_disableCRC(uint16_t instances)

Disables the CRC unit.

This function disables the specified CRC units.

Parameters
  • instances: is the OR’d value of CRC instances. Following macros can be used:

    • ERAD_INST_CRC1

    • ERAD_INST_CRC2

    • ERAD_INST_CRC3

    • ERAD_INST_CRC4

    • ERAD_INST_CRC5

    • ERAD_INST_CRC6

    • ERAD_INST_CRC7

    • ERAD_INST_CRC8

Return

None.

uint32_t ERAD_getCurrentCRC(uint32_t base)

Gets the current value of the CRC unit.

This function returns the current value of te specified CRC unit.

Parameters
  • base: is the base value of CRC unit

Return

Current CRC value.

void ERAD_setSeed(uint32_t base, uint32_t seed)

Sets the seed value of the CRC unit

This function sets a seed value of the CRC unit. Note: The corresponding CRC unit must be disabled before setting the seed value.

Parameters
  • base: is the base value of the CRC unit

  • seed: is the value of seed to be set

Return

None.

void ERAD_setCRCQualifier(uint32_t base, ERAD_CRC_Qualifiers qualifier)

Sets the qualifier event of the CRC unit

This function sets a qualifier to decide which events require a CRC computation. Note: The corresponding CRC unit must be disabled before setting the qualifier.

Parameters
  • base: is the base value of the CRC unit

  • qualifier: is the type of qualifier to be set

Return

None.

void ERAD_profile(ERAD_Profile_Params config_params)

Configures the ERAD to profile a certain piece of code

This function configures 2 bus comparators and 1 counter to profile a certain piece of code. The base address of the bus comparators and the counter to be used are specified in

config_params. Note: Use ERAD_getMaxCount to get the latest profiled value. The maximum count of the counter being used must be reset to 0x0 to get the correct value everytime.
Parameters
  • config_params: are the parameters that will be used to configure ERAD

Return

None.

void ERAD_enableInterruptOnAddressHit(ERAD_AddressHit_Params config_params, uint32_t busComp_base)

Enables an RTOS interrupt at a specified address.

This function enables an RTOS interrupt to be generated when an address in memory or instruction is hit.

Parameters
  • config_params: contrains the bus to be monitored and the address

  • busComp_base: is the base of the bus compoarator to be used

If the selected bus is ERAD_BUSCOMP_BUS_PAB, then the ERAD will be configured to trigger an interrupt when there is instruction fetch happening at the specified address. Similary, if ERAD_BUSCOMP_BUS_DWAB is selected, the ERAD will be configured to trigger an interrupt when there write access to the specified address, and so on.

Use

Return

None.

void ERAD_countAddressHits(ERAD_AddressHit_Params config_params, uint32_t busComp_base, uint32_t counter_base)

Configures the ERAD to count the number of times a the specified address is hit

This function configures 1 bus comparator and 1 counter to count how many times a the specified address is hit.

Parameters
  • config_params: are the parameters that will be used to configure ERAD

  • busComp_base: is the base of the bus compoarator to be used

  • counter_base: is the base of the counter to be used

If the selected bus is ERAD_BUSCOMP_BUS_PAB, then the ERAD will be configured to count the number of times an instruction fetch happens at the specified address. Similary, if ERAD_BUSCOMP_BUS_DWAB is selected, the ERAD will be configured to count the number of times there is a write access to the specified address, and so on.

Return

None.

struct ERAD_BusComp_Config
#include <erad.h>

Structure that is passed to ERAD_configBusComp() as config_params to configure a bus comparator.

struct ERAD_Profile_Params
#include <erad.h>

Structure that is passed to ERAD_profile() as config_params to setup the required modules appropriately for each use case.

struct ERAD_Counter_Config
#include <erad.h>

Structure that is passed to ERAD_configCounterInStartStopMode() and ERA_configCounterInCountingMode() as config_params to setup a counter appropriately.

struct ERAD_AddressHit_Params
#include <erad.h>

Structure that is passed to ERAD_enableInterruptOnAddressHit() and ERAD_countAddressHits() as config_params to select the bus and the address to compare. bus_Sel can be one of the following: ERAD_BUSCOMP_BUS_PAB : for instruction fetch at the address ERAD_BUSCOMP_BUS_DWAB : for data write access to the address ERAD_BUSCOMP_BUS_DRAB : for data read access to the address

The code for this module is contained in driverlib/erad.c, with driverlib/erad.h containing the API declarations for use by applications.