aboutsummaryrefslogtreecommitdiff
path: root/src/stm32/gdb_if.c
diff options
context:
space:
mode:
authorGareth McMullin2012-01-09 23:15:10 +1300
committerGareth McMullin2012-01-09 23:15:10 +1300
commit53ebc6770e7886f568633bddec16d9f6d351c6fb (patch)
tree4d52322919536eab3beb1eea0c3b24742a3b3d03 /src/stm32/gdb_if.c
parent7e0de5b86b654842c85e38bd36b22fe4176068bf (diff)
Configure CDC ACM packet size in a #define for easy access.
This doesn't work for >64 bytes. Suspect bug in libopencm3.
Diffstat (limited to 'src/stm32/gdb_if.c')
-rw-r--r--src/stm32/gdb_if.c12
1 files changed, 5 insertions, 7 deletions
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));