2 * FreeRTOS Kernel V10.3.0
\r
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\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
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
31 + Modified the default MAC address as the one used previously was not liked
\r
36 #ifndef SAM_7_EMAC_H
\r
37 #define SAM_7_EMAC_H
\r
39 /* MAC address definition. The MAC address must be unique on the network. */
\r
40 #define emacETHADDR0 0
\r
41 #define emacETHADDR1 0xbd
\r
42 #define emacETHADDR2 0x33
\r
43 #define emacETHADDR3 0x06
\r
44 #define emacETHADDR4 0x68
\r
45 #define emacETHADDR5 0x22
\r
47 /* The IP address being used. */
\r
48 #define emacIPADDR0 172
\r
49 #define emacIPADDR1 25
\r
50 #define emacIPADDR2 218
\r
51 #define emacIPADDR3 205
\r
53 /* The gateway address being used. */
\r
54 #define emacGATEWAY_ADDR0 172
\r
55 #define emacGATEWAY_ADDR1 25
\r
56 #define emacGATEWAY_ADDR2 218
\r
57 #define emacGATEWAY_ADDR3 3
\r
59 /* The network mask being used. */
\r
60 #define emacNET_MASK0 255
\r
61 #define emacNET_MASK1 255
\r
62 #define emacNET_MASK2 0
\r
63 #define emacNET_MASK3 0
\r
66 * Initialise the EMAC driver. If successful a semaphore is returned that
\r
67 * is used by the EMAC ISR to indicate that Rx packets have been received.
\r
68 * If the initialisation fails then NULL is returned.
\r
70 SemaphoreHandle_t xEMACInit( void );
\r
73 * Send ulLength bytes from pcFrom. This copies the buffer to one of the
\r
74 * EMAC Tx buffers, then indicates to the EMAC that the buffer is ready.
\r
75 * If lEndOfFrame is true then the data being copied is the end of the frame
\r
76 * and the frame can be transmitted.
\r
78 long lEMACSend( char *pcFrom, unsigned long ulLength, long lEndOfFrame );
\r
81 * Frames can be read from the EMAC in multiple sections.
\r
82 * Read ulSectionLength bytes from the EMAC receive buffers to pcTo.
\r
83 * ulTotalFrameLength is the size of the entire frame. Generally vEMACRead
\r
84 * will be repetedly called until the sum of all the ulSectionLenths totals
\r
85 * the value of ulTotalFrameLength.
\r
87 void vEMACRead( char *pcTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength );
\r
90 * The EMAC driver and interrupt service routines are defined in different
\r
91 * files as the driver is compiled to THUMB, and the ISR to ARM. This function
\r
92 * simply passes the semaphore used to communicate between the two.
\r
94 void vPassEMACSemaphore( SemaphoreHandle_t xCreatedSemaphore );
\r
97 * Called by the Tx interrupt, this function traverses the buffers used to
\r
98 * hold the frame that has just completed transmission and marks each as
\r
101 void vClearEMACTxBuffer( void );
\r
104 * Suspend on a semaphore waiting either for the semaphore to be obtained
\r
105 * or a timeout. The semaphore is used by the EMAC ISR to indicate that
\r
106 * data has been received and is ready for processing.
\r
108 void vEMACWaitForInput( void );
\r
111 * Return the length of the next frame in the receive buffers.
\r
113 unsigned long ulEMACInputLength( void );
\r