Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Functions

Loopback Device Driver. More...

Functions

devcall loopbackClose (device *devptr)
 
devcall loopbackControl (device *devptr, int func, long arg1, long arg2)
 
devcall loopbackGetc (device *devptr)
 
devcall loopbackInit (device *devptr)
 
devcall loopbackOpen (device *devptr)
 
devcall loopbackPutc (device *devptr, char ch)
 
devcall loopbackRead (device *devptr, void *buf, uint len)
 
devcall loopbackWrite (device *devptr, const void *buf, uint len)
 

Detailed Description

Loopback Device Driver.

This module implements a loopback device. Data written to a loopback device is placed into an internal buffer and then provided to later reads from the device.

Function Documentation

devcall loopbackClose ( device *  devptr)

Close a loopback device.

Parameters
devptrloopback device table entry
Returns
OK if loopback is closed properly, otherwise SYSERR
devcall loopbackControl ( device *  devptr,
int  func,
long  arg1,
long  arg2 
)

Control function for loopback devices.

Parameters
devptrdevice table entry
funccontrol function to execute
arg1first argument for the control function
arg2second argument for the control function
Returns
the result of the control function
devcall loopbackGetc ( device *  devptr)

Get a character from the loopback buffer, possibly blocking.

Parameters
devptrPointer to the loopback device.
Returns
The resulting ch as an unsigned char cast to an int on success; EOF if there is no data available and the device is in nonblocking mode.
devcall loopbackInit ( device *  devptr)

Initialize loopback device

Parameters
devptr
Returns
OK on open
devcall loopbackOpen ( device *  devptr)

Open a loopback device.

Parameters
devptrloopback device table entry
Returns
OK if loopback is opened properly, otherwise SYSERR
devcall loopbackPutc ( device *  devptr,
char  ch 
)

Put a character onto the loopback buffer

Parameters
devptrLoopback device
chcharacter to output
Returns
ch as an unsigned char cast to an int on success; SYSERR if there is no room in the buffer.
devcall loopbackRead ( device *  devptr,
void *  buf,
uint  len 
)

Read up to the specified number of characters from a loopback.

Parameters
devptrLoopback device to read from.
bufBuffer into which to place the read data.
lenMaximum number of characters to read.
Returns
Returns the number of characters read, which may be less than len if EOF or a read error occurs. Alternatively, if the loopback device is not open, returns SYSERR.
devcall loopbackWrite ( device *  devptr,
const void *  buf,
uint  len 
)

Write data to the loopbock device.

Parameters
devptrPointer to the loopback device to write to.
bufBuffer of data to write.
lenNumber of bytes of data to write.
Returns
On success, returns the number of bytes written, which may be less than len in the event of a write error. Alternatively, SYSERR is returned if the loopback device is not open or if a write error occurred before any data at all was successfully written.