• R/O
  • SSH
  • HTTPS

panda-p: Commit


Commit MetaInfo

Revisión11 (tree)
Tiempo2012-06-18 09:22:33
Autortekken_boss

Log Message

000.001.011: 2012/06/18 09:21 : enduser mode is ready. (still not default)

Modification

  • [UI] enduser mode is ready.

Confirmation

  • Compilable.
  • Confirmed enduser mode is workable.

Cambiar Resumen

Diferencia incremental

--- trunk/src/srcver.h (revision 10)
+++ trunk/src/srcver.h (revision 11)
@@ -15,9 +15,10 @@
1515
1616 #define SRCVER_MAJOR 0
1717 #define SRCVER_MINOR 1
18-#define SRCVER_BUILD 10
18+#define SRCVER_BUILD 11
1919
2020 /* --------------------------------------------------------------------
21+000.001.011: 2012/06/18 09:21 : enduser mode is ready. (still not default)
2122 000.001.010: 2012/06/18 02:14 : A part of enduser mode is added.
2223 000.001.009: 2012/06/13 18:35 : Fine tuning of SCI handshake.
2324 000.001.008: 2012/06/13 16:24 : Default setting for SCI was changed.
--- trunk/src/ui.c (revision 10)
+++ trunk/src/ui.c (revision 11)
@@ -15,6 +15,9 @@
1515 #include "serial.h"
1616 #include "srcver.h"
1717
18+extern unsigned char eram_start;
19+extern unsigned char eram_end;
20+
1821 // -------------------------------------------
1922 // Proto type definitions
2023 // -------------------------------------------
@@ -374,8 +377,11 @@
374377 static int ui_function_enduser_mode(UI_COMMAND uicmd) {
375378 int ret_val;
376379 static unsigned char current_index, cursol_position, mode_step;
380+ unsigned char *p_buffer_addr;
377381
382+ p_buffer_addr = &eram_start;
378383 ret_val = UI_RET_READY;
384+
379385 switch( uicmd.cmd ) {
380386 case UI_CMD_NOP:
381387 break;
@@ -432,6 +438,11 @@
432438 ret_val = UI_RET_QUIT;
433439 break;
434440
441+ case STEP_TANSFER:
442+ serial_status(CLASS_REQ_RESET);
443+ mode_step = STEP_DIR_VIEW;
444+ break;
445+
435446 default:
436447 break;
437448 }
@@ -439,6 +450,13 @@
439450 case UI_CMD_KEY_PRESS_OK:
440451 if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
441452 switch( mode_step ) {
453+ case STEP_WAIT_FOR_START:
454+ if( usbms_status( CLASS_REQ_NONE ) == CLASS_STS_READY ) {
455+ TransferStartRequest(p_buffer_addr, CurrentDirInfo[current_index].FileSize);
456+ mode_step = STEP_TANSFER;
457+ }
458+ break;
459+
442460 case STEP_DIR_VIEW:
443461 if( CurrentDirInfo[current_index].Attributes & DIR_ATTR_DIRECTORY ) {
444462 // Change dir
@@ -498,9 +516,25 @@
498516 break;
499517
500518 case STEP_FILE_READ:
519+ if( fat_status(CLASS_REQ_NONE) == CLASS_STS_READY ) {
520+ mode_step = STEP_WAIT_FOR_START;
521+ } else {
522+ sc1602_set_buffer_filename ( 0, 0, CurrentDirInfo[current_index].Name );
523+ sc1602_set_buffer_progress_kb(1, ReadFileStatus.ReadSize, ReadFileStatus.FileSize);
524+ }
525+ break;
526+
527+ case STEP_WAIT_FOR_START:
501528 sc1602_set_buffer_filename ( 0, 0, CurrentDirInfo[current_index].Name );
502- sc1602_set_buffer_progress_kb(1, ReadFileStatus.ReadSize, ReadFileStatus.FileSize);
529+ sc1602_set_buffer (1," Ready to start.");
503530 break;
531+
532+ case STEP_TANSFER:
533+ ui_serial_progress();
534+ break;
535+
536+ default:
537+ break;
504538 }
505539 break;
506540
--- trunk/src/serial.c (revision 10)
+++ trunk/src/serial.c (revision 11)
@@ -39,6 +39,9 @@
3939 void serial_1ms_handler(void);
4040 int serial_initialize(void);
4141 void serial_process(void);
42+void ui_serial_progress( void );
43+unsigned char serial_status(REQUEST_TO_CLASS req);
44+
4245 //int ui_function_serial(UI_COMMAND uicmd);
4346 void int_ERI0();
4447 void int_RXI0();
@@ -298,6 +301,26 @@
298301 }
299302
300303 // -------------------------------------------
304+// Query for FAT class status
305+// -------------------------------------------
306+unsigned char serial_status(REQUEST_TO_CLASS req) {
307+ switch( req ) {
308+ case CLASS_REQ_RESET:
309+ serial_initialize();
310+ return CLASS_STS_RESET_IN_PROGRESS;
311+
312+ default:
313+ break;
314+ }
315+
316+ // Status return
317+ if( serial_proc < SCI_IDLE ) return CLASS_STS_RESET_IN_PROGRESS;
318+ else if( serial_proc == SCI_IDLE ) return CLASS_STS_READY;
319+ else if( serial_proc == SCI_ERROR_STOP ) return CLASS_STS_ERROR_STOP;
320+ else return CLASS_STS_NOT_READY;
321+}
322+
323+// -------------------------------------------
301324 // Transfer Start Request
302325 // -------------------------------------------
303326 unsigned char TransferStartRequest( unsigned char* pBuf, unsigned long size ) {
@@ -788,3 +811,39 @@
788811 }
789812
790813
814+// -------------------------------------------
815+// UI service Function - SERIAL progress
816+// -------------------------------------------
817+void ui_serial_progress( void ) {
818+ // Title
819+ switch( serial_proc ) {
820+ case SCI_INITIALIZE:
821+ case SCI_ERROR_STOP:
822+ case SCI_READY_WAIT:
823+ sc1602_set_buffer( 0, "SCI is not ready" );
824+ break;
825+
826+ case SCI_IDLE:
827+ sc1602_set_buffer( 0, "SCI is ready. " );
828+ break;
829+
830+ case SCI_DATA_SET:
831+ case SCI_WAIT_TX_OK:
832+ if( sci_setting.flow_control_request == FLOW_REQ_PAUSE ) sc1602_set_buffer( 0, "Pause.... " );
833+ else sc1602_set_buffer( 0, "Sending... " );
834+ break;
835+
836+ case SCI_TX_IN_PROGRESS:
837+ sc1602_set_buffer( 0, "Sending... " );
838+ break;
839+
840+ case SCI_TX_IN_PAUSE:
841+ sc1602_set_buffer( 0, "Pause.... " );
842+ break;
843+
844+ case SCI_TX_IN_END:
845+ sc1602_set_buffer( 0, "Complete! " );
846+ break;
847+ }
848+ sc1602_set_buffer_progress_kb(1, tx_status.sent_bytes, tx_status.file_size);
849+}
--- trunk/src/serial.h (revision 10)
+++ trunk/src/serial.h (revision 11)
@@ -73,7 +73,9 @@
7373
7474 extern void serial_1ms_handler(void);
7575 extern int serial_initialize(void);
76-extern void serial_process(void);
76+extern void serial_process(void);
77+extern void ui_serial_progress( void );
78+extern unsigned char serial_status(REQUEST_TO_CLASS req);
7779
7880 extern void int_ERI0();
7981 extern void int_RXI0();
Show on old repository browser