static int hex2bin (const char *hex, char *bin, int);
+static int bin2hex (const char *bin, char *hex, int);
+
static int putpkt_binary (char *buf, int cnt);
static void check_binary_download (CORE_ADDR addr);
{
int i;
- /* May use a length, or a nul-terminated string as input. */
- if (count == 0)
- count = strlen (hex) / 2;
-
for (i = 0; i < count; i++)
{
if (hex[0] == 0 || hex[1] == 0)
}
static int
-bin2hex (char *bin, char *hex, int count)
+bin2hex (const char *bin, char *hex, int count)
{
int i;
/* May use a length, or a nul-terminated string as input. */
putpkt (buf);
getpkt (buf, PBUFSIZ, 0);
- if (packet_ok(buf, &remote_protocol_E) == PACKET_OK)
+ if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
return;
}
}
putpkt (buf);
getpkt (buf, PBUFSIZ, 0);
- if (packet_ok(buf, &remote_protocol_e) == PACKET_OK)
+ if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
return;
}
}
putpkt (buf);
getpkt (buf, PBUFSIZ, 0);
- if (packet_ok(buf, &remote_protocol_E) == PACKET_OK)
+ if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
goto register_event_loop;
}
}
putpkt (buf);
getpkt (buf, PBUFSIZ, 0);
- if (packet_ok(buf, &remote_protocol_e) == PACKET_OK)
+ if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
goto register_event_loop;
}
}
{
unsigned char *p1;
char *p_temp;
+ int fieldsize;
/* Read the register number */
regno = strtol ((const char *) p, &p_temp, 16);
Packet: '%s'\n",
regno, p, buf);
- if (hex2bin (p, regs, REGISTER_RAW_SIZE (regno))
- < REGISTER_RAW_SIZE (regno))
+ fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (regno));
+ p += 2 * fieldsize;
+ if (fieldsize < REGISTER_RAW_SIZE (regno))
warning ("Remote reply is too short: %s", buf);
supply_register (regno, regs);
}
{
unsigned char *p1;
char *p_temp;
+ int fieldsize;
/* Read the register number */
regno = strtol ((const char *) p, &p_temp, 16);
Packet: '%s'\n",
regno, p, buf);
- if (hex2bin (p, regs, REGISTER_RAW_SIZE (regno))
- < REGISTER_RAW_SIZE (regno))
+ fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (regno));
+ p += 2 * fieldsize;
+ if (fieldsize < REGISTER_RAW_SIZE (regno))
warning ("Remote reply is too short: %s", buf);
supply_register (regno, regs);
}
/* Normal mode: Send target system values byte by byte, in
increasing byte addresses. Each byte is encoded as a two hex
value. */
- bin2hex (myaddr, p, todo);
- nr_bytes = todo;
+ nr_bytes = bin2hex (myaddr, p, todo);
+ p += 2 * nr_bytes;
break;
case PACKET_SUPPORT_UNKNOWN:
internal_error (__FILE__, __LINE__,