libtonc: Interrupt

Tonclib

Interrupt

Hardware interrupt management. More...

Data Structures

struct  IRQ_REC
 Struct for prioritized irq table. More...

Options for irq_set

#define ISR_LAST   0x0040
 Last isr in line (Lowest priority).
#define ISR_REPLACE   0x0080
 Replace old isr if existing (prio ignored).
#define ISR_PRIO_MASK   0x003F
 Last isr in line (Lowest priority).
#define ISR_PRIO_SHIFT   0
 Last isr in line (Lowest priority).
#define ISR_PRIO(n)   ((n)<<ISR_PRIO_SHIFT)
 Last isr in line (Lowest priority).
#define ISR_DEF   (ISR_LAST|ISR_REPLACE)
 Last isr in line (Lowest priority).

Defines

#define IRQ_INIT()   irq_init(NULL)
 Default irq_init() call: use irq_master_nest() for switchboard.
#define IRQ_SET(irq_id)   irq_set(II_##irq_id, NULL, ISR_DEF)
 Default irq_set() call: no isr, add to back of priority stack.
#define IRQ_ADD(irq_id)   irq_add(II_##irq_id, NULL)

Enumerations

enum  eIrqIndex {
  II_VBLANK = 0, II_HBLANK, II_VCOUNT, II_TIMER0,
  II_TIMER1, II_TIMER2, II_TIMER3, II_SERIAL,
  II_DMA0, II_DMA1, II_DMA2, II_DMA3,
  II_KEYPAD, II_GAMEPAK, II_MAX
}
 IRQ indices, to be used in most functions.

Functions

IWRAM_CODE void isr_master (void)
IWRAM_CODE void isr_master_nest (void)
void irq_init (fnptr isr)
 Initialize irq business.
fnptr irq_set_master (fnptr isr)
 Set a master ISR.
fnptr irq_add (enum eIrqIndex irq_id, fnptr isr)
 Add a specific ISR.
fnptr irq_delete (enum eIrqIndex irq_id)
 Remove an ISR.
fnptr irq_set (enum eIrqIndex irq_id, fnptr isr, u32 opts)
 General IRQ manager.
void irq_enable (enum eIrqIndex irq_id)
void irq_disable (enum eIrqIndex irq_id)

Variables

IRQ_REC __isr_table [II_MAX+1]

Detailed Description

Hardware interrupt management.

For details, see tonc:irq


Function Documentation

fnptr irq_add ( enum eIrqIndex  irq_id,
fnptr  isr 
)

Add a specific ISR.

Special case of irq_set. If the interrupt has an ISR already it'll be replaced; if not it will add it in the back.

Parameters:
irq_id Index of irq.
isr Interrupt service routine for this irq; can be NULL
Returns:
Previous ISR
Note:
irq_id is NOT a bit-mask, it is an index!

fnptr irq_delete ( enum eIrqIndex  irq_id  ) 

Remove an ISR.

it'll be replaced; if not it will add it in the back.

Parameters:
irq_id Index of irq.
Returns:
Previous ISR
Note:
irq_id is NOT a bit-mask, it is an index!

void irq_init ( fnptr  isr  ) 

Initialize irq business.

Clears ISR table and sets up a master isr.

Parameters:
isr Master ISR. If NULL, isr_master_nest is used

fnptr irq_set ( enum eIrqIndex  irq_id,
fnptr  isr,
u32  opts 
)

General IRQ manager.

This routine manages the ISRs of interrupts and their priorities.

Parameters:
irq_id Index of irq.
isr Interrupt service routine for this irq; can be NULL
opts ISR options
Returns:
Previous specific ISR
Note:
irq_id is NOT a bit-mask, it is an index!

fnptr irq_set_master ( fnptr  isr  ) 

Set a master ISR.

Parameters:
isr Master ISR. If NULL, isr_master_multi is used
Returns:
Previous master ISR


Generated on Mon Aug 25 17:03:56 2008 for libtonc by  doxygen 1.5.3