1/* 2*参考arch/arm/mach-s3c24xx/dma-s3c2410.c 3*/ 4 #include5 #include6 #include7 #include8 #include9 #include10 #include11 #include12 #include13 #include14 #include15 #include16 #include17 #include18 #include19 #include20 #include21 22#define DMA_BASE 0x4b000000 23#define BUFF_SIZE 512 24 25static unsignedchar *src_addr;//源 26static unsignedchar *dst_addr;//目的 27staticint major; 28static dma_addr_t psrc_addr; 29static dma_addr_t pdst_addr; 30 31staticstructclass *dma_class; 32staticint dma_ok; 33#define MEM_COPY_NO_DMA 0 34#define MEM_COPY_BY_DMA 1 35static DECLARE_WAIT_QUEUE_HEAD(dma_waitq); 36 37struct dma_regs { 38 unsignedlong disrc; 39 unsignedlong disrcc; 40 unsignedlong didst; 41 unsignedlong didstc; 42 unsignedlong dcon; 43 unsignedlong dstat; 44 unsignedlong dcsrc; 45 unsignedlong dcdst; 46 unsignedlong dmasktrig; 47}; 48 49staticvolatilestruct dma_regs *dma_regs; 50 51long dma_ioctl(struct file *file, unsignedint cmd, unsignedlong dat) 52{ 53int i; 54 memset(src_addr,0xaa,BUFF_SIZE);//从src开始的BUFF_SIZE空间每个字节都设置为0xaa 55 memset(dst_addr,0x55,BUFF_SIZE); 56 57if(cmd == MEM_COPY_NO_DMA){ 58for(i =0; i