diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2020-06-30 09:22:17 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2020-06-30 09:22:17 -0400 |
commit | 482e14ea5eae471d0b303a25b9281afb9f8b2cad (patch) | |
tree | fa1b9f8858144b8e37cbf020ce3563b4ca1513aa /arm9/lib/include | |
parent | e1b2aaae3656d822c9feaca25e52e1363280d111 (diff) | |
parent | da721b74a0bc5c235a7f39ff827080c6b8f24b21 (diff) |
Merge branch 'master' of github.com:martmists/pokediamond into pikalax_work
Diffstat (limited to 'arm9/lib/include')
-rw-r--r-- | arm9/lib/include/GX_g3x.h | 15 | ||||
-rw-r--r-- | arm9/lib/include/MI_dma_gxcommand.h | 37 |
2 files changed, 52 insertions, 0 deletions
diff --git a/arm9/lib/include/GX_g3x.h b/arm9/lib/include/GX_g3x.h index 4bd55831..a0512b28 100644 --- a/arm9/lib/include/GX_g3x.h +++ b/arm9/lib/include/GX_g3x.h @@ -1,6 +1,8 @@ #ifndef GUARD_GX_G3X_H #define GUARD_GX_G3X_H +#include "fx.h" + void GXi_NopClearFifo128_(void *reg); void G3X_Init(); void G3X_ResetMtxStack(); @@ -66,4 +68,17 @@ typedef enum } GXFifoStat; +static inline void G3X_SetFifoIntrCond(GXFifoIntrCond cond) +{ + reg_G3X_GXSTAT = ((reg_G3X_GXSTAT & ~0xc0000000) | + (cond << 30)); +} + +static inline GXFifoStat G3X_GetCommandFifoStatus(void) +{ + return (GXFifoStat)((reg_G3X_GXSTAT & (0x01000000 | + 0x02000000 | + 0x04000000)) >> 24); +} + #endif //GUARD_GX_G3X_H diff --git a/arm9/lib/include/MI_dma_gxcommand.h b/arm9/lib/include/MI_dma_gxcommand.h new file mode 100644 index 00000000..29aa9c72 --- /dev/null +++ b/arm9/lib/include/MI_dma_gxcommand.h @@ -0,0 +1,37 @@ +#ifndef POKEDIAMOND_MI_DMA_GXCOMMAND_H +#define POKEDIAMOND_MI_DMA_GXCOMMAND_H + +#include "consts.h" +#include "MI_dma.h" +#include "GX_g3x.h" + +#define MIi_GX_LENGTH_ONCE (118 * sizeof(u32)) +#define REG_GXFIFO_ADDR 0x4000400 +#define MI_CNT_SEND32(size) (0x84400000 | (size/4)) +#define MI_CNT_SEND32_IF(size) (0xc4400000 | (size/4)) +#define MI_CNT_GXCOPY_IF(size) (0xfc400000 | (size/4)) + +#define OS_IE_GXFIFO 0x200000 + +typedef struct +{ + volatile BOOL isBusy; + + u32 dmaNo; + u32 src; + u32 length; + MIDmaCallback callback; + void *arg; + + GXFifoIntrCond fifoCond; + void (*fifoFunc) (void); +} MIiGXDmaParams; + +void MI_SendGXCommand(u32 dmaNo, const void *src, u32 commandLength); +void MI_SendGXCommandAsync(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg); +static void MIi_FIFOCallback(void); +static void MIi_DMACallback(void *); +void MI_SendGXCommandAsyncFast(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg); +static void MIi_DMAFastCallback(void *); + +#endif //POKEDIAMOND_MI_DMA_GXCOMMAND_H |