ERAD调试
bool ERAD_isValidBusCompBase(uint32_t base)
- function: Check whether the base address of the bus comparator is valid.
-
parameter description:
-
input parameters:
base
: The specified bus comparator base address.
- return parameter: return
true
if the base address is valid, otherwise returnfalse
.
bool ERAD_isValidCounterBase(uint32_t base)
- check whether the base address of the counter is valid.
- parameter description:
- input parameters:
base
: The specified counter base address.
- return parameter: return
true
if the base address is valid, otherwise returnfalse
.
ERAD_Owner ERAD_getOwnership(void)
- function function: The current owner of the ERAD obtained.
- parameter description:
- input parameter: none
- return parameter: return the owner of ERAD.
void ERAD_setOwnership(ERAD_Owner owner)
- function function: Set the owner of ERAD.
- parameter description:
- input parameters:
owner
: ERAD owner to set, optional:ERAD_OWNER_NOOWNER
: No ownerERAD_OWNER_APPLICATION
: ApplicationERAD_OWNER_DEBUGGER
: Debugger
- return parameter: none
void ERAD_resetCounter(uint16_t instances)
- function: Reset the counter through the global register.
- parameter description:
- input parameters:
instances
: To reset the bitwise or value of the counter instance, use the following macro:ERAD_INST_COUNTER1
ERAD_INST_COUNTER2
ERAD_INST_COUNTER3
ERAD_INST_COUNTER4
- return parameter: none
void ERAD_enableModules(uint16_t instances)
- function: Enables selected counters and bus comparators.
- parameter description:
- input parameters:
instances
: Bitwise or value of the counter and bus comparator instance to enable, using the following macro:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
- return parameter: none
void ERAD_disableModules(uint16_t instances)
- function: Disables selected counters and bus comparators.
- parameter description:
- input parameters:
instances
: The bitwise or value of the counter and bus comparator instances to be disabled using the following macro:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
- return parameter: none
void ERAD_initModule(ERAD_Owner owner)
- function: Initializes the ERAD module, including resetting all counters, disabling all bus comparators and counters, and setting the owner of ERAD.
-
parameter description:
-
input parameters:
owner
: ERAD owner to set, optional:ERAD_OWNER_NOOWNER
: No ownerERAD_OWNER_APPLICATION
: ApplicationERAD_OWNER_DEBUGGER
: Debugger
- return parameter: none
uint16_t ERAD_getHaltStatus(void)
- function: Obtain the completion status of any counters and bus comparators by reading the global registers. This allows us to read only one register to see if any of the modules are complete.
- parameter description:
- input parameter: none
- returns the completion status of all counters and bus comparators stored in the global register.
uint16_t ERAD_getEventStatus(void)
- function: Obtain the event trigger status of any counters and bus comparators by reading the global registers. This allows us to read only one register to see if any module has triggered.
- parameter description:
- input parameter: none
- returns the event-triggered status of all counters and bus comparators stored in the global register.
ERAD_Status ERAD_getBusCompStatus(uint32_t base)
- function: Returns the status of the bus comparator.
- parameter description:
-
input parameters:
base
: The base address of the bus comparator, using the following macros:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
-
return parameter: return the status of the bus comparator. Possible values are as follows:
ERAD_STATE_IDLE
: Idle state.ERAD_STATE_ENABLED
: is enabled.ERAD_STATE_COMPLETED
: is enabled and the event occurs.
void ERAD_clearBusCompEvent(uint32_t base)
- function: Clears the event triggered state of the bus comparator and restores the module to its
ERAD_STATE_IDLE
state. - parameter description:
-
input parameters:
base
: The base address of the bus comparator, using the following macros:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
-
return parameter: none
ERAD_Status ERAD_getCounterStatus(uint32_t base)
- function function: return the status of the counter.
-
parameter description:
-
input parameters:
base
: The base address of the counter, using the following macros:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
return parameter: return the status of the counter. Possible values are as follows:
ERAD_STATE_IDLE
: Idle state.ERAD_STATE_ENABLED
: is enabled.ERAD_STATE_COMPLETED
: is enabled and the event occurs.
void ERAD_configBusComp(uint32_t base, ERAD_BusComp_Config config_params)
- function: configure the bus comparator according to the given parameters.
- parameter description:
-
input parameters:
base
: The base address of the bus comparator to configure, using the following macro:-
ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
-
config_params
: Structure used to configure the bus comparator, containing the following fields: mask
: The mask used for the comparison.reference
: The reference value to be compared.comp_mode
: Comparison mode, ofERAD_BusComp_Comp_Mode
type, with the following optional values:ERAD_BUSCOMP_COMPMODE_GT
: Greater thanERAD_BUSCOMP_COMPMODE_GE
: Greater than or equal toERAD_BUSCOMP_COMPMODE_LT
: Less thanERAD_BUSCOMP_COMPMODE_LE
: Less than or equal toERAD_BUSCOMP_COMPMODE_EQ
: equal to
enable_int
: Flag to enable breaking when an event is matched.enable_stop
: Flag to enable the CPU stop feature when an event is matched.bus_sel
: The bus to be monitored, of typeERAD_BusComp_Bus_Select
, with the following optional values:ERAD_BUSCOMP_BUS_VPC
: Virtual Program CounterERAD_BUSCOMP_BUS_DWAB
: Data write address busERAD_BUSCOMP_BUS_DRAB
: Data read address busERAD_BUSCOMP_BUS_DWDB
: Data is written to the data bus
-
return parameter: none
void ERAD_configCounterInCountingMode(uint32_t base, ERAD_Counter_Config config_params)
- function function: configure the counter in count mode.
- parameter description:
-
input parameters:
base
: The base address of the counter to configure, using the following macro:-
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
config_params
: The struct used to configure the counter, with the following fields: event
: Configure the counter input event, the type isERAD_Counter_Input_Event
, the options are as follows:ERAD_EVENT_HWBP1
toERAD_EVENT_HWBP8
: hardware breakpoint events.ERAD_EVENT_COUNTER1_EVENT
toERAD_EVENT_COUNTER4_EVENT
: events related to the counter.ERAD_EVENT_PIE_INT1
toERAD_EVENT_PIE_INT12
: interrupt event.ERAD_EVENT_TIMER1_TINT1
andERAD_EVENT_TIMER2_TINT2
: Timer events.ERAD_EVENT_NO_EVENT
: Used to indicate that there is no event input. This option is used to set the counter to work in a mode that counts CPU cycles.
event_mode
: Set the event mode, the type isERAD_Counter_Event_Mode
, and the options are as follows:ERAD_COUNTER_MODE_ACTIVE
: Counts the number of CPU cycles while the event is active.ERAD_COUNTER_MODE_RISING_EDGE
: Counts the number of rising edges of an event.
reference
: Set the reference value of the counter.rst_on_match
: Flag to reset the counter on a match.enable_int
: Flag to enable breaking when an event is matched.enable_stop
: Flag to enable the CPU stop feature when an event is matched.- return parameter: none
void ERAD_configCounterInStartStopMode(uint32_t base, ERAD_Counter_Config config_params, ERAD_Counter_Input_Event start_event, ERAD_Counter_Input_Event stop_event)
- function: configure the counter in start-stop mode.
- parameter description:
-
input parameters:
base
: The base address of the counter to configure, using the following macro:-
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
config_params
: Configuration parameters with the following fields: -
event
: Configure the counter input event, the type isERAD_Counter_Input_Event
, the options are as follows:ERAD_EVENT_HWBP1
toERAD_EVENT_HWBP8
: hardware breakpoint events.ERAD_EVENT_COUNTER1_EVENT
toERAD_EVENT_COUNTER4_EVENT
: events related to the counter.ERAD_EVENT_PIE_INT1
toERAD_EVENT_PIE_INT12
: interrupt event.ERAD_EVENT_TIMER1_TINT1
andERAD_EVENT_TIMER2_TINT2
: Timer events.ERAD_EVENT_NO_EVENT
: Used to indicate that there is no event input. This option is used to set the counter to work in a mode that counts CPU cycles.
-
event_mode
: Set the event mode, the type isERAD_Counter_Event_Mode
, and the options are as follows:ERAD_COUNTER_MODE_ACTIVE
: Counts the number of CPU cycles while the event is active.ERAD_COUNTER_MODE_RISING_EDGE
: Counts the number of rising edges of an event.
reference
: Set the reference value of the counter.rst_on_match
: Flag to reset the counter on match.enable_int
: Flag to enable breaking when an event is matched.-
enable_stop
: Flag to enable the CPU stop feature when an event is matched. -
start_event
: Start counting events with the following options: ERAD_EVENT_HWBP1
toERAD_EVENT_HWBP8
: hardware breakpoint events.ERAD_EVENT_COUNTER1_EVENT
toERAD_EVENT_COUNTER4_EVENT
: events related to the counter.ERAD_EVENT_PIE_INT1
toERAD_EVENT_PIE_INT12
: interrupt event.ERAD_EVENT_TIMER1_TINT1
andERAD_EVENT_TIMER2_TINT2
: Timer events.-
ERAD_EVENT_NO_EVENT
: Used to indicate that there is no event input. This option is used to set the counter to work in a mode that counts CPU cycles. -
stop_event
: The event to stop counting. The options are thestart_event
same as.
-
return parameter: none
void ERAD_enableCounterResetInput(uint32_t base, ERAD_Counter_Input_Event reset_event)
- function: Enable the reset event of the counter.
- parameter description:
-
input parameters:
base
: The base address of the counter to configure, using the following macro:-
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
reset_event
: The event that triggers the reset of the counter. The options are as follows: ERAD_EVENT_HWBP1
toERAD_EVENT_HWBP8
: hardware breakpoint events.ERAD_EVENT_COUNTER1_EVENT
toERAD_EVENT_COUNTER4_EVENT
: events related to the counter.ERAD_EVENT_PIE_INT1
toERAD_EVENT_PIE_INT12
: interrupt event.ERAD_EVENT_TIMER1_TINT1
andERAD_EVENT_TIMER2_TINT2
: Timer events.ERAD_EVENT_NO_EVENT
: Used to indicate that there is no event input. This option is used to set the counter to work in a mode that counts CPU cycles.
-
return parameter: none
void ERAD_disableCounterResetInput(uint32_t base)
- function function: Disable the reset event of the counter.
-
parameter description:
-
input parameters:
base
: To disable the base address of the counter for the reset event, use the following macro:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
return parameter: none
void ERAD_clearCounterEvent(uint32_t base)
- function function: Clear the event triggered by the counter.
-
parameter description:
-
input parameters:
base
: To disable the base address of the counter for the reset event, use the following macro:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
return parameter: none
void ERAD_clearCounterOverflow(uint32_t base)
- function function: Clear the overflow that may occur in the counter.
-
parameter description:
-
input parameters:
base
: To clear the base address of the overflow counter, use the following macro:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
return parameter: none
uint32_t ERAD_getCurrentCount(uint32_t base)
- function function: Get the current count value of the counter.
- parameter description:
- input parameters:
base
: The base address of the counter, using the following macros:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
- return parameter: The current count value of the counter.
void ERAD_setCurrentCount(uint32_t base, uint32_t value)
- function: Set the current count value of the counter.
- parameter description:
-
input parameters:
base
: The base address of the counter, using the following macros:-
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
value
: The count value to be written.
-
return parameter: none
uint32_t ERAD_getMaxCount(uint32_t base)
- function function: get the maximum count value of the counter.
-
parameter description:
-
input parameters:
base
: The base address of the counter, using the following macros:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
return parameter: The maximum count value of the counter.
void ERAD_setMaxCount(uint32_t base, uint32_t value)
- function function: set the maximum count value of the counter.
- parameter description:
-
input parameters:
base
: The base address of the counter, using the following macros:-
ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
-
value
: The maximum count value to be written.
-
return parameter: none
void ERAD_profile(ERAD_Profile_Params config_params)
- function capability: Configure ERAD to analyze a specific code segment.
-
parameter description:
-
input parameters:
config_params
: Configuration parameters with the following fields:start_address
: The starting address of the analysis code.end_address
: End address of the analysis code.bus_sel
: Selection of the bus to be monitored, of typeERAD_BusComp_Bus_Select
, using the following macros:ERAD_BUSCOMP_BUS_VPC
: Virtual Program CounterERAD_BUSCOMP_BUS_DWAB
: Data write address busERAD_BUSCOMP_BUS_DRAB
: Data read address busERAD_BUSCOMP_BUS_DWDB
: Data is written to the data bus
busComp_base1
: The base address of the first bus comparator, using the following macro:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
busComp_base2
: The base address of the second bus comparator, using the following macro:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
counter_base
: The base address of the counter, using the following macros:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
- return parameter: none
void ERAD_enableInterruptOnAddressHit(ERAD_AddressHit_Params config_params, uint32_t busComp_base)
- function: Enables an RTOS interrupt at a specified address.
- parameter description:
- input parameters:
config_params
: Configuration parameters with the following fields:address
: The address that triggered the interrupt.mask
: Address mask, used for address comparison.bus_sel
: The bus to be monitored, of typeERAD_BusComp_Bus_Select
, using the following macros:ERAD_BUSCOMP_BUS_VPC
: Virtual Program CounterERAD_BUSCOMP_BUS_DWAB
: Data write address busERAD_BUSCOMP_BUS_DRAB
: Data read address busERAD_BUSCOMP_BUS_DWDB
: Data is written to the data bus
busComp_base
: The base address of the bus comparator to use, using the following macro:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
- return parameter: none
void ERAD_countAddressHits(ERAD_AddressHit_Params config_params, uint32_t busComp_base, uint32_t counter_base)
- function function: count the number of times the specified address is hit.
- parameter description:
- input parameters:
config_params
: Configuration parameters with the following fields:address
: Compare addresses.mask
: Address mask, used for address comparison.bus_sel
: The bus to be monitored, of typeERAD_BusComp_Bus_Select
, using the following macros:ERAD_BUSCOMP_BUS_VPC
: Virtual Program CounterERAD_BUSCOMP_BUS_DWAB
: Data write address busERAD_BUSCOMP_BUS_DRAB
: Data read address busERAD_BUSCOMP_BUS_DWDB
: Data is written to the data bus
busComp_base
: The base address of the bus comparator, using the following macros:ERAD_INST_BUSCOMP1
ToERAD_INST_BUSCOMP8
counter_base
: The base address of the counter, using the following macros:ERAD_INST_COUNTER1
ToERAD_INST_COUNTER4
- return parameter: none