VxWorks Reference Manual : Libraries
winSio - win serial driver
winDevInit( ) - initialize a WIN_CHAN
winDevInit2( ) - initialize a WIN_CHAN, part 2
winIntRcv( ) - handle a channel's receive-character interrupt
winIntTx( ) - transmit a single character.
dummyCallback( ) - dummy callback routine
This is the console serial driver for the Windows simulator. It recieves character interrupts from Windows and send them off to vxWorks.
Device data structures are defined in the header file h/drv/sio/winSio.h. A device data structure, WIN_CHAN, is defined for each channel.
The driver is typically only called only by the BSP. The directly callable routines in this module are winDevInit( ), winDevInit2( ), winIntRcv( ) and winIntTx( ).
The BSP calls winDevInit( ) to initialize or reset the device. It connects the driver's interrupt handlers (winIntRcv and winIntTx) using intConnect( ). After connecting the interrupt handlers, the BSP calls winDevInit2( ) to inform the driver that interrupt mode operation is now possible.
By convention all the BSP-specific serial initialization is performed in a file called sysSerial.c, which is #include'ed by sysLib.c. sysSerial.c implements at least four functions, sysSerialHwInit( ) sysSerialHwInit2( ), sysSerialChanGet( ), and sysSerialReset( ), which work as follows:
sysSerialHwInit is called by sysHwInit to initialize the serial devices. This routine will initialize all the board specific fields in the WIN_CHAN structure (e.g., register I/O addresses, etc) before calling winDevInit( ), which resets the device and installs the driver function pointers. sysSerialHwInit( ) should also perform any other processing which is needed for the serial drivers, such as configuring on-board interrupt controllers as appropriate.
sysSerialHwInit2 is called by sysHwInit2 to connect the serial driver's interrupt handlers using intConnect( ). After connecting the interrupt handlers, the call to winDevInit2( ) is made to permit interrupt mode operations to begin.
sysSerialChanGet is called by usrRoot to get the serial channel descriptor associated with a serial channel number. The routine takes a single parameter which is a channel number ranging between zero and NUM_TTY. It returns a pointer to the corresponding channel descriptor, SIO_CHAN *, which is just the address of the WIN_CHAN structure.
sysSerialReset is called from sysToMonitor( ) and should reset the serial devices to an inactive state.
drv/sio/winSio.h sioLib.h
winDevInit( ) - initialize a WIN_CHAN
void winDevInit ( WIN_CHAN * pChan )
This routine initializes the driver function pointers and then resets the chip in a quiescent state. The BSP must have already initialized all the device addresses and the baudFreq fields in the WIN_CHAN structure before passing it to this routine.
N/A
winDevInit2( ) - initialize a WIN_CHAN, part 2
void winDevInit2 ( WIN_CHAN * pChan /* device to initialize */ )
This routine is called by the BSP after interrupts have been connected. The driver can now operate in interrupt mode. Before this routine is called only polled mode operations should be allowed.
N/A
SEE ALSO winSio
winIntRcv( ) - handle a channel's receive-character interrupt
void winIntRcv ( WIN_CHAN * pChan, /* channel generating the interrupt */ UINT16 wparam /* message args get passed if you look */ )
This function is attached to the simulator's interrupt handler, and passes the character received in the message to the callback.
N/A
winIntTx( ) - transmit a single character.
void winIntTx ( WIN_CHAN * pChan /* channel generating the interrupt */ )
This displays a single character to the simulator's window.
N/A
dummyCallback( ) - dummy callback routine
STATUS dummyCallback (void)
ERROR.