Functions

Interrupt control
[Cooperative scheduler]

Interrupt control. More...

Functions

int BZ_IrqDisable (int irq)
 Disable or enable the IRQ interrupt.
int BZ_FiqDisable (int fiq)
 Disable or enable the FIQ interrupt.
int BZ_SwapWord (int data, int *addr)
 Atomic swap with a memory word.
char BZ_SwapByte (char data, char *addr)
 Atomic swap with a memory byte.

Detailed Description

Interrupt control.

When dealing with hardware, you often must disable interrupts for short intervals. The kernel provides functions that allow you to enable and disable them. Furthermore, even though the kernel does not support the fast interrupt mechanism of the ARM core, it provides the functions to enable and disable FIQ, in case you want to implement your own FIQ handler. In addition, the atomic swap with a memory word is also provided.


Function Documentation

int BZ_FiqDisable ( int  fiq  ) 

Disable or enable the FIQ interrupt.

The function disables or enables the FIQ interrupt and returns its status prior to the effect of the function.

Parameters:
fiq The desiredt state of the FIQ disable flag. If the parameter is 0 (i.e. false), then the FIQ will be enabled. If it is non-0, then FIQ interrupts will be disabled.
Returns:
The interrupt status before the operation. If the interrupt was enabled before the call, then the returned value is 0, if it was disabled, then a non-0 value.
int BZ_IrqDisable ( int  irq  ) 

Disable or enable the IRQ interrupt.

The function disables or enables the IRQ interrupt and returns its status prior to the effect of the function.

Parameters:
irq The desiredt state of the IRQ disable flag. If the parameter is 0 (i.e. false), then the IRQ will be enabled. If it is non-0, then IRQ interrupts will be disabled.
Returns:
The interrupt status before the operation. If the interrupt was enabled before the call, then the returned value is 0, if it was disabled, then a non-0 value.
Attention:
The kernel's interrupt system can not handle nested interrupts. Modifying the interrupt enable bit in an interrupt handler is likely to cause a system crash.
char BZ_SwapByte ( char  data,
char *  addr 
)

Atomic swap with a memory byte.

The function stores its first argument at the byte in memory pinted by its second argument and returns the content of the memory byte before the store. The reading of the memory byte and the subsequent writing of the argument into it is atomic, not even a DMA operation can interveen between the two accesses.

Parameters:
data The data to be stored in the memory byte
addr The address of the memory byte
Returns:
The previous content of the memory byte
int BZ_SwapWord ( int  data,
int *  addr 
)

Atomic swap with a memory word.

The function stores its first argument at the integer word in memory pointed by its second argument and returns the content of the word before the store. The reading of the memory word and the subsequent writing of the argument into it is atomic, not even a DMA operation can interveen between the two accesses.

Parameters:
data The data to be stored in the memory word
addr The address of the memory word
Returns:
The previous content of the memory word