Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use VxBus in vxworks

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use VxBus in vxworks. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Vx5's driver is entangled with BSP in most cases, for example, BSP needs to include sysDev.c. And Vx6 invented a new interface-VxBus. It not only standardizes the interface between Driver and Device, but also makes Driver independent of BSP and minimizes the architectural dependency of Driver. VxBus's driver is initialized in three steps, so the easiest example to write is

# include / * printf * / # include / * drvBusFuncs * / # include / * vxbPciRegister * /

# define MYDEVNAME "myDev"

Static void myDevInstInit (struct vxbDev * pDev); static void myDevInstInit2 (struct vxbDev * pDev); static void myDevInstConnect (struct vxbDev * pDev)

Static struct drvBusFuncs myDevFuncs = {myDevInstInit, / * devInstanceInit * / myDevInstInit2, / * devInstanceInit2 * / myDevInstConnect / * devConnect * /}

Static struct vxbDevRegInfo myDevReg = {NULL, VXB_DEVID_DEVICE, / * this is a Device Driver * / VXB_BUSID_PCI, / * this is a PCI Device * / VXB_VER_5_0_0, MYDEVNAME, & myDevFuncs, NULL, NULL, NULL}

Static void myDevInstInit (struct vxbDev * pDev) {} static void myDevInstInit2 (struct vxbDev * pDev) {} static void myDevInstConnect (struct vxbDev * pDev) {} void myDevRegister () {vxbDevRegister ((struct vxbDevRegInfo *) & myDevReg);}

Use vxBusShow ()-INCLUDE_VXBUS_SHOW to see the execution effect.

Alas, all the Orphan Device are connected to myDev. It seems that we have to filter it, first see what pci device there are, and randomly pick two free ones.

Change the type of myDevReg to vxbPciRegister and add device liststatic struct vxbPciID myDevIDList [] = {/ * devID, vendID * / {0x0740, 0x15ad}, {0x0790, 0x15ad}} Static struct vxbPciRegister myDevReg = {{NULL, / * pNext * / VXB_DEVID_DEVICE, / * BUS_DEVID_DEVICE or BUS_DEVID_BUSCTRL * / VXB_BUSID_PCI, / * PCI * / VXB_VER_5_0_0, / * vxbVersion * / MYDEVNAME, / * drvName * / & myDevFuncs / * pDrvBusFuncs * / NULL, / * pMethods * / NULL, / * devProbe * / NULL / * pParamDefaults * /}, NELEMENTS (myDevIDList), myDevIDList} There are only two myDev in the PCI Device this time, but how come the unit number is all 0?

You have to let driver add this number automatically every time it loads: when initializing, you can call a vxbNextUnitGet () to static void myDevInstInit (struct vxbDev * pDev) {vxbNextUnitGet (pDev);}

It will be normal if you execute it again.

The above is all the contents of the article "how to use VxBus in vxworks". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report