diff options
| -rw-r--r-- | src/cc1111/ao_dbg.c | 20 | ||||
| -rw-r--r-- | src/core/ao.h | 4 | ||||
| -rw-r--r-- | src/core/ao_cmd.c | 16 | ||||
| -rw-r--r-- | src/core/ao_send_packet.c | 20 | 
4 files changed, 24 insertions, 36 deletions
| diff --git a/src/cc1111/ao_dbg.c b/src/cc1111/ao_dbg.c index 847b5aaf..214cb013 100644 --- a/src/cc1111/ao_dbg.c +++ b/src/cc1111/ao_dbg.c @@ -281,22 +281,6 @@ debug_get(void)  	putchar('\n');  } -static uint8_t -getnibble(void) -{ -	__pdata char	c; - -	c = getchar(); -	if ('0' <= c && c <= '9') -		return c - '0'; -	if ('a' <= c && c <= 'f') -		return c - ('a' - 10); -	if ('A' <= c && c <= 'F') -		return c - ('A' - 10); -	ao_cmd_status = ao_cmd_lex_error; -	return 0; -} -  static void  debug_input(void)  { @@ -338,8 +322,8 @@ debug_output(void)  		return;  	ao_dbg_start_transfer(addr);  	while (count--) { -		b = getnibble() << 4; -		b |= getnibble(); +		b = ao_getnibble() << 4; +		b |= ao_getnibble();  		if (ao_cmd_status != ao_cmd_success)  			return;  		ao_dbg_write_byte(b); diff --git a/src/core/ao.h b/src/core/ao.h index 81d92e72..1aff3d49 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -170,6 +170,10 @@ ao_cmd_hex(void);  void  ao_cmd_decimal(void); +/* Read a single hex nibble off stdin. */ +uint8_t +ao_getnibble(void); +  uint8_t  ao_match_word(__code char *word); diff --git a/src/core/ao_cmd.c b/src/core/ao_cmd.c index 1814cecf..a3330974 100644 --- a/src/core/ao_cmd.c +++ b/src/core/ao_cmd.c @@ -110,6 +110,22 @@ putnibble(uint8_t v)  		putchar(v + ('a' - 10));  } +uint8_t +ao_getnibble(void) +{ +	char	c; + +	c = getchar(); +	if ('0' <= c && c <= '9') +		return c - '0'; +	if ('a' <= c && c <= 'f') +		return c - ('a' - 10); +	if ('A' <= c && c <= 'F') +		return c - ('A' - 10); +	ao_cmd_status = ao_cmd_lex_error; +	return 0; +} +  void  ao_cmd_put16(uint16_t v)  { diff --git a/src/core/ao_send_packet.c b/src/core/ao_send_packet.c index 1a8e74de..66315d22 100644 --- a/src/core/ao_send_packet.c +++ b/src/core/ao_send_packet.c @@ -21,22 +21,6 @@  static __xdata uint8_t ao_send[AO_MAX_SEND]; -static uint8_t -getnibble(void) -{ -	char	c; - -	c = getchar(); -	if ('0' <= c && c <= '9') -		return c - '0'; -	if ('a' <= c && c <= 'f') -		return c - ('a' - 10); -	if ('A' <= c && c <= 'F') -		return c - ('A' - 10); -	ao_cmd_status = ao_cmd_lex_error; -	return 0; -} -  static void  ao_send_packet(void)  { @@ -53,8 +37,8 @@ ao_send_packet(void)  		return;  	}  	for (i = 0; i < count; i++) { -		b = getnibble() << 4; -		b |= getnibble(); +		b = ao_getnibble() << 4; +		b |= ao_getnibble();  		if (ao_cmd_status != ao_cmd_success)  			return;  		ao_send[i] = b; | 
