static void put_hex_uint8(StubState *state, uint8_t val)
{
    char c = nibble_to_hex_char(val >> 4);
    state->host_interface.output_checksum += c;
    Serial_write_byte(c);
    c = nibble_to_hex_char(val);
    state->host_interface.output_checksum += c;
    Serial_write_byte(c);
}
Example #2
0
char *
v128_hex_string(v128_t *x) {
  int i, j;

  for (i=j=0; i < 16; i++) {
    bit_string[j++]  = nibble_to_hex_char(x->v8[i] >> 4);
    bit_string[j++]  = nibble_to_hex_char(x->v8[i] & 0xF);
  }

  bit_string[j] = 0; /* null terminate string */
  return bit_string;
}
void put_hex_buffer(StubState *state, const uint8_t * buffer, int len)
{
    int i;
    char c;
    
    for (i = 0; i < len; i++)
    {
        c = nibble_to_hex_char(buffer[i] >> 4);
        state->host_interface.output_checksum += c;
        Serial_write_byte(c);
        c = nibble_to_hex_char(buffer[i]);
        state->host_interface.output_checksum += c;
        Serial_write_byte(c);
    }
}
Example #4
0
char *
octet_string_hex_string(const void *s, int length) {
  const uint8_t *str = (const uint8_t *)s;
  int i;

  /* double length, since one octet takes two hex characters */
  length *= 2;

  /* truncate string if it would be too long */
  if (length > MAX_PRINT_STRING_LEN)
    length = MAX_PRINT_STRING_LEN-1;

  for (i=0; i < length; i+=2) {
    bit_string[i]   = nibble_to_hex_char(*str >> 4);
    bit_string[i+1] = nibble_to_hex_char(*str++ & 0xF);
  }
  bit_string[i] = 0; /* null terminate string */
  return bit_string;
}