1) The VxWorks driver generally implements 7 API calls: create, open, read, write, ioctl, remove, close
2) Call iosDrvInstall to register the above 7 APIs in drvTable, and iosDrvShow can be used to display the content of the drvTable table, for example:
-> iosDrvShow
drv creat remove open close read write ioctl
0 0x0 0x0 0x30de14 0x30ded4 0x0 0x30de0c 0x30de4c
1 0x310f54 0x0 0x310f54 0x310fac 0x311c4c 0x311b1c 0x311000
2 0x0 0x0 0x30ead0 0x30ebe4 0x30ec3c 0x30ed00 0x30ee94
3 0x26a6b0 0x26ae1c 0x26a18c 0x26a7dc 0x26c148 0x26c188 0x26d6d0
4 0x36ead8 0x0 0x36ead8 0x36e070 0x36ed64 0x36efc0 0x36e6f4
5 0x30f5b4 0x0 0x30f5b4 0x30f608 0x30f6b8 0x30f7e0 0x30f874
6 0x30f564 0x0 0x30f564 0x30f65c 0x30f748 0x30f80c 0x30f958
7 0x0 0x0 0x0 0x385814 0x385880 0x385868 0x385898
8 0x390944 0x0 0x390944 0x390a30 0x311c4c 0x311b1c 0x390a88
9 0x38fe54 0x38fe60 0x38fc30 0x38ff7c 0x390218 0x390220 0x390228
value = 20 = 0x14
3) Use iosDevAdd to create a new device, and add the device to iosDvList, you can use iosDevShow (devs) to display the list of devices
-> iosDevShow
drv name
0 /null
1 /tyCo/0
8 /vio
9 /tgtsvr
3 /sd0:1
4 /sd0:2
value = 25 = 0x19
From the above two outputs, it can be seen that the driver number of the device named "/sd0:1" is 3, and the corresponding driver API function is:
3 0x26a6b0 0x26ae1c 0x26a18c 0x26a7dc 0x26c148 0x26c188 0x26d6d0
It can be seen from the disassembly code:
0x26a6b0–>dosFsCreate
0x26ae1c–>dosFsDelete
0x26a18c–>dosFsOpen
0x26a7dc–>dosFsClose
0x26c148–>dosFsRead
0x26c188–>dosFsWrite
0x26d6d0–>dosFsIoctl
3 Establish fd table FD_ENTRY ** iosFdTable, and STATUS iosFdEntrySet(FD_ENTRY *pFdEntry,DEV_HDR *pDevHdr,const char *name, void *value)
register fd to iosFdTable table with.
Summary: The drive model of vxWorks is very simple, a chain of 2 tables.