libnds
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
nwram.h File Reference

New WRAM utilities. More...

#include <stdbool.h>
#include <nds/ndstypes.h>
#include <nds/system.h>

Macros

#define NWRAM_BASE   0x03000000
 Base address of NWRAM.
 

Enumerations

enum  NWRAM_A_SLOT_MASTER {
  NWRAM_A_SLOT_MASTER_ARM9 = 0 ,
  NWRAM_A_SLOT_MASTER_ARM7 = 1
}
 Possible owners of NWRAM A slots. More...
 
enum  NWRAM_B_SLOT_MASTER {
  NWRAM_B_SLOT_MASTER_ARM9 = 0 ,
  NWRAM_B_SLOT_MASTER_ARM7 = 1 ,
  NWRAM_B_SLOT_MASTER_DSP_CODE = 2
}
 Possible owners of NWRAM C slots. More...
 
enum  NWRAM_BLOCK {
  NWRAM_BLOCK_A = 0 ,
  NWRAM_BLOCK_B = 1 ,
  NWRAM_BLOCK_C = 2
}
 Available NWRAM blocks. More...
 
enum  NWRAM_BLOCK_IMAGE_SIZE {
  NWRAM_BLOCK_IMAGE_SIZE_32K = 0 ,
  NWRAM_BLOCK_IMAGE_SIZE_64K ,
  NWRAM_BLOCK_IMAGE_SIZE_128K ,
  NWRAM_BLOCK_IMAGE_SIZE_256K
}
 Possible image sizes of a NWRAM block. More...
 
enum  NWRAM_C_SLOT_MASTER {
  NWRAM_C_SLOT_MASTER_ARM9 = 0 ,
  NWRAM_C_SLOT_MASTER_ARM7 = 1 ,
  NWRAM_C_SLOT_MASTER_DSP_DATA = 2
}
 Possible owners of NWRAM C slots. More...
 

Functions

u32 nwramGetBlockAddress (NWRAM_BLOCK block)
 Returns the address of a NWRAM block that has been mapped to a CPU.
 
static bool nwramIsAvailable (void)
 Checks whether NWRAM is available to be used.
 
int nwramMapWramASlot (int slot, NWRAM_A_SLOT_MASTER master, int offset, bool enable)
 Maps a slot of WRAM slot A to the specified CPU.
 
int nwramMapWramBSlot (int slot, NWRAM_B_SLOT_MASTER master, int offset, bool enable)
 Maps a slot of WRAM slot B to the specified CPU.
 
int nwramMapWramCSlot (int slot, NWRAM_C_SLOT_MASTER master, int offset, bool enable)
 Maps a slot of WRAM slot C to the specified CPU.
 
void nwramSetBlockMapping (NWRAM_BLOCK block, u32 start, u32 length, NWRAM_BLOCK_IMAGE_SIZE imageSize)
 Maps a NWRAM block to a CPU to the specified address and length.
 

Detailed Description

New WRAM utilities.

Enumeration Type Documentation

◆ NWRAM_A_SLOT_MASTER

Possible owners of NWRAM A slots.

Enumerator
NWRAM_A_SLOT_MASTER_ARM9 

The ARM9 is the owner.

NWRAM_A_SLOT_MASTER_ARM7 

The ARM7 is the owner.

◆ NWRAM_B_SLOT_MASTER

Possible owners of NWRAM C slots.

Enumerator
NWRAM_B_SLOT_MASTER_ARM9 

The ARM9 is the owner.

NWRAM_B_SLOT_MASTER_ARM7 

The ARM7 is the owner.

NWRAM_B_SLOT_MASTER_DSP_CODE 

The DSP is the owner. Used for code.

◆ NWRAM_BLOCK

Available NWRAM blocks.

Enumerator
NWRAM_BLOCK_A 

NWRAM block A.

NWRAM_BLOCK_B 

NWRAM block B.

NWRAM_BLOCK_C 

NWRAM block C.

◆ NWRAM_BLOCK_IMAGE_SIZE

Possible image sizes of a NWRAM block.

Enumerator
NWRAM_BLOCK_IMAGE_SIZE_32K 

32 KB

NWRAM_BLOCK_IMAGE_SIZE_64K 

64 KB

NWRAM_BLOCK_IMAGE_SIZE_128K 

128 KB

NWRAM_BLOCK_IMAGE_SIZE_256K 

256 KB

◆ NWRAM_C_SLOT_MASTER

Possible owners of NWRAM C slots.

Enumerator
NWRAM_C_SLOT_MASTER_ARM9 

The ARM9 is the owner.

NWRAM_C_SLOT_MASTER_ARM7 

The ARM7 is the owner.

NWRAM_C_SLOT_MASTER_DSP_DATA 

The DSP is the owner. Used for data.

Function Documentation

◆ nwramGetBlockAddress()

u32 nwramGetBlockAddress ( NWRAM_BLOCK  block)

Returns the address of a NWRAM block that has been mapped to a CPU.

Parameters
blockOne of NWRAM_BLOCK.
Returns
The address.

◆ nwramIsAvailable()

static bool nwramIsAvailable ( void  )
inlinestatic

Checks whether NWRAM is available to be used.

It is possible to be in an execution state where NWRAM isn't available even in DSi mode.

Returns
If available, it returns true. If not, false.

◆ nwramMapWramASlot()

int nwramMapWramASlot ( int  slot,
NWRAM_A_SLOT_MASTER  master,
int  offset,
bool  enable 
)

Maps a slot of WRAM slot A to the specified CPU.

Parameters
slotSlot index (0 to 3).
masterOwner of the slot (ARM7, ARM9 or DSP).
offsetOffset of the slot.
enabletrue to enable the slot, false to disable it.
Returns
Returns 0 on success, a negative number on failure.

◆ nwramMapWramBSlot()

int nwramMapWramBSlot ( int  slot,
NWRAM_B_SLOT_MASTER  master,
int  offset,
bool  enable 
)

Maps a slot of WRAM slot B to the specified CPU.

Parameters
slotSlot index (0 to 3).
masterOwner of the slot (ARM7, ARM9 or DSP).
offsetOffset of the slot.
enabletrue to enable the slot, false to disable it.
Returns
Returns 0 on success, a negative number on failure.

◆ nwramMapWramCSlot()

int nwramMapWramCSlot ( int  slot,
NWRAM_C_SLOT_MASTER  master,
int  offset,
bool  enable 
)

Maps a slot of WRAM slot C to the specified CPU.

Parameters
slotSlot index (0 to 3).
masterOwner of the slot (ARM7, ARM9 or DSP).
offsetOffset of the slot.
enabletrue to enable the slot, false to disable it.
Returns
Returns 0 on success, a negative number on failure.

◆ nwramSetBlockMapping()

void nwramSetBlockMapping ( NWRAM_BLOCK  block,
u32  start,
u32  length,
NWRAM_BLOCK_IMAGE_SIZE  imageSize 
)

Maps a NWRAM block to a CPU to the specified address and length.

Parameters
blockOne of NWRAM_BLOCK.
startThe base address. Only 0x3000000 to 0x3800000 available.
lengthLength of the block.
imageSizeSize of the block.