add scsi write10 & test unit ready
done copy command implement get_fattime using __DATE__ and number of calls
This commit is contained in:
@@ -135,7 +135,7 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGUARM</Key>
|
||||
<Name>(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0)</Name>
|
||||
<Name></Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
@@ -158,24 +158,7 @@
|
||||
<Name>-O975 -S0 -C0 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>269</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>C:\Users\hathach\Dropbox\tinyusb\workspace\tinyusb\demos\host\src\cli.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
@@ -387,24 +370,7 @@
|
||||
<Name>-O975 -S0 -C0 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>269</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>C:\Users\hathach\Dropbox\tinyusb\workspace\tinyusb\demos\host\src\cli.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
@@ -458,10 +424,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>1</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>195</TopLine>
|
||||
<CurrentLine>200</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
@@ -476,7 +442,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>94</TopLine>
|
||||
<TopLine>125</TopLine>
|
||||
<CurrentLine>145</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\cdc_serial_app.c</PathWithFileName>
|
||||
@@ -492,7 +458,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>136</TopLine>
|
||||
<TopLine>167</TopLine>
|
||||
<CurrentLine>180</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\keyboard_app.c</PathWithFileName>
|
||||
@@ -508,7 +474,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>44</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>120</TopLine>
|
||||
<TopLine>121</TopLine>
|
||||
<CurrentLine>127</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\mouse_app.c</PathWithFileName>
|
||||
@@ -538,10 +504,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>1</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>111</TopLine>
|
||||
<CurrentLine>125</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\msc_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>msc_app.c</FilenameWithoutPath>
|
||||
@@ -554,10 +520,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>24</ColumnNumber>
|
||||
<ColumnNumber>27</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>11</CurrentLine>
|
||||
<TopLine>355</TopLine>
|
||||
<CurrentLine>367</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\cli.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cli.c</FilenameWithoutPath>
|
||||
@@ -596,7 +562,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>139</TopLine>
|
||||
<TopLine>140</TopLine>
|
||||
<CurrentLine>142</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\boards\embedded_artists\board_ea4357.c</PathWithFileName>
|
||||
@@ -612,7 +578,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>6</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>95</TopLine>
|
||||
<TopLine>125</TopLine>
|
||||
<CurrentLine>135</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
|
||||
@@ -748,7 +714,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>25</TopLine>
|
||||
<TopLine>56</TopLine>
|
||||
<CurrentLine>76</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\tusb.c</PathWithFileName>
|
||||
@@ -812,7 +778,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>483</TopLine>
|
||||
<TopLine>491</TopLine>
|
||||
<CurrentLine>501</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
|
||||
@@ -826,10 +792,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<ColumnNumber>38</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>602</TopLine>
|
||||
<CurrentLine>605</CurrentLine>
|
||||
<TopLine>479</TopLine>
|
||||
<CurrentLine>484</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\ehci\ehci.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ehci.c</FilenameWithoutPath>
|
||||
@@ -986,10 +952,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<ColumnNumber>1</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<TopLine>110</TopLine>
|
||||
<CurrentLine>118</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\class\msc_host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>msc_host.c</FilenameWithoutPath>
|
||||
@@ -1012,7 +978,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>548</TopLine>
|
||||
<TopLine>549</TopLine>
|
||||
<CurrentLine>553</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_uart.c</PathWithFileName>
|
||||
@@ -1114,10 +1080,10 @@
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<ColumnNumber>26</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>140</TopLine>
|
||||
<CurrentLine>158</CurrentLine>
|
||||
<TopLine>145</TopLine>
|
||||
<CurrentLine>154</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_LPC43xx.s</FilenameWithoutPath>
|
||||
@@ -1138,10 +1104,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>46</ColumnNumber>
|
||||
<ColumnNumber>45</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>17</TopLine>
|
||||
<CurrentLine>30</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>10</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>diskio.c</FilenameWithoutPath>
|
||||
|
||||
@@ -57,26 +57,39 @@ typedef enum {
|
||||
CLI_ERROR_NONE = 0,
|
||||
CLI_ERROR_INVALID_PARA,
|
||||
CLI_ERROR_INVALID_PATH,
|
||||
CLI_ERROR_FILE_EXISTED,
|
||||
CLI_ERROR_FAILED
|
||||
}cli_error_t;
|
||||
|
||||
static char const * const cli_error_message[] =
|
||||
{
|
||||
[CLI_ERROR_NONE ] = 0,
|
||||
[CLI_ERROR_INVALID_PARA ] = "Invalid parameter(s)",
|
||||
[CLI_ERROR_INVALID_PATH ] = "No such file or directory",
|
||||
[CLI_ERROR_FILE_EXISTED ] = "file or directory already exists",
|
||||
[CLI_ERROR_FAILED ] = "failed to execute"
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// CLI Database definition
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// command, function, description
|
||||
#define CLI_COMMAND_TABLE(ENTRY) \
|
||||
ENTRY(unknown , cli_cmd_unknown , NULL) \
|
||||
ENTRY(help , cli_cmd_help , NULL) \
|
||||
ENTRY(ls , cli_cmd_list , "list items in current directory") \
|
||||
ENTRY(cd , cli_cmd_changedir, "change current directory") \
|
||||
ENTRY(cat , cli_cmd_cat , "display contents of a text file") \
|
||||
ENTRY(unknown , cli_cmd_unknown , NULL ) \
|
||||
ENTRY(help , cli_cmd_help , NULL ) \
|
||||
ENTRY(cls , cli_cmd_clear , "Clear the screen." ) \
|
||||
ENTRY(ls , cli_cmd_list , "List information about the FILEs (the current directory by default).") \
|
||||
ENTRY(cd , cli_cmd_changedir, "change the current directory." ) \
|
||||
ENTRY(cat , cli_cmd_cat , "display contents of a text file." ) \
|
||||
ENTRY(cp , cli_cmd_copy , "Copies one or more files to another location." ) \
|
||||
ENTRY(mkdir , cli_cmd_mkdir , "Create a DIRECTORY, if it does not already exist." ) \
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Expands the function to have the standard function signature
|
||||
//--------------------------------------------------------------------+
|
||||
#define CLI_PROTOTYPE_EXPAND(command, function, description) \
|
||||
cli_error_t function(char const *);
|
||||
cli_error_t function(char *);
|
||||
|
||||
CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND);
|
||||
|
||||
@@ -116,38 +129,38 @@ char const* const cli_description_tbl[] =
|
||||
#define CMD_LOOKUP_EXPAND(command, function, description)\
|
||||
[CLI_CMDTYPE_##command] = function,\
|
||||
|
||||
typedef cli_error_t (* const cli_cmdfunc_t)(char const *);
|
||||
typedef cli_error_t (* const cli_cmdfunc_t)(char *);
|
||||
static cli_cmdfunc_t cli_command_tbl[] =
|
||||
{
|
||||
CLI_COMMAND_TABLE(CMD_LOOKUP_EXPAND)
|
||||
};
|
||||
|
||||
|
||||
|
||||
static char const * const cli_error_message[] =
|
||||
{
|
||||
[CLI_ERROR_NONE ] = 0,
|
||||
[CLI_ERROR_INVALID_PARA ] = "Invalid parameter(s)",
|
||||
[CLI_ERROR_INVALID_PATH ] = "No such file or directory",
|
||||
[CLI_ERROR_FAILED ] = "failed to execute"
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
static char cli_buffer[CLI_MAX_BUFFER];
|
||||
|
||||
uint8_t fileread_buffer[CLI_FILE_READ_BUFFER] TUSB_CFG_ATTR_USBRAM;
|
||||
|
||||
static char volume_label[20];
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
// NOTES: prompt re-use cli_buffer --> should not be called when cli_buffer has contents
|
||||
void cli_command_prompt(void)
|
||||
{
|
||||
f_getcwd(cli_buffer, CLI_MAX_BUFFER);
|
||||
printf("\n%s %c%s\n$ ",
|
||||
(volume_label[0] !=0) ? volume_label : "No Label",
|
||||
'E'+cli_buffer[0]-'0',
|
||||
cli_buffer+1);
|
||||
|
||||
memclr_(cli_buffer, CLI_MAX_BUFFER);
|
||||
}
|
||||
|
||||
void cli_init(void)
|
||||
{
|
||||
memclr_(cli_buffer, CLI_MAX_BUFFER);
|
||||
f_getlabel(NULL, volume_label, NULL);
|
||||
}
|
||||
|
||||
void cli_poll(char ch)
|
||||
@@ -192,11 +205,7 @@ void cli_poll(char ch)
|
||||
if (CLI_ERROR_NONE != error) puts(cli_error_message[error]); // error message output if any
|
||||
|
||||
//------------- print out current path -------------//
|
||||
f_getcwd(cli_buffer, CLI_MAX_BUFFER);
|
||||
printf("\nMSC %c%s\n$ ",
|
||||
'E'+cli_buffer[0]-'0',
|
||||
cli_buffer+1);
|
||||
memclr_(cli_buffer, CLI_MAX_BUFFER);
|
||||
cli_command_prompt();
|
||||
}
|
||||
else if (ch=='\t') // \t may be used for auto-complete later
|
||||
{
|
||||
@@ -207,7 +216,7 @@ void cli_poll(char ch)
|
||||
//--------------------------------------------------------------------+
|
||||
// UNKNOWN Command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_unknown(char const * para)
|
||||
cli_error_t cli_cmd_unknown(char * para)
|
||||
{
|
||||
puts("unknown command, please type \"help\" for list of supported commands");
|
||||
return CLI_ERROR_NONE;
|
||||
@@ -216,7 +225,7 @@ cli_error_t cli_cmd_unknown(char const * para)
|
||||
//--------------------------------------------------------------------+
|
||||
// HELP command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_help(char const * para)
|
||||
cli_error_t cli_cmd_help(char * para)
|
||||
{
|
||||
puts("current supported commands are:");
|
||||
for(cli_cmdtype_t cmd_id = CLI_CMDTYPE_help+1; cmd_id < CLI_CMDTYPE_COUNT; cmd_id++)
|
||||
@@ -227,10 +236,18 @@ cli_error_t cli_cmd_help(char const * para)
|
||||
return CLI_ERROR_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Clear Screen Command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_clear(char* p_para)
|
||||
{
|
||||
printf(ANSI_ERASE_SCREEN(2));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// LS Command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_list(const char * p_para)
|
||||
cli_error_t cli_cmd_list(char * p_para)
|
||||
{
|
||||
if ( strlen(p_para) == 0 ) // list current directory
|
||||
{
|
||||
@@ -253,7 +270,7 @@ cli_error_t cli_cmd_list(const char * p_para)
|
||||
printf("/%s", p_name);
|
||||
}else
|
||||
{
|
||||
printf("%-50s%d KB", p_name, dir_entry.fsize / 1000);
|
||||
printf("%-40s%d KB", p_name, dir_entry.fsize / 1000);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
@@ -271,7 +288,7 @@ cli_error_t cli_cmd_list(const char * p_para)
|
||||
//--------------------------------------------------------------------+
|
||||
// CD Command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_changedir(const char * p_para)
|
||||
cli_error_t cli_cmd_changedir(char * p_para)
|
||||
{
|
||||
if ( strlen(p_para) == 0 ) return CLI_ERROR_INVALID_PARA;
|
||||
|
||||
@@ -286,7 +303,7 @@ cli_error_t cli_cmd_changedir(const char * p_para)
|
||||
//--------------------------------------------------------------------+
|
||||
// CAT Command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_cat(const char *p_para)
|
||||
cli_error_t cli_cmd_cat(char *p_para)
|
||||
{
|
||||
if ( strlen(p_para) == 0 ) return CLI_ERROR_INVALID_PARA;
|
||||
|
||||
@@ -325,4 +342,57 @@ cli_error_t cli_cmd_cat(const char *p_para)
|
||||
return CLI_ERROR_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Make Directory command
|
||||
//--------------------------------------------------------------------+
|
||||
//--------------------------------------------------------------------+
|
||||
// COPY command
|
||||
//--------------------------------------------------------------------+
|
||||
cli_error_t cli_cmd_copy(char *p_para)
|
||||
{
|
||||
char* p_space = strchr(p_para, ' ');
|
||||
if ( p_space == NULL ) return CLI_ERROR_INVALID_PARA;
|
||||
|
||||
*p_space = 0; // replace space by NULL-character
|
||||
char* p_dest = p_space+1;
|
||||
|
||||
if ( strlen(p_dest) == 0 ) return CLI_ERROR_INVALID_PARA;
|
||||
|
||||
//------------- Check Existence of source & dest file -------------//
|
||||
cli_error_t error = CLI_ERROR_NONE;
|
||||
FIL src_file, dest_file;
|
||||
|
||||
if ( FR_OK != f_open(&src_file , p_para, FA_READ) ) return CLI_ERROR_INVALID_PATH;
|
||||
switch ( f_open(&dest_file, p_dest, FA_WRITE | FA_CREATE_NEW) )
|
||||
{
|
||||
case FR_EXIST:
|
||||
error = CLI_ERROR_FILE_EXISTED;
|
||||
break;\
|
||||
|
||||
case FR_OK:
|
||||
while(1)
|
||||
{
|
||||
uint32_t bytes_read = 0;
|
||||
uint32_t bytes_write = 0;
|
||||
FRESULT res;
|
||||
|
||||
res = f_read(&src_file, fileread_buffer, CLI_FILE_READ_BUFFER, &bytes_read); /* Read a chunk of src file */
|
||||
if ( (res != FR_OK) || (bytes_read == 0) ) break; /* error or eof */
|
||||
|
||||
res = f_write(&dest_file, fileread_buffer, bytes_read, &bytes_write); /* Write it to the dst file */
|
||||
if ( (res != FR_OK) || (bytes_write < bytes_read) ) break; /* error or disk full */
|
||||
}
|
||||
|
||||
f_close(&dest_file);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = CLI_ERROR_FAILED;
|
||||
break;
|
||||
}
|
||||
|
||||
f_close(&src_file);
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -125,8 +125,6 @@ int main(void)
|
||||
|
||||
tusb_init();
|
||||
|
||||
cli_init();
|
||||
|
||||
//------------- application task init -------------//
|
||||
(void) osal_task_create( OSAL_TASK_REF(led_blinking_task) );
|
||||
|
||||
|
||||
@@ -89,24 +89,23 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr)
|
||||
|
||||
if ( disk_is_ready(0) )
|
||||
{
|
||||
if ( f_mount(0, &fatfs[dev_addr-1]) != FR_OK )
|
||||
if ( f_mount(0, &fatfs[dev_addr-1]) != FR_OK ) // TODO multiple volume
|
||||
{
|
||||
puts("mount failed");
|
||||
return;
|
||||
}
|
||||
|
||||
char volume_label[20] = {0};
|
||||
f_getlabel(NULL, volume_label, NULL);
|
||||
printf("Label: %s\n\n", volume_label);
|
||||
|
||||
f_chdrive(dev_addr-1); // change to newly mounted drive
|
||||
f_chdir("/"); // root as current dir
|
||||
printf("MSC %c:/\n$ ", 'E'+dev_addr-1);
|
||||
|
||||
cli_init();
|
||||
cli_command_prompt();
|
||||
}
|
||||
}
|
||||
|
||||
void tusbh_msc_unmounted_isr(uint8_t dev_addr)
|
||||
{
|
||||
// unmount disk
|
||||
disk_state = STA_NOINIT;
|
||||
puts("--");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user