Microchip® Advanced Software Framework

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

A test for the frequency of interrupts.

Each time an interrupt is executed a counter is increased. The interrupt monitor is executed periodically to check that the counters are within a configurable range. The Real Time Counter is used to run classb_intmon_callback() periodically. The Interrupt monitor is enabled after calling classb_rtc_setup(). Note that CLASSB_INT_MON should be defined. See Real Time Counter Driver for more details.

In order to monitor an interrupt, the following steps should be followed:

  1. Register the interrupt in classb_int_identifiers.
  2. The main application registers the interrupt by calling classb_intmon_reg_int(). This gives the monitor information on the interrupt, for example the expected frequency.
  3. The interrupts that have to be monitored should call classb_intmon_increase() on each execution.
  4. The main application requests that the monitor starts checking the interrupt. This is done by changing the interrupt state to M_ENABLE with classb_intmon_set_state(). The next time the interrupt monitor runs the state of the interrupt will be set to ON.
  5. If at some point an interrupt should stop being monitored, the main application can change the state to M_DISABLE. The interrupt monitor will change the state to OFF the next time it is executed.

The fact that the main application has to request to start monitoring an interrupt (and that it is the monitor sets the ON state) ensures that the interrupt counter is synchronized with the interrupt monitor, i.e. the interrupt counter starts being increased exactly after a period of the interrupt monitor.

Note that the interrupt counter is only increased if the interrupt is ON. When an interrupt is OFF, the counter should be zero and otherwise the error flag will be set. Further, enabling an interrupt that is ON or disabling an interrupt that is OFF will call the error handler if CLASSB_STRICT_INTMON is defined.

The error handler related to this test is CLASSB_ERROR_HANDLER_INTERRUPT().

Modules

 Settings
 Settings for the interrupt monitor.
 
 Interrupt data interface
 Definition of data structures used by the monitor.
 
 Functions
 Functions related to the interrupt monitor.