Run uncrustify with github workflows (#369)

* uncrustify with github workflows

* Fix find expression

* Add uncrustify configuration file

* Uncrustify some files

* uncrustify some more files

* uncrustify more files

* Fix whitespace at end of lines

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
This commit is contained in:
alfred gedeon 2021-07-28 17:53:10 -07:00 committed by GitHub
parent 85a23127cc
commit ce81bcb33f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 375 additions and 184 deletions

View File

@ -17,7 +17,7 @@ If you discover a potential security issue in this project we ask that you notif
## Submitting a bugs/feature request ## Submitting a bugs/feature request
Have a bug to report or feature to request? Follow these steps: Have a bug to report or feature to request? Follow these steps:
1. Search on the [FreeRTOS Community Support Forums](https://forums.freertos.org/) and [GitHub issue tracker](https://github.com/FreeRTOS/FreeRTOS/issues?utf8=%E2%9C%93&q=is%3Aissue) to be sure this hasn't been already reported or discussed. 1. Search on the [FreeRTOS Community Support Forums](https://forums.freertos.org/) and [GitHub issue tracker](https://github.com/FreeRTOS/FreeRTOS/issues?utf8=%E2%9C%93&q=is%3Aissue) to be sure this hasn't been already reported or discussed.
2. If your search turns up empty, create a new topic in the [forums](https://forums.freertos.org/) and work with the community to help clarify issues or refine the idea. Include as many of the details listed below. 2. If your search turns up empty, create a new topic in the [forums](https://forums.freertos.org/) and work with the community to help clarify issues or refine the idea. Include as many of the details listed below.
3. Once the community has had time to discuss and digest, we welcome you to create an [issue](https://github.com/FreeRTOS/FreeRTOS/issues) to report bugs or suggest features. 3. Once the community has had time to discuss and digest, we welcome you to create an [issue](https://github.com/FreeRTOS/FreeRTOS/issues) to report bugs or suggest features.
@ -43,8 +43,8 @@ To send us a pull request, please:
2. Modify the source; focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 2. Modify the source; focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Follow the [coding style guide](https://www.FreeRTOS.org/FreeRTOS-Coding-Standard-and-Style-Guide.html). 3. Follow the [coding style guide](https://www.FreeRTOS.org/FreeRTOS-Coding-Standard-and-Style-Guide.html).
4. Commit to your fork using clear commit messages. 4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface. 5. Send us a pull request, answering any default questions in the pull request interface.
NOTE: Please make sure the default option (Allow edits from maintainers) is left checked. NOTE: Please make sure the default option (Allow edits from maintainers) is left checked.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and

View File

@ -24,7 +24,7 @@ A concise description of what the bug is.
**To Reproduce** **To Reproduce**
- Use project ... and configure with ... - Use project ... and configure with ...
- Run on ... and could observe ... - Run on ... and could observe ...
**Expected behavior** **Expected behavior**
A concise description of what you expected to happen. A concise description of what you expected to happen.

View File

@ -11,7 +11,7 @@ assignees: ''
Please describe the issue and expected clarification in concise language. Please describe the issue and expected clarification in concise language.
**Reference** **Reference**
Please attach the URL at which you are experiencing the issue. Please attach the URL at which you are experiencing the issue.
**Screenshot** **Screenshot**
If applicable, please attach screenshot. If applicable, please attach screenshot.

160
.github/uncrustify.cfg vendored Normal file
View File

@ -0,0 +1,160 @@
# Uncrustify-0.67
input_tab_size = 4 # unsigned number
output_tab_size = 4 # unsigned number
sp_arith = force # ignore/add/remove/force
sp_assign = force # ignore/add/remove/force
sp_assign_default = force # ignore/add/remove/force
sp_before_assign = force # ignore/add/remove/force
sp_after_assign = force # ignore/add/remove/force
sp_enum_assign = force # ignore/add/remove/force
sp_enum_before_assign = force # ignore/add/remove/force
sp_enum_after_assign = force # ignore/add/remove/force
sp_pp_stringify = add # ignore/add/remove/force
sp_bool = force # ignore/add/remove/force
sp_compare = force # ignore/add/remove/force
sp_inside_paren = force # ignore/add/remove/force
sp_paren_paren = force # ignore/add/remove/force
sp_paren_brace = force # ignore/add/remove/force
sp_before_ptr_star = force # ignore/add/remove/force
sp_before_unnamed_ptr_star = force # ignore/add/remove/force
sp_between_ptr_star = remove # ignore/add/remove/force
sp_after_ptr_star = force # ignore/add/remove/force
sp_before_byref = force # ignore/add/remove/force
sp_after_byref = remove # ignore/add/remove/force
sp_after_byref_func = remove # ignore/add/remove/force
sp_before_angle = remove # ignore/add/remove/force
sp_inside_angle = remove # ignore/add/remove/force
sp_after_angle = force # ignore/add/remove/force
sp_before_sparen = remove # ignore/add/remove/force
sp_inside_sparen = force # ignore/add/remove/force
sp_after_sparen = force # ignore/add/remove/force
sp_sparen_brace = force # ignore/add/remove/force
sp_before_semi_for = remove # ignore/add/remove/force
sp_before_semi_for_empty = add # ignore/add/remove/force
sp_after_semi_for_empty = force # ignore/add/remove/force
sp_before_square = remove # ignore/add/remove/force
sp_before_squares = remove # ignore/add/remove/force
sp_inside_square = force # ignore/add/remove/force
sp_after_comma = force # ignore/add/remove/force
sp_after_cast = force # ignore/add/remove/force
sp_inside_paren_cast = force # ignore/add/remove/force
sp_sizeof_paren = remove # ignore/add/remove/force
sp_inside_braces_enum = force # ignore/add/remove/force
sp_inside_braces_struct = force # ignore/add/remove/force
sp_inside_braces = force # ignore/add/remove/force
sp_inside_braces_empty = remove # ignore/add/remove/force
sp_type_func = force # ignore/add/remove/force
sp_func_proto_paren = remove # ignore/add/remove/force
sp_func_def_paren = remove # ignore/add/remove/force
sp_inside_fparens = remove # ignore/add/remove/force
sp_inside_fparen = force # ignore/add/remove/force
sp_fparen_brace = add # ignore/add/remove/force
sp_func_call_paren = remove # ignore/add/remove/force
sp_func_class_paren = remove # ignore/add/remove/force
sp_return_paren = remove # ignore/add/remove/force
sp_attribute_paren = remove # ignore/add/remove/force
sp_defined_paren = remove # ignore/add/remove/force
sp_macro = force # ignore/add/remove/force
sp_macro_func = force # ignore/add/remove/force
sp_brace_typedef = force # ignore/add/remove/force
sp_before_dc = remove # ignore/add/remove/force
sp_after_dc = remove # ignore/add/remove/force
sp_cond_colon = force # ignore/add/remove/force
sp_cond_question = force # ignore/add/remove/force
sp_case_label = force # ignore/add/remove/force
sp_endif_cmt = force # ignore/add/remove/force
sp_before_tr_emb_cmt = force # ignore/add/remove/force
sp_num_before_tr_emb_cmt = 1 # unsigned number
indent_columns = 4 # unsigned number
indent_with_tabs = 0 # unsigned number
indent_align_string = true # false/true
indent_class = true # false/true
indent_class_colon = true # false/true
indent_member = 3 # unsigned number
indent_switch_case = 4 # unsigned number
indent_case_brace = 3 # number
nl_assign_leave_one_liners = true # false/true
nl_class_leave_one_liners = true # false/true
nl_start_of_file = remove # ignore/add/remove/force
nl_end_of_file = force # ignore/add/remove/force
nl_end_of_file_min = 1 # unsigned number
nl_assign_brace = add # ignore/add/remove/force
nl_func_var_def_blk = 1 # unsigned number
nl_fcall_brace = add # ignore/add/remove/force
nl_enum_brace = force # ignore/add/remove/force
nl_struct_brace = force # ignore/add/remove/force
nl_union_brace = force # ignore/add/remove/force
nl_if_brace = add # ignore/add/remove/force
nl_brace_else = add # ignore/add/remove/force
nl_else_brace = add # ignore/add/remove/force
nl_getset_brace = force # ignore/add/remove/force
nl_for_brace = add # ignore/add/remove/force
nl_while_brace = add # ignore/add/remove/force
nl_do_brace = add # ignore/add/remove/force
nl_switch_brace = add # ignore/add/remove/force
nl_multi_line_define = true # false/true
nl_before_case = true # false/true
nl_after_case = true # false/true
nl_func_type_name = remove # ignore/add/remove/force
nl_func_proto_type_name = remove # ignore/add/remove/force
nl_func_paren = remove # ignore/add/remove/force
nl_func_def_paren = remove # ignore/add/remove/force
nl_func_decl_start = remove # ignore/add/remove/force
nl_func_def_start = remove # ignore/add/remove/force
nl_func_decl_args = add # ignore/add/remove/force
nl_func_def_args = add # ignore/add/remove/force
nl_func_decl_end = remove # ignore/add/remove/force
nl_func_def_end = remove # ignore/add/remove/force
nl_fdef_brace = add # ignore/add/remove/force
nl_after_semicolon = true # false/true
nl_after_brace_open = true # false/true
nl_after_brace_close = true # false/true
nl_squeeze_ifdef = true # false/true
nl_before_if = force # ignore/add/remove/force
nl_after_if = force # ignore/add/remove/force
nl_before_for = force # ignore/add/remove/force
nl_after_for = force # ignore/add/remove/force
nl_before_while = force # ignore/add/remove/force
nl_after_while = force # ignore/add/remove/force
nl_before_switch = force # ignore/add/remove/force
nl_after_switch = force # ignore/add/remove/force
nl_before_do = force # ignore/add/remove/force
nl_after_do = force # ignore/add/remove/force
nl_max = 4 # unsigned number
nl_after_func_proto_group = 1 # unsigned number
nl_after_func_body_class = 2 # unsigned number
nl_before_block_comment = 2 # unsigned number
eat_blanks_after_open_brace = true # false/true
eat_blanks_before_close_brace = true # false/true
nl_after_return = true # false/true
pos_bool = trail # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force
align_var_def_amp_style = 1 # unsigned number
align_var_def_thresh = 16 # unsigned number
align_assign_thresh = 12 # unsigned number
align_struct_init_span = 3 # unsigned number
align_typedef_gap = 3 # unsigned number
align_typedef_span = 5 # unsigned number
align_typedef_star_style = 1 # unsigned number
align_typedef_amp_style = 1 # unsigned number
align_right_cmt_span = 3 # unsigned number
align_nl_cont = true # false/true
align_pp_define_gap = 4 # unsigned number
align_pp_define_span = 3 # unsigned number
cmt_cpp_to_c = true # false/true
cmt_star_cont = true # false/true
mod_full_brace_do = add # ignore/add/remove/force
mod_full_brace_for = add # ignore/add/remove/force
mod_full_brace_if = add # ignore/add/remove/force
mod_full_brace_while = add # ignore/add/remove/force
mod_full_paren_if_bool = true # false/true
mod_remove_extra_semicolon = true # false/true
mod_add_long_ifdef_endif_comment = 10 # unsigned number
mod_add_long_ifdef_else_comment = 10 # unsigned number
mod_case_brace = remove # ignore/add/remove/force
mod_remove_empty_return = true # false/true
pp_indent = force # ignore/add/remove/force
pp_indent_at_level = true # false/true
pp_indent_count = 4 # unsigned number
pp_space = remove # ignore/add/remove/force
pp_if_indent_code = true # false/true
# option(s) with 'not default' value: 158

View File

@ -34,6 +34,27 @@ jobs:
else else
exit 1 exit 1
fi fi
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Uncrustify
run: sudo apt-get install uncrustify
- name: Run Uncrustify
run: |
uncrustify --version
find . \( -name portable \) -prune -false -o -iname "*.[hc]" -exec uncrustify --check -c .github/uncrustify.cfg {} +
- name: Check For Trailing Whitespace
run: |
set +e
grep --exclude="README.md" --exclude-dir="portable" -rnI -e "[[:blank:]]$" .
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
exit 1
else
exit 0
fi
url-check: url-check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -47,7 +47,7 @@
* contains the typedefs required to build FreeRTOS. Read the instructions * contains the typedefs required to build FreeRTOS. Read the instructions
* in FreeRTOS/source/stdint.readme for more information. * in FreeRTOS/source/stdint.readme for more information.
*/ */
#include <stdint.h> /* READ COMMENT ABOVE. */ #include <stdint.h> /* READ COMMENT ABOVE. */
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
@ -130,21 +130,23 @@
#ifdef INCLUDE_xTaskDelayUntil #ifdef INCLUDE_xTaskDelayUntil
#ifdef INCLUDE_vTaskDelayUntil #ifdef INCLUDE_vTaskDelayUntil
/* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
* compatibility is maintained if only one or the other is defined, but /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
* there is a conflict if both are defined. */ * compatibility is maintained if only one or the other is defined, but
* there is a conflict if both are defined. */
#error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
#endif #endif
#endif #endif
#ifndef INCLUDE_xTaskDelayUntil #ifndef INCLUDE_xTaskDelayUntil
#ifdef INCLUDE_vTaskDelayUntil #ifdef INCLUDE_vTaskDelayUntil
/* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
* the project's FreeRTOSConfig.h probably pre-dates the introduction of /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
* xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever * the project's FreeRTOSConfig.h probably pre-dates the introduction of
* INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility. * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
*/ * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
#define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil */
#define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
#endif #endif
#endif #endif
@ -906,6 +908,7 @@
#endif #endif
#ifndef configRUN_TIME_COUNTER_TYPE #ifndef configRUN_TIME_COUNTER_TYPE
/* Defaults to uint32_t for backward compatibility, but can be overridden in /* Defaults to uint32_t for backward compatibility, but can be overridden in
* FreeRTOSConfig.h if uint32_t is too restrictive. */ * FreeRTOSConfig.h if uint32_t is too restrictive. */

View File

@ -307,23 +307,23 @@ typedef struct xLIST
* \page listREMOVE_ITEM listREMOVE_ITEM * \page listREMOVE_ITEM listREMOVE_ITEM
* \ingroup LinkedList * \ingroup LinkedList
*/ */
#define listREMOVE_ITEM( pxItemToRemove ) \ #define listREMOVE_ITEM( pxItemToRemove ) \
{ \ { \
/* The list item knows which list it is in. Obtain the list from the list \ /* The list item knows which list it is in. Obtain the list from the list \
* item. */ \ * item. */ \
List_t * const pxList = ( pxItemToRemove )->pxContainer; \ List_t * const pxList = ( pxItemToRemove )->pxContainer; \
\ \
( pxItemToRemove )->pxNext->pxPrevious = ( pxItemToRemove )->pxPrevious; \ ( pxItemToRemove )->pxNext->pxPrevious = ( pxItemToRemove )->pxPrevious; \
( pxItemToRemove )->pxPrevious->pxNext = ( pxItemToRemove )->pxNext; \ ( pxItemToRemove )->pxPrevious->pxNext = ( pxItemToRemove )->pxNext; \
/* Make sure the index is left pointing to a valid item. */ \ /* Make sure the index is left pointing to a valid item. */ \
if( pxList->pxIndex == ( pxItemToRemove ) ) \ if( pxList->pxIndex == ( pxItemToRemove ) ) \
{ \ { \
pxList->pxIndex = ( pxItemToRemove )->pxPrevious; \ pxList->pxIndex = ( pxItemToRemove )->pxPrevious; \
} \ } \
\ \
( pxItemToRemove )->pxContainer = NULL; \ ( pxItemToRemove )->pxContainer = NULL; \
( pxList->uxNumberOfItems )--; \ ( pxList->uxNumberOfItems )--; \
} }
/* /*
* Inline version of vListInsertEnd() to provide slight optimisation for * Inline version of vListInsertEnd() to provide slight optimisation for
@ -347,30 +347,30 @@ typedef struct xLIST
* \page listINSERT_END listINSERT_END * \page listINSERT_END listINSERT_END
* \ingroup LinkedList * \ingroup LinkedList
*/ */
#define listINSERT_END( pxList, pxNewListItem ) \ #define listINSERT_END( pxList, pxNewListItem ) \
{ \ { \
ListItem_t * const pxIndex = ( pxList )->pxIndex; \ ListItem_t * const pxIndex = ( pxList )->pxIndex; \
\ \
/* Only effective when configASSERT() is also defined, these tests may catch \ /* Only effective when configASSERT() is also defined, these tests may catch \
* the list data structures being overwritten in memory. They will not catch \ * the list data structures being overwritten in memory. They will not catch \
* data errors caused by incorrect configuration or use of FreeRTOS. */ \ * data errors caused by incorrect configuration or use of FreeRTOS. */ \
listTEST_LIST_INTEGRITY( ( pxList ) ); \ listTEST_LIST_INTEGRITY( ( pxList ) ); \
listTEST_LIST_ITEM_INTEGRITY( ( pxNewListItem ) ); \ listTEST_LIST_ITEM_INTEGRITY( ( pxNewListItem ) ); \
\ \
/* Insert a new list item into ( pxList ), but rather than sort the list, \ /* Insert a new list item into ( pxList ), but rather than sort the list, \
* makes the new list item the last item to be removed by a call to \ * makes the new list item the last item to be removed by a call to \
* listGET_OWNER_OF_NEXT_ENTRY(). */ \ * listGET_OWNER_OF_NEXT_ENTRY(). */ \
( pxNewListItem )->pxNext = pxIndex; \ ( pxNewListItem )->pxNext = pxIndex; \
( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \ ( pxNewListItem )->pxPrevious = pxIndex->pxPrevious; \
\ \
pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \ pxIndex->pxPrevious->pxNext = ( pxNewListItem ); \
pxIndex->pxPrevious = ( pxNewListItem ); \ pxIndex->pxPrevious = ( pxNewListItem ); \
\ \
/* Remember which list the item is in. */ \ /* Remember which list the item is in. */ \
( pxNewListItem )->pxContainer = ( pxList ); \ ( pxNewListItem )->pxContainer = ( pxList ); \
\ \
( ( pxList )->uxNumberOfItems )++; \ ( ( pxList )->uxNumberOfItems )++; \
} }
/* /*
* Access function to obtain the owner of the first entry in a list. Lists * Access function to obtain the owner of the first entry in a list. Lists

View File

@ -55,7 +55,7 @@ TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) FREERTOS_SYSTEM_CALL; void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) FREERTOS_SYSTEM_CALL;
void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL; void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL; const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL; eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;

View File

@ -65,12 +65,12 @@
#define portBYTE_ALIGNMENT_MASK ( 0x0001 ) #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
#elif portBYTE_ALIGNMENT == 1 #elif portBYTE_ALIGNMENT == 1
#define portBYTE_ALIGNMENT_MASK ( 0x0000 ) #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
#else #else /* if portBYTE_ALIGNMENT == 32 */
#error "Invalid portBYTE_ALIGNMENT definition" #error "Invalid portBYTE_ALIGNMENT definition"
#endif #endif /* if portBYTE_ALIGNMENT == 32 */
#ifndef portUSING_MPU_WRAPPERS #ifndef portUSING_MPU_WRAPPERS
#define portUSING_MPU_WRAPPERS 0 #define portUSING_MPU_WRAPPERS 0
#endif #endif
#ifndef portNUM_CONFIGURABLE_REGIONS #ifndef portNUM_CONFIGURABLE_REGIONS
@ -87,7 +87,7 @@
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP #ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
/* Defaults to 0 for backward compatibility. */ /* Defaults to 0 for backward compatibility. */
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#endif #endif
/* *INDENT-OFF* */ /* *INDENT-OFF* */
@ -141,13 +141,13 @@ typedef struct HeapRegion
/* Used to pass information about the heap out of vPortGetHeapStats(). */ /* Used to pass information about the heap out of vPortGetHeapStats(). */
typedef struct xHeapStats typedef struct xHeapStats
{ {
size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */ size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */
size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */ size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */ size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */ size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */
size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */ size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */
size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */ size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */
size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */ size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */
} HeapStats_t; } HeapStats_t;
/* /*
@ -178,12 +178,12 @@ void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
#if( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 ) #if ( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
void *pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION; void * pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
void vPortFreeStack( void *pv ) PRIVILEGED_FUNCTION; void vPortFreeStack( void * pv ) PRIVILEGED_FUNCTION;
#else #else
#define pvPortMallocStack pvPortMalloc #define pvPortMallocStack pvPortMalloc
#define vPortFreeStack vPortFree #define vPortFreeStack vPortFree
#endif #endif
/* /*

View File

@ -1184,6 +1184,6 @@ typedef QueueHandle_t SemaphoreHandle_t;
* semaphore is not available. * semaphore is not available.
* *
*/ */
#define uxSemaphoreGetCountFromISR( xSemaphore ) uxQueueMessagesWaitingFromISR( ( QueueHandle_t ) ( xSemaphore ) ) #define uxSemaphoreGetCountFromISR( xSemaphore ) uxQueueMessagesWaitingFromISR( ( QueueHandle_t ) ( xSemaphore ) )
#endif /* SEMAPHORE_H */ #endif /* SEMAPHORE_H */

View File

@ -50,7 +50,7 @@
* use on the stack. * use on the stack.
*/ */
#ifndef portSTACK_LIMIT_PADDING #ifndef portSTACK_LIMIT_PADDING
#define portSTACK_LIMIT_PADDING 0 #define portSTACK_LIMIT_PADDING 0
#endif #endif
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
@ -59,7 +59,7 @@
#define taskCHECK_FOR_STACK_OVERFLOW() \ #define taskCHECK_FOR_STACK_OVERFLOW() \
{ \ { \
/* Is the currently saved stack pointer within the stack limit? */ \ /* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING) \ if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
{ \ { \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \ } \
@ -75,7 +75,7 @@
{ \ { \
\ \
/* Is the currently saved stack pointer within the stack limit? */ \ /* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING) \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
{ \ { \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \ } \

View File

@ -83,7 +83,7 @@
* \defgroup TaskHandle_t TaskHandle_t * \defgroup TaskHandle_t TaskHandle_t
* \ingroup Tasks * \ingroup Tasks
*/ */
struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */ struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
typedef struct tskTaskControlBlock * TaskHandle_t; typedef struct tskTaskControlBlock * TaskHandle_t;
/* /*
@ -95,22 +95,22 @@ typedef BaseType_t (* TaskHookFunction_t)( void * );
/* Task states returned by eTaskGetState. */ /* Task states returned by eTaskGetState. */
typedef enum typedef enum
{ {
eRunning = 0, /* A task is querying the state of itself, so must be running. */ eRunning = 0, /* A task is querying the state of itself, so must be running. */
eReady, /* The task being queried is in a ready or pending ready list. */ eReady, /* The task being queried is in a ready or pending ready list. */
eBlocked, /* The task being queried is in the Blocked state. */ eBlocked, /* The task being queried is in the Blocked state. */
eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */ eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */ eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
eInvalid /* Used as an 'invalid state' value. */ eInvalid /* Used as an 'invalid state' value. */
} eTaskState; } eTaskState;
/* Actions that can be performed when vTaskNotify() is called. */ /* Actions that can be performed when vTaskNotify() is called. */
typedef enum typedef enum
{ {
eNoAction = 0, /* Notify the task without updating its notify value. */ eNoAction = 0, /* Notify the task without updating its notify value. */
eSetBits, /* Set bits in the task's notification value. */ eSetBits, /* Set bits in the task's notification value. */
eIncrement, /* Increment the task's notification value. */ eIncrement, /* Increment the task's notification value. */
eSetValueWithOverwrite, /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */ eSetValueWithOverwrite, /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */
eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */ eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */
} eNotifyAction; } eNotifyAction;
/* /*
@ -138,7 +138,7 @@ typedef struct xMEMORY_REGION
typedef struct xTASK_PARAMETERS typedef struct xTASK_PARAMETERS
{ {
TaskFunction_t pvTaskCode; TaskFunction_t pvTaskCode;
const char * pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
configSTACK_DEPTH_TYPE usStackDepth; configSTACK_DEPTH_TYPE usStackDepth;
void * pvParameters; void * pvParameters;
UBaseType_t uxPriority; UBaseType_t uxPriority;
@ -153,23 +153,23 @@ typedef struct xTASK_PARAMETERS
* in the system. */ * in the system. */
typedef struct xTASK_STATUS typedef struct xTASK_STATUS
{ {
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */ TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
const char * pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
UBaseType_t xTaskNumber; /* A number unique to the task. */ UBaseType_t xTaskNumber; /* A number unique to the task. */
eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */ eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */ UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */ UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See https://www.FreeRTOS.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */ configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See https://www.FreeRTOS.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
StackType_t * pxStackBase; /* Points to the lowest address of the task's stack area. */ StackType_t * pxStackBase; /* Points to the lowest address of the task's stack area. */
configSTACK_DEPTH_TYPE usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */ configSTACK_DEPTH_TYPE usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
} TaskStatus_t; } TaskStatus_t;
/* Possible return values for eTaskConfirmSleepModeStatus(). */ /* Possible return values for eTaskConfirmSleepModeStatus(). */
typedef enum typedef enum
{ {
eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPRESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */ eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPRESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */
eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */ eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */ eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */
} eSleepModeStatus; } eSleepModeStatus;
/** /**
@ -347,7 +347,7 @@ typedef enum
*/ */
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode, BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const configSTACK_DEPTH_TYPE usStackDepth, const configSTACK_DEPTH_TYPE usStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
@ -357,7 +357,7 @@ typedef enum
/** /**
* task. h * task. h
* <pre> * <pre>
* TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, * TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
* const char *pcName, * const char *pcName,
* uint32_t ulStackDepth, * uint32_t ulStackDepth,
* void *pvParameters, * void *pvParameters,
@ -464,7 +464,7 @@ typedef enum
*/ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
const uint32_t ulStackDepth, const uint32_t ulStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
@ -859,10 +859,10 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
* vTaskDelayUntil() is the older version of xTaskDelayUntil() and does not * vTaskDelayUntil() is the older version of xTaskDelayUntil() and does not
* return a value. * return a value.
*/ */
#define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \ #define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \
{ \ { \
( void ) xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); \ ( void ) xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); \
} }
/** /**
@ -1475,7 +1475,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
* \defgroup pcTaskGetName pcTaskGetName * \defgroup pcTaskGetName pcTaskGetName
* \ingroup TaskUtils * \ingroup TaskUtils
*/ */
char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/** /**
* task. h * task. h
@ -1491,7 +1491,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin
* \defgroup pcTaskGetHandle pcTaskGetHandle * \defgroup pcTaskGetHandle pcTaskGetHandle
* \ingroup TaskUtils * \ingroup TaskUtils
*/ */
TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/** /**
* task.h * task.h
@ -1611,48 +1611,50 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) #if ( configCHECK_FOR_STACK_OVERFLOW > 0 )
/** /**
* task.h * task.h
* <pre>void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); </pre> * <pre>void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); </pre>
* *
* The application stack overflow hook is called when a stack overflow is detected for a task. * The application stack overflow hook is called when a stack overflow is detected for a task.
* *
* Details on stack overflow detection can be found here: https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html * Details on stack overflow detection can be found here: https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html
* *
* @param xTask the task that just exceeded its stack boundaries. * @param xTask the task that just exceeded its stack boundaries.
* @param pcTaskName A character string containing the name of the offending task. * @param pcTaskName A character string containing the name of the offending task.
*/ */
void vApplicationStackOverflowHook( TaskHandle_t xTask, void vApplicationStackOverflowHook( TaskHandle_t xTask,
char * pcTaskName ); char * pcTaskName );
#endif #endif
#if ( configUSE_TICK_HOOK > 0 ) #if ( configUSE_TICK_HOOK > 0 )
/**
* task.h /**
* <pre>void vApplicationTickHook( void ); </pre> * task.h
* * <pre>void vApplicationTickHook( void ); </pre>
* This hook function is called in the system tick handler after any OS work is completed. *
*/ * This hook function is called in the system tick handler after any OS work is completed.
*/
void vApplicationTickHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */ void vApplicationTickHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */
#endif #endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/**
* task.h /**
* <pre>void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) </pre> * task.h
* * <pre>void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) </pre>
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task TCB. This function is required when *
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION * This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task TCB. This function is required when
* * configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer *
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task * @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer * @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
*/ * @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer, StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */ uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
#endif #endif
/** /**
@ -1828,7 +1830,7 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
* \defgroup vTaskList vTaskList * \defgroup vTaskList vTaskList
* \ingroup TaskUtils * \ingroup TaskUtils
*/ */
void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/** /**
* task. h * task. h
@ -1882,7 +1884,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq
* \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats
* \ingroup TaskUtils * \ingroup TaskUtils
*/ */
void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/** /**
* task. h * task. h

View File

@ -1328,20 +1328,20 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* task.h * task.h
* <pre>void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) </pre> * <pre>void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) </pre>
* *
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when * This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION * configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
* *
* @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer * @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer
* @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task * @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task
* @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer * @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/ */
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer, StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize ); uint32_t * pulTimerTaskStackSize );
#endif #endif

View File

@ -314,6 +314,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
vListInitialise( &( pxQueue->xTasksWaitingToSend ) ); vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) ); vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
} }
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
} }
else else
@ -345,12 +346,12 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
if( ( uxQueueLength > ( UBaseType_t ) 0 ) && if( ( uxQueueLength > ( UBaseType_t ) 0 ) &&
( pxStaticQueue != NULL ) && ( pxStaticQueue != NULL ) &&
/* A queue storage area should be provided if the item size is not 0, and /* A queue storage area should be provided if the item size is not 0, and
* should not be provided if the item size is 0. */ * should not be provided if the item size is 0. */
( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) ) && ( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) ) &&
( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) ) ) ( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) ) )
{ {
#if ( configASSERT_DEFINED == 1 ) #if ( configASSERT_DEFINED == 1 )
{ {
/* Sanity check that the size of the structure used to declare a /* Sanity check that the size of the structure used to declare a

View File

@ -503,14 +503,15 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )
configASSERT( pxStreamBuffer ); configASSERT( pxStreamBuffer );
/* The code below reads xTail and then xHead. This is safe if the stream /* The code below reads xTail and then xHead. This is safe if the stream
buffer is updated once between the two reads - but not if the stream buffer * buffer is updated once between the two reads - but not if the stream buffer
is updated more than once between the two reads - hence the loop. */ * is updated more than once between the two reads - hence the loop. */
do do
{ {
xOriginalTail = pxStreamBuffer->xTail; xOriginalTail = pxStreamBuffer->xTail;
xSpace = pxStreamBuffer->xLength + pxStreamBuffer->xTail; xSpace = pxStreamBuffer->xLength + pxStreamBuffer->xTail;
xSpace -= pxStreamBuffer->xHead; xSpace -= pxStreamBuffer->xHead;
} while( xOriginalTail != pxStreamBuffer->xTail ); } while( xOriginalTail != pxStreamBuffer->xTail );
xSpace -= ( size_t ) 1; xSpace -= ( size_t ) 1;
if( xSpace >= pxStreamBuffer->xLength ) if( xSpace >= pxStreamBuffer->xLength )
@ -885,8 +886,8 @@ size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer )
/* The number of bytes available is greater than the number of bytes /* The number of bytes available is greater than the number of bytes
* required to hold the length of the next message, so another message * required to hold the length of the next message, so another message
* is available. */ * is available. */
( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempReturn, sbBYTES_TO_STORE_MESSAGE_LENGTH, pxStreamBuffer->xTail ); ( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempReturn, sbBYTES_TO_STORE_MESSAGE_LENGTH, pxStreamBuffer->xTail );
xReturn = ( size_t ) xTempReturn; xReturn = ( size_t ) xTempReturn;
} }
else else
{ {
@ -1009,7 +1010,7 @@ static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
if( xCount != ( size_t ) 0 ) if( xCount != ( size_t ) 0 )
{ {
/* Read the actual data and update the tail to mark the data as officially consumed. */ /* Read the actual data and update the tail to mark the data as officially consumed. */
pxStreamBuffer->xTail = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xCount, xNextTail); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */ pxStreamBuffer->xTail = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xCount, xNextTail ); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */
} }
return xCount; return xCount;

30
tasks.c
View File

@ -297,6 +297,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
#endif #endif
#if ( configUSE_NEWLIB_REENTRANT == 1 ) #if ( configUSE_NEWLIB_REENTRANT == 1 )
/* Allocate a Newlib reent structure that is specific to this task. /* Allocate a Newlib reent structure that is specific to this task.
* Note Newlib support has been included by popular demand, but is not * Note Newlib support has been included by popular demand, but is not
* used by the FreeRTOS maintainers themselves. FreeRTOS is not * used by the FreeRTOS maintainers themselves. FreeRTOS is not
@ -916,6 +917,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
/* This is used as an array index so must ensure it's not too large. */ /* This is used as an array index so must ensure it's not too large. */
configASSERT( uxPriority < configMAX_PRIORITIES ); configASSERT( uxPriority < configMAX_PRIORITIES );
if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES ) if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
{ {
uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U; uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U;
@ -5277,28 +5279,28 @@ TickType_t uxTaskResetEventItemValue( void )
{ {
configRUN_TIME_COUNTER_TYPE ulTotalTime, ulReturn; configRUN_TIME_COUNTER_TYPE ulTotalTime, ulReturn;
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE(); ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
/* For percentage calculations. */ /* For percentage calculations. */
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100; ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
/* Avoid divide by zero errors. */ /* Avoid divide by zero errors. */
if( ulTotalTime > ( configRUN_TIME_COUNTER_TYPE ) 0 ) if( ulTotalTime > ( configRUN_TIME_COUNTER_TYPE ) 0 )
{ {
ulReturn = xIdleTaskHandle->ulRunTimeCounter / ulTotalTime; ulReturn = xIdleTaskHandle->ulRunTimeCounter / ulTotalTime;
} }
else else
{ {
ulReturn = 0; ulReturn = 0;
} }
return ulReturn; return ulReturn;
} }
#endif #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
const BaseType_t xCanBlockIndefinitely ) const BaseType_t xCanBlockIndefinitely )
{ {
TickType_t xTimeToWake; TickType_t xTimeToWake;

View File

@ -57,8 +57,8 @@
#if ( configUSE_TIMERS == 1 ) #if ( configUSE_TIMERS == 1 )
/* Misc definitions. */ /* Misc definitions. */
#define tmrNO_DELAY ( ( TickType_t ) 0U ) #define tmrNO_DELAY ( ( TickType_t ) 0U )
#define tmrMAX_TIME_BEFORE_OVERFLOW ( ( TickType_t ) -1 ) #define tmrMAX_TIME_BEFORE_OVERFLOW ( ( TickType_t ) -1 )
/* The name assigned to the timer service task. This can be overridden by /* The name assigned to the timer service task. This can be overridden by
* defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */ * defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */
@ -363,11 +363,11 @@
configASSERT( ( xTimerPeriodInTicks > 0 ) ); configASSERT( ( xTimerPeriodInTicks > 0 ) );
/* Ensure the infrastructure used by the timer service task has been /* Ensure the infrastructure used by the timer service task has been
* created/initialised. */ * created/initialised. */
prvCheckForValidListAndQueue(); prvCheckForValidListAndQueue();
/* Initialise the timer structure members using the function /* Initialise the timer structure members using the function
* parameters. */ * parameters. */
pxNewTimer->pcTimerName = pcTimerName; pxNewTimer->pcTimerName = pcTimerName;
pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks; pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks;
pxNewTimer->pvTimerID = pvTimerID; pxNewTimer->pvTimerID = pvTimerID;
@ -521,7 +521,7 @@
/* Insert the timer into the appropriate list for the next expiry time. /* Insert the timer into the appropriate list for the next expiry time.
* If the next expiry time has already passed, advance the expiry time, * If the next expiry time has already passed, advance the expiry time,
* call the callback function, and try again. */ * call the callback function, and try again. */
while ( prvInsertTimerInActiveList( pxTimer, ( xExpiredTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xExpiredTime ) != pdFALSE ) while( prvInsertTimerInActiveList( pxTimer, ( xExpiredTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xExpiredTime ) != pdFALSE )
{ {
/* Advance the expiry time. */ /* Advance the expiry time. */
xExpiredTime += pxTimer->xTimerPeriodInTicks; xExpiredTime += pxTimer->xTimerPeriodInTicks;
@ -540,6 +540,7 @@
/* Remove the timer from the list of active timers. A check has already /* Remove the timer from the list of active timers. A check has already
* been performed to ensure the list is not empty. */ * been performed to ensure the list is not empty. */
( void ) uxListRemove( &( pxTimer->xTimerListItem ) ); ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
/* If the timer is an auto-reload timer then calculate the next /* If the timer is an auto-reload timer then calculate the next