comparison rvinterf/lowlevel/tfc139.c @ 418:a9bf3e92a30c

tfc139: clean exit on success
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 17 Jun 2014 20:59:59 +0000
parents 62f850da5d49
children 3a46728e054b
comparison
equal deleted inserted replaced
417:d8a120647649 418:a9bf3e92a30c
50 static unsigned iram_load_addr = 0x800000; 50 static unsigned iram_load_addr = 0x800000;
51 static unsigned stack_smash_addr = 0x837C54; 51 static unsigned stack_smash_addr = 0x837C54;
52 52
53 static u_char stack_smash_payload[4]; 53 static u_char stack_smash_payload[4];
54 54
55 static char *target_tty_port;
56
55 static void 57 static void
56 send_compal_memwrite(addr, payload, payload_len) 58 send_compal_memwrite(addr, payload, payload_len)
57 unsigned addr; 59 unsigned addr;
58 u_char *payload; 60 u_char *payload;
59 { 61 {
99 } 101 }
100 if (argc - optind != 1) 102 if (argc - optind != 1)
101 goto usage; 103 goto usage;
102 baudrate_name = "57600"; /* what Compal phones use */ 104 baudrate_name = "57600"; /* what Compal phones use */
103 open_target_serial(argv[optind]); 105 open_target_serial(argv[optind]);
106 target_tty_port = argv[optind];
104 107
105 set_serial_nonblock(0); 108 set_serial_nonblock(0);
106 setlinebuf(stdout); 109 setlinebuf(stdout);
107 if (logfname) { 110 if (logfname) {
108 logF = fopen(logfname, "w"); 111 logF = fopen(logfname, "w");
152 } 155 }
153 156
154 handle_rx_packet() 157 handle_rx_packet()
155 { 158 {
156 if (rxpkt_len == 2 && rxpkt[0] == 'O' && rxpkt[1] == 'K') { 159 if (rxpkt_len == 2 && rxpkt[0] == 'O' && rxpkt[1] == 'K') {
157 output_line("Success! Run fc-loadtool now!"); 160 output_line(
158 return; 161 "Success: target should now be in boot ROM download wait");
162 printf("You can now run fc-loadtool -h compal -c none %s\n",
163 target_tty_port);
164 exit(0);
159 } 165 }
160 switch (rxpkt[0]) { 166 switch (rxpkt[0]) {
161 case RVT_RV_HEADER: 167 case RVT_RV_HEADER:
162 if (rxpkt_len < 6) 168 if (rxpkt_len < 6)
163 goto unknown; 169 goto unknown;