GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CBIO / V1-0-0 > cbio / rad750
Typedefs | |
typedef int | CBIO_WriteCallback (const char *data, int bytes, void *userData) |
Functions | |
STATUS | CBIO_CreateDev (char *, CBIO_WriteCallback *, void *) |
Create CBIO device and attach user callback. | |
STATUS | CBIO_DeleteDev (char *) |
Delete CBIO device and clean up allocation. | |
STATUS | CBIO_Drv () |
Initialize CBIO vxWorks device driver. | |
STATUS | CBIO_DrvRemove () |
Remove CBIO driver from device table. |
The calling application need to take the following steps to use the CBIO:
1) Install driver with CBIO_Drv(). This should be done at boot time or application init.
2) Create one or more CBIO devices with CBIO_CreateDev(). By convention, the devices should be named /cbio/0, /cbio/1, etc. When these devices are created, the application supplies a callback function and user data. The callbacks functions are calld when data is written to a CBIO device type. The callback function takes 3 arguments, the data written to the CBIO device, the number of bytes and a userData pointer. This userData pointer is set in the call to CBIO_CreateDev() and is unique to each open CBIO device.
3) Open a CBIO driver with open() to obtain a file descriptor.
4) Use the file descriptor directly or attach to other vxWorks system resources with logFdAdd(), ioTaskStdSet(), etc.
for cleanup:
5) Use close() to close file descriptor.
6) Use CBIO_DeleteDev() to delete the device
7) CBIO_DrvRemove() will remove the driver from the kernel.
The application can create a CBIO device and use vxWorks functions such as logFdAdd(), ioTaskStdSet() or ioGlobalStdSet() to provide a point to capture messages printed to the "screen" or unsolicited output from the vxWorks kernel.
This driver is only intended for vxWorks systems. No ports will be supported for other operating systems.
The definition of a CBIO write callback function. These callbacks are used when data is written to a CBIO device type. The function takes 3 arguments, the data written to the CBIO device, the number of bytes and a userData pointer. This userData pointer is set in the call to CBIO_CreateDev and is unique to each open CBIO device.
int CBIO_WriteCallback(const char *data, int bytes, void *userData);
data | A pointer to location of data written to CBIO device. | |
bytes | Number of bytes written. | |
usrData | Pointer registered with CBIO_CreateDev() |
like | write(), this function will should the number of bytes processed. |
STATUS CBIO_CreateDev | ( | char * | name, | |
CBIO_WriteCallback * | cbFunction, | |||
void * | userData | |||
) |
Create CBIO device and attach user callback.
CBIO_CreateDev() is used to create a CBIO device. This is also where the application attaches a callback and user data to the device. This function must be called to create a CBIO device.
name | name of vxworks driver, in the form "/cbio/0", "/cbio/1", etc. | |
cbFunction | Application callback function. | |
userData | Application callback function. |
OK | function succeeded | |
FAILED | CBIO not installed, malloc() or ioDevAdd() failed. |
References _cbio_Device::callback, cbio_driverNum, _cbio_Device::devHdr, and _cbio_Device::userData.
STATUS CBIO_DeleteDev | ( | char * | name | ) |
Delete CBIO device and clean up allocation.
CBIO_DeleteDev() is used to delete a CBIO device. The device should be closed before the device is deleted. After removing a device, it cannot be opened until another call to CBIO_CreateDev() is made.
name | name of vxworks driver, in the form "/cbio/0", "/cbio/1", etc. |
OK | function succeeded | |
FAILED | ioDevAdd failed. |
STATUS CBIO_Drv | ( | ) |
Initialize CBIO vxWorks device driver.
This function is called to register the CBIO device driver with the vxWorks kernel. If the driver has already been installed (indicated by the module global cbio_driverNum being set to -1) this funciton will return error. This function will also fail if iosDrvInstall() fails.
This function should be called soon after (or during) kernel startup. It should only be called once unless CBIO_DrvRemove() is called to unregister the driver.
ERROR | driver already installed or failure of iosDrvInstall() | |
OK | success |
References cbio_driverNum, cbio_Open(), and cbio_Write().
STATUS CBIO_DrvRemove | ( | ) |
Remove CBIO driver from device table.
This function is called to unregister the CBIO device driver with the vxWorks kernel. If the driver has not been installed (indicated by the module global cbio_driverNum being set to a value other than -1) this funciton will return error. This function will also fail if iosDrvRemove() fails.
This function should be called before or during kernel shutdown. It should only be called after CBIO_Drv() is called to register the CBIO driver.
ERROR | failure of iosDrvInstall() | |
OK | success |
References cbio_driverNum.