00001 /* 00002 FreeRTOS.org V4.1.0 - Copyright (C) 2003-2006 Richard Barry. 00003 00004 This file is part of the FreeRTOS.org distribution. 00005 00006 FreeRTOS.org is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 FreeRTOS.org is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with FreeRTOS.org; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 A special exception to the GPL can be applied should you wish to distribute 00021 a combined work that includes FreeRTOS.org, without being obliged to provide 00022 the source code for any proprietary components. See the licensing section 00023 of http://www.FreeRTOS.org for full details of how and when the exception 00024 can be applied. 00025 00026 *************************************************************************** 00027 See http://www.FreeRTOS.org for documentation, latest information, license 00028 and contact details. Please ensure to read the configuration and relevant 00029 port sections of the online documentation. 00030 *************************************************************************** 00031 */ 00032 00033 /* 00034 Changes from V3.2.4 00035 00036 + Modified the default MAC address as the one used previously was not liked 00037 by some routers. 00038 00039 */ 00040 00041 00042 #ifndef SAM_7_EMAC_H 00043 #define SAM_7_EMAC_H 00044 00045 /* MAC address definition. The MAC address must be unique on the network. */ 00046 /* MakingThings: Changed to ints so they can be changed. */ 00047 extern char emacETHADDR0; 00048 extern char emacETHADDR1; 00049 extern char emacETHADDR2; 00050 extern char emacETHADDR3; 00051 extern char emacETHADDR4; 00052 extern char emacETHADDR5; 00053 00054 /* The IP address being used. */ 00055 // #define emacIPADDR0 192 00056 // #define emacIPADDR1 168 00057 // #define emacIPADDR2 0 00058 // #define emacIPADDR3 200 00059 00060 /* The gateway address being used. */ 00061 // #define emacGATEWAY_ADDR0 192 00062 // #define emacGATEWAY_ADDR1 168 00063 // #define emacGATEWAY_ADDR2 0 00064 // #define emacGATEWAY_ADDR3 1 00065 // #define emacGATEWAY_ADDR0 172 00066 // #define emacGATEWAY_ADDR1 16 00067 // #define emacGATEWAY_ADDR2 0 00068 // #define emacGATEWAY_ADDR3 1 00069 00070 /* The network mask being used. */ 00071 // #define emacNET_MASK0 255 00072 // #define emacNET_MASK1 255 00073 #define emacNET_MASK2 255 00074 #define emacNET_MASK3 0 00075 00076 /* 00077 * Initialise the EMAC driver. If successful a semaphore is returned that 00078 * is used by the EMAC ISR to indicate that Rx packets have been received. 00079 * If the initialisation fails then NULL is returned. 00080 */ 00081 xSemaphoreHandle xEMACInit( void ); 00082 00083 /* 00084 * Send ulLength bytes from pcFrom. This copies the buffer to one of the 00085 * EMAC Tx buffers, then indicates to the EMAC that the buffer is ready. 00086 * If lEndOfFrame is true then the data being copied is the end of the frame 00087 * and the frame can be transmitted. 00088 */ 00089 portLONG lEMACSend( portCHAR *pcFrom, unsigned portLONG ulLength, portLONG lEndOfFrame ); 00090 00091 /* 00092 * Frames can be read from the EMAC in multiple sections. 00093 * Read ulSectionLength bytes from the EMAC receive buffers to pcTo. 00094 * ulTotalFrameLength is the size of the entire frame. Generally vEMACRead 00095 * will be repetedly called until the sum of all the ulSectionLenths totals 00096 * the value of ulTotalFrameLength. 00097 */ 00098 void vEMACRead( portCHAR *pcTo, unsigned portLONG ulSectionLength, unsigned portLONG ulTotalFrameLength ); 00099 00100 /* 00101 * The EMAC driver and interrupt service routines are defined in different 00102 * files as the driver is compiled to THUMB, and the ISR to ARM. This function 00103 * simply passes the semaphore used to communicate between the two. 00104 */ 00105 void vPassEMACSemaphore( xSemaphoreHandle xCreatedSemaphore ); 00106 00107 /* 00108 * Called by the Tx interrupt, this function traverses the buffers used to 00109 * hold the frame that has just completed transmission and marks each as 00110 * free again. 00111 */ 00112 void vClearEMACTxBuffer( void ); 00113 00114 /* 00115 * Suspend on a semaphore waiting either for the semaphore to be obtained 00116 * or a timeout. The semaphore is used by the EMAC ISR to indicate that 00117 * data has been received and is ready for processing. 00118 */ 00119 void vEMACWaitForInput( void ); 00120 00121 /* 00122 * Return the length of the next frame in the receive buffers. 00123 */ 00124 unsigned portLONG ulEMACInputLength( void ); 00125 00126 #endif
The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.