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