Skip to content

Commit

Permalink
Clang Format FreeRTOS-Kernel and shared portable files
Browse files Browse the repository at this point in the history
  • Loading branch information
Skptak committed Sep 8, 2023
1 parent 11519b2 commit c7b2a65
Show file tree
Hide file tree
Showing 31 changed files with 2,329 additions and 2,777 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 10000
PointerAlignment: Middle
ReflowComments: true
SortIncludes: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
Expand Down
95 changes: 41 additions & 54 deletions croutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@
*
* 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:
* 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 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.
* 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
*
*/

#include "croutine.h"
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"

/* Remove the whole file is co-routines are not being used. */
#if( configUSE_CO_ROUTINES != 0 )
Expand All @@ -43,31 +42,24 @@
#endif

/* Lists for ready and blocked co-routines. --------------------*/
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**<
Prioritised
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**< Prioritised
ready
co-routines.
*/
static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */
static List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are
used - one for delays that have
overflowed the current tick count. */
static List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed
co-routine list currently
being used. */
static List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the
delayed co-routine
list currently being
used to hold
co-routines that have
overflowed the current
tick count. */
static List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been
readied by an external event. They
cannot be added directly to the
ready lists as the ready lists
cannot be accessed by interrupts.
*/
co-routines. */
static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */
static List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are used - one
for delays that have overflowed the current tick
count. */
static List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list
currently being used. */
static List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the delayed
co-routine list currently being
used to hold co-routines that
have overflowed the current tick
count. */
static List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been readied by
an external event. They cannot be added
directly to the ready lists as the ready
lists cannot be accessed by interrupts. */

/* Other file private variables. --------------------------------*/
CRCB_t * pxCurrentCoRoutine = NULL;
Expand Down Expand Up @@ -148,8 +140,7 @@ BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode,
uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
}

/* Fill out the co-routine control block from the function parameters.
*/
/* Fill out the co-routine control block from the function parameters. */
pxCoRoutine->uxState = corINITIAL_STATE;
pxCoRoutine->uxPriority = uxPriority;
pxCoRoutine->uxIndex = uxIndex;
Expand Down Expand Up @@ -265,9 +256,8 @@ static void prvCheckDelayedList( void )
{
List_t * pxTemp;

/* Tick count has overflowed so we need to swap the delay lists. If
* there are any items in pxDelayedCoRoutineList here then there is
* an error! */
/* Tick count has overflowed so we need to swap the delay lists. If there are
* any items in pxDelayedCoRoutineList here then there is an error! */
pxTemp = pxDelayedCoRoutineList;
pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
pxOverflowDelayedCoRoutineList = pxTemp;
Expand All @@ -288,11 +278,10 @@ static void prvCheckDelayedList( void )
portDISABLE_INTERRUPTS();
{
/* The event could have occurred just before this critical
* section. If this is the case then the generic list item
* will have been moved to the pending ready list and the
* following line is still valid. Also the pvContainer
* parameter will have been set to NULL so the following lines
* are also valid. */
* section. If this is the case then the generic list item will
* have been moved to the pending ready list and the following
* line is still valid. Also the pvContainer parameter will have
* been set to NULL so the following lines are also valid. */
( void ) uxListRemove( &( pxCRCB->xGenericListItem ) );

/* Is the co-routine waiting on an event also? */
Expand All @@ -318,8 +307,7 @@ void vCoRoutineSchedule( void )
* co-routine is created. */
if( pxDelayedCoRoutineList != NULL )
{
/* See if any co-routines readied by events need moving to the ready
* lists. */
/* See if any co-routines readied by events need moving to the ready lists. */
prvCheckPendingReadyList();

/* See if any delayed co-routines have timed out. */
Expand All @@ -338,9 +326,8 @@ void vCoRoutineSchedule( void )
--uxTopCoRoutineReadyPriority;
}

/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the
* co-routines of the same priority get an equal share of the processor
* time. */
/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
* of the same priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY(
pxCurrentCoRoutine,
&( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
Expand Down
Loading

0 comments on commit c7b2a65

Please sign in to comment.