VxWorks 653中如何读写PCI设备上的内存?

发布于 2024-10-10 03:39:37 字数 1896 浏览 5 评论 0原文

我使用的是 VxWorks 653,我的目标是 wrSbc7457 Power PC。

我的 wrSbc7457 上有一个夹层卡,我正在尝试写入/读取该夹层卡上的内存。

对于熟悉 VxWorks 的人来说,我的 ModuleOS 的 usrAppInit() 函数中有以下内容:

printf ( "Entering ModuleOS, usrAppInit() ...\n" ) ;
printf ( "sysModel() returns %s\n", sysModel() ) ;
pciDeviceShow ( 0 ) ;


{
int pciBus, pciDevice, pciFunc ;
UINT32  BAR_0_contents, BAR_1_contents ;

printf
    ( "\npciFindDevice returns STATUS %d\n",
            pciFindDevice ( my_VENDORID, my_PMC_DEVICEID, 0, &pciBus, &pciDevice, &pciFunc )
    ) ;
printf ( "\tand pciBus = %d, pciDevice = %d, pciFunc = %d\n", pciBus, pciDevice, pciFunc ) ;

printf ( "\npciConfigInLong returns STATUS %d\n",
        pciConfigInLong ( pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_0, & BAR_0_contents ) ) ;
printf ( "\tand Base Address Register 0 contains 0x%X\n", BAR_0_contents ) ;
printf ( "\npciConfigInLong returns STATUS %d\n",
        pciConfigInLong ( pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_1, & BAR_1_contents ) ) ;
printf ( "\tand Base Address Register 1 contains 0x%X\n", BAR_1_contents ) ;

加载操作系统启动映像时,我的目标输出以下内容:

Entering ModuleOS, usrAppInit() ...

sysModel() returns wrSbc7457 Power PC

Scanning function 0 of each PCI device on bus 0
Using configuration mechanism 0
bus       device    function  vendorID  deviceID  class
00000000  00000000  00000000  0000----  0000----  000-----
00000000  00000001  00000000  0000----  0000----  00--0000
00000000  00000002  00000000  0000----  0000----  000-----

pciFindDevice returns STATUS 0 (OK)
        and pciBus = 0, pciDevice = 1, pciFunc = 0

pciConfigInLong returns STATUS 0 (OK)
        and Base Address Register 0 contains 0x50000000

pciConfigInLong returns STATUS 0 (OK)
        and Base Address Register 1 contains 0x58000000

我的问题是:如何映射我的夹层卡的内存写入主机的地址空间,然后如何写入/读取该夹层卡上的内存?

I'm using VxWorks 653, and my target is the wrSbc7457 Power PC.

I have a mezzanine card on my wrSbc7457, and I'm trying to write/read the memory on that mezzanine card.

For those of you familiar with VxWorks, I have the following in the usrAppInit() function of my ModuleOS:

printf ( "Entering ModuleOS, usrAppInit() ...\n" ) ;
printf ( "sysModel() returns %s\n", sysModel() ) ;
pciDeviceShow ( 0 ) ;


{
int pciBus, pciDevice, pciFunc ;
UINT32  BAR_0_contents, BAR_1_contents ;

printf
    ( "\npciFindDevice returns STATUS %d\n",
            pciFindDevice ( my_VENDORID, my_PMC_DEVICEID, 0, &pciBus, &pciDevice, &pciFunc )
    ) ;
printf ( "\tand pciBus = %d, pciDevice = %d, pciFunc = %d\n", pciBus, pciDevice, pciFunc ) ;

printf ( "\npciConfigInLong returns STATUS %d\n",
        pciConfigInLong ( pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_0, & BAR_0_contents ) ) ;
printf ( "\tand Base Address Register 0 contains 0x%X\n", BAR_0_contents ) ;
printf ( "\npciConfigInLong returns STATUS %d\n",
        pciConfigInLong ( pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_1, & BAR_1_contents ) ) ;
printf ( "\tand Base Address Register 1 contains 0x%X\n", BAR_1_contents ) ;

My target outputs the following when the OS boot image is loaded:

Entering ModuleOS, usrAppInit() ...

sysModel() returns wrSbc7457 Power PC

Scanning function 0 of each PCI device on bus 0
Using configuration mechanism 0
bus       device    function  vendorID  deviceID  class
00000000  00000000  00000000  0000----  0000----  000-----
00000000  00000001  00000000  0000----  0000----  00--0000
00000000  00000002  00000000  0000----  0000----  000-----

pciFindDevice returns STATUS 0 (OK)
        and pciBus = 0, pciDevice = 1, pciFunc = 0

pciConfigInLong returns STATUS 0 (OK)
        and Base Address Register 0 contains 0x50000000

pciConfigInLong returns STATUS 0 (OK)
        and Base Address Register 1 contains 0x58000000

My question is: how do I map the memory of my mezzanine card into my host's address space, and then how do I write/read the memory on that mezzanine card?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心舞飞扬 2024-10-17 03:39:37

不幸的是,没有普遍的答案。您必须对 PCI 桥进​​行编程。
其中一些取决于您是否使用 PCI 自动配置。

您应该查看 pciConfig 和/或 pciAutoConfig 的库参考。

您的设备看起来有两个地址空间,分别为 0x50000000 和 0x58000000,但我相信那是 PCI 地址空间,而不是主机桥映射。

Unfortunately, there is no universal answer. You have to program the PCI bridge.
Some of it depends if you use the PCI auto configuration or not.

You should look at the library references for pciConfig and/or pciAutoConfig.

Your device looks like it has two address spaces at 0x50000000 and 0x58000000, but I believe that's the PCI address space, not the host bridge mapping.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文