Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Functions related to the interrupt monitor.

Functions

void classb_intmon_callback (void)
 The interrupt monitor. More...
 
void classb_intmon_increase (enum classb_int_identifiers identifier)
 Increase the counter for the specified interrupt. More...
 
void classb_intmon_reg_int (enum classb_int_identifiers identifier, uint16_t interrupt_counter, uint8_t tolerance_percent)
 Register an interrupt. More...
 
void classb_intmon_set_state (enum classb_int_identifiers identifier, enum classb_int_states state)
 Set a state for the specified interrupt. More...
 

Variables

static struct
classb_intmon_interrupt 
monitored_interrupts [N_INTERRUPTS]
 Array of data structures for the monitored interrupts. More...
 

void classb_intmon_callback ( void  )

The interrupt monitor.

For each registered interrupt, this function compares the counter with the expected value. There is an error if the difference is greater than the limit or if the interrupt is disabled and the counter is different than zero. If CLASSB_CONDITION2_INTERRUPT is true, the monitor will stop immediately, i.e., the remaining interrupts are not checked.

Note
This should be called back from the RTC interrupt. See Real Time Counter Driver.

References abs_diff(), CLASSB_CONDITION2_INTERRUPT, CLASSB_ERROR_HANDLER_INTERRUPT, classb_intmon_interrupt::count, classb_intmon_interrupt::expected, classb_intmon_interrupt::limit, M_DISABLE, M_ENABLE, monitored_interrupts, N_INTERRUPTS, OFF, ON, state, and classb_intmon_interrupt::state.

Referenced by classb_rtc_callback().

void classb_intmon_increase ( enum classb_int_identifiers  identifier)

Increase the counter for the specified interrupt.

This is called from the interrupt routine and it will increases the counter if the interrupt is ON.

Parameters
identifierInterrupt identifier. Use symbol declared in classb_int_identifiers

References classb_intmon_interrupt::count, monitored_interrupts, ON, and state.

Referenced by ovenctl_periodic_classb_tests(), and ovenctl_periodic_temperature_sanity_check().

void classb_intmon_reg_int ( enum classb_int_identifiers  identifier,
uint16_t  reference,
uint8_t  tolerance 
)

Register an interrupt.

This function registers the information that the monitor needs in order to check an interrupt. It should be called from the main application. Interrupts must be declared in classb_int_identifiers in the configuration file. Note that by default the interrupt is not active for monitoring, i.e. the state is OFF.

Parameters
identifierInterrupt identifier. Use symbol declared in classb_int_identifiers
referenceNumber of expected executions for the interrupt within an RTC period: F_INT (Hz) * CLASSB_RTC_INT_PERIOD / CLASSB_RTC_FREQ (Hz)
toleranceThe allowed deviation (%) with respect to interrupt_counter for the interrupt counter.

References classb_intmon_interrupt::count, classb_intmon_interrupt::expected, classb_intmon_interrupt::limit, monitored_interrupts, OFF, and classb_intmon_interrupt::state.

Referenced by oven_classb_init_tests().

void classb_intmon_set_state ( enum classb_int_identifiers  identifier,
enum classb_int_states  state 
)

Set a state for the specified interrupt.

This function should be called from the main application to enable or disable monitoring this interrupt. The application can only set the state to ENABLE or DISABLE, otherwise the error handler will be called, i.e., only the monitor can set ON and OFF states.

Further, if CLASSB_STRICT_INTMON is defined, it is not allowed to enable an interrupt already in the ON state, or disable an interrupt already in the OFF state.

Parameters
identifierInterrupt identifier. Use symbol declared in classb_int_identifiers.
stateInterrupt state. Use symbol declared in classb_int_states.

References CLASSB_CONDITION1_INTERRUPT, CLASSB_ERROR_HANDLER_INTERRUPT, M_DISABLE, M_ENABLE, monitored_interrupts, OFF, ON, state, and classb_intmon_interrupt::state.

Referenced by main(), ovenctl_turn_off_plate(), and ovenctl_turn_on_plate().

struct classb_intmon_interrupt monitored_interrupts[N_INTERRUPTS]
static

Array of data structures for the monitored interrupts.

Referenced by classb_intmon_callback(), classb_intmon_increase(), classb_intmon_reg_int(), and classb_intmon_set_state().