]> git.sur5r.net Git - freertos/blob - Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@14 1d2547de-c912-0410-9cb9...
[freertos] / Demo / lwIP_Demo_Rowley_ARM7 / EMAC / SAM7_EMAC.h
1 /*\r
2         FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
3 \r
4         This file is part of the FreeRTOS.org distribution.\r
5 \r
6         FreeRTOS.org is free software; you can redistribute it and/or modify\r
7         it under the terms of the GNU General Public License as published by\r
8         the Free Software Foundation; either version 2 of the License, or\r
9         (at your option) any later version.\r
10 \r
11         FreeRTOS.org is distributed in the hope that it will be useful,\r
12         but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14         GNU General Public License for more details.\r
15 \r
16         You should have received a copy of the GNU General Public License\r
17         along with FreeRTOS.org; if not, write to the Free Software\r
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 \r
20         A special exception to the GPL can be applied should you wish to distribute\r
21         a combined work that includes FreeRTOS.org, without being obliged to provide\r
22         the source code for any proprietary components.  See the licensing section\r
23         of http://www.FreeRTOS.org for full details of how and when the exception\r
24         can be applied.\r
25 \r
26         ***************************************************************************\r
27         See http://www.FreeRTOS.org for documentation, latest information, license\r
28         and contact details.  Please ensure to read the configuration and relevant\r
29         port sections of the online documentation.\r
30         ***************************************************************************\r
31 */\r
32 \r
33 /*\r
34 Changes from V3.2.4\r
35 \r
36         + Modified the default MAC address as the one used previously was not liked\r
37           by some routers.\r
38 \r
39 */\r
40 \r
41 #ifndef SAM_7_EMAC_H\r
42 #define SAM_7_EMAC_H\r
43 \r
44 /* MAC address definition.  The MAC address must be unique on the network. */\r
45 #define emacETHADDR0 0\r
46 #define emacETHADDR1 0xbd\r
47 #define emacETHADDR2 0x33\r
48 #define emacETHADDR3 0x06\r
49 #define emacETHADDR4 0x68\r
50 #define emacETHADDR5 0x22\r
51 \r
52 /* The IP address being used. */\r
53 #define emacIPADDR0 172\r
54 #define emacIPADDR1 25\r
55 #define emacIPADDR2 218\r
56 #define emacIPADDR3 205\r
57 \r
58 /* The gateway address being used. */\r
59 #define emacGATEWAY_ADDR0 172\r
60 #define emacGATEWAY_ADDR1 25\r
61 #define emacGATEWAY_ADDR2 218\r
62 #define emacGATEWAY_ADDR3 3\r
63 \r
64 /* The network mask being used. */\r
65 #define emacNET_MASK0 255\r
66 #define emacNET_MASK1 255\r
67 #define emacNET_MASK2 0\r
68 #define emacNET_MASK3 0\r
69 \r
70 /*\r
71  * Initialise the EMAC driver.  If successful a semaphore is returned that\r
72  * is used by the EMAC ISR to indicate that Rx packets have been received.\r
73  * If the initialisation fails then NULL is returned.\r
74  */\r
75 xSemaphoreHandle xEMACInit( void );\r
76 \r
77 /*\r
78  * Send ulLength bytes from pcFrom.  This copies the buffer to one of the\r
79  * EMAC Tx buffers, then indicates to the EMAC that the buffer is ready.\r
80  * If lEndOfFrame is true then the data being copied is the end of the frame\r
81  * and the frame can be transmitted. \r
82  */\r
83 portLONG lEMACSend( portCHAR *pcFrom, unsigned portLONG ulLength, portLONG lEndOfFrame );\r
84 \r
85 /*\r
86  * Frames can be read from the EMAC in multiple sections.\r
87  * Read ulSectionLength bytes from the EMAC receive buffers to pcTo.  \r
88  * ulTotalFrameLength is the size of the entire frame.  Generally vEMACRead\r
89  * will be repetedly called until the sum of all the ulSectionLenths totals\r
90  * the value of ulTotalFrameLength.\r
91  */\r
92 void vEMACRead( portCHAR *pcTo, unsigned portLONG ulSectionLength, unsigned portLONG ulTotalFrameLength );\r
93 \r
94 /*\r
95  * The EMAC driver and interrupt service routines are defined in different \r
96  * files as the driver is compiled to THUMB, and the ISR to ARM.  This function\r
97  * simply passes the semaphore used to communicate between the two.\r
98  */\r
99 void vPassEMACSemaphore( xSemaphoreHandle xCreatedSemaphore );\r
100 \r
101 /* \r
102  * Called by the Tx interrupt, this function traverses the buffers used to\r
103  * hold the frame that has just completed transmission and marks each as\r
104  * free again.\r
105  */\r
106 void vClearEMACTxBuffer( void );\r
107 \r
108 /*\r
109  * Suspend on a semaphore waiting either for the semaphore to be obtained \r
110  * or a timeout.  The semaphore is used by the EMAC ISR to indicate that\r
111  * data has been received and is ready for processing.\r
112  */\r
113 void vEMACWaitForInput( void );\r
114 \r
115 /*\r
116  * Return the length of the next frame in the receive buffers.\r
117  */\r
118 unsigned portLONG ulEMACInputLength( void );\r
119 \r
120 #endif\r