mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Feature/fixing clang gnu compiler warnings (#620)
* Adding in ability to support a library for freertos_config and a custom freertos_kernel_port (#558) * Using single name definition for libraries everywhere. (#558) * Supporting backwards compatibility with FREERTOS_CONFIG_FILE_DIRECTORY (#571) * Removing compiler warnings for GNU and Clang. (#571) * Added in documentation on how to consume from a main project. Added default PORT selection for native POSIX and MINGW platforms. * Only adding freertos_config if it exists. Removing auto generation of it from a FREERTOS_CONFIG_FILE_DIRECTORY. * Fixing clang and gnu compiler warnings. * Adding in project information and how to compile for GNU/clang * Fixing compiler issue with unused variable - no need to declare variable. * Adding in compile warnings for linux builds that kernel is okay with using. * Fixing more extra-semi-stmt clang warnings. * Moving definition of hooks into header files if features are enabled. * Fixing formatting with uncrustify. * Fixing merge conflicts with main merge. * Fixing compiler errors due to merge issues and formatting. * Fixing Line feeds. * Adding 'portNORETURN' into portmacros.h. Other Updates based on PR request * Further clean-up of clang and clang-tidy issues. * Removing compiler specific pragmas from common c files. * Fixing missing lexicon entry and uncrustify formatting changes. * Resolving merge issue multiple defnitions of proto for prvIdleTask * Fixing formatting issues that are not covered by uncrustify. Use clang-tidy instead if you want this level of control. * More uncrustify formatting issues. * Fixing extra bracket in #if statement. --------- Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
5d05601045
commit
8cd5451ad5
1
.github/lexicon.txt
vendored
1
.github/lexicon.txt
vendored
|
@ -2458,6 +2458,7 @@ vaninterruptserviceroutine
|
|||
vanisr
|
||||
vanothertask
|
||||
vapplicationcleartimerinterrupt
|
||||
vapplicationdaemontaskstartuphook
|
||||
vapplicationexceptionregisterdump
|
||||
vapplicationfpusafeirqhandler
|
||||
vapplicationgetidletaskmemory
|
||||
|
|
|
@ -222,6 +222,47 @@ elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_
|
|||
" freertos_kernel)")
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Requirements
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
########################################################################
|
||||
# Overall Compile Options
|
||||
# Note the compile option strategy is to error on everything and then
|
||||
# Per library opt-out of things that are warnings/errors.
|
||||
# This ensures that no matter what strategy for compilation you take, the
|
||||
# builds will still occur.
|
||||
#
|
||||
# Only tested with GNU and Clang.
|
||||
# Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
|
||||
# Naming of compilers translation map:
|
||||
#
|
||||
# FreeRTOS | CMake
|
||||
# -------------------
|
||||
# CCS | ?TBD?
|
||||
# GCC | GNU, Clang, *Clang Others?
|
||||
# IAR | IAR
|
||||
# Keil | ARMCC
|
||||
# MSVC | MSVC # Note only for MinGW?
|
||||
# Renesas | ?TBD?
|
||||
|
||||
add_compile_options(
|
||||
### Gnu/Clang C Options
|
||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
|
||||
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
|
||||
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
|
||||
|
||||
# TODO: Add in other Compilers here.
|
||||
)
|
||||
|
||||
|
||||
########################################################################
|
||||
add_subdirectory(portable)
|
||||
|
||||
add_library(freertos_kernel STATIC
|
||||
|
|
|
@ -69,14 +69,14 @@
|
|||
typedef struct EventGroupDef_t
|
||||
{
|
||||
EventBits_t uxEventBits;
|
||||
List_t xTasksWaitingForBits; /*< List of tasks waiting for a bit to be set. */
|
||||
List_t xTasksWaitingForBits; /**< List of tasks waiting for a bit to be set. */
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxEventGroupNumber;
|
||||
#endif
|
||||
|
||||
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */
|
||||
uint8_t ucStaticallyAllocated; /**< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */
|
||||
#endif
|
||||
} EventGroup_t;
|
||||
|
||||
|
@ -521,15 +521,15 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
|||
|
||||
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
|
||||
{
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
EventGroup_t const * const pxEventBits = xEventGroup;
|
||||
EventBits_t uxReturn;
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
uxReturn = pxEventBits->uxEventBits;
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return uxReturn;
|
||||
} /*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */
|
||||
|
|
|
@ -904,6 +904,10 @@
|
|||
#define portDONT_DISCARD
|
||||
#endif
|
||||
|
||||
#ifndef portNORETURN
|
||||
#define portNORETURN
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_TIME_SLICING
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#endif
|
||||
|
|
|
@ -143,20 +143,20 @@
|
|||
struct xLIST;
|
||||
struct xLIST_ITEM
|
||||
{
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in ascending order. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||
struct xLIST * configLIST_VOLATILE pxContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue; /**< The value being listed. In most cases this is used to sort the list in ascending order. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /**< Pointer to the next ListItem_t in the list. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /**< Pointer to the previous ListItem_t in the list. */
|
||||
void * pvOwner; /**< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||
struct xLIST * configLIST_VOLATILE pxContainer; /**< Pointer to the list in which this list item is placed (if any). */
|
||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
};
|
||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||
|
||||
#if ( configUSE_MINI_LIST_ITEM == 1 )
|
||||
struct xMINI_LIST_ITEM
|
||||
{
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||
|
@ -171,11 +171,11 @@ typedef struct xLIST_ITEM ListItem_t; /* For some reason lint
|
|||
*/
|
||||
typedef struct xLIST
|
||||
{
|
||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
volatile UBaseType_t uxNumberOfItems;
|
||||
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
ListItem_t * configLIST_VOLATILE pxIndex; /**< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
MiniListItem_t xListEnd; /**< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
} List_t;
|
||||
|
||||
/*
|
||||
|
@ -283,7 +283,7 @@ typedef struct xLIST
|
|||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||
{ \
|
||||
do { \
|
||||
List_t * const pxConstList = ( pxList ); \
|
||||
/* Increment the index to the next item and return the item, ensuring */ \
|
||||
/* we don't return the marker used at the end of the list. */ \
|
||||
|
@ -293,7 +293,7 @@ typedef struct xLIST
|
|||
( pxConstList )->pxIndex = ( pxConstList )->xListEnd.pxNext; \
|
||||
} \
|
||||
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
* Version of uxListRemove() that does not return a value. Provided as a slight
|
||||
|
@ -312,7 +312,7 @@ typedef struct xLIST
|
|||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listREMOVE_ITEM( pxItemToRemove ) \
|
||||
{ \
|
||||
do { \
|
||||
/* The list item knows which list it is in. Obtain the list from the list \
|
||||
* item. */ \
|
||||
List_t * const pxList = ( pxItemToRemove )->pxContainer; \
|
||||
|
@ -327,7 +327,7 @@ typedef struct xLIST
|
|||
\
|
||||
( pxItemToRemove )->pxContainer = NULL; \
|
||||
( pxList->uxNumberOfItems )--; \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
* Inline version of vListInsertEnd() to provide slight optimisation for
|
||||
|
@ -352,7 +352,7 @@ typedef struct xLIST
|
|||
* \ingroup LinkedList
|
||||
*/
|
||||
#define listINSERT_END( pxList, pxNewListItem ) \
|
||||
{ \
|
||||
do { \
|
||||
ListItem_t * const pxIndex = ( pxList )->pxIndex; \
|
||||
\
|
||||
/* Only effective when configASSERT() is also defined, these tests may catch \
|
||||
|
@ -374,7 +374,7 @@ typedef struct xLIST
|
|||
( pxNewListItem )->pxContainer = ( pxList ); \
|
||||
\
|
||||
( ( pxList )->uxNumberOfItems )++; \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
* Access function to obtain the owner of the first entry in a list. Lists
|
||||
|
|
|
@ -1346,9 +1346,9 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
|||
* @param pvBuffer Pointer to the buffer into which the received item will
|
||||
* be copied.
|
||||
*
|
||||
* @param pxTaskWoken A task may be blocked waiting for space to become
|
||||
* available on the queue. If xQueueReceiveFromISR causes such a task to
|
||||
* unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
|
||||
* @param pxHigherPriorityTaskWoken A task may be blocked waiting for space to
|
||||
* become available on the queue. If xQueueReceiveFromISR causes such a task
|
||||
* to unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
|
||||
* remain unchanged.
|
||||
*
|
||||
* @return pdTRUE if an item was successfully received from the queue,
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
do { \
|
||||
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
|
||||
\
|
||||
|
@ -98,7 +98,7 @@
|
|||
{ \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
@ -658,7 +658,7 @@ typedef enum
|
|||
*
|
||||
* @param xTask The handle of the task being updated.
|
||||
*
|
||||
* @param xRegions A pointer to a MemoryRegion_t structure that contains the
|
||||
* @param[in] pxRegions A pointer to a MemoryRegion_t structure that contains the
|
||||
* new memory region definitions.
|
||||
*
|
||||
* Example usage:
|
||||
|
@ -1667,7 +1667,7 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
|
|||
#endif
|
||||
|
||||
|
||||
#if ( configUSE_TICK_HOOK > 0 )
|
||||
#if ( configUSE_TICK_HOOK != 0 )
|
||||
|
||||
/**
|
||||
* task.h
|
||||
|
|
|
@ -1361,6 +1361,20 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
|
|||
|
||||
#endif
|
||||
|
||||
#if ( configUSE_DAEMON_TASK_STARTUP_HOOK != 0 )
|
||||
|
||||
/**
|
||||
* timers.h
|
||||
* @code{c}
|
||||
* void vApplicationDaemonTaskStartupHook( void );
|
||||
* @endcode
|
||||
*
|
||||
* This hook function is called form the timer task once when the task starts running.
|
||||
*/
|
||||
void vApplicationDaemonTaskStartupHook( void );
|
||||
|
||||
#endif
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M23"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M23"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M33"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M33"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M55"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M85"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M23"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M23"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler utilities. */
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M33"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M33"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* SVC numbers for various services. */
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler utilities. */
|
||||
|
|
|
@ -203,6 +203,7 @@ typedef struct MPU_SETTINGS
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* SVC numbers for various services. */
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M55"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M55"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Scheduler utilities. */
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M85"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
*/
|
||||
#define portARCH_NAME "Cortex-M85"
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,8 +96,8 @@
|
|||
* of their memory address. */
|
||||
typedef struct A_BLOCK_LINK
|
||||
{
|
||||
struct A_BLOCK_LINK * pxNextFreeBlock; /*<< The next free block in the list. */
|
||||
size_t xBlockSize; /*<< The size of the free block. */
|
||||
struct A_BLOCK_LINK * pxNextFreeBlock; /**< The next free block in the list. */
|
||||
size_t xBlockSize; /**< The size of the free block. */
|
||||
} BlockLink_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -390,7 +390,7 @@ static void prvHeapInit( void ) /* PRIVILEGED_FUNCTION */
|
|||
{
|
||||
uxAddress += ( portBYTE_ALIGNMENT - 1 );
|
||||
uxAddress &= ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK );
|
||||
xTotalHeapSize -= uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap;
|
||||
xTotalHeapSize -= ( size_t ) ( uxAddress - ( portPOINTER_SIZE_TYPE ) ucHeap );
|
||||
}
|
||||
|
||||
pucAlignedHeap = ( uint8_t * ) uxAddress;
|
||||
|
@ -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;
|
||||
|
|
7
portable/ThirdParty/GCC/Posix/port.c
vendored
7
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -115,6 +115,9 @@ static void prvPortYieldFromISR( void );
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvFatalError( const char * pcCall,
|
||||
int iErrno ) __attribute__ ((__noreturn__));
|
||||
|
||||
void prvFatalError( const char * pcCall,
|
||||
int iErrno )
|
||||
{
|
||||
fprintf( stderr, "%s: %s\n", pcCall, strerror( iErrno ) );
|
||||
|
@ -141,7 +144,7 @@ portSTACK_TYPE * pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack,
|
|||
*/
|
||||
thread = ( Thread_t * ) ( pxTopOfStack + 1 ) - 1;
|
||||
pxTopOfStack = ( portSTACK_TYPE * ) thread - 1;
|
||||
ulStackSize = ( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );
|
||||
ulStackSize = ( size_t )( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );
|
||||
|
||||
thread->pxCode = pxCode;
|
||||
thread->pvParams = pvParameters;
|
||||
|
@ -340,7 +343,7 @@ static uint64_t prvGetTimeNs( void )
|
|||
|
||||
clock_gettime( CLOCK_MONOTONIC, &t );
|
||||
|
||||
return t.tv_sec * 1000000000ULL + t.tv_nsec;
|
||||
return ( uint64_t )t.tv_sec * 1000000000ULL + ( uint64_t )t.tv_nsec;
|
||||
}
|
||||
|
||||
static uint64_t prvStartTimeNs;
|
||||
|
|
2
portable/ThirdParty/GCC/Posix/portmacro.h
vendored
2
portable/ThirdParty/GCC/Posix/portmacro.h
vendored
|
@ -68,6 +68,8 @@ typedef unsigned long TickType_t;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portHAS_STACK_OVERFLOW_CHECKING ( 1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
/* We have to use PICO_DIVIDER_DISABLE_INTERRUPTS as the source of truth rathern than our config,
|
||||
* as our FreeRTOSConfig.h header cannot be included by ASM code - which is what this affects in the SDK */
|
||||
#define portUSE_DIVIDER_SAVE_RESTORE !PICO_DIVIDER_DISABLE_INTERRUPTS
|
||||
|
|
|
@ -335,6 +335,8 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portNORETURN __attribute__( ( noreturn ) )
|
||||
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
|
|
64
queue.c
64
queue.c
|
@ -64,14 +64,14 @@
|
|||
|
||||
typedef struct QueuePointers
|
||||
{
|
||||
int8_t * pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */
|
||||
int8_t * pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */
|
||||
int8_t * pcTail; /**< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */
|
||||
int8_t * pcReadFrom; /**< Points to the last place that a queued item was read from when the structure is used as a queue. */
|
||||
} QueuePointers_t;
|
||||
|
||||
typedef struct SemaphoreData
|
||||
{
|
||||
TaskHandle_t xMutexHolder; /*< The handle of the task that holds the mutex. */
|
||||
UBaseType_t uxRecursiveCallCount; /*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */
|
||||
TaskHandle_t xMutexHolder; /**< The handle of the task that holds the mutex. */
|
||||
UBaseType_t uxRecursiveCallCount; /**< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */
|
||||
} SemaphoreData_t;
|
||||
|
||||
/* Semaphores do not actually store or copy data, so have an item size of
|
||||
|
@ -95,27 +95,27 @@ typedef struct SemaphoreData
|
|||
*/
|
||||
typedef struct QueueDefinition /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
{
|
||||
int8_t * pcHead; /*< Points to the beginning of the queue storage area. */
|
||||
int8_t * pcWriteTo; /*< Points to the free next place in the storage area. */
|
||||
int8_t * pcHead; /**< Points to the beginning of the queue storage area. */
|
||||
int8_t * pcWriteTo; /**< Points to the free next place in the storage area. */
|
||||
|
||||
union
|
||||
{
|
||||
QueuePointers_t xQueue; /*< Data required exclusively when this structure is used as a queue. */
|
||||
SemaphoreData_t xSemaphore; /*< Data required exclusively when this structure is used as a semaphore. */
|
||||
QueuePointers_t xQueue; /**< Data required exclusively when this structure is used as a queue. */
|
||||
SemaphoreData_t xSemaphore; /**< Data required exclusively when this structure is used as a semaphore. */
|
||||
} u;
|
||||
|
||||
List_t xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */
|
||||
List_t xTasksWaitingToReceive; /*< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */
|
||||
List_t xTasksWaitingToSend; /**< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */
|
||||
List_t xTasksWaitingToReceive; /**< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */
|
||||
|
||||
volatile UBaseType_t uxMessagesWaiting; /*< The number of items currently in the queue. */
|
||||
UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */
|
||||
UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */
|
||||
volatile UBaseType_t uxMessagesWaiting; /**< The number of items currently in the queue. */
|
||||
UBaseType_t uxLength; /**< The length of the queue defined as the number of items it will hold, not the number of bytes. */
|
||||
UBaseType_t uxItemSize; /**< The size of each items that the queue will hold. */
|
||||
|
||||
volatile int8_t cRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */
|
||||
volatile int8_t cTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */
|
||||
volatile int8_t cRxLock; /**< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */
|
||||
volatile int8_t cTxLock; /**< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */
|
||||
|
||||
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the memory used by the queue was statically allocated to ensure no attempt is made to free the memory. */
|
||||
uint8_t ucStaticallyAllocated; /**< Set to pdTRUE if the memory used by the queue was statically allocated to ensure no attempt is made to free the memory. */
|
||||
#endif
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
|
@ -264,14 +264,14 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
|||
* tasks than the number of tasks in the system.
|
||||
*/
|
||||
#define prvIncrementQueueTxLock( pxQueue, cTxLock ) \
|
||||
{ \
|
||||
do { \
|
||||
const UBaseType_t uxNumberOfTasks = uxTaskGetNumberOfTasks(); \
|
||||
if( ( UBaseType_t ) ( cTxLock ) < uxNumberOfTasks ) \
|
||||
{ \
|
||||
configASSERT( ( cTxLock ) != queueINT8_MAX ); \
|
||||
( pxQueue )->cTxLock = ( int8_t ) ( ( cTxLock ) + ( int8_t ) 1 ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
/*
|
||||
* Macro to increment cRxLock member of the queue data structure. It is
|
||||
|
@ -279,14 +279,14 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
|||
* tasks than the number of tasks in the system.
|
||||
*/
|
||||
#define prvIncrementQueueRxLock( pxQueue, cRxLock ) \
|
||||
{ \
|
||||
do { \
|
||||
const UBaseType_t uxNumberOfTasks = uxTaskGetNumberOfTasks(); \
|
||||
if( ( UBaseType_t ) ( cRxLock ) < uxNumberOfTasks ) \
|
||||
{ \
|
||||
configASSERT( ( cRxLock ) != queueINT8_MAX ); \
|
||||
( pxQueue )->cRxLock = ( int8_t ) ( ( cRxLock ) + ( int8_t ) 1 ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||
|
@ -1046,7 +1046,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
|
|||
const BaseType_t xCopyPosition )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
Queue_t * const pxQueue = xQueue;
|
||||
|
||||
configASSERT( pxQueue );
|
||||
|
@ -1074,7 +1074,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
|
|||
* read, instead return a flag to say whether a context switch is required or
|
||||
* not (i.e. has a task with a higher priority than us been woken by this
|
||||
* post). */
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
|
||||
{
|
||||
|
@ -1199,7 +1199,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
|
|||
xReturn = errQUEUE_FULL;
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1209,7 +1209,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
|||
BaseType_t * const pxHigherPriorityTaskWoken )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
Queue_t * const pxQueue = xQueue;
|
||||
|
||||
/* Similar to xQueueGenericSendFromISR() but used with semaphores where the
|
||||
|
@ -1245,7 +1245,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
|||
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
|
@ -1365,7 +1365,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
|||
xReturn = errQUEUE_FULL;
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1880,7 +1880,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
|
|||
BaseType_t * const pxHigherPriorityTaskWoken )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
Queue_t * const pxQueue = xQueue;
|
||||
|
||||
configASSERT( pxQueue );
|
||||
|
@ -1902,7 +1902,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
|
|||
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
|
@ -1962,7 +1962,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
|
|||
traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1972,7 +1972,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
|||
void * const pvBuffer )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
int8_t * pcOriginalReadPosition;
|
||||
Queue_t * const pxQueue = xQueue;
|
||||
|
||||
|
@ -1996,7 +1996,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
|||
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
/* Cannot block in an ISR, so check there is data available. */
|
||||
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
|
||||
|
@ -2017,7 +2017,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
|||
traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue );
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
( pxStreamBuffer )->xTaskWaitingToSend = NULL; \
|
||||
} \
|
||||
} \
|
||||
( void ) xTaskResumeAll();
|
||||
( void ) xTaskResumeAll()
|
||||
#endif /* sbRECEIVE_COMPLETED */
|
||||
|
||||
/* If user has provided a per-instance receive complete callback, then
|
||||
|
@ -95,10 +95,10 @@
|
|||
#ifndef sbRECEIVE_COMPLETED_FROM_ISR
|
||||
#define sbRECEIVE_COMPLETED_FROM_ISR( pxStreamBuffer, \
|
||||
pxHigherPriorityTaskWoken ) \
|
||||
{ \
|
||||
UBaseType_t uxSavedInterruptStatus; \
|
||||
do { \
|
||||
portBASE_TYPE xSavedInterruptStatus; \
|
||||
\
|
||||
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
{ \
|
||||
if( ( pxStreamBuffer )->xTaskWaitingToSend != NULL ) \
|
||||
{ \
|
||||
|
@ -109,8 +109,8 @@
|
|||
( pxStreamBuffer )->xTaskWaitingToSend = NULL; \
|
||||
} \
|
||||
} \
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus ); \
|
||||
} while( 0 )
|
||||
#endif /* sbRECEIVE_COMPLETED_FROM_ISR */
|
||||
|
||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||
|
@ -147,7 +147,7 @@
|
|||
( pxStreamBuffer )->xTaskWaitingToReceive = NULL; \
|
||||
} \
|
||||
} \
|
||||
( void ) xTaskResumeAll();
|
||||
( void ) xTaskResumeAll()
|
||||
#endif /* sbSEND_COMPLETED */
|
||||
|
||||
/* If user has provided a per-instance send completed callback, then
|
||||
|
@ -155,7 +155,7 @@
|
|||
*/
|
||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||
#define prvSEND_COMPLETED( pxStreamBuffer ) \
|
||||
{ \
|
||||
do { \
|
||||
if( ( pxStreamBuffer )->pxSendCompletedCallback != NULL ) \
|
||||
{ \
|
||||
pxStreamBuffer->pxSendCompletedCallback( ( pxStreamBuffer ), pdFALSE, NULL ); \
|
||||
|
@ -164,7 +164,7 @@
|
|||
{ \
|
||||
sbSEND_COMPLETED( ( pxStreamBuffer ) ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
#else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
|
||||
#define prvSEND_COMPLETED( pxStreamBuffer ) sbSEND_COMPLETED( ( pxStreamBuffer ) )
|
||||
#endif /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
|
||||
|
@ -172,10 +172,10 @@
|
|||
|
||||
#ifndef sbSEND_COMPLETE_FROM_ISR
|
||||
#define sbSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken ) \
|
||||
{ \
|
||||
UBaseType_t uxSavedInterruptStatus; \
|
||||
do { \
|
||||
portBASE_TYPE xSavedInterruptStatus; \
|
||||
\
|
||||
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \
|
||||
{ \
|
||||
if( ( pxStreamBuffer )->xTaskWaitingToReceive != NULL ) \
|
||||
{ \
|
||||
|
@ -186,14 +186,14 @@
|
|||
( pxStreamBuffer )->xTaskWaitingToReceive = NULL; \
|
||||
} \
|
||||
} \
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus ); \
|
||||
} while( 0 )
|
||||
#endif /* sbSEND_COMPLETE_FROM_ISR */
|
||||
|
||||
|
||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||
#define prvSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken ) \
|
||||
{ \
|
||||
do { \
|
||||
if( ( pxStreamBuffer )->pxSendCompletedCallback != NULL ) \
|
||||
{ \
|
||||
( pxStreamBuffer )->pxSendCompletedCallback( ( pxStreamBuffer ), pdTRUE, ( pxHigherPriorityTaskWoken ) ); \
|
||||
|
@ -202,7 +202,7 @@
|
|||
{ \
|
||||
sbSEND_COMPLETE_FROM_ISR( ( pxStreamBuffer ), ( pxHigherPriorityTaskWoken ) ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
#else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
|
||||
#define prvSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken ) \
|
||||
sbSEND_COMPLETE_FROM_ISR( ( pxStreamBuffer ), ( pxHigherPriorityTaskWoken ) )
|
||||
|
@ -436,13 +436,11 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
|
||||
|
||||
#if ( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
|
||||
/* 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. */
|
||||
volatile size_t xSize = sizeof( StaticStreamBuffer_t );
|
||||
configASSERT( xSize == sizeof( StreamBuffer_t ) );
|
||||
} /*lint !e529 xSize is referenced is configASSERT() is defined. */
|
||||
configASSERT( sizeof( StaticStreamBuffer_t ) == sizeof( StreamBuffer_t ) );
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )
|
||||
|
@ -1188,11 +1186,11 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
|
|||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
||||
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
if( ( pxStreamBuffer )->xTaskWaitingToReceive != NULL )
|
||||
{
|
||||
|
@ -1208,7 +1206,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
|
|||
xReturn = pdFALSE;
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1219,11 +1217,11 @@ BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuf
|
|||
{
|
||||
StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
|
||||
BaseType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
configASSERT( pxStreamBuffer );
|
||||
|
||||
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
if( ( pxStreamBuffer )->xTaskWaitingToSend != NULL )
|
||||
{
|
||||
|
@ -1239,7 +1237,7 @@ BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuf
|
|||
xReturn = pdFALSE;
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -1372,9 +1370,9 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
/* 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. */
|
||||
const BaseType_t xWriteValue = 0x55;
|
||||
configASSERT( memset( pucBuffer, ( int ) xWriteValue, xBufferSizeBytes ) == pucBuffer );
|
||||
} /*lint !e529 !e438 xWriteValue is only used if configASSERT() is defined. */
|
||||
#define STREAM_BUFFER_BUFFER_WRITE_VALUE ( 0x55 )
|
||||
configASSERT( memset( pucBuffer, ( int ) STREAM_BUFFER_BUFFER_WRITE_VALUE, xBufferSizeBytes ) == pucBuffer );
|
||||
}
|
||||
#endif
|
||||
|
||||
( void ) memset( ( void * ) pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); /*lint !e9087 memset() requires void *. */
|
||||
|
|
128
tasks.c
128
tasks.c
|
@ -134,7 +134,7 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define taskSELECT_HIGHEST_PRIORITY_TASK() \
|
||||
{ \
|
||||
do { \
|
||||
UBaseType_t uxTopPriority = uxTopReadyPriority; \
|
||||
\
|
||||
/* Find the highest priority queue that contains ready tasks. */ \
|
||||
|
@ -148,7 +148,7 @@
|
|||
* the same priority get an equal share of the processor time. */ \
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
|
||||
uxTopReadyPriority = uxTopPriority; \
|
||||
} /* taskSELECT_HIGHEST_PRIORITY_TASK */
|
||||
} while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -170,14 +170,14 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define taskSELECT_HIGHEST_PRIORITY_TASK() \
|
||||
{ \
|
||||
do { \
|
||||
UBaseType_t uxTopPriority; \
|
||||
\
|
||||
/* Find the highest priority list that contains ready tasks. */ \
|
||||
portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
|
||||
configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
|
||||
} /* taskSELECT_HIGHEST_PRIORITY_TASK() */
|
||||
} while( 0 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -185,12 +185,12 @@
|
|||
* is being referenced from a ready list. If it is referenced from a delayed
|
||||
* or suspended list then it won't be in a ready list. */
|
||||
#define taskRESET_READY_PRIORITY( uxPriority ) \
|
||||
{ \
|
||||
do { \
|
||||
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ ( uxPriority ) ] ) ) == ( UBaseType_t ) 0 ) \
|
||||
{ \
|
||||
portRESET_READY_PRIORITY( ( uxPriority ), ( uxTopReadyPriority ) ); \
|
||||
} \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
|
||||
|
||||
|
@ -199,7 +199,7 @@
|
|||
/* pxDelayedTaskList and pxOverflowDelayedTaskList are switched when the tick
|
||||
* count overflows. */
|
||||
#define taskSWITCH_DELAYED_LISTS() \
|
||||
{ \
|
||||
do { \
|
||||
List_t * pxTemp; \
|
||||
\
|
||||
/* The delayed tasks list should be empty when the lists are switched. */ \
|
||||
|
@ -210,7 +210,7 @@
|
|||
pxOverflowDelayedTaskList = pxTemp; \
|
||||
xNumOfOverflows++; \
|
||||
prvResetNextTaskUnblockTime(); \
|
||||
}
|
||||
} while( 0 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -218,11 +218,13 @@
|
|||
* Place the task represented by pxTCB into the appropriate ready list for
|
||||
* the task. It is inserted at the end of the list.
|
||||
*/
|
||||
#define prvAddTaskToReadyList( pxTCB ) \
|
||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
|
||||
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
||||
listINSERT_END( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
|
||||
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#define prvAddTaskToReadyList( pxTCB ) \
|
||||
do { \
|
||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
|
||||
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
||||
listINSERT_END( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
|
||||
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB ); \
|
||||
} while( 0 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -256,33 +258,33 @@
|
|||
*/
|
||||
typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
{
|
||||
volatile StackType_t * pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
|
||||
volatile StackType_t * pxTopOfStack; /**< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
|
||||
|
||||
#if ( portUSING_MPU_WRAPPERS == 1 )
|
||||
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
|
||||
xMPU_SETTINGS xMPUSettings; /**< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
|
||||
#endif
|
||||
|
||||
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
|
||||
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
|
||||
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
|
||||
StackType_t * pxStack; /*< Points to the start of the stack. */
|
||||
char pcTaskName[ configMAX_TASK_NAME_LEN ]; /*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
ListItem_t xStateListItem; /**< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
|
||||
ListItem_t xEventListItem; /**< Used to reference a task from an event list. */
|
||||
UBaseType_t uxPriority; /**< The priority of the task. 0 is the lowest priority. */
|
||||
StackType_t * pxStack; /**< Points to the start of the stack. */
|
||||
char pcTaskName[ configMAX_TASK_NAME_LEN ]; /**< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
|
||||
StackType_t * pxEndOfStack; /*< Points to the highest valid address for the stack. */
|
||||
StackType_t * pxEndOfStack; /**< Points to the highest valid address for the stack. */
|
||||
#endif
|
||||
|
||||
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
||||
UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
|
||||
UBaseType_t uxCriticalNesting; /**< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
|
||||
#endif
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
|
||||
UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
|
||||
UBaseType_t uxTCBNumber; /**< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
|
||||
UBaseType_t uxTaskNumber; /**< Stores a number specifically for use by third party trace code. */
|
||||
#endif
|
||||
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
|
||||
UBaseType_t uxBasePriority; /**< The priority last assigned to the task - used by the priority inheritance mechanism. */
|
||||
UBaseType_t uxMutexesHeld;
|
||||
#endif
|
||||
|
||||
|
@ -295,11 +297,11 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
|||
#endif
|
||||
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
|
||||
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /**< Stores the amount of time the task has spent in the Running state. */
|
||||
#endif
|
||||
|
||||
#if ( ( configUSE_NEWLIB_REENTRANT == 1 ) || ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
|
||||
configTLS_BLOCK_TYPE xTLSBlock; /*< Memory block used as Thread Local Storage (TLS) Block for the task. */
|
||||
configTLS_BLOCK_TYPE xTLSBlock; /**< Memory block used as Thread Local Storage (TLS) Block for the task. */
|
||||
#endif
|
||||
|
||||
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
|
||||
|
@ -310,7 +312,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
|||
/* See the comments in FreeRTOS.h with the definition of
|
||||
* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
|
||||
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
|
||||
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
|
||||
uint8_t ucStaticallyAllocated; /**< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
|
||||
#endif
|
||||
|
||||
#if ( INCLUDE_xTaskAbortDelay == 1 )
|
||||
|
@ -334,23 +336,23 @@ portDONT_DISCARD PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL;
|
|||
* xDelayedTaskList1 and xDelayedTaskList2 could be moved to function scope but
|
||||
* doing so breaks some kernel aware debuggers and debuggers that rely on removing
|
||||
* the static qualifier. */
|
||||
PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; /*< Prioritised ready tasks. */
|
||||
PRIVILEGED_DATA static List_t xDelayedTaskList1; /*< Delayed tasks. */
|
||||
PRIVILEGED_DATA static List_t xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */
|
||||
PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */
|
||||
PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */
|
||||
PRIVILEGED_DATA static List_t xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */
|
||||
PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; /**< Prioritised ready tasks. */
|
||||
PRIVILEGED_DATA static List_t xDelayedTaskList1; /**< Delayed tasks. */
|
||||
PRIVILEGED_DATA static List_t xDelayedTaskList2; /**< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */
|
||||
PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList; /**< Points to the delayed task list currently being used. */
|
||||
PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList; /**< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */
|
||||
PRIVILEGED_DATA static List_t xPendingReadyList; /**< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */
|
||||
|
||||
#if ( INCLUDE_vTaskDelete == 1 )
|
||||
|
||||
PRIVILEGED_DATA static List_t xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */
|
||||
PRIVILEGED_DATA static List_t xTasksWaitingTermination; /**< Tasks that have been deleted - but their memory not yet freed. */
|
||||
PRIVILEGED_DATA static volatile UBaseType_t uxDeletedTasksWaitingCleanUp = ( UBaseType_t ) 0U;
|
||||
|
||||
#endif
|
||||
|
||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||
|
||||
PRIVILEGED_DATA static List_t xSuspendedTaskList; /*< Tasks that are currently suspended. */
|
||||
PRIVILEGED_DATA static List_t xSuspendedTaskList; /**< Tasks that are currently suspended. */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -370,7 +372,7 @@ PRIVILEGED_DATA static volatile BaseType_t xYieldPending = pdFALSE;
|
|||
PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0;
|
||||
PRIVILEGED_DATA static UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U;
|
||||
PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U; /* Initialised to portMAX_DELAY before the scheduler starts. */
|
||||
PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandle = NULL; /*< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */
|
||||
PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandle = NULL; /**< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */
|
||||
|
||||
/* Improve support for OpenOCD. The kernel tracks Ready tasks via priority lists.
|
||||
* For tracking the state of remote threads, OpenOCD uses uxTopUsedPriority
|
||||
|
@ -391,8 +393,8 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
|||
|
||||
/* Do not move these variables to function scope as doing so prevents the
|
||||
* code working with debuggers that need to remove the static qualifier. */
|
||||
PRIVILEGED_DATA static configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */
|
||||
PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */
|
||||
PRIVILEGED_DATA static configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime = 0UL; /**< Holds the value of a timer/counter the last time a task was switched in. */
|
||||
PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime = 0UL; /**< Holds the total amount of execution time as defined by the run time counter clock. */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -430,7 +432,7 @@ static void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION;
|
|||
* void prvIdleTask( void *pvParameters );
|
||||
*
|
||||
*/
|
||||
static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
|
||||
static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) portNORETURN PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Utility to free all memory allocated by the scheduler to hold a TCB,
|
||||
|
@ -1469,7 +1471,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask )
|
||||
{
|
||||
TCB_t const * pxTCB;
|
||||
UBaseType_t uxReturn, uxSavedInterruptState;
|
||||
UBaseType_t uxReturn;
|
||||
portBASE_TYPE xSavedInterruptState;
|
||||
|
||||
/* RTOS ports that support interrupt nesting have the concept of a
|
||||
* maximum system call (or maximum API call) interrupt priority.
|
||||
|
@ -1489,14 +1492,14 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptState = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptState = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
/* If null is passed in here then it is the priority of the calling
|
||||
* task that is being queried. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
uxReturn = pxTCB->uxPriority;
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptState );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptState );
|
||||
|
||||
return uxReturn;
|
||||
}
|
||||
|
@ -1882,7 +1885,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
{
|
||||
BaseType_t xYieldRequired = pdFALSE;
|
||||
TCB_t * const pxTCB = xTaskToResume;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
configASSERT( xTaskToResume );
|
||||
|
||||
|
@ -1904,7 +1907,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
if( prvTaskIsTaskSuspended( pxTCB ) != pdFALSE )
|
||||
{
|
||||
|
@ -1945,7 +1948,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xYieldRequired;
|
||||
}
|
||||
|
@ -2303,7 +2306,7 @@ TickType_t xTaskGetTickCount( void )
|
|||
TickType_t xTaskGetTickCountFromISR( void )
|
||||
{
|
||||
TickType_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
/* RTOS ports that support interrupt nesting have the concept of a maximum
|
||||
* system call (or maximum API call) interrupt priority. Interrupts that are
|
||||
|
@ -2321,11 +2324,11 @@ TickType_t xTaskGetTickCountFromISR( void )
|
|||
* link: https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
xReturn = xTickCount;
|
||||
}
|
||||
portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -2535,7 +2538,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
|
|||
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||
portALT_GET_RUN_TIME_COUNTER_VALUE( ( *pulTotalRunTime ) );
|
||||
#else
|
||||
*pulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
*pulTotalRunTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -2956,18 +2959,18 @@ BaseType_t xTaskIncrementTick( void )
|
|||
{
|
||||
TCB_t * pxTCB;
|
||||
TaskHookFunction_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
/* If xTask is NULL then set the calling task's hook. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
|
||||
/* Save the hook function in the TCB. A critical section is required as
|
||||
* the value can be accessed from an interrupt. */
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
xReturn = pxTCB->pxTaskTag;
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -3026,7 +3029,7 @@ void vTaskSwitchContext( void )
|
|||
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );
|
||||
#else
|
||||
ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
ulTotalRunTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#endif
|
||||
|
||||
/* Add the amount of time the task has been running to the
|
||||
|
@ -3426,7 +3429,8 @@ void vTaskMissedYield( void )
|
|||
* void prvIdleTask( void *pvParameters );
|
||||
*
|
||||
*/
|
||||
static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
|
||||
portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
{
|
||||
/* Stop warnings. */
|
||||
( void ) pvParameters;
|
||||
|
@ -4975,7 +4979,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
TCB_t * pxTCB;
|
||||
uint8_t ucOriginalNotifyState;
|
||||
BaseType_t xReturn = pdPASS;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
configASSERT( xTaskToNotify );
|
||||
configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES );
|
||||
|
@ -5000,7 +5004,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
|
||||
pxTCB = xTaskToNotify;
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
if( pulPreviousNotificationValue != NULL )
|
||||
{
|
||||
|
@ -5094,7 +5098,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
}
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
@ -5110,7 +5114,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
{
|
||||
TCB_t * pxTCB;
|
||||
uint8_t ucOriginalNotifyState;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
portBASE_TYPE xSavedInterruptStatus;
|
||||
|
||||
configASSERT( xTaskToNotify );
|
||||
configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES );
|
||||
|
@ -5135,7 +5139,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
|
||||
pxTCB = xTaskToNotify;
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
ucOriginalNotifyState = pxTCB->ucNotifyState[ uxIndexToNotify ];
|
||||
pxTCB->ucNotifyState[ uxIndexToNotify ] = taskNOTIFICATION_RECEIVED;
|
||||
|
@ -5185,7 +5189,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
}
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||
}
|
||||
|
||||
#endif /* configUSE_TASK_NOTIFICATIONS */
|
||||
|
@ -5269,7 +5273,7 @@ TickType_t uxTaskResetEventItemValue( void )
|
|||
{
|
||||
configRUN_TIME_COUNTER_TYPE ulTotalTime, ulReturn;
|
||||
|
||||
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
ulTotalTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE();
|
||||
|
||||
/* For percentage calculations. */
|
||||
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
|
||||
|
|
24
timers.c
24
timers.c
|
@ -74,15 +74,15 @@
|
|||
/* The definition of the timers themselves. */
|
||||
typedef struct tmrTimerControl /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
{
|
||||
const char * pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */
|
||||
TickType_t xTimerPeriodInTicks; /*<< How quickly and often the timer expires. */
|
||||
void * pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */
|
||||
TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */
|
||||
const char * pcTimerName; /**< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
ListItem_t xTimerListItem; /**< Standard linked list item as used by all kernel features for event management. */
|
||||
TickType_t xTimerPeriodInTicks; /**< How quickly and often the timer expires. */
|
||||
void * pvTimerID; /**< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */
|
||||
TimerCallbackFunction_t pxCallbackFunction; /**< The function that will be called when the timer expires. */
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */
|
||||
UBaseType_t uxTimerNumber; /**< An ID assigned by trace tools such as FreeRTOS+Trace */
|
||||
#endif
|
||||
uint8_t ucStatus; /*<< Holds bits to say if the timer was statically allocated or not, and if it is active or not. */
|
||||
uint8_t ucStatus; /**< Holds bits to say if the timer was statically allocated or not, and if it is active or not. */
|
||||
} xTIMER;
|
||||
|
||||
/* The old xTIMER name is maintained above then typedefed to the new Timer_t
|
||||
|
@ -96,8 +96,8 @@
|
|||
* and xCallbackParametersType respectively. */
|
||||
typedef struct tmrTimerParameters
|
||||
{
|
||||
TickType_t xMessageValue; /*<< An optional value used by a subset of commands, for example, when changing the period of a timer. */
|
||||
Timer_t * pxTimer; /*<< The timer to which the command will be applied. */
|
||||
TickType_t xMessageValue; /**< An optional value used by a subset of commands, for example, when changing the period of a timer. */
|
||||
Timer_t * pxTimer; /**< The timer to which the command will be applied. */
|
||||
} TimerParameter_t;
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@
|
|||
* that is used to determine which message type is valid. */
|
||||
typedef struct tmrTimerQueueMessage
|
||||
{
|
||||
BaseType_t xMessageID; /*<< The command being sent to the timer service task. */
|
||||
BaseType_t xMessageID; /**< The command being sent to the timer service task. */
|
||||
union
|
||||
{
|
||||
TimerParameter_t xTimerParameters;
|
||||
|
@ -158,7 +158,7 @@
|
|||
* task. Other tasks communicate with the timer service task using the
|
||||
* xTimerQueue queue.
|
||||
*/
|
||||
static portTASK_FUNCTION_PROTO( prvTimerTask, pvParameters ) PRIVILEGED_FUNCTION;
|
||||
static portTASK_FUNCTION_PROTO( prvTimerTask, pvParameters ) portNORETURN PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Called by the timer service task to interpret and process a command it
|
||||
|
@ -575,8 +575,6 @@
|
|||
|
||||
#if ( configUSE_DAEMON_TASK_STARTUP_HOOK == 1 )
|
||||
{
|
||||
extern void vApplicationDaemonTaskStartupHook( void );
|
||||
|
||||
/* Allow the application writer to execute some code in the context of
|
||||
* this task at the point the task starts executing. This is useful if the
|
||||
* application includes initialisation code that would benefit from
|
||||
|
|
Loading…
Reference in a new issue