Doxygen Documentation

Main Index

Package Index

Package:

CBIO

Version:

dev

Marked:

(not marked)

Constituent:

cbio

Tag:

mv2304


Interface   Compound List   File List   Compound Members   File Members  

cbio.h File Reference


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.


Detailed Description

Author:
: Ray Caperoon
Date:
: Thu Apr 3 10:00:41 2003
Public header for CBIO module for GLAST. Provides a method for application code to attach a callback to capture/log/telemeter any data printed to stdout or stderr. This is implemented as vxworks driver.

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.

Date
2003/04/10 21:05:00
Source
/nfs/slac/g/glast/flight/archive/CBIO/CBIO/cbio.h,v
Author
ray
Revision
1.1.1.1
Log
cbio.h,v
Revision 1.1.1.1 2003/04/10 21:05:00 ray Create package CBIO

Typedef Documentation

CBIO_WriteCallback
 

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);

Parameters:
data A pointer to location of data written to CBIO device.
bytes Number of bytes written.
usrData Pointer registered with CBIO_CreateDev()
Return values:
like write(), this function will should the number of bytes processed.


Function Documentation

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.

Parameters:
name name of vxworks driver, in the form "/cbio/0", "/cbio/1", etc.
cbFunction Application callback function.
userData Application callback function.
Return values:
OK function succeeded
FAILED CBIO not installed, malloc() or ioDevAdd() failed.

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.

Parameters:
name name of vxworks driver, in the form "/cbio/0", "/cbio/1", etc.
Return values:
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.

Return values:
ERROR driver already installed or failure of iosDrvInstall()
OK success

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.

Return values:
ERROR failure of iosDrvInstall()
OK success


Generated on Sat Nov 29 13:03:37 2003 by doxygen 1.3.3