• R/O
  • SSH
  • HTTPS

panda-p: Commit


Commit MetaInfo

Revisión12 (tree)
Tiempo2012-08-22 17:03:12
Autortekken_boss

Log Message

000.001.012: 2012/08/22 16:59 : Single chip mode is implemented.

Modification

  • [GEN] Single chip mode (Enable ROM_VERSION, default off)
--> TO CHANGE TO SINGLE CHIP MODE
        • Enable ROM_VERSION
        • Modify Makefile to apply H8-3069_single.x as linker script.
  • [SCI] Transfer debug UI is added.

Confirmation

  • Compilable.

Cambiar Resumen

Diferencia incremental

--- trunk/src/srcver.h (revision 11)
+++ trunk/src/srcver.h (revision 12)
@@ -15,9 +15,10 @@
1515
1616 #define SRCVER_MAJOR 0
1717 #define SRCVER_MINOR 1
18-#define SRCVER_BUILD 11
18+#define SRCVER_BUILD 12
1919
2020 /* --------------------------------------------------------------------
21+000.001.012: 2012/08/22 16:59 : Single chip mode is implemented.
2122 000.001.011: 2012/06/18 09:21 : enduser mode is ready. (still not default)
2223 000.001.010: 2012/06/18 02:14 : A part of enduser mode is added.
2324 000.001.009: 2012/06/13 18:35 : Fine tuning of SCI handshake.
--- trunk/src/ui.c (revision 11)
+++ trunk/src/ui.c (revision 12)
@@ -131,10 +131,20 @@
131131 break;
132132
133133 case UI_01_STARTUP:
134+#ifdef START_WITH_ENDUSERMODE
135+ {
136+ UI_COMMAND ui_cmd;
137+ ui_cmd.cmd = UI_CMD_STARTED;
138+ ui_cmdset( ui_cmd ); // TODO: error handling
139+ ui_event_timer = ui_app_table[current_index].interval_time; // timer reset
140+ ui_proc = UI_03_EXECUTING;
141+ }
142+#else
134143 if( ui_queue_rp || ui_queue_wp ) {
135144 ui_queue_rp = ui_queue_wp = 0;
136145 ui_proc++;
137146 }
147+#endif
138148 break;
139149
140150 case UI_02_TOP_LEVEL:
--- trunk/src/sc1602.c (revision 11)
+++ trunk/src/sc1602.c (revision 12)
@@ -56,7 +56,7 @@
5656 volatile int lcd_wait_timer;
5757 volatile int lcd_proc;
5858 volatile int lcd_disable_timer;
59-const char hex2ascii[] = "0123456789ABCDEF";
59+static const char hex2ascii[] = "0123456789ABCDEF";
6060
6161 enum lcd_process_mode {
6262 LCD_00_INIT,
--- trunk/src/serial.c (revision 11)
+++ trunk/src/serial.c (revision 12)
@@ -58,6 +58,7 @@
5858 static int ui_function_serial_debug(UI_COMMAND uicmd, int param);
5959 static int ui_function_serial_config(UI_COMMAND uicmd, int param);
6060 static int ui_function_serial_trans(UI_COMMAND uicmd, int param);
61+static int ui_function_serial_trans_debug(UI_COMMAND uicmd, int param);
6162
6263 // -------------------------------------------
6364 // Variables
@@ -142,6 +143,7 @@
142143 { 0, 0, ui_function_serial_debug, " Debug ", },
143144 { 1, 0, ui_function_serial_config, " Config ", },
144145 { 2, 0, ui_function_serial_trans, " Transfer ", },
146+ { 3, 0, ui_function_serial_trans_debug, " Transfer(Dbg) ", },
145147 { -1, 0, ui_function_serial_nop, "0123456789ABCDEF", },
146148 };
147149
@@ -803,7 +805,141 @@
803805 return ret_val;
804806 }
805807
808+static const char hex2ascii[] = "0123456789ABCDEF";
806809 // -------------------------------------------
810+// UI Function - SERIAL trans (debug)
811+// -------------------------------------------
812+static int ui_function_serial_trans_debug(UI_COMMAND uicmd, int param) {
813+ static unsigned char current_index;
814+ static unsigned char ok_press;
815+ unsigned char *data;
816+ int ret_val;
817+ unsigned int uint_val;
818+ char tempbuf[2][16];
819+ // 0123456789ABCDEF
820+ // ----------------
821+ // R[?]:........|**
822+ // S..C..P.. ...%
823+ tempbuf[0][0x0]='R'; tempbuf[0][0x1]='['; tempbuf[0][0x2]=' '; tempbuf[0][0x3]=']';
824+ tempbuf[0][0x4]=' '; tempbuf[0][0x5]=' '; tempbuf[0][0x6]=' '; tempbuf[0][0x7]=' ';
825+ tempbuf[0][0x8]=' '; tempbuf[0][0x9]=' '; tempbuf[0][0xA]=' '; tempbuf[0][0xB]=' ';
826+ tempbuf[0][0xC]=' '; tempbuf[0][0xD]='|'; tempbuf[0][0xE]=' '; tempbuf[0][0xF]=' ';
827+
828+ tempbuf[1][0x0]='S'; tempbuf[1][0x1]=' '; tempbuf[1][0x2]=' '; tempbuf[1][0x3]='C';
829+ tempbuf[1][0x4]=' '; tempbuf[1][0x5]=' '; tempbuf[1][0x6]='P'; tempbuf[1][0x7]=' ';
830+ tempbuf[1][0x8]=' '; tempbuf[1][0x9]=' '; tempbuf[1][0xA]=' '; tempbuf[1][0xB]=' ';
831+ tempbuf[1][0xC]=' '; tempbuf[1][0xD]=' '; tempbuf[1][0xE]=' '; tempbuf[1][0xF]='%';
832+
833+
834+ ret_val = UI_RET_READY;
835+
836+ switch( uicmd.cmd ) {
837+ case UI_CMD_NOP:
838+ break;
839+
840+ case UI_CMD_KEY_PRESS_OK:
841+ if( uicmd.param == OFF_EDGE ) ok_press = 0;
842+ else ok_press = 1;
843+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
844+ break;
845+
846+ case UI_CMD_INTEVAL:
847+ // Title
848+ switch( serial_proc ) {
849+ case SCI_INITIALIZE:
850+ case SCI_ERROR_STOP:
851+ case SCI_READY_WAIT:
852+ //sc1602_set_buffer( 0, "SCI is not ready" );
853+ tempbuf[0][0xE]='N'; tempbuf[0][0xF]='R'; // NR / Not ready
854+ break;
855+
856+ case SCI_IDLE:
857+ //sc1602_set_buffer( 0, "SCI is ready. " );
858+ tempbuf[0][0xE]='R'; tempbuf[0][0xF]='D'; // RD / Ready
859+ break;
860+
861+ case SCI_DATA_SET:
862+ case SCI_WAIT_TX_OK:
863+ if( sci_setting.flow_control_request == FLOW_REQ_PAUSE )
864+ /*sc1602_set_buffer( 0, "Pause.... " );*/ {tempbuf[0][0xE]='P'; tempbuf[0][0xF]='S';} // PS / Pause
865+ else
866+ /*sc1602_set_buffer( 0, "Sending... " );*/ {tempbuf[0][0xE]='S'; tempbuf[0][0xF]='D';} // SD / Sending
867+ break;
868+
869+ case SCI_TX_IN_PROGRESS:
870+ //sc1602_set_buffer( 0, "Sending... " );
871+ tempbuf[0][0xE]='S'; tempbuf[0][0xF]='D'; // SD / Sending
872+ break;
873+
874+ case SCI_TX_IN_PAUSE:
875+ //sc1602_set_buffer( 0, "Pause.... " );
876+ tempbuf[0][0xE]='P'; tempbuf[0][0xF]='S'; // PS / Pause
877+ break;
878+
879+ case SCI_TX_IN_END:
880+ //sc1602_set_buffer( 0, "Complete! " );
881+ tempbuf[0][0xE]='P'; tempbuf[0][0xF]='S'; // DN / Complete
882+ break;
883+ }
884+
885+ // Read buf dump
886+ data = &ReceiveBuf[(ReceiveCnt&0x03)];
887+ tempbuf[0][0x2] = hex2ascii[ReceiveCnt & 0x0F ];
888+ tempbuf[0][0x5] = hex2ascii[(*(data + 0) >> 4) & 0x0F ];
889+ tempbuf[0][0x6] = hex2ascii[(*(data + 0) ) & 0x0F ];
890+ tempbuf[0][0x7] = hex2ascii[(*(data + 1) >> 4) & 0x0F ];
891+ tempbuf[0][0x8] = hex2ascii[(*(data + 1) ) & 0x0F ];
892+ tempbuf[0][0x9] = hex2ascii[(*(data + 2) >> 4) & 0x0F ];
893+ tempbuf[0][0xA] = hex2ascii[(*(data + 2) ) & 0x0F ];
894+ tempbuf[0][0xB] = hex2ascii[(*(data + 3) >> 4) & 0x0F ];
895+ tempbuf[0][0xC] = hex2ascii[(*(data + 3) ) & 0x0F ];
896+
897+ // Registers
898+ tempbuf[1][0x1] = hex2ascii[(SCI0.SSR.BYTE >> 4) & 0x0F ];
899+ tempbuf[1][0x2] = hex2ascii[(SCI0.SSR.BYTE ) & 0x0F ];
900+ tempbuf[1][0x4] = hex2ascii[(SCI0.SCR.BYTE >> 4) & 0x0F ];
901+ tempbuf[1][0x5] = hex2ascii[(SCI0.SCR.BYTE ) & 0x0F ];
902+ tempbuf[1][0x7] = hex2ascii[(serial_proc >> 4) & 0x0F ];
903+ tempbuf[1][0x8] = hex2ascii[(serial_proc ) & 0x0F ];
904+
905+ // Percentage
906+ uint_val = (unsigned int) (tx_status.sent_bytes/tx_status.file_size)*100;
907+ tempbuf[1][0xC] = hex2ascii[(uint_val/100) % 10 ];
908+ tempbuf[1][0xD] = hex2ascii[(uint_val/10) % 10 ];
909+ tempbuf[1][0xE] = hex2ascii[(uint_val) % 10 ];
910+
911+ sc1602_set_buffer(0,tempbuf[0]);
912+ sc1602_set_buffer(1,tempbuf[1]);
913+ break;
914+
915+ case UI_CMD_STARTED:
916+ current_index = 0;
917+ ok_press = 0;
918+ break;
919+
920+ case UI_CMD_KEY_PRESS_UP:
921+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
922+ if( current_index != 0 ) current_index--;
923+ break;
924+
925+ case UI_CMD_KEY_PRESS_DOWN:
926+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
927+ if( ok_press == 0 ) {
928+ if( debug_var_table[current_index+1].num != -1 ) current_index++;
929+ } else {
930+ // TODO
931+ }
932+ break;
933+
934+ case UI_CMD_KEY_PRESS_BACK:
935+ if( uicmd.param == OFF_EDGE ) break; // Ignore off edge
936+ ret_val = UI_RET_QUIT;
937+ break;
938+ }
939+ return ret_val;
940+}
941+
942+// -------------------------------------------
807943 // UI Sub Function - SERIAL nop
808944 // -------------------------------------------
809945 static int ui_function_serial_nop(UI_COMMAND uicmd, int param) {
--- trunk/src/main.c (revision 11)
+++ trunk/src/main.c (revision 12)
@@ -54,6 +54,19 @@
5454 // Main routine
5555 // -------------------------------------------
5656 int main(void) {
57+/*
58+ BSC.ABWCR.BYTE = 0xff; // CS0-CS7:8bitバス
59+ BSC.ASTCR.BYTE = 0xff; // CS0-CS7:3ステートアクセス
60+ BSC.BCR.BYTE = 0xc6; //
61+
62+ P1DDR=0xFF; // Port1 use for BUS
63+ P2DDR=0x07; // Port2 use for BUS
64+ P8DDR=0xEC; // Port8(4-2) use for CS
65+ RTCOR=0x03;
66+ RTMCSR=0x27;
67+ DRCRB=0x98;
68+ DRCRA=0x78;
69+*/
5770 // uCom initialize
5871 port_initialize();
5972 register_initialize();
--- trunk/src/Makefile (revision 11)
+++ trunk/src/Makefile (revision 12)
@@ -16,6 +16,7 @@
1616 AS = $(TOOL_PREFIX)as
1717
1818 LDSCRIPT = H8_3069_h8mon.x
19+#LDSCRIPT = H8_3069_single.x
1920 CRT0 = start.s
2021 SRCS = main.c sc1602.c key.c ui.c sl811.c usb_ms.c led.c fat.c serial.c
2122
--- trunk/src/common.h (revision 11)
+++ trunk/src/common.h (revision 12)
@@ -13,7 +13,16 @@
1313
1414 #include "3069s.h"
1515
16-#define DEBUG_ON
16+//#define ROM_VERSION
17+#ifdef ROM_VERSION
18+ //#define DEBUG_ON
19+ #define START_WITH_ENDUSERMODE
20+#else
21+ #define DEBUG_ON
22+ #define START_WITH_ENDUSERMODE
23+#endif
24+
25+
1726 #ifdef DEBUG_ON
1827 #define SL811HS_DEBUG_ON
1928 #define MSCLASS_DEBUG_ON
@@ -49,8 +58,10 @@
4958 #define CLASS_STS_UNKNOWN 0xFF
5059
5160
61+#ifdef DEBUG_ON
5262 #define printf ((int (*)(const char *,...))0x00002b84)
5363 #define scanf ((int (*)(const char *,...))0x00002bd6)
64+#endif // DEBUG_ON
5465
5566 extern const char hex2char[256][3];
5667
Show on old repository browser