Loopback Device Driver.
More...
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.
devcall loopbackClose |
( |
device * |
devptr | ) |
|
Close a loopback device.
- Parameters
-
devptr | loopback 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
-
devptr | device table entry |
func | control function to execute |
arg1 | first argument for the control function |
arg2 | second 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
-
devptr | Pointer 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
-
- Returns
- OK on open
devcall loopbackOpen |
( |
device * |
devptr | ) |
|
Open a loopback device.
- Parameters
-
devptr | loopback 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
-
devptr | Loopback device |
ch | character 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
-
devptr | Loopback device to read from. |
buf | Buffer into which to place the read data. |
len | Maximum 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
-
devptr | Pointer to the loopback device to write to. |
buf | Buffer of data to write. |
len | Number 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.