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

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

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

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.

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

3.3.2.1.2.2 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

3.3.2.1.2.3 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

3.3.2.1.2.4 DMT_Enable()

void DMT_Enable (void )

Enables the DMT module.

Parameters:
none
Returns:

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.

Parameters:
none
Returns:

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.

Parameters:
in handler

- Address of the callback function.

Returns:

none

3.3.2.1.2.7 DMT_Initialize()

void DMT_Initialize (void )

Initializes the DMT module.

Parameters:
none
Returns:

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.

Parameters:
none
Returns:

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.

Parameters:
none
Returns:

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.

Precondition:

This function should be called before calling DMT_Clear

Parameters:
none
Returns:

none

3.3.2.1.2.11 DMT_StatusGet()

uint16_t DMT_StatusGet (void )

Gets the DMT status.

Parameters:
none
Returns:

status value of DMT

3.3.2.1.2.12 DMT_TimeoutCounterGet()

uint32_t DMT_TimeoutCounterGet (void )

Reads the DMT counter register.

Parameters:
none
Returns:

32 bit timeout counter value

3.3.2.1.2.13 DMT_WindowTimeoutCounterGet()

uint32_t DMT_WindowTimeoutCounterGet (void )

Reads the DMT Window Interval Counter.

Parameters:
none
Returns:

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

3.3.3.1.2 Detailed Description

DMT Generated Driver Header File