2011年8月22日

PCI Express设备驱动 (4,PCIe配置空间和PCI设备中的寄存器)

摘要: 1、访问PCI配置空间,PCI基本配置空间的读写使用下列函数: 原型定义在<linux/pci.h>int pci_read_config_byte(struct pci_dev *pdev, int where, u8 *val);int pci_read_config_word(struct pci_dev *pdev, int where, u8 *val);int pci_read_config_dword(struct pci_dev *pdev, int where, u8 *val);通过8位、16位或32位的数据传输访问配置空间。从由pdev标识的设备空间读入一个、 阅读全文

posted @ 2011-08-22 17:15 zzwworld 阅读(9686) 评论(0) 推荐(0)

PCI Express设备驱动 (3)

摘要: //打开设备文件系统调用对应的操作static int card_open(struct inode *inode, struct file *filp){ return 0;}//关闭设备文件系统调用对应的操作static int card_release(struct inode *inode, struct file *filp){ return 0;}static ssize_t card_read(struct file *file, char __user *buf, size_t count, loff_t *f_pos){ void* virt_addr = ... 阅读全文

posted @ 2011-08-22 15:22 zzwworld 阅读(2607) 评论(0) 推荐(0)

PCI Express设备驱动 (2)

摘要: #include "card.h"#include <linux/time.h>#include <linux/spinlock.h>#define DMA_MASK 0xffffffff#define test_dri_major 249 // 主设备号//#define INT_ASSERT_W 0x02 // DMA Write Complete//#define INT_ASSERT_R 0x10 // DMA Read Complete/* PCI 驱动基本框架 */static struct pci_device_id card_ids[ 阅读全文

posted @ 2011-08-22 15:16 zzwworld 阅读(3054) 评论(1) 推荐(1)

PCI Express设备驱动 (1)

摘要: Virtex®-5 FPGA IntegratedEndpoint Block for PCI Express® designs.(the integrated Endpoint block embedded in Virtex-5 devices.)//头文件card.h#include <linux/module.h>#include <linux/init.h> //指定初始化和清楚函数#include <linux/fs.h> //文件系统相关的函数和头文件#include <linux/cdev.h> #includ 阅读全文

posted @ 2011-08-22 11:03 zzwworld 阅读(3522) 评论(1) 推荐(1)

导航