#include <cfg/os.h>
#include <cfg/dev.h>
#include <cfg/arch/gpio.h>
#include <arch/avr32.h>
#include <arch/avr32/gpio.h>
#include <string.h>
#include <sys/atom.h>
#include <sys/heap.h>
#include <sys/thread.h>
#include <sys/event.h>
#include <sys/timer.h>
#include <sys/confnet.h>
#include <netinet/if_ether.h>
#include <net/ether.h>
#include <net/if_var.h>
#include <dev/irqreg.h>
#include <dev/gpio.h>
#include <avr32/io.h>
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | _EMACINFO |
Network interface controller information structure. More... | |
struct | _RxTdDescriptor |
struct | _TxTdDescriptor |
Defines | |
#define | NUT_THREAD_NICRXSTACK 768 |
#define | EMAC_RX_BUFFERS 32 |
#define | EMAC_RX_BUFSIZ 128 |
#define | EMAC_TX_BUFFERS 2 |
#define | EMAC_TX_BUFSIZ 1536 |
#define | EMAC_LINK_LOOPS 1000000 |
#define | NIC_PHY_BMCR 0x00 |
Basic mode control register. | |
#define | NIC_PHY_BMCR_COLTEST 0x0080 |
Collision test. | |
#define | NIC_PHY_BMCR_FDUPLEX 0x0100 |
Full duplex mode. | |
#define | NIC_PHY_BMCR_ANEGSTART 0x0200 |
Restart auto negotiation. | |
#define | NIC_PHY_BMCR_ISOLATE 0x0400 |
Isolate from MII. | |
#define | NIC_PHY_BMCR_PWRDN 0x0800 |
Power-down. | |
#define | NIC_PHY_BMCR_ANEGENA 0x1000 |
Enable auto negotiation. | |
#define | NIC_PHY_BMCR_100MBPS 0x2000 |
Select 100 Mbps. | |
#define | NIC_PHY_BMCR_LOOPBACK 0x4000 |
Enable loopback mode. | |
#define | NIC_PHY_BMCR_RESET 0x8000 |
Software reset. | |
#define | NIC_PHY_BMSR 0x01 |
Basic mode status register. | |
#define | NIC_PHY_BMSR_ANCOMPL 0x0020 |
Auto negotiation complete. | |
#define | NIC_PHY_BMSR_LINKSTAT 0x0004 |
Link status. | |
#define | NIC_PHY_ID1 0x02 |
PHY identifier register 1. | |
#define | NIC_PHY_ID2 0x03 |
PHY identifier register 2. | |
#define | NIC_PHY_ANAR 0x04 |
Auto negotiation advertisement register. | |
#define | NIC_PHY_ANLPAR 0x05 |
Auto negotiation link partner availability register. | |
#define | NIC_PHY_ANEG_NP 0x8000 |
Next page available. | |
#define | NIC_PHY_ANEG_ACK 0x4000 |
Ability data reception acknowledged. | |
#define | NIC_PHY_ANEG_RF 0x2000 |
Remote fault. | |
#define | NIC_PHY_ANEG_FCS 0x0400 |
Flow control supported. | |
#define | NIC_PHY_ANEG_T4 0x0200 |
100BASE-T4 supported. | |
#define | NIC_PHY_ANEG_TX_FDX 0x0100 |
100BASE-T full duplex supported. | |
#define | NIC_PHY_ANEG_TX_HDX 0x0080 |
100BASE-T half duplex supported. | |
#define | NIC_PHY_ANEG_10_FDX 0x0040 |
10BASE-T full duplex supported. | |
#define | NIC_PHY_ANEG_10_HDX 0x0020 |
10BASE-T half duplex supported. | |
#define | NIC_PHY_ANEG_BINSEL 0x001F |
Binary encoded protocol selector. | |
#define | NIC_PHY_ANER 0x06 |
Auto negotiation expansion register. | |
#define | NIC_PHY_ADDR 0 |
PHY address. | |
#define | NIC_PHY_UID 0xffffffff |
#define | PHY_MODE_RMII |
#define | RXBUF_OWNERSHIP 0x00000001 |
#define | RXBUF_WRAP 0x00000002 |
#define | RXBUF_ADDRMASK 0xFFFFFFFC |
#define | RXS_BROADCAST_ADDR 0x80000000 |
Broadcast address detected. | |
#define | RXS_MULTICAST_HASH 0x40000000 |
Multicast hash match. | |
#define | RXS_UNICAST_HASH 0x20000000 |
Unicast hash match. | |
#define | RXS_EXTERNAL_ADDR 0x10000000 |
External address match. | |
#define | RXS_SA1_ADDR 0x04000000 |
Specific address register 1 match. | |
#define | RXS_SA2_ADDR 0x02000000 |
Specific address register 2 match. | |
#define | RXS_SA3_ADDR 0x01000000 |
Specific address register 3 match. | |
#define | RXS_SA4_ADDR 0x00800000 |
Specific address register 4 match. | |
#define | RXS_TYPE_ID 0x00400000 |
Type ID match. | |
#define | RXS_VLAN_TAG 0x00200000 |
VLAN tag detected. | |
#define | RXS_PRIORITY_TAG 0x00100000 |
Priority tag detected. | |
#define | RXS_VLAN_PRIORITY 0x000E0000 |
VLAN priority. | |
#define | RXS_CFI_IND 0x00010000 |
Concatenation format indicator. | |
#define | RXS_EOF 0x00008000 |
End of frame. | |
#define | RXS_SOF 0x00004000 |
Start of frame. | |
#define | RXS_RBF_OFFSET 0x00003000 |
Receive buffer offset mask. | |
#define | RXS_LENGTH_FRAME 0x000007FF |
Length of frame including FCS. | |
#define | TXS_USED 0x80000000 |
Used buffer. | |
#define | TXS_WRAP 0x40000000 |
Last descriptor. | |
#define | TXS_ERROR 0x20000000 |
Retry limit exceeded. | |
#define | TXS_UNDERRUN 0x10000000 |
Transmit underrun. | |
#define | TXS_NO_BUFFER 0x08000000 |
Buffer exhausted. | |
#define | TXS_NO_CRC 0x00010000 |
CRC not appended. | |
#define | TXS_LAST_BUFF 0x00008000 |
Last buffer of frame. | |
Typedefs | |
typedef struct _EMACINFO | EMACINFO |
Network interface controller information type. | |
typedef struct _RxTdDescriptor | RxTdDescriptor |
Functions | |
void | EmacRxThread (void *arg) |
NIC receiver thread. | |
int | EmacOutput (NUTDEVICE *dev, NETBUF *nb) |
Send Ethernet packet. | |
int | EmacInit (NUTDEVICE *dev) |
Initialize Ethernet hardware. | |
Variables | |
NUTDEVICE | devAvr32macb |
Device information structure. | |
Advertisement control register. | |
#define | NIC_PHY_ADVERTISE_SLCT 0x001f |
Selector bits. | |
#define | NIC_PHY_ADVERTISE_CSMA 0x0001 |
Only selector supported. | |
#define | NIC_PHY_ADVERTISE_10HALF 0x0020 |
Try for 10mbps half-duplex. | |
#define | NIC_PHY_ADVERTISE_1000XFULL 0x0020 |
Try for 1000BASE-X full-duplex. | |
#define | NIC_PHY_ADVERTISE_10FULL 0x0040 |
Try for 10mbps full-duplex. | |
#define | NIC_PHY_ADVERTISE_1000XHALF 0x0040 |
Try for 1000BASE-X half-duplex. | |
#define | NIC_PHY_ADVERTISE_100HALF 0x0080 |
Try for 100mbps half-duplex. | |
#define | NIC_PHY_ADVERTISE_1000XPAUSE 0x0080 |
Try for 1000BASE-X pause. | |
#define | NIC_PHY_ADVERTISE_100FULL 0x0100 |
Try for 100mbps full-duplex. | |
#define | NIC_PHY_ADVERTISE_1000XPSE_ASYM 0x0100 |
Try for 1000BASE-X asym pause. | |
#define | NIC_PHY_ADVERTISE_100BASE4 0x0200 |
Try for 100mbps 4k packets. | |
#define | NIC_PHY_ADVERTISE_PAUSE_CAP 0x0400 |
Try for pause. | |
#define | NIC_PHY_ADVERTISE_PAUSE_ASYM 0x0800 |
Try for asymetric pause. | |
#define | NIC_PHY_ADVERTISE_RESV 0x1000 |
Unused... | |
#define | NIC_PHY_ADVERTISE_RFAULT 0x2000 |
Say we can detect faults. | |
#define | NIC_PHY_ADVERTISE_LPACK 0x4000 |
Ack link partners response. | |
#define | NIC_PHY_ADVERTISE_NPAGE 0x8000 |
Next page bit. | |
#define | NIC_PHY_ADVERTISE_FULL (NIC_PHY_ADVERTISE_100FULL | NIC_PHY_ADVERTISE_10FULL | NIC_PHY_ADVERTISE_CSMA) |
#define | NIC_PHY_ADVERTISE_ALL |
typedef struct _TxTdDescriptor | TxTdDescriptor |
#define NUT_THREAD_NICRXSTACK 768 |
Copyright (C) 2001-2010 by egnite Software GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For additional information see http://www.ethernut.de/
#define RXS_BROADCAST_ADDR 0x80000000 |
#define RXS_SA1_ADDR 0x04000000 |
#define RXS_SA2_ADDR 0x02000000 |
#define RXS_SA3_ADDR 0x01000000 |
#define RXS_SA4_ADDR 0x00800000 |
#define RXS_CFI_IND 0x00010000 |
#define RXS_RBF_OFFSET 0x00003000 |
#define RXS_LENGTH_FRAME 0x000007FF |
typedef struct _TxTdDescriptor TxTdDescriptor |
Transmit Transfer descriptor structure.