Ethernet Loopback Device Driver.
More...
Ethernet Loopback Device Driver.
This is a driver for a device that presents itself as an Ethernet Driver but actually just writes packets into a buffer and reads them back from the same buffer.
devcall ethloopClose |
( |
device * |
devptr | ) |
|
Close a ethloop device.
- Parameters
-
devptr | ethloop device table entry |
- Returns
- OK if ethloop is closed properly, otherwise SYSERR
devcall ethloopControl |
( |
device * |
devptr, |
|
|
int |
func, |
|
|
long |
arg1, |
|
|
long |
arg2 |
|
) |
| |
Control function for ethloop devices.
- Parameters
-
devptr | ethloop 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 ethloopInit |
( |
device * |
devptr | ) |
|
Initialize ethloop device
- Parameters
-
- Returns
- OK on open
devcall ethloopOpen |
( |
device * |
devptr | ) |
|
Open an ethloop device.
- Parameters
-
devptr | ethloop device table entry |
- Returns
- OK if ethloop is opened properly, otherwise SYSERR
devcall ethloopRead |
( |
device * |
devptr, |
|
|
void * |
buf, |
|
|
uint |
len |
|
) |
| |
Read data from an Ethernet Loopback device. This will block until data has been made available by a call to ethloopWrite().
- Parameters
-
devptr | Pointer to the device table entry for the ethloop. |
buf | Buffer into which to place the read data. |
len | Maximum length of the data to read, in bytes. |
- Returns
- On success, returns the number of bytes read, which will be less than or equal to
len
. Otherwise returns SYSERR.
devcall ethloopWrite |
( |
device * |
devptr, |
|
|
const void * |
buf, |
|
|
uint |
len |
|
) |
| |
Write data to an Ethernet Loopback device. On success, the data will be available to be read by a subsequent call to ethloopRead().
- Parameters
-
devptr | Pointer to the device table entry for the ethloop. |
buf | Buffer of data to write. |
len | Length of data to write, in bytes. |
- Returns
- On success, returns the number of bytes written, which will be exactly
len
. On failure, returns SYSERR.