驱动源码:
#include “linux/module.h”
#include “linux/kernel.h”
#include “linux/fs.h”
#include “linux/init.h”
#include “linux/delay.h”
#include “linux/irq.h”
#include “asm/uaccess.h”
#include “asm/irq.h”
#include “asm/io.h”
#include “asm/arch/regs-gpio.h”
#include “asm/hardware.h”
#include “linux/poll.h”
#include “linux/dma-mapping.h”
#define MEM_CPY_NO_DMA 0
#define MEM_CPY_DMA 1
#define BUF_SIZE (512*1024)
#define DMA0_BASE_ADDR 0x4B000000
#define DMA1_BASE_ADDR 0x4B000040
#define DMA2_BASE_ADDR 0x4B000080
#define DMA3_BASE_ADDR 0x4B0000C0
struct s3c_dma_regs {
};
static int major = 0;
static char *src;
static u32 src_phys;
static char *dst;
static u32 dst_phys;
static struct class *cls;
static volatile struct s3c_dma_regs *dma_regs;
static DECLARE_WAIT_QUEUE_HEAD(dma_waitq);
// 中止事情标志, 中止服务程序将它置1,ioctl将它清0 //
static volatile int ev_dma = 0;
static int s3c_dma_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
}
static struct file_operations dma_fops = {
};
static irqreturn_t s3c_dma_irq(int irq, void *devid)
{
}
static int s3c_dma_init(void)
{
}
static void s3c_dma_exit(void)
{
}
module_init(s3c_dma_init);
module_exit(s3c_dma_exit);
MODULE_LICENSE(“GPL”);
==================================================================
测验程序:
#include “stdio.h”
#include “sys/types.h”
#include “sys/stat.h”
#include “fcntl.h”
#include “sys/ioctl.h”
#include “string.h”
// ./dma_test nodma
// ./dma_test dma
//
#define MEM_CPY_NO_DMA 0
#define MEM_CPY_DMA 1
void print_usage(char *name)
{
}
int main(int argc, char **argv)
{
}