2.29.3 DMT Driver

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

can be enabled or disabled by the user, by default it is disabled. Option to configure DMT on Hardware or Software. Options to configure DMT Fetch Counter and DMT Window interval

2.29.3.1 Module Documentation

2.29.3.1.1 DMT Driver

Deadman Timer (DMT) driver using dsPIC MCUs. The functionality is to interrupt the processor in the event of a software malfunction.

Module description

Deadman Timer (DMT) driver using dsPIC MCUs. The functionality is to interrupt the processor in the event of a software malfunction.

Functions

Function Documentation

DMT_CalibratedCounterGet()

uint32_t DMT_CalibratedCounterGet (void )

Returns the current counter value.

Precondition:

Value will be compensated for the instructions involved in call-stack-push, reading SFR and call-stack-pop operations.

Parameters:
none
Returns:

Returns the 32 bit counter value

DMT_Clear()

void DMT_Clear (void )

Checks the PreClear Status and clears the DMT Fetch Counter.

Precondition:

DMT_PreClear() should be called for the associated function to work

Parameters:
none
Returns:

none

DMT_CounterGet()

uint32_t DMT_CounterGet (void )

Returns the current counter value.

Precondition:

Value will not be compensated for the instructions involved in call-stack-push, reading SFR and call-stack-pop operations.

Parameters:
none
Returns:

Returns the 32 bit counter value

DMT_Enable()

void DMT_Enable (void )

Enables the DMT module.

Parameters:
none
Returns:

none

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.

Parameters:
none
Returns:

none

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.

Parameters:
in handler

- Address of the callback function.

Returns:

none

DMT_Initialize()

void DMT_Initialize (void )

Initializes the DMT module.

Parameters:
none
Returns:

none

DMT_IsPreCleared()

bool DMT_IsPreCleared (void )

Checks for the PreClear sequence was initiated and done before the Clear sequence is done.

Parameters:
none
Returns:

true - PreClear sequence performed successfully

false - PreClear sequence failed

DMT_IsWindowOpen()

bool DMT_IsWindowOpen (void )

Returns the Window Open status.

Parameters:
none
Returns:

true - Window Open status bit is set

false - Window Open status bit is not set

DMT_PreClear()

void DMT_PreClear (void )

Writes the PreClear Pattern for DMTPRECLR register.

Precondition:

This function should be called before calling DMT_Clear

Parameters:
none
Returns:

none

DMT_StatusGet()

uint16_t DMT_StatusGet (void )

Gets the DMT status.

Parameters:
none
Returns:

status value of DMT

DMT_TimeoutCounterGet()

uint32_t DMT_TimeoutCounterGet (void )

Reads the DMT counter register.

Parameters:
none
Returns:

32 bit timeout counter value

DMT_WindowTimeoutCounterGet()

uint32_t DMT_WindowTimeoutCounterGet (void )

Reads the DMT Window Interval Counter.

Parameters:
none
Returns:

32-bit window interval counter value

2.29.3.2 File Documentation

2.29.3.2.1 source/dmt.h File Reference

#include <stdbool.h>
#include <stdint.h>

Functions

Detailed Description

DMT Generated Driver Header File