]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h
***IMMINENT RELEASE NOTICE***
[freertos] / FreeRTOS / Demo / lwIP_Demo_Rowley_ARM7 / EMAC / SAM7_EMAC.h
1 /*\r
2     FreeRTOS V8.1.0 - Copyright (C) 2014 Real Time Engineers Ltd. \r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS provides completely free yet professionally developed,    *\r
10      *    robust, strictly quality controlled, supported, and cross          *\r
11      *    platform software that has become a de facto standard.             *\r
12      *                                                                       *\r
13      *    Help yourself get started quickly and support the FreeRTOS         *\r
14      *    project by purchasing a FreeRTOS tutorial book, reference          *\r
15      *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
16      *                                                                       *\r
17      *    Thank you!                                                         *\r
18      *                                                                       *\r
19     ***************************************************************************\r
20 \r
21     This file is part of the FreeRTOS distribution.\r
22 \r
23     FreeRTOS is free software; you can redistribute it and/or modify it under\r
24     the terms of the GNU General Public License (version 2) as published by the\r
25     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
26 \r
27     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
28     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
29     >>!   obliged to provide the source code for proprietary components     !<<\r
30     >>!   outside of the FreeRTOS kernel.                                   !<<\r
31 \r
32     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
33     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
34     FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
35     link: http://www.freertos.org/a00114.html\r
36 \r
37     1 tab == 4 spaces!\r
38 \r
39     ***************************************************************************\r
40      *                                                                       *\r
41      *    Having a problem?  Start by reading the FAQ "My application does   *\r
42      *    not run, what could be wrong?"                                     *\r
43      *                                                                       *\r
44      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
49     license and Real Time Engineers Ltd. contact details.\r
50 \r
51     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
52     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
53     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
54 \r
55     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
56     Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
57     licenses offer ticketed support, indemnification and middleware.\r
58 \r
59     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
60     engineered and independently SIL3 certified version for use in safety and\r
61     mission critical applications that require provable dependability.\r
62 \r
63     1 tab == 4 spaces!\r
64 */\r
65 \r
66 /*\r
67 Changes from V3.2.4\r
68 \r
69         + Modified the default MAC address as the one used previously was not liked\r
70           by some routers.\r
71 \r
72 */\r
73 \r
74 #ifndef SAM_7_EMAC_H\r
75 #define SAM_7_EMAC_H\r
76 \r
77 /* MAC address definition.  The MAC address must be unique on the network. */\r
78 #define emacETHADDR0 0\r
79 #define emacETHADDR1 0xbd\r
80 #define emacETHADDR2 0x33\r
81 #define emacETHADDR3 0x06\r
82 #define emacETHADDR4 0x68\r
83 #define emacETHADDR5 0x22\r
84 \r
85 /* The IP address being used. */\r
86 #define emacIPADDR0 172\r
87 #define emacIPADDR1 25\r
88 #define emacIPADDR2 218\r
89 #define emacIPADDR3 205\r
90 \r
91 /* The gateway address being used. */\r
92 #define emacGATEWAY_ADDR0 172\r
93 #define emacGATEWAY_ADDR1 25\r
94 #define emacGATEWAY_ADDR2 218\r
95 #define emacGATEWAY_ADDR3 3\r
96 \r
97 /* The network mask being used. */\r
98 #define emacNET_MASK0 255\r
99 #define emacNET_MASK1 255\r
100 #define emacNET_MASK2 0\r
101 #define emacNET_MASK3 0\r
102 \r
103 /*\r
104  * Initialise the EMAC driver.  If successful a semaphore is returned that\r
105  * is used by the EMAC ISR to indicate that Rx packets have been received.\r
106  * If the initialisation fails then NULL is returned.\r
107  */\r
108 SemaphoreHandle_t xEMACInit( void );\r
109 \r
110 /*\r
111  * Send ulLength bytes from pcFrom.  This copies the buffer to one of the\r
112  * EMAC Tx buffers, then indicates to the EMAC that the buffer is ready.\r
113  * If lEndOfFrame is true then the data being copied is the end of the frame\r
114  * and the frame can be transmitted. \r
115  */\r
116 long lEMACSend( char *pcFrom, unsigned long ulLength, long lEndOfFrame );\r
117 \r
118 /*\r
119  * Frames can be read from the EMAC in multiple sections.\r
120  * Read ulSectionLength bytes from the EMAC receive buffers to pcTo.  \r
121  * ulTotalFrameLength is the size of the entire frame.  Generally vEMACRead\r
122  * will be repetedly called until the sum of all the ulSectionLenths totals\r
123  * the value of ulTotalFrameLength.\r
124  */\r
125 void vEMACRead( char *pcTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength );\r
126 \r
127 /*\r
128  * The EMAC driver and interrupt service routines are defined in different \r
129  * files as the driver is compiled to THUMB, and the ISR to ARM.  This function\r
130  * simply passes the semaphore used to communicate between the two.\r
131  */\r
132 void vPassEMACSemaphore( SemaphoreHandle_t xCreatedSemaphore );\r
133 \r
134 /* \r
135  * Called by the Tx interrupt, this function traverses the buffers used to\r
136  * hold the frame that has just completed transmission and marks each as\r
137  * free again.\r
138  */\r
139 void vClearEMACTxBuffer( void );\r
140 \r
141 /*\r
142  * Suspend on a semaphore waiting either for the semaphore to be obtained \r
143  * or a timeout.  The semaphore is used by the EMAC ISR to indicate that\r
144  * data has been received and is ready for processing.\r
145  */\r
146 void vEMACWaitForInput( void );\r
147 \r
148 /*\r
149  * Return the length of the next frame in the receive buffers.\r
150  */\r
151 unsigned long ulEMACInputLength( void );\r
152 \r
153 #endif\r