Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
HwiP.h File Reference

Detailed Description

Hardware Interrupt module for the RTOS Porting Interface.

============================================================================

The HwiP_disable/HwiP_restore APIs can be called recursively. The order of the HwiP_restore calls, must be in reversed order. For example:

uintptr_t key1, key2;
key1 = HwiP_disable();
key2 = HwiP_disable();

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for HwiP.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  HwiP_Struct
 HwiP structure. More...
 
struct  HwiP_Params
 Basic HwiP Parameters. More...
 

Macros

#define HwiP_STRUCT_SIZE   (28)
 Number of bytes greater than or equal to the size of any RTOS HwiP object. More...
 

Typedefs

typedef union HwiP_Struct HwiP_Struct
 HwiP structure. More...
 
typedef void * HwiP_Handle
 Opaque client reference to an instance of a HwiP. More...
 
typedef void(* HwiP_Fxn) (uintptr_t arg)
 Prototype for the entry function for a hardware interrupt. More...
 

Enumerations

enum  HwiP_Status { HwiP_OK = 0, HwiP_FAILURE = -1 }
 Status codes for HwiP APIs. More...
 

Functions

HwiP_Handle HwiP_construct (HwiP_Struct *hwiP, int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params)
 Function to construct a hardware interrupt object. More...
 
void HwiP_destruct (HwiP_Struct *hwiP)
 Function to destruct a hardware interrupt object. More...
 
void HwiP_clearInterrupt (int interruptNum)
 Function to clear a single interrupt. More...
 
HwiP_Handle HwiP_create (int interruptNum, HwiP_Fxn hwiFxn, HwiP_Params *params)
 Function to create an interrupt on CortexM devices. More...
 
void HwiP_delete (HwiP_Handle handle)
 Function to delete an interrupt on CortexM devices. More...
 
uintptr_t HwiP_disable (void)
 Function to disable interrupts to enter a critical region. More...
 
void HwiP_enable (void)
 Function to enable interrupts. More...
 
void HwiP_disableInterrupt (int interruptNum)
 Function to disable a single interrupt. More...
 
void HwiP_enableInterrupt (int interruptNum)
 Function to enable a single interrupt. More...
 
bool HwiP_inISR (void)
 Function to return a status based on whether it is in an interrupt context. More...
 
bool HwiP_interruptsEnabled (void)
 Function to determine whether interrupts are currently enabled. More...
 
void HwiP_Params_init (HwiP_Params *params)
 Initialize params structure to default values. More...
 
void HwiP_plug (int interruptNum, void *fxn)
 Function to plug an interrupt vector. More...
 
void HwiP_post (int interruptNum)
 Function to generate an interrupt. More...
 
void HwiP_restore (uintptr_t key)
 Function to restore interrupts to exit a critical region. More...
 
void HwiP_setFunc (HwiP_Handle hwiP, HwiP_Fxn fxn, uintptr_t arg)
 Function to overwrite HwiP function and arg. More...
 
void HwiP_setPriority (int interruptNum, uint32_t priority)
 Function to set the priority of a hardware interrupt. More...
 
void HwiP_dispatchInterrupt (int interruptNum)
 Function to call the HW ISR function registered by HwiP_construct. More...
 

Variables

int HwiP_swiPIntNum
 Interrupt number posted by SwiP. More...
 

Macro Definition Documentation

§ HwiP_STRUCT_SIZE

#define HwiP_STRUCT_SIZE   (28)

Number of bytes greater than or equal to the size of any RTOS HwiP object.

NoRTOS: 12 FreeRTOS: 12 BIOS 6.x: 28 BIOS 7.x: 20

Typedef Documentation

§ HwiP_Struct

typedef union HwiP_Struct HwiP_Struct

HwiP structure.

Opaque structure that should be large enough to hold any of the RTOS specific HwiP objects.

§ HwiP_Handle

typedef void* HwiP_Handle

Opaque client reference to an instance of a HwiP.

A HwiP_Handle returned from the HwiP_create represents that instance.

§ HwiP_Fxn

typedef void(* HwiP_Fxn) (uintptr_t arg)

Prototype for the entry function for a hardware interrupt.

Enumeration Type Documentation

§ HwiP_Status

Status codes for HwiP APIs.

Enumerator
HwiP_OK 
HwiP_FAILURE 

Function Documentation

§ HwiP_construct()

HwiP_Handle HwiP_construct ( HwiP_Struct hwiP,
int  interruptNum,
HwiP_Fxn  hwiFxn,
HwiP_Params params 
)

Function to construct a hardware interrupt object.

Parameters
hwiPPointer to HwiP_Struct object.
interruptNumInterrupt Vector Id
hwiFxnentry function of the hardware interrupt
paramsPointer to the instance configuration parameters. NULL denotes to use the default parameters. The HwiP default parameters are noted in HwiP_Params_init.
Returns
A HwiP_Handle on success or a NULL on an error

§ HwiP_destruct()

void HwiP_destruct ( HwiP_Struct hwiP)

Function to destruct a hardware interrupt object.

Parameters
hwiPPointer to a HwiP_Struct object that was passed to HwiP_construct().
Returns

§ HwiP_clearInterrupt()

void HwiP_clearInterrupt ( int  interruptNum)

Function to clear a single interrupt.

Parameters
interruptNuminterrupt number to clear

§ HwiP_create()

HwiP_Handle HwiP_create ( int  interruptNum,
HwiP_Fxn  hwiFxn,
HwiP_Params params 
)

Function to create an interrupt on CortexM devices.

Note
This function may not be available on all implementations
Parameters
interruptNumInterrupt Vector Id
hwiFxnentry function of the hardware interrupt
paramsPointer to the instance configuration parameters. NULL denotes to use the default parameters. The HwiP default parameters are noted in HwiP_Params_init.
Returns
A HwiP_Handle on success or a NULL on an error

§ HwiP_delete()

void HwiP_delete ( HwiP_Handle  handle)

Function to delete an interrupt on CortexM devices.

Note
This function may not be available on all implementations
Parameters
handlereturned from the HwiP_create call
Returns

§ HwiP_disable()

uintptr_t HwiP_disable ( void  )

Function to disable interrupts to enter a critical region.

This function can be called multiple times, but must unwound in the reverse order. For example

uintptr_t key1, key2;
key1 = HwiP_disable();
key2 = HwiP_disable();
Returns
A key that must be passed to HwiP_restore to re-enable interrupts.

§ HwiP_enable()

void HwiP_enable ( void  )

Function to enable interrupts.

§ HwiP_disableInterrupt()

void HwiP_disableInterrupt ( int  interruptNum)

Function to disable a single interrupt.

Parameters
interruptNuminterrupt number to disable

§ HwiP_enableInterrupt()

void HwiP_enableInterrupt ( int  interruptNum)

Function to enable a single interrupt.

Parameters
interruptNuminterrupt number to enable

§ HwiP_inISR()

bool HwiP_inISR ( void  )

Function to return a status based on whether it is in an interrupt context.

Returns
A status: indicating whether the function was called in an ISR (true) or at thread level (false).

§ HwiP_interruptsEnabled()

bool HwiP_interruptsEnabled ( void  )

Function to determine whether interrupts are currently enabled.

Returns
Current state of interrupts.
  • true Interrupts are currently enabled.
  • false Interrupts are currently disabled.

§ HwiP_Params_init()

void HwiP_Params_init ( HwiP_Params params)

Initialize params structure to default values.

The default parameters are:

  • arg: 0
  • priority: ~0
  • enableInt: true
Parameters
paramsPointer to the instance configuration parameters.

§ HwiP_plug()

void HwiP_plug ( int  interruptNum,
void *  fxn 
)

Function to plug an interrupt vector.

Parameters
interruptNumID of interrupt to plug
fxnISR that services plugged interrupt

§ HwiP_post()

void HwiP_post ( int  interruptNum)

Function to generate an interrupt.

Parameters
interruptNumID of interrupt to generate

§ HwiP_restore()

void HwiP_restore ( uintptr_t  key)

Function to restore interrupts to exit a critical region.

Parameters
keyreturn from HwiP_disable

§ HwiP_setFunc()

void HwiP_setFunc ( HwiP_Handle  hwiP,
HwiP_Fxn  fxn,
uintptr_t  arg 
)

Function to overwrite HwiP function and arg.

Parameters
hwiPhandle returned from the HwiP_create or construct call
fxnpointer to ISR function
argargument to ISR function

§ HwiP_setPriority()

void HwiP_setPriority ( int  interruptNum,
uint32_t  priority 
)

Function to set the priority of a hardware interrupt.

Parameters
interruptNumid of the interrupt to change
prioritynew priority

§ HwiP_dispatchInterrupt()

void HwiP_dispatchInterrupt ( int  interruptNum)

Function to call the HW ISR function registered by HwiP_construct.

Note
This function may not be available on all implementations
Parameters
interruptNumInterrupt Vector Id

Variable Documentation

§ HwiP_swiPIntNum

int HwiP_swiPIntNum

Interrupt number posted by SwiP.

The SwiP module needs its scheduler to run at key points in SwiP processing. This is accomplished via an interrupt that is configured at the lowest possible interrupt priority level and is plugged with the SwiP scheduler. This interrupt must be the only interrupt at that lowest priority. SwiP will post this interrupt whenever its scheduler needs to run.

The default value for your device should suffice, but if a different interrupt is needed to be used for SwiP scheduling then HwiP_swiPIntNum can be assigned with this interrupt (early on, before HwiPs are created and before any SwiP gets posted).

© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale