Skip to content

Commit

Permalink
Fixing formatting with uncrustify.
Browse files Browse the repository at this point in the history
  • Loading branch information
phelter committed Nov 3, 2022
1 parent cb1efde commit 6b9bbe6
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 73 deletions.
66 changes: 33 additions & 33 deletions include/croutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
*/

#ifndef CO_ROUTINE_H
#define CO_ROUTINE_H
#define CO_ROUTINE_H

#ifndef INC_FREERTOS_H
#error "include FreeRTOS.h must appear in source files before include croutine.h"
#endif
#ifndef INC_FREERTOS_H
#error "include FreeRTOS.h must appear in source files before include croutine.h"
#endif

#include "list.h"
#include "list.h"

/* *INDENT-OFF* */
#ifdef __cplusplus
Expand All @@ -44,21 +44,21 @@
/* Used to hide the implementation of the co-routine control block. The
* control block structure however has to be included in the header due to
* the macro implementation of the co-routine functionality. */
typedef void * CoRoutineHandle_t;
typedef void * CoRoutineHandle_t;

/* Defines the prototype to which co-routine functions must conform. */
typedef void (* crCOROUTINE_CODE)( CoRoutineHandle_t,
UBaseType_t );
typedef void (* crCOROUTINE_CODE)( CoRoutineHandle_t,
UBaseType_t );

typedef struct corCoRoutineControlBlock
{
crCOROUTINE_CODE pxCoRoutineFunction;
ListItem_t xGenericListItem; /**< List item used to place the CRCB in ready and blocked queues. */
ListItem_t xEventListItem; /**< List item used to place the CRCB in event lists. */
UBaseType_t uxPriority; /**< The priority of the co-routine in relation to other co-routines. */
UBaseType_t uxIndex; /**< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
uint16_t uxState; /**< Used internally by the co-routine implementation. */
} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */
typedef struct corCoRoutineControlBlock
{
crCOROUTINE_CODE pxCoRoutineFunction;
ListItem_t xGenericListItem; /**< List item used to place the CRCB in ready and blocked queues. */
ListItem_t xEventListItem; /**< List item used to place the CRCB in event lists. */
UBaseType_t uxPriority; /**< The priority of the co-routine in relation to other co-routines. */
UBaseType_t uxIndex; /**< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
uint16_t uxState; /**< Used internally by the co-routine implementation. */
} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */

/**
* croutine. h
Expand Down Expand Up @@ -133,9 +133,9 @@ typedef struct corCoRoutineControlBlock
* \defgroup xCoRoutineCreate xCoRoutineCreate
* \ingroup Tasks
*/
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode,
UBaseType_t uxPriority,
UBaseType_t uxIndex );
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode,
UBaseType_t uxPriority,
UBaseType_t uxIndex );


/**
Expand Down Expand Up @@ -178,7 +178,7 @@ BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode,
* \defgroup vCoRoutineSchedule vCoRoutineSchedule
* \ingroup Tasks
*/
void vCoRoutineSchedule( void );
void vCoRoutineSchedule( void );

/**
* croutine. h
Expand Down Expand Up @@ -211,7 +211,7 @@ void vCoRoutineSchedule( void );
* \defgroup crSTART crSTART
* \ingroup Tasks
*/
#define crSTART( pxCRCB ) \
#define crSTART( pxCRCB ) \
switch( ( ( CRCB_t * ) ( pxCRCB ) )->uxState ) { \
case 0:

Expand Down Expand Up @@ -246,16 +246,16 @@ void vCoRoutineSchedule( void );
* \defgroup crSTART crSTART
* \ingroup Tasks
*/
#define crEND() }
#define crEND() }

/*
* These macros are intended for internal use by the co-routine implementation
* only. The macros should not be used directly by application writers.
*/
#define crSET_STATE0( xHandle ) \
#define crSET_STATE0( xHandle ) \
( ( CRCB_t * ) ( xHandle ) )->uxState = ( __LINE__ * 2 ); return; \
case ( __LINE__ * 2 ):
#define crSET_STATE1( xHandle ) \
#define crSET_STATE1( xHandle ) \
( ( CRCB_t * ) ( xHandle ) )->uxState = ( ( __LINE__ * 2 ) + 1 ); return; \
case ( ( __LINE__ * 2 ) + 1 ):

Expand Down Expand Up @@ -307,7 +307,7 @@ void vCoRoutineSchedule( void );
* \defgroup crDELAY crDELAY
* \ingroup Tasks
*/
#define crDELAY( xHandle, xTicksToDelay ) \
#define crDELAY( xHandle, xTicksToDelay ) \
if( ( xTicksToDelay ) > 0 ) \
{ \
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
Expand Down Expand Up @@ -399,7 +399,7 @@ void vCoRoutineSchedule( void );
* \defgroup crQUEUE_SEND crQUEUE_SEND
* \ingroup Tasks
*/
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
{ \
*( pxResult ) = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), ( xTicksToWait ) ); \
if( *( pxResult ) == errQUEUE_BLOCKED ) \
Expand Down Expand Up @@ -493,7 +493,7 @@ void vCoRoutineSchedule( void );
* \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE
* \ingroup Tasks
*/
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
{ \
*( pxResult ) = xQueueCRReceive( ( pxQueue ), ( pvBuffer ), ( xTicksToWait ) ); \
if( *( pxResult ) == errQUEUE_BLOCKED ) \
Expand Down Expand Up @@ -604,7 +604,7 @@ void vCoRoutineSchedule( void );
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
* \ingroup Tasks
*/
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) \
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) \
xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )


Expand Down Expand Up @@ -720,7 +720,7 @@ void vCoRoutineSchedule( void );
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
* \ingroup Tasks
*/
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) \
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) \
xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )

/*
Expand All @@ -732,8 +732,8 @@ void vCoRoutineSchedule( void );
* Removes the current co-routine from its ready list and places it in the
* appropriate delayed list.
*/
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay,
List_t * pxEventList );
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay,
List_t * pxEventList );

/*
* This function is intended for internal use by the queue implementation only.
Expand All @@ -742,7 +742,7 @@ void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay,
* Removes the highest priority co-routine from the event list and places it in
* the pending ready list.
*/
BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList );
BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList );

/* *INDENT-OFF* */
#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions include/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ typedef struct xLIST
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
} \
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
} while(0)
} while( 0 )

/*
* Version of uxListRemove() that does not return a value. Provided as a slight
Expand All @@ -312,7 +312,7 @@ typedef struct xLIST
* \ingroup LinkedList
*/
#define listREMOVE_ITEM( pxItemToRemove ) \
do { \
do { \
/* The list item knows which list it is in. Obtain the list from the list \
* item. */ \
List_t * const pxList = ( pxItemToRemove )->pxContainer; \
Expand All @@ -327,7 +327,7 @@ typedef struct xLIST
\
( pxItemToRemove )->pxContainer = NULL; \
( pxList->uxNumberOfItems )--; \
} while(0)
} while( 0 )

/*
* Inline version of vListInsertEnd() to provide slight optimisation for
Expand Down Expand Up @@ -374,7 +374,7 @@ typedef struct xLIST
( pxNewListItem )->pxContainer = ( pxList ); \
\
( ( pxList )->uxNumberOfItems )++; \
} while(0)
} while( 0 )

/*
* Access function to obtain the owner of the first entry in a list. Lists
Expand Down
2 changes: 1 addition & 1 deletion include/stack_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \
} while(0)
} while( 0 )

#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
/*-----------------------------------------------------------*/
Expand Down
1 change: 1 addition & 0 deletions include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,7 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
#endif

#if ( configUSE_IDLE_HOOK != 0 )

/**
* task.h
* @code{c}
Expand Down
2 changes: 1 addition & 1 deletion include/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
*
* This hook function is called in the timers task before task executes.
*/
void vApplicationDaemonTaskStartupHook(void);
void vApplicationDaemonTaskStartupHook( void );

#endif

Expand Down
10 changes: 5 additions & 5 deletions portable/MemMang/heap_4.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
{
uxAddress += ( portBYTE_ALIGNMENT - 1 );
uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
xTotalHeapSize -= (size_t) (uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap);
xTotalHeapSize -= ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap );
}

pucAlignedHeap = ( uint8_t * ) uxAddress;
Expand All @@ -402,7 +402,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */

/* pxEnd is used to mark the end of the list of free blocks and is inserted
* at the end of the heap space. */
uxAddress = ( portPOINTER_SIZE_TYPE ) ( pucAlignedHeap + xTotalHeapSize );
uxAddress = ( portPOINTER_SIZE_TYPE ) ( pucAlignedHeap + xTotalHeapSize );
uxAddress -= xHeapStructSize;
uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
pxEnd = ( BlockLink_t * ) uxAddress;
Expand All @@ -411,13 +411,13 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */

/* To start with there is a single free block that is sized to take up the
* entire heap space, minus the space taken by pxEnd. */
#if defined(__clang__)
/* Alignment checked above with calculations on uxAddress */
#if defined( __clang__ )
/* Alignment checked above with calculations on uxAddress */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-align"
#endif /* defined(__clang__) */
pxFirstFreeBlock = ( BlockLink_t * ) pucAlignedHeap;
#if defined(__clang__)
#if defined( __clang__ )
#pragma clang diagnostic pop
#endif /* defined(__clang__) */
pxFirstFreeBlock->xBlockSize = ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) pxFirstFreeBlock );
Expand Down
4 changes: 2 additions & 2 deletions queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
configASSERT( ( cTxLock ) != queueINT8_MAX ); \
( pxQueue )->cTxLock = ( int8_t ) ( ( cTxLock ) + ( int8_t ) 1 ); \
} \
} while(0)
} while( 0 )

/*
* Macro to increment cRxLock member of the queue data structure. It is
Expand All @@ -290,7 +290,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
configASSERT( ( cRxLock ) != queueINT8_MAX ); \
( pxQueue )->cRxLock = ( int8_t ) ( ( cRxLock ) + ( int8_t ) 1 ); \
} \
} while(0)
} while( 0 )
/*-----------------------------------------------------------*/

BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
Expand Down
24 changes: 14 additions & 10 deletions stream_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus ); \
} while(0)
} while( 0 )
#endif /* sbRECEIVE_COMPLETED_FROM_ISR */

#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
Expand Down Expand Up @@ -164,15 +164,15 @@
{ \
sbSEND_COMPLETED( ( pxStreamBuffer ) ); \
} \
} while(0)
} while( 0 )
#else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
#define prvSEND_COMPLETED( pxStreamBuffer ) sbSEND_COMPLETED( ( pxStreamBuffer ) )
#endif /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */


#ifndef sbSEND_COMPLETE_FROM_ISR
#define sbSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken ) \
do { \
do { \
portBASE_TYPE xSavedInterruptStatus; \
\
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
Expand All @@ -187,7 +187,7 @@
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus ); \
} while(0)
} while( 0 )
#endif /* sbSEND_COMPLETE_FROM_ISR */


Expand All @@ -202,7 +202,7 @@
{ \
sbSEND_COMPLETE_FROM_ISR( ( pxStreamBuffer ), ( pxHigherPriorityTaskWoken ) ); \
} \
} while(0)
} while( 0 )
#else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
#define prvSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken ) \
sbSEND_COMPLETE_FROM_ISR( ( pxStreamBuffer ), ( pxHigherPriorityTaskWoken ) )
Expand Down Expand Up @@ -370,10 +370,12 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
{
pucAllocatedMemory = NULL;
}
#if defined(__clang__)

#if defined( __clang__ )
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-align"
#endif /* defined(__clang__) */

if( pucAllocatedMemory != NULL )
{
prvInitialiseNewStreamBuffer( ( StreamBuffer_t * ) pucAllocatedMemory, /* Structure at the start of the allocated memory. */ /*lint !e9087 Safe cast as allocated memory is aligned. */ /*lint !e826 Area is not too small and alignment is guaranteed provided malloc() behaves as expected and returns aligned buffer. */
Expand All @@ -392,7 +394,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
}

return ( StreamBufferHandle_t ) pucAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */
#if defined(__clang__)

#if defined( __clang__ )
#pragma clang diagnostic pop
#endif /* defined(__clang__) */
}
Expand Down Expand Up @@ -442,8 +445,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );

/* Sanity check that the size of the structure used to declare a
* variable of type StaticStreamBuffer_t equals the size of the real
* message buffer structure. */
* variable of type StaticStreamBuffer_t equals the size of the real
* message buffer structure. */
configASSERT( sizeof( StaticStreamBuffer_t ) == sizeof( StreamBuffer_t ) );

if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )
Expand Down Expand Up @@ -1368,7 +1371,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
/* Assert here is deliberately writing to the entire buffer to ensure it can
* be written to without generating exceptions, and is setting the buffer to a
* known value to assist in development/debugging. */
#define STREAM_BUFFER_BUFFER_WRITE_VALUE (0x55)
#define STREAM_BUFFER_BUFFER_WRITE_VALUE ( 0x55 )

/* The value written just has to be identifiable when looking at the
* memory. Don't use 0xA5 as that is the stack fill value and could
* result in confusion as to what is actually being observed. */
Expand Down
Loading

0 comments on commit 6b9bbe6

Please sign in to comment.