diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-12-28 12:18:29 +0100 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-12-28 12:18:29 +0100 |
| commit | 7e350980d5c09bbc81a0de01bf016a87ecfc4feb (patch) | |
| tree | 26b403d12eea34a4644b3d147f00e1d1455e7f52 /libpsn00b/psxspu | |
| parent | eaec942f56ceec9c14de5c4185a02602abadd50a (diff) | |
| download | psn00bsdk-7e350980d5c09bbc81a0de01bf016a87ecfc4feb.tar.gz | |
Add CdUnlock() and DMA priority API
Diffstat (limited to 'libpsn00b/psxspu')
| -rw-r--r-- | libpsn00b/psxspu/common.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libpsn00b/psxspu/common.c b/libpsn00b/psxspu/common.c index 45654ad..6ccbef4 100644 --- a/libpsn00b/psxspu/common.c +++ b/libpsn00b/psxspu/common.c @@ -5,6 +5,7 @@ #include <stdint.h> #include <assert.h> +#include <psxetc.h> #include <psxspu.h> #include <hwregs_c.h> @@ -59,13 +60,14 @@ static size_t _dma_transfer(uint32_t *data, size_t length, int write) { SPU_CTRL |= ctrl; _wait_status(0x0030, ctrl); - DMA_MADR(4) = (uint32_t) data; + DMA_MADR(DMA_SPU) = (uint32_t) data; if (length < DMA_CHUNK_LENGTH) - DMA_BCR(4) = 0x00010000 | length; + DMA_BCR(DMA_SPU) = 0x00010000 | length; else - DMA_BCR(4) = DMA_CHUNK_LENGTH | ((length / DMA_CHUNK_LENGTH) << 16); + DMA_BCR(DMA_SPU) = DMA_CHUNK_LENGTH | + ((length / DMA_CHUNK_LENGTH) << 16); - DMA_CHCR(4) = 0x01000200 | write; + DMA_CHCR(DMA_SPU) = 0x01000200 | write; return length; } @@ -130,8 +132,8 @@ void SpuInit(void) { SPU_EXT_VOL_L = 0; SPU_EXT_VOL_R = 0; - DMA_DPCR |= 0x000b0000; // Enable DMA4 - DMA_CHCR(4) = 0x00000201; // Stop DMA4 + SetDMAPriority(DMA_SPU, 3); + DMA_CHCR(DMA_SPU) = 0x00000201; // Stop DMA SPU_DMA_CTRL = 0x0004; // Reset transfer mode SPU_CTRL = 0xc001; // Enable SPU, DAC, CD audio, disable DMA request |
