• R/O
  • SSH
  • HTTPS

panda-p: 提交


Commit MetaInfo

修訂10 (tree)
時間2012-06-18 02:19:04
作者tekken_boss

Log Message

000.001.010: 2012/06/18 02:14 : A part of end user mode is added.

modification

* "UI" A part of end user mode is added.

Confirmation

* Compilable.
* End user mode is working.

Change Summary

差異

--- trunk/src/sl811.c (revision 9)
+++ trunk/src/sl811.c (revision 10)
@@ -26,7 +26,7 @@
2626 int sl811_initialize(void);
2727 int sl811_process(void);
2828 int ui_function_usb(UI_COMMAND uicmd);
29-unsigned char sl811_status(unsigned char req);
29+unsigned char sl811_status(REQUEST_TO_CLASS req);
3030 unsigned char sl811_ctrl_receive(P_SETUP_FORMAT p_fmt);
3131 void sl811_buffer_copy( unsigned char* p_buf, int size);
3232 unsigned char sl811_bulk_out_request( unsigned char* p_buf, int size );
@@ -320,7 +320,7 @@
320320 // -------------------------------------------
321321 // Query for SL811 device class status
322322 // -------------------------------------------
323-unsigned char sl811_status(unsigned char req) {
323+unsigned char sl811_status(REQUEST_TO_CLASS req) {
324324
325325 switch( req ) {
326326 case CLASS_REQ_RESET:
--- trunk/src/srcver.h (revision 9)
+++ trunk/src/srcver.h (revision 10)
@@ -15,9 +15,10 @@
1515
1616 #define SRCVER_MAJOR 0
1717 #define SRCVER_MINOR 1
18-#define SRCVER_BUILD 9
18+#define SRCVER_BUILD 10
1919
2020 /* --------------------------------------------------------------------
21+000.001.010: 2012/06/18 02:14 : A part of enduser mode is added.
2122 000.001.009: 2012/06/13 18:35 : Fine tuning of SCI handshake.
2223 000.001.008: 2012/06/13 16:24 : Default setting for SCI was changed.
2324 000.001.007: 2012/06/13 14:45 : Fine tuning of SL811 driver class.
--- trunk/src/fat.c (revision 9)
+++ trunk/src/fat.c (revision 10)
@@ -10,20 +10,21 @@
1010 #include "fat.h"
1111 #include "serial.h"
1212
13-// change directory
14-// read file
13+// debug options
14+// #define UI_FAT_DIR_VIEW_CHECK_SIZE
1515
1616 extern unsigned char eram_start;
1717 extern unsigned char eram_end;
1818
19+// for local UI control
20+enum {
21+ DIR_VIEW_MODE,
22+ FILE_VIEW_MODE,
23+ READ_FILE_MODE,
24+};
25+
26+
1927 #define MAX_RETRY 20
20-// Keep file list on current directory
21-typedef struct {
22- unsigned long FirstCluster;
23- unsigned long FileSize;
24- char Name[13];
25- unsigned char Attributes;
26-} DIR_INFO, *P_DIR_INFO;
2728
2829 // Search status for DIR information
2930 typedef struct {
@@ -34,13 +35,6 @@
3435 unsigned int ByteOffset;
3536 } DIR_ENTRY, *P_DIR_ENTRY;
3637
37-// Read file status
38-typedef struct {
39- unsigned long ReadSize;
40- unsigned long FileSize;
41- unsigned long CurrentCluster;
42- unsigned long CurrentSector;
43-} READ_FILE_STS, *P_READ_FILE_STS;
4438
4539 // FAT position
4640 typedef struct {
@@ -69,6 +63,7 @@
6963 int fat_initialize(void);
7064 int fat_process(void);
7165 int ui_function_fat(UI_COMMAND uicmd);
66+unsigned char fat_status(REQUEST_TO_CLASS req);
7267 unsigned char fat_change_directory( unsigned long cluster );
7368 unsigned char fat_read_file( unsigned long cluster, unsigned long file_size );
7469
@@ -86,6 +81,10 @@
8681 // Variables
8782 // -------------------------------------------
8883 // Global
84+unsigned int TotalFileNum;
85+READ_FILE_STS ReadFileStatus;
86+DIR_INFO CurrentDirInfo[MAX_FILE_IN_DIR]; // Keep file list on current directory
87+
8988 // Locals
9089 static int fat_disable_timer;
9190 static int window_disable_timer;
@@ -108,15 +107,12 @@
108107 static unsigned long CountofClusters;
109108
110109 static unsigned long CurrentWindowSector;
111-static unsigned int TotalFileNum;
112110 static unsigned char IsFAT32;
113111
114112 static DIR_ENTRY dir_entry;
115-static DIR_INFO dir_info[MAX_FILE_IN_DIR]; // Keep file list on current directory
116-static READ_FILE_STS ReadFileStatus;
117113 static unsigned char WindowBuffer[WINDOW_SIZE];
118114
119-static unsigned long current_byte_cnt;
115+static unsigned long current_byte_cnt; // Use this only in ui_function_fat_dir().
120116
121117 enum fat_error_code {
122118 FAT_ERR_NONE,
@@ -224,6 +220,18 @@
224220 }
225221
226222 // -------------------------------------------
223+// Query for FAT class status
224+// -------------------------------------------
225+unsigned char fat_status(REQUEST_TO_CLASS req) {
226+ // Status return
227+ if( fat_proc < FAT_IDLE ) return CLASS_STS_RESET_IN_PROGRESS;
228+ else if( fat_proc == FAT_IDLE ) return CLASS_STS_READY;
229+ else if( fat_proc == FAT_ERROR_STOP ) return CLASS_STS_ERROR_STOP;
230+ else return CLASS_STS_NOT_READY;
231+}
232+
233+
234+// -------------------------------------------
227235 // Change Directory
228236 // -------------------------------------------
229237 unsigned char fat_change_directory( unsigned long cluster ) {
@@ -423,33 +431,33 @@
423431 fat_proc = FAT_CHANGE_DIR_04; // Long File name information ---> next entry
424432 break;
425433 } else {
426- dir_info[TotalFileNum].FirstCluster =
434+ CurrentDirInfo[TotalFileNum].FirstCluster =
427435 WindowBuffer[dir_entry.ByteOffset+ 20] * 0x10000
428436 + WindowBuffer[dir_entry.ByteOffset+ 21] * 0x1000000
429437 + WindowBuffer[dir_entry.ByteOffset+ 26]
430438 + WindowBuffer[dir_entry.ByteOffset+ 27] * 0x100;
431- dir_info[TotalFileNum].Attributes = WindowBuffer[dir_entry.ByteOffset+ 11];
439+ CurrentDirInfo[TotalFileNum].Attributes = WindowBuffer[dir_entry.ByteOffset+ 11];
432440
433441 val = *( (unsigned long*) &WindowBuffer[dir_entry.ByteOffset+ 28] );
434- dir_info[TotalFileNum].FileSize = (val<<24) | ((val<<8) & 0x00FF0000) | ((val>>8) & 0x0000FF00) | ((val>>24) & 0x000000FF);
442+ CurrentDirInfo[TotalFileNum].FileSize = (val<<24) | ((val<<8) & 0x00FF0000) | ((val>>8) & 0x0000FF00) | ((val>>24) & 0x000000FF);
435443
436- dir_info[TotalFileNum].Name[ 0] = WindowBuffer[dir_entry.ByteOffset+ 0]; dir_info[TotalFileNum].Name[ 1] = WindowBuffer[dir_entry.ByteOffset+ 1];
437- dir_info[TotalFileNum].Name[ 2] = WindowBuffer[dir_entry.ByteOffset+ 2]; dir_info[TotalFileNum].Name[ 3] = WindowBuffer[dir_entry.ByteOffset+ 3];
438- dir_info[TotalFileNum].Name[ 4] = WindowBuffer[dir_entry.ByteOffset+ 4]; dir_info[TotalFileNum].Name[ 5] = WindowBuffer[dir_entry.ByteOffset+ 5];
439- dir_info[TotalFileNum].Name[ 6] = WindowBuffer[dir_entry.ByteOffset+ 6]; dir_info[TotalFileNum].Name[ 7] = WindowBuffer[dir_entry.ByteOffset+ 7];
444+ CurrentDirInfo[TotalFileNum].Name[ 0] = WindowBuffer[dir_entry.ByteOffset+ 0]; CurrentDirInfo[TotalFileNum].Name[ 1] = WindowBuffer[dir_entry.ByteOffset+ 1];
445+ CurrentDirInfo[TotalFileNum].Name[ 2] = WindowBuffer[dir_entry.ByteOffset+ 2]; CurrentDirInfo[TotalFileNum].Name[ 3] = WindowBuffer[dir_entry.ByteOffset+ 3];
446+ CurrentDirInfo[TotalFileNum].Name[ 4] = WindowBuffer[dir_entry.ByteOffset+ 4]; CurrentDirInfo[TotalFileNum].Name[ 5] = WindowBuffer[dir_entry.ByteOffset+ 5];
447+ CurrentDirInfo[TotalFileNum].Name[ 6] = WindowBuffer[dir_entry.ByteOffset+ 6]; CurrentDirInfo[TotalFileNum].Name[ 7] = WindowBuffer[dir_entry.ByteOffset+ 7];
440448
441- if(dir_info[TotalFileNum].Attributes & DIR_ATTR_DIRECTORY) {
442- dir_info[TotalFileNum].Name[ 8] = WindowBuffer[dir_entry.ByteOffset+ 8];
443- dir_info[TotalFileNum].Name[ 9] = WindowBuffer[dir_entry.ByteOffset+ 9];
444- dir_info[TotalFileNum].Name[10] = WindowBuffer[dir_entry.ByteOffset+ 10];
445- dir_info[TotalFileNum].Name[11] = ' ';
446- dir_info[TotalFileNum].Name[12] = 0x00;
449+ if(CurrentDirInfo[TotalFileNum].Attributes & DIR_ATTR_DIRECTORY) {
450+ CurrentDirInfo[TotalFileNum].Name[ 8] = WindowBuffer[dir_entry.ByteOffset+ 8];
451+ CurrentDirInfo[TotalFileNum].Name[ 9] = WindowBuffer[dir_entry.ByteOffset+ 9];
452+ CurrentDirInfo[TotalFileNum].Name[10] = WindowBuffer[dir_entry.ByteOffset+ 10];
453+ CurrentDirInfo[TotalFileNum].Name[11] = ' ';
454+ CurrentDirInfo[TotalFileNum].Name[12] = 0x00;
447455 } else {
448- dir_info[TotalFileNum].Name[ 8] = '.';
449- dir_info[TotalFileNum].Name[ 9] = WindowBuffer[dir_entry.ByteOffset+ 8];
450- dir_info[TotalFileNum].Name[10] = WindowBuffer[dir_entry.ByteOffset+ 9];
451- dir_info[TotalFileNum].Name[11] = WindowBuffer[dir_entry.ByteOffset+ 10];
452- dir_info[TotalFileNum].Name[12] = 0x00;
456+ CurrentDirInfo[TotalFileNum].Name[ 8] = '.';
457+ CurrentDirInfo[TotalFileNum].Name[ 9] = WindowBuffer[dir_entry.ByteOffset+ 8];
458+ CurrentDirInfo[TotalFileNum].Name[10] = WindowBuffer[dir_entry.ByteOffset+ 9];
459+ CurrentDirInfo[TotalFileNum].Name[11] = WindowBuffer[dir_entry.ByteOffset+ 10];
460+ CurrentDirInfo[TotalFileNum].Name[12] = 0x00;
453461 }
454462
455463 if( TotalFileNum < MAX_FILE_IN_DIR ) {
@@ -882,12 +890,8 @@
882890 return ret_val;
883891 }
884892
885-enum {
886- DIR_VIEW_MODE,
887- FILE_VIEW_MODE,
888- READ_FILE_MODE,
889-};
890893
894+
891895 // -------------------------------------------
892896 // UI Function - DIR debug
893897 // -------------------------------------------
@@ -961,10 +965,10 @@
961965 switch ( view_mode ) {
962966 case FILE_VIEW_MODE:
963967 while( (p_buffer_addr[current_byte_cnt] != 0x0D) || (p_buffer_addr[current_byte_cnt+1] != 0x0A) ) {
964- if( current_byte_cnt >= dir_info[current_index].FileSize ) break;
968+ if( current_byte_cnt >= CurrentDirInfo[current_index].FileSize ) break;
965969 current_byte_cnt++;
966970 }
967- if( current_byte_cnt < dir_info[current_index].FileSize ) current_byte_cnt+=2;
971+ if( current_byte_cnt < CurrentDirInfo[current_index].FileSize ) current_byte_cnt+=2;
968972 break;
969973
970974 case DIR_VIEW_MODE:
@@ -976,6 +980,7 @@
976980 } else {
977981 if( current_index < TotalFileNum ) current_index++;
978982 }
983+ break;
979984
980985 default:
981986 case READ_FILE_MODE:
@@ -987,18 +992,18 @@
987992 // change dir or file view
988993 switch ( view_mode ) {
989994 case FILE_VIEW_MODE:
990- //TransferStartRequest(p_buffer_addr, dir_info[current_index].FileSize);
995+ //TransferStartRequest(p_buffer_addr, CurrentDirInfo[current_index].FileSize);
991996 view_mode = READ_FILE_MODE;
992997 break;
993998
994999 case DIR_VIEW_MODE:
995- if( dir_info[current_index].Attributes & DIR_ATTR_DIRECTORY ) {
1000+ if( CurrentDirInfo[current_index].Attributes & DIR_ATTR_DIRECTORY ) {
9961001 // Change dir
997- fat_change_directory(dir_info[current_index].FirstCluster);
1002+ fat_change_directory(CurrentDirInfo[current_index].FirstCluster);
9981003 current_index = 0;
9991004 } else {
10001005 // Open File
1001- fat_read_file(dir_info[current_index].FirstCluster, dir_info[current_index].FileSize );
1006+ fat_read_file(CurrentDirInfo[current_index].FirstCluster, CurrentDirInfo[current_index].FileSize );
10021007 view_mode = READ_FILE_MODE;
10031008 current_byte_cnt = 0;
10041009 }
@@ -1007,7 +1012,7 @@
10071012 case READ_FILE_MODE:
10081013 #if 1
10091014 if( usbms_status( CLASS_REQ_NONE ) == CLASS_STS_READY )
1010- TransferStartRequest(p_buffer_addr, dir_info[current_index].FileSize);
1015+ TransferStartRequest(p_buffer_addr, CurrentDirInfo[current_index].FileSize);
10111016 #endif
10121017 break;
10131018
@@ -1026,7 +1031,7 @@
10261031 offset = 0;
10271032 for(i=0; i<16; i++) tempbuf[i]=' ';
10281033 for(i=0; i<16; i++) {
1029- if( current_byte_cnt+offset >= dir_info[current_index].FileSize ) break;
1034+ if( current_byte_cnt+offset >= CurrentDirInfo[current_index].FileSize ) break;
10301035 if( (p_buffer_addr[current_byte_cnt+offset] == 0x0D) && (p_buffer_addr[current_byte_cnt+offset+1] == 0x0A) ) {
10311036 offset += 2;
10321037 break;
@@ -1041,13 +1046,13 @@
10411046 if(offset == 16) {
10421047 while( (p_buffer_addr[current_byte_cnt+offset] != 0x0D) || (p_buffer_addr[current_byte_cnt+offset+1] != 0x0A) ) {
10431048 offset++;
1044- if( current_byte_cnt+offset >= dir_info[current_index].FileSize ) break;
1049+ if( current_byte_cnt+offset >= CurrentDirInfo[current_index].FileSize ) break;
10451050 }
10461051 }
10471052
10481053 for(i=0; i<16; i++) tempbuf[i]='.';
10491054 for(i=0; i<16; i++) {
1050- if( current_byte_cnt+offset >= dir_info[current_index].FileSize ) break;
1055+ if( current_byte_cnt+offset >= CurrentDirInfo[current_index].FileSize ) break;
10511056 if( (p_buffer_addr[current_byte_cnt+offset] == 0x0D) && (p_buffer_addr[current_byte_cnt+offset+1] == 0x0A) ) {
10521057 offset += 2;
10531058 break;
@@ -1066,18 +1071,18 @@
10661071 sc1602_set_buffer(1," ");
10671072 } else {
10681073 if( cursol_position == 0) { // cursol in first line
1069- make_display_text_dirinfo(tempbuf, &dir_info[current_index]);
1074+ make_display_text_dirinfo(tempbuf, &CurrentDirInfo[current_index]);
10701075 sc1602_set_buffer_cursol( 0, tempbuf );
10711076 if( current_index < TotalFileNum) {
1072- make_display_text_dirinfo(tempbuf, &dir_info[current_index+1]);
1077+ make_display_text_dirinfo(tempbuf, &CurrentDirInfo[current_index+1]);
10731078 sc1602_set_buffer( 1, tempbuf );
10741079 } else {
10751080 sc1602_set_buffer(1," ");
10761081 }
10771082 } else {
1078- make_display_text_dirinfo(tempbuf, &dir_info[current_index-1]);
1083+ make_display_text_dirinfo(tempbuf, &CurrentDirInfo[current_index-1]);
10791084 sc1602_set_buffer ( 0, tempbuf );
1080- make_display_text_dirinfo(tempbuf, &dir_info[current_index]);
1085+ make_display_text_dirinfo(tempbuf, &CurrentDirInfo[current_index]);
10811086 sc1602_set_buffer_cursol( 1, tempbuf );
10821087 }
10831088 }
@@ -1084,7 +1089,7 @@
10841089 break;
10851090
10861091 case READ_FILE_MODE:
1087- make_display_text_dirinfo(tempbuf, &dir_info[current_index]);
1092+ make_display_text_dirinfo(tempbuf, &CurrentDirInfo[current_index]);
10881093 sc1602_set_buffer( 0, tempbuf );
10891094 sc1602_set_buffer_progress_kb(1, ReadFileStatus.ReadSize, ReadFileStatus.FileSize);
10901095 default:
@@ -1105,10 +1110,7 @@
11051110 tempbuf[ 1]='[';
11061111 tempbuf[14]=']';
11071112 }
1108-#if 0
1109- for(i=0;i<sizeof(pDirInfo->Name)-1;i++)
1110- tempbuf[i+2]=pDirInfo->Name[i];
1111-#else
1113+#ifdef UI_FAT_DIR_VIEW_CHECK_SIZE
11121114 for(i=0;i<sizeof(pDirInfo->Name)-6;i++)
11131115 tempbuf[i+2]=pDirInfo->Name[i];
11141116 Val = pDirInfo->FileSize / 1024;
@@ -1120,12 +1122,14 @@
11201122 tempbuf[14]='K';
11211123 tempbuf[15]='B';
11221124 }
1125+#else
1126+ for(i=0;i<sizeof(pDirInfo->Name)-1;i++)
1127+ tempbuf[i+2]=pDirInfo->Name[i];
11231128 #endif
11241129
11251130 }
11261131
11271132
1128-
11291133 // -------------------------------------------
11301134 // UI Sub Function - USB nop
11311135 // -------------------------------------------
--- trunk/src/ui.c (revision 9)
+++ trunk/src/ui.c (revision 10)
@@ -26,6 +26,7 @@
2626 // Locals
2727 static int ui_function_nop(UI_COMMAND uicmd);
2828 static int ui_function_memview(UI_COMMAND uicmd);
29+static int ui_function_enduser_mode(UI_COMMAND uicmd);
2930
3031 // -------------------------------------------
3132 // Variables
@@ -32,7 +33,7 @@
3233 // -------------------------------------------
3334
3435 const UI_APP_TABLE ui_app_table[] = {
35- { 0, ui_function_nop, " FILE READ ", 0 },
36+ { 0, ui_function_enduser_mode, " END USER MODE ", 200 },
3637 { 1, ui_function_nop, " RX START ", 0 },
3738 { 2, ui_function_nop, " TX START ", 1000 },
3839 { 3, ui_function_nop, " CONFIG ", 0 },
@@ -356,3 +357,155 @@
356357 }
357358 return ret_val;
358359 }
360+
361+
362+enum enduser_mode_step {
363+ STEP_WAIT_FOR_READY,
364+ STEP_DIR_VIEW,
365+ STEP_FILE_READ,
366+ STEP_WAIT_FOR_START,
367+ STEP_TANSFER,
368+ STEP_COMPLETE,
369+};
370+
371+// -------------------------------------------
372+// UI Function - End user mode
373+// -------------------------------------------
374+static int ui_function_enduser_mode(UI_COMMAND uicmd) {
375+ int ret_val;
376+ static unsigned char current_index, cursol_position, mode_step;
377+
378+ ret_val = UI_RET_READY;
379+ switch( uicmd.cmd ) {
380+ case UI_CMD_NOP:
381+ break;
382+
383+ case UI_CMD_STARTED:
384+ current_index = 0;
385+ cursol_position = 0;
386+ mode_step = STEP_WAIT_FOR_READY;
387+ break;
388+ break;
389+
390+ case UI_CMD_KEY_PRESS_UP:
391+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
392+ switch( mode_step ) {
393+ case STEP_DIR_VIEW:
394+ if( cursol_position == 1 ) {
395+ cursol_position = 0;
396+ current_index--;
397+ } else {
398+ if( current_index != 0 ) current_index--;
399+ }
400+ break;
401+
402+ default:
403+ break;
404+ }
405+ break;
406+ case UI_CMD_KEY_PRESS_DOWN:
407+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
408+ switch( mode_step ) {
409+ case STEP_DIR_VIEW:
410+ if( cursol_position == 0 ) {
411+ if( TotalFileNum != 0) {
412+ cursol_position = 1;
413+ current_index++;
414+ }
415+ } else {
416+ if( current_index < TotalFileNum ) current_index++;
417+ }
418+ break;
419+
420+ default:
421+ break;
422+ }
423+ break;
424+ case UI_CMD_KEY_PRESS_BACK:
425+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
426+ switch( mode_step ) {
427+ case STEP_FILE_READ:
428+ mode_step = STEP_DIR_VIEW;
429+ break;
430+
431+ case STEP_DIR_VIEW:
432+ ret_val = UI_RET_QUIT;
433+ break;
434+
435+ default:
436+ break;
437+ }
438+ break;
439+ case UI_CMD_KEY_PRESS_OK:
440+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
441+ switch( mode_step ) {
442+ case STEP_DIR_VIEW:
443+ if( CurrentDirInfo[current_index].Attributes & DIR_ATTR_DIRECTORY ) {
444+ // Change dir
445+ fat_change_directory(CurrentDirInfo[current_index].FirstCluster);
446+ current_index = 0;
447+ } else {
448+ // Open File
449+ fat_read_file(CurrentDirInfo[current_index].FirstCluster, CurrentDirInfo[current_index].FileSize );
450+ mode_step = STEP_FILE_READ;
451+ }
452+ break;
453+
454+ default:
455+ break;
456+ }
457+ break;
458+ case UI_CMD_INTEVAL:
459+ switch( mode_step ) {
460+ case STEP_WAIT_FOR_READY:
461+ if( fat_status(CLASS_REQ_NONE) == CLASS_STS_READY )
462+ mode_step = STEP_DIR_VIEW;
463+ else {
464+ sc1602_set_buffer(0,"SYSTEM STARTING ");
465+ sc1602_set_buffer(1,"Wait a momnet...");
466+ }
467+ break;
468+
469+ case STEP_DIR_VIEW:
470+ // Directory
471+ if( fat_status(CLASS_REQ_NONE) != CLASS_STS_READY ) {
472+ sc1602_set_buffer(0," Reading... ");
473+ sc1602_set_buffer(1," ");
474+ } else if(TotalFileNum == 0) {
475+ sc1602_set_buffer(0,"--- NO FILE --- ");
476+ sc1602_set_buffer(1," ");
477+ } else {
478+ if( cursol_position == 0) { // cursol in first line
479+ sc1602_set_buffer_filename_cursol( 0,
480+ (CurrentDirInfo[current_index].Attributes & DIR_ATTR_DIRECTORY),
481+ CurrentDirInfo[current_index].Name );
482+ if( current_index < TotalFileNum) {
483+ sc1602_set_buffer_filename ( 1,
484+ (CurrentDirInfo[current_index+1].Attributes & DIR_ATTR_DIRECTORY),
485+ CurrentDirInfo[current_index+1].Name );
486+ } else {
487+ sc1602_set_buffer(1," ");
488+ }
489+ } else {
490+ sc1602_set_buffer_filename ( 0,
491+ (CurrentDirInfo[current_index-1].Attributes & DIR_ATTR_DIRECTORY),
492+ CurrentDirInfo[current_index-1].Name );
493+ sc1602_set_buffer_filename_cursol( 1,
494+ (CurrentDirInfo[current_index].Attributes & DIR_ATTR_DIRECTORY),
495+ CurrentDirInfo[current_index].Name );
496+ }
497+ }
498+ break;
499+
500+ case STEP_FILE_READ:
501+ sc1602_set_buffer_filename ( 0, 0, CurrentDirInfo[current_index].Name );
502+ sc1602_set_buffer_progress_kb(1, ReadFileStatus.ReadSize, ReadFileStatus.FileSize);
503+ break;
504+ }
505+ break;
506+
507+ }
508+ return ret_val;
509+}
510+
511+
--- trunk/src/sl811.h (revision 9)
+++ trunk/src/sl811.h (revision 10)
@@ -275,7 +275,7 @@
275275 extern int sl811_initialize(void);
276276 extern int sl811_process(void);
277277 extern int ui_function_usb(UI_COMMAND uicmd);
278-extern unsigned char sl811_status(unsigned char cmd);
278+extern unsigned char sl811_status(REQUEST_TO_CLASS cmd);
279279 extern unsigned char sl811_ctrl_receive(P_SETUP_FORMAT p_fmt);
280280 extern void sl811_buffer_copy( unsigned char* p_buf, int size);
281281 extern unsigned char sl811_bulk_out_request( unsigned char* p_buf, int size );
--- trunk/src/sc1602.c (revision 9)
+++ trunk/src/sc1602.c (revision 10)
@@ -33,6 +33,8 @@
3333 int sc1602_set_buffer_variable2 (unsigned char buf, unsigned short *data);
3434 int sc1602_set_buffer_variable3 (unsigned char buf, unsigned long *data);
3535 int sc1602_set_buffer_progress_kb (unsigned char buf, unsigned long val1, unsigned long val2);
36+int sc1602_set_buffer_filename (unsigned char buf, unsigned char dir, char *data);
37+int sc1602_set_buffer_filename_cursol (unsigned char buf, unsigned char dir, char *data);
3638
3739 int sc1602_set_buffer_version (unsigned char buf, unsigned char major, unsigned char minor, unsigned char build);
3840
@@ -388,6 +390,30 @@
388390 }
389391
390392 // -------------------------------------------
393+// Buffer set service function (file/dir name w/o cursol)
394+// -------------------------------------------
395+int sc1602_set_buffer_filename (unsigned char buf, unsigned char dir, char *data) {
396+ unsigned char pos, i;
397+
398+ // 0123456789ABCDEF
399+ if( dir == 0 ) sc1602_set_buffer(buf," ");
400+ else sc1602_set_buffer(buf," [ ]");
401+
402+ pos = 2;
403+ for(i=0;i<12;i++)
404+ if(data[i]!=0x20) sc1602_buffer[buf][pos++]=data[i];
405+}
406+
407+
408+// -------------------------------------------
409+// Buffer set service function (file/dir name w/ cursol)
410+// -------------------------------------------
411+int sc1602_set_buffer_filename_cursol (unsigned char buf, unsigned char dir, char *data) {
412+ sc1602_set_buffer_filename(buf, dir, data);
413+ sc1602_buffer[buf][0] = '>';
414+}
415+
416+// -------------------------------------------
391417 // Local functions
392418 // -------------------------------------------
393419 void sc1602_command_output4(char cmd) {
--- trunk/src/fat.h (revision 9)
+++ trunk/src/fat.h (revision 10)
@@ -25,13 +25,21 @@
2525 #define DIR_ATTR_ARCHIVE 0x20
2626 #define DIR_ATTR_LONG_NAME (DIR_ATTR_READONLY|DIR_ATTR_HIDDEN|DIR_ATTR_SYSTEM|DIR_ATTR_VOLUME_ID)
2727
28-extern void fat_20ms_handler(void);
29-extern int fat_initialize(void);
30-extern int fat_process(void);
31-extern int ui_function_fat(UI_COMMAND uicmd);
32-extern unsigned char fat_change_directory( unsigned long cluster );
33-extern unsigned char fat_read_file( unsigned long cluster, unsigned long file_size );
28+// Keep file list on current directory
29+typedef struct {
30+ unsigned long FirstCluster;
31+ unsigned long FileSize;
32+ char Name[13];
33+ unsigned char Attributes;
34+} DIR_INFO, *P_DIR_INFO;
3435
36+// Read file status
37+typedef struct {
38+ unsigned long ReadSize;
39+ unsigned long FileSize;
40+ unsigned long CurrentCluster;
41+ unsigned long CurrentSector;
42+} READ_FILE_STS, *P_READ_FILE_STS;
3543
3644 typedef struct {
3745 unsigned char fat_type;
@@ -52,4 +60,21 @@
5260 unsigned long RootClus; // Offset 44 Size 4
5361 } BPB_INFORMARION, *P_BPB_INFORMATION;
5462
63+
64+// Global variables
65+extern unsigned int TotalFileNum;
66+extern READ_FILE_STS ReadFileStatus;
67+extern DIR_INFO CurrentDirInfo[MAX_FILE_IN_DIR]; // Keep file list on current directory
68+
69+// Global functions
70+extern void fat_20ms_handler(void);
71+extern int fat_initialize(void);
72+extern int fat_process(void);
73+extern int ui_function_fat(UI_COMMAND uicmd);
74+extern unsigned char fat_status(REQUEST_TO_CLASS req);
75+extern unsigned char fat_change_directory( unsigned long cluster );
76+extern unsigned char fat_read_file( unsigned long cluster, unsigned long file_size );
77+
78+
79+
5580 #endif
--- trunk/src/serial.c (revision 9)
+++ trunk/src/serial.c (revision 10)
@@ -13,6 +13,7 @@
1313 #define READ_BUF_SIZE 16
1414 #define SENT_BUF_SIZE 16
1515
16+// #define RECEIVE_DATA_EVENIF_ERR
1617
1718 // -------------------------------------------
1819 // Macros
@@ -183,7 +184,7 @@
183184 if(SCI0.SSR.BIT.PER) {
184185 SCI0.SSR.BIT.PER = 0;
185186 SCIErrorDebug+=0x100;
186-#if 1
187+#ifdef RECEIVE_DATA_EVENIF_ERR
187188 ReceiveBuf[ReceiveCnt] = SCI0.RDR; // データ受信
188189 // DC code was refered from http://www5a.biglobe.ne.jp/~NCPRO/pc_nc.htm.
189190 if( ReceiveBuf[ReceiveCnt] == 0x11
--- trunk/src/sc1602.h (revision 9)
+++ trunk/src/sc1602.h (revision 10)
@@ -28,6 +28,8 @@
2828 extern int sc1602_set_buffer_variable3 (unsigned char buf, unsigned long *data);
2929 extern int sc1602_set_buffer_version (unsigned char buf, unsigned char major, unsigned char minor, unsigned char build);
3030 extern int sc1602_set_buffer_progress_kb (unsigned char buf, unsigned long val1, unsigned long val2);
31+extern int sc1602_set_buffer_filename (unsigned char buf, unsigned char dir, char *data);
32+extern int sc1602_set_buffer_filename_cursol (unsigned char buf, unsigned char dir, char *data);
3133
3234 extern char sc1602_buffer[MAX_LINE][MAX_COLUMN];
3335 extern int sc1602_buffer_updates[MAX_LINE];
--- trunk/src/common.h (revision 9)
+++ trunk/src/common.h (revision 10)
@@ -19,7 +19,8 @@
1919 #define MSCLASS_DEBUG_ON
2020 #define SCI_DEBUG_ON
2121 #endif
22-#define SUB_PROC_RESULT unsigned char
22+#define REQUEST_TO_CLASS unsigned char
23+#define SUB_PROC_RESULT unsigned char
2324 enum sub_proc_result_code {
2425 SUB_PROC_BUSY,
2526 SUB_PROC_DONE,
Show on old repository browser