mirror of
https://github.com/pret/pokediamond.git
synced 2026-04-25 07:26:54 -05:00
use macros for cnt + clean
This commit is contained in:
parent
57f95da687
commit
cf154a6b5d
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
#include "registers.h"
|
||||
|
||||
#define MI_DMA_TIMING_MASK (3UL << 28)
|
||||
#define MI_DMA_TIMING_CARD (2UL << 28)
|
||||
|
||||
void MI_StopDma(u32 channel);
|
||||
void MI_WaitDma(u32 channel);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ void MI_WaitDma(u32 channel) {
|
|||
void MI_StopDma(u32 channel) {
|
||||
OSIntrMode mode = OS_DisableInterrupts();
|
||||
vu16 *addr = (vu16 *)(REG_DMA0SAD_ADDR + (channel * 6 + 5) * 2);
|
||||
addr[0] &= ~(DMA_START_MASK | DMA_REPEAT);
|
||||
addr[0] &= ~DMA_ENABLE;
|
||||
addr[0] &= ~((MI_DMA_TIMING_MASK | MI_DMA_CONTINUOUS_ON) >> 16);
|
||||
addr[0] &= ~(MI_DMA_ENABLE >> 16);
|
||||
{
|
||||
s32 dummy = addr[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ typedef void (*MIDmaCallback)(void *);
|
|||
|
||||
#define MI_DMA_MAX_NUM 3
|
||||
|
||||
#define MI_DMA_TIMING_MASK (7UL << 27)
|
||||
#define MI_DMA_TIMING_CARD (5UL << 27)
|
||||
|
||||
#define MI_CNT_CARDRECV32(size) (MI_DMA_ENABLE | MI_DMA_TIMING_CARD | MI_DMA_SRC_FIX | MI_DMA_DEST_INC | MI_DMA_32BIT_BUS | ((size) / 4))
|
||||
|
||||
#define REG_ADDR_DMA0CNT 0x40000b8
|
||||
#define REG_ADDR_DMA0_CLR_DATA 0x40000e0
|
||||
|
||||
|
|
@ -19,12 +24,6 @@ typedef void (*MIDmaCallback)(void *);
|
|||
#define MI_CNT_COPY32_IF(size) (0xc4000000 | ((size) / 4))
|
||||
#define MI_CNT_COPY16(size) (0x80000000 | ((size) / 2))
|
||||
|
||||
#define MI_DMA_SRC_FIX (2UL << 23)
|
||||
#define MI_DMA_SRC_INC (0UL << 23)
|
||||
|
||||
#define MI_DMA_16BIT_BUS (0UL << 26)
|
||||
#define MI_DMA_32BIT_BUS (1UL << 26)
|
||||
|
||||
#define MIi_DMA_TIMING_ANY (u32)(~0)
|
||||
#define MI_DMA_TIMING_H_BLANK (2UL << 27)
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ void MI_DmaFill32(u32 dmaNo, void *dest, u32 data, u32 size) {
|
|||
|
||||
void MI_DmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size) {
|
||||
vu32 *dmaCntp;
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_INC);
|
||||
|
||||
if (!size) {
|
||||
return;
|
||||
|
|
@ -115,7 +115,7 @@ void MI_DmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size) {
|
|||
return;
|
||||
}
|
||||
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_INC);
|
||||
|
||||
MIi_WAIT_BEFOREDMA(dmaCntp, dmaNo);
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ void MI_DmaFill32Async(u32 dmaNo, void *dest, u32 data, u32 size, MIDmaCallback
|
|||
}
|
||||
|
||||
void MI_DmaCopy32Async(u32 dmaNo, const void *src, void *dest, u32 size, MIDmaCallback callback, void *arg) {
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_INC);
|
||||
|
||||
if (!size) {
|
||||
MIi_CallCallback(callback, arg);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,5 @@ void MIi_CardDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size) {
|
|||
vu32 *dmaCntp;
|
||||
MIi_WAIT_BEFOREDMA(dmaCntp, dmaNo);
|
||||
|
||||
// TODO: control params, should be MI_CNT_CARDRECV32(4) | MI_DMA_CONTINUOUS_ON
|
||||
MIi_DmaSetParams(dmaNo, (u32)src, (u32)dest, (u32)(0xaf000001));
|
||||
MIi_DmaSetParams(dmaNo, (u32)src, (u32)dest, (u32)(MI_CNT_CARDRECV32(4) | MI_DMA_CONTINUOUS_ON));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void MI_SendGXCommand(u32 dmaNo, const void *src, u32 commandLength) {
|
|||
return;
|
||||
}
|
||||
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, MI_DMA_SRC_INC);
|
||||
|
||||
MIi_WAIT_BEFOREDMA(dmaCntp, dmaNo);
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ void MI_SendGXCommandAsync(u32 dmaNo, const void *src, u32 commandLength, MIDmaC
|
|||
MIi_GXDmaParams.callback = callback;
|
||||
MIi_GXDmaParams.arg = arg;
|
||||
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, MI_DMA_SRC_INC);
|
||||
|
||||
MI_WaitDma(dmaNo);
|
||||
{
|
||||
|
|
@ -121,7 +121,7 @@ void MI_SendGXCommandAsyncFast(u32 dmaNo, const void *src, u32 commandLength, MI
|
|||
|
||||
MIi_CheckAnotherAutoDMA(dmaNo, 0x38000000);
|
||||
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, DMA_SRC_INC);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, commandLength, MI_DMA_SRC_INC);
|
||||
|
||||
MI_WaitDma(dmaNo);
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user