SAM4S-EK_FreeRTOS+FAT-SL  1.0
An example project to test the functionality of FreeRTOS+FAT-SL using SD card as data storage medium
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
FreeRTOS_CLI.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS+CLI V1.0.3 (C) 2014 Real Time Engineers ltd. All rights reserved.
3  *
4  * This file is part of the FreeRTOS+CLI distribution. The FreeRTOS+CLI license
5  * terms are different to the FreeRTOS license terms.
6  *
7  * FreeRTOS+CLI uses a dual license model that allows the software to be used
8  * under a standard GPL open source license, or a commercial license. The
9  * standard GPL license (unlike the modified GPL license under which FreeRTOS
10  * itself is distributed) requires that all software statically linked with
11  * FreeRTOS+CLI is also distributed under the same GPL V2 license terms.
12  * Details of both license options follow:
13  *
14  * - Open source licensing -
15  * FreeRTOS+CLI is a free download and may be used, modified, evaluated and
16  * distributed without charge provided the user adheres to version two of the
17  * GNU General Public License (GPL) and does not remove the copyright notice or
18  * this text. The GPL V2 text is available on the gnu.org web site, and on the
19  * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.
20  *
21  * - Commercial licensing -
22  * Businesses and individuals that for commercial or other reasons cannot comply
23  * with the terms of the GPL V2 license must obtain a low cost commercial
24  * license before incorporating FreeRTOS+CLI into proprietary software for
25  * distribution in any form. Commercial licenses can be purchased from
26  * http://shop.freertos.org/cli and do not require any source files to be
27  * changed.
28  *
29  * FreeRTOS+CLI is distributed in the hope that it will be useful. You cannot
30  * use FreeRTOS+CLI unless you agree that you use the software 'as is'.
31  * FreeRTOS+CLI is provided WITHOUT ANY WARRANTY; without even the implied
32  * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
33  * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they
34  * implied, expressed, or statutory.
35  *
36  * 1 tab == 4 spaces!
37  *
38  * http://www.FreeRTOS.org
39  * http://www.FreeRTOS.org/FreeRTOS-Plus
40  *
41  */
42 
43 #ifndef COMMAND_INTERPRETER_H
44 #define COMMAND_INTERPRETER_H
45 
46 /* The prototype to which callback functions used to process command line
47 commands must comply. pcWriteBuffer is a buffer into which the output from
48 executing the command can be written, xWriteBufferLen is the length, in bytes of
49 the pcWriteBuffer buffer, and pcCommandString is the entire string as input by
50 the user (from which parameters can be extracted).*/
51 typedef portBASE_TYPE (*pdCOMMAND_LINE_CALLBACK)( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
52 
53 /* The structure that defines command line commands. A command line command
54 should be defined by declaring a const structure of this type. */
55 typedef struct xCOMMAND_LINE_INPUT
56 {
57  const char * const pcCommand; /* The command that causes pxCommandInterpreter to be executed. For example "help". Must be all lower case. */
58  const char * const pcHelpString; /* String that describes how to use the command. Should start with the command itself, and end with "\r\n". For example "help: Returns a list of all the commands\r\n". */
59  const pdCOMMAND_LINE_CALLBACK pxCommandInterpreter; /* A pointer to the callback function that will return the output generated by the command. */
60  int8_t cExpectedNumberOfParameters; /* Commands expect a fixed number of parameters, which may be zero. */
62 
63 /* For backward compatibility. */
64 #define xCommandLineInput CLI_Command_Definition_t
65 
66 /*
67  * Register the command passed in using the pxCommandToRegister parameter.
68  * Registering a command adds the command to the list of commands that are
69  * handled by the command interpreter. Once a command has been registered it
70  * can be executed from the command line.
71  */
72 portBASE_TYPE FreeRTOS_CLIRegisterCommand( const CLI_Command_Definition_t * const pxCommandToRegister );
73 
74 /*
75  * Runs the command interpreter for the command string "pcCommandInput". Any
76  * output generated by running the command will be placed into pcWriteBuffer.
77  * xWriteBufferLen must indicate the size, in bytes, of the buffer pointed to
78  * by pcWriteBuffer.
79  *
80  * FreeRTOS_CLIProcessCommand should be called repeatedly until it returns pdFALSE.
81  *
82  * pcCmdIntProcessCommand is not reentrant. It must not be called from more
83  * than one task - or at least - by more than one task at a time.
84  */
85 portBASE_TYPE FreeRTOS_CLIProcessCommand( const char * const pcCommandInput, char * pcWriteBuffer, size_t xWriteBufferLen );
86 
87 /*-----------------------------------------------------------*/
88 
89 /*
90  * A buffer into which command outputs can be written is declared in the
91  * main command interpreter, rather than in the command console implementation,
92  * to allow application that provide access to the command console via multiple
93  * interfaces to share a buffer, and therefore save RAM. Note, however, that
94  * the command interpreter itself is not re-entrant, so only one command
95  * console interface can be used at any one time. For that reason, no attempt
96  * is made to provide any mutual exclusion mechanism on the output buffer.
97  *
98  * FreeRTOS_CLIGetOutputBuffer() returns the address of the output buffer.
99  */
100 char *FreeRTOS_CLIGetOutputBuffer( void );
101 
102 /*
103  * Return a pointer to the xParameterNumber'th word in pcCommandString.
104  */
105 const char *FreeRTOS_CLIGetParameter( const char *pcCommandString, unsigned portBASE_TYPE uxWantedParameter, portBASE_TYPE *pxParameterStringLength );
106 
107 #endif /* COMMAND_INTERPRETER_H */
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
char * FreeRTOS_CLIGetOutputBuffer(void)
Definition: FreeRTOS_CLI.c:217
const char * FreeRTOS_CLIGetParameter(const char *pcCommandString, unsigned portBASE_TYPE uxWantedParameter, portBASE_TYPE *pxParameterStringLength)
Definition: FreeRTOS_CLI.c:223
struct xCOMMAND_LINE_INPUT CLI_Command_Definition_t
portBASE_TYPE FreeRTOS_CLIProcessCommand(const char *const pcCommandInput, char *pcWriteBuffer, size_t xWriteBufferLen)
Definition: FreeRTOS_CLI.c:142
int8_t cExpectedNumberOfParameters
Definition: FreeRTOS_CLI.h:60
const char *const pcHelpString
Definition: FreeRTOS_CLI.h:58
portBASE_TYPE(* pdCOMMAND_LINE_CALLBACK)(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
Definition: FreeRTOS_CLI.h:51
const pdCOMMAND_LINE_CALLBACK pxCommandInterpreter
Definition: FreeRTOS_CLI.h:59
portBASE_TYPE FreeRTOS_CLIRegisterCommand(const CLI_Command_Definition_t *const pxCommandToRegister)
Definition: FreeRTOS_CLI.c:101
#define portBASE_TYPE
Definition: portmacro.h:91
const char *const pcCommand
Definition: FreeRTOS_CLI.h:57