2 FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.
\r
5 ***************************************************************************
\r
7 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
8 * Complete, revised, and edited pdf reference manuals are also *
\r
11 * Purchasing FreeRTOS documentation will not only help you, by *
\r
12 * ensuring you get running as quickly as possible and with an *
\r
13 * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
14 * the FreeRTOS project to continue with its mission of providing *
\r
15 * professional grade, cross platform, de facto standard solutions *
\r
16 * for microcontrollers - completely free of charge! *
\r
18 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
20 * Thank you for using FreeRTOS, and thank you for your support! *
\r
22 ***************************************************************************
\r
25 This file is part of the FreeRTOS distribution.
\r
27 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
28 the terms of the GNU General Public License (version 2) as published by the
\r
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
30 >>>NOTE<<< The modification to the GPL is included to allow you to
\r
31 distribute a combined work that includes FreeRTOS without being obliged to
\r
32 provide the source code for proprietary components outside of the FreeRTOS
\r
33 kernel. FreeRTOS is distributed in the hope that it will be useful, but
\r
34 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
35 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
36 more details. You should have received a copy of the GNU General Public
\r
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
39 by writing to Richard Barry, contact details for whom are available on the
\r
44 ***************************************************************************
\r
46 * Having a problem? Start by reading the FAQ "My application does *
\r
47 * not run, what could be wrong? *
\r
49 * http://www.FreeRTOS.org/FAQHelp.html *
\r
51 ***************************************************************************
\r
54 http://www.FreeRTOS.org - Documentation, training, latest information,
\r
55 license and contact details.
\r
57 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
58 including FreeRTOS+Trace - an indispensable productivity tool.
\r
60 Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
\r
61 the code with commercial support, indemnification, and middleware, under
\r
62 the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
\r
63 provide a safety engineered and independently SIL3 certified version under
\r
64 the SafeRTOS brand: http://www.SafeRTOS.com.
\r
67 /* FreeRTOS includes. */
\r
68 #include "FreeRTOS.h"
\r
73 /* Library includes. */
\r
74 #include "stm32fxxx_eth.h"
\r
75 #include "stm32f10x_gpio.h"
\r
76 #include "stm32f10x_rcc.h"
\r
77 #include "stm32f10x_nvic.h"
\r
79 /*-----------------------------------------------------------*/
\r
81 /* Hardware specifics. */
\r
82 #define uipRCC_MAC_CLOCK ( 1UL << 14UL )
\r
83 #define uipRCC_MAC_TX_CLOCK ( 1UL << 15UL )
\r
84 #define uipRCC_MAC_RX_CLOCK ( 1UL << 16UL )
\r
85 #define uipPHY_ADDRESS ( 1 )
\r
86 #define uipENET_IRQ_NUM ( 61 )
\r
87 #define uipMODE_MII ( 1UL << 23UL )
\r
88 #define uipREMAP_MAC_IO ( 1UL << 21UL )
\r
90 /* The number of descriptors to chain together for use by the Rx DMA. */
\r
91 #define uipNUM_RX_DESCRIPTORS 4
\r
93 /* The total number of buffers to be available. At most (?) there should be
\r
94 one available for each Rx descriptor, one for current use, and one that is
\r
95 in the process of being transmitted. */
\r
96 #define uipNUM_BUFFERS ( uipNUM_RX_DESCRIPTORS + 2 )
\r
98 /* Each buffer is sized to fit an entire Ethernet packet. This is for
\r
99 simplicity and speed, but could waste RAM. */
\r
100 #define uipMAX_PACKET_SIZE 1520
\r
102 /* The field in the descriptor that is unused by this configuration is used to
\r
103 hold the send count. This is just #defined to a meaningful name. */
\r
104 #define SendCount Buffer2NextDescAddr
\r
106 /* If no buffers are available, then wait this long before looking again.... */
\r
107 #define uipBUFFER_WAIT_DELAY ( 3 / portTICK_RATE_MS )
\r
109 /* ...and don't look more than this many times. */
\r
110 #define uipBUFFER_WAIT_ATTEMPTS ( 30 )
\r
112 /* Let the DMA know that a new descriptor has been made available to it. */
\r
113 #define prvRxDescriptorAvailable() ETH_DMA->DMARPDR = 0
\r
115 /*-----------------------------------------------------------*/
\r
118 * Configure the IO for Ethernet use.
\r
120 static void prvSetupEthGPIO( void );
\r
123 * Return a pointer to an unused buffer, marking the returned buffer as now
\r
126 static unsigned char *prvGetNextBuffer( void );
\r
128 /*-----------------------------------------------------------*/
\r
130 /* Allocate the Rx descriptors used by the DMA. */
\r
131 static ETH_DMADESCTypeDef xRxDescriptors[ uipNUM_RX_DESCRIPTORS ] __attribute__((aligned(4)));
\r
133 /* Allocate the descriptor used for transmitting. It might be that better
\r
134 performance could be achieved by having more than one Tx descriptor, but
\r
135 in this simple case only one is used. */
\r
136 static volatile ETH_DMADESCTypeDef xTxDescriptor __attribute__((aligned(4)));
\r
138 /* Buffers used for receiving and transmitting data. */
\r
139 static unsigned char ucMACBuffers[ uipNUM_BUFFERS ][ uipMAX_PACKET_SIZE ] __attribute__((aligned(4)));
\r
141 /* Each ucBufferInUse index corresponds to a position in the same index in the
\r
142 ucMACBuffers array. If the index contains a 1 then the buffer within
\r
143 ucMACBuffers is in use, if it contains a 0 then the buffer is free. */
\r
144 static unsigned char ucBufferInUse[ uipNUM_BUFFERS ] = { 0 };
\r
146 /* Index to the Rx descriptor to inspect next when looking for a received
\r
148 static unsigned long ulNextDescriptor;
\r
150 /* The uip_buffer is not a fixed array, but instead gets pointed to the buffers
\r
151 allocated within this file. */
\r
152 extern unsigned char * uip_buf;
\r
154 /*-----------------------------------------------------------*/
\r
156 portBASE_TYPE xEthInitialise( void )
\r
158 static ETH_InitTypeDef xEthInit; /* Static so as not to take up too much stack space. */
\r
159 NVIC_InitTypeDef xNVICInit;
\r
160 const unsigned char ucMACAddress[] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
\r
161 portBASE_TYPE xReturn;
\r
164 /* Start with things in a safe known state. */
\r
166 for( ul = 0; ul < uipNUM_RX_DESCRIPTORS; ul++ )
\r
168 ETH_DMARxDescReceiveITConfig( &( xRxDescriptors[ ul ] ), DISABLE );
\r
171 /* Route clock to the peripheral. */
\r
172 RCC->AHBENR |= ( uipRCC_MAC_CLOCK | uipRCC_MAC_TX_CLOCK | uipRCC_MAC_RX_CLOCK );
\r
174 /* Set the MAC address. */
\r
175 ETH_MACAddressConfig( ETH_MAC_Address0, ( unsigned char * ) ucMACAddress );
\r
177 /* Use MII mode. */
\r
178 AFIO->MAPR &= ~( uipMODE_MII );
\r
180 /* Configure all the GPIO as required for MAC/PHY interfacing. */
\r
183 /* Reset the peripheral. */
\r
184 ETH_SoftwareReset();
\r
185 while( ETH_GetSoftwareResetStatus() == SET );
\r
187 /* Initialise using the whopping big structure. Code space could be saved
\r
188 by making this a const struct, however that would mean changes to the
\r
189 structure within the library header files could break the code, so for now
\r
190 just set everything manually at run time. */
\r
191 xEthInit.ETH_AutoNegotiation = ETH_AutoNegotiation_Enable;
\r
192 xEthInit.ETH_Watchdog = ETH_Watchdog_Disable;
\r
193 xEthInit.ETH_Jabber = ETH_Jabber_Disable;
\r
194 xEthInit.ETH_JumboFrame = ETH_JumboFrame_Disable;
\r
195 xEthInit.ETH_InterFrameGap = ETH_InterFrameGap_96Bit;
\r
196 xEthInit.ETH_CarrierSense = ETH_CarrierSense_Enable;
\r
197 xEthInit.ETH_Speed = ETH_Speed_10M;
\r
198 xEthInit.ETH_ReceiveOwn = ETH_ReceiveOwn_Disable;
\r
199 xEthInit.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
\r
200 xEthInit.ETH_Mode = ETH_Mode_HalfDuplex;
\r
201 xEthInit.ETH_ChecksumOffload = ETH_ChecksumOffload_Disable;
\r
202 xEthInit.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
\r
203 xEthInit.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
\r
204 xEthInit.ETH_BackOffLimit = ETH_BackOffLimit_10;
\r
205 xEthInit.ETH_DeferralCheck = ETH_DeferralCheck_Disable;
\r
206 xEthInit.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
\r
207 xEthInit.ETH_SourceAddrFilter = ETH_SourceAddrFilter_Disable;
\r
208 xEthInit.ETH_PassControlFrames = ETH_PassControlFrames_ForwardPassedAddrFilter;
\r
209 xEthInit.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
\r
210 xEthInit.ETH_DestinationAddrFilter = ETH_DestinationAddrFilter_Normal;
\r
211 xEthInit.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
\r
212 xEthInit.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
\r
213 xEthInit.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
\r
214 xEthInit.ETH_HashTableHigh = 0x0;
\r
215 xEthInit.ETH_HashTableLow = 0x0;
\r
216 xEthInit.ETH_PauseTime = 0x0;
\r
217 xEthInit.ETH_ZeroQuantaPause = ETH_ZeroQuantaPause_Disable;
\r
218 xEthInit.ETH_PauseLowThreshold = ETH_PauseLowThreshold_Minus4;
\r
219 xEthInit.ETH_UnicastPauseFrameDetect = ETH_UnicastPauseFrameDetect_Disable;
\r
220 xEthInit.ETH_ReceiveFlowControl = ETH_ReceiveFlowControl_Disable;
\r
221 xEthInit.ETH_TransmitFlowControl = ETH_TransmitFlowControl_Disable;
\r
222 xEthInit.ETH_VLANTagComparison = ETH_VLANTagComparison_16Bit;
\r
223 xEthInit.ETH_VLANTagIdentifier = 0x0;
\r
224 xEthInit.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Disable;
\r
225 xEthInit.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;
\r
226 xEthInit.ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Disable;
\r
227 xEthInit.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;
\r
228 xEthInit.ETH_TransmitThresholdControl = ETH_TransmitThresholdControl_64Bytes;
\r
229 xEthInit.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;
\r
230 xEthInit.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;
\r
231 xEthInit.ETH_ReceiveThresholdControl = ETH_ReceiveThresholdControl_64Bytes;
\r
232 xEthInit.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Disable;
\r
233 xEthInit.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;
\r
234 xEthInit.ETH_FixedBurst = ETH_FixedBurst_Disable;
\r
235 xEthInit.ETH_RxDMABurstLength = ETH_RxDMABurstLength_1Beat;
\r
236 xEthInit.ETH_TxDMABurstLength = ETH_TxDMABurstLength_1Beat;
\r
237 xEthInit.ETH_DescriptorSkipLength = 0x0;
\r
238 xEthInit.ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_1_1;
\r
240 xReturn = ETH_Init( &xEthInit, uipPHY_ADDRESS );
\r
242 /* Check a link was established. */
\r
243 if( xReturn != pdFAIL )
\r
245 /* Rx and Tx interrupts are used. */
\r
246 ETH_DMAITConfig( ETH_DMA_IT_NIS | ETH_DMA_IT_R | ETH_DMA_IT_T, ENABLE );
\r
248 /* Only a single Tx descriptor is used. For now it is set to use an Rx
\r
249 buffer, but will get updated to point to where ever uip_buf is
\r
250 pointing prior to its use. */
\r
251 ETH_DMATxDescChainInit( ( void * ) &xTxDescriptor, ( void * ) ucMACBuffers, 1 );
\r
252 ETH_DMARxDescChainInit( xRxDescriptors, ( void * ) ucMACBuffers, uipNUM_RX_DESCRIPTORS );
\r
253 for( ul = 0; ul < uipNUM_RX_DESCRIPTORS; ul++ )
\r
255 /* Ensure received data generates an interrupt. */
\r
256 ETH_DMARxDescReceiveITConfig( &( xRxDescriptors[ ul ] ), ENABLE );
\r
258 /* Fix up the addresses used by the descriptors.
\r
259 The way ETH_DMARxDescChainInit() is not compatible with the buffer
\r
260 declarations in this file. */
\r
261 xRxDescriptors[ ul ].Buffer1Addr = ( unsigned long ) &( ucMACBuffers[ ul ][ 0 ] );
\r
263 /* Mark the buffer used by this descriptor as in use. */
\r
264 ucBufferInUse[ ul ] = pdTRUE;
\r
267 /* When receiving data, start at the first descriptor. */
\r
268 ulNextDescriptor = 0;
\r
270 /* Initialise uip_buf to ensure it points somewhere valid. */
\r
271 uip_buf = prvGetNextBuffer();
\r
273 /* SendCount must be initialised to 2 to ensure the Tx descriptor looks
\r
274 as if its available (as if it has already been sent twice. */
\r
275 xTxDescriptor.SendCount = 2;
\r
277 /* Switch on the interrupts in the NVIC. */
\r
278 xNVICInit.NVIC_IRQChannel = uipENET_IRQ_NUM;
\r
279 xNVICInit.NVIC_IRQChannelPreemptionPriority = configLIBRARY_KERNEL_INTERRUPT_PRIORITY;
\r
280 xNVICInit.NVIC_IRQChannelSubPriority = 0;
\r
281 xNVICInit.NVIC_IRQChannelCmd = ENABLE;
\r
282 NVIC_Init( &xNVICInit );
\r
284 /* Buffers and descriptors are all set up, now enable the MAC. */
\r
287 /* Let the DMA know there are Rx descriptors available. */
\r
288 prvRxDescriptorAvailable();
\r
293 /*-----------------------------------------------------------*/
\r
295 static unsigned char *prvGetNextBuffer( void )
\r
298 unsigned char *ucReturn = NULL;
\r
299 unsigned long ulAttempts = 0;
\r
301 while( ucReturn == NULL )
\r
303 /* Look through the buffers to find one that is not in use by
\r
305 for( x = 0; x < uipNUM_BUFFERS; x++ )
\r
307 if( ucBufferInUse[ x ] == pdFALSE )
\r
309 ucBufferInUse[ x ] = pdTRUE;
\r
310 ucReturn = &( ucMACBuffers[ x ][ 0 ] );
\r
315 /* Was a buffer found? */
\r
316 if( ucReturn == NULL )
\r
320 if( ulAttempts >= uipBUFFER_WAIT_ATTEMPTS )
\r
325 /* Wait then look again. */
\r
326 vTaskDelay( uipBUFFER_WAIT_DELAY );
\r
332 /*-----------------------------------------------------------*/
\r
334 unsigned short usGetMACRxData( void )
\r
336 unsigned short usReturn;
\r
338 if( ( xRxDescriptors[ ulNextDescriptor ].Status & ETH_DMARxDesc_ES ) != 0 )
\r
340 /* Error in Rx. Discard the frame and give it back to the DMA. */
\r
341 xRxDescriptors[ ulNextDescriptor ].Status = ETH_DMARxDesc_OWN;
\r
342 prvRxDescriptorAvailable();
\r
344 /* No data to return. */
\r
347 /* Start from the next descriptor the next time this function is called. */
\r
348 ulNextDescriptor++;
\r
349 if( ulNextDescriptor >= uipNUM_RX_DESCRIPTORS )
\r
351 ulNextDescriptor = 0UL;
\r
354 else if( ( xRxDescriptors[ ulNextDescriptor ].Status & ETH_DMARxDesc_OWN ) == 0 )
\r
356 /* Mark the current buffer as free as uip_buf is going to be set to
\r
357 the buffer that contains the received data. */
\r
358 vReturnBuffer( uip_buf );
\r
360 /* Get the received data length from the top 2 bytes of the Status
\r
361 word and the data itself. */
\r
362 usReturn = ( unsigned short ) ( ( xRxDescriptors[ ulNextDescriptor ].Status & ETH_DMARxDesc_FL ) >> 16UL );
\r
363 uip_buf = ( unsigned char * ) ( xRxDescriptors[ ulNextDescriptor ].Buffer1Addr );
\r
365 /* Allocate a new buffer to the descriptor. */
\r
366 xRxDescriptors[ ulNextDescriptor ].Buffer1Addr = ( unsigned long ) prvGetNextBuffer();
\r
368 /* Give the descriptor back to the DMA. */
\r
369 xRxDescriptors[ ulNextDescriptor ].Status = ETH_DMARxDesc_OWN;
\r
370 prvRxDescriptorAvailable();
\r
372 /* Start from the next descriptor the next time this function is called. */
\r
373 ulNextDescriptor++;
\r
374 if( ulNextDescriptor >= uipNUM_RX_DESCRIPTORS )
\r
376 ulNextDescriptor = 0UL;
\r
381 /* No received data at all. */
\r
387 /*-----------------------------------------------------------*/
\r
389 void vSendMACData( unsigned short usDataLen )
\r
391 unsigned long ulAttempts = 0UL;
\r
393 /* Check to see if the Tx descriptor is free. The check against <2 is to
\r
394 ensure the buffer has been sent twice and in so doing preventing a race
\r
395 condition with the DMA on the ETH_DMATxDesc_OWN bit. */
\r
396 while( ( xTxDescriptor.SendCount < 2 ) && ( xTxDescriptor.Status & ETH_DMATxDesc_OWN ) == ETH_DMATxDesc_OWN )
\r
398 /* Wait for the Tx descriptor to become available. */
\r
399 vTaskDelay( uipBUFFER_WAIT_DELAY );
\r
402 if( ulAttempts > uipBUFFER_WAIT_ATTEMPTS )
\r
404 /* Something has gone wrong as the Tx descriptor is still in use.
\r
405 Clear it down manually, the data it was sending will probably be
\r
407 xTxDescriptor.Status &= ~ETH_DMATxDesc_OWN;
\r
408 vReturnBuffer( ( unsigned char * ) xTxDescriptor.Buffer1Addr );
\r
413 /* Setup the Tx descriptor for transmission. */
\r
414 xTxDescriptor.SendCount = 0;
\r
415 xTxDescriptor.Buffer1Addr = ( unsigned long ) uip_buf;
\r
416 xTxDescriptor.ControlBufferSize = ( unsigned long ) usDataLen;
\r
417 xTxDescriptor.Status = ETH_DMATxDesc_OWN | ETH_DMATxDesc_LS | ETH_DMATxDesc_FS | ETH_DMATxDesc_TER | ETH_DMATxDesc_TCH | ETH_DMATxDesc_IC;
\r
418 ETH_DMA->DMASR = ETH_DMASR_TBUS;
\r
419 ETH_DMA->DMATPDR = 0;
\r
421 /* uip_buf is being sent by the Tx descriptor. Allocate a new buffer. */
\r
422 uip_buf = prvGetNextBuffer();
\r
424 /*-----------------------------------------------------------*/
\r
426 static void prvSetupEthGPIO( void )
\r
428 GPIO_InitTypeDef xEthInit;
\r
430 /* Remap MAC IO. */
\r
431 AFIO->MAPR |= ( uipREMAP_MAC_IO );
\r
433 /* Set PA2, PA8, PB5, PB8, PB11, PB12, PB13, PC1 and PC2 for Ethernet
\r
435 xEthInit.GPIO_Pin = GPIO_Pin_2;/* | GPIO_Pin_8; This should be set when the 25MHz is generated by MCO. */
\r
436 xEthInit.GPIO_Speed = GPIO_Speed_50MHz;
\r
437 xEthInit.GPIO_Mode = GPIO_Mode_AF_PP;
\r
438 GPIO_Init( GPIOA, &xEthInit );
\r
440 xEthInit.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13; /*5*/
\r
441 GPIO_Init( GPIOB, &xEthInit );
\r
443 xEthInit.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2;
\r
444 GPIO_Init( GPIOC, &xEthInit );
\r
447 /* Configure PA0, PA1, PA3, PB10, PC3, PD8, PD9, PD10, PD11 and PD12 as
\r
449 xEthInit.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_3;
\r
450 xEthInit.GPIO_Mode = GPIO_Mode_IN_FLOATING;
\r
451 GPIO_Init( GPIOA, &xEthInit );
\r
453 xEthInit.GPIO_Pin = GPIO_Pin_10;
\r
454 GPIO_Init( GPIOB, &xEthInit );
\r
456 xEthInit.GPIO_Pin = GPIO_Pin_3;
\r
457 GPIO_Init( GPIOC, &xEthInit );
\r
459 xEthInit.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;
\r
460 GPIO_Init( GPIOD, &xEthInit );
\r
462 /*-----------------------------------------------------------*/
\r
464 void vReturnBuffer( unsigned char *pucBuffer )
\r
468 /* Mark a buffer as free for use. */
\r
469 for( ul = 0; ul < uipNUM_BUFFERS; ul++ )
\r
471 if( ucMACBuffers[ ul ] == pucBuffer )
\r
473 ucBufferInUse[ ul ] = pdFALSE;
\r
478 /*-----------------------------------------------------------*/
\r
480 void vMAC_ISR( void )
\r
482 unsigned long ulStatus;
\r
483 extern xSemaphoreHandle xEMACSemaphore;
\r
484 long xHigherPriorityTaskWoken = pdFALSE;
\r
486 /* What caused the interrupt? */
\r
487 ulStatus = ETH_DMA->DMASR;
\r
489 /* Clear everything before leaving. */
\r
490 ETH_DMA->DMASR = ulStatus;
\r
492 if( ulStatus & ETH_DMA_IT_R )
\r
494 /* Data was received. Ensure the uIP task is not blocked as data has
\r
496 xSemaphoreGiveFromISR( xEMACSemaphore, &xHigherPriorityTaskWoken );
\r
499 if( ulStatus & ETH_DMA_IT_T )
\r
501 /* Data was transmitted. */
\r
502 if( xTxDescriptor.SendCount == 0 )
\r
505 ( xTxDescriptor.SendCount )++;
\r
507 xTxDescriptor.Status = ETH_DMATxDesc_OWN | ETH_DMATxDesc_LS | ETH_DMATxDesc_FS | ETH_DMATxDesc_TER | ETH_DMATxDesc_TCH | ETH_DMATxDesc_IC;
\r
508 ETH_DMA->DMASR = ETH_DMASR_TBUS;
\r
509 ETH_DMA->DMATPDR = 0;
\r
513 /* The Tx buffer is no longer required. */
\r
514 vReturnBuffer( ( unsigned char * ) xTxDescriptor.Buffer1Addr );
\r
518 /* If xSemaphoreGiveFromISR() unblocked a task, and the unblocked task has
\r
519 a higher priority than the currently executing task, then
\r
520 xHigherPriorityTaskWoken will have been set to pdTRUE and this ISR should
\r
521 return directly to the higher priority unblocked task. */
\r
522 portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
\r