1.28.4.6 DWDT_PS_RegisterCallback Function

C

void DWDT_PS_RegisterCallback(DWDT_CALLBACK pCallback, void* pContext);

Summary

Allows application to register callback with PLIB

Description

This function allows application to register a callback function for the PLIB to call back when interrupt occurred.

At any point if application wants to stop the callback, it can call this function with "callback" value as NULL.

Precondition

The DWDT_Initialize function must have been called and one of the programmable secure interrupts is enabled.

Parameters

Param Description
callback Pointer to the callback function implemented by the user.
pContext The value of parameter will be passed back to the application unchanged, when the callback function is called. It can be used to identify any application specific value that identifies the instance of the client module (for example, it may be a pointer to the client module's state structure).

Returns

None.

Example

MY_APP_OBJ myAppObj;

void APP_DWDT_CallbackFunction (bool interruptStatus, void* pContext)
{
    // The context was set to an application specific object.
    // It is now retrievable easily in Callback function.
    MY_APP_OBJ myAppObj = (MY_APP_OBJ *) context;
    //Application related tasks
}

DWDT_PS_RegisterCallback (APP_DWDT_CallbackFunction, &myAppObj);

Remarks

None.