From 750899d309eda8ddfcff6d4da683807827ef6cce Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri, 17 Feb 2023 12:17:22 -0800 Subject: [PATCH 1/5] Update PR template to include checkbox for ut change --- .github/pull_request_template.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c3c8607fbd..a39aa2bfa3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,6 +8,13 @@ Test Steps ----------- +Checklist: +---------- + + +- [ ] I have tested my changes. No regression in existing tests. +- [ ] I have modified and/or added unit-tests to cover the code changes in this Pull Request. + Related Issue ----------- From d1695e1e1735a256725938846790606b5a8a4bc3 Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 9 Mar 2023 17:44:17 -0800 Subject: [PATCH 2/5] Empty-Commit to trigger workflow --- .github/workflows/ci.yml | 15 + source/include/FreeRTOS_IP.h | 28 +- .../NXP1060/NetworkInterface.c | 810 ++++++++++++++++++ .../NetworkInterface/RX/NetworkInterface.c | 15 +- test/CMakeLists.txt | 1 - test/cbmc/proofs/lib/print_tool_versions.py | 74 ++ test/cbmc/proofs/lib/summarize.py | 143 ++++ test/cbmc/proofs/run-cbmc-proofs.py | 8 +- test/unit-test/CMakeLists.txt | 14 +- 9 files changed, 1089 insertions(+), 19 deletions(-) create mode 100644 source/portable/NetworkInterface/NXP1060/NetworkInterface.c create mode 100755 test/cbmc/proofs/lib/print_tool_versions.py create mode 100644 test/cbmc/proofs/lib/summarize.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fe0b79fdd..d755e4fcd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,3 +178,18 @@ jobs: run: | git-secrets --register-aws git-secrets --scan + proof_ci: + runs-on: cbmc_ubuntu-latest_16-core + steps: + - name: Set up CBMC runner + uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main + with: + cbmc_version: "5.61.0" + - run: | + git submodule update --init --checkout --recursive + sudo apt-get update + sudo apt-get install --yes --no-install-recommends gcc-multilib + - name: Run CBMC + uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main + with: + proofs_dir: test/cbmc/proofs diff --git a/source/include/FreeRTOS_IP.h b/source/include/FreeRTOS_IP.h index d8cdf2be1e..5114ac8f1d 100644 --- a/source/include/FreeRTOS_IP.h +++ b/source/include/FreeRTOS_IP.h @@ -276,14 +276,28 @@ uint32_t FreeRTOS_round_down( uint32_t a, #define pdMS_TO_MIN_TICKS( xTimeInMs ) ipMS_TO_MIN_TICKS( xTimeInMs ) #ifndef pdTRUE_SIGNED - /* Temporary solution: eventually the defines below will appear in 'Source\include\projdefs.h' */ - #define pdTRUE_SIGNED pdTRUE - #define pdFALSE_SIGNED pdFALSE - #define pdTRUE_UNSIGNED ( 1U ) + #define pdTRUE_SIGNED pdTRUE +#endif /* pdTRUE_SIGNED */ + +#ifndef pdFALSE_SIGNED + #define pdFALSE_SIGNED pdFALSE +#endif /* pdFALSE_SIGNED */ + +#ifndef pdTRUE_UNSIGNED + #define pdTRUE_UNSIGNED ( 1U ) +#endif /* pdTRUE_UNSIGNED */ + +#ifndef pdFALSE_UNSIGNED #define pdFALSE_UNSIGNED ( 0U ) - #define ipTRUE_BOOL ( 1 == 1 ) - #define ipFALSE_BOOL ( 1 == 2 ) -#endif +#endif /* pdFALSE_UNSIGNED */ + +#ifndef ipTRUE_BOOL + #define ipTRUE_BOOL ( 1 == 1 ) +#endif /* ipTRUE_BOOL */ + +#ifndef ipFALSE_BOOL + #define ipFALSE_BOOL ( 1 == 2 ) +#endif /* ipFALSE_BOOL */ /* * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE diff --git a/source/portable/NetworkInterface/NXP1060/NetworkInterface.c b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c new file mode 100644 index 0000000000..0c0d20bd97 --- /dev/null +++ b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c @@ -0,0 +1,810 @@ +/* + * FreeRTOS+TCP + * Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + */ + +/** + * @file NetworkInterface.c + * @brief Implements the Network Interface driver for the NXP MIMXRT1060 board. + */ +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" +#include "semphr.h" + +#include "fsl_device_registers.h" +#include "fsl_debug_console.h" +#include "board.h" + +#include "fsl_phy.h" + +#include "fsl_phyksz8081.h" +#include "fsl_enet_mdio.h" +#include "fsl_enet.h" + +#include "NetworkInterface.h" + +#if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES != 1 + #define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eProcessBuffer +#else + #define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eConsiderFrameForProcessing( ( pucEthernetBuffer ) ) +#endif + +/* MDIO operations. */ +#define EXAMPLE_MDIO_OPS enet_ops + +/* PHY operations. */ +#define EXAMPLE_PHY_OPS phyksz8081_ops + +/* ENET clock frequency. */ +#define EXAMPLE_CLOCK_FREQ CLOCK_GetFreq( kCLOCK_IpgClk ) + +/* + * Padding of ethernet frames has to be disabled for zero-copy functionality + * since ENET driver requires the starting buffer addresses to be aligned. + */ +#if ETH_PAD_SIZE != 0 + #error "ETH_PAD_SIZE != 0" +#endif /* ETH_PAD_SIZE != 0 */ + +/******************************************************************************* + * Definitions + ******************************************************************************/ +#define ENET_RING_NUM ( 1 ) + +/* The length or RX buffer. */ +#ifndef ENET_RXBUFF_SIZE + #define ENET_RXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) +#endif + +/* ENET IRQ priority. Used in FreeRTOS. */ +/* Interrupt priorities. */ +#ifdef __CA7_REV + #ifndef ENET_PRIORITY + #define ENET_PRIORITY ( 21U ) + #endif + #ifndef ENET_1588_PRIORITY + #define ENET_1588_PRIORITY ( 20U ) + #endif +#else + #ifndef ENET_PRIORITY + #define ENET_PRIORITY ( 6U ) + #endif + #ifndef ENET_1588_PRIORITY + #define ENET_1588_PRIORITY ( 5U ) + #endif +#endif /* ifdef __CA7_REV */ + +/* The number of ENET buffers needed to receive frame of maximum length. */ +#define MAX_BUFFERS_PER_FRAME \ + ( ( ENET_FRAME_MAX_FRAMELEN / ENET_RXBUFF_SIZE ) + ( ( ENET_FRAME_MAX_FRAMELEN % ENET_RXBUFF_SIZE == 0 ) ? 0 : 1 ) ) + +/* The length or TX buffer. */ +#ifndef ENET_TXBUFF_SIZE + #define ENET_TXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) +#endif + +/* The number of buffer descriptors in ENET RX ring. */ +#ifndef ENET_RXBD_NUM + #define ENET_RXBD_NUM ( 5 ) +#endif + +/* Ring should be able to receive at least 1 frame with maximum length. */ +#if ENET_RXBD_NUM < MAX_BUFFERS_PER_FRAME + #error "ENET_RXBD_NUM < MAX_BUFFERS_PER_FRAME" +#endif + +/* The number of RX buffers. ENET_RXBD_NUM is always held by ENET driver. */ +#ifndef ENET_RXBUFF_NUM + #define ENET_RXBUFF_NUM ( ENET_RXBD_NUM * 2 ) +#endif + +/* At least ENET_RXBD_NUM number of buffers is always held by ENET driver + * for RX. */ +#if ENET_RXBUFF_NUM < ( ENET_RXBD_NUM + MAX_BUFFERS_PER_FRAME ) + #error "ENET_RXBUFF_NUM < (ENET_RXBD_NUM + MAX_BUFFERS_PER_FRAME)" +#endif + +/* The number of buffer descriptors in ENET TX ring. */ +#ifndef ENET_TXBD_NUM + #define ENET_TXBD_NUM ( 3 ) +#endif + +/* Set the timeout values such that the total timeout adds up to 4000ms. */ +#define MAX_AUTONEG_FAILURE_COUNT ( 40 ) +#define SINGLE_ITERATION_TIMEOUT ( 100 ) + +#if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL + #if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && \ + ( ( !defined( FSL_SDK_DISBLE_L2CACHE_PRESENT ) ) || ( FSL_SDK_DISBLE_L2CACHE_PRESENT == 0 ) ) + #if defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) + #define FSL_CACHE_LINESIZE_MAX MAX( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) + #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_CACHE_LINESIZE_MAX ) + #else + #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) + #endif + #elif defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) + #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) + #else + #define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT + #endif /* if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && ( ( !defined( FSL_SDK_DISBLE_L2CACHE_PRESENT ) ) || ( FSL_SDK_DISBLE_L2CACHE_PRESENT == 0 ) ) */ +#else /* if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ + #define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT +#endif /* if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ + +/* A bigger value is chosen so that the previous notification values are + * not interfering with the driver ready notifications. */ +#define DRIVER_READY ( 0x40 ) +#define DRIVER_FATAL ( DRIVER_READY << 1 ) + +#if defined( ENET_ENHANCEDBUFFERDESCRIPTOR_MODE ) + #error "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE is not supported by this driver" +#endif + +typedef uint8_t rx_buffer_t[ SDK_SIZEALIGN( ENET_RXBUFF_SIZE, FSL_ENET_BUFF_ALIGNMENT ) ]; +typedef uint8_t tx_buffer_t[ SDK_SIZEALIGN( ENET_TXBUFF_SIZE, FSL_ENET_BUFF_ALIGNMENT ) ]; + +/** + * @brief Used to wrap received data a buffer to be passed into the stack. + */ +typedef struct rx_pbuf_wrapper +{ + void * buffer; /*!< Original buffer wrapped. */ + volatile bool buffer_used; /*!< Wrapped buffer is used by ENET or FreeRTOS+TCP. */ +} rx_pbuf_wrapper_t; + +/** + * Helper structure to hold private data used to operate your Ethernet interface. + */ +struct ethernetif +{ + ENET_Type * base; + enet_handle_t handle; + enet_rx_bd_struct_t * RxBuffDescrip; + enet_tx_bd_struct_t * TxBuffDescrip; + rx_buffer_t * RxDataBuff; + tx_buffer_t * TxDataBuff; + rx_pbuf_wrapper_t RxPbufs[ ENET_RXBUFF_NUM ]; +}; + +typedef enum xEMAC_STATE +{ + xEMAC_SetupPHY, + xEMAC_WaitPHY, + xEMAC_Init, + xEMAC_Ready, +} EMACState_t; + +static EMACState_t eEMACState = xEMAC_SetupPHY; + +static mdio_handle_t mdioHandle = { .ops = &EXAMPLE_MDIO_OPS }; + +static phy_handle_t phyHandle = { .phyAddr = 0x00, .mdioHandle = &mdioHandle, .ops = &EXAMPLE_PHY_OPS }; + +/** + * The task-handle for deferred interrupt handler task that processes + * incoming packets. + */ +static TaskHandle_t receiveTaskHandle = NULL; + +static struct ethernetif EthernetInterface1; +static struct ethernetif * ethernetifLocal = &EthernetInterface1; + +static bool bGlobalLinkStatus = false; + +/*-----------------------------------------------------------*/ + +AT_NONCACHEABLE_SECTION_ALIGN( static enet_rx_bd_struct_t rxBuffDescrip_0[ ENET_RXBD_NUM ], FSL_ENET_BUFF_ALIGNMENT ); +AT_NONCACHEABLE_SECTION_ALIGN( static enet_tx_bd_struct_t txBuffDescrip_0[ ENET_TXBD_NUM ], FSL_ENET_BUFF_ALIGNMENT ); +SDK_ALIGN( static rx_buffer_t rxDataBuff_0[ ENET_RXBUFF_NUM ], FSL_ENET_BUFF_ALIGNMENT ); +SDK_ALIGN( static tx_buffer_t txDataBuff_0[ ENET_TXBD_NUM ], FSL_ENET_BUFF_ALIGNMENT ); + +/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ +/*------------ PHY configuration parameters. ----------------*/ +static phy_config_t xConfig = +{ + .autoNeg = pdTRUE, /* Allow auto-negotiation. */ + .duplex = kPHY_FullDuplex, /* Use full duplex mode. In case + * auto-negotiation is turned on, + * this is not used. */ + .phyAddr = BOARD_ENET0_PHY_ADDRESS, /* The PHY address. */ + .speed = kPHY_Speed100M, /* Use 100 Mbps configuration (maximum possible + * for this PHY). In case auto-negotiation is + * turned on, this is not used. */ + .enableEEE = pdFALSE +}; /* Disable the energy efficient PHY. */ +/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ + +static void prvEMACHandlerTask( void * pvParameters ); + +static void ethernet_callback( ENET_Type * base, + enet_handle_t * handle, + enet_event_t event, + enet_frame_info_t * frameInfo, + void * userData ); + +static void prvProcessFrame( int length ); + +static status_t xSetupPHY( phy_config_t * pxConfig ); + +static status_t xWaitPHY( phy_config_t xConfig ); + +static status_t xEMACInit( phy_speed_t speed, + phy_duplex_t duplex ); + +BaseType_t xNetworkInterfaceInitialise( void ) +{ + status_t xStatus; + BaseType_t xResult = pdFAIL; + phy_speed_t speed; + phy_duplex_t duplex; + BaseType_t xTaskCreated; + static BaseType_t xFirstCall = pdTRUE; + + configASSERT( FSL_FEATURE_ENET_QUEUE == 1 ); + + switch( eEMACState ) + { + case xEMAC_SetupPHY: + xStatus = xSetupPHY( &xConfig ); + + if( xStatus != kStatus_Success ) + { + break; + } + else + { + eEMACState = xEMAC_WaitPHY; + } + + /* Fall through. */ + case xEMAC_WaitPHY: + FreeRTOS_printf( ( "Configuration successful. Waiting for link to go up" + " and auto-negotiation to complete." ) ); + + xStatus = xWaitPHY( xConfig ); + + if( xStatus == kStatus_Success ) + { + xStatus = PHY_GetLinkSpeedDuplex( &phyHandle, &speed, &duplex ); + } + + if( xStatus != kStatus_Success ) + { + break; + } + else + { + eEMACState = xEMAC_Init; + } + + /* Fall through. */ + case xEMAC_Init: + xStatus = xEMACInit( speed, duplex ); + + if( ( xFirstCall == pdTRUE ) || ( receiveTaskHandle == NULL ) ) + { + if( xStatus == kStatus_Success ) + { + /* The link is now up. */ + bGlobalLinkStatus = true; + + /* The handler task is created at the highest possible priority to + * ensure the interrupt handler can return directly to it. */ + xTaskCreated = xTaskCreate( prvEMACHandlerTask, + "EMAC-Handler", + configMINIMAL_STACK_SIZE * 3, + NULL, + configMAX_PRIORITIES - 1, + &receiveTaskHandle ); + + if( ( receiveTaskHandle == NULL ) || ( xTaskCreated != pdPASS ) ) + { + FreeRTOS_printf( ( "Failed to create the handler task." ) ); + break; + } + + /* Enable the interrupt and set its priority to the minimum + * interrupt priority. */ + NVIC_SetPriority( ENET_IRQn, ENET_PRIORITY ); + NVIC_EnableIRQ( ENET_IRQn ); + + eEMACState = xEMAC_Ready; + + /* After this, the task should not be created. */ + xFirstCall = pdFALSE; + } + else + { + break; + } + } + else + { + eEMACState = xEMAC_Ready; + } + + /* Fall through. */ + case xEMAC_Ready: + FreeRTOS_printf( ( "Driver ready for use." ) ); + + /* Kick the task once the driver is ready. */ + if( receiveTaskHandle != NULL ) + { + xTaskNotify( receiveTaskHandle, DRIVER_READY, eSetValueWithOverwrite ); + } + + xResult = pdPASS; + + break; + } + + return xResult; +} + +BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, + BaseType_t xReleaseAfterSend ) +{ + status_t result; + BaseType_t xReturn = pdFAIL; + + if( bGlobalLinkStatus == true ) + { + /* ENET_SendFrame copies the data before sending it. Therefore, the network buffer can + * be released without worrying about the buffer memory being used by the ENET_SendFrame + * function. */ + result = ENET_SendFrame( ethernetifLocal->base, + ðernetifLocal->handle, + pxNetworkBuffer->pucEthernetBuffer, + pxNetworkBuffer->xDataLength, + 0, + false, + NULL ); + + switch( result ) + { + case kStatus_ENET_TxFrameBusy: + FreeRTOS_printf( ( "Failed to send the frame - driver busy!" ) ); + break; + + case kStatus_Success: + iptraceNETWORK_INTERFACE_TRANSMIT(); + xReturn = pdPASS; + break; + } + } + + if( xReleaseAfterSend == pdTRUE ) + { + vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer ); + } + + return xReturn; +} + +static void prvEMACHandlerTask( void * parameter ) +{ + bool LinkUp = false; + status_t readStatus; + + /* Wait for the driver to finish starting. */ + ( void ) ulTaskNotifyTake( pdTRUE, portMAX_DELAY ); + + while( pdTRUE ) + { + if( ulTaskNotifyTake( pdTRUE, pdMS_TO_TICKS( 500 ) ) == pdFALSE ) + { + /* No RX packets for a bit so check for a link. */ + const IPStackEvent_t xNetworkEventDown = { .eEventType = eNetworkDownEvent, .pvData = NULL }; + + do + { + readStatus = PHY_GetLinkStatus( &phyHandle, &LinkUp ); + + if( readStatus == kStatus_Success ) + { + if( LinkUp == pdFALSE ) + { + /* The link is down. */ + bGlobalLinkStatus = false; + /* We need to setup the PHY again. */ + eEMACState = xEMAC_WaitPHY; + + FreeRTOS_printf( ( "Link down!" ) ); + + xSendEventStructToIPTask( &xNetworkEventDown, 0U ); + + /* Wait for the driver to finish initialization. */ + uint32_t ulNotificationValue; + + do + { + ulNotificationValue = ulTaskNotifyTake( pdTRUE, portMAX_DELAY ); + } while( !( ulNotificationValue & DRIVER_READY ) ); + } + else + { + /* The link is still up. */ + bGlobalLinkStatus = true; + } + } + } while( bGlobalLinkStatus == false ); + } + else + { + BaseType_t receiving = pdTRUE; + + /* A packet was received, the link must be up. */ + bGlobalLinkStatus = true; + + while( receiving == pdTRUE ) + { + uint32_t length; + const status_t status = ENET_GetRxFrameSize( &( ethernetifLocal->handle ), &length, 0 ); + + switch( status ) + { + case kStatus_Success: /* there is a frame. process it */ + + if( length ) + { + prvProcessFrame( length ); + } + + break; + + case kStatus_ENET_RxFrameEmpty: /* Received an empty frame. Ignore it */ + receiving = pdFALSE; + break; + + case kStatus_ENET_RxFrameError: /* Received an error frame. Read & drop it */ + PRINTF( "RX Receive Error\n" ); + ENET_ReadFrame( ethernetifLocal->base, &( ethernetifLocal->handle ), NULL, 0, 0, NULL ); + /* Not sure if a trace is required. The MAC had an error and needed to dump bytes */ + break; + + default: + PRINTF( "RX Receive default" ); + break; + } + } + } + } +} + +/** + * @brief Callback for ENET interrupts. We have only enabled the Ethernet receive interrupts + * in the case of this driver. + */ +static void ethernet_callback( ENET_Type * base, + enet_handle_t * handle, + enet_event_t event, + enet_frame_info_t * frameInfo, + void * userData ) +{ + BaseType_t needsToYield = pdFALSE; + + ( void ) base; + ( void ) handle; + ( void ) frameInfo; + ( void ) userData; + + switch( event ) + { + case kENET_RxEvent: + vTaskNotifyGiveFromISR( receiveTaskHandle, &needsToYield ); + portEND_SWITCHING_ISR( needsToYield ); + break; + + default: + FreeRTOS_printf( ( "Unknown interrupt callback %u!", event ) ); + break; + } +} + +/** + * @brief This function verifies that the incoming frame needs processing. + * If the frame is deemed to be appropriate, then the frame is sent to the + * TCP stack for further processing. + * @param[in] length: The length of the incoming frame. This length should be read + * using a call to ENET_GetRxFrameSize. + */ +static void prvProcessFrame( int length ) +{ + NetworkBufferDescriptor_t * pxBufferDescriptor = pxGetNetworkBufferWithDescriptor( length, 0 ); + + if( pxBufferDescriptor != NULL ) + { + ENET_ReadFrame( ethernetifLocal->base, &( ethernetifLocal->handle ), pxBufferDescriptor->pucEthernetBuffer, length, 0, NULL ); + pxBufferDescriptor->xDataLength = length; + + if( ipCONSIDER_FRAME_FOR_PROCESSING( pxBufferDescriptor->pucEthernetBuffer ) == eProcessBuffer ) + { + IPStackEvent_t xRxEvent; + xRxEvent.eEventType = eNetworkRxEvent; + xRxEvent.pvData = ( void * ) pxBufferDescriptor; + + if( xSendEventStructToIPTask( &xRxEvent, 0 ) == pdFALSE ) + { + vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor ); + iptraceETHERNET_RX_EVENT_LOST(); + FreeRTOS_printf( ( "RX Event Lost\n" ) ); + } + } + else + { + #if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) + const EthernetHeader_t * pxEthernetHeader; + char ucSource[ 18 ]; + char ucDestination[ 18 ]; + + pxEthernetHeader = ( ( const EthernetHeader_t * ) pxBufferDescriptor->pucEthernetBuffer ); + + + FreeRTOS_EUI48_ntop( pxEthernetHeader->xSourceAddress.ucBytes, ucSource, 'A', ':' ); + FreeRTOS_EUI48_ntop( pxEthernetHeader->xDestinationAddress.ucBytes, ucDestination, 'A', ':' ); + + FreeRTOS_debug_printf( ( "Invalid target MAC: dropping frame from: %s to: %s", ucSource, ucDestination ) ); + #endif /* if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) */ + vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor ); + /* Not sure if a trace is required. The stack did not want this message */ + } + } + else + { + #if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) + FreeRTOS_debug_printf( ( "No Buffer Available: dropping incoming frame!!" ) ); + #endif + ENET_ReadFrame( ENET, &( ethernetifLocal->handle ), NULL, length, 0, NULL ); + + /* No buffer available to receive this message */ + iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER(); + } +} + + +/** + * @brief This function is used to setup the PHY in auto-negotiation mode. + * + * @param[out] pxConfig: the configuration parameters. + * + * @return kStatus_Success if the PHY was initialized; error code otherwise. + */ +static status_t xSetupPHY( phy_config_t * pxConfig ) +{ + status_t xStatus; + + /* Set the clock frequency. MDIO handle is pointed to by the PHY handle. */ + mdioHandle.resource.csrClock_Hz = EXAMPLE_CLOCK_FREQ; + mdioHandle.resource.base = ( void * ) ENET_BASE; + + FreeRTOS_printf( ( "Starting PHY initialization." ) ); + + xStatus = PHY_Init( &phyHandle, pxConfig ); + + if( xStatus != kStatus_Success ) + { + FreeRTOS_printf( ( "Failed to initialize the PHY." ) ); + } + + return xStatus; +} + +/** + * @brief This function is used wait on the auto-negotiation completion. + * + * @param[in] xConfig: the configuration parameters. + * + * @return kStatus_Success if the PHY was initialized; error code otherwise. + */ +static status_t xWaitPHY( phy_config_t xConfig ) +{ + status_t xStatus; + bool LinkUp; + bool autoNegotiationComplete; + uint8_t ucCounter = 0; + + do + { + xStatus = PHY_GetLinkStatus( &phyHandle, &LinkUp ); + + if( LinkUp == true ) + { + break; + } + + /* Try for only a limited number of times. */ + if( ucCounter++ > MAX_AUTONEG_FAILURE_COUNT ) + { + break; + } + + vTaskDelay( pdMS_TO_TICKS( SINGLE_ITERATION_TIMEOUT ) ); + } + while( xStatus == kStatus_Success ); + + if( LinkUp == false ) + { + FreeRTOS_printf( ( "Failed to get the link up." ) ); + xStatus = kStatus_Fail; + } + else + { + FreeRTOS_printf( ( "Link up." ) ); + } + + if( ( xStatus == kStatus_Success ) && + ( LinkUp == true ) && + ( xConfig.autoNeg == true ) ) + { + /* Reset the counter for next use. */ + ucCounter = 0; + + FreeRTOS_printf( ( "Waiting for auto-negotiation to complete." ) ); + + do + { + xStatus = PHY_GetAutoNegotiationStatus( &phyHandle, &autoNegotiationComplete ); + + if( autoNegotiationComplete == true ) + { + break; + } + + /* Try for only a limited number of times. */ + if( ucCounter++ > MAX_AUTONEG_FAILURE_COUNT ) + { + break; + } + + vTaskDelay( pdMS_TO_TICKS( SINGLE_ITERATION_TIMEOUT ) ); + } + while( xStatus == kStatus_Success ); + + if( autoNegotiationComplete == false ) + { + FreeRTOS_printf( ( "Failed to complete auto-negotiation." ) ); + xStatus = kStatus_Fail; + } + else + { + /* Success in auto-negotiation and the link is up. */ + FreeRTOS_printf( ( "Auto-negotiation complete." ) ); + } + } + + return xStatus; +} + +/** + * @brief This function is used to initialize the ENET module. It initializes the network buffers + * and buffer descriptors. + * + * @param[in] speed: The speed of communication (either set by auto-negotiation or the default + * value). + * @param[in] duplex: The nature of the channel. This must be set to kPHY_FullDuplex by + * auto-negotiation. + * + * @return kStatus_Success if the ENET module was initialized; error code otherwise. + */ +static status_t xEMACInit( phy_speed_t speed, + phy_duplex_t duplex ) +{ + enet_config_t config; + uint32_t sysClock; + enet_buffer_config_t buffCfg[ ENET_RING_NUM ]; + status_t xStatus; + uint32_t instance; + static ENET_Type * const enetBases[] = ENET_BASE_PTRS; + static const IRQn_Type enetTxIrqId[] = ENET_Transmit_IRQS; + /*! @brief Pointers to enet receive IRQ number for each instance. */ + static const IRQn_Type enetRxIrqId[] = ENET_Receive_IRQS; + int i; + + ethernetifLocal->RxBuffDescrip = &( rxBuffDescrip_0[ 0 ] ); + ethernetifLocal->TxBuffDescrip = &( txBuffDescrip_0[ 0 ] ); + ethernetifLocal->RxDataBuff = &( rxDataBuff_0[ 0 ] ); + ethernetifLocal->TxDataBuff = &( txDataBuff_0[ 0 ] ); + ethernetifLocal->base = ( void * ) ENET_BASE; + + /* prepare the buffer configuration. */ + buffCfg[ 0 ].rxBdNumber = ENET_RXBD_NUM; /* Number of RX buffer descriptors. */ + buffCfg[ 0 ].txBdNumber = ENET_TXBD_NUM; /* Transmit buffer descriptor number. */ + buffCfg[ 0 ].rxBuffSizeAlign = sizeof( rx_buffer_t ); /* Aligned receive data buffer size. */ + buffCfg[ 0 ].txBuffSizeAlign = sizeof( tx_buffer_t ); /* Aligned transmit data buffer size. */ + buffCfg[ 0 ].rxBdStartAddrAlign = + &( rxBuffDescrip_0[ 0 ] ); /* Aligned receive buffer descriptor start address. */ + buffCfg[ 0 ].txBdStartAddrAlign = + &( txBuffDescrip_0[ 0 ] ); /* Aligned transmit buffer descriptor start address. */ + buffCfg[ 0 ].rxBufferAlign = + &( rxDataBuff_0[ 0 ][ 0 ] ); /* Receive data buffer start address. */ + buffCfg[ 0 ].txBufferAlign = &( txDataBuff_0[ 0 ][ 0 ] ); /* Transmit data buffer start address. */ + buffCfg[ 0 ].txFrameInfo = NULL; /* Transmit frame information start address. Set only if using zero-copy transmit. */ + buffCfg[ 0 ].rxMaintainEnable = true; /* Receive buffer cache maintain. */ + buffCfg[ 0 ].txMaintainEnable = true; /* Transmit buffer cache maintain. */ + + sysClock = phyHandle.mdioHandle->resource.csrClock_Hz; + + ENET_GetDefaultConfig( &config ); + + config.ringNum = ENET_RING_NUM; + config.rxBuffAlloc = NULL; + config.rxBuffFree = NULL; + config.userData = ethernetifLocal; + config.miiSpeed = ( enet_mii_speed_t ) speed; + config.miiDuplex = ( enet_mii_duplex_t ) duplex; + + /* Only get interrupt for incoming messages. */ + config.interrupt = kENET_RxFrameInterrupt; + config.callback = ethernet_callback; + + for( instance = 0; instance < ARRAY_SIZE( enetBases ); instance++ ) + { + if( enetBases[ instance ] == ethernetifLocal->base ) + { + NVIC_SetPriority( enetRxIrqId[ instance ], ENET_PRIORITY ); + NVIC_SetPriority( enetTxIrqId[ instance ], ENET_PRIORITY ); + break; + } + } + + configASSERT( instance != ARRAY_SIZE( enetBases ) ); + + if( instance == ARRAY_SIZE( enetBases ) ) + { + xStatus = kStatus_Fail; + } + else + { + for( i = 0; i < ENET_RXBUFF_NUM; i++ ) + { + ethernetifLocal->RxPbufs[ i ].buffer = &( ethernetifLocal->RxDataBuff[ i ][ 0 ] ); + ethernetifLocal->RxPbufs[ i ].buffer_used = false; + } + + /* Initialize the ENET module. */ + xStatus = ENET_Init( ethernetifLocal->base, + ðernetifLocal->handle, + &config, + &buffCfg[ 0 ], + ipLOCAL_MAC_ADDRESS, + sysClock ); + + if( xStatus == kStatus_Success ) + { + FreeRTOS_printf( ( "ENET initialized." ) ); + ENET_ActiveRead( ethernetifLocal->base ); + } + else + { + FreeRTOS_printf( ( "Failed to initialize ENET." ) ); + } + } + + return xStatus; +} diff --git a/source/portable/NetworkInterface/RX/NetworkInterface.c b/source/portable/NetworkInterface/RX/NetworkInterface.c index 204588abdb..6b131930e5 100644 --- a/source/portable/NetworkInterface/RX/NetworkInterface.c +++ b/source/portable/NetworkInterface/RX/NetworkInterface.c @@ -422,15 +422,12 @@ static int InitializeNetwork( void ) ether_return_t eth_ret; BaseType_t return_code = pdFALSE; ether_param_t param; - uint8_t myethaddr[ 6 ] = - { - configMAC_ADDR0, - configMAC_ADDR1, - configMAC_ADDR2, - configMAC_ADDR3, - configMAC_ADDR4, - configMAC_ADDR5 - }; /*XXX Fix me */ + + /* Read the mac address after it has been initilized by the FreeRTOS IP Stack, rather than from defines + * as the mac address is usually read from the EEPROM, and it might be different to the mac address in + * the defines, especially in production environments + */ + const uint8_t * myethaddr = FreeRTOS_GetMACAddress(); R_ETHER_PinSet_CHANNEL_0(); R_ETHER_Initial(); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 97d4459107..fb71ba3463 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,6 @@ add_subdirectory(build-combination) if(FREERTOS_PLUS_TCP_BUILD_TEST) - add_subdirectory(cbmc) add_subdirectory(Coverity) add_subdirectory(unit-test) endif() diff --git a/test/cbmc/proofs/lib/print_tool_versions.py b/test/cbmc/proofs/lib/print_tool_versions.py new file mode 100755 index 0000000000..bdeb429e3d --- /dev/null +++ b/test/cbmc/proofs/lib/print_tool_versions.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT-0 + + +import logging +import pathlib +import shutil +import subprocess + + +_TOOLS = [ + "cadical", + "cbmc", + "cbmc-viewer", + "cbmc-starter-kit-update", + "kissat", + "litani", +] + + +def _format_versions(table): + lines = [ + "", + '', + ] + for tool, version in table.items(): + if version: + v_str = f'
{version}
' + else: + v_str = 'not found' + lines.append( + f'' + f'') + lines.append("
Tool Versions
{tool}:{v_str}
") + return "\n".join(lines) + + +def _get_tool_versions(): + ret = {} + for tool in _TOOLS: + err = f"Could not determine version of {tool}: " + ret[tool] = None + if not shutil.which(tool): + logging.error("%s'%s' not found on $PATH", err, tool) + continue + cmd = [tool, "--version"] + proc = subprocess.Popen(cmd, text=True, stdout=subprocess.PIPE) + try: + out, _ = proc.communicate(timeout=10) + except subprocess.TimeoutExpired: + logging.error("%s'%s --version' timed out", err, tool) + continue + if proc.returncode: + logging.error( + "%s'%s --version' returned %s", err, tool, str(proc.returncode)) + continue + ret[tool] = out.strip() + return ret + + +def main(): + exe_name = pathlib.Path(__file__).name + logging.basicConfig(format=f"{exe_name}: %(message)s") + + table = _get_tool_versions() + out = _format_versions(table) + print(out) + + +if __name__ == "__main__": + main() diff --git a/test/cbmc/proofs/lib/summarize.py b/test/cbmc/proofs/lib/summarize.py new file mode 100644 index 0000000000..50dbcc33ce --- /dev/null +++ b/test/cbmc/proofs/lib/summarize.py @@ -0,0 +1,143 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT-0 + +import argparse +import json +import logging +import os +import sys + + +DESCRIPTION = """Print 2 tables in GitHub-flavored Markdown that summarize +an execution of CBMC proofs.""" + + +def get_args(): + """Parse arguments for summarize script.""" + parser = argparse.ArgumentParser(description=DESCRIPTION) + for arg in [{ + "flags": ["--run-file"], + "help": "path to the Litani run.json file", + "required": True, + }]: + flags = arg.pop("flags") + parser.add_argument(*flags, **arg) + return parser.parse_args() + + +def _get_max_length_per_column_list(data): + ret = [len(item) + 1 for item in data[0]] + for row in data[1:]: + for idx, item in enumerate(row): + ret[idx] = max(ret[idx], len(item) + 1) + return ret + + +def _get_table_header_separator(max_length_per_column_list): + line_sep = "" + for max_length_of_word_in_col in max_length_per_column_list: + line_sep += "|" + "-" * (max_length_of_word_in_col + 1) + line_sep += "|\n" + return line_sep + + +def _get_entries(max_length_per_column_list, row_data): + entries = [] + for row in row_data: + entry = "" + for idx, word in enumerate(row): + max_length_of_word_in_col = max_length_per_column_list[idx] + space_formatted_word = (max_length_of_word_in_col - len(word)) * " " + entry += "| " + word + space_formatted_word + entry += "|\n" + entries.append(entry) + return entries + + +def _get_rendered_table(data): + table = [] + max_length_per_column_list = _get_max_length_per_column_list(data) + entries = _get_entries(max_length_per_column_list, data) + for idx, entry in enumerate(entries): + if idx == 1: + line_sep = _get_table_header_separator(max_length_per_column_list) + table.append(line_sep) + table.append(entry) + table.append("\n") + return "".join(table) + + +def _get_status_and_proof_summaries(run_dict): + """Parse a dict representing a Litani run and create lists summarizing the + proof results. + + Parameters + ---------- + run_dict + A dictionary representing a Litani run. + + + Returns + ------- + A list of 2 lists. + The first sub-list maps a status to the number of proofs with that status. + The second sub-list maps each proof to its status. + """ + count_statuses = {} + proofs = [["Proof", "Status"]] + for proof_pipeline in run_dict["pipelines"]: + status_pretty_name = proof_pipeline["status"].title().replace("_", " ") + try: + count_statuses[status_pretty_name] += 1 + except KeyError: + count_statuses[status_pretty_name] = 1 + if proof_pipeline["name"] == "print_tool_versions": + continue + proofs.append([proof_pipeline["name"], status_pretty_name]) + statuses = [["Status", "Count"]] + for status, count in count_statuses.items(): + statuses.append([status, str(count)]) + return [statuses, proofs] + + +def print_proof_results(out_file): + """ + Print 2 strings that summarize the proof results. + When printing, each string will render as a GitHub flavored Markdown table. + """ + output = "## Summary of CBMC proof results\n\n" + with open(out_file, encoding='utf-8') as run_json: + run_dict = json.load(run_json) + status_table, proof_table = _get_status_and_proof_summaries(run_dict) + for summary in (status_table, proof_table): + output += _get_rendered_table(summary) + + print(output) + sys.stdout.flush() + + github_summary_file = os.getenv("GITHUB_STEP_SUMMARY") + if github_summary_file: + with open(github_summary_file, "a") as handle: + print(output, file=handle) + handle.flush() + else: + logging.warning( + "$GITHUB_STEP_SUMMARY not set, not writing summary file") + + msg = ( + "Click the 'Summary' button to view a Markdown table " + "summarizing all proof results") + if run_dict["status"] != "success": + logging.error("Not all proofs passed.") + logging.error(msg) + sys.exit(1) + logging.info(msg) + + +if __name__ == '__main__': + args = get_args() + logging.basicConfig(format="%(levelname)s: %(message)s") + try: + print_proof_results(args.run_file) + except Exception as ex: # pylint: disable=broad-except + logging.critical("Could not print results. Exception: %s", str(ex)) diff --git a/test/cbmc/proofs/run-cbmc-proofs.py b/test/cbmc/proofs/run-cbmc-proofs.py index f92d5ea663..429d787342 100755 --- a/test/cbmc/proofs/run-cbmc-proofs.py +++ b/test/cbmc/proofs/run-cbmc-proofs.py @@ -301,7 +301,13 @@ def main(): if not args.no_standalone: run_build(args.parallel_jobs) + out_sym = pathlib.Path("/tmp")/"litani"/"runs"/"latest" + out_dir = out_sym.resolve() + + local_copy = pathlib.Path("output")/"latest" + local_copy.parent.mkdir(exist_ok=True) + local_copy.symlink_to(out_dir) + if __name__ == "__main__": main() - diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt index 18e868a61d..59c51ab2fb 100644 --- a/test/unit-test/CMakeLists.txt +++ b/test/unit-test/CMakeLists.txt @@ -113,8 +113,20 @@ foreach( file ${TCP_INCLUDES} ) execute_process( COMMAND mv ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp2.h ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp.h ) endif() + + # Use this tool to process all conditional declarations. - execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT -UpdTRUE_SIGNED -UFreeRTOS_htonl -D__COVERITY__ -DTEST -I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src + execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT + -UpdTRUE_SIGNED + -UpdFALSE_SIGNED + -UpdTRUE_UNSIGNED + -UpdFALSE_UNSIGNED + -UipTRUE_BOOL + -UipFALSE_BOOL + -UFreeRTOS_htonl + -D__COVERITY__ + -DTEST + -I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src -I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include -I ${UNIT_TEST_DIR}/ConfigFiles -I ${MODULE_ROOT_DIR}/source/include From 76945ee1781ec8250f12825b8f6e8a0f02e7792e Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:35:54 -0700 Subject: [PATCH 3/5] Fix issues pointed out in PR comments --- .../NXP1060/NetworkInterface.c | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/source/portable/NetworkInterface/NXP1060/NetworkInterface.c b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c index 0c0d20bd97..39522a4e85 100644 --- a/source/portable/NetworkInterface/NXP1060/NetworkInterface.c +++ b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c @@ -62,18 +62,10 @@ /* ENET clock frequency. */ #define EXAMPLE_CLOCK_FREQ CLOCK_GetFreq( kCLOCK_IpgClk ) -/* - * Padding of ethernet frames has to be disabled for zero-copy functionality - * since ENET driver requires the starting buffer addresses to be aligned. - */ -#if ETH_PAD_SIZE != 0 - #error "ETH_PAD_SIZE != 0" -#endif /* ETH_PAD_SIZE != 0 */ - /******************************************************************************* * Definitions ******************************************************************************/ -#define ENET_RING_NUM ( 1 ) +#define ENET_RING_NUM ( 1 ) /* The length or RX buffer. */ #ifndef ENET_RXBUFF_SIZE @@ -235,8 +227,8 @@ static phy_config_t xConfig = .speed = kPHY_Speed100M, /* Use 100 Mbps configuration (maximum possible * for this PHY). In case auto-negotiation is * turned on, this is not used. */ - .enableEEE = pdFALSE -}; /* Disable the energy efficient PHY. */ + .enableEEE = pdFALSE /* Disable the energy efficient PHY. */ +}; /*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/ @@ -409,7 +401,7 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB static void prvEMACHandlerTask( void * parameter ) { - bool LinkUp = false; + bool bLinkUp = false; status_t readStatus; /* Wait for the driver to finish starting. */ @@ -424,11 +416,11 @@ static void prvEMACHandlerTask( void * parameter ) do { - readStatus = PHY_GetLinkStatus( &phyHandle, &LinkUp ); + readStatus = PHY_GetLinkStatus( &phyHandle, &bLinkUp ); if( readStatus == kStatus_Success ) { - if( LinkUp == pdFALSE ) + if( bLinkUp == pdFALSE ) { /* The link is down. */ bGlobalLinkStatus = false; @@ -625,15 +617,15 @@ static status_t xSetupPHY( phy_config_t * pxConfig ) static status_t xWaitPHY( phy_config_t xConfig ) { status_t xStatus; - bool LinkUp; - bool autoNegotiationComplete; + bool bLinkUp; + bool bAutoNegotiationComplete; uint8_t ucCounter = 0; do { - xStatus = PHY_GetLinkStatus( &phyHandle, &LinkUp ); + xStatus = PHY_GetLinkStatus( &phyHandle, &bLinkUp ); - if( LinkUp == true ) + if( bLinkUp == true ) { break; } @@ -648,7 +640,7 @@ static status_t xWaitPHY( phy_config_t xConfig ) } while( xStatus == kStatus_Success ); - if( LinkUp == false ) + if( bLinkUp == false ) { FreeRTOS_printf( ( "Failed to get the link up." ) ); xStatus = kStatus_Fail; @@ -659,7 +651,7 @@ static status_t xWaitPHY( phy_config_t xConfig ) } if( ( xStatus == kStatus_Success ) && - ( LinkUp == true ) && + ( bLinkUp == true ) && ( xConfig.autoNeg == true ) ) { /* Reset the counter for next use. */ @@ -669,9 +661,9 @@ static status_t xWaitPHY( phy_config_t xConfig ) do { - xStatus = PHY_GetAutoNegotiationStatus( &phyHandle, &autoNegotiationComplete ); + xStatus = PHY_GetAutoNegotiationStatus( &phyHandle, &bAutoNegotiationComplete ); - if( autoNegotiationComplete == true ) + if( bAutoNegotiationComplete == true ) { break; } @@ -686,7 +678,7 @@ static status_t xWaitPHY( phy_config_t xConfig ) } while( xStatus == kStatus_Success ); - if( autoNegotiationComplete == false ) + if( bAutoNegotiationComplete == false ) { FreeRTOS_printf( ( "Failed to complete auto-negotiation." ) ); xStatus = kStatus_Fail; From 2e347063ec7c7e9fc858660e2cd2112459ef2538 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 18 Mar 2023 00:05:09 +0000 Subject: [PATCH 4/5] Uncrustify: triggered by comment. --- source/portable/NetworkInterface/NXP1060/NetworkInterface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/portable/NetworkInterface/NXP1060/NetworkInterface.c b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c index 9b78fdf801..d1739d97cd 100644 --- a/source/portable/NetworkInterface/NXP1060/NetworkInterface.c +++ b/source/portable/NetworkInterface/NXP1060/NetworkInterface.c @@ -66,7 +66,7 @@ /******************************************************************************* * Definitions ******************************************************************************/ -#define ENET_RING_NUM ( 1 ) +#define ENET_RING_NUM ( 1 ) /* The length or RX buffer. */ #ifndef ENET_RXBUFF_SIZE From 7d4094b1d26460fa0948146e2f5f2c15d99b345c Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:05:34 -0700 Subject: [PATCH 5/5] Empty-Commit to trigger workflow