libnds
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
memory.h File Reference

Defines for many of the regions of memory on the DS as well as a few control functions for memory bus access. More...

#include <assert.h>
#include <nds/ndstypes.h>

Data Structures

struct  sGBAHeader
 GBA file header format. More...
 
struct  sNDSBanner
 NDS banner format. More...
 
struct  sNDSHeader
 NDS file header format. More...
 

Macros

#define ALLRAM   ((u8*)0x00000000)
 8 bit pointer to the start of all the RAM.
 
#define GBA_BUS   ((vu16 *)(0x08000000))
 16 bit volatile pointer to the GBA slot bus.
 
#define GBAROM   ((u16 *)0x08000000)
 16 bit pointer to the GBA slot ROM.
 
#define MAINRAM16   ((u16 *)0x02000000)
 16 bit pointer to main RAM.
 
#define MAINRAM32   ((u32 *)0x02000000)
 32 bit pointer to main RAM.
 
#define MAINRAM8   ((u8 *)0x02000000)
 8 bit pointer to main RAM.
 
#define SRAM   ((u8 *)0x0A000000)
 8 bit pointer to GBA slot Save RAM.
 

Typedefs

typedef struct sGBAHeader tGBAHeader
 GBA file header format.
 
typedef struct sNDSBanner tNDSBanner
 NDS banner format.
 
typedef struct sNDSHeader tNDSHeader
 NDS file header format.
 

Functions

static bool sysGetCardOwner (void)
 Retrieves the owner of the DS card bus.
 
static bool sysGetCartOwner (void)
 Retrieves the owner of the GBA cart.
 
static void sysSetBusOwners (bool arm9rom, bool arm9card)
 Sets the owner of the DS card bus (slot 1) and GBA cart bus (slot 2).
 
static void sysSetCardOwner (bool arm9)
 Sets the owner of the DS card bus.
 
static void sysSetCartOwner (bool arm9)
 Sets the owner of the GBA cart.
 

Detailed Description

Defines for many of the regions of memory on the DS as well as a few control functions for memory bus access.

Typedef Documentation

◆ tGBAHeader

typedef struct sGBAHeader tGBAHeader

GBA file header format.

See gbatek for more info.

◆ tNDSBanner

typedef struct sNDSBanner tNDSBanner

NDS banner format.

See gbatek for more information.

◆ tNDSHeader

typedef struct sNDSHeader tNDSHeader

NDS file header format.

See gbatek for more info.

Function Documentation

◆ sysGetCardOwner()

static bool sysGetCardOwner ( void  )
inlinestatic

Retrieves the owner of the DS card bus.

Both CPUs cannot have access to the DS card bus at the same time (slot 1).

Returns
The current owner of the DS card bus (true if ARM9 is the owner).

◆ sysGetCartOwner()

static bool sysGetCartOwner ( void  )
inlinestatic

Retrieves the owner of the GBA cart.

Both CPUs cannot have access to the GBA cart at the same time (slot 2).

Returns
The current owner of the GBA cart bus (true if ARM9 is the owner).

◆ sysSetBusOwners()

static void sysSetBusOwners ( bool  arm9rom,
bool  arm9card 
)
inlinestatic

Sets the owner of the DS card bus (slot 1) and GBA cart bus (slot 2).

Only one CPU may access the devices at a time.

Parameters
arm9romIf true the ARM9 is the owner of slot 2, otherwise the ARM7
arm9cardIf true the ARM9 is the owner of slot 1, otherwise the ARM7

◆ sysSetCardOwner()

static void sysSetCardOwner ( bool  arm9)
inlinestatic

Sets the owner of the DS card bus.

Both CPUs cannot have access to the DS card bus at the same time (slot 1).

Parameters
arm9If true the ARM9 is the owner, otherwise the ARM7

◆ sysSetCartOwner()

static void sysSetCartOwner ( bool  arm9)
inlinestatic

Sets the owner of the GBA cart.

Both CPUs cannot have access to the GBA cart at the same time (slot 2).

Parameters
arm9If true the ARM9 is the owner, otherwise the ARM7