From a91c3116ba800649d83252bac85a7a566610ec0d Mon Sep 17 00:00:00 2001 From: Peter R Herrmann <114958111+Peter-Herrmann@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:08:37 -0700 Subject: [PATCH] DriverSAM/NetworkInterface.c warning cleanup - purely refactoring (#1016) * warning cleanup - purely refactoring * Incorporated PR feedback - Made vCheckBuffersAndQueue() static - Added uxLowestSemCount back into prvEMACHandlerTask, now modifying global instead of shadowing * Uncrustify: triggered by comment. * Fix formatting * Uncrustify: triggered by comment. * Un-doing uncrustify commit that breaks formatting rules * formatting fix * formatting fix --------- Co-authored-by: Soren Ptak Co-authored-by: GitHub Action Co-authored-by: Rahul Kar --- .../DriverSAM/NetworkInterface.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/portable/NetworkInterface/DriverSAM/NetworkInterface.c b/source/portable/NetworkInterface/DriverSAM/NetworkInterface.c index a2b19d734..7ad92f940 100644 --- a/source/portable/NetworkInterface/DriverSAM/NetworkInterface.c +++ b/source/portable/NetworkInterface/DriverSAM/NetworkInterface.c @@ -204,14 +204,17 @@ static void hand_tx_errors( void ); static uint16_t prvGenerateCRC16( const uint8_t * pucAddress ); static void prvAddMulticastMACAddress( const uint8_t * ucMacAddress ); +/* Checks IP queue, buffers, and semaphore and logs diagnostic info if configured */ +static void vCheckBuffersAndQueue( void ); + +/* return 'puc_buffer' to the pool of transmission buffers. */ +void returnTxBuffer( uint8_t * puc_buffer ); + /*-----------------------------------------------------------*/ /* A copy of PHY register 1: 'PHY_REG_01_BMSR' */ static BaseType_t xGMACSwitchRequired; -/* LLMNR multicast address. */ -static const uint8_t llmnr_mac_address[] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0xFC }; - /* The GMAC object as defined by the ASF drivers. */ static gmac_device_t gs_gmac_dev; @@ -454,8 +457,6 @@ static BaseType_t xPHY_Write( BaseType_t xAddress, static BaseType_t prvSAM_NetworkInterfaceInitialise( NetworkInterface_t * pxInterface ) { - const TickType_t x5_Seconds = 5000UL; - if( xEMACTaskHandle == NULL ) { prvGMACInit( pxInterface ); @@ -673,9 +674,7 @@ static BaseType_t prvSAM_NetworkInterfaceOutput( NetworkInterface_t * pxInterfac static BaseType_t prvGMACInit( NetworkInterface_t * pxInterface ) { - uint32_t ncfgr; NetworkEndPoint_t * pxEndPoint; - BaseType_t xEntry = 1; gmac_options_t gmac_option; @@ -1065,7 +1064,7 @@ volatile UBaseType_t uxLastMinBufferCount = 0; volatile UBaseType_t uxCurrentSemCount; volatile UBaseType_t uxLowestSemCount; -void vCheckBuffersAndQueue( void ) +static void vCheckBuffersAndQueue( void ) { static UBaseType_t uxCurrentCount; @@ -1126,14 +1125,14 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB static void prvEMACHandlerTask( void * pvParameters ) { UBaseType_t uxCount; - UBaseType_t uxLowestSemCount = GMAC_TX_BUFFERS + 1; + + uxLowestSemCount = GMAC_TX_BUFFERS + 1; #if ( ipconfigZERO_COPY_TX_DRIVER != 0 ) NetworkBufferDescriptor_t * pxBuffer; #endif uint8_t * pucBuffer; BaseType_t xResult = 0; - uint32_t xStatus; const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( EMAC_MAX_BLOCK_TIME_MS ); uint32_t ulISREvents = 0U;