ATMEL: ushell_task.h Source File

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# ushell_task.h

Go to the documentation of this file.

    00001 /*This file is prepared for Doxygen automatic documentation generation.*/
    00013
    00014 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
    00015  *
    00016  * Redistribution and use in source and binary forms, with or without
    00017  * modification, are permitted provided that the following conditions are met:
    00018  *
    00019  * 1. Redistributions of source code must retain the above copyright notice,
    00020  * this list of conditions and the following disclaimer.
    00021  *
    00022  * 2. Redistributions in binary form must reproduce the above copyright notice,
    00023  * this list of conditions and the following disclaimer in the documentation
    00024  * and/or other materials provided with the distribution.
    00025  *
    00026  * 3. The name of Atmel may not be used to endorse or promote products derived
    00027  * from this software without specific prior written permission.
    00028  *
    00029  * 4. This software may only be redistributed and used in connection with an Atmel
    00030  * AVR product.
    00031  *
    00032  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
    00033  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00034  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
    00035  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
    00036  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00037  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    00038  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00039  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    00041  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00042  */
    00043
    00044 #ifndef _USHELL_TASK_H_
    00045 #define _USHELL_TASK_H_
    00046
    00047 //_____ I N C L U D E S ____________________________________________________
    00048
    00049 #include "config.h"
    00050 #include "modules/file_system/fs_com.h"
    00051
    00052 //_____ M A C R O S ________________________________________________________
    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 // String values for commands
    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 // String Messages
    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 //_____ D E C L A R A T I O N S ____________________________________________
    00213
    00214 void ushell_task_init   (void);
    00215 void ushell_task        (void);
    00216
    00217 #endif  // _USHELL_TASK_H_