Lines Matching refs:ch
214 static int hex(unsigned char ch);
222 static int hex(unsigned char ch) in hex() argument
224 if (ch >= 'a' && ch <= 'f') in hex()
225 return ch-'a'+10; in hex()
226 if (ch >= '0' && ch <= '9') in hex()
227 return ch-'0'; in hex()
228 if (ch >= 'A' && ch <= 'F') in hex()
229 return ch-'A'+10; in hex()
271 unsigned char ch; in gdbstub_recv_packet() local
277 gdbstub_rx_char(&ch, 0); in gdbstub_recv_packet()
278 } while (ch != '$'); in gdbstub_recv_packet()
287 ret = gdbstub_rx_char(&ch, 0); in gdbstub_recv_packet()
291 if (ch == '#') in gdbstub_recv_packet()
293 checksum += ch; in gdbstub_recv_packet()
294 buffer[count] = ch; in gdbstub_recv_packet()
311 ret = gdbstub_rx_char(&ch, 0); in gdbstub_recv_packet()
314 xmitcsum = hex(ch) << 4; in gdbstub_recv_packet()
316 ret = gdbstub_rx_char(&ch, 0); in gdbstub_recv_packet()
319 xmitcsum |= hex(ch); in gdbstub_recv_packet()
366 unsigned char ch; in gdbstub_send_packet() local
376 while ((ch = buffer[count]) != 0) { in gdbstub_send_packet()
377 gdbstub_tx_char(ch); in gdbstub_send_packet()
378 checksum += ch; in gdbstub_send_packet()
386 } while (gdbstub_rx_char(&ch,0), in gdbstub_send_packet()
388 ch=='-' && (gdbstub_proto("### GDB Rx NAK\n"),0), in gdbstub_send_packet()
389 ch!='-' && ch!='+' && (gdbstub_proto("### GDB Rx ??? %02x\n",ch),0), in gdbstub_send_packet()
391 ch!='+' && ch!='$'); in gdbstub_send_packet()
393 if (ch=='+') { in gdbstub_send_packet()
399 gdbstub_rx_unget = ch; in gdbstub_send_packet()
409 int count = 0, ch; in hexToInt() local
413 ch = hex(**ptr); in hexToInt()
414 if (ch < 0) in hexToInt()
417 *_value = (*_value << 4) | ((uint8_t) ch & 0xf); in hexToInt()
669 uint8_t ch[4] __attribute__((aligned(4))); in mem2hex() local
672 if (!gdbstub_read_byte(mem,ch)) in mem2hex()
674 buf = hex_byte_pack(buf, ch[0]); in mem2hex()
680 if (!gdbstub_read_word(mem,(uint16_t *)ch)) in mem2hex()
682 buf = hex_byte_pack(buf, ch[0]); in mem2hex()
683 buf = hex_byte_pack(buf, ch[1]); in mem2hex()
689 if (!gdbstub_read_dword(mem,(uint32_t *)ch)) in mem2hex()
691 buf = hex_byte_pack(buf, ch[0]); in mem2hex()
692 buf = hex_byte_pack(buf, ch[1]); in mem2hex()
693 buf = hex_byte_pack(buf, ch[2]); in mem2hex()
694 buf = hex_byte_pack(buf, ch[3]); in mem2hex()
700 if (!gdbstub_read_word(mem,(uint16_t *)ch)) in mem2hex()
702 buf = hex_byte_pack(buf, ch[0]); in mem2hex()
703 buf = hex_byte_pack(buf, ch[1]); in mem2hex()
709 if (!gdbstub_read_byte(mem,ch)) in mem2hex()
711 buf = hex_byte_pack(buf, ch[0]); in mem2hex()
731 } ch; in hex2mem() local
734 ch.b[0] = hex(*buf++) << 4; in hex2mem()
735 ch.b[0] |= hex(*buf++); in hex2mem()
736 if (!gdbstub_write_byte(mem,ch.b[0])) in hex2mem()
743 ch.b[0] = hex(*buf++) << 4; in hex2mem()
744 ch.b[0] |= hex(*buf++); in hex2mem()
745 ch.b[1] = hex(*buf++) << 4; in hex2mem()
746 ch.b[1] |= hex(*buf++); in hex2mem()
747 if (!gdbstub_write_word(mem,ch.w)) in hex2mem()
754 ch.b[0] = hex(*buf++) << 4; in hex2mem()
755 ch.b[0] |= hex(*buf++); in hex2mem()
756 ch.b[1] = hex(*buf++) << 4; in hex2mem()
757 ch.b[1] |= hex(*buf++); in hex2mem()
758 ch.b[2] = hex(*buf++) << 4; in hex2mem()
759 ch.b[2] |= hex(*buf++); in hex2mem()
760 ch.b[3] = hex(*buf++) << 4; in hex2mem()
761 ch.b[3] |= hex(*buf++); in hex2mem()
762 if (!gdbstub_write_dword(mem,ch.l)) in hex2mem()
769 ch.b[0] = hex(*buf++) << 4; in hex2mem()
770 ch.b[0] |= hex(*buf++); in hex2mem()
771 ch.b[1] = hex(*buf++) << 4; in hex2mem()
772 ch.b[1] |= hex(*buf++); in hex2mem()
773 if (!gdbstub_write_word(mem,ch.w)) in hex2mem()
780 ch.b[0] = hex(*buf++) << 4; in hex2mem()
781 ch.b[0] |= hex(*buf++); in hex2mem()
782 if (!gdbstub_write_byte(mem,ch.b[0])) in hex2mem()
2030 unsigned char ch; in gdbstub_init() local
2049 do { gdbstub_rx_char(&ch, 0); } while (ch != '$'); in gdbstub_init()
2050 do { gdbstub_rx_char(&ch, 0); } while (ch != '#'); in gdbstub_init()
2051 do { ret = gdbstub_rx_char(&ch, 0); } while (ret != 0); /* eat first csum byte */ in gdbstub_init()
2052 do { ret = gdbstub_rx_char(&ch, 0); } while (ret != 0); /* eat second csum byte */ in gdbstub_init()
2097 unsigned char ch; in gdbstub_exit() local
2105 while ((ch = output_buffer[count]) != 0) { in gdbstub_exit()
2106 gdbstub_tx_char(ch); in gdbstub_exit()
2107 checksum += ch; in gdbstub_exit()