vxKernel/include/vhex/driver/mpu/sh/sh7305/dma.h

101 lines
2.6 KiB
C

#ifndef __VHEX_DRIVER_MPU_SH_SH7305_DMA__
# define __VHEX_DRIVER_MPU_SH_SH7305_DMA__
#include <vhex/defs/attributes.h>
#include <vhex/defs/types.h>
//---
// SH7305 Direct Memory Access Controller. Refer to:
// "Renesas SH7724 User's Manual: Hardware"
// Section 16: "Direct Memory Access Controller (DMAC)"
//
// However, there is some (minor) differencies with the DMA controller of
// the SH7305. Mainly, only the first channel have special features that
// other don't.
//---
/* sh7305_dma_channel_t - One of the main 6 channels of the DMA
Note that the many settings are only available on channels 0 to 3 (denoted
by [0..3]) or on channels 0 (denoted by [0]).
The documentation is apparently wrong about the placement is TS[3:2], the
neighboring read-only bit must be swapped before TS[3:2]. */
struct __sh7305_dma_channel
{
uint32_t SAR;
uint32_t DAR;
/* Mind that the 8 upper bits should always be written as 0 */
uint32_t TCR;
lword_union(CHCR,
uint32_t :1;
uint32_t LCKN :1; /* Bus Right Release Enable */
uint32_t :2;
uint32_t RPT :3; /* Repeat setting [0..3] */
uint32_t DA :1; /* DREQ Asynchronous [0] */
uint32_t DO :1; /* DMA Overrun [0] */
uint32_t :1;
uint32_t TS3 :1; /* Transfer Size (bit3) */
uint32_t TS2 :1; /* Transfer Size (bit2) */
uint32_t HE :1; /* Half-End flag [0..3] */
uint32_t HIE :1; /* Half-end Interrupt Enable [0..3] */
uint32_t AM :1; /* Acknowledge mode [0] */
uint32_t AL :1; /* Acknowledge level [0] */
uint32_t DM :2; /* Destination address Mode */
uint32_t SM :2; /* Source address Mode */
uint32_t RS :4; /* Resource Select */
uint32_t DL :1; /* DREQ Level [0] */
uint32_t DS :1; /* DREQ Source select[0] */
uint32_t TB :1; /* Transfer Bus Mode */
uint32_t TS1 :1; /* Transfer Size (bit1) */
uint32_t TS0 :1; /* Transfer Size (bit0) */
uint32_t IE :1; /* Interrupt Enable */
uint32_t TE :1; /* Transfer End flag */
uint32_t DE :1; /* DMA Enable */
);
} VPACKED(4);
/* sh7305_dma_t - DMA Controller */
struct __sh7305_dma
{
struct __sh7305_dma_channel DMA0;
struct __sh7305_dma_channel DMA1;
struct __sh7305_dma_channel DMA2;
struct __sh7305_dma_channel DMA3;
word_union(DMAOR,
uint16_t CMS :4; /* Cycle steal Mode Select */
uint16_t :2;
uint16_t PR :2; /* PRiority mode */
uint16_t :4;
uint16_t :1;
uint16_t AE :1; /* Address Error flag */
uint16_t NMIF :1; /* NMI Flag */
uint16_t DME :1; /* DMA Master Enable */
);
pad(14);
struct __sh7305_dma_channel DMA4;
struct __sh7305_dma_channel DMA5;
} VPACKED(4);
#define SH7305_DMA (*((volatile struct __sh7305_dma *)0xfe008020))
#endif /* __VHEX_DRIVER_MPU_SH_SH7305_DMA__ */