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

Ethernet Loopback Device Driver. More...

Functions

devcall ethloopClose (device *devptr)
 
devcall ethloopControl (device *devptr, int func, long arg1, long arg2)
 
devcall ethloopInit (device *devptr)
 
devcall ethloopOpen (device *devptr)
 
devcall ethloopRead (device *devptr, void *buf, uint len)
 
devcall ethloopWrite (device *devptr, const void *buf, uint len)
 

Detailed Description

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.

Function Documentation

devcall ethloopClose ( device *  devptr)

Close a ethloop device.

Parameters
devptrethloop 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
devptrethloop device 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 ethloopInit ( device *  devptr)

Initialize ethloop device

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

Open an ethloop device.

Parameters
devptrethloop 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
devptrPointer to the device table entry for the ethloop.
bufBuffer into which to place the read data.
lenMaximum 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
devptrPointer to the device table entry for the ethloop.
bufBuffer of data to write.
lenLength of data to write, in bytes.
Returns
On success, returns the number of bytes written, which will be exactly len. On failure, returns SYSERR.