Line 1,075: |
Line 1,075: |
| = DMA = | | = DMA = |
| The CTRSDK code for using svcStartInterProcessDma will execute svcBreak when svcStartInterProcessDma returns an error(except for certain error value(s)). Therefore on retail, triggering a svcStartInterProcessDma via a system-module which results in an error from svcStartInterProcessDma will result in the system-module terminating. | | The CTRSDK code for using svcStartInterProcessDma will execute svcBreak when svcStartInterProcessDma returns an error(except for certain error value(s)). Therefore on retail, triggering a svcStartInterProcessDma via a system-module which results in an error from svcStartInterProcessDma will result in the system-module terminating. |
| + | |
| + | ==DmaConfig== |
| + | Size of struct is 24 bytes. |
| + | |
| + | struct DmaConfig { |
| + | sint8_t channel_sel; // @0 Selects which DMA channel to use: 0-7, -1 = don't care. |
| + | uint8_t unk1; // @1 Accepted values: 0,2,4,8. |
| + | uint8_t flags; // @2 bit0: DST_CFG, bit1: SRC_CFG, bit2: SHALL_BLOCK, bit3: ???, bit6: DST_ALT_CFG, bit7: DST_ALT_CFG |
| + | uint8_t dst_cfg[10]; |
| + | // @5 Accepted values (u8): 4, 8, 12, 15. |
| + | // @15 Accepted values (u8): 4, 8, 12, 15. |
| + | uint8_t src_cfg[10]; // @14 |
| + | } |
| + | |
| + | If SRC_CFG/DST_CFG is set in the flags field, the configuration for src/dst is loaded from src_cfg/dst_cfg respectively. If the *_ALT_CFG flag is set same thing goes, except byte0 of each cfg is forced to 0xFF. ALT_CFG has priority over CFG. |
| + | |
| + | If CFG or ALT_CFG is not set, default configuration is loaded: |
| + | FF 0F 80 00 00 00 80 00 00 00 |
| + | |
| + | If SHALL_BLOCK is set, the thread will sleep until the DMA engine is ready. If not set, the SVC will return 0xD04007F0 if the DMA channel is busy. |
| + | |
| + | The format of src_cfg/dst_cfg is unknown, but both have the same format. Checks suggest that the second byte of cfg equalling 4 means NO_INCREMENT (don't increment after read/write). |
| | | |
| = Debugging = | | = Debugging = |