EE445M RTOS
Taken at the University of Texas Spring 2015
Sysexc_api

Functions

static uint32_t _SysExcIntNumberGet (void)
 
void SysExcIntRegister (void(*pfnHandler)(void))
 
void SysExcIntUnregister (void)
 
void SysExcIntEnable (uint32_t ui32IntFlags)
 
void SysExcIntDisable (uint32_t ui32IntFlags)
 
uint32_t SysExcIntStatus (bool bMasked)
 
void SysExcIntClear (uint32_t ui32IntFlags)
 

Detailed Description

Function Documentation

static uint32_t _SysExcIntNumberGet ( void  )
static

Returns the interrupt number for a system exception.

This function returns the interrupt number for a system exception.

Returns
Returns the system exception interrupt number.

Definition at line 66 of file sysexc.c.

References CLASS_IS_TM4C123, CLASS_IS_TM4C129, INT_SYSEXC_TM4C123, and INT_SYSEXC_TM4C129.

Referenced by SysExcIntRegister(), and SysExcIntUnregister().

67 {
68  uint32_t ui32Int;
69 
70  //
71  // Get the interrupt number based on the class.
72  //
74  {
75  ui32Int = INT_SYSEXC_TM4C123;
76  }
77  else if(CLASS_IS_TM4C129)
78  {
79  ui32Int = INT_SYSEXC_TM4C129;
80  }
81  else
82  {
83  ui32Int = 0;
84  }
85  return(ui32Int);
86 }
#define INT_SYSEXC_TM4C129
Definition: hw_ints.h:243
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
#define INT_SYSEXC_TM4C123
Definition: hw_ints.h:143
#define CLASS_IS_TM4C129
Definition: hw_types.h:99

Here is the caller graph for this function:

void SysExcIntClear ( uint32_t  ui32IntFlags)

Clears system exception interrupt sources.

Parameters
ui32IntFlagsis a bit mask of the interrupt sources to be cleared.

This function clears the specified system exception interrupt sources, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.

The ui32IntFlags parameter is the logical OR of any of the following:

  • SYSEXC_INT_FP_IXC - Floating-point inexact exception interrupt
  • SYSEXC_INT_FP_OFC - Floating-point overflow exception interrupt
  • SYSEXC_INT_FP_UFC - Floating-point underflow exception interrupt
  • SYSEXC_INT_FP_IOC - Floating-point invalid operation interrupt
  • SYSEXC_INT_FP_DZC - Floating-point divide by zero exception interrupt
  • SYSEXC_INT_FP_IDC - Floating-point input denormal exception interrupt
Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Returns
None.

Definition at line 298 of file sysexc.c.

References HWREG, and SYSEXC_IC.

299 {
300  //
301  // Clear the requested interrupt sources.
302  //
303  HWREG(SYSEXC_IC) = ui32IntFlags;
304 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSEXC_IC
Definition: hw_sysexc.h:54
void SysExcIntDisable ( uint32_t  ui32IntFlags)

Disables individual system exception interrupt sources.

Parameters
ui32IntFlagsis the bit mask of the interrupt sources to be disabled.

This function disables the indicated system exception interrupt sources. Only sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter is the logical OR of any of the following:

  • SYSEXC_INT_FP_IXC - Floating-point inexact exception interrupt
  • SYSEXC_INT_FP_OFC - Floating-point overflow exception interrupt
  • SYSEXC_INT_FP_UFC - Floating-point underflow exception interrupt
  • SYSEXC_INT_FP_IOC - Floating-point invalid operation interrupt
  • SYSEXC_INT_FP_DZC - Floating-point divide by zero exception interrupt
  • SYSEXC_INT_FP_IDC - Floating-point input denormal exception interrupt
Returns
None.

Definition at line 223 of file sysexc.c.

References HWREG, and SYSEXC_IM.

224 {
225  //
226  // Disable the specified interrupts.
227  //
228  HWREG(SYSEXC_IM) &= ~(ui32IntFlags);
229 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSEXC_IM
Definition: hw_sysexc.h:51
void SysExcIntEnable ( uint32_t  ui32IntFlags)

Enables individual system exception interrupt sources.

Parameters
ui32IntFlagsis the bit mask of the interrupt sources to be enabled.

This function enables the indicated system exception interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter is the logical OR of any of the following:

  • SYSEXC_INT_FP_IXC - Floating-point inexact exception interrupt
  • SYSEXC_INT_FP_OFC - Floating-point overflow exception interrupt
  • SYSEXC_INT_FP_UFC - Floating-point underflow exception interrupt
  • SYSEXC_INT_FP_IOC - Floating-point invalid operation interrupt
  • SYSEXC_INT_FP_DZC - Floating-point divide by zero exception interrupt
  • SYSEXC_INT_FP_IDC - Floating-point input denormal exception interrupt
Returns
None.

Definition at line 191 of file sysexc.c.

References HWREG, and SYSEXC_IM.

192 {
193  //
194  // Enable the specified interrupts.
195  //
196  HWREG(SYSEXC_IM) |= ui32IntFlags;
197 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSEXC_IM
Definition: hw_sysexc.h:51
void SysExcIntRegister ( void(*)(void)  pfnHandler)

Registers an interrupt handler for the system exception interrupt.

Parameters
pfnHandleris a pointer to the function to be called when the system exception interrupt occurs.

This function places the address of the system exception interrupt handler into the interrupt vector table in SRAM. This function also enables the global interrupt in the interrupt controller; specific system exception interrupts must be enabled via SysExcIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

Definition at line 108 of file sysexc.c.

References _SysExcIntNumberGet(), ASSERT, IntEnable(), and IntRegister().

109 {
110  uint32_t ui32Int;
111 
112  //
113  // Get the system exception interrupt number.
114  //
115  ui32Int = _SysExcIntNumberGet();
116 
117  ASSERT(ui32Int != 0);
118 
119  //
120  // Register the interrupt handler.
121  //
122  IntRegister(ui32Int, pfnHandler);
123 
124  //
125  // Enable the system exception interrupt.
126  //
127  IntEnable(ui32Int);
128 }
#define ASSERT(expr)
Definition: debug.h:67
static uint32_t _SysExcIntNumberGet(void)
Definition: sysexc.c:66
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:309
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610

Here is the call graph for this function:

uint32_t SysExcIntStatus ( bool  bMasked)

Gets the current system exception interrupt status.

Parameters
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function returns the system exception interrupt status. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Returns
Returns the current system exception interrupt status, enumerated as the logical OR of SYSEXC_INT_FP_IXC, SYSEXC_INT_FP_OFC, SYSEXC_INT_FP_UFC, SYSEXC_INT_FP_IOC, SYSEXC_INT_FP_DZC, and SYSEXC_INT_FP_IDC.

Definition at line 249 of file sysexc.c.

References HWREG, SYSEXC_MIS, and SYSEXC_RIS.

250 {
251  //
252  // Return either the interrupt status or the raw interrupt status as
253  // requested.
254  //
255  if(bMasked)
256  {
257  return(HWREG(SYSEXC_MIS));
258  }
259  else
260  {
261  return(HWREG(SYSEXC_RIS));
262  }
263 }
#define HWREG(x)
Definition: hw_types.h:48
#define SYSEXC_MIS
Definition: hw_sysexc.h:52
#define SYSEXC_RIS
Definition: hw_sysexc.h:49
void SysExcIntUnregister ( void  )

Unregisters the system exception interrupt handler.

This function removes the system exception interrupt handler from the vector table in SRAM. This function also masks off the system exception interrupt in the interrupt controller so that the interrupt handler is no longer called.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

Definition at line 146 of file sysexc.c.

References _SysExcIntNumberGet(), ASSERT, IntDisable(), and IntUnregister().

147 {
148  uint32_t ui32Int;
149 
150  //
151  // Get the system exception interrupt number.
152  //
153  ui32Int = _SysExcIntNumberGet();
154 
155  ASSERT(ui32Int != 0);
156 
157  //
158  // Disable the system exception interrupt.
159  //
160  IntDisable(ui32Int);
161 
162  //
163  // Unregister the system exception interrupt handler.
164  //
165  IntUnregister(ui32Int);
166 }
#define ASSERT(expr)
Definition: debug.h:67
static uint32_t _SysExcIntNumberGet(void)
Definition: sysexc.c:66
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684

Here is the call graph for this function: