00001 /*This file has been prepared for Doxygen automatic documentation generation.*/ 00019 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00020 * 00021 * Redistribution and use in source and binary forms, with or without 00022 * modification, are permitted provided that the following conditions are met: 00023 * 00024 * 1. Redistributions of source code must retain the above copyright notice, this 00025 * list of conditions and the following disclaimer. 00026 * 00027 * 2. Redistributions in binary form must reproduce the above copyright notice, 00028 * this list of conditions and the following disclaimer in the documentation 00029 * and/or other materials provided with the distribution. 00030 * 00031 * 3. The name of Atmel may not be used to endorse or promote products derived 00032 * from this software without specific prior written permission. 00033 * 00034 * 4. This software may only be redistributed and used in connection with an Atmel 00035 * AVR product. 00036 * 00037 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00038 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00039 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00040 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00041 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00042 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00043 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00045 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00046 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00047 * 00048 */ 00049 00050 #ifndef __SHELL_H__ 00051 #define __SHELL_H__ 00052 00053 #include "compiler.h" 00054 #include "FreeRTOS.h" 00055 00056 #include "supervisor.h" 00057 00058 //_____ M A C R O S ________________________________________________________ 00059 00060 // Special char values 00061 #define CR '\r' 00062 #define LF '\n' 00063 #define CTRL_C 0x03 00064 #define BKSPACE_CHAR '\b' 00065 #define ABORT_CHAR CTRL_C 00066 #define CRLF "\r\n" 00067 #define CTRL_Q 0x11 00068 #define QUIT_APPEND CTRL_Q 00069 00070 #define OK_CRLF "OK"CRLF 00071 #define ERROR_CRLF "Error"CRLF 00072 00073 #define SHELL_ERRMSG_NOTIMPLEMENTED "NOT IMPLEMENTED"CRLF 00074 #define SHELL_ERRMSG_CONFIGERROR ERROR_CRLF"COULD NOT SET CONFIG"CRLF 00075 #define SHELL_ERRMSG_MEMALLOC ERROR_CRLF"Memory allocation failed"CRLF 00076 #define SHELL_ERRMSG_MAINTENANCEMODE ERROR_CRLF"Command unavailable in maintenance mode"CRLF 00077 #define SHELL_MSG_REBOOT "Reboot to take effect"CRLF 00078 #define SHELL_MSG_CONFIG_SET "config updated"CRLF 00079 00081 #define SHELL_MAX_MSGOUT_LEN 128 00082 00086 typedef enum { 00087 SHELL_EXECSTATUS_OK, // The command was successfully executed. 00088 SHELL_EXECSTATUS_OK_NO_FREE, // The command was successfully executed, but the caller has not to free buffer. 00089 SHELL_EXECSTATUS_KO, // The command execution failed. 00090 } eExecStatus; 00091 00092 00109 typedef eExecStatus (*pfShellCmd) ( eModId xModId, signed short FsNavId, 00110 int ac, signed portCHAR *av[], 00111 signed portCHAR **ppcStringReply); 00112 00113 00128 eExecStatus Shell_exec( signed portCHAR *pcStringCmd, 00129 eModId xModId, 00130 signed short FsNavId, 00131 signed portCHAR **ppcStringReply); 00132 00140 void v_shell_Print_String_To_Requester_Stream( eModId xModId, 00141 const signed portCHAR *pcStringToDisplay ); 00142 00143 #endif // __SHELL_H__