Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-josi-aws committed May 13, 2024
1 parent 5804456 commit a37f0b9
Show file tree
Hide file tree
Showing 13 changed files with 1,940 additions and 1,875 deletions.
18 changes: 10 additions & 8 deletions source/FreeRTOS_DHCP.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
static void prvCloseDHCPSocket( NetworkEndPoint_t * pxEndPoint );

static int vDHCPProcessEndPoint( BaseType_t xReset,
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint );
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint );

static BaseType_t xHandleWaitingOffer( NetworkEndPoint_t * pxEndPoint,
BaseType_t xDoCheck );
Expand Down Expand Up @@ -262,7 +262,7 @@
/* The second parameter pdTRUE tells to check for a UDP message. */
int ret_val = vDHCPProcessEndPoint( pdFALSE, pdTRUE, pxIterator );

if (ret_val == -1)
if( ret_val == -1 )
{
/* Target not found, fetch the message and delete it. */
/* PAss the address of a pointer pucUDPPayload, because zero-copy is used. */
Expand Down Expand Up @@ -681,8 +681,8 @@
* make one cycle.
*/
static int vDHCPProcessEndPoint( BaseType_t xReset,
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint )
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint )
{
BaseType_t xGivingUp = pdFALSE;

Expand All @@ -698,10 +698,11 @@
{
/* When the DHCP event was generated, the DHCP client was
* in a different state. Therefore, ignore this event. */

/*
FreeRTOS_debug_printf( ( "vDHCPProcessEndPoint: wrong state: expect: %d got: %d : ignore\n",
EP_DHCPData.eExpectedState, EP_DHCPData.eDHCPState ) );
*/
* FreeRTOS_debug_printf( ( "vDHCPProcessEndPoint: wrong state: expect: %d got: %d : ignore\n",
* EP_DHCPData.eExpectedState, EP_DHCPData.eDHCPState ) );
*/
return -1;
}
else
Expand Down Expand Up @@ -841,6 +842,7 @@
prvCloseDHCPSocket( pxEndPoint );
}
}

return 0;
}
/*-----------------------------------------------------------*/
Expand Down
73 changes: 32 additions & 41 deletions source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@
* processed.
*/
#if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 )
#define STACK_TX_EVENT ( 0U )
#define STACK_RX_EVENT ( 1U )
#define STACK_TX_EVENT ( 0U )
#define STACK_RX_EVENT ( 1U )

static volatile UBaseType_t uxNextTxRx[ipconfigEVENT_QUEUES] = { STACK_TX_EVENT };
static volatile UBaseType_t uxIsEmptyQueue[ipconfigEVENT_QUEUES][ 2 ] = { { 0 } };
static volatile UBaseType_t uxCurrentBudget[ipconfigEVENT_QUEUES] = ipconfigBUDGET_MAPPING;
static volatile const UBaseType_t uxAllottedBudget[ipconfigEVENT_QUEUES] = ipconfigBUDGET_MAPPING;
static volatile UBaseType_t uxNextTxRx[ ipconfigEVENT_QUEUES ] = { STACK_TX_EVENT };
static volatile UBaseType_t uxIsEmptyQueue[ ipconfigEVENT_QUEUES ][ 2 ] = { { 0 } };
static volatile UBaseType_t uxCurrentBudget[ ipconfigEVENT_QUEUES ] = ipconfigBUDGET_MAPPING;
static volatile const UBaseType_t uxAllottedBudget[ ipconfigEVENT_QUEUES ] = ipconfigBUDGET_MAPPING;
#endif

/** @brief If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1, then the Ethernet
Expand Down Expand Up @@ -191,10 +191,11 @@ static eFrameProcessingResult_t prvProcessUDPPacket( NetworkBufferDescriptor_t *
/** @brief The queue used to pass events into the IP-task for processing. */
QueueHandle_t xNetworkEventQueue = NULL;
#if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 )
/** @brief Multi priority event queues for TX and RX, and their mapping.
*/
QueueHandle_t xNetworkTxRxEventQueues[ ipconfigEVENT_QUEUES ][ 2 ] = { { NULL } }; /**< 0 - TX Queue, 1 - RX Queue */
uint8_t xQueueMapping[ ipconfigEVENT_PRIORITIES ] = ipconfigPACKET_PRIORITY_QUEUE_MAPPING;

/** @brief Multi priority event queues for TX and RX, and their mapping.
*/
QueueHandle_t xNetworkTxRxEventQueues[ ipconfigEVENT_QUEUES ][ 2 ] = { { NULL } }; /**< 0 - TX Queue, 1 - RX Queue */
uint8_t xQueueMapping[ ipconfigEVENT_PRIORITIES ] = ipconfigPACKET_PRIORITY_QUEUE_MAPPING;
#endif

/** @brief The IP packet ID. */
Expand Down Expand Up @@ -297,7 +298,7 @@ static void prvProcessIPEventsAndTimers( void )
while( pdTRUE )
{
xQueueReceiveRet = pdFALSE;

if( uxQueueMessagesWaiting( xNetworkTxRxEventQueues[ xCurQueueIndex ][ uxNextTxRx[ xCurQueueIndex ] ] ) > 0 )
{
xQueueReceiveRet = xQueueReceive( xNetworkTxRxEventQueues[ xCurQueueIndex ][ uxNextTxRx[ xCurQueueIndex ] ], &xReceivedEvent, 0 );
Expand Down Expand Up @@ -340,18 +341,16 @@ static void prvProcessIPEventsAndTimers( void )
/* Decrement the queue index to the next queue */
xCurQueueIndex--;
}

}

if( xQueueReceiveRet == pdTRUE )
{
/* Break the event scheduler loop and process the event */
break;
}

}
}
#else
#else /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
if( xQueueReceive( xNetworkEventQueue, ( void * ) &xReceivedEvent, xNextIPSleep ) == pdFALSE )
{
xReceivedEvent.eEventType = eNoEvent;
Expand Down Expand Up @@ -996,7 +995,7 @@ void * FreeRTOS_GetUDPPayloadBuffer_Multi( size_t uxRequestedSizeBytes,
}
}

FreeRTOS_printf(("==>> FreeRTOS_GetUDPPayloadBuffer_Multi alloc: %p\n", pvReturn));
FreeRTOS_printf( ( "==>> FreeRTOS_GetUDPPayloadBuffer_Multi alloc: %p\n", pvReturn ) );

return ( void * ) pvReturn;
}
Expand Down Expand Up @@ -1068,35 +1067,32 @@ BaseType_t FreeRTOS_IPInit_Multi( void )
for( xIndex = 0; xIndex < ipconfigEVENT_QUEUES; xIndex++ )
{
xNetworkTxRxEventQueues[ xIndex ][ 0 ] = xQueueCreateStatic( ipconfigEVENT_QUEUE_LENGTH,
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea[ xIndex ][ 0 ],
&xNetworkEventStaticQueue[ xIndex ][ 0 ] );
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea[ xIndex ][ 0 ],
&xNetworkEventStaticQueue[ xIndex ][ 0 ] );
xQueueCreateStatus &= ( xNetworkTxRxEventQueues[ xIndex ][ 0 ] != NULL );

xNetworkTxRxEventQueues[ xIndex ][ 1 ] = xQueueCreateStatic( ipconfigEVENT_QUEUE_LENGTH,
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea[ xIndex ][ 1 ],
&xNetworkEventStaticQueue[ xIndex ][ 1 ] );
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea[ xIndex ][ 1 ],
&xNetworkEventStaticQueue[ xIndex ][ 1 ] );
xQueueCreateStatus &= ( xNetworkTxRxEventQueues[ xIndex ][ 1 ] != NULL );

}

xNetworkEventQueue = xNetworkTxRxEventQueues[ ipconfigEVENT_QUEUES - 1 ][ 0 ];

#else
#else /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
static StaticQueue_t xNetworkEventStaticQueue;
static uint8_t ucNetworkEventQueueStorageArea[ ipconfigEVENT_QUEUE_LENGTH * sizeof( IPStackEvent_t ) ];

xNetworkEventQueue = xQueueCreateStatic( ipconfigEVENT_QUEUE_LENGTH,
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea,
&xNetworkEventStaticQueue );
sizeof( IPStackEvent_t ),
ucNetworkEventQueueStorageArea,
&xNetworkEventStaticQueue );

xQueueCreateStatus = ( xNetworkEventQueue != NULL );

#endif
#endif /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
}
#else
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
{
#if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 )
xQueueCreateStatus = pdTRUE;
Expand All @@ -1113,14 +1109,11 @@ BaseType_t FreeRTOS_IPInit_Multi( void )
}

xNetworkEventQueue = xNetworkTxRxEventQueues[ ipconfigEVENT_QUEUES - 1 ][ 0 ];

#else

#else /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
xNetworkEventQueue = xQueueCreate( ipconfigEVENT_QUEUE_LENGTH, sizeof( IPStackEvent_t ) );
configASSERT( xNetworkEventQueue != NULL );
xQueueCreateStatus = ( xNetworkEventQueue != NULL );

#endif
#endif /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
}
#endif /* configSUPPORT_STATIC_ALLOCATION */

Expand Down Expand Up @@ -1182,15 +1175,13 @@ BaseType_t FreeRTOS_IPInit_Multi( void )

vQueueDelete( xNetworkTxRxEventQueues[ xIndex ][ 1 ] );
xNetworkTxRxEventQueues[ xIndex ][ 1 ] = NULL;

}

xNetworkEventQueue = NULL;

#else
#else /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
vQueueDelete( xNetworkEventQueue );
xNetworkEventQueue = NULL;
#endif
#endif /* if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 ) */
}
}
else
Expand Down Expand Up @@ -1602,12 +1593,12 @@ BaseType_t xSendEventStructToIPTask( const IPStackEvent_t * pxEvent,
if( ( pxEvent->eEventType == eNetworkTxEvent ) || ( pxEvent->eEventType == eStackTxEvent ) )
{
NetworkBufferDescriptor_t * pxBuffer = ( NetworkBufferDescriptor_t * ) pxEvent->pvData;
xQueue = xNetworkTxRxEventQueues[ xQueueMapping[ pxBuffer->ucPriority ] ][ 0 ] ;
xQueue = xNetworkTxRxEventQueues[ xQueueMapping[ pxBuffer->ucPriority ] ][ 0 ];
}
else if( pxEvent->eEventType == eNetworkRxEvent )
{
NetworkBufferDescriptor_t * pxBuffer = ( NetworkBufferDescriptor_t * ) pxEvent->pvData;
xQueue = xNetworkTxRxEventQueues[ xQueueMapping[ pxBuffer->ucPriority ] ][ 1 ] ;
xQueue = xNetworkTxRxEventQueues[ xQueueMapping[ pxBuffer->ucPriority ] ][ 1 ];
}

xReturn = xQueueSendToBack( xQueue, pxEvent, uxUseTimeout );
Expand Down
20 changes: 10 additions & 10 deletions source/FreeRTOS_Routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,16 +914,16 @@ struct xIPv6_Couple
/* Check if 'pucEthernetBuffer()' has the expected alignment,
* which is 32-bits + 2. */
#ifndef _lint
{
/* MISRA Ref 11.4.3 [Casting pointer to int for verification] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* coverity[misra_c_2012_rule_11_4_violation] */
uintptr_t uxAddress = ( uintptr_t ) pucEthernetBuffer;
uxAddress += 2U;
/* configASSERT( ( uxAddress % 4U ) == 0U ); */
/* And in case configASSERT is not defined. */
( void ) uxAddress;
}
{
/* MISRA Ref 11.4.3 [Casting pointer to int for verification] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-114 */
/* coverity[misra_c_2012_rule_11_4_violation] */
uintptr_t uxAddress = ( uintptr_t ) pucEthernetBuffer;
uxAddress += 2U;
/* configASSERT( ( uxAddress % 4U ) == 0U ); */
/* And in case configASSERT is not defined. */
( void ) uxAddress;
}
#endif /* ifndef _lint */

/* An Ethernet packet has been received. Inspect the contents to see which
Expand Down
14 changes: 7 additions & 7 deletions source/include/FreeRTOSIPConfigDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -3357,35 +3357,35 @@ STATIC_ASSERT( ipconfigDNS_SEND_BLOCK_TIME_TICKS <= portMAX_DELAY );
#endif

#ifndef ipconfigEVENT_QUEUES
#define ipconfigEVENT_QUEUES ( 1 )
#define ipconfigEVENT_QUEUES ( 1 )
#endif

#ifndef ipconfigEVENT_PRIORITIES
#if ( ipconfigEVENT_QUEUES > 1 )
#define ipconfigEVENT_PRIORITIES ( 8 )
#define ipconfigEVENT_PRIORITIES ( 8 )
#else
#define ipconfigEVENT_PRIORITIES ( 1 )
#define ipconfigEVENT_PRIORITIES ( 1 )
#endif
#endif

#if ( ipconfigEVENT_QUEUES > 1 )
#define ipconfigMULTI_PRIORITY_EVENT_QUEUES ( 1 )
#define ipconfigMULTI_PRIORITY_EVENT_QUEUES ( 1 )
#endif

#ifndef ipconfigBUDGET_MAPPING
#if ( ipconfigEVENT_QUEUES == 8 )
#define ipconfigBUDGET_MAPPING { 8, 8, 6, 6, 4, 4, 2, 2, }
#define ipconfigBUDGET_MAPPING { 8, 8, 6, 6, 4, 4, 2, 2, }
#endif
#endif

#ifndef ipconfigPACKET_PRIORITY_QUEUE_MAPPING
#if ( ipconfigEVENT_PRIORITIES == 8 )
#define ipconfigPACKET_PRIORITY_QUEUE_MAPPING { 0, 1, 2, 3, 4, 5, 6, 7 }
#define ipconfigPACKET_PRIORITY_QUEUE_MAPPING { 0, 1, 2, 3, 4, 5, 6, 7 }
#endif
#endif

#ifndef ipconfig_DEFAULT_EVENT_PRIORITY
#define ipconfig_DEFAULT_EVENT_PRIORITY ( 1 )
#define ipconfig_DEFAULT_EVENT_PRIORITY ( 1 )
#endif

/*---------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion source/include/FreeRTOS_Sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
#endif

#if ( ipconfigUSE_TCP == 1 )
#define FREERTOS_SO_SET_LOW_HIGH_WATER ( 18 )
#define FREERTOS_SO_SET_LOW_HIGH_WATER ( 18 )
#endif

#if ( ipconfigMULTI_PRIORITY_EVENT_QUEUES == 1 )
Expand Down
Loading

0 comments on commit a37f0b9

Please sign in to comment.