1 |
581 |
jeremybenn |
/*
|
2 |
|
|
* @file: EthDev.h
|
3 |
|
|
* @purpose: Ethernet Device Definitions
|
4 |
|
|
* @version: V1.10
|
5 |
|
|
* @date: 24. Feb. 2009
|
6 |
|
|
*----------------------------------------------------------------------------
|
7 |
|
|
*
|
8 |
|
|
* Copyright (C) 2009 ARM Limited. All rights reserved.
|
9 |
|
|
*
|
10 |
|
|
* ARM Limited (ARM) is supplying this software for use with Cortex-M3
|
11 |
|
|
* processor based microcontrollers. This file can be freely distributed
|
12 |
|
|
* within development tools that are supporting such ARM based processors.
|
13 |
|
|
*
|
14 |
|
|
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
15 |
|
|
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
16 |
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
17 |
|
|
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
18 |
|
|
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
19 |
|
|
*
|
20 |
|
|
*/
|
21 |
|
|
|
22 |
|
|
#ifndef _ETHDEV__H
|
23 |
|
|
#define _ETHDEV__H
|
24 |
|
|
|
25 |
|
|
#ifndef NULL
|
26 |
|
|
#define NULL 0
|
27 |
|
|
#endif
|
28 |
|
|
|
29 |
|
|
/*----------------------------------------------------------------------------
|
30 |
|
|
Ethernet Device Defines
|
31 |
|
|
*----------------------------------------------------------------------------*/
|
32 |
|
|
#define EthDev_ADDR_SIZE 6 /*!< Ethernet Address size in bytes */
|
33 |
|
|
#define EthDev_MTU_SIZE 1514 /*!< Maximum Transmission Unit */
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/*----------------------------------------------------------------------------
|
37 |
|
|
Ethernet Device Configuration and Control Command Defines
|
38 |
|
|
*----------------------------------------------------------------------------*/
|
39 |
|
|
typedef enum {
|
40 |
|
|
EthDev_LINK_DOWN = 0, /*!< Ethernet link not established */
|
41 |
|
|
EthDev_LINK_UP = 1, /*!< Ethernet link established */
|
42 |
|
|
} EthDev_LINK;
|
43 |
|
|
|
44 |
|
|
typedef enum {
|
45 |
|
|
EthDev_SPEED_10M = 0, /*!< 10.0 Mbps link speed */
|
46 |
|
|
EthDev_SPEED_100M = 1, /*!< 100.0 Mbps link speed */
|
47 |
|
|
EthDev_SPEED_1000M = 2, /*!< 1.0 Gbps link speed */
|
48 |
|
|
} EthDev_SPEED;
|
49 |
|
|
|
50 |
|
|
typedef enum {
|
51 |
|
|
EthDev_DUPLEX_HALF = 0, /*!< Link half duplex */
|
52 |
|
|
EthDev_DUPLEX_FULL = 1, /*!< Link full duplex */
|
53 |
|
|
} EthDev_DUPLEX;
|
54 |
|
|
|
55 |
|
|
typedef enum {
|
56 |
|
|
EthDev_MODE_AUTO = 0,
|
57 |
|
|
EthDev_MODE_10M_FULL = 1,
|
58 |
|
|
EthDev_MODE_10M_HALF = 2,
|
59 |
|
|
EthDev_MODE_100M_FULL = 3,
|
60 |
|
|
EthDev_MODE_100M_HALF = 4,
|
61 |
|
|
EthDev_MODE_1000M_FULL = 5,
|
62 |
|
|
EthDev_MODE_1000M_HALF = 6,
|
63 |
|
|
} EthDev_MODE;
|
64 |
|
|
|
65 |
|
|
typedef struct {
|
66 |
|
|
EthDev_LINK Link : 1;
|
67 |
|
|
EthDev_DUPLEX Duplex : 1;
|
68 |
|
|
EthDev_SPEED Speed : 2;
|
69 |
|
|
} EthDev_STATUS;
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
/*----------------------------------------------------------------------------
|
73 |
|
|
Ethernet Device IO Block Structure
|
74 |
|
|
*----------------------------------------------------------------------------*/
|
75 |
|
|
typedef struct {
|
76 |
|
|
|
77 |
|
|
/* Initialized by the user application before call to Init. */
|
78 |
|
|
EthDev_MODE Mode;
|
79 |
|
|
unsigned char HwAddr[EthDev_ADDR_SIZE];
|
80 |
|
|
void *(*RxFrame) (int size);
|
81 |
|
|
void (*RxFrameReady) (int size);
|
82 |
|
|
|
83 |
|
|
/* Initialized by Ethernet driver. */
|
84 |
|
|
int (*Init) (void);
|
85 |
|
|
int (*UnInit) (void);
|
86 |
|
|
int (*SetMCFilter)(int NumHwAddr, unsigned char *pHwAddr);
|
87 |
|
|
int (*TxFrame) (void *pData, int size);
|
88 |
|
|
void (*Lock) (void);
|
89 |
|
|
void (*UnLock) (void);
|
90 |
|
|
EthDev_STATUS (*LinkChk) (void);
|
91 |
|
|
} EthDev_IOB;
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
/*
|
95 |
|
|
* Look for received data. If data is found then uip_buf is assigned to the
|
96 |
|
|
* new data and the length of the data is returned. If no data is found then
|
97 |
|
|
* uip_buf is not updated and 0 is returned.
|
98 |
|
|
*/
|
99 |
|
|
unsigned long ulGetEMACRxData( void );
|
100 |
|
|
|
101 |
|
|
/*
|
102 |
|
|
* Send usTxDataLen bytes from uip_buf.
|
103 |
|
|
*/
|
104 |
|
|
void vSendEMACTxData( unsigned short usTxDataLen );
|
105 |
|
|
|
106 |
|
|
/*
|
107 |
|
|
* Prepare the Ethernet hardware ready for TCP/IP comms.
|
108 |
|
|
*/
|
109 |
|
|
long lEMACInit(void);
|
110 |
|
|
|
111 |
|
|
#endif
|