]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / lwIP_Demo_Rowley_ARM7 / EMAC / SAM7_EMAC.h
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29 /*\r
30 Changes from V3.2.4\r
31 \r
32         + Modified the default MAC address as the one used previously was not liked\r
33           by some routers.\r
34 \r
35 */\r
36 \r
37 #ifndef SAM_7_EMAC_H\r
38 #define SAM_7_EMAC_H\r
39 \r
40 /* MAC address definition.  The MAC address must be unique on the network. */\r
41 #define emacETHADDR0 0\r
42 #define emacETHADDR1 0xbd\r
43 #define emacETHADDR2 0x33\r
44 #define emacETHADDR3 0x06\r
45 #define emacETHADDR4 0x68\r
46 #define emacETHADDR5 0x22\r
47 \r
48 /* The IP address being used. */\r
49 #define emacIPADDR0 172\r
50 #define emacIPADDR1 25\r
51 #define emacIPADDR2 218\r
52 #define emacIPADDR3 205\r
53 \r
54 /* The gateway address being used. */\r
55 #define emacGATEWAY_ADDR0 172\r
56 #define emacGATEWAY_ADDR1 25\r
57 #define emacGATEWAY_ADDR2 218\r
58 #define emacGATEWAY_ADDR3 3\r
59 \r
60 /* The network mask being used. */\r
61 #define emacNET_MASK0 255\r
62 #define emacNET_MASK1 255\r
63 #define emacNET_MASK2 0\r
64 #define emacNET_MASK3 0\r
65 \r
66 /*\r
67  * Initialise the EMAC driver.  If successful a semaphore is returned that\r
68  * is used by the EMAC ISR to indicate that Rx packets have been received.\r
69  * If the initialisation fails then NULL is returned.\r
70  */\r
71 SemaphoreHandle_t xEMACInit( void );\r
72 \r
73 /*\r
74  * Send ulLength bytes from pcFrom.  This copies the buffer to one of the\r
75  * EMAC Tx buffers, then indicates to the EMAC that the buffer is ready.\r
76  * If lEndOfFrame is true then the data being copied is the end of the frame\r
77  * and the frame can be transmitted. \r
78  */\r
79 long lEMACSend( char *pcFrom, unsigned long ulLength, long lEndOfFrame );\r
80 \r
81 /*\r
82  * Frames can be read from the EMAC in multiple sections.\r
83  * Read ulSectionLength bytes from the EMAC receive buffers to pcTo.  \r
84  * ulTotalFrameLength is the size of the entire frame.  Generally vEMACRead\r
85  * will be repetedly called until the sum of all the ulSectionLenths totals\r
86  * the value of ulTotalFrameLength.\r
87  */\r
88 void vEMACRead( char *pcTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength );\r
89 \r
90 /*\r
91  * The EMAC driver and interrupt service routines are defined in different \r
92  * files as the driver is compiled to THUMB, and the ISR to ARM.  This function\r
93  * simply passes the semaphore used to communicate between the two.\r
94  */\r
95 void vPassEMACSemaphore( SemaphoreHandle_t xCreatedSemaphore );\r
96 \r
97 /* \r
98  * Called by the Tx interrupt, this function traverses the buffers used to\r
99  * hold the frame that has just completed transmission and marks each as\r
100  * free again.\r
101  */\r
102 void vClearEMACTxBuffer( void );\r
103 \r
104 /*\r
105  * Suspend on a semaphore waiting either for the semaphore to be obtained \r
106  * or a timeout.  The semaphore is used by the EMAC ISR to indicate that\r
107  * data has been received and is ready for processing.\r
108  */\r
109 void vEMACWaitForInput( void );\r
110 \r
111 /*\r
112  * Return the length of the next frame in the receive buffers.\r
113  */\r
114 unsigned long ulEMACInputLength( void );\r
115 \r
116 #endif\r