Skip to content

Commit 74c633a

Browse files
committed
Code review suggestions
Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent 2587c22 commit 74c633a

11 files changed

+77
-82
lines changed

event_groups.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
689689

690690
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
691691
{
692-
/* Check if the event group was statically allocated */
692+
/* Check if the event group was statically allocated. */
693693
if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
694694
{
695695
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
@@ -702,7 +702,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
702702
}
703703
#else /* configSUPPORT_DYNAMIC_ALLOCATION */
704704
{
705-
/* Event group must have been statically allocated */
705+
/* Event group must have been statically allocated. */
706706
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
707707
xReturn = pdTRUE;
708708
}

include/event_groups.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -770,16 +770,15 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
770770
* StaticEventGroup_t ** ppxEventGroupBuffer );
771771
* @endcode
772772
*
773-
* This function fetches a pointer to the memory buffer of a statically created
774-
* event group.
773+
* Retrieve a pointer to a statically created event groups's data structure
774+
* buffer. It is the same buffer that is supplied at the time of creation.
775775
*
776-
* @param xEventGroup The handle of the event group
776+
* @param xEventGroup The event group for which to retrieve the buffer.
777777
*
778-
* @param ppxEventGroupBuffer Used to pass back a pointer to the event groups's
778+
* @param ppxEventGroupBuffer Used to return a pointer to the event groups's
779779
* data structure buffer.
780780
*
781-
* @return pdTRUE if the buffer were fetched. pdFALSE if the event group was not
782-
* statically created.
781+
* @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
783782
*/
784783
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
785784
BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,

include/message_buffer.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,30 +250,30 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
250250
*
251251
* @code{c}
252252
* BaseType_t xMessageBufferGetStaticBuffers( MessageBufferHandle_t xMessageBuffer,
253-
* uint8_t ** ppucMessageBufferStorageArea,
254-
* StaticMessageBuffer_t ** ppxStaticMessageBuffer );
253+
* uint8_t ** ppucMessageBufferStorageArea,
254+
* StaticMessageBuffer_t ** ppxStaticMessageBuffer );
255255
* @endcode
256256
*
257-
* This function fetches the pointers to the memory buffers of a statically
258-
* created message buffer.
257+
* Retrieve pointers to a statically created message buffer's data structure
258+
* buffer and storage area buffer. These are the same buffers that are supplied
259+
* at the time of creation.
259260
*
260-
* @param xMessageBuffer The handle to the message buffer
261+
* @param xMessageBuffer The message buffer for which to retrieve the buffers.
261262
*
262-
* @param ppucMessageBufferStorageArea Used to pass back a pointer to the
263+
* @param ppucMessageBufferStorageArea Used to return a pointer to the
263264
* message buffer's storage area buffer.
264265
*
265-
* @param ppxStaticMessageBuffer Used to pass back a pointer to the message
266+
* @param ppxStaticMessageBuffer Used to return a pointer to the message
266267
* buffer's data structure buffer.
267268
*
268-
* @return pdTRUE if buffers were fetched. pdFALSE if the message buffer was not
269-
* statically created.
269+
* @return pdTRUE if buffers were retrieved, pdFALSE otherwise..
270270
*
271271
* \defgroup xMessageBufferGetStaticBuffers xMessageBufferGetStaticBuffers
272272
* \ingroup MessageBufferManagement
273273
*/
274274
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
275275
#define xMessageBufferGetStaticBuffers( xMessageBuffer, ppucMessageBufferStorageArea, ppxStaticMessageBuffer ) \
276-
xStreamBufferGenericGetStaticBuffers( ( xMessageBuffer ), ( ppucMessageBufferStorageArea ), ( ppxStaticMessageBuffer ) )
276+
xStreamBufferGetStaticBuffers( ( xMessageBuffer ), ( ppucMessageBufferStorageArea ), ( ppxStaticMessageBuffer ) )
277277
#endif /* configSUPPORT_STATIC_ALLOCATION */
278278

279279
/**

include/queue.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,19 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
243243
* StaticQueue_t ** ppxStaticQueue );
244244
* @endcode
245245
*
246-
* This function fetches the pointers to the memory buffers of a statically
247-
* created queue.
246+
* Retrieve pointers to a statically created queue's data structure buffer
247+
* and storage area buffer. These are the same buffers that are supplied
248+
* at the time of creation.
248249
*
249-
* @param xQueue The handle to the queue
250+
* @param xQueue The queue for which to retrieve the buffers.
250251
*
251-
* @param ppucQueueStorage Used to pass back a pointer to the queue's storage
252+
* @param ppucQueueStorage Used to return a pointer to the queue's storage
252253
* area buffer.
253254
*
254-
* @param ppxStaticQueue Used to pass back a pointer to the queue's data
255+
* @param ppxStaticQueue Used to return a pointer to the queue's data
255256
* structure buffer.
256257
*
257-
* @return pdTRUE if buffers were fetched. pdFALSE if the queue was not
258-
* created using xQueueCreateStatic().
258+
* @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
259259
*
260260
* \defgroup xQueueGetStaticBuffers xQueueGetStaticBuffers
261261
* \ingroup QueueManagement
@@ -1572,10 +1572,10 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
15721572
#endif
15731573

15741574
/*
1575-
* Generic version of the function used to get the buffers of statically created
1576-
* queues. This is called by other functions and macros that get the buffers
1577-
* of other statically created RTOS objects that use the queue structure as
1578-
* their base.
1575+
* Generic version of the function used to retrieve the buffers of statically
1576+
* created queues. This is called by other functions and macros that retrieve
1577+
* the buffers of other statically created RTOS objects that use the queue
1578+
* structure as their base.
15791579
*/
15801580
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
15811581
BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,

include/semphr.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,16 +1196,16 @@ typedef QueueHandle_t SemaphoreHandle_t;
11961196
* BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore );
11971197
* @endcode
11981198
*
1199-
* This function fetches a pointer to the memory buffer of a statically created
1200-
* binary semaphore, counting semaphore, or mutex semaphore.
1199+
* Retrieve pointer to a statically created binary semaphore, counting semaphore,
1200+
* or mutex semaphore's data structure buffer. This is the same buffer that is
1201+
* supplied at the time of creation.
12011202
*
1202-
* @param xSemaphore The handle of the statically created semaphore
1203+
* @param xSemaphore The semaphore for which to retrieve the buffer.
12031204
*
1204-
* @param ppxSemaphoreBuffer Used to pass back a pointer to the semaphore's
1205-
* data structure buffer
1205+
* @param ppxSemaphoreBuffer Used to return a pointer to the semaphore's
1206+
* data structure buffer.
12061207
*
1207-
* @return pdTRUE if buffer was fetched. pdFALSE if the semaphore was not
1208-
* statically allocated.
1208+
* @return pdTRUE if buffer was retrieved, pdFALSE otherwise.
12091209
*/
12101210
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
12111211
#define xSemaphoreGetStaticBuffer( xSemaphore, ppxSemaphoreBuffer ) xQueueGenericGetStaticBuffers( ( QueueHandle_t ) ( xSemaphore ), NULL, ( ppxSemaphoreBuffer ) )

include/stream_buffer.h

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -269,26 +269,27 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
269269
* StaticStreamBuffer_t ** ppxStaticStreamBuffer );
270270
* @endcode
271271
*
272-
* This function fetches the pointers to the memory buffers of a statically
273-
* created stream buffer.
272+
* Retrieve pointers to a statically created stream buffer's data structure
273+
* buffer and storage area buffer. These are the same buffers that are supplied
274+
* at the time of creation.
274275
*
275-
* @param xStreamBuffer The handle to the stream buffer
276+
* @param xStreamBuffer The stream buffer for which to retrieve the buffers.
276277
*
277-
* @param ppucStreamBufferStorageArea Used to pass back a pointer to the stream
278+
* @param ppucStreamBufferStorageArea Used to return a pointer to the stream
278279
* buffer's storage area buffer.
279280
*
280-
* @param ppxStaticStreamBuffer Used to pass back a pointer to the stream
281+
* @param ppxStaticStreamBuffer Used to return a pointer to the stream
281282
* buffer's data structure buffer.
282283
*
283-
* @return pdTRUE if buffers were fetched. pdFALSE if the stream buffer was not
284-
* statically created.
284+
* @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
285285
*
286286
* \defgroup xStreamBufferGetStaticBuffers xStreamBufferGetStaticBuffers
287287
* \ingroup StreamBufferManagement
288288
*/
289289
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
290-
#define xStreamBufferGetStaticBuffers( xStreamBuffer, ppucStreamBufferStorageArea, ppxStaticStreamBuffer ) \
291-
xStreamBufferGenericGetStaticBuffers( ( xStreamBuffer ), ( ppucStreamBufferStorageArea ), ( ppxStaticStreamBuffer ) )
290+
BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
291+
uint8_t ** ppucStreamBufferStorageArea,
292+
StaticStreamBuffer_t ** ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
292293
#endif /* configSUPPORT_STATIC_ALLOCATION */
293294

294295
/**
@@ -926,16 +927,6 @@ StreamBufferHandle_t xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
926927
StreamBufferCallbackFunction_t pxSendCompletedCallback,
927928
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
928929

929-
/*
930-
* Generic version of the function used to get the buffers of statically created
931-
* stream or message buffer.
932-
*/
933-
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
934-
BaseType_t xStreamBufferGenericGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
935-
uint8_t ** ppucStreamBufferStorageArea,
936-
StaticStreamBuffer_t ** ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
937-
#endif /* configSUPPORT_STATIC_ALLOCATION */
938-
939930
size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
940931

941932
#if ( configUSE_TRACE_FACILITY == 1 )

include/task.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,18 +1517,18 @@ TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /
15171517
* StaticTask_t ** ppxTaskBuffer );
15181518
* @endcode
15191519
*
1520-
* This function fetches a pointer to the memory buffers of a statically created
1521-
* task.
1520+
* Retrieve pointers to a statically created task's data structure
1521+
* buffer and stack buffer. These are the same buffers that are supplied
1522+
* at the time of creation.
15221523
*
1523-
* @param xTask The handle of the statically created task
1524+
* @param xTask The task for which to retrieve the buffers.
15241525
*
1525-
* @param ppuxStackBuffer Used to pass back a pointer to the task's stack buffer
1526+
* @param ppuxStackBuffer Used to return a pointer to the task's stack buffer.
15261527
*
1527-
* @param ppxTaskBuffer Used to pass back a pointer to the task's data structure
1528-
* buffer
1528+
* @param ppxTaskBuffer Used to return a pointer to the task's data structure
1529+
* buffer.
15291530
*
1530-
* @return pdTRUE if buffers were fetched. pdFALSE if the task was not
1531-
* statically created.
1531+
* @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
15321532
*
15331533
* \defgroup xTaskGetStaticBuffers xTaskGetStaticBuffers
15341534
* \ingroup TaskUtils

include/timers.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,16 +1327,16 @@ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
13271327
* BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
13281328
* StaticTimer_t ** ppxTimerBuffer );
13291329
*
1330-
* This function fetches a pointer to the memory buffer of a statically created
1331-
* timer.
1330+
* Retrieve pointer to a statically created timer's data structure
1331+
* buffer. This is the same buffer that is supplied at the time of
1332+
* creation.
13321333
*
1333-
* @param xTimer The handle of the timer
1334+
* @param xTimer The timer for which to retrieve the buffer.
13341335
*
1335-
* @param ppxTaskBuffer Used to pass back a pointer to the timers's data
1336+
* @param ppxTaskBuffer Used to return a pointer to the timers's data
13361337
* structure buffer.
13371338
*
1338-
* @return pdTRUE if the buffer were fetched. pdFALSE if the timer was not
1339-
* statically created.
1339+
* @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
13401340
*/
13411341
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
13421342
BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,

queue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
433433

434434
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
435435
{
436-
/* Check if the queue was statically allocated */
436+
/* Check if the queue was statically allocated. */
437437
if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
438438
{
439439
if( ppucQueueStorage != NULL )
@@ -451,7 +451,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
451451
}
452452
#else /* configSUPPORT_DYNAMIC_ALLOCATION */
453453
{
454-
/* Queue must have been statically allocated */
454+
/* Queue must have been statically allocated. */
455455
if( ppucQueueStorage != NULL )
456456
{
457457
*ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;

stream_buffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
473473
/*-----------------------------------------------------------*/
474474

475475
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
476-
BaseType_t xStreamBufferGenericGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
477-
uint8_t ** ppucStreamBufferStorageArea,
478-
StaticStreamBuffer_t ** ppxStaticStreamBuffer )
476+
BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
477+
uint8_t ** ppucStreamBufferStorageArea,
478+
StaticStreamBuffer_t ** ppxStaticStreamBuffer )
479479
{
480480
BaseType_t xReturn;
481481
const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;

tasks.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,15 +2504,13 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
25042504
pxTCB = prvGetTCBFromHandle( xTask );
25052505

25062506
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 )
2507-
if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
2508-
#endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
25092507
{
2510-
*ppuxStackBuffer = pxTCB->pxStack;
2511-
*ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
2512-
xReturn = pdTRUE;
2513-
}
2514-
2515-
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 )
2508+
if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
2509+
{
2510+
*ppuxStackBuffer = pxTCB->pxStack;
2511+
*ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
2512+
xReturn = pdTRUE;
2513+
}
25162514
else if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_ONLY )
25172515
{
25182516
*ppuxStackBuffer = pxTCB->pxStack;
@@ -2523,6 +2521,13 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
25232521
{
25242522
xReturn = pdFALSE;
25252523
}
2524+
}
2525+
#else /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
2526+
{
2527+
*ppuxStackBuffer = pxTCB->pxStack;
2528+
*ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
2529+
xReturn = pdTRUE;
2530+
}
25262531
#endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
25272532

25282533
return xReturn;

0 commit comments

Comments
 (0)