interrupts.h File Reference

nds interrupt support. More...

#include <nds/ndstypes.h>

Defines

#define IRQ_TIMER(n)   (1 << ((n) + 3))
 returns the mask for a given timer.
#define MAX_INTERRUPTS   25
 maximum number of interrupts.
#define REG_IE   (*(vuint32*)0x04000210)
 Interrupt Enable Register.
#define REG_IF   (*(vuint32*)0x04000214)
 Interrupt Flag Register.
#define REG_IME   (*(vuint32*)0x04000208)
 Interrupt Master Enable Register.

Enumerations

enum  IME_VALUE {
  IME_DISABLE = 0,
  IME_ENABLE = 1
}
 

values allowed for REG_IME

More...
enum  IRQ_MASKS {
  IRQ_VBLANK = BIT(0),
  IRQ_HBLANK = BIT(1),
  IRQ_VCOUNT = BIT(2),
  IRQ_TIMER0 = BIT(3),
  IRQ_TIMER1 = BIT(4),
  IRQ_TIMER2 = BIT(5),
  IRQ_TIMER3 = BIT(6),
  IRQ_NETWORK = BIT(7),
  IRQ_DMA0 = BIT(8),
  IRQ_DMA1 = BIT(9),
  IRQ_DMA2 = BIT(10),
  IRQ_DMA3 = BIT(11),
  IRQ_KEYS = BIT(12),
  IRQ_CART = BIT(13),
  IRQ_IPC_SYNC = BIT(16),
  IRQ_FIFO_EMPTY = BIT(17),
  IRQ_FIFO_NOT_EMPTY = BIT(18),
  IRQ_CARD = BIT(19),
  IRQ_CARD_LINE = BIT(20),
  IRQ_GEOMETRY_FIFO = BIT(21),
  IRQ_LID = BIT(22),
  IRQ_SPI = BIT(23),
  IRQ_WIFI = BIT(24),
  IRQ_ALL = (~0)
}
 

values allowed for REG_IE and REG_IF

More...
enum  IRQ_MASKSAUX { IRQ_POWER = BIT(6) }
 

values allowed for REG_AUXIE and REG_AUXIF

More...

Functions

void irqClear (u32 irq)
 remove the handler associated with the interrupt mask irq.
void irqDisable (u32 irq)
 Prevent the given interrupt from occuring.
void irqEnable (u32 irq)
 Allow the given interrupt to occur.
void irqInit ()
 Initialise the libnds interrupt system.
void irqInitHandler (VoidFn handler)
 Install a user interrupt dispatcher.
void irqSet (u32 irq, VoidFn handler)
 Add a handler for the given interrupt mask.
void swiIntrWait (u32 waitForSet, uint32 flags)
 wait for interrupt(s) to occur
void swiWaitForVBlank (void)
 Wait for vblank interrupt.

Detailed Description

nds interrupt support.


Define Documentation

#define IRQ_TIMER (  )     (1 << ((n) + 3))

returns the mask for a given timer.

Parameters:
n the timer.
Returns:
the bitmask.
#define REG_IE   (*(vuint32*)0x04000210)

Interrupt Enable Register.

This is the activation mask for the internal interrupts. Unless the corresponding bit is set, the IRQ will be masked out.

#define REG_IF   (*(vuint32*)0x04000214)

Interrupt Flag Register.

Since there is only one hardware interrupt vector, the IF register contains flags to indicate when a particular of interrupt has occured. To acknowledge processing interrupts, set IF to the value of the interrupt handled.

#define REG_IME   (*(vuint32*)0x04000208)

Interrupt Master Enable Register.

When bit 0 is clear, all interrupts are masked. When it is 1, interrupts will occur if not masked out in REG_IE.


Enumeration Type Documentation

enum IME_VALUE

values allowed for REG_IME

Enumerator:
IME_DISABLE 

Disable all interrupts.

IME_ENABLE 

Enable all interrupts not masked out in REG_IE

enum IRQ_MASKS

values allowed for REG_IE and REG_IF

Enumerator:
IRQ_VBLANK 

vertical blank interrupt mask

IRQ_HBLANK 

horizontal blank interrupt mask

IRQ_VCOUNT 

vcount match interrupt mask

IRQ_TIMER0 

timer 0 interrupt mask

IRQ_TIMER1 

timer 1 interrupt mask

IRQ_TIMER2 

timer 2 interrupt mask

IRQ_TIMER3 

timer 3 interrupt mask

IRQ_NETWORK 

serial interrupt mask

IRQ_DMA0 

DMA 0 interrupt mask

IRQ_DMA1 

DMA 1 interrupt mask

IRQ_DMA2 

DMA 2 interrupt mask

IRQ_DMA3 

DMA 3 interrupt mask

IRQ_KEYS 

Keypad interrupt mask

IRQ_CART 

GBA cartridge interrupt mask

IRQ_IPC_SYNC 

IPC sync interrupt mask

IRQ_FIFO_EMPTY 

Send FIFO empty interrupt mask

IRQ_FIFO_NOT_EMPTY 

Receive FIFO not empty interrupt mask

IRQ_CARD 

interrupt mask DS Card Slot

IRQ_CARD_LINE 

interrupt mask

IRQ_GEOMETRY_FIFO 

geometry FIFO interrupt mask

IRQ_LID 

interrupt mask DS hinge

IRQ_SPI 

SPI interrupt mask

IRQ_WIFI 

WIFI interrupt mask (ARM7)

IRQ_ALL 

'mask' for all interrupt

values allowed for REG_AUXIE and REG_AUXIF

Enumerator:
IRQ_POWER 

Power Button interrupt mask (DSi ARM7)


Function Documentation

irqClear ( u32  irq  ) 

remove the handler associated with the interrupt mask irq.

Parameters:
irq Mask associated with the interrupt.
irqDisable ( u32  irq  ) 

Prevent the given interrupt from occuring.

Parameters:
irq The set of interrupt masks to disable.
Note:
Specify multiple interrupts to disable by ORing several IRQ_MASKS.
irqEnable ( u32  irq  ) 

Allow the given interrupt to occur.

Parameters:
irq The set of interrupt masks to enable.
Note:
Specify multiple interrupts to enable by ORing several IRQ_MASKS.
Examples:
audio/maxmod/streaming/source/main.c.
irqInit (  ) 

Initialise the libnds interrupt system.

This function is called internally (prior to main()) to set up irqs on the ARM9. It must be called on the ARM7 prior to installing irq handlers.

irqInitHandler ( VoidFn  handler  ) 

Install a user interrupt dispatcher.

This function installs the main interrupt function, all interrupts are serviced through this routine. For most purposes the libnds interrupt dispacther should be used in preference to user code unless you know *exactly* what you're doing.

Parameters:
handler Address of the function to use as an interrupt dispatcher
Note:
the function *must* be ARM code
irqSet ( u32  irq,
VoidFn  handler 
)

Add a handler for the given interrupt mask.

Specify the handler to use for the given interrupt. This only works with the default interrupt handler, do not mix the use of this routine with a user-installed IRQ handler.

Parameters:
irq Mask associated with the interrupt.
handler Address of the function to use as an interrupt service routine
Note:
When any handler specifies using IRQ_VBLANK or IRQ_HBLANK, DISP_SR is automatically updated to include the corresponding DISP_VBLANK_IRQ or DISP_HBLANK_IRQ.
Warning:
Only one IRQ_MASK can be specified with this function.
Examples:
hello_world/source/main.cpp.
swiIntrWait ( u32  waitForSet,
uint32  flags 
)

wait for interrupt(s) to occur

Parameters:
waitForSet 0: Return if the interrupt has already occured 1: Wait until the interrupt has been set since the call
flags interrupt mask to wait for
Examples:
audio/maxmod/streaming/source/main.c.
swiWaitForVBlank ( void   ) 

Wait for vblank interrupt.

Waits for a vertical blank interrupt

Note:
Identical to calling swiIntrWait(1, 1)
Examples:
audio/maxmod/audio_modes/source/main.c, audio/maxmod/basic_sound/source/MaxModExample.c, audio/maxmod/reverb/source/main.c, audio/maxmod/song_events_example/source/template.c, audio/maxmod/song_events_example2/source/template.c, audio/maxmod/streaming/source/main.c, audio/micrecord/source/micrecord.c, capture/ScreenShot/source/main.cpp, card/eeprom/source/main.cpp, debugging/exceptionTest/source/exceptionTest.c, ds_motion/source/main.c, dswifi/ap_search/source/template.c, dswifi/autoconnect/source/autoconnect.c, dswifi/httpget/source/httpget.c, filesystem/libfat/libfatdir/source/directory.c, filesystem/nitrofs/nitrodir/source/directory.c, Graphics/3D/3D_Both_Screens/source/template.c, Graphics/3D/BoxTest/source/main.cpp, Graphics/3D/nehe/lesson01/source/nehe1.cpp, Graphics/3D/nehe/lesson02/source/nehe2.cpp, Graphics/3D/nehe/lesson03/source/nehe3.cpp, Graphics/3D/nehe/lesson04/source/nehe4.cpp, Graphics/3D/nehe/lesson05/source/nehe5.cpp, Graphics/3D/nehe/lesson06/source/nehe6.cpp, Graphics/3D/nehe/lesson07/source/nehe7.cpp, Graphics/3D/nehe/lesson08/source/nehe8.cpp, Graphics/3D/nehe/lesson09/source/nehe9.cpp, Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/nehe/lesson10b/source/nehe10b.cpp, Graphics/3D/nehe/lesson11/source/nehe11.cpp, Graphics/3D/Simple_Quad/source/main.cpp, Graphics/3D/Simple_Tri/source/main.cpp, Graphics/3D/Textured_Cube/source/main.cpp, Graphics/3D/Textured_Quad/source/main.cpp, Graphics/3D/Toon_Shading/source/main.cpp, Graphics/Backgrounds/16bit_color_bmp/source/template.cpp, Graphics/Backgrounds/256_color_bmp/source/main.cpp, Graphics/Backgrounds/all_in_one/source/advanced.cpp, Graphics/Backgrounds/all_in_one/source/main.cpp, Graphics/Backgrounds/all_in_one/source/scrolling.cpp, Graphics/Backgrounds/Double_Buffer/source/main.cpp, Graphics/Backgrounds/rotation/source/main.cpp, Graphics/Printing/ansi_console/source/main.c, Graphics/Printing/console_windows/source/main.c, Graphics/Printing/custom_font/source/main.c, Graphics/Printing/print_both_screens/source/template.c, Graphics/Printing/rotscale_text/source/main.c, Graphics/Sprites/allocation_test/source/main.c, Graphics/Sprites/animate_simple/source/template.c, Graphics/Sprites/bitmap_sprites/source/main.cpp, Graphics/Sprites/fire_and_sprites/source/main.cpp, Graphics/Sprites/simple/source/template.c, Graphics/Sprites/sprite_extended_palettes/source/template.c, Graphics/Sprites/sprite_rotate/source/template.c, hello_world/source/main.cpp, input/keyboard/keyboard_async/source/template.c, input/keyboard/keyboard_stdin/source/keymain.c, input/Touch_Pad/touch_area/source/template.c, input/Touch_Pad/touch_test/source/main.c, time/RealTimeClock/source/main.c, time/stopwatch/source/main.c, and time/timercallback/source/main.c.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Sat Oct 2 12:55:13 2010 for libnds by  doxygen 1.6.3