SYS/BIOS
7.00
|
Cortex M0 Hardware Interrupt Manager.
The Hardware Interrupt Manager provides APIs for managing hardware interrupts.
The user can dynamically assign routines that run when specific hardware interrupts occur.
Dynamic assignment of Hwi routines to interrupts at run-time is done using the Hwi_create() or Hwi_construct() functions.
Interrupt routines can be written completely in C, completely in assembly, or in a mix of C and assembly.
In order to support interrupt routines written completely in C, an interrupt dispatcher is provided that performs the requisite prolog and epilog for an interrupt routine so the interrupt function can safely inter-operate with the BIOS Task and Swi schedulers.
Some routines are assigned to interrupts by the other SYS/BIOS modules. For example, the Clock module configures its own timer interrupt handler. See the Clock Module for more details.
Below is an example of configuring an interrupt at runtime. Usually this code would be placed in main().
Below is an example of configuring the same interrupt without requiring the use of a heap.
The Cortex-M devices' Nested Vectored Interrupt Controller (NVIC) supports up to 256 interrupts/exceptions. In practice, most devices support much fewer (ie the SimpleLink CC13XX/CC26XX family of devices have around 50 total interrupts defined).
SYS/BIOS Interrupt IDs or interrupt numbers correspond to an interrupt's position in the interrupt vector table.
ID 0 corresponds to vector 0 which is used by the NVIC to hold the initial (reset) stack pointer value.
ID 1 corresponds to vector 1 which is the reset vector (ie _c_int00)
IDs 2-14 are hardwired to exceptions.
ID 15 is the SysTick timer interrupt.
ID's 16-255 are mapped to the NVIC's user interrupts 0-239 which are tied to platform specific interrupt sources.
Due to the M0's native automatic stacking of saved-by-caller C context on the way to an ISR, zero latency interrupt handlers are implemented using regular C functions (ie no 'interrupt' keyword is required).
The NVIC interrupt controller is designed for priority based interrupts.
In this Hwi module, the Hwi_maskSetting instance configuration parameter is ignored. Effectively, only the Hwi_MaskingOption_LOWER is supported.
In general, the NVIC supports priority values of 0 thru 255.
In practice valid priorities values are device dependent and their nesting behaviors depend on the Hwi_priGroup setting.
See the Cortex M0 architecture reference manual for details on the behavior of interrupt priorities and their relationship to the Hwi_priGroup setting.
Tiva devices:
By default, two vector tables are created for Tiva devices:
A 15 entry boot vector table is placed at address 0x00000000 in FLASH.
A vector table of length Hwi_NUM_INTERRUPTS is placed at address 0x20000000 in RAM.
The FLASH boot vector table contains the reset vector and exception handler vectors used until the RAM based vector table is initialized.
The RAM vector table contains those same first 15 vectors plus the SysTick interrupt vector and the remainder of the user interrupt vectors.
During system startup, the NVIC Vector Table Offset Registor is intialized to point to the RAM vector table after it has been initialized.
Sets of hook functions can be specified for the Hwi module using the configuration tool. Each set contains these hook functions:
Register: A function called before any statically-created Hwis are initialized at runtime. The register hook is called at boot time before main() and before interrupts are enabled.
Create: A function that is called when a Hwi is created. This includes hwis that are created statically and those created dynamically using Hwi_create.
Begin: A function that is called just prior to running a Hwi.
End: A function that is called just after a Hwi finishes.
Delete: A function that is called when a Hwi is deleted at run-time with Hwi_delete.
Register Function
The Register function is provided to allow a hook set to store its hookset ID. This id can be passed to "Hwi_setHookContext" and "Hwi_getHookContext" to set or get hookset- specific context. The Register function must be specified if the hook implementation needs to use "Hwi_setHookContext" or "Hwi_getHookContext". The registerFxn hook function is called during system initialization before interrupts have been enabled.
Create and Delete Functions
The create and delete functions are called whenever a Hwi is created or deleted. They are called with interrupts enabled (unless called at boot time or from main()).
Begin and End Functions
The beginFxn and endFxn function hooks are called with interrupts globally disabled, therefore any hook processing function will contribute to the overall system interrupt response latency. In order to minimize this impact, carefully consider the processing time spent in an Hwi beginFxn or endFxn function hook.
Hook functions can only be configured statically.
To add a Hwi hook or set of Hwi hooks, the following syntax is used in the app.syscfg file:
Leaving a subset of the hook functions undefined is ok.
Function | Hwi | Swi | Task | Main | Startup |
---|---|---|---|---|---|
Hwi_clearInterrupt | Y | Y | Y | Y | Y |
Hwi_create | N | N | Y | Y | N |
Hwi_disable | Y | Y | Y | Y | Y |
Hwi_disableInterrupt | Y | Y | Y | Y | N |
Hwi_enable | Y | Y | Y | N | N |
Hwi_enableInterrupt | Y | Y | Y | Y | N |
Hwi_Params_init | Y | Y | Y | Y | Y |
Hwi_restore | Y | Y | Y | Y | Y |
Hwi_restoreInterrupt | Y | Y | Y | Y | Y |
Hwi_construct | N | N | Y | Y | N |
Hwi_delete | N | N | Y | Y | N |
Hwi_destruct | N | N | Y | Y | N |
Hwi_getHookContext | Y | Y | Y | Y | N |
Hwi_setFunc | Y | Y | Y | Y | N |
Hwi_setHookContext | Y | Y | Y | Y | N |
Definitions:
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/runtime/Error.h>
Go to the source code of this file.
Data Structures | |
struct | Hwi_HookSet |
Hwi hook set type definition. More... | |
struct | Hwi_Hook |
struct | Hwi_StackInfo |
Structure contains Hwi stack usage info. More... | |
struct | Hwi_NVIC |
Nested Vectored Interrupt Controller. More... | |
struct | Hwi_ExcContext |
Exception Context - Register contents at the time of an exception. More... | |
struct | Hwi_Module_State |
struct | Hwi_Struct |
struct | Hwi_Params |
Macros | |
#define | Hwi_E_badIntNum "intnum: %d is out of range" |
Error raised Error raised if an attempt is made to create a Hwi with an interrupt number greater than Hwi_NUM_INTERRUPTS - 1. More... | |
#define | Hwi_E_alreadyDefined "Hwi already defined: intr# %d" |
Error raised when a Hwi is already defined. More... | |
#define | Hwi_E_hwiLimitExceeded "Too many interrupts defined" |
Error raised when the number of interrupts being created exceeds the number supported. More... | |
#define | Hwi_E_exception "hardware exception id = %d, pc = 0x%08x" |
Error raised when an exception occurs. More... | |
#define | Hwi_E_noIsr "no ISR, id = %d, pc = 0x%08x" |
Error raised when an uninitialized interrupt occurs. More... | |
#define | Hwi_E_NMI "NMI: %s" |
Error raised when NMI exception occurs. More... | |
#define | Hwi_E_hardFault "Hard-fault: %s" |
Error raised when hard fault exception occurs. More... | |
#define | Hwi_E_memFault "Mem-fault: %s, addresss: 0x%08x" |
Error raised when memory fault exception occurs. More... | |
#define | Hwi_E_busFault "Bus-fault: %s, address: 0x%08x" |
Error raised when bus fault exception occurs. More... | |
#define | Hwi_E_usageFault "Usage-fault: %s" |
Error raised when usage fault exception occurs. More... | |
#define | Hwi_E_svCall "SvCall: svNum = %d" |
Error raised when svCall exception occurs. More... | |
#define | Hwi_E_debugMon "Debug-monitor: %s" |
Error raised when debugMon exception occurs. More... | |
#define | Hwi_E_reserved "reserved %s %d" |
Error raised when reserved exceptions occur. More... | |
#define | Hwi_E_stackOverflow "ISR stack overflow" |
Error raised when the ISR stack has overflowed. More... | |
Typedefs | |
typedef struct Hwi_Struct | Hwi_Struct |
typedef struct Hwi_Struct | Hwi_Object |
typedef Hwi_Struct * | Hwi_Handle |
typedef Hwi_Struct * | Hwi_Instance |
typedef struct Hwi_HookSet | Hwi_HookSet |
Hwi hook set type definition. More... | |
typedef struct Hwi_Module_State | Hwi_Module_State |
typedef struct Hwi_Params | Hwi_Params |
typedef struct Hwi_NVIC | Hwi_NVIC |
Nested Vectored Interrupt Controller. More... | |
typedef struct Hwi_ExcContext | Hwi_ExcContext |
Exception Context - Register contents at the time of an exception. More... | |
typedef struct Hwi_StackInfo | Hwi_StackInfo |
Structure contains Hwi stack usage info. More... | |
typedef void(* | Hwi_FuncPtr) (uintptr_t) |
Hwi create function type definition. More... | |
typedef void(* | Hwi_VectorFuncPtr) (void) |
Hwi vector function type definition. More... | |
typedef void(* | Hwi_ExceptionHookFuncPtr) (Hwi_ExcContext *arg1) |
Exception hook function type definition. More... | |
typedef Hwi_ExceptionHookFuncPtr | Hwi_ExcHookFunc |
typedef enum Hwi_MaskingOption | Hwi_MaskingOption |
Shorthand interrupt masking options. More... | |
typedef void(* | Hwi_ExcHandlerFuncPtr) (unsigned int *arg1, unsigned int arg2) |
Hwi exception handler function type definition. More... | |
Enumerations | |
enum | Hwi_MaskingOption { Hwi_MaskingOption_NONE, Hwi_MaskingOption_ALL, Hwi_MaskingOption_SELF, Hwi_MaskingOption_BITMASK, Hwi_MaskingOption_LOWER } |
Interrupt masking options. More... | |
Functions | |
unsigned int | Hwi_Disable () |
Globally disable interrupts. More... | |
unsigned int | Hwi_Enable () |
Globally enable interrupts. More... | |
void | Hwi_Restore (uint32_t key) |
restore global interrupts to the state they were in prior Hwi_disable(). More... | |
Hwi_Handle | Hwi_create (int intNum, Hwi_FuncPtr hwiFxn, const Hwi_Params *prms, Error_Block *eb) |
Hwi_Handle | Hwi_construct (Hwi_Struct *obj, int intNum, Hwi_FuncPtr hwiFxn, const Hwi_Params *prms, Error_Block *eb) |
void | Hwi_delete (Hwi_Handle *handle) |
void | Hwi_destruct (Hwi_Struct *obj) |
bool | Hwi_getStackInfo (Hwi_StackInfo *stkInfo, bool computeStackDepth) |
Get Hwi stack usage Info. More... | |
void | Hwi_post (unsigned int intNum) |
Generate an interrupt for test purposes. More... | |
unsigned int | Hwi_disableInterrupt (unsigned int intNum) |
Disable a specific interrupt. More... | |
unsigned int | Hwi_enableInterrupt (unsigned int intNum) |
Enable a specific interrupt. More... | |
void | Hwi_restoreInterrupt (unsigned int intNum, unsigned int key) |
Restore a specific interrupt's enabled/disabled state. More... | |
void | Hwi_clearInterrupt (unsigned int intNum) |
Clear a specific interrupt. More... | |
Hwi_FuncPtr | Hwi_getFunc (Hwi_Handle hwi, uintptr_t *arg) |
Get Hwi function and arg. More... | |
void | Hwi_setFunc (Hwi_Handle hwi, Hwi_FuncPtr fxn, uintptr_t arg) |
Overwrite Hwi function and arg. More... | |
void * | Hwi_getHookContext (Hwi_Handle hwi, int id) |
Get hook instance's context for a Hwi. More... | |
void | Hwi_setHookContext (Hwi_Handle hwi, int id, void *hookContext) |
Set hook instance's context for a Hwi. More... | |
uintptr_t | Hwi_getIrp (Hwi_Handle hwi) |
Get address of interrupted instruction. More... | |
void | Hwi_plug (unsigned int intNum, void *fxn) |
Plug a non dispatched interrupt vector with an ISR address. More... | |
Hwi_Handle | Hwi_getHandle (unsigned int intNum) |
Returns Hwi_handle associated with intNum. More... | |
void | Hwi_setPriority (unsigned int intNum, unsigned int priority) |
Set an interrupt's relative priority. More... | |
void | Hwi_excSetBuffers (void *excContextBuffer, void *excStackBuffer) |
Set the exception context and stack buffer pointers. More... | |
void | Hwi_reconfig (Hwi_Handle hwi, Hwi_FuncPtr fxn, const Hwi_Params *params) |
Reconfigure a dispatched interrupt. More... | |
void | Hwi_Params_init (Hwi_Params *prms) |
Hwi_Handle | Hwi_Object_first (void) |
Hwi_Handle | Hwi_Object_next (Hwi_Object *obj) |
Variables | |
volatile Hwi_NVIC | Hwi_nvic |
Physical Nested Vectored Interrupt Controller Device. short name is "Hwi_nvic" long name is "ti_sysbios_family_arm_m3_Hwi_nvic". More... | |
const int | Hwi_NUM_INTERRUPTS |
The Cortex M0 NVIC supports up to 256 interrupts/exceptions. More... | |
const int | Hwi_NUM_PRIORITIES |
The Cortex M0 NVIC supports up to 256 interrupt priorities. More... | |
const Hwi_ExcHookFunc | Hwi_excHookFunc |
User Exception hook function. More... | |
const unsigned int | Hwi_disablePriority |
The priority that BASEPRI is set to by Hwi_disable(). More... | |
const unsigned int | Hwi_priGroup |
The PRIGROUP setting. Default is 0. More... | |
const unsigned int | Hwi_numSparseInterrupts |
If Hwi.dispatchTableSize is initialized by the user then Hwi.numSparseInterrupts is set to the value of Hwi.dispatchTableSize. More... | |
#define Hwi_E_badIntNum "intnum: %d is out of range" |
Error raised Error raised if an attempt is made to create a Hwi with an interrupt number greater than Hwi_NUM_INTERRUPTS - 1.
#define Hwi_E_alreadyDefined "Hwi already defined: intr# %d" |
Error raised when a Hwi is already defined.
#define Hwi_E_hwiLimitExceeded "Too many interrupts defined" |
Error raised when the number of interrupts being created exceeds the number supported.
#define Hwi_E_exception "hardware exception id = %d, pc = 0x%08x" |
Error raised when an exception occurs.
#define Hwi_E_noIsr "no ISR, id = %d, pc = 0x%08x" |
Error raised when an uninitialized interrupt occurs.
#define Hwi_E_NMI "NMI: %s" |
Error raised when NMI exception occurs.
#define Hwi_E_hardFault "Hard-fault: %s" |
Error raised when hard fault exception occurs.
#define Hwi_E_memFault "Mem-fault: %s, addresss: 0x%08x" |
Error raised when memory fault exception occurs.
#define Hwi_E_busFault "Bus-fault: %s, address: 0x%08x" |
Error raised when bus fault exception occurs.
#define Hwi_E_usageFault "Usage-fault: %s" |
Error raised when usage fault exception occurs.
#define Hwi_E_svCall "SvCall: svNum = %d" |
Error raised when svCall exception occurs.
#define Hwi_E_debugMon "Debug-monitor: %s" |
Error raised when debugMon exception occurs.
#define Hwi_E_reserved "reserved %s %d" |
Error raised when reserved exceptions occur.
#define Hwi_E_stackOverflow "ISR stack overflow" |
Error raised when the ISR stack has overflowed.
typedef struct Hwi_Struct Hwi_Struct |
typedef struct Hwi_Struct Hwi_Object |
typedef Hwi_Struct* Hwi_Handle |
typedef Hwi_Struct* Hwi_Instance |
typedef struct Hwi_HookSet Hwi_HookSet |
Hwi hook set type definition.
The functions that make up a hookSet have certain restrictions. They cannot call any Hwi instance functions other than Hwi_getHookContext() and Hwi_setHookContext(). For all practical purposes, they should treat the Hwi_Handle passed to these functions as an opaque handle.
typedef struct Hwi_Module_State Hwi_Module_State |
typedef struct Hwi_Params Hwi_Params |
typedef struct Hwi_ExcContext Hwi_ExcContext |
Exception Context - Register contents at the time of an exception.
typedef struct Hwi_StackInfo Hwi_StackInfo |
Structure contains Hwi stack usage info.
Used by getStackInfo() and viewGetStackInfo() functions
typedef void(* Hwi_FuncPtr) (uintptr_t) |
Hwi create function type definition.
typedef void(* Hwi_VectorFuncPtr) (void) |
Hwi vector function type definition.
typedef void(* Hwi_ExceptionHookFuncPtr) (Hwi_ExcContext *arg1) |
Exception hook function type definition.
typedef enum Hwi_MaskingOption Hwi_MaskingOption |
Shorthand interrupt masking options.
typedef void(* Hwi_ExcHandlerFuncPtr) (unsigned int *arg1, unsigned int arg2) |
Hwi exception handler function type definition.
enum Hwi_MaskingOption |
Interrupt masking options.
unsigned int Hwi_Disable | ( | ) |
Globally disable interrupts.
Hwi_disable globally disables hardware interrupts and returns an opaque key indicating whether interrupts were globally enabled or disabled on entry to Hwi_disable(). The actual value of the key is target/device specific and is meant to be passed to Hwi_restore().
Call Hwi_disable before a portion of a function that needs to run without interruption. When critical processing is complete, call Hwi_restore or Hwi_enable to reenable hardware interrupts.
Servicing of interrupts that occur while interrupts are disabled is postponed until interrupts are reenabled. However, if the same type of interrupt occurs several times while interrupts are disabled, the interrupt's function is executed only once when interrupts are reenabled.
A context switch can occur when calling Hwi_enable or Hwi_restore if an enabled interrupt occurred while interrupts are disabled.
Hwi_disable may be called from main(). However, since Hwi interrupts are already disabled in main(), such a call has no effect.
opaque | uint32_t key for use by Hwi_restore() |
unsigned int Hwi_Enable | ( | ) |
Globally enable interrupts.
Hwi_enable()
Hwi_enable globally enables hardware interrupts and returns an opaque key indicating whether interrupts were globally enabled or disabled on entry to Hwi_enable(). The actual value of the key is target/device specific and is meant to be passed to Hwi_restore().
This function is called within BIOS_start() to enable interrupts after "main()" has been executed. Prior to BIOS_start(), interrupts are globally disabled.
Hardware interrupts are enabled unless a call to Hwi_disable() disables them.
Servicing of interrupts that occur while interrupts are disabled is postponed until interrupts are reenabled. However, if the same type of interrupt occurs several times while interrupts are disabled, the interrupt's function is executed only once when interrupts are reenabled.
A context switch can occur when calling Hwi_enable or Hwi_restore if an enabled interrupt occurred while interrupts are disabled.
Any call to Hwi_enable enables interrupts, even if Hwi_disable has been called several times.
Hwi_enable must not be called from within "main()".
void Hwi_Restore | ( | uint32_t | key | ) |
restore global interrupts to the state they were in prior Hwi_disable().
Hwi_restore(key)
Globally restore interrupts.
Hwi_restore() globally restores interrupts to the state determined by the key argument provided by a previous invocation of Hwi_disable().
A context switch may occur when calling Hwi_restore if Hwi_restore() reenables interrupts and another Hwi occurred while interrupts were disabled.
The Hwi_disable() / Hwi_restore() pair may be called from within main(). However, since interrupts are globally disabled prior to main(), the call to Hwi_restore() has no effect.
Hwi_Handle Hwi_create | ( | int | intNum, |
Hwi_FuncPtr | hwiFxn, | ||
const Hwi_Params * | prms, | ||
Error_Block * | eb | ||
) |
Hwi_Handle Hwi_construct | ( | Hwi_Struct * | obj, |
int | intNum, | ||
Hwi_FuncPtr | hwiFxn, | ||
const Hwi_Params * | prms, | ||
Error_Block * | eb | ||
) |
void Hwi_delete | ( | Hwi_Handle * | handle | ) |
void Hwi_destruct | ( | Hwi_Struct * | obj | ) |
bool Hwi_getStackInfo | ( | Hwi_StackInfo * | stkInfo, |
bool | computeStackDepth | ||
) |
Get Hwi stack usage Info.
getStackInfo returns the Hwi stack usage info to its calling function by filling stack base address, stack size and stack peak fields in the Hwi_StackInfo structure.
getStackInfo accepts two arguments, a pointer to a structure of type Hwi_StackInfo and a boolean. If the boolean is set to true, the function computes the stack depth and fills the stack peak field in the StackInfo structure. If a stack overflow is detected, the stack depth is not computed. If the boolean is set to false, the function only checks for a stack overflow.
The isr stack is always checked for an overflow and a boolean is returned to indicate whether an overflow occured.
Below is an example of calling getStackInfo() API:
stkInfo | pointer to stack info structure |
computeStackDepth | decides whether to compute stack depth |
boolean | to indicate a stack overflow |
void Hwi_post | ( | unsigned int | intNum | ) |
Generate an interrupt for test purposes.
intNum | ID of interrupt to generate |
unsigned int Hwi_disableInterrupt | ( | unsigned int | intNum | ) |
Disable a specific interrupt.
Disable a specific interrupt identified by an interrupt number.
intNum | interrupt number to disable |
key | to restore previous enable/disable state |
unsigned int Hwi_enableInterrupt | ( | unsigned int | intNum | ) |
Enable a specific interrupt.
Enables a specific interrupt identified by an interrupt number.
intNum | interrupt number to enable |
key | to restore previous enable/disable state |
void Hwi_restoreInterrupt | ( | unsigned int | intNum, |
unsigned int | key | ||
) |
Restore a specific interrupt's enabled/disabled state.
Restores a specific interrupt identified by an interrupt number. restoreInterrupt is generally used to restore an interrupt to its state before Hwi_disableInterrupt or Hwi_enableInterrupt was invoked.
intNum | interrupt number to restore |
key | key returned from enableInt or disableInt |
void Hwi_clearInterrupt | ( | unsigned int | intNum | ) |
Clear a specific interrupt.
Clears a specific interrupt's pending status. The implementation is family- specific.
intNum | interrupt number to clear |
Hwi_FuncPtr Hwi_getFunc | ( | Hwi_Handle | hwi, |
uintptr_t * | arg | ||
) |
Get Hwi function and arg.
hwi | Hwi handle |
arg | pointer for returning hwi's ISR function argument |
hwi's | ISR function |
void Hwi_setFunc | ( | Hwi_Handle | hwi, |
Hwi_FuncPtr | fxn, | ||
uintptr_t | arg | ||
) |
Overwrite Hwi function and arg.
Replaces a Hwi object's hwiFxn function originally provided in Hwi_create.
To guard against this condition, surround the Hwi_setFunc() call with calls to Hwi_disable() and Hwi_restore():
hwi | Hwi handle |
fxn | pointer to ISR function |
arg | argument to ISR function |
void* Hwi_getHookContext | ( | Hwi_Handle | hwi, |
int | id | ||
) |
Get hook instance's context for a Hwi.
hwi | Hwi handle |
id | hook id |
hook | instance's context for hwi |
void Hwi_setHookContext | ( | Hwi_Handle | hwi, |
int | id, | ||
void * | hookContext | ||
) |
Set hook instance's context for a Hwi.
hwi | Hwi handle |
id | hook id |
hookContext | value to write to context |
uintptr_t Hwi_getIrp | ( | Hwi_Handle | hwi | ) |
Get address of interrupted instruction.
hwi | Hwi handle |
most | current IRP of a Hwi |
void Hwi_plug | ( | unsigned int | intNum, |
void * | fxn | ||
) |
Plug a non dispatched interrupt vector with an ISR address.
Used internally by Hwi_create() and Hwi_construct().
This API is provided for external use primarily to allow users to plug the NMI vector (interrupt #2) at runtime.
intNum | interrupt number |
fxn | pointer to ISR function |
Hwi_Handle Hwi_getHandle | ( | unsigned int | intNum | ) |
Returns Hwi_handle associated with intNum.
intNum | interrupt number |
Hwi | handle |
void Hwi_setPriority | ( | unsigned int | intNum, |
unsigned int | priority | ||
) |
Set an interrupt's relative priority.
Valid priorities are 0 - 255. 0 is highest priority.
intNum | ID of interrupt |
priority | priority |
void Hwi_excSetBuffers | ( | void * | excContextBuffer, |
void * | excStackBuffer | ||
) |
Set the exception context and stack buffer pointers.
excContextBuffer | Address to place ExcContext |
excStackBuffer | Address to place ExcStack |
void Hwi_reconfig | ( | Hwi_Handle | hwi, |
Hwi_FuncPtr | fxn, | ||
const Hwi_Params * | params | ||
) |
Reconfigure a dispatched interrupt.
hwi | Hwi handle |
fxn | Hwi function |
params | pointer to Hwi params structure |
void Hwi_Params_init | ( | Hwi_Params * | prms | ) |
Hwi_Handle Hwi_Object_first | ( | void | ) |
Hwi_Handle Hwi_Object_next | ( | Hwi_Object * | obj | ) |
volatile Hwi_NVIC Hwi_nvic |
Physical Nested Vectored Interrupt Controller Device. short name is "Hwi_nvic" long name is "ti_sysbios_family_arm_m3_Hwi_nvic".
const int Hwi_NUM_INTERRUPTS |
The Cortex M0 NVIC supports up to 256 interrupts/exceptions.
The actual number supported is device specific and provided by the catalog device specification.
const int Hwi_NUM_PRIORITIES |
The Cortex M0 NVIC supports up to 256 interrupt priorities.
The actual number supported is device specific and provided by the catalog device specification.
const Hwi_ExcHookFunc Hwi_excHookFunc |
User Exception hook function.
Called just after the exception context has been initialized.
This function will be run on the ISR stack.
This function must run to completion.
It is called without any Task or Swi scheduling protection and therefore can not call any functions that may cause a Swi or Task scheduling operation (Swi_post(), Semaphore_post(), Event_post(), etc).
const unsigned int Hwi_disablePriority |
The priority that BASEPRI is set to by Hwi_disable().
All interrupts configured with equal or less priority (equal or higher number) than disablePriority are disabled by Hwi_disable. Interrupts configured with higher priority (smaller number) than Hwi.disablePriority are non-maskable (ie zero-latency).
The default setting is the second highest interrupt priority defined for the device (typically '0x20' for devices which support 8 priority values). This results in priority 0 (and all other values in the same priority group, ie 0x00 thru 0x1f) being the zero-latency, non-maskable interrupt priority. All other priorities are disabled with Hwi_disable().
The constant Hwi_disablePriority is configured within the app.syscfg file using the following syntax:
const unsigned int Hwi_priGroup |
The PRIGROUP setting. Default is 0.
This value will be written to the PRIGROUP field within the NVIC's Application Interrupt and Reset Control Register (Hwi_nvic.AIRCR). It defines how the 8 bit priority values are interpreted by the hardware.
Valid settings are 0-7.
The default setting of 0 causes bits 7-1 of an interrupt's priority value to be used as pre-emption priority, while bit 0 is used to determine which of two simultaneous interrupts with the same pre-emption priority will be serviced first.
For most TI MCU devices, this means that each of the 8 supported priority values are unique pre-emption priorities and are not subdivided into priority groups.
See the "AIRCR" register description in the Arm "Cortex M4 Devices Generic User Guide" for more details regarding priority groups.
The constant Hwi_priGroup is configured within the app.syscfg file using the following syntax:
const unsigned int Hwi_numSparseInterrupts |
If Hwi.dispatchTableSize is initialized by the user then Hwi.numSparseInterrupts is set to the value of Hwi.dispatchTableSize.
If Hwi.dispatchTableSize is NOT set by the user, the normal intNum-indexed Hwi dispatchTable mechanism is used by the dispatcher to find the corresponding Hwi object.
If Hwi.dispatchTableSize is set by the user, then a RAM-based fixed sized interrupt jump table is generated that contains a repeating pattern of the following 3 word assembly code snippets:
hwiX: ldr r3, hwiObjectX ldr pc, ti_sysbios_family_arm_v6m_Hwi_dispatch__I hwiObjectX: .word 0 hwiY: ldr r3, hwiObjectY ldr pc, ti_sysbios_family_arm_v6m_Hwi_dispatch__I hwiObjectY: .word 0
Each dispatched interrupt vector is then initialized to point to one of these tuples, and the address of the corresponding Hwi object is written into the hwiObjectX field.
The low level assembly code in Hwi_dispatch__I preserves the value of r3 when it calls Hwi_dispatchC(), which results in the Hwi object being passed as the arg3.
Depending on the boolean value of Hwi_numSparseInterrupts, the dispatcher either uses the value passed in arg3 as the Hwi object, or uses intNum to index into the standard dispatchTable to fetch the Hwi object.