• R/O
  • SSH
  • HTTPS

panda-p: Commit


Commit MetaInfo

Revisión5 (tree)
Tiempo2012-06-11 13:07:50
Autortekken_boss

Log Message

000.001.005: 2012/06/11 13:06 : UI for DC flow control is added.
[Modification]
+ [SCI] UI for DC flow control is added.
+ [SCI] Transfer condition for SCI is changed from FLOW_REQ_NONE to FLOW_REQ_PAUSE.
[Confirmation]
+ Compilable.

Cambiar Resumen

Diferencia incremental

--- trunk/src/srcver.h (revision 4)
+++ trunk/src/srcver.h (revision 5)
@@ -15,9 +15,10 @@
1515
1616 #define SRCVER_MAJOR 0
1717 #define SRCVER_MINOR 1
18-#define SRCVER_BUILD 4
18+#define SRCVER_BUILD 5
1919
2020 /* --------------------------------------------------------------------
21+000.001.005: 2012/06/11 13:06 : UI for DC flow control is added.
2122 000.001.004: 2012/06/11 11:23 : DC flow control is added.
2223 000.001.003: 2012/06/11 09:39 : SCI config UI function is added.
2324 000.001.002: 2012/06/11 02:15 : Character code(ISO/EIA) conversion are added.
--- trunk/src/fat.c (revision 4)
+++ trunk/src/fat.c (revision 5)
@@ -991,8 +991,10 @@
991991 break;
992992
993993 case READ_FILE_MODE:
994+#if 1
994995 if( usbms_status( CLASS_REQ_NONE ) == CLASS_STS_READY )
995996 TransferStartRequest(p_buffer_addr, dir_info[current_index].FileSize);
997+#endif
996998 break;
997999
9981000 default:
--- trunk/src/serial.c (revision 4)
+++ trunk/src/serial.c (revision 5)
@@ -51,6 +51,7 @@
5151 static int ui_function_serial_nop(UI_COMMAND uicmd, int param);
5252 static int ui_function_serial_debug(UI_COMMAND uicmd, int param);
5353 static int ui_function_serial_config(UI_COMMAND uicmd, int param);
54+static int ui_function_serial_trans(UI_COMMAND uicmd, int param);
5455
5556 // -------------------------------------------
5657 // Variables
@@ -127,7 +128,8 @@
127128
128129 static const MODULE_MENU_TABLE serial_app_table[] = { // interval time will be ignored.
129130 { 0, 0, ui_function_serial_debug, " Debug ", },
130- { 2, 0, ui_function_serial_config, " Config ", },
131+ { 1, 0, ui_function_serial_config, " Config ", },
132+ { 2, 0, ui_function_serial_trans, " Transfer ", },
131133 { -1, 0, ui_function_serial_nop, "0123456789ABCDEF", },
132134 };
133135
@@ -204,6 +206,7 @@
204206 if( serial_proc == SCI_TX_IN_PROGRESS ) {
205207 if(SCI0.SSR.BIT.TDRE) {
206208 if( sci_setting.flow_control_request == FLOW_REQ_PAUSE ) {
209+ sci_setting.flow_control_request = FLOW_REQ_NONE;
207210 serial_proc = SCI_TX_IN_PAUSE;
208211 tx_status.sent_bytes++;
209212 SCI0.SCR.BIT.TIE = 0; // TX empty intr. disable
@@ -264,24 +267,26 @@
264267 tx_status.file_size = size;
265268 tx_status.sent_bytes = 0;
266269 tx_status.p_buf = pBuf;
270+ serial_proc = SCI_TX_IN_PAUSE;
271+ } else {
272+ serial_proc = SCI_TX_IN_PROGRESS;
273+ // Transfer start
274+ switch( sci_setting.code_setting_index ) {
275+ case COMM_CODE_ISO:
276+ SCI0.TDR = Cnv2Iso( (unsigned char) tx_status.p_buf[tx_status.sent_bytes++]);
277+ break;
278+ case COMM_CODE_EIA:
279+ SCI0.TDR = Cnv2Eia( (unsigned char) tx_status.p_buf[tx_status.sent_bytes++]);
280+ break;
281+ default:
282+ SCI0.TDR = (unsigned char) tx_status.p_buf[tx_status.sent_bytes++];
283+ break;
284+ }
285+
286+ if(SCI0.SSR.BIT.TDRE) SCI0.SSR.BIT.TDRE = 0; // TX empty intr. clear
287+ SCI0.SCR.BIT.TIE = 1; // TX empty intr. enable
267288 }
268289
269- // Transfer start
270- serial_proc = SCI_TX_IN_PROGRESS;
271- switch( sci_setting.code_setting_index ) {
272- case COMM_CODE_ISO:
273- SCI0.TDR = Cnv2Iso( (unsigned char) tx_status.p_buf[tx_status.sent_bytes++]);
274- break;
275- case COMM_CODE_EIA:
276- SCI0.TDR = Cnv2Eia( (unsigned char) tx_status.p_buf[tx_status.sent_bytes++]);
277- break;
278- default:
279- SCI0.TDR = (unsigned char) tx_status.p_buf[tx_status.sent_bytes++];
280- break;
281- }
282-
283- if(SCI0.SSR.BIT.TDRE) SCI0.SSR.BIT.TDRE = 0; // TX empty intr. clear
284- SCI0.SCR.BIT.TIE = 1; // TX empty intr. enable
285290 }
286291
287292 // -------------------------------------------
@@ -317,17 +322,21 @@
317322 break;
318323
319324 case SCI_TX_IN_PROGRESS:
320- if( tx_status.sent_bytes >= tx_status.file_size ) serial_proc = SCI_TX_IN_END;
325+ if( tx_status.sent_bytes >= tx_status.file_size ) {
326+ SCI0.SCR.BIT.TIE = 0; //TX empty Interrupt disable
327+ serial_proc = SCI_TX_IN_END;
328+ serial_disable_timer = 1000;
329+ }
321330 break;
322331
323332 case SCI_TX_IN_PAUSE:
324333 if( sci_setting.flow_control_request == FLOW_REQ_RESUME ) {
334+ sci_setting.flow_control_request = FLOW_REQ_NONE;
325335 TransferStartRequest(0, 0);
326336 }
327337 break;
328338
329339 case SCI_TX_IN_END:
330- SCI0.SCR.BIT.TIE = 0; //TX empty Interrupt disable
331340 serial_proc = SCI_IDLE;
332341 break;
333342
@@ -593,6 +602,80 @@
593602 }
594603
595604 // -------------------------------------------
605+// UI Function - SERIAL trans
606+// -------------------------------------------
607+static int ui_function_serial_trans(UI_COMMAND uicmd, int param) {
608+ static unsigned char current_index;
609+ static unsigned char ok_press;
610+ int ret_val;
611+
612+ ret_val = UI_RET_READY;
613+
614+ switch( uicmd.cmd ) {
615+ case UI_CMD_NOP:
616+ break;
617+
618+ case UI_CMD_KEY_PRESS_OK:
619+ if( uicmd.param == OFF_EDGE ) ok_press = 0;
620+ else ok_press = 1;
621+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
622+
623+ break;
624+
625+ case UI_CMD_INTEVAL:
626+ // Title
627+ switch( serial_proc ) {
628+ case SCI_INITIALIZE:
629+ case SCI_ERROR_STOP:
630+ case SCI_READY_WAIT:
631+ sc1602_set_buffer( 0, "SCI is not ready" );
632+ break;
633+
634+ case SCI_IDLE:
635+ sc1602_set_buffer( 0, "SCI is ready. " );
636+ break;
637+
638+ case SCI_TX_IN_PROGRESS:
639+ sc1602_set_buffer( 0, "Sending... " );
640+ break;
641+
642+ case SCI_TX_IN_PAUSE:
643+ sc1602_set_buffer( 0, "Pause.... " );
644+ break;
645+
646+ case SCI_TX_IN_END:
647+ sc1602_set_buffer( 0, "Complete! " );
648+ break;
649+ }
650+ sc1602_set_buffer_progress_kb(1, tx_status.sent_bytes, tx_status.file_size);
651+ break;
652+
653+ case UI_CMD_STARTED:
654+ current_index = 0;
655+ ok_press = 0;
656+ break;
657+
658+ case UI_CMD_KEY_PRESS_UP:
659+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
660+ if( current_index != 0 ) current_index--;
661+ break;
662+ case UI_CMD_KEY_PRESS_DOWN:
663+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
664+ if( ok_press == 0 ) {
665+ if( debug_var_table[current_index+1].num != -1 ) current_index++;
666+ } else {
667+ // TODO
668+ }
669+ break;
670+ case UI_CMD_KEY_PRESS_BACK:
671+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
672+ ret_val = UI_RET_QUIT;
673+ break;
674+ }
675+ return ret_val;
676+}
677+
678+// -------------------------------------------
596679 // UI Sub Function - SERIAL nop
597680 // -------------------------------------------
598681 static int ui_function_serial_nop(UI_COMMAND uicmd, int param) {
Show on old repository browser