Statistics
| Branch: | Tag: | Revision:

amiro-blt / Target / Demo / ARMCM4_STM32F405_Power_Management_GCC / Boot / lib / ethernetlib / inc / stm32_eth.h @ 69661903

History | View | Annotate | Download (80.7 KB)

1
/**
2
  ******************************************************************************
3
  * @file    stm32_eth.h
4
  * @author  MCD Application Team
5
  * @version V1.0.0
6
  * @date    06/19/2009
7
  * @brief   This file contains all the functions prototypes for the Ethernet
8
  *          firmware library.
9
  ******************************************************************************
10
  * @copy
11
  *
12
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
  *
19
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
20
  */ 
21

    
22
/* Define to prevent recursive inclusion -------------------------------------*/
23
#ifndef __STM32_ETH_H
24
#define __STM32_ETH_H
25

    
26
#ifdef __cplusplus
27
 extern "C" {
28
#endif
29

    
30
/* Includes ------------------------------------------------------------------*/
31
#include "stm32f4xx.h"                               /* STM32 registers                */
32

    
33
/** @addtogroup STM32_ETH_Driver
34
  * @{
35
  */
36

    
37
/** @defgroup ETH_Exported_Types
38
  * @{
39
  */
40

    
41
/** 
42
  * @brief  ETH MAC Init structure definition
43
  */ 
44
typedef struct {
45
/** 
46
  * @brief / * MAC  
47
  */ 
48
  uint32_t             ETH_AutoNegotiation;           /*!< Selects or not the AutoNegotiation with the external PHY */  
49
  uint32_t             ETH_Watchdog;                  /*!< Enable/disable Watchdog timer */  
50
  uint32_t             ETH_Jabber;                    /*!< Enable/disable Jabber timer */ 
51
  uint32_t             ETH_InterFrameGap;             /*!< Selects minimum IFG between frames during transmission */   
52
  uint32_t             ETH_CarrierSense;              /*!< Enable/disable Carrier Sense */ 
53
  uint32_t             ETH_Speed;                     /*!< Indicates the Ethernet speed: 10/100 Mbps */  
54
  uint32_t             ETH_ReceiveOwn;                /*!< Enable/disable the reception of frames when the TX_EN signal is asserted in Half-Duplex mode */  
55
  uint32_t             ETH_LoopbackMode;              /*!< Enable/disable internal MAC MII Loopback mode */ 
56
  uint32_t             ETH_Mode;                      /*!< Selects the MAC duplex mode: Half-Duplex or Full-Duplex mode */ 
57
  uint32_t             ETH_ChecksumOffload;           /*!< Enable/disable the calculation of complement sum of all received Ethernet frame payloads */   
58
  uint32_t             ETH_RetryTransmission;         /*!< Enable/disable the MAC attempt retries transmission, based on the settings of BL, when a colision occurs (Half-Duplex mode) */
59
  uint32_t             ETH_AutomaticPadCRCStrip;      /*!< Enable/disable Automatic MAC Pad/CRC Stripping */ 
60
  uint32_t             ETH_BackOffLimit;              /*!< Selects the BackOff limit value */ 
61
  uint32_t             ETH_DeferralCheck;             /*!< Enable/disable deferral check function (Half-Duplex mode) */                                                                                                       
62
  uint32_t             ETH_ReceiveAll;                /*!< Enable/disable all frames reception by the MAC (No fitering)*/ 
63
  uint32_t             ETH_SourceAddrFilter;          /*!< Selects EnableNormal/EnableInverse/disable Source Address Filter comparison */                  
64
  uint32_t             ETH_PassControlFrames;         /*!< Selects None/All/FilterPass of all control frames (including unicast and multicast PAUSE frames) */ 
65
  uint32_t             ETH_BroadcastFramesReception;  /*!< Enable/disable reception of Broadcast Frames */
66
  uint32_t             ETH_DestinationAddrFilter;     /*!< Selects EnableNormal/EnableInverse destination filter for both unicast and multicast frames */ 
67
  uint32_t             ETH_PromiscuousMode;           /*!< Enable/disable Promiscuous Mode */
68
  uint32_t             ETH_MulticastFramesFilter;     /*!< Selects the Multicast Frames filter: None/HashTableFilter/PerfectFilter/PerfectHashTableFilter */ 
69
  uint32_t             ETH_UnicastFramesFilter;       /*!< Selects the Unicast Frames filter: HashTableFilter/PerfectFilter/PerfectHashTableFilter  */
70
  uint32_t             ETH_HashTableHigh;             /*!< This field contains the higher 32 bits of Hash table.  */    
71
  uint32_t             ETH_HashTableLow;              /*!< This field contains the lower 32 bits of Hash table.  */    
72
  uint32_t             ETH_PauseTime;                 /*!< This field holds the value to be used in the Pause Time field in the transmit control frame */
73
  uint32_t             ETH_ZeroQuantaPause;           /*!< Enable/disable the automatic generation of Zero-Quanta Pause Control frames */ 
74
  uint32_t             ETH_PauseLowThreshold;         /*!< This field configures the threshold of the PAUSE to be checked for automatic retransmission of PAUSE Frame */
75
  uint32_t             ETH_UnicastPauseFrameDetect;   /*!< Enable/disable MAC to detect the Pause frames (with MAC Address0 unicast address and unique multicast address) */ 
76
  uint32_t             ETH_ReceiveFlowControl;        /*!< Enable/disable the MAC to decode the received Pause frame and disable its transmitter for a specified (Pause Time) time */
77
  uint32_t             ETH_TransmitFlowControl;       /*!< Enable/disable the MAC to transmit Pause frames (Full-Duplex mode) or the MAC back-pressure operation (Half-Duplex mode) */     
78
  uint32_t             ETH_VLANTagComparison;         /*!< Selects the 12-bit VLAN identifier or the complete 16-bit VLAN tag for comparison and filtering */ 
79
  uint32_t             ETH_VLANTagIdentifier;         /*!< VLAN tag identifier for receive frames */
80

    
81
/** 
82
  * @brief / * DMA  
83
  */ 
84
  uint32_t             ETH_DropTCPIPChecksumErrorFrame; /*!< Enable/disable Dropping of TCP/IP Checksum Error Frames */
85
  uint32_t             ETH_ReceiveStoreForward;         /*!< Enable/disable Receive store and forward */
86
  uint32_t             ETH_FlushReceivedFrame;          /*!< Enable/disable flushing of received frames */
87
  uint32_t             ETH_TransmitStoreForward;        /*!< Enable/disable Transmit store and forward */
88
  uint32_t             ETH_TransmitThresholdControl;    /*!< Selects the Transmit Threshold Control */
89
  uint32_t             ETH_ForwardErrorFrames;          /*!< Enable/disable forward to DMA of all frames except runt error frames */
90
  uint32_t             ETH_ForwardUndersizedGoodFrames; /*!< Enable/disable Rx FIFO to forward Undersized frames (frames with no Error and length less than 64 bytes) including pad-bytes and CRC) */
91
  uint32_t             ETH_ReceiveThresholdControl;     /*!< Selects the threshold level of the Receive FIFO */
92
  uint32_t             ETH_SecondFrameOperate;          /*!< Enable/disable the DMA process of a second frame of Transmit data even before status for first frame is obtained */
93
  uint32_t             ETH_AddressAlignedBeats;         /*!< Enable/disable Address Aligned Beats */
94
  uint32_t             ETH_FixedBurst;                  /*!< Enable/disable the AHB Master interface fixed burst transfers */
95
  uint32_t             ETH_RxDMABurstLength;            /*!< Indicate the maximum number of beats to be transferred in one Rx DMA transaction */
96
  uint32_t             ETH_TxDMABurstLength;            /*!< Indicate the maximum number of beats to be transferred in one Tx DMA transaction */                                                 
97
  uint32_t             ETH_DescriptorSkipLength;        /*!< Specifies the number of word to skip between two unchained descriptors (Ring mode) */
98
  uint32_t             ETH_DMAArbitration;              /*!< Selects DMA Tx/Rx arbitration */  
99
}ETH_InitTypeDef;
100

    
101
/**--------------------------------------------------------------------------**/
102
/** 
103
  * @brief                           DMA descriptors types
104
  */ 
105
/**--------------------------------------------------------------------------**/
106

    
107
/** 
108
  * @brief  ETH DMA Desciptors data structure definition
109
  */ 
110
typedef struct  {
111
  uint32_t   Status;                /*!< Status */
112
  uint32_t   ControlBufferSize;     /*!< Control and Buffer1, Buffer2 lengths */
113
  uint32_t   Buffer1Addr;           /*!< Buffer1 address pointer */
114
  uint32_t   Buffer2NextDescAddr;   /*!< Buffer2 or next descriptor address pointer */
115
} ETH_DMADESCTypeDef;
116

    
117
/**
118
  * @}
119
  */
120

    
121
/** @defgroup ETH_Exported_Constants
122
  * @{
123
  */ 
124
/**--------------------------------------------------------------------------**/
125
/** 
126
  * @brief                          ETH Frames defines
127
  */ 
128
/**--------------------------------------------------------------------------**/
129

    
130
/** @defgroup ENET_Buffers_setting 
131
  * @{
132
  */ 
133
#define ETH_MAX_PACKET_SIZE    1520    /*!< ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
134
#define ETH_HEADER               14    /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */
135
#define ETH_CRC                   4    /*!< Ethernet CRC */
136
#define ETH_EXTRA                 2    /*!< Extra bytes in some cases */   
137
#define VLAN_TAG                  4    /*!< optional 802.1q VLAN Tag */
138
#define MIN_ETH_PAYLOAD          46    /*!< Minimum Ethernet payload size */
139
#define MAX_ETH_PAYLOAD        1500    /*!< Maximum Ethernet payload size */
140
#define JUMBO_FRAME_PAYLOAD    9000    /*!< Jumbo frame payload size */      
141

    
142
/**--------------------------------------------------------------------------**/
143
/** 
144
  * @brief                 Ethernet DMA descriptors registers bits definition
145
  */ 
146
/**--------------------------------------------------------------------------**/
147

    
148
/* DMA Tx Desciptor -----------------------------------------------------------*/
149
/**----------------------------------------------------------------------------------------------
150
  TDES0 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
151
  -----------------------------------------------------------------------------------------------
152
  TDES1 | Reserved[31:29] | Buffer2 ByteCount[28:16] | Reserved[15:13] | Buffer1 ByteCount[12:0] |
153
  -----------------------------------------------------------------------------------------------
154
  TDES2 |                         Buffer1 Address [31:0]                                         |
155
  -----------------------------------------------------------------------------------------------
156
  TDES3 |                   Buffer2 Address [31:0] / Next Desciptor Address [31:0]               |
157
  ---------------------------------------------------------------------------------------------**/
158

    
159
/** 
160
  * @brief  Bit definition of TDES0 register: DMA Tx descriptor status register
161
  */ 
162
#define ETH_DMATxDesc_OWN                     ((uint32_t)0x80000000)  /*!< OWN bit: descriptor is owned by DMA engine */
163
#define ETH_DMATxDesc_IC                      ((uint32_t)0x40000000)  /*!< Interrupt on Completion */
164
#define ETH_DMATxDesc_LS                      ((uint32_t)0x20000000)  /*!< Last Segment */
165
#define ETH_DMATxDesc_FS                      ((uint32_t)0x10000000)  /*!< First Segment */
166
#define ETH_DMATxDesc_DC                      ((uint32_t)0x08000000)  /*!< Disable CRC */
167
#define ETH_DMATxDesc_DP                      ((uint32_t)0x04000000)  /*!< Disable Padding */
168
#define ETH_DMATxDesc_TTSE                    ((uint32_t)0x02000000)  /*!< Transmit Time Stamp Enable */
169
#define ETH_DMATxDesc_CIC                     ((uint32_t)0x00C00000)  /*!< Checksum Insertion Control: 4 cases */
170
#define ETH_DMATxDesc_CIC_ByPass              ((uint32_t)0x00000000)  /*!< Do Nothing: Checksum Engine is bypassed */ 
171
#define ETH_DMATxDesc_CIC_IPV4Header          ((uint32_t)0x00400000)  /*!< IPV4 header Checksum Insertion */ 
172
#define ETH_DMATxDesc_CIC_TCPUDPICMP_Segment  ((uint32_t)0x00800000)  /*!< TCP/UDP/ICMP Checksum Insertion calculated over segment only */ 
173
#define ETH_DMATxDesc_CIC_TCPUDPICMP_Full     ((uint32_t)0x00C00000)  /*!< TCP/UDP/ICMP Checksum Insertion fully calculated */ 
174
#define ETH_DMATxDesc_TER                     ((uint32_t)0x00200000)  /*!< Transmit End of Ring */
175
#define ETH_DMATxDesc_TCH                     ((uint32_t)0x00100000)  /*!< Second Address Chained */
176
#define ETH_DMATxDesc_TTSS                    ((uint32_t)0x00020000)  /*!< Tx Time Stamp Status */
177
#define ETH_DMATxDesc_IHE                     ((uint32_t)0x00010000)  /*!< IP Header Error */
178
#define ETH_DMATxDesc_ES                      ((uint32_t)0x00008000)  /*!< Error summary: OR of the following bits: UE || ED || EC || LCO || NC || LCA || FF || JT */
179
#define ETH_DMATxDesc_JT                      ((uint32_t)0x00004000)  /*!< Jabber Timeout */
180
#define ETH_DMATxDesc_FF                      ((uint32_t)0x00002000)  /*!< Frame Flushed: DMA/MTL flushed the frame due to SW flush */
181
#define ETH_DMATxDesc_PCE                     ((uint32_t)0x00001000)  /*!< Payload Checksum Error */
182
#define ETH_DMATxDesc_LCA                     ((uint32_t)0x00000800)  /*!< Loss of Carrier: carrier lost during tramsmission */
183
#define ETH_DMATxDesc_NC                      ((uint32_t)0x00000400)  /*!< No Carrier: no carrier signal from the tranceiver */
184
#define ETH_DMATxDesc_LCO                     ((uint32_t)0x00000200)  /*!< Late Collision: transmission aborted due to collision */
185
#define ETH_DMATxDesc_EC                      ((uint32_t)0x00000100)  /*!< Excessive Collision: transmission aborted after 16 collisions */
186
#define ETH_DMATxDesc_VF                      ((uint32_t)0x00000080)  /*!< VLAN Frame */
187
#define ETH_DMATxDesc_CC                      ((uint32_t)0x00000078)  /*!< Collision Count */
188
#define ETH_DMATxDesc_ED                      ((uint32_t)0x00000004)  /*!< Excessive Deferral */
189
#define ETH_DMATxDesc_UF                      ((uint32_t)0x00000002)  /*!< Underflow Error: late data arrival from the memory */
190
#define ETH_DMATxDesc_DB                      ((uint32_t)0x00000001)  /*!< Deferred Bit */
191

    
192
/** 
193
  * @brief  Bit definition of TDES1 register
194
  */ 
195
#define ETH_DMATxDesc_TBS2  ((uint32_t)0x1FFF0000)  /*!< Transmit Buffer2 Size */
196
#define ETH_DMATxDesc_TBS1  ((uint32_t)0x00001FFF)  /*!< Transmit Buffer1 Size */
197

    
198
/** 
199
  * @brief  Bit definition of TDES2 register
200
  */ 
201
#define ETH_DMATxDesc_B1AP  ((uint32_t)0xFFFFFFFF)  /*!< Buffer1 Address Pointer */
202

    
203
/** 
204
  * @brief  Bit definition of TDES3 register
205
  */ 
206
#define ETH_DMATxDesc_B2AP  ((uint32_t)0xFFFFFFFF)  /*!< Buffer2 Address Pointer */
207

    
208
/**
209
  * @}
210
  */ 
211

    
212

    
213
/** @defgroup DMA_Rx_descriptor 
214
  * @{
215
  */
216

    
217
/**--------------------------------------------------------------------------------------------------------------------
218
  RDES0 | OWN(31) |                                             Status [30:0]                                          |
219
  ---------------------------------------------------------------------------------------------------------------------
220
  RDES1 | CTRL(31) | Reserved[30:29] | Buffer2 ByteCount[28:16] | CTRL[15:14] | Reserved(13) | Buffer1 ByteCount[12:0] |
221
  ---------------------------------------------------------------------------------------------------------------------
222
  RDES2 |                                       Buffer1 Address [31:0]                                                 |
223
  ---------------------------------------------------------------------------------------------------------------------
224
  RDES3 |                          Buffer2 Address [31:0] / Next Desciptor Address [31:0]                              |
225
  -------------------------------------------------------------------------------------------------------------------**/
226

    
227
/** 
228
  * @brief  Bit definition of RDES0 register: DMA Rx descriptor status register
229
  */ 
230
#define ETH_DMARxDesc_OWN         ((uint32_t)0x80000000)  /*!< OWN bit: descriptor is owned by DMA engine  */
231
#define ETH_DMARxDesc_AFM         ((uint32_t)0x40000000)  /*!< DA Filter Fail for the rx frame  */
232
#define ETH_DMARxDesc_FL          ((uint32_t)0x3FFF0000)  /*!< Receive descriptor frame length  */
233
#define ETH_DMARxDesc_ES          ((uint32_t)0x00008000)  /*!< Error summary: OR of the following bits: DE || OE || IPC || LC || RWT || RE || CE */
234
#define ETH_DMARxDesc_DE          ((uint32_t)0x00004000)  /*!< Desciptor error: no more descriptors for receive frame  */
235
#define ETH_DMARxDesc_SAF         ((uint32_t)0x00002000)  /*!< SA Filter Fail for the received frame */
236
#define ETH_DMARxDesc_LE          ((uint32_t)0x00001000)  /*!< Frame size not matching with length field */
237
#define ETH_DMARxDesc_OE          ((uint32_t)0x00000800)  /*!< Overflow Error: Frame was damaged due to buffer overflow */
238
#define ETH_DMARxDesc_VLAN        ((uint32_t)0x00000400)  /*!< VLAN Tag: received frame is a VLAN frame */
239
#define ETH_DMARxDesc_FS          ((uint32_t)0x00000200)  /*!< First descriptor of the frame  */
240
#define ETH_DMARxDesc_LS          ((uint32_t)0x00000100)  /*!< Last descriptor of the frame  */ 
241
#define ETH_DMARxDesc_IPV4HCE     ((uint32_t)0x00000080)  /*!< IPC Checksum Error: Rx Ipv4 header checksum error   */    
242
#define ETH_DMARxDesc_LC          ((uint32_t)0x00000040)  /*!< Late collision occurred during reception   */
243
#define ETH_DMARxDesc_FT          ((uint32_t)0x00000020)  /*!< Frame type - Ethernet, otherwise 802.3    */
244
#define ETH_DMARxDesc_RWT         ((uint32_t)0x00000010)  /*!< Receive Watchdog Timeout: watchdog timer expired during reception    */
245
#define ETH_DMARxDesc_RE          ((uint32_t)0x00000008)  /*!< Receive error: error reported by MII interface  */
246
#define ETH_DMARxDesc_DBE         ((uint32_t)0x00000004)  /*!< Dribble bit error: frame contains non int multiple of 8 bits  */
247
#define ETH_DMARxDesc_CE          ((uint32_t)0x00000002)  /*!< CRC error */
248
#define ETH_DMARxDesc_MAMPCE      ((uint32_t)0x00000001)  /*!< Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error */
249

    
250
/** 
251
  * @brief  Bit definition of RDES1 register
252
  */ 
253
#define ETH_DMARxDesc_DIC   ((uint32_t)0x80000000)  /*!< Disable Interrupt on Completion */
254
#define ETH_DMARxDesc_RBS2  ((uint32_t)0x1FFF0000)  /*!< Receive Buffer2 Size */
255
#define ETH_DMARxDesc_RER   ((uint32_t)0x00008000)  /*!< Receive End of Ring */
256
#define ETH_DMARxDesc_RCH   ((uint32_t)0x00004000)  /*!< Second Address Chained */
257
#define ETH_DMARxDesc_RBS1  ((uint32_t)0x00001FFF)  /*!< Receive Buffer1 Size */
258

    
259
/** 
260
  * @brief  Bit definition of RDES2 register  
261
  */ 
262
#define ETH_DMARxDesc_B1AP  ((uint32_t)0xFFFFFFFF)  /*!< Buffer1 Address Pointer */
263

    
264
/** 
265
  * @brief  Bit definition of RDES3 register  
266
  */ 
267
#define ETH_DMARxDesc_B2AP  ((uint32_t)0xFFFFFFFF)  /*!< Buffer2 Address Pointer */
268

    
269
/**--------------------------------------------------------------------------**/
270
/** 
271
  * @brief                     Desciption of common PHY registers
272
  */ 
273
/**--------------------------------------------------------------------------**/
274

    
275
/**
276
  * @}
277
  */
278

    
279
/** @defgroup PHY_Read_write_Timeouts 
280
  * @{
281
  */ 
282
#define PHY_READ_TO                     ((uint32_t)0x0004FFFF)
283
#define PHY_WRITE_TO                    ((uint32_t)0x0004FFFF)
284

    
285
/**
286
  * @}
287
  */
288

    
289
/** @defgroup PHY_Reset_Delay 
290
  * @{
291
  */ 
292
#define PHY_ResetDelay                  ((uint32_t)0x04000000) 
293

    
294
/**
295
  * @}
296
  */
297

    
298
/** @defgroup PHY_Config_Delay 
299
  * @{
300
  */ 
301
#define PHY_ConfigDelay                 ((uint32_t)0x00FFFFFF)
302

    
303
/**
304
  * @}
305
  */
306

    
307
/** @defgroup PHY_Register_address 
308
  * @{
309
  */ 
310
#define PHY_BCR                          0          /*!< Tranceiver Basic Control Register */
311
#define PHY_BSR                          1          /*!< Tranceiver Basic Status Register */
312

    
313
/**
314
  * @}
315
  */
316

    
317
/** @defgroup PHY_basic_Control_register 
318
  * @{
319
  */ 
320
#define PHY_Reset                       ((u16)0x8000)      /*!< PHY Reset */
321
#define PHY_Loopback                    ((u16)0x4000)      /*!< Select loop-back mode */
322
#define PHY_FULLDUPLEX_100M             ((u16)0x2100)      /*!< Set the full-duplex mode at 100 Mb/s */
323
#define PHY_HALFDUPLEX_100M             ((u16)0x2000)      /*!< Set the half-duplex mode at 100 Mb/s */
324
#define PHY_FULLDUPLEX_10M              ((u16)0x0100)      /*!< Set the full-duplex mode at 10 Mb/s */
325
#define PHY_HALFDUPLEX_10M              ((u16)0x0000)      /*!< Set the half-duplex mode at 10 Mb/s */
326
#define PHY_AutoNegotiation             ((u16)0x1000)      /*!< Enable auto-negotiation function */
327
#define PHY_Restart_AutoNegotiation     ((u16)0x0200)      /*!< Restart auto-negotiation function */
328
#define PHY_Powerdown                   ((u16)0x0800)      /*!< Select the power down mode */
329
#define PHY_Isolate                     ((u16)0x0400)      /*!< Isolate PHY from MII */
330

    
331
/**
332
  * @}
333
  */
334

    
335
/** @defgroup PHY_basic_status_register 
336
  * @{
337
  */ 
338
#define PHY_AutoNego_Complete           ((u16)0x0020)      /*!< Auto-Negotioation process completed */
339
#define PHY_Linked_Status               ((u16)0x0004)      /*!< Valid link established */
340
#define PHY_Jabber_detection            ((u16)0x0002)      /*!< Jabber condition detected */
341

    
342
/**
343
  * @}
344
  */
345

    
346
/** @defgroup PHY_status_register 
347
  * @{
348
  */ 
349
/* The PHY status register value change from a PHY to another so the user have 
350
   to update this value depending on the used external PHY */
351
/** 
352
  * @brief  For LAN8700  
353
  */ 
354
//#define PHY_SR                           31         /*!< Tranceiver Status Register */
355
/** 
356
  * @brief  For DP83848  
357
  */ 
358
#define PHY_SR                           16     /*!< Tranceiver Status Register */
359

    
360
/* The Speed and Duplex mask values change from a PHY to another so the user have to update
361
   this value depending on the used external PHY */
362
/** 
363
  * @brief  For LAN8700  
364
  */ 
365
//#define PHY_Speed_Status            ((u16)0x0004)       /*!< Configured information of Speed: 10Mbps */
366
//#define PHY_Duplex_Status           ((u16)0x0010)       /*!< Configured information of Duplex: Full-duplex */
367

    
368
/** 
369
  * @brief  For DP83848  
370
  */ 
371
#define PHY_Speed_Status            ((u16)0x0002)    /*!< Configured information of Speed: 10Mbps */
372
#define PHY_Duplex_Status           ((u16)0x0004)    /*!< Configured information of Duplex: Full-duplex */
373
#define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20)
374
#define IS_ETH_PHY_REG(REG) (((REG) == PHY_BCR) || \
375
                             ((REG) == PHY_BSR) || \
376
                             ((REG) == PHY_SR))
377

    
378
/**--------------------------------------------------------------------------**/
379
/** 
380
  * @brief                                  MAC defines
381
  */ 
382
/**--------------------------------------------------------------------------**/
383

    
384
/**
385
  * @}
386
  */ 
387

    
388
/** @defgroup ETH_AutoNegotiation 
389
  * @{
390
  */ 
391
#define ETH_AutoNegotiation_Enable     ((uint32_t)0x00000001)
392
#define ETH_AutoNegotiation_Disable    ((uint32_t)0x00000000)
393
#define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AutoNegotiation_Enable) || \
394
                                     ((CMD) == ETH_AutoNegotiation_Disable))
395

    
396
/**
397
  * @}
398
  */
399

    
400
/** @defgroup ETH_watchdog 
401
  * @{
402
  */ 
403
#define ETH_Watchdog_Enable       ((uint32_t)0x00000000)
404
#define ETH_Watchdog_Disable      ((uint32_t)0x00800000)
405
#define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_Watchdog_Enable) || \
406
                              ((CMD) == ETH_Watchdog_Disable))
407

    
408
/**
409
  * @}
410
  */
411

    
412
/** @defgroup ETH_Jabber 
413
  * @{
414
  */ 
415
#define ETH_Jabber_Enable    ((uint32_t)0x00000000)
416
#define ETH_Jabber_Disable   ((uint32_t)0x00400000)
417
#define IS_ETH_JABBER(CMD) (((CMD) == ETH_Jabber_Enable) || \
418
                            ((CMD) == ETH_Jabber_Disable))
419

    
420
/**
421
  * @}
422
  */
423

    
424
/** @defgroup ETH_Inter_Frame_Gap 
425
  * @{
426
  */ 
427
#define ETH_InterFrameGap_96Bit   ((uint32_t)0x00000000)  /*!< minimum IFG between frames during transmission is 96Bit */
428
#define ETH_InterFrameGap_88Bit   ((uint32_t)0x00020000)  /*!< minimum IFG between frames during transmission is 88Bit */
429
#define ETH_InterFrameGap_80Bit   ((uint32_t)0x00040000)  /*!< minimum IFG between frames during transmission is 80Bit */
430
#define ETH_InterFrameGap_72Bit   ((uint32_t)0x00060000)  /*!< minimum IFG between frames during transmission is 72Bit */
431
#define ETH_InterFrameGap_64Bit   ((uint32_t)0x00080000)  /*!< minimum IFG between frames during transmission is 64Bit */
432
#define ETH_InterFrameGap_56Bit   ((uint32_t)0x000A0000)  /*!< minimum IFG between frames during transmission is 56Bit */
433
#define ETH_InterFrameGap_48Bit   ((uint32_t)0x000C0000)  /*!< minimum IFG between frames during transmission is 48Bit */
434
#define ETH_InterFrameGap_40Bit   ((uint32_t)0x000E0000)  /*!< minimum IFG between frames during transmission is 40Bit */
435
#define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_InterFrameGap_96Bit) || \
436
                                     ((GAP) == ETH_InterFrameGap_88Bit) || \
437
                                     ((GAP) == ETH_InterFrameGap_80Bit) || \
438
                                     ((GAP) == ETH_InterFrameGap_72Bit) || \
439
                                     ((GAP) == ETH_InterFrameGap_64Bit) || \
440
                                     ((GAP) == ETH_InterFrameGap_56Bit) || \
441
                                     ((GAP) == ETH_InterFrameGap_48Bit) || \
442
                                     ((GAP) == ETH_InterFrameGap_40Bit))
443

    
444
/**
445
  * @}
446
  */
447

    
448
/** @defgroup ETH_Carrier_Sense 
449
  * @{
450
  */ 
451
#define ETH_CarrierSense_Enable   ((uint32_t)0x00000000)
452
#define ETH_CarrierSense_Disable  ((uint32_t)0x00010000)
453
#define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CarrierSense_Enable) || \
454
                                   ((CMD) == ETH_CarrierSense_Disable))
455

    
456
/**
457
  * @}
458
  */
459

    
460
/** @defgroup ETH_Speed 
461
  * @{
462
  */ 
463
#define ETH_Speed_10M        ((uint32_t)0x00000000)
464
#define ETH_Speed_100M       ((uint32_t)0x00004000)
465
#define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_Speed_10M) || \
466
                             ((SPEED) == ETH_Speed_100M))
467

    
468
/**
469
  * @}
470
  */
471

    
472
/** @defgroup ETH_Receive_Own 
473
  * @{
474
  */ 
475
#define ETH_ReceiveOwn_Enable     ((uint32_t)0x00000000)
476
#define ETH_ReceiveOwn_Disable    ((uint32_t)0x00002000)
477
#define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_ReceiveOwn_Enable) || \
478
                                 ((CMD) == ETH_ReceiveOwn_Disable))
479

    
480
/**
481
  * @}
482
  */
483

    
484
/** @defgroup ETH_Loop_back_Mode 
485
  * @{
486
  */ 
487
#define ETH_LoopbackMode_Enable        ((uint32_t)0x00001000)
488
#define ETH_LoopbackMode_Disable       ((uint32_t)0x00000000)
489
#define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LoopbackMode_Enable) || \
490
                                   ((CMD) == ETH_LoopbackMode_Disable))
491

    
492
/**
493
  * @}
494
  */
495

    
496
/** @defgroup ETH_Duplex_mode 
497
  * @{
498
  */ 
499
#define ETH_Mode_FullDuplex       ((uint32_t)0x00000800)
500
#define ETH_Mode_HalfDuplex       ((uint32_t)0x00000000)
501
#define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_Mode_FullDuplex) || \
502
                                  ((MODE) == ETH_Mode_HalfDuplex))
503

    
504
/**
505
  * @}
506
  */
507

    
508
/** @defgroup ETH_Checksum_Offload 
509
  * @{
510
  */ 
511
#define ETH_ChecksumOffload_Enable     ((uint32_t)0x00000400)
512
#define ETH_ChecksumOffload_Disable    ((uint32_t)0x00000000)
513
#define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_ChecksumOffload_Enable) || \
514
                                      ((CMD) == ETH_ChecksumOffload_Disable))
515

    
516
/**
517
  * @}
518
  */
519

    
520
/** @defgroup ETH_Retry_Transmission 
521
  * @{
522
  */ 
523
#define ETH_RetryTransmission_Enable   ((uint32_t)0x00000000)
524
#define ETH_RetryTransmission_Disable  ((uint32_t)0x00000200)
525
#define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RetryTransmission_Enable) || \
526
                                        ((CMD) == ETH_RetryTransmission_Disable))
527

    
528
/**
529
  * @}
530
  */
531

    
532
/** @defgroup ETH_Automatic_Pad_CRC_Strip 
533
  * @{
534
  */ 
535
#define ETH_AutomaticPadCRCStrip_Enable     ((uint32_t)0x00000080)
536
#define ETH_AutomaticPadCRCStrip_Disable    ((uint32_t)0x00000000)
537
#define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AutomaticPadCRCStrip_Enable) || \
538
                                            ((CMD) == ETH_AutomaticPadCRCStrip_Disable))
539

    
540
/**
541
  * @}
542
  */
543

    
544
/** @defgroup ETH_Back-Off_limit 
545
  * @{
546
  */ 
547
#define ETH_BackOffLimit_10  ((uint32_t)0x00000000)
548
#define ETH_BackOffLimit_8   ((uint32_t)0x00000020)
549
#define ETH_BackOffLimit_4   ((uint32_t)0x00000040)
550
#define ETH_BackOffLimit_1   ((uint32_t)0x00000060)
551
#define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BackOffLimit_10) || \
552
                                     ((LIMIT) == ETH_BackOffLimit_8) || \
553
                                     ((LIMIT) == ETH_BackOffLimit_4) || \
554
                                     ((LIMIT) == ETH_BackOffLimit_1))
555

    
556
/**
557
  * @}
558
  */
559

    
560
/** @defgroup ETH_Deferral_Check 
561
  * @{
562
  */
563
#define ETH_DeferralCheck_Enable       ((uint32_t)0x00000010)
564
#define ETH_DeferralCheck_Disable      ((uint32_t)0x00000000)
565
#define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DeferralCheck_Enable) || \
566
                                    ((CMD) == ETH_DeferralCheck_Disable))
567

    
568
/**
569
  * @}
570
  */
571

    
572
/** @defgroup ETH_Receive_All 
573
  * @{
574
  */ 
575
#define ETH_ReceiveAll_Enable     ((uint32_t)0x80000000)
576
#define ETH_ReceiveAll_Disable    ((uint32_t)0x00000000)
577
#define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_ReceiveAll_Enable) || \
578
                                 ((CMD) == ETH_ReceiveAll_Disable))
579

    
580
/**
581
  * @}
582
  */
583

    
584
/** @defgroup ETH_Source_Addr_Filter 
585
  * @{
586
  */ 
587
#define ETH_SourceAddrFilter_Normal_Enable       ((uint32_t)0x00000200)
588
#define ETH_SourceAddrFilter_Inverse_Enable      ((uint32_t)0x00000300)
589
#define ETH_SourceAddrFilter_Disable             ((uint32_t)0x00000000)
590
#define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SourceAddrFilter_Normal_Enable) || \
591
                                        ((CMD) == ETH_SourceAddrFilter_Inverse_Enable) || \
592
                                        ((CMD) == ETH_SourceAddrFilter_Disable))
593

    
594
/**
595
  * @}
596
  */
597

    
598
/** @defgroup ETH_Pass_Control_Frames 
599
  * @{
600
  */ 
601
#define ETH_PassControlFrames_BlockAll                ((uint32_t)0x00000040)  /*!< MAC filters all control frames from reaching the application */
602
#define ETH_PassControlFrames_ForwardAll              ((uint32_t)0x00000080)  /*!< MAC forwards all control frames to application even if they fail the Address Filter */
603
#define ETH_PassControlFrames_ForwardPassedAddrFilter ((uint32_t)0x000000C0)  /*!< MAC forwards control frames that pass the Address Filter. */ 
604
#define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PassControlFrames_BlockAll) || \
605
                                     ((PASS) == ETH_PassControlFrames_ForwardAll) || \
606
                                     ((PASS) == ETH_PassControlFrames_ForwardPassedAddrFilter))
607

    
608
/**
609
  * @}
610
  */
611

    
612
/** @defgroup ETH_Broadcast_Frames_Reception 
613
  * @{
614
  */ 
615
#define ETH_BroadcastFramesReception_Enable      ((uint32_t)0x00000000)
616
#define ETH_BroadcastFramesReception_Disable     ((uint32_t)0x00000020)
617
#define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BroadcastFramesReception_Enable) || \
618
                                                ((CMD) == ETH_BroadcastFramesReception_Disable))
619

    
620
/**
621
  * @}
622
  */
623

    
624
/** @defgroup ETH_Destination_Addr_Filter 
625
  * @{
626
  */ 
627
#define ETH_DestinationAddrFilter_Normal    ((uint32_t)0x00000000)
628
#define ETH_DestinationAddrFilter_Inverse   ((uint32_t)0x00000008)
629
#define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DestinationAddrFilter_Normal) || \
630
                                                ((FILTER) == ETH_DestinationAddrFilter_Inverse))
631

    
632
/**
633
  * @}
634
  */
635

    
636
/** @defgroup ETH_Promiscuous_Mode 
637
  * @{
638
  */ 
639
#define ETH_PromiscuousMode_Enable     ((uint32_t)0x00000001)
640
#define ETH_PromiscuousMode_Disable    ((uint32_t)0x00000000)
641
#define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PromiscuousMode_Enable) || \
642
                                      ((CMD) == ETH_PromiscuousMode_Disable))
643

    
644
/**
645
  * @}
646
  */
647

    
648
/** @defgroup ETH_multicast_frames_filter 
649
  * @{
650
  */ 
651
#define ETH_MulticastFramesFilter_PerfectHashTable    ((uint32_t)0x00000404)
652
#define ETH_MulticastFramesFilter_HashTable           ((uint32_t)0x00000004)
653
#define ETH_MulticastFramesFilter_Perfect             ((uint32_t)0x00000000)
654
#define ETH_MulticastFramesFilter_None                ((uint32_t)0x00000010)
655
#define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MulticastFramesFilter_PerfectHashTable) || \
656
                                                ((FILTER) == ETH_MulticastFramesFilter_HashTable) || \
657
                                                ((FILTER) == ETH_MulticastFramesFilter_Perfect) || \
658
                                                ((FILTER) == ETH_MulticastFramesFilter_None))
659
                                                     
660

    
661
/**
662
  * @}
663
  */
664

    
665
/** @defgroup ETH_unicast_frames_filter 
666
  * @{
667
  */ 
668
#define ETH_UnicastFramesFilter_PerfectHashTable ((uint32_t)0x00000402)
669
#define ETH_UnicastFramesFilter_HashTable        ((uint32_t)0x00000002)
670
#define ETH_UnicastFramesFilter_Perfect          ((uint32_t)0x00000000)
671
#define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UnicastFramesFilter_PerfectHashTable) || \
672
                                              ((FILTER) == ETH_UnicastFramesFilter_HashTable) || \
673
                                              ((FILTER) == ETH_UnicastFramesFilter_Perfect))
674

    
675
/**
676
  * @}
677
  */
678

    
679
/** @defgroup ETH_Pause_Time 
680
  * @{
681
  */ 
682
#define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFF)
683

    
684
/**
685
  * @}
686
  */
687

    
688
/** @defgroup ETH_Zero_Quanta_Pause 
689
  * @{
690
  */ 
691
#define ETH_ZeroQuantaPause_Enable     ((uint32_t)0x00000000)
692
#define ETH_ZeroQuantaPause_Disable    ((uint32_t)0x00000080)
693
#define IS_ETH_ZEROQUANTA_PAUSE(CMD)   (((CMD) == ETH_ZeroQuantaPause_Enable) || \
694
                                        ((CMD) == ETH_ZeroQuantaPause_Disable))
695
/**
696
  * @}
697
  */
698

    
699
/** @defgroup ETH_Pause_Low_Threshold 
700
  * @{
701
  */ 
702
#define ETH_PauseLowThreshold_Minus4        ((uint32_t)0x00000000)  /*!< Pause time minus 4 slot times */
703
#define ETH_PauseLowThreshold_Minus28       ((uint32_t)0x00000010)  /*!< Pause time minus 28 slot times */
704
#define ETH_PauseLowThreshold_Minus144      ((uint32_t)0x00000020)  /*!< Pause time minus 144 slot times */
705
#define ETH_PauseLowThreshold_Minus256      ((uint32_t)0x00000030)  /*!< Pause time minus 256 slot times */
706
#define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PauseLowThreshold_Minus4) || \
707
                                               ((THRESHOLD) == ETH_PauseLowThreshold_Minus28) || \
708
                                               ((THRESHOLD) == ETH_PauseLowThreshold_Minus144) || \
709
                                               ((THRESHOLD) == ETH_PauseLowThreshold_Minus256))
710

    
711
/**
712
  * @}
713
  */
714

    
715
/** @defgroup ETH_Unicast_Pause_Frame_Detect 
716
  * @{
717
  */ 
718
#define ETH_UnicastPauseFrameDetect_Enable  ((uint32_t)0x00000008)
719
#define ETH_UnicastPauseFrameDetect_Disable ((uint32_t)0x00000000)
720
#define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UnicastPauseFrameDetect_Enable) || \
721
                                                ((CMD) == ETH_UnicastPauseFrameDetect_Disable))
722

    
723
/**
724
  * @}
725
  */
726

    
727
/** @defgroup ETH_Receive_Flow_Control 
728
  * @{
729
  */ 
730
#define ETH_ReceiveFlowControl_Enable       ((uint32_t)0x00000004)
731
#define ETH_ReceiveFlowControl_Disable      ((uint32_t)0x00000000)
732
#define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_ReceiveFlowControl_Enable) || \
733
                                         ((CMD) == ETH_ReceiveFlowControl_Disable))
734

    
735
/**
736
  * @}
737
  */
738

    
739
/** @defgroup ETH_Transmit_Flow_Control 
740
  * @{
741
  */ 
742
#define ETH_TransmitFlowControl_Enable      ((uint32_t)0x00000002)
743
#define ETH_TransmitFlowControl_Disable     ((uint32_t)0x00000000)
744
#define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TransmitFlowControl_Enable) || \
745
                                          ((CMD) == ETH_TransmitFlowControl_Disable))
746

    
747
/**
748
  * @}
749
  */
750

    
751
/** @defgroup ETH_VLAN_Tag_Comparison 
752
  * @{
753
  */ 
754
#define ETH_VLANTagComparison_12Bit    ((uint32_t)0x00010000)
755
#define ETH_VLANTagComparison_16Bit    ((uint32_t)0x00000000)
756
#define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTagComparison_12Bit) || \
757
                                                ((COMPARISON) == ETH_VLANTagComparison_16Bit))
758
#define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFF)
759

    
760
/**
761
  * @}
762
  */
763

    
764
/** @defgroup ETH_MAC_Flags 
765
  * @{
766
  */ 
767
#define ETH_MAC_FLAG_TST     ((uint32_t)0x00000200)  /*!< Time stamp trigger flag (on MAC) */
768
#define ETH_MAC_FLAG_MMCT    ((uint32_t)0x00000040)  /*!< MMC transmit flag  */
769
#define ETH_MAC_FLAG_MMCR    ((uint32_t)0x00000020)  /*!< MMC receive flag */
770
#define ETH_MAC_FLAG_MMC     ((uint32_t)0x00000010)  /*!< MMC flag (on MAC) */
771
#define ETH_MAC_FLAG_PMT     ((uint32_t)0x00000008)  /*!< PMT flag (on MAC) */
772
#define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \
773
                                   ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \
774
                                   ((FLAG) == ETH_MAC_FLAG_PMT))
775
/**
776
  * @}
777
  */
778

    
779
/** @defgroup ETH_MAC_Interrupts 
780
  * @{
781
  */ 
782
#define ETH_MAC_IT_TST       ((uint32_t)0x00000200)  /*!< Time stamp trigger interrupt (on MAC) */
783
#define ETH_MAC_IT_MMCT      ((uint32_t)0x00000040)  /*!< MMC transmit interrupt */
784
#define ETH_MAC_IT_MMCR      ((uint32_t)0x00000020)  /*!< MMC receive interrupt */
785
#define ETH_MAC_IT_MMC       ((uint32_t)0x00000010)  /*!< MMC interrupt (on MAC) */
786
#define ETH_MAC_IT_PMT       ((uint32_t)0x00000008)  /*!< PMT interrupt (on MAC) */
787
#define IS_ETH_MAC_IT(IT) ((((IT) & (uint32_t)0xFFFFFDF7) == 0x00) && ((IT) != 0x00))
788
#define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_IT_TST) || ((IT) == ETH_MAC_IT_MMCT) || \
789
                               ((IT) == ETH_MAC_IT_MMCR) || ((IT) == ETH_MAC_IT_MMC) || \
790
                               ((IT) == ETH_MAC_IT_PMT))
791
/**
792
  * @}
793
  */
794

    
795
/** @defgroup ETH_MAC_addresses 
796
  * @{
797
  */ 
798
#define ETH_MAC_Address0     ((uint32_t)0x00000000)
799
#define ETH_MAC_Address1     ((uint32_t)0x00000008)
800
#define ETH_MAC_Address2     ((uint32_t)0x00000010)
801
#define ETH_MAC_Address3     ((uint32_t)0x00000018)
802
#define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_Address0) || \
803
                                         ((ADDRESS) == ETH_MAC_Address1) || \
804
                                         ((ADDRESS) == ETH_MAC_Address2) || \
805
                                         ((ADDRESS) == ETH_MAC_Address3))
806
#define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_Address1) || \
807
                                        ((ADDRESS) == ETH_MAC_Address2) || \
808
                                        ((ADDRESS) == ETH_MAC_Address3))
809
/**
810
  * @}
811
  */
812

    
813
/** @defgroup ETH_MAC_addresses_filter:_SA_DA_filed_of_received_frames 
814
  * @{
815
  */ 
816
#define ETH_MAC_AddressFilter_SA       ((uint32_t)0x00000000)
817
#define ETH_MAC_AddressFilter_DA       ((uint32_t)0x00000008)
818
#define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_AddressFilter_SA) || \
819
                                           ((FILTER) == ETH_MAC_AddressFilter_DA))
820
/**
821
  * @}
822
  */
823

    
824
/** @defgroup ETH_MAC_addresses_filter:_Mask_bytes 
825
  * @{
826
  */ 
827
#define ETH_MAC_AddressMask_Byte6      ((uint32_t)0x20000000)  /*!< Mask MAC Address high reg bits [15:8] */
828
#define ETH_MAC_AddressMask_Byte5      ((uint32_t)0x10000000)  /*!< Mask MAC Address high reg bits [7:0] */
829
#define ETH_MAC_AddressMask_Byte4      ((uint32_t)0x08000000)  /*!< Mask MAC Address low reg bits [31:24] */
830
#define ETH_MAC_AddressMask_Byte3      ((uint32_t)0x04000000)  /*!< Mask MAC Address low reg bits [23:16] */
831
#define ETH_MAC_AddressMask_Byte2      ((uint32_t)0x02000000)  /*!< Mask MAC Address low reg bits [15:8] */
832
#define ETH_MAC_AddressMask_Byte1      ((uint32_t)0x01000000)  /*!< Mask MAC Address low reg bits [70] */
833
#define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_AddressMask_Byte6) || \
834
                                       ((MASK) == ETH_MAC_AddressMask_Byte5) || \
835
                                       ((MASK) == ETH_MAC_AddressMask_Byte4) || \
836
                                       ((MASK) == ETH_MAC_AddressMask_Byte3) || \
837
                                       ((MASK) == ETH_MAC_AddressMask_Byte2) || \
838
                                       ((MASK) == ETH_MAC_AddressMask_Byte1))
839

    
840
/**--------------------------------------------------------------------------**/
841
/** 
842
  * @brief                      Ethernet DMA Desciptors defines
843
  */ 
844
/**--------------------------------------------------------------------------**/
845
/**
846
  * @}
847
  */
848

    
849
/** @defgroup ETH_DMA_Tx_descriptor_flags
850
  * @{
851
  */ 
852
#define IS_ETH_DMATxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATxDesc_OWN) || \
853
                                         ((FLAG) == ETH_DMATxDesc_IC) || \
854
                                         ((FLAG) == ETH_DMATxDesc_LS) || \
855
                                         ((FLAG) == ETH_DMATxDesc_FS) || \
856
                                         ((FLAG) == ETH_DMATxDesc_DC) || \
857
                                         ((FLAG) == ETH_DMATxDesc_DP) || \
858
                                         ((FLAG) == ETH_DMATxDesc_TTSE) || \
859
                                         ((FLAG) == ETH_DMATxDesc_TER) || \
860
                                         ((FLAG) == ETH_DMATxDesc_TCH) || \
861
                                         ((FLAG) == ETH_DMATxDesc_TTSS) || \
862
                                         ((FLAG) == ETH_DMATxDesc_IHE) || \
863
                                         ((FLAG) == ETH_DMATxDesc_ES) || \
864
                                         ((FLAG) == ETH_DMATxDesc_JT) || \
865
                                         ((FLAG) == ETH_DMATxDesc_FF) || \
866
                                         ((FLAG) == ETH_DMATxDesc_PCE) || \
867
                                         ((FLAG) == ETH_DMATxDesc_LCA) || \
868
                                         ((FLAG) == ETH_DMATxDesc_NC) || \
869
                                         ((FLAG) == ETH_DMATxDesc_LCO) || \
870
                                         ((FLAG) == ETH_DMATxDesc_EC) || \
871
                                         ((FLAG) == ETH_DMATxDesc_VF) || \
872
                                         ((FLAG) == ETH_DMATxDesc_CC) || \
873
                                         ((FLAG) == ETH_DMATxDesc_ED) || \
874
                                         ((FLAG) == ETH_DMATxDesc_UF) || \
875
                                         ((FLAG) == ETH_DMATxDesc_DB))
876

    
877
/**
878
  * @}
879
  */
880

    
881
/** @defgroup ETH_DMA_Tx_descriptor_segment 
882
  * @{
883
  */ 
884
#define ETH_DMATxDesc_LastSegment      ((uint32_t)0x40000000)  /*!< Last Segment */
885
#define ETH_DMATxDesc_FirstSegment     ((uint32_t)0x20000000)  /*!< First Segment */
886
#define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATxDesc_LastSegment) || \
887
                                            ((SEGMENT) == ETH_DMATxDesc_FirstSegment))
888

    
889
/**
890
  * @}
891
  */
892

    
893
/** @defgroup ETH_DMA_Tx_descriptor_Checksum_Insertion_Control
894
  * @{
895
  */ 
896
#define ETH_DMATxDesc_ChecksumByPass             ((uint32_t)0x00000000)   /*!< Checksum engine bypass */
897
#define ETH_DMATxDesc_ChecksumIPV4Header         ((uint32_t)0x00400000)   /*!< IPv4 header checksum insertion  */
898
#define ETH_DMATxDesc_ChecksumTCPUDPICMPSegment  ((uint32_t)0x00800000)   /*!< TCP/UDP/ICMP checksum insertion. Pseudo header checksum is assumed to be present */
899
#define ETH_DMATxDesc_ChecksumTCPUDPICMPFull     ((uint32_t)0x00C00000)   /*!< TCP/UDP/ICMP checksum fully in hardware including pseudo header */
900
#define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATxDesc_ChecksumByPass) || \
901
                                              ((CHECKSUM) == ETH_DMATxDesc_ChecksumIPV4Header) || \
902
                                              ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPSegment) || \
903
                                              ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPFull))
904
/** 
905
  * @brief  ETH DMA Tx Desciptor buffer size
906
  */ 
907
#define IS_ETH_DMATxDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFF)
908

    
909
/**
910
  * @}
911
  */
912

    
913
/** @defgroup ETH_DMA_Rx_descriptor_flags
914
  * @{
915
  */ 
916
#define IS_ETH_DMARxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARxDesc_OWN) || \
917
                                         ((FLAG) == ETH_DMARxDesc_AFM) || \
918
                                         ((FLAG) == ETH_DMARxDesc_ES) || \
919
                                         ((FLAG) == ETH_DMARxDesc_DE) || \
920
                                         ((FLAG) == ETH_DMARxDesc_SAF) || \
921
                                         ((FLAG) == ETH_DMARxDesc_LE) || \
922
                                         ((FLAG) == ETH_DMARxDesc_OE) || \
923
                                         ((FLAG) == ETH_DMARxDesc_VLAN)