基于PCIExpress总线的DMA数据传输的研究

 2022-02-07 09:02

论文总字数:30584字

摘 要

随着计算机和通讯技术的不断发展,科研和工程应用场景中对数据的采集和存储速率有着越来越高的要求。尤其在图像测量领域,科研人员对高速、高分辨率图像的实时采集与存储提出了更高的要求。本课题以PCIe总线技术为背景,利用基于PCIe的DMA传输技术,研究并设计出PCIe总线作为高速图像传输通道的点对点交换系统。

本文首先分析了PCIe总线体系结构,并对描述符链表式DMA的接口以及内部逻辑进行了讨论,制定出了基于PCIe总线的数据交换方案。在设计方面,以Xilinx 7系列FPGA为硬件开发平台,基于Northwest Logic 描述符链表式DMA软核以及Xilinx PCIe硬核,实现了DMA控制器硬件逻辑和PCIe接口。其次,本文基于Linux系统,设计了PCIe设备驱动程序,实现了系统内存与PCIe板卡之间的数据交换。最后,基于GTK图形库设计了用户程序,通过用户界面可以实时显示数据传输速率与设备状态。

本文完成了PCIe设备与上位机间的数据交换系统。通过实验,PCIE 2.0单通道的实际接收速率达到340MB/s,发送速率达到260MB/s,达到了较高的传输速率,可以应用到高速相机的传输与存储通道中。

关键词:PCI Express,DMA,FPGA,Linux驱动,IP核

A STUDY ON DMA TRANSMISSION BASED ON PCI EXPRESS

Abstract

With the development of computer and communication technology, information products in terms of transmission speed have higher requirements. In order to meet the needs of image transmission, project aims to study the DMA data transfer on the PCI Express bus.

The hardware side, we realize DMA controller hardware and PCIe interfaces in Xilinx 7 Series development board, using the company's Northwest Logic DMA core and the PCIe core. The software, under Linux device drivers and applications are designed to achieve DMA transfers between the system memory and the board memory. In this paper, firstly, the PCI Express bus and the DMA transfer principles are summarized, and then DMA control registers in DMA core and the descriptor structure are introduced, and then focuses on how to write a driver under Linux, realize the driver of the hardware and data transmission control, transmission speed and real-time access status of the device and displayed on the application interface.

After compiling the driver and loading driver, we establish a single channel. According to our experiments, the actual transfer speeds can up to 340MB / s. And because of the scalability in PCI Express, when establishing x4 channels can reach 1.3GB / s, fully meet the image transmission demand.

KEY WORDS: PCI Express,DMA,FPGA,Linux Driver,IP Core

目 录

摘 要 I

Abstract II

第一章 绪 论 1

1.1 课题研究背景 1

1.2 主要工作目标和整体设计方案 2

第二章 PCI Express总线简介 4

2.1 PCI Express 的发展与现状 4

2.2 PCI Express体系结构 5

2.3 本章小结 7

第三章 DMA传输与DMA核 8

3.1 DMA传输原理 8

3.2 DMA控制器的工作模式——描述符工作模式 8

3.3 Northwest Logic的DMA核 9

3.3.1描述符的结构和描述符链表 9

3.3.2 DMA核的寄存器 13

3.4 本章小结 15

第四章 Linux下驱动程序以及应用程序的设计与实现 16

4.1 Linux驱动设备的分类 16

4.2 基于PCI Express的DMA传输设备驱动的实现 16

4.2.1 设备注册 18

4.2.2 设备注销 18

4.2.3 探测设备 18

4.2.4 设备移除 19

4.2.5 给应用层提供设备控制的接口 20

4.2.6 DMA描述符与缓冲区的管理 21

4.2.7 驱动对硬件设备的读写 23

4.3 应用程序的实现 24

4.3.1 窗口控件的创建 24

4.3.2 控件的功能的实现 26

4.3.3 应用程序中对设备驱动的控制 26

4.3.4 应用程序实时得获取统计 27

4.4 本章小结 27

第五章 设备驱动编译、加载与测试 28

5.1 环境准备 28

5.2 驱动编译 29

5.3 驱动加载和创建设备文件 29

5.4 DMA传输的性能测试 30

5.5 本章小结 32

总结 33

致谢 34

参考文献(References) 35

第一章 绪 论

1.1 课题研究背景

随着计算机的发展,我们如今来到了高速的互联时代。以昔日的PCI总线为代表的总线标准渐渐不能满足如今高速场景的要求。比如足球场上用来直播和帮助裁判判断进球的高分辨的高速摄像机,它们能够以每秒数百帧的速度采集图像。其中的传输上的接口如若使用PCI总线是达不到采集的要求的。再比如高速网卡、显卡等高带宽的产品,PCI总线已经成为了其速度提升的瓶颈[1]。

PCI-Express3.0是最新的总线和接口标准,是第三代I/ O总线技术。PCIe属于高速串行点对点双高带宽传输:设备之间不共享总线带宽,支持主动电源管理,错误报告,端到端传输的可靠性,服务质量(QOS)以及热插拔等功能[2]。

剩余内容已隐藏,请支付后下载全文,论文总字数:30584字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;