00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef _USHELL_TASK_H_
00045 #define _USHELL_TASK_H_
00046
00047
00048
00049 #include "config.h"
00050 #include "modules/file_system/fs_com.h"
00051
00052
00053
00054
00057
00058 #define ASCII_CR '\r'
00059 #define ASCII_LF '\n'
00060 #define ASCII_BKSPACE '\b'
00061 #define ASCII_ESCAPE 0x1B
00062 #define ASCII_CTRL_Q 0x11
00063 #define ASCII_CTRL_C 0x03
00065
00066
00069
00070 #define CMD_NONE 0x00
00071 #define CMD_NB_DRIVE 0x01
00072 #define CMD_DF 0x02
00073 #define CMD_FORMAT 0x03
00074 #define CMD_MOUNT 0x04
00075 #define CMD_SPACE 0x05
00076 #define CMD_LS 0x06
00077 #define CMD_LS_MORE 0x07
00078 #define CMD_CD 0x08
00079 #define CMD_UP 0x09
00080 #define CMD_CAT 0x0A
00081 #define CMD_CAT_MORE 0x0B
00082 #define CMD_HELP 0x0C
00083 #define CMD_MKDIR 0x0D
00084 #define CMD_TOUCH 0x0E
00085 #define CMD_RM 0x0F
00086 #define CMD_APPEND 0x10
00087 #define CMD_SET_ID 0x11
00088 #define CMD_GOTO_ID 0x12
00089 #define CMD_CP 0x13
00090 #define CMD_MV 0x14
00091 #define CMD_SYNC 0x15
00092 #define CMD_PERFORM 0x16
00093 #define CMD_REBOOT 0x17
00094
00095 #define CMD_LS_USB 0x18
00096 #define CMD_USB_SUSPEND 0x19
00097 #define CMD_USB_RESUME 0x1A
00098 #define CMD_USB_FORCE_ENUM 0x1B
00099
00100 #define CMD_DFU_ERASE 0x1C
00101 #define CMD_DFU_LOAD 0x1D
00102 #define CMD_DFU_START 0x1E
00103
00104 #define CMD_HID_ENTER_DFU 0x1F
00105 #define CMD_HID_GET_INFO 0x20
00106
00107
00108
00109 #define STR_DISK "disk"
00110 #define STR_DF "df"
00111 #define STR_FORMAT "format"
00112 #define STR_MOUNT "mount"
00113 #define STR_SPACE "space"
00114 #define STR_LS "ls"
00115 #define STR_LS_MORE "ls|more"
00116 #define STR_CD "cd"
00117 #define STR_UP "cd.."
00118 #define STR_CAT "cat"
00119 #define STR_CAT_MORE "cat|more"
00120 #define STR_HELP "help"
00121 #define STR_MKDIR "mkdir"
00122 #define STR_TOUCH "touch"
00123 #define STR_RM "rm"
00124 #define STR_APPEND "append"
00125 #define STR_MARK "mark"
00126 #define STR_GOTO "goto"
00127 #define STR_CP "cp"
00128 #define STR_MV "mv"
00129 #define STR_SYNC "sync"
00130 #define STR_PERFORM "perf"
00131 #define STR_REBOOT "reboot"
00132
00133 #define STR_LS_USB "lsusb"
00134 #define STR_USB_SUSPEND "suspend"
00135 #define STR_USB_RESUME "resume"
00136 #define STR_USB_FORCE_ENUM "enumerate"
00137
00138 #define STR_DFU_ERASE "dfu_erase"
00139 #define STR_DFU_LOAD "dfu_prog"
00140 #define STR_DFU_START "dfu_start"
00141
00142 #define STR_HID_GET_INFO "hid_get"
00143 #define STR_HID_ENTER_DFU "hid_dfu"
00144
00145
00146 #define MSG_PROMPT "$>"
00147 #define MSG_WELCOME "\x0C" \
00148 "--------------------------\r\n" \
00149 " ATMEL AVR uShell\r\n" \
00150 "--------------------------\r\n"
00151 #define MSG_EXIT "\x0C" \
00152 "------------------------\r\n" \
00153 "uShell not available\r\n" \
00154 "------------------------\r\n"
00155 #define MSG_ER_CMD_NOT_FOUND "Command not found\r\n"
00156 #define MSG_ER_MOUNT "Unable to mount drive\r\n"
00157 #define MSG_ER_DRIVE "Drive does not exist\r\n"
00158 #define MSG_ER_RM "Can not erase, if the name is a directory, check it is empty\r\n"
00159 #define MSG_ER_UNKNOWN_FILE "Unknown file\r\n"
00160 #define MSG_ER_FORMAT "Format fails\r\n"
00161 #define MSG_APPEND_WELCOME "\r\nSimple text editor, enter char to append, ^q to exit and save\r\n"
00162 #define MSG_HELP "\r\n---- Ushell Commands:\r\n" \
00163 " HELP Provides Help information for Ushell commands.\r\n" \
00164 " ! Previous command (history).\r\n" \
00165 " $ Next command (history).\r\n" \
00166 "\r\n---- File Systems Commands:\r\n" \
00167 " DISK Displays the number of drives.\r\n" \
00168 " DF Displays free space of all connected drives.\r\n" \
00169 " FORMAT [/A:] Formats drive, /A drive letter (a, b, etc.).\r\n" \
00170 " MOUNT [/A:] Mounts drive, /A drive letter (a, b, etc.).\r\n" \
00171 " [/A:] Mounts drive, /A drive letter (a, b, etc.).\r\n" \
00172 " SPACE Displays drive capacity.\r\n" \
00173 " LS [|MORE] Displays a list of files and subdirectories in a directory.\r\n" \
00174 " CD [..][path] Changes the current directory.\r\n" \
00175 " CAT [file name] Displays file contents.\r\n" \
00176 " MKDIR [dir name] Creates a directory.\r\n" \
00177 " TOUCH [file name] Creates a file.\r\n" \
00178 " RM [*][file name] Deletes one or more files or directories.\r\n" \
00179 " APPEND [file name] Appends file from terminal input\r\n" \
00180 " MARK Record the current directory in bookmark\r\n" \
00181 " GOTO Go to bookmarked directory\r\n" \
00182 " CP [file name][path\\] Copys file to bookmarked directory or to path argument.\r\n" \
00183 " MV [path] [new name] Renames file from path with new name.\r\n" \
00184 " SYNC [src_path] [dest_path] Synchronizes a folder content with other folder.\r\n" \
00185 " PERF [/A:] [/A:] Perfoms the transfer rate between two devices.\r\n" \
00186 " REBOOT Reset the application.\r\n" \
00187 "\r\n---- USB Host Commands:\r\n" \
00188 " LSUSB Displays USB information.\r\n" \
00189 " SUSPEND Suspends USB bus activity.\r\n" \
00190 " RESUME Resumes USB bus activity.\r\n" \
00191 " ENUMERATE Forces a reset on USB line and restart the enumaration.\r\n" \
00192 "\r\n---- USB Host DFU Commands:\r\n" \
00193 " DFU_ERASE Erase target.\r\n" \
00194 " DFU_PROG [path] Program target with a HEX file.\r\n" \
00195 " DFU_START Start target.\r\n" \
00196 "\r\n---- USB Host HID Generic Commands:\r\n" \
00197 " HID_GET Dispalys information about the target connected at HID.\r\n" \
00198 " HID_DFU Enters in DFU mode the target connected at HID.\r\n" \
00199
00200 #define MSG_NO_DEVICE "Not currently applicable to supported connected device(s) if any\r\n"
00201 #define MSG_REMOTE_WAKEUP_OK "Device supports remote wake-up\r\n"
00202 #define MSG_REMOTE_WAKEUP_KO "Device does not support remote wake-up\r\n"
00203 #define MSG_SELF_POWERED "Device is self-powered\r\n"
00204 #define MSG_BUS_POWERED "Device is bus-powered\r\n"
00205 #define MSG_USB_SUSPENDED "USB is suspended!\r\n"
00206 #define MSG_OK "ok\r\n"
00207 #define MSG_KO "FAIL\r\n"
00208 #define MSG_DEVICE_FULL_SPEED "Device is full-speed\r\n"
00209 #define MSG_DEVICE_LOW_SPEED "Device is low-speed\r\n"
00210 #define MSG_ER_PASTE "Paste Fail\r\n"
00211
00212
00213
00214 void ushell_task_init (void);
00215 void ushell_task (void);
00216
00217 #endif // _USHELL_TASK_H_