From 53ebc6770e7886f568633bddec16d9f6d351c6fb Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 9 Jan 2012 23:15:10 +1300 Subject: Configure CDC ACM packet size in a #define for easy access. This doesn't work for >64 bytes. Suspect bug in libopencm3. --- src/stm32/gdb_if.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/stm32/gdb_if.c') diff --git a/src/stm32/gdb_if.c b/src/stm32/gdb_if.c index 59e9c2b..aa43293 100644 --- a/src/stm32/gdb_if.c +++ b/src/stm32/gdb_if.c @@ -27,18 +27,16 @@ #include "gdb_if.h" -#define VIRTUAL_COM_PORT_DATA_SIZE 64 - static uint32_t count_out; static uint32_t count_in; static uint32_t out_ptr; -static uint8_t buffer_out[VIRTUAL_COM_PORT_DATA_SIZE]; -static uint8_t buffer_in[VIRTUAL_COM_PORT_DATA_SIZE]; +static uint8_t buffer_out[CDCACM_PACKET_SIZE]; +static uint8_t buffer_in[CDCACM_PACKET_SIZE]; void gdb_if_putchar(unsigned char c, int flush) { buffer_in[count_in++] = c; - if(flush || (count_in == VIRTUAL_COM_PORT_DATA_SIZE)) { + if(flush || (count_in == CDCACM_PACKET_SIZE)) { /* Refuse to send if USB isn't configured, and * don't bother if nobody's listening */ if((cdcacm_get_config() != 1) || !cdcacm_get_dtr()) { @@ -59,7 +57,7 @@ unsigned char gdb_if_getchar(void) while(cdcacm_get_config() != 1); count_out = usbd_ep_read_packet(1, buffer_out, - VIRTUAL_COM_PORT_DATA_SIZE); + CDCACM_PACKET_SIZE); out_ptr = 0; } @@ -76,7 +74,7 @@ unsigned char gdb_if_getchar_to(int timeout) return 0x04; count_out = usbd_ep_read_packet(1, buffer_out, - VIRTUAL_COM_PORT_DATA_SIZE); + CDCACM_PACKET_SIZE); out_ptr = 0; } while(timeout_counter && !(out_ptr < count_out)); -- cgit v1.2.3