没有合适的资源?快使用搜索试试~ 我知道了~
首页嵌入式系统/ARM技术中的Linux PCI驱动的编写
嵌入式系统/ARM技术中的Linux PCI驱动的编写
589 浏览量
更新于2023-03-16
评论
收藏 57KB PDF 举报
作者:曹忠明,华清远见嵌入式学院讲师。 PCI是外围设备互联的简称(Peripheral Component Interconnect)的简称,作为一种通用的总线接口标准,他在计算机系统中得到了广泛的使用。PCI的速度能够达到132M/s。在这里简单的介绍一下 linux 下PCI驱动的实现。 在编写一个PCI驱动的时候我们先得确定系统中是否有我们的设备。我们可以通过lspci查看PCI设备。 [root@localhost ~]# lspci 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX
资源详情
资源评论
资源推荐

嵌入式系统嵌入式系统/ARM技术中的技术中的Linux PCI驱动的编写驱动的编写
作者:曹忠明,华清远见嵌入式学院讲师。 PCI是外围设备互联的简称(Peripheral Component Interconnect)
的简称,作为一种通用的总线接口标准,他在计算机系统中得到了广泛的使用。PCI的速度能够达到132M/s。
在这里简单的介绍一下 linux 下PCI驱动的实现。 在编写一个PCI驱动的时候我们先得确定系统中是否有我
们的设备。我们可以通过lspci查看PCI设备。 [root@localhost ~]# lspci 00:00.0 Host bridge: Intel
Corporation 440BX/ZX/DX - 82443BX/ZX
作者:曹忠作者:曹忠明明,华清远见嵌入式学院讲师。
PCI是外围设备互联的简称(Peripheral Component Interconnect)的简称,作为一种通用的总线接口标准,他在计算机系
统中得到了广泛的使用。PCI的速度能够达到132M/s。在这里简单的介绍一下 linux 下PCI驱动的实现。
在编写一个PCI驱动的时候我们先得确定系统中是否有我们的设备。我们可以通过lspci查看PCI设备。
[root@localhost ~]# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:0f.0 VGA compatible controller: VMware Inc Abstract SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware Inc PCI bridge (rev 02)
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
02:01.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
02:02.0 USB Controller: VMware Inc Abstract USB2 EHCI Controller
确定有设备以后,我们就可以开始我们的PCI设备驱动的编写了。
1、 首先我们介绍几个必须了解的结构体
pci_driver:这个结构体定义在include/linux/pci.h,这里我们最关注的是id_table、probe和remove。id_table是一个结构体
数组,用来存放驱动程序适用的设备信息,probe用于检测设备,remove为设备卸载时调用。
struct pci_driver {
struct list_head node;
char *name;
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
int (*resume) (struct pci_dev *dev); /* Device woken up */
int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
void (*shutdown) (struct pci_dev *dev);
struct pci_error_handlers *err_handler;
struct device_driver driver;


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0