--- xmil/io/dmac.h 2004/08/01 05:31:30 1.1 +++ xmil/io/dmac.h 2005/02/04 06:42:11 1.6 @@ -1,27 +1,143 @@ +#define DMAS_STOIC + #if defined(BYTESEX_LITTLE) typedef union { struct { - UINT8 l; - UINT8 h; - } b; - UINT16 w; -} DMAPAIR; + UINT8 flag; + UINT8 padding; + UINT8 addrl; + UINT8 addrh; + } b; + struct { + UINT8 flag; + UINT8 padding; + UINT16 addr; + } w; +} DMACNT; + +typedef union { + struct { + UINT8 ll; + UINT8 lh; + UINT8 nl; + UINT8 nh; + } b; + struct { + UINT16 l; + UINT16 n; + } w; +} DMALENG; + +typedef union { + struct { + UINT8 al; + UINT8 ah; + UINT8 bl; + UINT8 bh; + } b; + struct { + UINT16 a; + UINT16 b; + } w; +} DMAADDR; #else typedef union { struct { - UINT8 h; - UINT8 l; - } b; - UINT16 w; -} DMAPAIR; + UINT8 flag; + UINT8 padding; + UINT8 addrh; + UINT8 addrl; + } b; + struct { + UINT8 flag; + UINT8 padding; + UINT16 addr; + } w; +} DMACNT; + +typedef union { + struct { + UINT8 lh; + UINT8 ll; + UINT8 nh; + UINT8 nl; + } b; + struct { + UINT16 l; + UINT16 n; + } w; +} DMALENG; +typedef union { + struct { + UINT8 ah; + UINT8 al; + UINT8 bh; + UINT8 bl; + } b; + struct { + UINT16 a; + UINT16 b; + } w; +} DMAADDR; #endif + +#if defined(DMAS_STOIC) + +enum { + DMAF_WORKING = 0x01, + DMAF_INCREMENT = 0x08, + DMAF_MACH = 0x10, + DMAF_ENDB = 0x20 +}; + typedef struct { - UINT8 DMA_ENBL; - UINT8 DMA_REDY; - UINT8 DMA_MODE; - UINT8 DMA_CMND; + UINT8 flag; + UINT8 WR0; + UINT8 mode; // DMA_MODE + UINT8 INT_ENBL; + + UINT8 WR4; + UINT8 WR5; + UINT8 MASK_BYT; + UINT8 MACH_BYT; + + DMACNT cnt_a; + DMACNT cnt_b; + + DMALENG leng; + DMAADDR addr; + + UINT8 enable; // DMA_ENBL + UINT8 ready; // DMA_REDY + UINT8 RR_MSK; + UINT8 RR; + + UINT8 INT_FLG; + UINT8 INT_PLS; + UINT8 INT_VCT; + UINT8 dummydat; + + UINT wcnt; + UINT wptr; + UINT rcnt; + UINT rptr; + UINT8 wtbl[8]; + UINT8 rtbl[8]; +} DMAC; + +#else + +typedef struct { + UINT8 working; + UINT8 increment; + + UINT8 mode; // DMA_MODE + UINT8 __cmd; // DMA_CMND + + UINT8 enable; // DMA_ENBL + UINT8 ready; // DMA_REDY UINT8 INT_ENBL; UINT8 INT_FLG; @@ -35,38 +151,30 @@ typedef struct { UINT8 RR_MSK; UINT8 RR; - UINT8 DMA_STOP; + + UINT8 WR0; +// UINT8 WR1; +// UINT8 WR2; +// UINT8 WR3; + UINT8 WR4; + UINT8 WR5; UINT8 dummydat; +// UINT8 padding; - DMAPAIR ADR_A; - DMAPAIR ADR_B; - DMAPAIR BYT_L; - - DMAPAIR CNT_A; - DMAPAIR CNT_B; - DMAPAIR BYT_N; - - UINT8 WR[8]; - - UINT WR_CNT; - UINT WR_OFF; - UINT RR_CNT; - UINT RR_OFF; - UINT8 WR_TBL[16]; - UINT8 RR_TBL[16]; -} DMAC; + DMACNT cnt_a; + DMACNT cnt_b; + DMALENG leng; + DMAADDR addr; -#if 0 -#define DMAOFST(item) (BYTE)(&(((DMA_TABLE *)NULL)->item)) + UINT wcnt; + UINT wptr; + UINT rcnt; + UINT rptr; + UINT8 wtbl[8]; + UINT8 rtbl[8]; +} DMAC; -#if (defined(NP2_LITTLEENDIAN) || defined(NP2_TESTBIGENDIAN)) -#define DMAOFST_L(item) (BYTE)(&(((DMA_TABLE *)NULL)->item.b[0])) -#define DMAOFST_H(item) (BYTE)(&(((DMA_TABLE *)NULL)->item.b[1])) -#else -#define DMAOFST_L(item) (BYTE)(&(((DMA_TABLE *)NULL)->item.b[1])) -#define DMAOFST_H(item) (BYTE)(&(((DMA_TABLE *)NULL)->item.b[0])) -#endif #endif @@ -74,7 +182,10 @@ typedef struct { extern "C" { #endif -void IOOUTCALL dmac_o(UINT port, REG8 value); // x1_dma_w +void dmac_sendready(BRESULT ready); +BRESULT ieitem_dmac(UINT id); + +void IOOUTCALL dmac_o(UINT port, REG8 dat); // x1_dma_w REG8 IOINPCALL dmac_i(UINT port); // x1_dma_r void dmac_reset(void);