PCIe事务包解析与单片机实现

单片机 专栏收录该内容
¥59.90 ¥99.00
130篇文章

PCI Express(Peripheral Component Interconnect Express)是一种高速、高可靠性、低延迟的计算机总线标准,它可以在计算机系统中进行快速数据传输和通信。在PCIe中,数据是通过事务包进行传输的,因此理解PCIe事务包的结构和工作原理对于理解PCIe总线至关重要。本文将详细介绍PCIe事务包的结构、类型、状态和流程,并提供使用单片机实现的源代码。

一、PCIe事务包结构

每个PCIe事务包由一个头部和一个数据负载组成,如图1所示。头部提供了必要的控制信息,包括事务包类型、目标设备地址、数据传输方向、事务包长度等。数据负载则包含了事务包所要传输的实际数据。在PCIe中,数据负载可以是存储器读取、存储器写入、IO读取、IO写入等多种类型。

图1 PCIe事务包结构

二、PCIe事务包类型

PCIe中定义了多种不同类型的事务包,最基本的有四种:读取请求(Memory Read Request)、写入请求(Memory Write Request)、读取完成回复(Completion with Data)和写入完成回复(Completion without Data)。在这些基本类型的基础上,PCIe还支持多种扩展类型的事务包,在不同的应用场合下选择不同的事务包类型可以获得更好的性能和效率。

  1. 读取请求(Memory Read Request)

当一个PCIe设备想要从另一个PCIe设备中读取数据时,它会发送一个读取请求事务包。读取请求事务包包含了读取地址和读取长度等信息,目标设备在接收到读取请求之后需要返回相应的数据。图2是一个典型的读取请求事务包示例。

图2 读取请求事务包示例

二、PCIE的TLP包的封包解包原理 熟悉 PCIE 的组建包的过程,以及内部的字段细节的定 义,掌握如何发送接收 Mrd(memory read TLP)、 Mwr(Memory write TLP)、Cpl (Completion TLP)和 Cpld(Completion with data TLP)命令包,深入理解 PCIE 底层协议工作过程 阅读详情

相关推荐

PCIe学习笔记1:PCIe体系架构——PCIe简介

PCI Express(PCIe)学习笔记

membre_non的博客 2万+

使用单片机实现PCIe配置空间的扩展

PCIe的配置空间是由各种配置寄存器(Configuration Register)组成的,每个配置寄存器有自己的地址和功能。在实际应用中,可根据具体需求进行硬件电路和软件代码的修改,以满足不同的应用场景。本设计采用STM32F407单片机作为主控芯片,通过SPI接口与PCIe控制器进行通信,实现对PCIe的配置空间进行读写操作。然后可以使用PCIe调试工具对配置空间的读写进行测试,以验证本设计的正确性。代码实现方面主要分为两部分,一部分是SPI接口的初始化配置,另一部分是实现PCIe配置空间的读写操作。

VfhBlockchain的博客 1944

PCIe事务包解析与单片机应用

本文将详细介绍PCIe事务包的结构和解析,并探讨如何在单片机应用中使用PCIe通信。本文详细介绍了PCIe事务包的结构和解析过程,并给出了在单片机应用中使用PCIe通信的示例代码。在头部中,每个双字(32位)包含了控制信息和地址信息,用于指示事务的类型、传输方向、目标设备等。一个完整的PCIe事务包由头部(Header)、有效载荷(Payload)和尾部(Tail)组成。在解析过程中,首先将接收到的数据存储在一个结构体变量packet中。在接收端,需要对接收到的PCIe事务包进行解析,以提取出所需的信息。

server_api196的博客 156

SAP生产版本导入避坑大全:从‘黄灯’到‘绿灯’,详解CM_FV_MKAL_CONSISTENCY_CHECK检查函数

本文深入解析SAP生产版本导入过程中的常见问题,特别是通过`CM_FV_MKAL_CONSISTENCY_CHECK`检查函数从‘黄灯’异常到‘绿灯’正常的修复方法。涵盖静态与动态校验机制、典型异常场景诊断及批量导入最佳实践,帮助SAP运维人员高效解决生产版本管理难题。

weixin_30568591的博客 389

Python爬虫(一)京东商品价格及详情页抓取

这是一个以http://item.jd.com/2957726.html为例的单网页抓取案例 import urllib.request; #载入urllib.request,用于获取页面html源代码 from pandas import Series; #载入series包 from pandas import DataFrame; #载入dataframe包 from bs4 impo

Data Proc 1万+

Unity物理引擎实战:从刚体重心到碰撞体,打造真实不倒翁交互

刚体(Rigidbody)是Unity物理系统的核心组件,它定义了游戏对象的物理属性,如质量、阻力和碰撞响应。其原理基于牛顿力学,通过物理引擎(如PhysX)实时计算物体的运动状态。在游戏开发中,刚体的价值在于能够模拟真实世界的物理行为,为玩家提供沉浸式的交互体验。碰撞体(Collider)则定义了物体的形状边界,用于检测与其他物体的接触。通过精细调整刚体的重心(Center of Mass)和碰撞体形状,开发者可以模拟出各种有趣的物理现象,例如低重心物体的动态平衡。这在休闲游戏、物理玩具模拟等场景中尤为实

weixin_33976326的博客 356

第四节、C# 上位机面向对象编程详解(工控硬件继承实战版)

继承核心价值:在 C# 上位机工控开发中,继承的核心是通用逻辑复用与接口统一,将所有硬件的通用属性 / 方法封装到抽象基类,子类只需实现独有逻辑,大幅减少冗余代码。基类设计要点:优先使用抽象基类,合理分配访问修饰符(privateprotectedpublic),定义通用事件与虚方法,提供资源释放机制,兼顾复用性与扩展性。子类设计要点:通过: base()调用基类构造函数,强制实现抽象方法(保证接口统一),选择性重写虚方法(实现独有逻辑),复用基类的protected成员。多设备管理。

kylezhao2019的博客 787

AI在保险产品定价优化中的创新应用

在当今保险市场中,准确合理的产品定价是保险公司实现可持续发展的关键因素之一。传统的保险产品定价主要基于经验数据和精算模型,但这种方式往往存在数据处理效率低、对复杂风险因素考虑不足等问题。本文的目的在于深入探讨AI技术如何在保险产品定价中进行创新应用,以提高定价的准确性、效率和灵活性,更好地满足市场需求和客户个性化需求。本文的范围涵盖了AI技术在保险产品定价各个环节的应用,包括风险评估、费率计算、产品设计等方面。同时,还会涉及到相关的核心算法、数学模型以及实际应用案例等内容。

欢迎来到我的优快云空间!这里聚焦AI大模型应用实战,分享前沿技术、实战案例与开发经验。 983

TC397 EB MCAL开发从0开始系列 之 [13.1] Dma配置实战 -实现M2M数据传输(读存储写存储)

TC3XX TC397 MCAL DMA 从0搭建测试用例-实现M2M 存储到存储数据传输

yy九歌的博客 1917

【K210+STM32项目】基于K210与STM32协同工作的智能垃圾分类系统设计与实现(更新3.0版本)(完整工程资料源码)

STM32F407STM32F407_2(含有app功能)

嵌入式技术开发 2497

PyTorch生成式人工智能(25)——基于Transformer实现机器翻译

不同于循环神经网络 (RNN) 按顺序处理数据,Transformer 以并行的方式处理输入数据(例如句子)。这种并行处理提高了效率,但并未使其能够识别输入的顺序。为了解决这个问题,Transformer 向输入的词嵌入中添加了位置编码。这些位置编码是分配给输入序列中每个位置的独特向量,其维度与输入词嵌入对齐。本节将以英语到法语的翻译为例,通过介绍如何训练 Transformer 模型将英语句子转换为法语,深入理解 Transformer 的架构及自注意力机制的运作方式。

盼小辉丶的博客 2805

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

上一篇: Framebuffer设备显示测试程序编写
下一篇: 使用Wireshark分析单片机的FTP通信
普通网友
博客等级 码龄3年 79粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值