]> git.sur5r.net Git - freertos/blob - Demo/Common/Utils/CommandInterpreter.h
Update a few util functions in the common demo area.
[freertos] / Demo / Common / Utils / CommandInterpreter.h
1 /*\r
2     FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
3         \r
4 \r
5     ***************************************************************************\r
6      *                                                                       *\r
7      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
8      *    Complete, revised, and edited pdf reference manuals are also       *\r
9      *    available.                                                         *\r
10      *                                                                       *\r
11      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
12      *    ensuring you get running as quickly as possible and with an        *\r
13      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
14      *    the FreeRTOS project to continue with its mission of providing     *\r
15      *    professional grade, cross platform, de facto standard solutions    *\r
16      *    for microcontrollers - completely free of charge!                  *\r
17      *                                                                       *\r
18      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
19      *                                                                       *\r
20      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
21      *                                                                       *\r
22     ***************************************************************************\r
23 \r
24 \r
25     This file is part of the FreeRTOS distribution.\r
26 \r
27     FreeRTOS is free software; you can redistribute it and/or modify it under\r
28     the terms of the GNU General Public License (version 2) as published by the\r
29     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
30     >>>NOTE<<< The modification to the GPL is included to allow you to\r
31     distribute a combined work that includes FreeRTOS without being obliged to\r
32     provide the source code for proprietary components outside of the FreeRTOS\r
33     kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
34     WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
35     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
36     more details. You should have received a copy of the GNU General Public\r
37     License and the FreeRTOS license exception along with FreeRTOS; if not it\r
38     can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
39     by writing to Richard Barry, contact details for whom are available on the\r
40     FreeRTOS WEB site.\r
41 \r
42     1 tab == 4 spaces!\r
43 \r
44     http://www.FreeRTOS.org - Documentation, latest information, license and\r
45     contact details.\r
46 \r
47     http://www.SafeRTOS.com - A version that is certified for use in safety\r
48     critical systems.\r
49 \r
50     http://www.OpenRTOS.com - Commercial support, development, porting,\r
51     licensing and training services.\r
52 */\r
53 \r
54 #ifndef COMMAND_INTERPRETER_H\r
55 #define COMMAND_INTERPRETER_H\r
56 \r
57 /* The prototype to which callback functions used to process command line\r
58 commands must comply.  This type will change when commands with parameters \r
59 are included. */\r
60 typedef const signed char * (*pdCOMMAND_LINE_CALLBACK)( void );\r
61 \r
62 /* The structure that defines command line commands.  A command line command\r
63 should be defined by declaring a const structure of this type. */\r
64 typedef struct xCOMMAND_LINE_INPUT\r
65 {\r
66         const signed char * const pcCommand;                    /* The command that causes pxCommandInterpreter to be executed.  For example "help".  Must be all lower case. */\r
67         const signed char * const pcHelpString;                 /* String that describes how to use the command.  Should start with the command itself, and end with "\r\n".  For exxample "help: Returns a list of all the commands\r\n". */\r
68         pdCOMMAND_LINE_CALLBACK pxCommandInterpreter;   /* A pointer to the callback function that will return the output generated by the command. */\r
69         const struct xCOMMAND_LINE_INPUT *pxNext;               /* A pointer to the next xCommandLinInput structure.  This should be NULL when the command is defined.  It will get filled in automatically when the command is registered. */\r
70 } xCommandLineInput;\r
71 \r
72 /*\r
73  * Register the command passed in using the pxCommandToRegister parameter.\r
74  * Registering a command adds the command to the list of commands that are\r
75  * handled by the command interpreter.  Once a command has been registered it\r
76  * can be executed from the command line.\r
77  */\r
78 void vCmdIntRegisterCommand( const xCommandLineInput *pxCommandToRegister );\r
79 \r
80 /*\r
81  * Runns the command interpreter for the command string "pcCommandInput".  If\r
82  * pcCommandInput is valid (the command has been registered) a string will be \r
83  * returned, and pcCmdIntProcessCommand must then be called repeatedly until \r
84  * NULL is returned.  If pcCommand pcCommandInput is not valid (the command is\r
85  * not recognised as a registered command) then an error message will be\r
86  * returned - and again pcCmdIntProcessCommand() must be called repeatedly\r
87  * until NULL is returned.\r
88  *\r
89  * pcCmdIntProcessCommand is not reentrant.  It must not be called from more\r
90  * than one task - or at least - by more than one task at a time.\r
91  */\r
92 const signed char *pcCmdIntProcessCommand( const signed char *pcCommandInput );\r
93 \r
94 #endif /* COMMAND_INTERPRETER_H */\r
95 \r
96 \r
97 \r
98 \r
99 \r
100 \r
101 \r
102 \r
103 \r
104 \r
105 \r
106 \r
107 \r