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


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. | |
Definition in file ether.h.
| int allocRxBuffer | ( | struct ether * | peth, | |
| int | destIndex | |||
| ) |
Allocate an ethernet packet buffer structure.
| peth | ethernet table entry | |
| destIndex | destination index in ethernet reciever ring |
Definition at line 21 of file allocRxBuffer.c.
References bzero(), getbuf(), kprintf(), NULL, OK, and SYSERR.
Referenced by etherOpen().


| int colon2mac | ( | char * | src, | |
| uchar * | dst | |||
| ) |
Convert a colon-separated string representation of a MAC into the equivalent byte array.
| src | pointer to colon-separated MAC string | |
| dst | pointer to byte array |
Definition at line 22 of file colon2mac.c.
References MAX_ADDR_LENGTH, NULL, and SYSERR.
Referenced by etherInit().

| devcall etherClose | ( | device * | pdev | ) |
Close an ethernet device.
| pdev | ether device table entry |
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().


| devcall etherControl | ( | device * | pdev, | |
| int | func, | |||
| long | arg1, | |||
| long | arg2 | |||
| ) |
Control function for ethernet devices.
| pdev | ethernet device table entry | |
| func | control function to execute | |
| arg1 | first argument for the control function | |
| args | second argument for 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().


| devcall etherInit | ( | device * | pdev | ) |
Initialize ethernet device structures.
| pdev | TTY device table entry |
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.

| devcall etherOpen | ( | device * | pdev | ) |
Open an ethernet device for use.
| pdev | ethernet device table entry |
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.

Read a packet from the ethernet device.
| pdev | pointer to ethernet device | |
| buf | buffer for read | |
| len | size of the buffer |
Definition at line 24 of file etherRead.c.
References disable, ETH_IBLEN, freebuf(), memcpy(), NULL, restore, SYSERR, and wait().

| thread etherStart | ( | int | devnum | ) |
Write a packet to the ethernet device.
| pdev | device table entry | |
| buf | packet buffer | |
| len | size of the buffer |
Definition at line 25 of file etherWrite.c.
References control(), disable, getbuf(), memcpy(), NULL, restore, and SYSERR.

Wait on a bit in a device's control and status register.
| reg | pointer to device status register | |
| mask | bit to wait on | |
| value | bit value desired | |
| timeout | number of retries before giving up |
Definition at line 21 of file waitOnBit.c.
References kprintf(), OK, and SYSERR.

1.5.5