TIwilliam hill官网
直播中

李艳茹

7年用户 163经验值
私信 关注
[问答]

关于C6678的PCIE中BAR配置问题

各位ti的高手好,
我最近在做一个项目用到了C6678的PCIE,通过PCIe连接6678和一个PC主机(win7),我已经成功跑起来了pdk中PCIe的例程,在PC上用WinDriver也能发现设备。现在有几个问题想要搞明白:
1.pdk的PCIE例程中配置了bar1基地址为0x70000000,我通过WinDriver查看bar1基地址也是0x70000000,然后用WinDriver在bar1中写数据,那么该数据写在6678的DDR中的物理地址是多少?
2.我把bar1的基地址改为0x90000000后,发现数据写在了6678的DDR中0x60000000的物理地址上,这个映射可以在哪里找到?我应该怎么配置Bar1才可以让它映射在想要的物理地址上?
3.这个映射和Inbound和Outbound的配置有无关系?我改了inbound的addr_Lo后发现bar1为0x90000000使数据还是写在了DDR的0x60000000上。

回帖(2)

高欢

2018-6-19 04:45:34
通过BAR和inbound region配置,
大致流程是:PCIE inbound端会对接收到的PCIE packet的PCIE BUS address和 BAR进行匹配,如果发现和其中某一个BAR一致,那么就按照该BAR对应的inbound region进行映射。具体流程你可以参考userguide,下面是2个例子,帮助理解:

Example 1: Inbound write, destination buffer 32KB in L2, 32-bit addressing

CMD_STATUS[IB_XLT_EN] = 1 (Inbound address translation enabled)

The target packets with PCIe address 0x9001_5678~0x9001_D677 (32KB)  (Based on the previous Outbound Address Translation Example 1).

BAR1 = 0x9000_0000 (bits [3:0]=0000b, means 32-bit, non-prefetchable, memory BAR).
BAR1 Mask register is 0x00FF_FFFF. So BAR1 window size is 16MB.
BAR1 accepts this inbound write request since the window includes the PCIe address of the target packets.

IB_BAR0 = 1 (BAR1 is selected for IB Region 0)
IB_START0_HI = 0x0 (upper 32 bits are zero for 32-bit addressing)
IB_START0_LO= 0x9000_0000
IB_OFFSET0 = 0x1086_0000

Then the starting internal device address
= PCIe address – (IB_START0_HI:IB_START0_LO) + IB_OFFSET
= (0x9001_5678) – (0x9000_0000) + (0x1086_0000) = 0x1087_5678


Example 2: Inbound read, destination buffer 12MB in DDR, 64-bit addressing
CMD_STATUS[IB_XLT_EN] = 1 (Inbound address translation enabled)

The target packets with PCIe address 0x12345678_70000000~0x12345678_70BFFFFF (12MB) (Based on the previous Outbound Address Translation Example 2).

BAR2 = 0x7000000C (bits [3:0]=1100b, means 64-bit, prefetchable, memory BAR).
BAR3 = 0x12345678 (BAR3 Mask register is 0x0, non-masked)
BAR2 Mask register is 0x0FFF_FFFF. So BAR2&3 window size is 256MB.
BAR2&3 accept this inbound read request since the window includes the PCIe address of the target packets.

IB_BAR1 = 2 (BAR2&3 are selected for IB Region 1 for 64-bit addressing)
IB_START1_HI = 0x12345678 (upper 32 bits are zero for 32-bit addressing)
IB_START1_LO= 0x7000_0000
IB_OFFSET1 = 0x8700_0000

Then the starting internal device address
= PCIe address – (IB_START0_HI:IB_START0_LO) + IB_OFFSET
= (0x12345678_70000000) – (0x12345678_70000000) + (0x8700_0000)
= 0x8700_0000

So the data located in the buffer as 0x8700_0000~0x87BF_FFFF are fetched by the PCIe master port with PCIe address 0x12345678_70000000~0x12345678_70BFFFFF (no EDMA or CPU is involved in local device for the inbound transfer).
So the data packets with PCIe address 0x9001_5678~0x9001_D677 are transferred to the destination buffer as 0x1087_5678~0x1087_D677 by the PCIe master port (no EDMA or CPU is involved in local device for the inbound transfer).
举报

李艳茹

2018-6-19 04:52:32
引用: liuqin123 发表于 2018-6-19 04:45
通过BAR和inbound region配置,
大致流程是:PCIE inbound端会对接收到的PCIE packet的PCIE BUS address和 BAR进行匹配,如果发现和其中某一个BAR一致,那么就按照该BAR对应的inbound region进行映射。具体流程你可以参考userguide,下面是2个例子,帮助理解:

谢谢,很详细,我在Windriver上看到的的BAR1的地址和我在6678配置的一样的原因也找到了,是因为上电顺序问题,应该6678先上电,Windows才会给它分配资源
举报

更多回帖

发帖
×
20
完善资料,
赚取积分