Nut/OS  5.0.5
API Reference
at91sam7x_emac.c File Reference
#include <cfg/os.h>
#include <arch/arm.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/phy.h>
#include <dev/at91sam7x_emac.h>
#include <stdio.h>
Include dependency graph for at91sam7x_emac.c:

Data Structures

struct  _EMACINFO
 Network interface controller information structure. More...
struct  _BufDescriptor

Defines

#define NUTDEBUG
#define EMPRINTF(args,...)   printf(args,##__VA_ARGS__)
#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 NIC_PHY_ADDR   31
#define PHY_TXCLK_ISOLATE_BIT   0
#define PHY_REFCLK_XT2_BIT   0
#define PHY_TXEN_BIT   1
#define PHY_TXD0_BIT   2
#define PHY_TXD1_BIT   3
#define PHY_CRS_AD4_BIT   4
#define PHY_RXD0_AD0_BIT   5
#define PHY_RXD1_AD1_BIT   6
#define PHY_RXER_RXD4_RPTR_BIT   7
#define PHY_MDC_BIT   8
#define PHY_MDIO_BIT   9
#define PHY_TXD2_BIT   10
#define PHY_TXD3_BIT   11
#define PHY_TXER_TXD4_BIT   12
#define PHY_RXD2_AD2_BIT   13
#define PHY_RXD3_AD3_BIT   14
#define PHY_RXDV_TESTMODE_BIT   15
#define PHY_COL_RMII_BIT   16
#define PHY_RXCLK_10BTSER_BIT   17
#define PHY_PWRDN_BIT   18
#define PHY_MDINTR_BIT   26
#define PHY_MII_PINS
#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 _BufDescriptor BufDescriptor

Functions

 outr (EMAC_NCR, inr(EMAC_NCR)&~EMAC_MPE)
 outr (EMAC_USRIO, EMAC_CLKEN)
void EmacRxThread (void *arg)
int EmacOutput (NUTDEVICE *dev, NETBUF *nb)
 Send Ethernet packet.
int EmacInit (NUTDEVICE *dev)
 Initialize Ethernet hardware.

Variables

return rc
NUTDEVICE devAt91Emac
 Device information structure.

Define Documentation

#define NUTDEBUG

Referenced by NutPppInput(), and SpiMmcMount().

#define EMPRINTF (   args,
  ... 
)    printf(args,##__VA_ARGS__)
#define NUT_THREAD_NICRXSTACK   768

Referenced by EmacInit().

#define EMAC_RX_BUFFERS   32
#define EMAC_RX_BUFSIZ   128
#define EMAC_TX_BUFFERS   2
#define EMAC_TX_BUFSIZ   1536
#define NIC_PHY_ADDR   31
#define PHY_TXCLK_ISOLATE_BIT   0
#define PHY_REFCLK_XT2_BIT   0
#define PHY_TXEN_BIT   1
#define PHY_TXD0_BIT   2
#define PHY_TXD1_BIT   3
#define PHY_CRS_AD4_BIT   4
#define PHY_RXD0_AD0_BIT   5
#define PHY_RXD1_AD1_BIT   6
#define PHY_RXER_RXD4_RPTR_BIT   7
#define PHY_MDC_BIT   8
#define PHY_MDIO_BIT   9
#define PHY_TXD2_BIT   10
#define PHY_TXD3_BIT   11
#define PHY_TXER_TXD4_BIT   12
#define PHY_RXD2_AD2_BIT   13
#define PHY_RXD3_AD3_BIT   14
#define PHY_RXDV_TESTMODE_BIT   15
#define PHY_COL_RMII_BIT   16
#define PHY_RXCLK_10BTSER_BIT   17
#define PHY_PWRDN_BIT   18
#define PHY_MDINTR_BIT   26
#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.

Referenced by EmacOutput().

#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.


Typedef Documentation

typedef struct _EMACINFO EMACINFO

Network interface controller information type.

typedef struct _BufDescriptor BufDescriptor