1 |
583 |
jeremybenn |
//*----------------------------------------------------------------------------
|
2 |
|
|
//* ATMEL Microcontroller Software Support - ROUSSET -
|
3 |
|
|
//*----------------------------------------------------------------------------
|
4 |
|
|
//* The software is delivered "AS IS" without warranty or condition of any
|
5 |
|
|
//* kind, either express, implied or statutory. This includes without
|
6 |
|
|
//* limitation any warranty or condition with respect to merchantability or
|
7 |
|
|
//* fitness for any particular purpose, or against the infringements of
|
8 |
|
|
//* intellectual property rights of others.
|
9 |
|
|
//*----------------------------------------------------------------------------
|
10 |
|
|
//* File Name : Emac.h
|
11 |
|
|
//* Object : Emac header file
|
12 |
|
|
//* Creation : Hi 11/18/2002
|
13 |
|
|
//*
|
14 |
|
|
//*----------------------------------------------------------------------------
|
15 |
|
|
#ifndef AT91C_EMAC_H
|
16 |
|
|
#define AT91C_EMAC_H
|
17 |
|
|
|
18 |
|
|
#include "lwipopts.h"
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
/* Number of receive buffers */
|
22 |
|
|
#define NB_RX_BUFFERS 20
|
23 |
|
|
|
24 |
|
|
/* Size of each receive buffer - DO NOT CHANGE. */
|
25 |
|
|
#define ETH_RX_BUFFER_SIZE 128
|
26 |
|
|
|
27 |
|
|
/* Number of Transmit buffers */
|
28 |
|
|
#define NB_TX_BUFFERS ( MEMP_NUM_PBUF / 2 )
|
29 |
|
|
|
30 |
|
|
/* Size of each Transmit buffer. */
|
31 |
|
|
#define ETH_TX_BUFFER_SIZE ( PBUF_POOL_BUFSIZE )
|
32 |
|
|
|
33 |
|
|
/* Receive Transfer descriptor structure */
|
34 |
|
|
typedef struct _AT91S_RxTdDescriptor {
|
35 |
|
|
unsigned int addr;
|
36 |
|
|
union
|
37 |
|
|
{
|
38 |
|
|
unsigned int status;
|
39 |
|
|
struct {
|
40 |
|
|
unsigned int Length:11;
|
41 |
|
|
unsigned int Res0:1;
|
42 |
|
|
unsigned int Rxbuf_off:2;
|
43 |
|
|
unsigned int StartOfFrame:1;
|
44 |
|
|
unsigned int EndOfFrame:1;
|
45 |
|
|
unsigned int Cfi:1;
|
46 |
|
|
unsigned int VlanPriority:3;
|
47 |
|
|
unsigned int PriorityTag:1;
|
48 |
|
|
unsigned int VlanTag:1;
|
49 |
|
|
unsigned int TypeID:1;
|
50 |
|
|
unsigned int Sa4Match:1;
|
51 |
|
|
unsigned int Sa3Match:1;
|
52 |
|
|
unsigned int Sa2Match:1;
|
53 |
|
|
unsigned int Sa1Match:1;
|
54 |
|
|
unsigned int Res1:1;
|
55 |
|
|
unsigned int ExternalAdd:1;
|
56 |
|
|
unsigned int UniCast:1;
|
57 |
|
|
unsigned int MultiCast:1;
|
58 |
|
|
unsigned int BroadCast:1;
|
59 |
|
|
}S_Status;
|
60 |
|
|
}U_Status;
|
61 |
|
|
}AT91S_RxTdDescriptor, *AT91PS_RxTdDescriptor;
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/* Transmit Transfer descriptor structure */
|
65 |
|
|
typedef struct _AT91S_TxTdDescriptor {
|
66 |
|
|
unsigned int addr;
|
67 |
|
|
union
|
68 |
|
|
{
|
69 |
|
|
unsigned int status;
|
70 |
|
|
struct {
|
71 |
|
|
unsigned int Length:11;
|
72 |
|
|
unsigned int Res0:4;
|
73 |
|
|
unsigned int LastBuff:1;
|
74 |
|
|
unsigned int NoCrc:1;
|
75 |
|
|
unsigned int Res1:10;
|
76 |
|
|
unsigned int BufExhausted:1;
|
77 |
|
|
unsigned int TransmitUnderrun:1;
|
78 |
|
|
unsigned int TransmitError:1;
|
79 |
|
|
unsigned int Wrap:1;
|
80 |
|
|
unsigned int BuffUsed:1;
|
81 |
|
|
}S_Status;
|
82 |
|
|
}U_Status;
|
83 |
|
|
}AT91S_TxTdDescriptor, *AT91PS_TxTdDescriptor;
|
84 |
|
|
|
85 |
|
|
#define AT91C_OWNERSHIP_BIT 0x00000001
|
86 |
|
|
|
87 |
|
|
/* Receive status defintion */
|
88 |
|
|
#define AT91C_BROADCAST_ADDR ((unsigned int) (1 << 31)) //* Broadcat address detected
|
89 |
|
|
#define AT91C_MULTICAST_HASH ((unsigned int) (1 << 30)) //* MultiCast hash match
|
90 |
|
|
#define AT91C_UNICAST_HASH ((unsigned int) (1 << 29)) //* UniCast hash match
|
91 |
|
|
#define AT91C_EXTERNAL_ADDR ((unsigned int) (1 << 28)) //* External Address match
|
92 |
|
|
#define AT91C_SA1_ADDR ((unsigned int) (1 << 26)) //* Specific address 1 match
|
93 |
|
|
#define AT91C_SA2_ADDR ((unsigned int) (1 << 25)) //* Specific address 2 match
|
94 |
|
|
#define AT91C_SA3_ADDR ((unsigned int) (1 << 24)) //* Specific address 3 match
|
95 |
|
|
#define AT91C_SA4_ADDR ((unsigned int) (1 << 23)) //* Specific address 4 match
|
96 |
|
|
#define AT91C_TYPE_ID ((unsigned int) (1 << 22)) //* Type ID match
|
97 |
|
|
#define AT91C_VLAN_TAG ((unsigned int) (1 << 21)) //* VLAN tag detected
|
98 |
|
|
#define AT91C_PRIORITY_TAG ((unsigned int) (1 << 20)) //* PRIORITY tag detected
|
99 |
|
|
#define AT91C_VLAN_PRIORITY ((unsigned int) (7 << 17)) //* PRIORITY Mask
|
100 |
|
|
#define AT91C_CFI_IND ((unsigned int) (1 << 16)) //* CFI indicator
|
101 |
|
|
#define AT91C_EOF ((unsigned int) (1 << 15)) //* EOF
|
102 |
|
|
#define AT91C_SOF ((unsigned int) (1 << 14)) //* SOF
|
103 |
|
|
#define AT91C_RBF_OFFSET ((unsigned int) (3 << 12)) //* Receive Buffer Offset Mask
|
104 |
|
|
#define AT91C_LENGTH_FRAME ((unsigned int) 0x07FF) //* Length of frame
|
105 |
|
|
|
106 |
|
|
/* Transmit Status definition */
|
107 |
|
|
#define AT91C_TRANSMIT_OK ((unsigned int) (1 << 31)) //*
|
108 |
|
|
#define AT91C_TRANSMIT_WRAP ((unsigned int) (1 << 30)) //* Wrap bit: mark the last descriptor
|
109 |
|
|
#define AT91C_TRANSMIT_ERR ((unsigned int) (1 << 29)) //* RLE:transmit error
|
110 |
|
|
#define AT91C_TRANSMIT_UND ((unsigned int) (1 << 28)) //* Transmit Underrun
|
111 |
|
|
#define AT91C_BUF_EX ((unsigned int) (1 << 27)) //* Buffers exhausted in mid frame
|
112 |
|
|
#define AT91C_TRANSMIT_NO_CRC ((unsigned int) (1 << 16)) //* No CRC will be appended to the current frame
|
113 |
|
|
#define AT91C_LAST_BUFFER ((unsigned int) (1 << 15)) //*
|
114 |
|
|
|
115 |
|
|
#define AT91C_EMAC_CLKEN 0x2
|
116 |
|
|
|
117 |
|
|
#endif //* AT91C_EMAC_H
|