3.3 DMT Driver
3.3.1 Introduction
Overview
The Deadman Timer (DMT) module is designed to enable users to monitor the health of their application software by requiring periodic timer interrupts within a user-specified timing window. DMT is a synchronous counter and when enabled, counts instruction fetches, and is able to cause a soft trap if the DMT counter is not cleared within a set number of instructions.
Features
3.3.2 Module Documentation
3.3.2.1 DMT Driver
Deadman Timer (DMT) driver using dsPIC MCUs. The functionality is to interrupt the processor in the event of a software malfunction.
3.3.2.1.1 Module description
Deadman Timer (DMT) driver using dsPIC MCUs. The functionality is to interrupt the processor in the event of a software malfunction.
3.3.2.1.1.1 Functions
void DMT_Initialize (void)
Initializes the DMT module.
void DMT_PreClear (void)
Writes the PreClear Pattern for DMTPRECLR register.
void DMT_Enable (void)
Enables the DMT module.
void DMT_Clear (void)
Checks the PreClear Status and clears the DMT Fetch Counter.
bool DMT_IsWindowOpen (void)
Returns the Window Open status.
bool DMT_IsPreCleared (void)
Checks for the PreClear sequence was initiated and done before the Clear sequence is done.
uint32_t DMT_TimeoutCounterGet (void)
Reads the DMT counter register.
uint32_t DMT_WindowTimeoutCounterGet (void)
Reads the DMT Window Interval Counter.
uint16_t DMT_StatusGet (void)
Gets the DMT status.
uint32_t DMT_CounterGet (void)
Returns the current counter value.
uint32_t DMT_CalibratedCounterGet (void)
Returns the current counter value.
void DMT_EventCallbackRegister (void *handler)
This function can be used to override default callback and to define custom callback for DMT Event event.
void DMT_EventCallback (void)
This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using DMT_EventCallbackRegister.
3.3.2.1.2 Function Documentation
3.3.2.1.2.1 DMT_CalibratedCounterGet()
uint32_t DMT_CalibratedCounterGet (void )
Returns the current counter value.
Value will be compensated for the instructions involved in call-stack-push, reading SFR and call-stack-pop operations. |
none |
Returns the 32 bit counter value |
3.3.2.1.2.2 DMT_Clear()
void DMT_Clear (void )
Checks the PreClear Status and clears the DMT Fetch Counter.
DMT_PreClear() should be called for the associated function to work |
none |
none |
3.3.2.1.2.3 DMT_CounterGet()
uint32_t DMT_CounterGet (void )
Returns the current counter value.
Value will not be compensated for the instructions involved in call-stack-push, reading SFR and call-stack-pop operations. |
none |
Returns the 32 bit counter value |
3.3.2.1.2.4 DMT_Enable()
void DMT_Enable (void )
Enables the DMT module.
none |
none |
3.3.2.1.2.5 DMT_EventCallback()
void DMT_EventCallback (void )
This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using DMT_EventCallbackRegister.
none |
none |
3.3.2.1.2.6 DMT_EventCallbackRegister()
void DMT_EventCallbackRegister (void * handler)
This function can be used to override default callback and to define custom callback for DMT Event event.
in | handler |
- Address of the callback function. |
none |
3.3.2.1.2.7 DMT_Initialize()
void DMT_Initialize (void )
Initializes the DMT module.
none |
none |
3.3.2.1.2.8 DMT_IsPreCleared()
bool DMT_IsPreCleared (void )
Checks for the PreClear sequence was initiated and done before the Clear sequence is done.
none |
true - PreClear sequence performed successfully false - PreClear sequence failed |
3.3.2.1.2.9 DMT_IsWindowOpen()
bool DMT_IsWindowOpen (void )
Returns the Window Open status.
none |
true - Window Open status bit is set false - Window Open status bit is not set |
3.3.2.1.2.10 DMT_PreClear()
void DMT_PreClear (void )
Writes the PreClear Pattern for DMTPRECLR register.
This function should be called before calling DMT_Clear |
none |
none |
3.3.2.1.2.11 DMT_StatusGet()
uint16_t DMT_StatusGet (void )
Gets the DMT status.
none |
status value of DMT |
3.3.2.1.2.12 DMT_TimeoutCounterGet()
uint32_t DMT_TimeoutCounterGet (void )
Reads the DMT counter register.
none |
32 bit timeout counter value |
3.3.2.1.2.13 DMT_WindowTimeoutCounterGet()
uint32_t DMT_WindowTimeoutCounterGet (void )
Reads the DMT Window Interval Counter.
none |
32-bit window interval counter value |
3.3.3 File Documentation
3.3.3.1 source/dmt.h File Reference
#include <stdbool.h> #include <stdint.h>
3.3.3.1.1 Functions
void DMT_Initialize (void)
Initializes the DMT module.
void DMT_PreClear (void)
Writes the PreClear Pattern for DMTPRECLR register.
void DMT_Enable (void)
Enables the DMT module.
void DMT_Clear (void)
Checks the PreClear Status and clears the DMT Fetch Counter.
bool DMT_IsWindowOpen (void)
Returns the Window Open status.
bool DMT_IsPreCleared (void)
Checks for the PreClear sequence was initiated and done before the Clear sequence is done.
uint32_t DMT_TimeoutCounterGet (void)
Reads the DMT counter register.
uint32_t DMT_WindowTimeoutCounterGet (void)
Reads the DMT Window Interval Counter.
uint16_t DMT_StatusGet (void)
Gets the DMT status.
uint32_t DMT_CounterGet (void)
Returns the current counter value.
uint32_t DMT_CalibratedCounterGet (void)
Returns the current counter value.
void DMT_EventCallbackRegister (void *handler)
This function can be used to override default callback and to define custom callback for DMT Event event.
void DMT_EventCallback (void)
This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using DMT_EventCallbackRegister.
3.3.3.1.2 Detailed Description
DMT Generated Driver Header File