Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,18 @@ BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES
configASSERT( sizeof( UDPHeader_t ) == ipEXPECTED_UDPHeader_t_SIZE );

/* Attempt to create the queue used to communicate with the IP task. */
xNetworkEventQueue = xQueueCreate( ipconfigEVENT_QUEUE_LENGTH, sizeof( IPStackEvent_t ) );
configASSERT( xNetworkEventQueue != NULL );
#if ( configSUPPORT_STATIC_ALLOCATION == 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 );
}
#else
{
xNetworkEventQueue = xQueueCreate( ipconfigEVENT_QUEUE_LENGTH, sizeof( IPStackEvent_t ) );
configASSERT( xNetworkEventQueue != NULL );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */

if( xNetworkEventQueue != NULL )
{
Expand Down Expand Up @@ -1223,12 +1233,28 @@ BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES
vNetworkSocketsInit();

/* Create the task that processes Ethernet and stack events. */
xReturn = xTaskCreate( prvIPTask,
"IP-task",
ipconfigIP_TASK_STACK_SIZE_WORDS,
NULL,
ipconfigIP_TASK_PRIORITY,
&( xIPTaskHandle ) );
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
{
static StaticTask_t xIPTaskBuffer;
static StackType_t xIPTaskStack[ ipconfigIP_TASK_STACK_SIZE_WORDS ];
xIPTaskHandle = xTaskCreateStatic( prvIPTask,
"IP-Task",
ipconfigIP_TASK_STACK_SIZE_WORDS,
NULL,
ipconfigIP_TASK_PRIORITY,
xIPTaskStack,
&xIPTaskBuffer );
}
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
{
xReturn = xTaskCreate( prvIPTask,
"IP-task",
ipconfigIP_TASK_STACK_SIZE_WORDS,
NULL,
ipconfigIP_TASK_PRIORITY,
&( xIPTaskHandle ) );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
}
else
{
Expand Down
15 changes: 14 additions & 1 deletion portable/BufferManagement/BufferAllocation_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,20 @@ BaseType_t xNetworkBuffersInitialise( void )
* here */
ipconfigBUFFER_ALLOC_INIT();

xNetworkBufferSemaphore = xSemaphoreCreateCounting( ( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS, ( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS );
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
{
static StaticSemaphore_t xNetworkBufferSemaphoreBuffer;
xNetworkBufferSemaphore = xSemaphoreCreateCountingStatic(
( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS,
( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS,
&xNetworkBufferSemaphoreBuffer );
}
#else
{
xNetworkBufferSemaphore = xSemaphoreCreateCounting( ( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS, ( UBaseType_t ) ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */

configASSERT( xNetworkBufferSemaphore != NULL );

if( xNetworkBufferSemaphore != NULL )
Expand Down
15 changes: 14 additions & 1 deletion portable/BufferManagement/BufferAllocation_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,20 @@ BaseType_t xNetworkBuffersInitialise( void )
* have not been initialised before. */
if( xNetworkBufferSemaphore == NULL )
{
xNetworkBufferSemaphore = xSemaphoreCreateCounting( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS, ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS );
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
{
static StaticSemaphore_t xNetworkBufferSemaphoreBuffer;
xNetworkBufferSemaphore = xSemaphoreCreateCountingStatic(
ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS,
ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS,
&xNetworkBufferSemaphoreBuffer );
}
#else
{
xNetworkBufferSemaphore = xSemaphoreCreateCounting( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS, ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */

configASSERT( xNetworkBufferSemaphore != NULL );

if( xNetworkBufferSemaphore != NULL )
Expand Down