1 /***********************************************************************************************************************
\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
\r
4 * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
\r
5 * applicable laws, including copyright laws.
\r
6 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
\r
7 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
\r
8 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
\r
9 * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
\r
10 * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
\r
11 * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\r
12 * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
\r
13 * this software. By using this software, you agree to the additional terms and conditions found by accessing the
\r
15 * http://www.renesas.com/disclaimer
\r
17 * Copyright (C) 2018 Renesas Electronics Corporation. All rights reserved.
\r
18 ***********************************************************************************************************************/
\r
20 /***********************************************************************************************************************
\r
21 * File Name : NetworkInterface.c
\r
23 * Description : Interfaces FreeRTOS TCP/IP stack to RX Ethernet driver.
\r
24 ***********************************************************************************************************************/
\r
26 /***********************************************************************************************************************
\r
27 * History : DD.MM.YYYY Version Description
\r
28 * : 07.03.2018 0.1 Development
\r
29 ***********************************************************************************************************************/
\r
31 /***********************************************************************************************************************
\r
32 * Includes <System Includes> , "Project Includes"
\r
33 ***********************************************************************************************************************/
\r
39 /* FreeRTOS includes. */
\r
40 #include "FreeRTOS.h"
\r
42 #include "FreeRTOS_IP.h"
\r
43 #include "FreeRTOS_IP_Private.h"
\r
44 /*#include "FreeRTOS_DNS.h" */
\r
45 #include "NetworkBufferManagement.h"
\r
46 #include "NetworkInterface.h"
\r
48 #include "r_ether_rx_if.h"
\r
49 #include "r_pinset.h"
\r
51 /***********************************************************************************************************************
\r
53 **********************************************************************************************************************/
\r
54 #define ETHER_BUFSIZE_MIN 60
\r
56 #if defined( BSP_MCU_RX65N ) || defined( BSP_MCU_RX64M ) || defined( BSP_MCU_RX71M )
\r
57 #if ETHER_CFG_MODE_SEL == 0
\r
58 #define R_ETHER_PinSet_CHANNEL_0() R_ETHER_PinSet_ETHERC0_MII()
\r
59 #elif ETHER_CFG_MODE_SEL == 1
\r
60 #define R_ETHER_PinSet_CHANNEL_0() R_ETHER_PinSet_ETHERC0_RMII()
\r
62 #elif defined( BSP_MCU_RX63N )
\r
63 #if ETHER_CFG_MODE_SEL == 0
\r
64 #define R_ETHER_PinSet_CHANNEL_0() R_ETHER_PinSet_ETHERC_MII()
\r
65 #elif ETHER_CFG_MODE_SEL == 1
\r
66 #define R_ETHER_PinSet_CHANNEL_0() R_ETHER_PinSet_ETHERC_RMII()
\r
68 #endif /* if defined( BSP_MCU_RX65N ) || defined( BSP_MCU_RX64M ) || defined( BSP_MCU_RX71M ) */
\r
70 #ifndef PHY_LS_HIGH_CHECK_TIME_MS
\r
72 /* Check if the LinkSStatus in the PHY is still high after 2 seconds of not
\r
73 * receiving packets. */
\r
74 #define PHY_LS_HIGH_CHECK_TIME_MS 2000
\r
77 #ifndef PHY_LS_LOW_CHECK_TIME_MS
\r
78 /* Check if the LinkSStatus in the PHY is still low every second. */
\r
79 #define PHY_LS_LOW_CHECK_TIME_MS 1000
\r
82 /***********************************************************************************************************************
\r
83 * Private global variables and functions
\r
84 **********************************************************************************************************************/
\r
87 eMACInit, /* Must initialise MAC. */
\r
88 eMACPass, /* Initialisation was successful. */
\r
89 eMACFailed, /* Initialisation failed. */
\r
90 } eMAC_INIT_STATUS_TYPE;
\r
92 static TaskHandle_t ether_receive_check_task_handle = 0;
\r
93 static TaskHandle_t ether_link_check_task_handle = 0;
\r
94 static TaskHandle_t xTaskToNotify = NULL;
\r
95 static BaseType_t xPHYLinkStatus;
\r
96 static BaseType_t xReportedStatus;
\r
97 static eMAC_INIT_STATUS_TYPE xMacInitStatus = eMACInit;
\r
99 static int16_t SendData( uint8_t * pucBuffer,
\r
101 static int InitializeNetwork( void );
\r
102 static void prvEMACDeferredInterruptHandlerTask( void * pvParameters );
\r
103 static void clear_all_ether_rx_discriptors( uint32_t event );
\r
105 int32_t callback_ether_regist( void );
\r
106 void EINT_Trig_isr( void * );
\r
107 void get_random_number( uint8_t * data,
\r
110 void prvLinkStatusChange( BaseType_t xStatus );
\r
111 #if ( ipconfigHAS_PRINTF != 0 )
\r
112 static void prvMonitorResources( void );
\r
115 /***********************************************************************************************************************
\r
116 * Function Name: xNetworkInterfaceInitialise ()
\r
117 * Description : Initialization of Ethernet driver.
\r
119 * Return Value : pdPASS, pdFAIL
\r
120 **********************************************************************************************************************/
\r
121 BaseType_t xNetworkInterfaceInitialise( void )
\r
123 BaseType_t xReturn;
\r
125 if( xMacInitStatus == eMACInit )
\r
128 * Perform the hardware specific network initialization here using the Ethernet driver library to initialize the
\r
129 * Ethernet hardware, initialize DMA descriptors, and perform a PHY auto-negotiation to obtain a network link.
\r
131 * InitialiseNetwork() uses Ethernet peripheral driver library function, and returns 0 if the initialization fails.
\r
133 if( InitializeNetwork() == pdFALSE )
\r
135 xMacInitStatus = eMACFailed;
\r
139 /* Indicate that the MAC initialisation succeeded. */
\r
140 xMacInitStatus = eMACPass;
\r
143 FreeRTOS_printf( ( "InitializeNetwork returns %s\n", ( xMacInitStatus == eMACPass ) ? "OK" : " Fail" ) );
\r
146 if( xMacInitStatus == eMACPass )
\r
148 xReturn = xPHYLinkStatus;
\r
155 FreeRTOS_printf( ( "xNetworkInterfaceInitialise returns %d\n", xReturn ) );
\r
158 } /* End of function xNetworkInterfaceInitialise() */
\r
161 /***********************************************************************************************************************
\r
162 * Function Name: xNetworkInterfaceOutput ()
\r
163 * Description : Simple network output interface.
\r
164 * Arguments : pxDescriptor, xReleaseAfterSend
\r
165 * Return Value : pdTRUE, pdFALSE
\r
166 **********************************************************************************************************************/
\r
167 BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxDescriptor,
\r
168 BaseType_t xReleaseAfterSend )
\r
170 BaseType_t xReturn = pdFALSE;
\r
172 /* Simple network interfaces (as opposed to more efficient zero copy network
\r
173 * interfaces) just use Ethernet peripheral driver library functions to copy
\r
174 * data from the FreeRTOS+TCP buffer into the peripheral driver's own buffer.
\r
175 * This example assumes SendData() is a peripheral driver library function that
\r
176 * takes a pointer to the start of the data to be sent and the length of the
\r
177 * data to be sent as two separate parameters. The start of the data is located
\r
178 * by pxDescriptor->pucEthernetBuffer. The length of the data is located
\r
179 * by pxDescriptor->xDataLength. */
\r
180 if( xPHYLinkStatus != 0 )
\r
182 if( SendData( pxDescriptor->pucEthernetBuffer, pxDescriptor->xDataLength ) >= 0 )
\r
185 /* Call the standard trace macro to log the send event. */
\r
186 iptraceNETWORK_INTERFACE_TRANSMIT();
\r
191 /* As the PHY Link Status is low, it makes no sense trying to deliver a packet. */
\r
194 if( xReleaseAfterSend != pdFALSE )
\r
196 /* It is assumed SendData() copies the data out of the FreeRTOS+TCP Ethernet
\r
197 * buffer. The Ethernet buffer is therefore no longer needed, and must be
\r
198 * freed for re-use. */
\r
199 vReleaseNetworkBufferAndDescriptor( pxDescriptor );
\r
203 } /* End of function xNetworkInterfaceOutput() */
\r
206 #if ( ipconfigHAS_PRINTF != 0 )
\r
207 static void prvMonitorResources()
\r
209 static UBaseType_t uxLastMinBufferCount = 0u;
\r
210 static UBaseType_t uxCurrentBufferCount = 0u;
\r
211 static size_t uxMinLastSize = 0uL;
\r
212 static size_t uxCurLastSize = 0uL;
\r
216 uxCurrentBufferCount = uxGetMinimumFreeNetworkBuffers();
\r
218 if( uxLastMinBufferCount != uxCurrentBufferCount )
\r
220 /* The logging produced below may be helpful
\r
221 * while tuning +TCP: see how many buffers are in use. */
\r
222 uxLastMinBufferCount = uxCurrentBufferCount;
\r
223 FreeRTOS_printf( ( "Network buffers: %lu lowest %lu\n",
\r
224 uxGetNumberOfFreeNetworkBuffers(), uxCurrentBufferCount ) );
\r
227 uxMinSize = xPortGetMinimumEverFreeHeapSize();
\r
228 uxCurSize = xPortGetFreeHeapSize();
\r
230 if( uxMinLastSize != uxMinSize )
\r
232 uxCurLastSize = uxCurSize;
\r
233 uxMinLastSize = uxMinSize;
\r
234 FreeRTOS_printf( ( "Heap: current %lu lowest %lu\n", uxCurSize, uxMinSize ) );
\r
237 #if ( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
\r
239 static UBaseType_t uxLastMinQueueSpace = 0;
\r
240 UBaseType_t uxCurrentCount = 0u;
\r
242 uxCurrentCount = uxGetMinimumIPQueueSpace();
\r
244 if( uxLastMinQueueSpace != uxCurrentCount )
\r
246 /* The logging produced below may be helpful
\r
247 * while tuning +TCP: see how many buffers are in use. */
\r
248 uxLastMinQueueSpace = uxCurrentCount;
\r
249 FreeRTOS_printf( ( "Queue space: lowest %lu\n", uxCurrentCount ) );
\r
252 #endif /* ipconfigCHECK_IP_QUEUE_SPACE */
\r
254 #endif /* ( ipconfigHAS_PRINTF != 0 ) */
\r
256 /***********************************************************************************************************************
\r
257 * Function Name: prvEMACDeferredInterruptHandlerTask ()
\r
258 * Description : The deferred interrupt handler is a standard RTOS task.
\r
259 * Arguments : pvParameters
\r
260 * Return Value : none
\r
261 **********************************************************************************************************************/
\r
262 static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )
\r
264 NetworkBufferDescriptor_t * pxBufferDescriptor;
\r
265 int32_t xBytesReceived = 0;
\r
267 /* Avoid compiler warning about unreferenced parameter. */
\r
268 ( void ) pvParameters;
\r
270 /* Used to indicate that xSendEventStructToIPTask() is being called because
\r
271 * of an Ethernet receive event. */
\r
272 IPStackEvent_t xRxEvent;
\r
274 uint8_t * buffer_pointer;
\r
276 /* Some variables related to monitoring the PHY. */
\r
277 TimeOut_t xPhyTime;
\r
278 TickType_t xPhyRemTime;
\r
279 const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );
\r
281 vTaskSetTimeOutState( &xPhyTime );
\r
282 xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
\r
284 FreeRTOS_printf( ( "Deferred Interrupt Handler Task started\n" ) );
\r
285 xTaskToNotify = ether_receive_check_task_handle;
\r
289 #if ( ipconfigHAS_PRINTF != 0 )
\r
291 prvMonitorResources();
\r
293 #endif /* ipconfigHAS_PRINTF != 0 ) */
\r
295 /* Wait for the Ethernet MAC interrupt to indicate that another packet
\r
296 * has been received. */
\r
297 if( xBytesReceived <= 0 )
\r
299 ulTaskNotifyTake( pdFALSE, ulMaxBlockTime );
\r
302 /* See how much data was received. */
\r
303 xBytesReceived = R_ETHER_Read_ZC2( ETHER_CHANNEL_0, ( void ** ) &buffer_pointer );
\r
305 if( xBytesReceived < 0 )
\r
307 /* This is an error. Logged. */
\r
308 FreeRTOS_printf( ( "R_ETHER_Read_ZC2: rc = %d\n", xBytesReceived ) );
\r
310 else if( xBytesReceived > 0 )
\r
312 /* Allocate a network buffer descriptor that points to a buffer
\r
313 * large enough to hold the received frame. As this is the simple
\r
314 * rather than efficient example the received data will just be copied
\r
315 * into this buffer. */
\r
316 pxBufferDescriptor = pxGetNetworkBufferWithDescriptor( ( size_t ) xBytesReceived, 0 );
\r
318 if( pxBufferDescriptor != NULL )
\r
320 /* pxBufferDescriptor->pucEthernetBuffer now points to an Ethernet
\r
321 * buffer large enough to hold the received data. Copy the
\r
322 * received data into pcNetworkBuffer->pucEthernetBuffer. Here it
\r
323 * is assumed ReceiveData() is a peripheral driver function that
\r
324 * copies the received data into a buffer passed in as the function's
\r
325 * parameter. Remember! While is is a simple robust technique -
\r
326 * it is not efficient. An example that uses a zero copy technique
\r
327 * is provided further down this page. */
\r
328 memcpy( pxBufferDescriptor->pucEthernetBuffer, buffer_pointer, ( size_t ) xBytesReceived );
\r
329 /*ReceiveData( pxBufferDescriptor->pucEthernetBuffer ); */
\r
331 /* Set the actual packet length, in case a larger buffer was returned. */
\r
332 pxBufferDescriptor->xDataLength = ( size_t ) xBytesReceived;
\r
334 R_ETHER_Read_ZC2_BufRelease( ETHER_CHANNEL_0 );
\r
336 /* See if the data contained in the received Ethernet frame needs
\r
337 * to be processed. NOTE! It is preferable to do this in
\r
338 * the interrupt service routine itself, which would remove the need
\r
339 * to unblock this task for packets that don't need processing. */
\r
340 if( eConsiderFrameForProcessing( pxBufferDescriptor->pucEthernetBuffer ) == eProcessBuffer )
\r
342 /* The event about to be sent to the TCP/IP is an Rx event. */
\r
343 xRxEvent.eEventType = eNetworkRxEvent;
\r
345 /* pvData is used to point to the network buffer descriptor that
\r
346 * now references the received data. */
\r
347 xRxEvent.pvData = ( void * ) pxBufferDescriptor;
\r
349 /* Send the data to the TCP/IP stack. */
\r
350 if( xSendEventStructToIPTask( &xRxEvent, 0 ) == pdFALSE )
\r
352 /* The buffer could not be sent to the IP task so the buffer must be released. */
\r
353 vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor );
\r
355 /* Make a call to the standard trace macro to log the occurrence. */
\r
356 iptraceETHERNET_RX_EVENT_LOST();
\r
357 clear_all_ether_rx_discriptors( 0 );
\r
361 /* The message was successfully sent to the TCP/IP stack.
\r
362 * Call the standard trace macro to log the occurrence. */
\r
363 iptraceNETWORK_INTERFACE_RECEIVE();
\r
369 /* The Ethernet frame can be dropped, but the Ethernet buffer must be released. */
\r
370 vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor );
\r
375 /* The event was lost because a network buffer was not available.
\r
376 * Call the standard trace macro to log the occurrence. */
\r
377 iptraceETHERNET_RX_EVENT_LOST();
\r
378 clear_all_ether_rx_discriptors( 1 );
\r
379 FreeRTOS_printf( ( "R_ETHER_Read_ZC2: Cleared descriptors\n" ) );
\r
383 if( xBytesReceived > 0 )
\r
385 /* A packet was received. No need to check for the PHY status now,
\r
386 * but set a timer to check it later on. */
\r
387 vTaskSetTimeOutState( &xPhyTime );
\r
388 xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
\r
390 /* Indicate that the Link Status is high, so that
\r
391 * xNetworkInterfaceOutput() can send packets. */
\r
392 if( xPHYLinkStatus == 0 )
\r
394 xPHYLinkStatus = 1;
\r
395 FreeRTOS_printf( ( "prvEMACHandlerTask: PHY LS assume %d\n", xPHYLinkStatus ) );
\r
398 else if( ( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE ) || ( FreeRTOS_IsNetworkUp() == pdFALSE ) )
\r
400 R_ETHER_LinkProcess( 0 );
\r
402 if( xPHYLinkStatus != xReportedStatus )
\r
404 xPHYLinkStatus = xReportedStatus;
\r
405 FreeRTOS_printf( ( "prvEMACHandlerTask: PHY LS now %d\n", xPHYLinkStatus ) );
\r
408 vTaskSetTimeOutState( &xPhyTime );
\r
410 if( xPHYLinkStatus != 0 )
\r
412 xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
\r
416 xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
\r
420 } /* End of function prvEMACDeferredInterruptHandlerTask() */
\r
423 /***********************************************************************************************************************
\r
424 * Function Name: vNetworkInterfaceAllocateRAMToBuffers ()
\r
426 * Arguments : pxNetworkBuffers
\r
427 * Return Value : none
\r
428 **********************************************************************************************************************/
\r
429 void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
\r
432 uint8_t * buffer_address;
\r
434 R_EXTERN_SEC( B_ETHERNET_BUFFERS_1 )
\r
436 buffer_address = R_SECTOP( B_ETHERNET_BUFFERS_1 );
\r
438 for( ul = 0; ul < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; ul++ )
\r
440 pxNetworkBuffers[ ul ].pucEthernetBuffer = ( buffer_address + ( ETHER_CFG_BUFSIZE * ul ) );
\r
442 } /* End of function vNetworkInterfaceAllocateRAMToBuffers() */
\r
445 /***********************************************************************************************************************
\r
446 * Function Name: prvLinkStatusChange ()
\r
447 * Description : Function will be called when the Link Status of the phy has changed ( see ether_callback.c )
\r
448 * Arguments : xStatus : true when statyus has become high
\r
449 * Return Value : void
\r
450 **********************************************************************************************************************/
\r
451 void prvLinkStatusChange( BaseType_t xStatus )
\r
453 if( xReportedStatus != xStatus )
\r
455 FreeRTOS_printf( ( "prvLinkStatusChange( %d )\n", xStatus ) );
\r
456 xReportedStatus = xStatus;
\r
460 /***********************************************************************************************************************
\r
461 * Function Name: InitializeNetwork ()
\r
464 * Return Value : pdTRUE, pdFALSE
\r
465 **********************************************************************************************************************/
\r
466 static int InitializeNetwork( void )
\r
468 ether_return_t eth_ret;
\r
469 BaseType_t return_code = pdFALSE;
\r
470 ether_param_t param;
\r
471 uint8_t myethaddr[ 6 ] =
\r
481 R_ETHER_PinSet_CHANNEL_0();
\r
483 callback_ether_regist();
\r
485 param.channel = ETHER_CHANNEL_0;
\r
486 eth_ret = R_ETHER_Control( CONTROL_POWER_ON, param ); /* PHY mode settings, module stop cancellation */
\r
488 if( ETHER_SUCCESS != eth_ret )
\r
493 eth_ret = R_ETHER_Open_ZC2( ETHER_CHANNEL_0, myethaddr, ETHER_FLAG_OFF );
\r
495 if( ETHER_SUCCESS != eth_ret )
\r
500 return_code = xTaskCreate( prvEMACDeferredInterruptHandlerTask,
\r
501 "ETHER_RECEIVE_CHECK_TASK",
\r
504 configMAX_PRIORITIES - 1,
\r
505 ðer_receive_check_task_handle );
\r
507 if( pdFALSE == return_code )
\r
513 } /* End of function InitializeNetwork() */
\r
516 /***********************************************************************************************************************
\r
517 * Function Name: SendData ()
\r
519 * Arguments : pucBuffer, length
\r
520 * Return Value : 0 success, negative fail
\r
521 **********************************************************************************************************************/
\r
522 static int16_t SendData( uint8_t * pucBuffer,
\r
523 size_t length ) /*TODO complete stub function */
\r
525 ether_return_t ret;
\r
526 uint8_t * pwrite_buffer;
\r
527 uint16_t write_buf_size;
\r
529 /* (1) Retrieve the transmit buffer location controlled by the descriptor. */
\r
530 ret = R_ETHER_Write_ZC2_GetBuf( ETHER_CHANNEL_0, ( void ** ) &pwrite_buffer, &write_buf_size );
\r
532 if( ETHER_SUCCESS == ret )
\r
534 if( write_buf_size >= length )
\r
536 memcpy( pwrite_buffer, pucBuffer, length );
\r
539 if( length < ETHER_BUFSIZE_MIN ) /*under minimum*/
\r
541 memset( ( pwrite_buffer + length ), 0, ( ETHER_BUFSIZE_MIN - length ) ); /*padding*/
\r
542 length = ETHER_BUFSIZE_MIN; /*resize*/
\r
545 ret = R_ETHER_Write_ZC2_SetBuf( ETHER_CHANNEL_0, ( uint16_t ) length );
\r
546 ret = R_ETHER_CheckWrite( ETHER_CHANNEL_0 );
\r
549 if( ETHER_SUCCESS != ret )
\r
551 return -5; /* XXX return meaningful value */
\r
557 } /* End of function SendData() */
\r
560 /***********************************************************************************************************************
\r
561 * Function Name: EINT_Trig_isr
\r
562 * Description : Standard frame received interrupt handler
\r
563 * Arguments : ectrl - EDMAC and ETHERC control structure
\r
564 * Return Value : None
\r
565 * Note : This callback function is executed when EINT0 interrupt occurred.
\r
566 ***********************************************************************************************************************/
\r
567 void EINT_Trig_isr( void * ectrl )
\r
569 ether_cb_arg_t * pdecode;
\r
570 BaseType_t xHigherPriorityTaskWoken = pdFALSE;
\r
572 pdecode = ( ether_cb_arg_t * ) ectrl;
\r
574 if( pdecode->status_eesr & 0x00040000 ) /* EDMAC FR (Frame Receive Event) interrupt */
\r
576 if( xTaskToNotify != NULL )
\r
578 vTaskNotifyGiveFromISR( ether_receive_check_task_handle, &xHigherPriorityTaskWoken );
\r
581 /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
\r
582 * should be performed to ensure the interrupt returns directly to the highest
\r
583 * priority task. The macro used for this purpose is dependent on the port in
\r
584 * use and may be called portEND_SWITCHING_ISR(). */
\r
585 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
\r
586 /*TODO complete interrupt handler for other events. */
\r
588 } /* End of function EINT_Trig_isr() */
\r
591 static void clear_all_ether_rx_discriptors( uint32_t event )
\r
593 int32_t xBytesReceived;
\r
594 uint8_t * buffer_pointer;
\r
596 /* Avoid compiler warning about unreferenced parameter. */
\r
601 /* See how much data was received. */
\r
602 xBytesReceived = R_ETHER_Read_ZC2( ETHER_CHANNEL_0, ( void ** ) &buffer_pointer );
\r
604 if( 0 > xBytesReceived )
\r
606 /* This is an error. Ignored. */
\r
608 else if( 0 < xBytesReceived )
\r
610 R_ETHER_Read_ZC2_BufRelease( ETHER_CHANNEL_0 );
\r
611 iptraceETHERNET_RX_EVENT_LOST();
\r
620 /***********************************************************************************************************************
\r
621 * End of file "NetworkInterface.c"
\r
622 **********************************************************************************************************************/
\r