system.h File Reference

NDS hardware definitions. More...

#include "ndstypes.h"

Data Structures

struct  __argv
 argv structure More...
struct  tPERSONAL_DATA
 User's DS settings. More...

Defines

#define __system_argv   ((struct __argv *)0x02FFFE70)
 Default location for the libnds argv structure.
#define HALT_CR   (*(vu16*)0x04000300)
 Halt control register.
#define PersonalData   ((PERSONAL_DATA*)0x2FFFC80)
 Default location for the user's personal data (see PERSONAL_DATA).
#define REG_DISPSTAT   (*(vu16*)0x04000004)
 LCD status register.
#define REG_POWERCNT   *(vu16*)0x4000304
 Power control register.
#define REG_VCOUNT   (*(vu16*)0x4000006)
 Current display scanline.

Enumerations

enum  ARM7_power {
  POWER_SOUND = (1 << ( 0 )),
  PM_CONTROL_REG = 0,
  PM_BATTERY_REG = 1,
  PM_AMPLIFIER_REG = 2,
  PM_READ_REGISTER = (1<<7),
  PM_AMP_OFFSET = 2,
  PM_GAIN_OFFSET = 3,
  PM_GAIN_20 = 0,
  PM_GAIN_40 = 1,
  PM_GAIN_80 = 2,
  PM_GAIN_160 = 3,
  PM_AMP_ON = 1,
  PM_AMP_OFF = 0
}
 Power-controlled hardware devices accessable to the ARM7. More...
enum  DISP_BITS { ,
  DISP_IN_HBLANK = (1 << ( 1 )),
  DISP_YTRIGGERED = (1 << ( 2 )),
  DISP_VBLANK_IRQ = (1 << ( 3 )),
  DISP_HBLANK_IRQ = (1 << ( 4 )),
  DISP_YTRIGGER_IRQ = (1 << ( 5 ))
}
 LCD Status register bitdefines. More...
enum  PM_Bits {
  PM_SOUND_AMP = (1 << ( 0 )),
  PM_SOUND_MUTE = (1 << ( 1 )),
  PM_BACKLIGHT_BOTTOM = (1 << ( 2 )),
  PM_BACKLIGHT_TOP = (1 << ( 3 )),
  PM_SYSTEM_PWR = (1 << ( 6 )),
  POWER_LCD = (1 << ( 16 )) | (1 << ( 0 )),
  POWER_2D_A = (1 << ( 16 )) | (1 << ( 1 )),
  POWER_MATRIX = (1 << ( 16 )) | (1 << ( 2 )),
  POWER_3D_CORE = (1 << ( 16 )) | (1 << ( 3 )),
  POWER_2D_B = (1 << ( 16 )) | (1 << ( 9 )),
  POWER_SWAP_LCDS = (1 << ( 16 )) | (1 << ( 15 )),
  POWER_ALL_2D = (1 << ( 16 )) | POWER_LCD | POWER_2D_A | POWER_2D_B,
  POWER_ALL = (1 << ( 16 )) | POWER_ALL_2D | POWER_3D_CORE | POWER_MATRIX
}
 Power Management control bits. More...

Functions

static void lcdMainOnBottom (void)
 Forces the main core to display on the bottom.
static void lcdMainOnTop (void)
 Forces the main core to display on the top.
static void lcdSwap (void)
 Switches the screens.
void ledBlink (int bm)
 Set the LED blink mode.
void powerOff (int bits)
 Turns off specified hardware.
void powerOn (int bits)
 Turns on specified hardware.
void setVectorBase (int highVector)
 Set the arm9 vector base.


Detailed Description

NDS hardware definitions.

These definitions are usually only touched during the initialization of the program.


Define Documentation

#define HALT_CR   (*(vu16*)0x04000300)

Halt control register.

Writing 0x40 to HALT_CR activates GBA mode. HALT_CR can only be accessed via the BIOS.

#define REG_POWERCNT   *(vu16*)0x4000304

Power control register.

This register controls what hardware should be turned on or off.


Enumeration Type Documentation

enum ARM7_power

Power-controlled hardware devices accessable to the ARM7.

Note that these should only be used when programming for the ARM7. Trying to boot up these hardware devices via the ARM9 would lead to unexpected results.

Enumerator:
POWER_SOUND  Controls the power for the sound controller.
PM_CONTROL_REG  Selects the PM control register.
PM_BATTERY_REG  Selects the PM nattery register.
PM_AMPLIFIER_REG  Selects the PM amplifier register.
PM_READ_REGISTER  Selects the PM read register.
PM_AMP_OFFSET  Selects the PM amp register.
PM_GAIN_OFFSET  Selects the PM gain register.
PM_GAIN_20  Sets the mic gain to 20db.
PM_GAIN_40  Sets the mic gain to 40db.
PM_GAIN_80  Sets the mic gain to 80db.
PM_GAIN_160  Sets the mic gain to 160db.
PM_AMP_ON  Turns the sound amp on.
PM_AMP_OFF  Turns the sound amp off.

enum DISP_BITS

LCD Status register bitdefines.

Enumerator:
DISP_IN_HBLANK  The display currently in a vertical blank.
DISP_YTRIGGERED  The display currently in a horizontal blank.
DISP_VBLANK_IRQ  Current scanline and DISP_Y match.
DISP_HBLANK_IRQ  Interrupt on vertical blank.
DISP_YTRIGGER_IRQ  Interrupt on horizontal blank.

enum PM_Bits

Power Management control bits.

Enumerator:
PM_SOUND_AMP  Power the sound hardware (needed to hear stuff in GBA mode too).
PM_SOUND_MUTE  Mute the main speakers, headphone output will still work.
PM_BACKLIGHT_BOTTOM  Enable the top backlight if set.
PM_BACKLIGHT_TOP  Enable the bottom backlight if set.
PM_SYSTEM_PWR  Turn the power *off* if set.
POWER_LCD  Controls the power for both LCD screens.
POWER_2D_A  Controls the power for the main 2D core.
POWER_MATRIX  Controls the power for the 3D matrix.
POWER_3D_CORE  Controls the power for the main 3D core.
POWER_2D_B  Controls the power for the sub 2D core.
POWER_SWAP_LCDS  Controls which screen should use the main core.
POWER_ALL_2D  power just 2D hardware
POWER_ALL  power everything


Function Documentation

void ledBlink ( int  bm  ) 

Set the LED blink mode.

Arm9 only

Parameters:
bm What to power on.

void powerOff ( int  bits  ) 

Turns off specified hardware.

May be called from arm7 or arm9 (arm9 power bits will be ignored by arm7, arm7 power bits will be passed to the arm7 from the arm9).

Parameters:
bits What to power on.

void powerOn ( int  bits  ) 

Turns on specified hardware.

May be called from arm7 or arm9 (arm9 power bits will be ignored by arm7, arm7 power bits will be passed to the arm7 from the arm9).

Parameters:
bits What to power on.

void setVectorBase ( int  highVector  ) 

Set the arm9 vector base.

Arm9 only

Parameters:
highVector high vector


Generated on Sun Mar 7 12:47:54 2010 for libnds by  doxygen 1.5.7.1