Added support for static memory allocation in FreeRTOS-Plus-CLI (#983)

* Added support for static memory allocation in FreeRTOS-Plus-CLI

* Removed relative include path

* removed whitespace changes

* Removed whitespace changes

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix spell check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Marc-André Harvey <marc-andre.harvey@d-ta.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
tabarnakos
2023-04-13 10:32:41 -04:00
committed by GitHub
parent 1309654d6f
commit 4727d6b3cc
3 changed files with 101 additions and 58 deletions

View File

@@ -1,6 +1,6 @@
/*
* FreeRTOS+CLI V1.0.4
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@@ -50,6 +50,13 @@ typedef struct xCOMMAND_LINE_INPUT
int8_t cExpectedNumberOfParameters; /* Commands expect a fixed number of parameters, which may be zero. */
} CLI_Command_Definition_t;
/* The structure that defines a command line list entry. */
typedef struct xCOMMAND_INPUT_LIST
{
const CLI_Command_Definition_t *pxCommandLineDefinition;
struct xCOMMAND_INPUT_LIST *pxNext;
} CLI_Definition_List_Item_t;
/* For backward compatibility. */
#define xCommandLineInput CLI_Command_Definition_t
@@ -59,7 +66,18 @@ typedef struct xCOMMAND_LINE_INPUT
* handled by the command interpreter. Once a command has been registered it
* can be executed from the command line.
*/
BaseType_t FreeRTOS_CLIRegisterCommand( const CLI_Command_Definition_t * const pxCommandToRegister );
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
BaseType_t FreeRTOS_CLIRegisterCommand( const CLI_Command_Definition_t * const pxCommandToRegister );
#endif
/*
* Static version of the above function which allows the application writer
* to supply the memory used for a command line list entry.
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t FreeRTOS_CLIRegisterCommandStatic( const CLI_Command_Definition_t * const pxCommandToRegister,
CLI_Definition_List_Item_t * pxCliDefinitionListItemBuffer );
#endif
/*
* Runs the command interpreter for the command string "pcCommandInput". Any
@@ -102,15 +120,3 @@ const char *FreeRTOS_CLIGetParameter( const char *pcCommandString, UBaseType_t u
#endif /* COMMAND_INTERPRETER_H */