X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=Demo%2FCommon%2FUtils%2FCommandInterpreter.h;h=4173056093900a0a534215c80db6b098cbebb958;hb=53d1f4146cde336460d7df6c6a178632febaa6bb;hp=e3d01614be02f23b517d84edf49a642b44fbbf7e;hpb=63ef73b0bdaaf8e0889703f02a5ef370bfd08e7e;p=freertos diff --git a/Demo/Common/Utils/CommandInterpreter.h b/Demo/Common/Utils/CommandInterpreter.h index e3d01614b..417305609 100644 --- a/Demo/Common/Utils/CommandInterpreter.h +++ b/Demo/Common/Utils/CommandInterpreter.h @@ -56,15 +56,17 @@ /* The prototype to which callback functions used to process command line commands must comply. This type will change when commands with parameters -are included. */ -typedef const signed char * (*pdCOMMAND_LINE_CALLBACK)( void ); +are included. pcWriteBuffer is a buffer into which the output from executing +the command can be written, xWriteBufferLen is the length, in bytes, of the +pcWriteBuffer buffer. */ +typedef portBASE_TYPE (*pdCOMMAND_LINE_CALLBACK)( signed char *pcWriteBuffer, size_t xWriteBufferLen ); /* The structure that defines command line commands. A command line command should be defined by declaring a const structure of this type. */ typedef struct xCOMMAND_LINE_INPUT { const signed char * const pcCommand; /* The command that causes pxCommandInterpreter to be executed. For example "help". Must be all lower case. */ - 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". */ + 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 example "help: Returns a list of all the commands\r\n". */ const pdCOMMAND_LINE_CALLBACK pxCommandInterpreter; /* A pointer to the callback function that will return the output generated by the command. */ } xCommandLineInput; @@ -77,18 +79,17 @@ typedef struct xCOMMAND_LINE_INPUT portBASE_TYPE xCmdIntRegisterCommand( const xCommandLineInput * const pxCommandToRegister ); /* - * Runns the command interpreter for the command string "pcCommandInput". If - * pcCommandInput is valid (the command has been registered) a string will be - * returned, and pcCmdIntProcessCommand must then be called repeatedly until - * NULL is returned. If pcCommand pcCommandInput is not valid (the command is - * not recognised as a registered command) then an error message will be - * returned - and again pcCmdIntProcessCommand() must be called repeatedly - * until NULL is returned. + * Runs the command interpreter for the command string "pcCommandInput". Any + * output generated by running the command will be placed into pcWriteBuffer. + * xWriteBufferLen must indicate the size, in bytes, of the buffer pointed to + * by pcWriteBuffer. + * + * xCmdIntProcessCommand should be called repeatedly until it returns pdFALSE. * * pcCmdIntProcessCommand is not reentrant. It must not be called from more * than one task - or at least - by more than one task at a time. */ -const signed char *pcCmdIntProcessCommand( const signed char * const pcCommandInput ); +portBASE_TYPE xCmdIntProcessCommand( const signed char * const pcCommandInput, signed char * pcWriteBuffer, size_t xWriteBufferLen ); #endif /* COMMAND_INTERPRETER_H */