Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
PR #2: Fix demo, test project after updating device driver (aws#2236)
Browse files Browse the repository at this point in the history
  • Loading branch information
VanNamDinh authored Jul 21, 2020
1 parent d02f0e6 commit f6476de
Show file tree
Hide file tree
Showing 436 changed files with 2,234 additions and 379,840 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2018 Renesas Electronics Corporation. All rights reserved.
* Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/

/***********************************************************************************************************************
Expand Down Expand Up @@ -53,7 +53,7 @@
**********************************************************************************************************************/
#define ETHER_BUFSIZE_MIN 60

#if defined( BSP_MCU_RX65N ) || defined( BSP_MCU_RX64M ) || defined( BSP_MCU_RX71M )
#if defined(BSP_MCU_RX65N) || defined(BSP_MCU_RX64M) || defined(BSP_MCU_RX71M) || defined(BSP_MCU_RX72M)
#if ETHER_CFG_MODE_SEL == 0
#define R_ETHER_PinSet_CHANNEL_0() R_ETHER_PinSet_ETHERC0_MII()
#elif ETHER_CFG_MODE_SEL == 1
Expand Down Expand Up @@ -90,7 +90,6 @@ typedef enum
} eMAC_INIT_STATUS_TYPE;

static TaskHandle_t ether_receive_check_task_handle = 0;
static TaskHandle_t ether_link_check_task_handle = 0;
static TaskHandle_t xTaskToNotify = NULL;
static BaseType_t xPHYLinkStatus;
static BaseType_t xReportedStatus;
Expand All @@ -108,6 +107,9 @@ void get_random_number( uint8_t * data,
uint32_t len );

void prvLinkStatusChange( BaseType_t xStatus );
#if ( ipconfigHAS_PRINTF != 0 )
static void prvMonitorResources( void );
#endif

/***********************************************************************************************************************
* Function Name: xNetworkInterfaceInitialise ()
Expand Down Expand Up @@ -200,6 +202,56 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxDescript
} /* End of function xNetworkInterfaceOutput() */


#if ( ipconfigHAS_PRINTF != 0 )
static void prvMonitorResources()
{
static UBaseType_t uxLastMinBufferCount = 0u;
static UBaseType_t uxCurrentBufferCount = 0u;
static size_t uxMinLastSize = 0uL;
static size_t uxCurLastSize = 0uL;
size_t uxMinSize;
size_t uxCurSize;

uxCurrentBufferCount = uxGetMinimumFreeNetworkBuffers();

if( uxLastMinBufferCount != uxCurrentBufferCount )
{
/* The logging produced below may be helpful
* while tuning +TCP: see how many buffers are in use. */
uxLastMinBufferCount = uxCurrentBufferCount;
FreeRTOS_printf( ( "Network buffers: %lu lowest %lu\n",
uxGetNumberOfFreeNetworkBuffers(), uxCurrentBufferCount ) );
}

uxMinSize = xPortGetMinimumEverFreeHeapSize();
uxCurSize = xPortGetFreeHeapSize();

if( uxMinLastSize != uxMinSize )
{
uxCurLastSize = uxCurSize;
uxMinLastSize = uxMinSize;
FreeRTOS_printf( ( "Heap: current %lu lowest %lu\n", uxCurSize, uxMinSize ) );
}

#if ( ipconfigCHECK_IP_QUEUE_SPACE != 0 )
{
static UBaseType_t uxLastMinQueueSpace = 0;
UBaseType_t uxCurrentCount = 0u;

uxCurrentCount = uxGetMinimumIPQueueSpace();

if( uxLastMinQueueSpace != uxCurrentCount )
{
/* The logging produced below may be helpful
* while tuning +TCP: see how many buffers are in use. */
uxLastMinQueueSpace = uxCurrentCount;
FreeRTOS_printf( ( "Queue space: lowest %lu\n", uxCurrentCount ) );
}
}
#endif /* ipconfigCHECK_IP_QUEUE_SPACE */
}
#endif /* ( ipconfigHAS_PRINTF != 0 ) */

/***********************************************************************************************************************
* Function Name: prvEMACDeferredInterruptHandlerTask ()
* Description : The deferred interrupt handler is a standard RTOS task.
Expand Down Expand Up @@ -233,10 +285,11 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )

for( ; ; )
{
/* Call a function that monitors resources: the amount of free network
buffers and the amount of free space on the heap. See FreeRTOS_IP.c
for more detailed comments. */
vPrintResourceStats();
#if ( ipconfigHAS_PRINTF != 0 )
{
prvMonitorResources();
}
#endif /* ipconfigHAS_PRINTF != 0 ) */

/* Wait for the Ethernet MAC interrupt to indicate that another packet
* has been received. */
Expand All @@ -251,15 +304,7 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )
if( xBytesReceived < 0 )
{
/* This is an error. Logged. */
if( xBytesReceived == ETHER_ERR_LINK )
{
/* Auto-negotiation is not completed, and transmission/
reception is not enabled. Will be logged elsewhere. */
}
else
{
FreeRTOS_printf( ( "R_ETHER_Read_ZC2: rc = %d not %d\n", xBytesReceived, ETHER_ERR_LINK ) );
}
FreeRTOS_printf( ( "R_ETHER_Read_ZC2: rc = %d\n", xBytesReceived ) );
}
else if( xBytesReceived > 0 )
{
Expand Down Expand Up @@ -315,7 +360,7 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )
/* The message was successfully sent to the TCP/IP stack.
* Call the standard trace macro to log the occurrence. */
iptraceNETWORK_INTERFACE_RECEIVE();
R_NOP();
R_BSP_NOP();
}
}
else
Expand Down Expand Up @@ -385,9 +430,9 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
uint32_t ul;
uint8_t * buffer_address;

R_EXTERN_SEC( B_ETHERNET_BUFFERS_1 )
R_BSP_SECTION_OPERATORS_INIT( B_ETHERNET_BUFFERS_1 )

buffer_address = R_SECTOP( B_ETHERNET_BUFFERS_1 );
buffer_address = R_BSP_SECTOP( B_ETHERNET_BUFFERS_1 );

for( ul = 0; ul < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; ul++ )
{
Expand All @@ -406,6 +451,7 @@ void prvLinkStatusChange( BaseType_t xStatus )
{
if( xReportedStatus != xStatus )
{
FreeRTOS_printf( ( "prvLinkStatusChange( %d )\n", xStatus ) );
xReportedStatus = xStatus;
}
}
Expand Down
Loading

0 comments on commit f6476de

Please sign in to comment.