NDMA Registers

NDMA Registers

3DS NDMA has 8 channels. The first 0x100-bytes of this IO mem is mirrored at 0x10002100, repeated every 0x100-bytes until the end of the 0x1000-byte IO mem. NDMA can access the Arm9 bootrom, including the protected part before it is locked out.

Registers #

Old3DSNameAddressWidthUsed by
YesNDMA_GLOBAL_CNT0x100020004Boot9, Kernel9
YesNDMA_SRC_ADDR(n)0x10002004 + (n*0x1c)4Boot9, Kernel9
YesNDMA_DST_ADDR(n)0x10002008 + (n*0x1c)4Boot9, Kernel9
YesNDMA_TRANSFER_CNT(n)0x1000200c + (n*0x1c)4Boot9, Kernel9
YesNDMA_WRITE_CNT(n)0x10002010 + (n*0x1c)4Boot9, Kernel9
YesNDMA_BLOCK_CNT(n)0x10002014 + (n*0x1c)4Boot9, Kernel9
YesNDMA_FILL_DATA(n)0x10002018 + (n*0x1c)4Boot9, Kernel9
YesNDMA_CNT(n)0x1000201C + (n*0x1c)4Boot9, Kernel9

NDMA_GLOBAL_CNT #

BitDescription
0Global enable?
19-16Cycle selection.
31DMA arbitration method. 0=Fixed method, 1=Round robin

NDMA_SRC_ADDR #

BitDescription
31-0Source data address. Must be multiple of 4.

Like old DMA, NDMA_SRC_ADDR is copied to internal registers when written to.

NDMA_DST_ADDR #

BITDESCRIPTION
31-0Destination data address. Must be multiple of 4.

Like old DMA, NDMA_DST_ADDR is copied to internal registers when written to.

NDMA_TRANSFER_CNT #

BitDescription
27-0Total number of words transferred.

NDMA_WRITE_CNT #

BitDescription
23-0Number of words to transfer.

NDMA_BLOCK_CNT #

BitDescription
15-0Interval timer.
17-16Prescaler. 0=System freq, 1=1/4th freq, 2=1/16th freq, 3=1/64th freq.

NDMA_FILL_DATA #

BitDescription
31-0Fill data.

NDMA_CNT #

BitDescription
4-0Device to device startup mode
11-10Destination address update method. 0=Increment, 1=Decrement, 2=Fixed.
12Destination address reload flag.
14-13Source address update method. 0=Increment, 1=Decrement, 2=Fixed, 3=No address (for filling)
15Source address reload flag.
19-16Block transfer word count = (1<<x) words.
27-24Startup mode.
28Immediate mode.
29Repeating mode.
30IRQ enable
31Enable/busy flag.

Startup modes (4-0) #

ValueDescription
0TIMER0
1TIMER1
2TIMER2
3TIMER3
4CTRCARD0
5CTRCARD1
6SDIO1
7SDIO3
8AES in ( WRFIFO)
9AES out ( RDFIFO)
10SHA in ( INFIFO)
11SHA out ( INFIFO, source data readback mode)
12NTRCARD
13?
14?
15Device to device (subclassed by bits 4-0)

Device to device startup modes (4-0) #

ValueDescription
0CTRCARD0 -> AES
1CTRCARD1 -> AES
2AES -> CTRCARD0
3AES -> CTRCARD1
4CTRCARD0 -> SHA
5CTRCARD1 -> SHA
6SHA -> CTRCARD0
7SHA -> CTRCARD1
8SDIO1 -> AES
9SDIO3 -> AES
10AES -> SDIO1
11AES -> SDIO3
12SDIO1 -> SHA
13SDIO3 -> SHA
14SHA -> SDIO1
15SHA -> SDIO3
16AES -> SHA
17SHA -> AES

Block transfers #

First, a word is always 32 bits. Second, the block transfer specified in NDMA_CNT is the smallest atom of data that will be transferred in a burst. The bus is monopolized until this block is transferred, without splitting up.

The next block transfer will happen after the specified time in the NDMA_BLOCK_CNT interval timer, until done.

Immediate mode #

Transfers the words specified in NDMA_WRITE_CNT immediately following block transfer rules. NDMA_TRANSFER_CNT and repeating mode are ignored.

Repeating mode #

Transfers the words specified in NDMA_WRITE_CNT following the startup mode event. NDMA_TRANSFER_CNT is ignored.

No immediate and no repeating mode #

Transfers the words specified in NDMA_WRITE_CNT for each startup event, and gets disabled when the total number of words in NDMA_TRANSFER_CNT are transferred.