ether.h File Reference

Id
ether.h 1447 2008-08-12 19:23:34Z mschul
More...

#include <device.h>
#include <stdarg.h>
#include <stddef.h>
#include <semaphore.h>
#include <bcm4713.h>

Include dependency graph for ether.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rxHeader
struct  ethPktBuffer
struct  dmaDescriptor
struct  ether

Defines

#define ETH_IBLEN   1024
 input buffer size
#define MAX_ADDR_LENGTH   8
 Maximum length of address.
#define RX_RING_ENTRIES   511
 Number of buffers on Rx Ring.
#define TX_RING_ENTRIES   511
 Number of buffers on Tx Ring.
#define RING_MASK   0x01FF
 Field size for ring indices.
#define RING_PAGES   1
 Ring buffer size in pages.
#define DMA_TABLE_PAGES   1
 DMA Table size in pages.
#define RX_FLAG_OFIFO   0x00000001
 FIFO Overflow.
#define RX_FLAG_CRCERR   0x00000002
 CRC Error.
#define RX_FLAG_SERR   0x00000004
 Receive Symbol Error.
#define RX_FLAG_ODD   0x00000008
 Frame has odd number nibbles.
#define RX_FLAG_LARGE   0x00000010
 Frame is > RX MAX Length.
#define RX_FLAG_MCAST   0x00000020
 Dest is Multicast Address.
#define RX_FLAG_BCAST   0x00000040
 Dest is Broadcast Address.
#define RX_FLAG_MISS   0x00000080
 Received due to promisc mode.
#define RX_FLAG_LAST   0x00000800
 Last buffer in frame.

Functions

devcall etherInit (device *)
 Initialize ethernet device structures.
devcall etherOpen (device *)
 Open an ethernet device for use.
devcall etherClose (device *)
 Close an ethernet device.
devcall etherRead (device *, void *, uint)
 Read a packet from the ethernet device.
devcall etherWrite (device *, void *, uint)
 Write a packet to the ethernet device.
devcall etherControl (device *, int, long, long)
 Control function for ethernet devices.
interrupt etherInterrupt (void)
 Decode and handle hardware interrupt request from ethernet device.
thread etherStart (int)
 Process for bringing an ethernet device up.
int colon2mac (char *, uchar *)
 Convert a colon-separated string representation of a MAC into the equivalent byte array.
int allocRxBuffer (struct ether *, int)
 Allocate an ethernet packet buffer structure.
int waitOnBit (volatile ulong *, ulong, const ulong, ulong)
 Wait on a bit in a device's control and status register.


Detailed Description

Id
ether.h 1447 2008-08-12 19:23:34Z mschul

Definition in file ether.h.


Function Documentation

int allocRxBuffer ( struct ether *  peth,
int  destIndex 
)

Allocate an ethernet packet buffer structure.

Parameters:
peth ethernet table entry
destIndex destination index in ethernet reciever ring
Returns:
bytes allocated

Definition at line 21 of file allocRxBuffer.c.

References bzero(), getbuf(), kprintf(), NULL, OK, and SYSERR.

Referenced by etherOpen().

Here is the call graph for this function:

Here is the caller graph for this function:

int colon2mac ( char *  src,
uchar dst 
)

Convert a colon-separated string representation of a MAC into the equivalent byte array.

Parameters:
src pointer to colon-separated MAC string
dst pointer to byte array
Returns:
number of octets converted.

Definition at line 22 of file colon2mac.c.

References MAX_ADDR_LENGTH, NULL, and SYSERR.

Referenced by etherInit().

Here is the caller graph for this function:

devcall etherClose ( device *  pdev  ) 

Close an ethernet device.

Parameters:
pdev ether device table entry
Returns:
OK if device is closed properly, otherwise SYSERR

Definition at line 21 of file etherClose.c.

References disable, disable_irq, DMA_TABLE_PAGES, etherControl(), free(), NULL, OK, restore, and RING_PAGES.

Referenced by etherInterrupt().

Here is the call graph for this function:

Here is the caller graph for this function:

devcall etherControl ( device *  pdev,
int  func,
long  arg1,
long  arg2 
)

Control function for ethernet devices.

Parameters:
pdev ethernet device table entry
func control function to execute
arg1 first argument for the control function
args second argument for the control function
Returns:
the result of the control function

Definition at line 25 of file etherControl.c.

References backplaneCoreUp(), etherControl(), kprintf(), NULL, OK, SYSERR, and waitOnBit().

Referenced by etherClose(), etherControl(), etherInit(), and etherOpen().

Here is the call graph for this function:

Here is the caller graph for this function:

devcall etherInit ( device *  pdev  ) 

Initialize ethernet device structures.

Parameters:
pdev TTY device table entry
Returns:
OK if device is intialized successfully

Definition at line 26 of file etherInit.c.

References bzero(), colon2mac(), DMA_TABLE_PAGES, etherControl(), kprintf(), nvramGet(), OK, RING_PAGES, RX_RING_ENTRIES, semcreate(), sprintf(), stkget(), and TX_RING_ENTRIES.

Here is the call graph for this function:

devcall etherOpen ( device *  pdev  ) 

Open an ethernet device for use.

Parameters:
pdev ethernet device table entry
Returns:
OK if opened properly, otherwise SYSERR

Definition at line 22 of file etherOpen.c.

References allocRxBuffer(), disable, enable_irq, ETH_IBLEN, etherControl(), mkpool(), OK, restore, RX_RING_ENTRIES, SYSERR, and TX_RING_ENTRIES.

Here is the call graph for this function:

devcall etherRead ( device *  pdev,
void *  buf,
uint  len 
)

Read a packet from the ethernet device.

Parameters:
pdev pointer to ethernet device
buf buffer for read
len size of the buffer
Returns:
number of bytes read

Definition at line 24 of file etherRead.c.

References disable, ETH_IBLEN, freebuf(), memcpy(), NULL, restore, SYSERR, and wait().

Here is the call graph for this function:

thread etherStart ( int  devnum  ) 

Process for bringing an ethernet device up.

Parameters:
devnum Ethernet device number
Returns:
OK

Definition at line 23 of file etherStart.c.

References NULL, OK, open(), sleep(), and SYSERR.

Here is the call graph for this function:

devcall etherWrite ( device *  pdev,
void *  buf,
uint  len 
)

Write a packet to the ethernet device.

Parameters:
pdev device table entry
buf packet buffer
len size of the buffer
Returns:
bytes output

Definition at line 25 of file etherWrite.c.

References control(), disable, getbuf(), memcpy(), NULL, restore, and SYSERR.

Here is the call graph for this function:

int waitOnBit ( volatile ulong reg,
ulong  mask,
const ulong  value,
ulong  timeout 
)

Wait on a bit in a device's control and status register.

Parameters:
reg pointer to device status register
mask bit to wait on
value bit value desired
timeout number of retries before giving up
Returns:
OK or SYSERR

Definition at line 21 of file waitOnBit.c.

References kprintf(), OK, and SYSERR.

Here is the call graph for this function:


Generated on Wed Aug 27 06:08:09 2008 for Embedded XINU by  doxygen 1.5.5