The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoIntManager

Interrupt handling routines. More...

Files

file  SoIntManager.c
file  SoIntManager.h

Interrupt types

#define SO_INTERRUPT_TYPE_VBLANK
#define SO_INTERRUPT_TYPE_HBLANK
#define SO_INTERRUPT_TYPE_VTRIGGER
#define SO_INTERRUPT_TYPE_TIMER_0
#define SO_INTERRUPT_TYPE_TIMER_1
#define SO_INTERRUPT_TYPE_TIMER_2
#define SO_INTERRUPT_TYPE_TIMER_3
#define SO_INTERRUPT_TYPE_SERIAL
#define SO_INTERRUPT_TYPE_DMA_0
#define SO_INTERRUPT_TYPE_DMA_1
#define SO_INTERRUPT_TYPE_DMA_2
#define SO_INTERRUPT_TYPE_DMA_3
#define SO_INTERRUPT_TYPE_KEYPAD
#define SO_INTERRUPT_TYPE_CART
#define SO_NUM_INTERRUPT_TYPES

Typedefs

typedef void(* SoInterruptHandler )(void)
 Interrupt handler type definition;.


Functions

void SoIntManagerInitialize (void)
 Initializes the interrupt manager.

void SoIntManagerSetInterruptHandler (u32 a_InterruptType, SoInterruptHandler a_IntHandler)
 Sets an interrupt;.

void SoIntManagerEnableInterruptMaster (void)
 Enables the master-enable setting for the interrupts.

void SoIntManagerDisableInterruptMaster (void)
 Disables the master-enable setting for the interrupts.

void SoIntManagerEnableInterrupt (u32 a_InterruptType)
 Enables a specific interrupt.

void SoIntManagerDisableInterrupt (u32 a_InterruptType)
 Disables a specific interrupt.

void SoIntManagerInterruptHandler (void)
 The interrupt handler.


Variables

SoInterruptHandler g_InterruptHandlers [SO_NUM_INTERRUPT_TYPES]
 Declared here because we need in both the .C and the assembly.


Detailed Description

Interrupt handling routines.

Singleton

This module contains all functionality to get control over interrupts. It allows you to enable/diable all interrupt processing, and also enable/disable each unique interrupt. You can install a separate interrupt handler (function) for each interrupt type.

One very very important thing to remember is that some interrupts may be used by the SGADE itself. For example, the SoSpriteManager and SoTimer modules use interrupts. These modules will probably even implicitly enable these interrupts. Because of this, you may sometimes find that the interrupt master is enabled even though you never did so. So watch out...


Typedef Documentation

typedef void(* SoInterruptHandler)( void )
 

Interrupt handler type definition;.

This prototype defines interrupt handlers. When you want to install an interrupt handler you have to pass the installer a function of this type. Simply it's just a function with no parameters and which returns nothing.


Function Documentation

void SoIntManagerDisableInterrupt u32    a_InterruptType
 

Disables a specific interrupt.

Parameters:
a_InterruptType  Type of the interrupt you want to disable. This is one of the SO_INTERRUPT_TYPE_ * constants.

void SoIntManagerDisableInterruptMaster void   
 

Disables the master-enable setting for the interrupts.

Disables all interrupts even when they are individually enabled.

void SoIntManagerEnableInterrupt u32    a_InterruptType
 

Enables a specific interrupt.

Parameters:
a_InterruptType  Type of the interrupt you want to enable. This is one of the SO_INTERRUPT_TYPE_ * constants.
Note that if there are no handlers installed for this type, or the master enable is disabled, then nothing will happen.

void SoIntManagerEnableInterruptMaster void   
 

Enables the master-enable setting for the interrupts.

Without the master enabled, no interrupt will function even when you individually enable them.

void SoIntManagerInitialize void   
 

Initializes the interrupt manager.

First function you should call before you use any other function of the interrupt manager.

This function will return immediately if it was called before (cause then the manager is already initialized).

void SoIntManagerInterruptHandler void   
 

The interrupt handler.

For internal use only.

This is the function that is called when an interrupt occurs. It checks what interrupt occured and calls the installed interrupt handler for that specific interrupt type.

void SoIntManagerSetInterruptHandler u32    a_InterruptType,
SoInterruptHandler    a_IntHandler
 

Sets an interrupt;.

Parameters:
a_InterruptType  Type of the interrupt you want to install the handler for. This is one of the SO_INTERRUPT_TYPE_ * constants.
a_IntHandler  The interrupt handler that is to be installed. Can be NULL if you want to disable an interrupt handler.


Variable Documentation

SoInterruptHandler g_InterruptHandlers[ SO_NUM_INTERRUPT_TYPES ]  
 

Declared here because we need in both the .C and the assembly.

For internal use only.

This array contains all interrupt handlers. If an entry is NULL there is no handler installed for the interrupt type.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.