diff options
Diffstat (limited to 'src/generic')
-rw-r--r-- | src/generic/crc16_ccitt.c | 2 | ||||
-rw-r--r-- | src/generic/misc.h | 2 | ||||
-rw-r--r-- | src/generic/serial_irq.c | 15 | ||||
-rw-r--r-- | src/generic/usb_cdc.c | 13 |
4 files changed, 13 insertions, 19 deletions
diff --git a/src/generic/crc16_ccitt.c b/src/generic/crc16_ccitt.c index 8347bb83..87d08cac 100644 --- a/src/generic/crc16_ccitt.c +++ b/src/generic/crc16_ccitt.c @@ -8,7 +8,7 @@ // Implement the standard crc "ccitt" algorithm on the given buffer uint16_t -crc16_ccitt(char *buf, uint8_t len) +crc16_ccitt(uint8_t *buf, uint_fast8_t len) { uint16_t crc = 0xffff; while (len--) { diff --git a/src/generic/misc.h b/src/generic/misc.h index 65861207..eebd16d8 100644 --- a/src/generic/misc.h +++ b/src/generic/misc.h @@ -16,6 +16,6 @@ void timer_kick(void); void *dynmem_start(void); void *dynmem_end(void); -uint16_t crc16_ccitt(char *buf, uint8_t len); +uint16_t crc16_ccitt(uint8_t *buf, uint_fast8_t len); #endif // misc.h diff --git a/src/generic/serial_irq.c b/src/generic/serial_irq.c index 79eaad7f..7c7842ea 100644 --- a/src/generic/serial_irq.c +++ b/src/generic/serial_irq.c @@ -14,10 +14,8 @@ #include "sched.h" // sched_wake_tasks #include "serial_irq.h" // serial_enable_tx_irq -static char receive_buf[192]; -static uint8_t receive_pos; -static char transmit_buf[96]; -static uint8_t transmit_pos, transmit_max; +static uint8_t receive_buf[192], receive_pos; +static uint8_t transmit_buf[96], transmit_pos, transmit_max; DECL_CONSTANT(SERIAL_BAUD, CONFIG_SERIAL_BAUD); @@ -73,9 +71,8 @@ console_pop_input(uint_fast8_t len) void console_task(void) { - uint_fast8_t rpos = readb(&receive_pos); - uint8_t pop_count; - int8_t ret = command_find_block(receive_buf, rpos, &pop_count); + uint_fast8_t rpos = readb(&receive_pos), pop_count; + int_fast8_t ret = command_find_block(receive_buf, rpos, &pop_count); if (ret > 0) command_dispatch(receive_buf, pop_count); if (ret) @@ -110,8 +107,8 @@ console_sendf(const struct command_encoder *ce, va_list args) } // Generate message - char *buf = &transmit_buf[tmax]; - uint8_t msglen = command_encodef(buf, ce, args); + uint8_t *buf = &transmit_buf[tmax]; + uint_fast8_t msglen = command_encodef(buf, ce, args); command_add_frame(buf, msglen); // Start message transmit diff --git a/src/generic/usb_cdc.c b/src/generic/usb_cdc.c index fea567ec..49bb483e 100644 --- a/src/generic/usb_cdc.c +++ b/src/generic/usb_cdc.c @@ -23,8 +23,7 @@ ****************************************************************/ static struct task_wake usb_bulk_in_wake; -static char transmit_buf[96]; -static uint8_t transmit_pos; +static uint8_t transmit_buf[96], transmit_pos; void usb_notify_bulk_in(void) @@ -65,8 +64,8 @@ console_sendf(const struct command_encoder *ce, va_list args) return; // Generate message - char *buf = &transmit_buf[tpos]; - uint8_t msglen = command_encodef(buf, ce, args); + uint8_t *buf = &transmit_buf[tpos]; + uint_fast8_t msglen = command_encodef(buf, ce, args); command_add_frame(buf, msglen); // Start message transmit @@ -80,8 +79,7 @@ console_sendf(const struct command_encoder *ce, va_list args) ****************************************************************/ static struct task_wake usb_bulk_out_wake; -static char receive_buf[128]; -static uint8_t receive_pos; +static uint8_t receive_buf[128], receive_pos; void usb_notify_bulk_out(void) @@ -95,8 +93,7 @@ usb_bulk_out_task(void) if (!sched_check_wake(&usb_bulk_out_wake)) return; // Process any existing message blocks - uint_fast8_t rpos = receive_pos; - uint8_t pop_count; + uint_fast8_t rpos = receive_pos, pop_count; int_fast8_t ret = command_find_block(receive_buf, rpos, &pop_count); if (ret > 0) command_dispatch(receive_buf, pop_count); |