PCI Express设备驱动 (1)
2011-08-22 11:03
190 查看
Virtex®-5 FPGA Integrated Endpoint 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> #include <linux/pci.h> #include <linux/interrupt.h> // request_irq() #include <linux/sched.h> // #define TASK_INTERRUPTIBLE 1
/* interruptible_sleep_on / wait_event_interruptible
interruptible_sleep_on_timeout / wait_event_interruptible_timeout
wake_up_interruptible(x) */
#include <linux/wait.h>
// void writel (unsigned char data , unsigned short addr ) #include <asm/io.h>
// copy_from_user / copy_to_user #include <asm/uaccess.h> /* DMA Register Locations (byte offset from BAR 0) */
// EP DDR2 memory address for DMA write operation.
#define WRITE_DDR2_SA_OFFSET 0x0
// Lower 32-bit address of system memory buffer for DMA write operation.
#define WRITE_HOST_DA_L_OFFSET 0x4
// Upper 32-bit address of system memory buffer for DMA write operation.
#define WRITE_HOST_DA_U_OFFSET 0x8
// Lower 32-bit address of system memory buffer for DMA READ operation.
#define READ_HOST_SA_L_OFFSET 0xC
// Upper 32-bit address of system memory buffer for DMA READ operation. #define READ_HOST_SA_U_OFFSET 0x10
// EP DDR2 memory address for DMA READ operation.
#define READ_DDR2_DA_OFFSET 0x14
// Write DMA TLP Size Register(from DDR2 to mm).
#define WRITE_SIZE_OFFSET 0x18
// Read DMA TLP Size Register(from mm to DDR2).
#define READ_SIZE_OFFSET 0x1C
// DMA Control and Status Register
#define DMA_CST_OFFSET 0x28#define WRITE_DMA_COUNTER_OFFSET 0x30 // Write DMA Number of Completions Register#define READ_DMA_COUNTER_OFFSET 0x34 // Read DMA Number of Completions Register#define PCI_DEVICE_ID_EP_PIPE 0x0007 // Device ID#define DEV_NAME "card007"static int card_probe(struct pci_dev *pdev, const struct pci_device_id *id);static void card_remove(struct pci_dev *pdev);static int card_open(struct inode *inode, struct file *filp);static int card_release(struct inode *inode, struct file *filp);static ssize_t card_read(struct file *file, char __user *buf, size_t count, loff_t *f_pos);static ssize_t card_write(struct file *file, const char __user *buf, size_t count, loff_t *f_pos);//static irqreturn_t card_interrupt(int irq, void * dev);
相关文章推荐
- PCI Express设备驱动 (7,linux对于多个MSI中断向量的支持)
- PCI Express设备驱动 (2)
- PCI Express设备驱动 (3)
- PCI Express设备驱动 (6)
- PCI Express设备驱动 (4,PCIe配置空间和PCI设备中的寄存器)
- PCI Express设备驱动 (8,驱动的编译、安装、卸载)
- PCI Express设备驱动 (4,PCIe配置空间和PCI设备中的寄存器)
- PCI Express设备驱动 (9,用户态API)
- linux字符设备驱动
- 第三章:字符设备驱动
- LINUX设备驱动之设备模型一--kobject
- C#访问设备驱动
- DriverStudio 和 WDF驱动 通过GUID获取设备句柄的差别
- Linux USB 驱动开发(一)—— USB设备基础概念
- 字符设备驱动、平台设备驱动、设备驱动模型、sysfs的比较和关联
- SylixOS中RTC设备驱动
- 字符设备驱动--外部中断
- Linux设备驱动之——I2C总线
- Linux视频设备驱动常用控制命令使用说明
- linux powerpc i2c驱动 之 i2c设备…