AM243x MCU+ SDK  10.00.00
APIs for HW Interrupts

Introduction

For more details and example usage, see HW Interrupts

Data Structures

struct  HwiP_Config
 HwiP config parameters, setup as part of SysConfig, not to be set by end-users directly. More...
 
struct  HwiP_Params
 Parameters passed during HwiP_construct. More...
 
struct  HwiP_Object
 Opaque Hwi object used with the Hwi APIs. More...
 

Functions

void HwiP_Params_init (HwiP_Params *params)
 Set default values to HwiP_Params. More...
 
int32_t HwiP_construct (HwiP_Object *obj, HwiP_Params *params)
 Create a Hwi object. More...
 
int32_t HwiP_setArgs (HwiP_Object *obj, void *args)
 Set argument to pass to the ISR. More...
 
void HwiP_destruct (HwiP_Object *obj)
 Cleanup, delete, destruct a Hwi object. More...
 
void HwiP_enableInt (uint32_t intNum)
 Enable a specific interrupt. More...
 
uint32_t HwiP_disableInt (uint32_t intNum)
 Disable a specific interrupt. More...
 
void HwiP_restoreInt (uint32_t intNum, uint32_t oldIntState)
 Restore a specific interrupt. More...
 
void HwiP_clearInt (uint32_t intNum)
 Clear a pending specific interrupt. More...
 
void HwiP_post (uint32_t intNum)
 Force trigger a specific interrupt. More...
 
uintptr_t HwiP_disable (void)
 Disable all interrupts. More...
 
void HwiP_enable (void)
 Enable all interrupts. More...
 
void HwiP_restore (uintptr_t oldIntState)
 Restores all interrupts to a given state. More...
 
uint32_t HwiP_inISR (void)
 Check if the caller of this function is inside a ISR or not. More...
 
void HwiP_init (void)
 Initialize Hwi module. More...
 
int32_t HwiP_registerNmiHandler (HwiP_FxnCallback nmiHandler, void *args)
 This API registers the NMI handler. More...
 
int32_t HwiP_unregisterNmiHandler (void)
 This API unregisters the current NMI handler. More...
 

Typedefs

typedef void(* HwiP_FxnCallback) (void *args)
 Callback that is called when a HW interrupt is received. More...
 

Macros

#define HwiP_OBJECT_SIZE_MAX   (32u)
 Max size of Hwi object across no-RTOS and all OS's. More...
 

Macro Definition Documentation

◆ HwiP_OBJECT_SIZE_MAX

#define HwiP_OBJECT_SIZE_MAX   (32u)

Max size of Hwi object across no-RTOS and all OS's.

Typedef Documentation

◆ HwiP_FxnCallback

typedef void(* HwiP_FxnCallback) (void *args)

Callback that is called when a HW interrupt is received.

Parameters
args[in] user argument passed during HwiP_construct

Function Documentation

◆ HwiP_Params_init()

void HwiP_Params_init ( HwiP_Params params)

Set default values to HwiP_Params.

Strongly recommended to be called before seting values in HwiP_Params

Parameters
params[out] parameter structure to set to default

◆ HwiP_construct()

int32_t HwiP_construct ( HwiP_Object obj,
HwiP_Params params 
)

Create a Hwi object.

Parameters
obj[out] created object
params[in] parameter structure
Returns
SystemP_SUCCESS on success, SystemP_FAILURE on error

◆ HwiP_setArgs()

int32_t HwiP_setArgs ( HwiP_Object obj,
void *  args 
)

Set argument to pass to the ISR.

Parameters
obj[out] created object
args[in] argument to pass to the ISR
Returns
SystemP_SUCCESS on success, SystemP_FAILURE on error

◆ HwiP_destruct()

void HwiP_destruct ( HwiP_Object obj)

Cleanup, delete, destruct a Hwi object.

Parameters
obj[in] Hwi object

◆ HwiP_enableInt()

void HwiP_enableInt ( uint32_t  intNum)

Enable a specific interrupt.

Parameters
intNum[in] Interrupt number

◆ HwiP_disableInt()

uint32_t HwiP_disableInt ( uint32_t  intNum)

Disable a specific interrupt.

The return value is typically used with HwiP_restoreInt to restore the interrupt state to old value.

Parameters
intNum[in] Interrupt number
Returns
old interrupt state,
0: interrupt was disabled previously,
1: interrupt was enabled previously

◆ HwiP_restoreInt()

void HwiP_restoreInt ( uint32_t  intNum,
uint32_t  oldIntState 
)

Restore a specific interrupt.

The oldIntState value typically returned by HwiP_disableInt is used to restore the interrupt state to old value.

Parameters
intNum[in] Interrupt number
oldIntState[in] 0: disable interrupt, 1: enable interrupt

◆ HwiP_clearInt()

void HwiP_clearInt ( uint32_t  intNum)

Clear a pending specific interrupt.

Parameters
intNum[in] Interrupt number

◆ HwiP_post()

void HwiP_post ( uint32_t  intNum)

Force trigger a specific interrupt.

Parameters
intNum[in] Interrupt number

◆ HwiP_disable()

uintptr_t HwiP_disable ( void  )

Disable all interrupts.

Note
In case of ARM R5F, ARM M4F, this only disables IRQ.
FIQ is not disabled.
In case of ARM M4F, this only disables interrupts which has priority between 1-7.
Returns
interrupt state before disable, typically used by HwiP_restore later

◆ HwiP_enable()

void HwiP_enable ( void  )

Enable all interrupts.

Note
In case of ARM R5F, ARM M4F, this only enables IRQ.
FIQ is not enabled.

◆ HwiP_restore()

void HwiP_restore ( uintptr_t  oldIntState)

Restores all interrupts to a given state.

Note
In case of ARM R5F, ARM M4F, this only restores IRQ state.
FIQ state is not changed.
Parameters
oldIntState[in] interrupt state, typically returned by HwiP_disable earlier

◆ HwiP_inISR()

uint32_t HwiP_inISR ( void  )

Check if the caller of this function is inside a ISR or not.

In some cases, like with freertos, some functions cannot be called from within the OS ISR handler, this API allows the user and some driver porting layer (DPL) APIs to check and call the appropiate ISR safe API when in ISR handler mode.

To get the exact CPU mode of the executing CPU, use the low level CPU specific system calls/registers.

Note
In case of ARM R5F, this only checks if caller is inside IRQ or not. This means when HwiP_inISR returns 1, CPU is in IRQ mode and when HwiP_inISR return 0, CPU could be in system mode or FIQ or abort mode and so on
Returns
0 not in interrupt mode, 1 in interrupt mode

◆ HwiP_init()

void HwiP_init ( void  )

Initialize Hwi module.

  • Disables all individual interrupts
  • Clears all individual interrupts
  • Enables global interrupts
Note
MUST be called during system intialization before any HwiP_construct API calls.
In case of ARM R5F, ARM M4F, this initializes and enables both FIQ and IRQ

◆ HwiP_registerNmiHandler()

int32_t HwiP_registerNmiHandler ( HwiP_FxnCallback  nmiHandler,
void *  args 
)

This API registers the NMI handler.

Parameters
nmiHandler[in] Callback function to be called for NMI
args[in] Args passed for the NMI callback
Returns
SystemP_SUCCESS on success, SystemP_FAILURE on error

◆ HwiP_unregisterNmiHandler()

int32_t HwiP_unregisterNmiHandler ( void  )

This API unregisters the current NMI handler.

Returns
SystemP_SUCCESS on success, SystemP_FAILURE on error