查看: 2138|回复: 0

ARM2440在linux驱动DMA传输时无法正常工作

[复制链接]

该用户从未签到

发表于 2012-3-8 11:28:15 | 显示全部楼层 |阅读模式
分享到:
简介:ARM2440与FPGA通信,通过DMA方式。ARM的DMA请求信号(XnDREQ0)由FPGA提供。
 
问题:在驱动程序中配置好DMA控制器后,打开DMA控制器,理论上是控制器应该等待请求信号XnDREQ0有效,才
发起DMA传输。但是问题在于,当打开DMA控制器后,不管外部XnDREQ0信号如何给定(调试时用外部电平给),
DMA控制器均发起DMA传输。
驱动源代码:#include  
#include
#include
#include
#include
#include           //copy_to_use, copy_from_user 
#include  
//#include    
#include                 //readl, readb, writel, writeb
#include
//#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define XDREQ0_MAJOR 239
#define XDREQ0_MINOR 0
#define dma_base  (ioremap(0x4B000000,0x24))
#define DMA_DISRC0 (dma_base)
#define DMA_DISRCC0 (dma_base+0x4)
#define DMA_DIDST0   (dma_base+0x8)
#define DMA_DIDSTC0  (dma_base+0xC)
#define DMA_DCON0   (dma_base+0x10)
#define DMA_DSTAT0  (dma_base+0x14)
#define DMA_DCSRC0  (dma_base+0x18)
#define DMA_DCDST0  (dma_base+0x1C)
#define DMA_DMASKTRIG (dma_base+0x20)
#define mydma_channel 0
#define GPB_base (ioremap(0x56000010,0x0C))
#define GPBCON (GPB_base)
#define GPBDAT (GPB_base+0x4)
#define GPBUP  (GPB_base+0x8)
MODULE_AUTHOR("hankle"); 
MODULE_DESCRIPTION("s3c2440 dma driver"); 
MODULE_LICENSE("GPL");
struct device *my_cdev;
struct class *my_class;
/*open*/
int fifo_dma_open(struct inode * inode,struct file * filp)
{
    printk("dma is open\n");
    //try_module_get(THIS_MODULE);
    return 0;
}
int fifo_dma_release(struct inode * inode,struct file * filp)
{
   printk("dma is released!\n");
    //module_put(THIS_MODULE);
    return 0;
}
ssize_t fifo_dma_read(struct file *filp, unsigned long *buff,size_t count,loff_t *f_ops)
{
 unsigned long a,b,c,d,e;
 int transfer_flag;
 unsigned long srcaddr;
   unsigned long dma_distaddr;
 unsigned long order;
 dma_addr_t *dma_buf_virt;

 printk(KERN_ALERT"Kmalloc count %d",count);
 order = get_order(count);
 dma_buf_virt = __get_free_pages(GFP_KERNEL|GFP_DMA,order);
 dma_distaddr = virt_to_phys(dma_buf_virt);
 printk(KERN_ALERT"dma_buf_phy address is %lx \n",dma_distaddr);
 
 srcaddr = 0x12000000; //GCS2 select
 writel(srcaddr,DMA_DISRC0);
 a= readl(DMA_DISRC0);
 printk(KERN_ALERT"DMA_DISRC0 is %lx \n",a);
 
 writel(((0
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条



手机版|小黑屋|与非网

GMT+8, 2025-1-9 23:27 , Processed in 0.105999 second(s), 15 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.