More renaming - Prefix DAP-specific defines with DAP_ - PROBE_ defines refer to config options selected by a board type
diff --git a/CMakeLists.txt b/CMakeLists.txt index d86942d..e582ce7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -45,7 +45,7 @@ PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1 ) -option (DEBUG_ON_PICO "Compile firmware for the Pico instead of Debugprobe" OFF) +option (DEBUG_ON_PICO "Compile firmware for the Pico instead of Debug Probe" OFF) if (DEBUG_ON_PICO) target_compile_definitions (debugprobe PRIVATE DEBUG_ON_PICO=1
diff --git a/include/board_debugprobe_config.h b/include/board_debug_probe_config.h similarity index 83% rename from include/board_debugprobe_config.h rename to include/board_debug_probe_config.h index d56e04e..c6d3dfa 100644 --- a/include/board_debugprobe_config.h +++ b/include/board_debug_probe_config.h
@@ -39,16 +39,16 @@ #define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 2) // UART config -#define DEBUGPROBE_UART_TX 4 -#define DEBUGPROBE_UART_RX 5 -#define DEBUGPROBE_UART_INTERFACE uart1 -#define DEBUGPROBE_UART_BAUDRATE 115200 +#define PROBE_UART_TX 4 +#define PROBE_UART_RX 5 +#define PROBE_UART_INTERFACE uart1 +#define PROBE_UART_BAUDRATE 115200 -#define DEBUGPROBE_USB_CONNECTED_LED 2 -#define DEBUGPROBE_DAP_CONNECTED_LED 15 -#define DEBUGPROBE_DAP_RUNNING_LED 16 -#define DEBUGPROBE_UART_RX_LED 7 -#define DEBUGPROBE_UART_TX_LED 8 +#define PROBE_USB_CONNECTED_LED 2 +#define PROBE_DAP_CONNECTED_LED 15 +#define PROBE_DAP_RUNNING_LED 16 +#define PROBE_UART_RX_LED 7 +#define PROBE_UART_TX_LED 8 #define PROBE_PRODUCT_STRING "Debug Probe (CMSIS-DAP)"
diff --git a/include/board_example_config.h b/include/board_example_config.h index 6f93f34..825e6fb 100644 --- a/include/board_example_config.h +++ b/include/board_example_config.h
@@ -64,21 +64,21 @@ #endif #if defined(PROBE_CDC_UART) -#define DEBUGPROBE_UART_TX 4 -#define DEBUGPROBE_UART_RX 5 -#define DEBUGPROBE_UART_INTERFACE uart1 -#define DEBUGPROBE_UART_BAUDRATE 115200 +#define PROBE_UART_TX 4 +#define PROBE_UART_RX 5 +#define PROBE_UART_INTERFACE uart1 +#define PROBE_UART_BAUDRATE 115200 /* Flow control - some or all of these can be omitted if not used */ -#define DEBUGPROBE_UART_RTS 9 -#define DEBUGPROBE_UART_DTR 10 +#define PROBE_UART_RTS 9 +#define PROBE_UART_DTR 10 #endif /* LED config - some or all of these can be omitted if not used */ -#define DEBUGPROBE_USB_CONNECTED_LED 2 -#define DEBUGPROBE_DAP_CONNECTED_LED 15 -#define DEBUGPROBE_DAP_RUNNING_LED 16 -#define DEBUGPROBE_UART_RX_LED 7 -#define DEBUGPROBE_UART_TX_LED 8 +#define PROBE_USB_CONNECTED_LED 2 +#define PROBE_DAP_CONNECTED_LED 15 +#define PROBE_DAP_RUNNING_LED 16 +#define PROBE_UART_RX_LED 7 +#define PROBE_UART_TX_LED 8 #define PROBE_PRODUCT_STRING "Example Debug Probe"
diff --git a/include/board_pico_config.h b/include/board_pico_config.h index f8315f3..1f96d36 100644 --- a/include/board_pico_config.h +++ b/include/board_pico_config.h
@@ -40,12 +40,12 @@ #endif // UART config -#define DEBUGPROBE_UART_TX 4 -#define DEBUGPROBE_UART_RX 5 -#define DEBUGPROBE_UART_INTERFACE uart1 -#define DEBUGPROBE_UART_BAUDRATE 115200 +#define PROBE_UART_TX 4 +#define PROBE_UART_RX 5 +#define PROBE_UART_INTERFACE uart1 +#define PROBE_UART_BAUDRATE 115200 -#define DEBUGPROBE_USB_CONNECTED_LED 25 +#define PROBE_USB_CONNECTED_LED 25 #define PROBE_PRODUCT_STRING "Debugprobe on Pico (CMSIS-DAP)"
diff --git a/src/cdc_uart.c b/src/cdc_uart.c index 7e54383..9c2441f 100644 --- a/src/cdc_uart.c +++ b/src/cdc_uart.c
@@ -29,7 +29,7 @@ #include "tusb.h" -#include "debugprobe_config.h" +#include "probe_config.h" TaskHandle_t uart_taskhandle; TickType_t last_wake, interval = 100; @@ -41,30 +41,30 @@ #define DEBOUNCE_MS 40 static uint debounce_ticks = 5; -#ifdef DEBUGPROBE_UART_TX_LED +#ifdef PROBE_UART_TX_LED static uint tx_led_debounce; #endif -#ifdef DEBUGPROBE_UART_RX_LED +#ifdef PROBE_UART_RX_LED static uint rx_led_debounce; #endif void cdc_uart_init(void) { - gpio_set_function(DEBUGPROBE_UART_TX, GPIO_FUNC_UART); - gpio_set_function(DEBUGPROBE_UART_RX, GPIO_FUNC_UART); - gpio_set_pulls(DEBUGPROBE_UART_TX, 1, 0); - gpio_set_pulls(DEBUGPROBE_UART_RX, 1, 0); - uart_init(DEBUGPROBE_UART_INTERFACE, DEBUGPROBE_UART_BAUDRATE); + gpio_set_function(PROBE_UART_TX, GPIO_FUNC_UART); + gpio_set_function(PROBE_UART_RX, GPIO_FUNC_UART); + gpio_set_pulls(PROBE_UART_TX, 1, 0); + gpio_set_pulls(PROBE_UART_RX, 1, 0); + uart_init(PROBE_UART_INTERFACE, PROBE_UART_BAUDRATE); -#ifdef DEBUGPROBE_UART_RTS - gpio_init(DEBUGPROBE_UART_RTS); - gpio_set_dir(DEBUGPROBE_UART_RTS, GPIO_OUT); - gpio_put(DEBUGPROBE_UART_RTS, 1); +#ifdef PROBE_UART_RTS + gpio_init(PROBE_UART_RTS); + gpio_set_dir(PROBE_UART_RTS, GPIO_OUT); + gpio_put(PROBE_UART_RTS, 1); #endif -#ifdef DEBUGPROBE_UART_DTR - gpio_init(DEBUGPROBE_UART_DTR); - gpio_set_dir(DEBUGPROBE_UART_DTR, GPIO_OUT); - gpio_put(DEBUGPROBE_UART_DTR, 1); +#ifdef PROBE_UART_DTR + gpio_init(PROBE_UART_DTR); + gpio_set_dir(PROBE_UART_DTR, GPIO_OUT); + gpio_put(PROBE_UART_DTR, 1); #endif } @@ -75,8 +75,8 @@ uint rx_len = 0; // Consume uart fifo regardless even if not connected - while(uart_is_readable(DEBUGPROBE_UART_INTERFACE) && (rx_len < sizeof(rx_buf))) { - rx_buf[rx_len++] = uart_getc(DEBUGPROBE_UART_INTERFACE); + while(uart_is_readable(PROBE_UART_INTERFACE) && (rx_len < sizeof(rx_buf))) { + rx_buf[rx_len++] = uart_getc(PROBE_UART_INTERFACE); } if (tud_cdc_connected()) { @@ -85,8 +85,8 @@ /* Implicit overflow if we don't write all the bytes to the host. * Also throw away bytes if we can't write... */ if (rx_len) { -#ifdef DEBUGPROBE_UART_RX_LED - gpio_put(DEBUGPROBE_UART_RX_LED, 1); +#ifdef PROBE_UART_RX_LED + gpio_put(PROBE_UART_RX_LED, 1); rx_led_debounce = debounce_ticks; #endif written = MIN(tud_cdc_write_available(), rx_len); @@ -98,11 +98,11 @@ tud_cdc_write_flush(); } } else { -#ifdef DEBUGPROBE_UART_RX_LED +#ifdef PROBE_UART_RX_LED if (rx_led_debounce) rx_led_debounce--; else - gpio_put(DEBUGPROBE_UART_RX_LED, 0); + gpio_put(PROBE_UART_RX_LED, 0); #endif } @@ -110,20 +110,20 @@ size_t watermark = MIN(tud_cdc_available(), sizeof(tx_buf)); if (watermark > 0) { size_t tx_len; -#ifdef DEBUGPROBE_UART_TX_LED - gpio_put(DEBUGPROBE_UART_TX_LED, 1); +#ifdef PROBE_UART_TX_LED + gpio_put(PROBE_UART_TX_LED, 1); tx_led_debounce = debounce_ticks; #endif /* Batch up to half a FIFO of data - don't clog up on RX */ watermark = MIN(watermark, 16); tx_len = tud_cdc_read(tx_buf, watermark); - uart_write_blocking(DEBUGPROBE_UART_INTERFACE, tx_buf, tx_len); + uart_write_blocking(PROBE_UART_INTERFACE, tx_buf, tx_len); } else { -#ifdef DEBUGPROBE_UART_TX_LED +#ifdef PROBE_UART_TX_LED if (tx_led_debounce) tx_led_debounce--; else - gpio_put(DEBUGPROBE_UART_TX_LED, 0); + gpio_put(PROBE_UART_TX_LED, 0); #endif } } else if (was_connected) { @@ -158,12 +158,12 @@ vTaskSuspend(uart_taskhandle); interval = MAX(1, micros / ((1000 * 1000) / configTICK_RATE_HZ)); debounce_ticks = MAX(1, configTICK_RATE_HZ / (interval * DEBOUNCE_MS)); - debugprobe_info("New baud rate %ld micros %ld interval %lu\n", + probe_info("New baud rate %ld micros %ld interval %lu\n", line_coding->bit_rate, micros, interval); - uart_deinit(DEBUGPROBE_UART_INTERFACE); + uart_deinit(PROBE_UART_INTERFACE); tud_cdc_write_clear(); tud_cdc_read_flush(); - uart_init(DEBUGPROBE_UART_INTERFACE, line_coding->bit_rate); + uart_init(PROBE_UART_INTERFACE, line_coding->bit_rate); switch (line_coding->parity) { case CDC_LINE_CODING_PARITY_ODD: @@ -173,7 +173,7 @@ parity = UART_PARITY_EVEN; break; default: - debugprobe_info("invalid parity setting %u\n", line_coding->parity); + probe_info("invalid parity setting %u\n", line_coding->parity); /* fallthrough */ case CDC_LINE_CODING_PARITY_NONE: parity = UART_PARITY_NONE; @@ -188,7 +188,7 @@ data_bits = line_coding->data_bits; break; default: - debugprobe_info("invalid data bits setting: %u\n", line_coding->data_bits); + probe_info("invalid data bits setting: %u\n", line_coding->data_bits); data_bits = 8; break; } @@ -201,36 +201,36 @@ stop_bits = 2; break; default: - debugprobe_info("invalid stop bits setting: %u\n", line_coding->stop_bits); + probe_info("invalid stop bits setting: %u\n", line_coding->stop_bits); /* fallthrough */ case CDC_LINE_CONDING_STOP_BITS_1: stop_bits = 1; break; } - uart_set_format(DEBUGPROBE_UART_INTERFACE, data_bits, stop_bits, parity); + uart_set_format(PROBE_UART_INTERFACE, data_bits, stop_bits, parity); vTaskResume(uart_taskhandle); } void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { -#ifdef DEBUGPROBE_UART_RTS - gpio_put(DEBUGPROBE_UART_RTS, !rts); +#ifdef PROBE_UART_RTS + gpio_put(PROBE_UART_RTS, !rts); #endif -#ifdef DEBUGPROBE_UART_DTR - gpio_put(DEBUGPROBE_UART_DTR, !dtr); +#ifdef PROBE_UART_DTR + gpio_put(PROBE_UART_DTR, !dtr); #endif /* CDC drivers use linestate as a bodge to activate/deactivate the interface. * Resume our UART polling on activate, stop on deactivate */ if (!dtr && !rts) { vTaskSuspend(uart_taskhandle); -#ifdef DEBUGPROBE_UART_RX_LED - gpio_put(DEBUGPROBE_UART_RX_LED, 0); +#ifdef PROBE_UART_RX_LED + gpio_put(PROBE_UART_RX_LED, 0); rx_led_debounce = 0; #endif -#ifdef DEBUGPROBE_UART_RX_LED - gpio_put(DEBUGPROBE_UART_TX_LED, 0); +#ifdef PROBE_UART_RX_LED + gpio_put(PROBE_UART_TX_LED, 0); tx_led_debounce = 0; #endif } else
diff --git a/src/led.c b/src/led.c index e3c109f..c004c9b 100644 --- a/src/led.c +++ b/src/led.c
@@ -26,27 +26,27 @@ #include <pico/stdlib.h> #include <stdint.h> -#include "debugprobe_config.h" +#include "probe_config.h" void led_init(void) { -#ifdef DEBUGPROBE_USB_CONNECTED_LED - gpio_init(DEBUGPROBE_USB_CONNECTED_LED); - gpio_set_dir(DEBUGPROBE_USB_CONNECTED_LED, GPIO_OUT); +#ifdef PROBE_USB_CONNECTED_LED + gpio_init(PROBE_USB_CONNECTED_LED); + gpio_set_dir(PROBE_USB_CONNECTED_LED, GPIO_OUT); #endif -#ifdef DEBUGPROBE_DAP_CONNECTED_LED - gpio_init(DEBUGPROBE_DAP_CONNECTED_LED); - gpio_set_dir(DEBUGPROBE_DAP_CONNECTED_LED, GPIO_OUT); +#ifdef PROBE_DAP_CONNECTED_LED + gpio_init(PROBE_DAP_CONNECTED_LED); + gpio_set_dir(PROBE_DAP_CONNECTED_LED, GPIO_OUT); #endif -#ifdef DEBUGPROBE_DAP_RUNNING_LED - gpio_init(DEBUGPROBE_DAP_RUNNING_LED); - gpio_set_dir(DEBUGPROBE_DAP_RUNNING_LED, GPIO_OUT); +#ifdef PROBE_DAP_RUNNING_LED + gpio_init(PROBE_DAP_RUNNING_LED); + gpio_set_dir(PROBE_DAP_RUNNING_LED, GPIO_OUT); #endif -#ifdef DEBUGPROBE_UART_RX_LED - gpio_init(DEBUGPROBE_UART_RX_LED); - gpio_set_dir(DEBUGPROBE_UART_RX_LED, GPIO_OUT); +#ifdef PROBE_UART_RX_LED + gpio_init(PROBE_UART_RX_LED); + gpio_set_dir(PROBE_UART_RX_LED, GPIO_OUT); #endif -#ifdef DEBUGPROBE_UART_TX_LED - gpio_init(DEBUGPROBE_UART_TX_LED); - gpio_set_dir(DEBUGPROBE_UART_TX_LED, GPIO_OUT); +#ifdef PROBE_UART_TX_LED + gpio_init(PROBE_UART_TX_LED); + gpio_set_dir(PROBE_UART_TX_LED, GPIO_OUT); #endif }
diff --git a/src/main.c b/src/main.c index 5c52005..0886b6d 100644 --- a/src/main.c +++ b/src/main.c
@@ -62,11 +62,11 @@ wake = xTaskGetTickCount(); do { tud_task(); -#ifdef DEBUGPROBE_USB_CONNECTED_LED - if (!gpio_get(DEBUGPROBE_USB_CONNECTED_LED) && tud_ready()) - gpio_put(DEBUGPROBE_USB_CONNECTED_LED, 1); +#ifdef PROBE_USB_CONNECTED_LED + if (!gpio_get(PROBE_USB_CONNECTED_LED) && tud_ready()) + gpio_put(PROBE_USB_CONNECTED_LED, 1); else - gpio_put(DEBUGPROBE_USB_CONNECTED_LED, 0); + gpio_put(PROBE_USB_CONNECTED_LED, 0); #endif // Go to sleep for up to a tick if nothing to do if (!tud_task_event_ready()) @@ -91,7 +91,7 @@ led_init(); - debugprobe_info("Welcome to Debugprobe!\n"); + probe_info("Welcome to debugprobe!\n"); if (THREADED) { /* UART needs to preempt USB as if we don't, characters get lost */ @@ -106,7 +106,7 @@ tud_task(); cdc_task(); -#if (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) +#if (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) if (tud_vendor_available()) { uint32_t resp_len; tud_vendor_read(RxDataBuffer, sizeof(RxDataBuffer)); @@ -145,7 +145,7 @@ tud_hid_report(0, TxDataBuffer, response_size); } -#if (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) +#if (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) extern uint8_t const desc_ms_os_20[]; bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
diff --git a/src/probe.c b/src/probe.c index 95c2d62..ff2239c 100644 --- a/src/probe.c +++ b/src/probe.c
@@ -31,7 +31,7 @@ #include <hardware/gpio.h> #include "led.h" -#include "debugprobe_config.h" +#include "probe_config.h" #include "probe.pio.h" #include "tusb.h" @@ -61,7 +61,7 @@ void probe_set_swclk_freq(uint freq_khz) { uint clk_sys_freq_khz = clock_get_hz(clk_sys) / 1000; - debugprobe_info("Set swclk freq %dKHz sysclk %dkHz\n", freq_khz, clk_sys_freq_khz); + probe_info("Set swclk freq %dKHz sysclk %dkHz\n", freq_khz, clk_sys_freq_khz); uint32_t divider = clk_sys_freq_khz / freq_khz / 4; if (divider == 0) divider = 1; @@ -105,7 +105,7 @@ DEBUG_PINS_SET(probe_timing, DBG_PIN_WRITE); pio_sm_put_blocking(pio0, PROBE_SM, fmt_probe_command(bit_count, true, CMD_WRITE)); pio_sm_put_blocking(pio0, PROBE_SM, data_byte); - debugprobe_dump("Write %d bits 0x%x\n", bit_count, data_byte); + probe_dump("Write %d bits 0x%x\n", bit_count, data_byte); // Return immediately so we can cue up the next command whilst this one runs DEBUG_PINS_CLR(probe_timing, DBG_PIN_WRITE); } @@ -124,7 +124,7 @@ data_shifted = data >> (32 - bit_count); } - debugprobe_dump("Read %d bits 0x%x (shifted 0x%x)\n", bit_count, data, data_shifted); + probe_dump("Read %d bits 0x%x (shifted 0x%x)\n", bit_count, data, data_shifted); DEBUG_PINS_CLR(probe_timing, DBG_PIN_READ); return data_shifted; }
diff --git a/src/probe_config.h b/src/probe_config.h index d17e4c5..8b4825e 100644 --- a/src/probe_config.h +++ b/src/probe_config.h
@@ -30,37 +30,37 @@ #include "task.h" #if false -#define debugprobe_info(format,args...) \ +#define probe_info(format,args...) \ do { \ vTaskSuspendAll(); \ printf(format, ## args); \ xTaskResumeAll(); \ } while (0) #else -#define debugprobe_info(format,...) ((void)0) +#define probe_info(format,...) ((void)0) #endif #if false -#define debugprobe_debug(format,args...) \ +#define probe_debug(format,args...) \ do { \ vTaskSuspendAll(); \ printf(format, ## args); \ xTaskResumeAll(); \ } while (0) #else -#define debugprobe_debug(format,...) ((void)0) +#define probe_debug(format,...) ((void)0) #endif #if false -#define debugprobe_dump(format,args...)\ +#define probe_dump(format,args...)\ do { \ vTaskSuspendAll(); \ printf(format, ## args); \ xTaskResumeAll(); \ } while (0) #else -#define debugprobe_dump(format,...) ((void)0) +#define probe_dump(format,...) ((void)0) #endif // TODO tie this up with PICO_BOARD defines in the main SDK @@ -68,7 +68,7 @@ #ifdef DEBUG_ON_PICO #include "board_pico_config.h" #else -#include "board_debugprobe_config.h" +#include "board_debug_probe_config.h" #endif //#include "board_example_config.h" @@ -77,8 +77,8 @@ #define PROTO_DAP_V2 2 // Interface config -#ifndef DEBUGPROBE_DEBUG_PROTOCOL -#define DEBUGPROBE_DEBUG_PROTOCOL PROTO_DAP_V2 +#ifndef PROBE_DEBUG_PROTOCOL +#define PROBE_DEBUG_PROTOCOL PROTO_DAP_V2 #endif #endif
diff --git a/src/sw_dp_pio.c b/src/sw_dp_pio.c index ba7e6ed..2dbe7a4 100755 --- a/src/sw_dp_pio.c +++ b/src/sw_dp_pio.c
@@ -47,7 +47,7 @@ probe_set_swclk_freq(MAKE_KHZ(DAP_Data.clock_delay)); cached_delay = DAP_Data.clock_delay; } - debugprobe_debug("SWJ sequence count = %d FDB=0x%2x\n", count, data[0]); + probe_debug("SWJ sequence count = %d FDB=0x%2x\n", count, data[0]); n = count; while (n > 0) { if (n > 8) @@ -74,7 +74,7 @@ probe_set_swclk_freq(MAKE_KHZ(DAP_Data.clock_delay)); cached_delay = DAP_Data.clock_delay; } - debugprobe_debug("SWD sequence\n"); + probe_debug("SWD sequence\n"); n = info & SWD_SEQUENCE_CLK; if (n == 0U) { n = 64U; @@ -119,7 +119,7 @@ probe_set_swclk_freq(MAKE_KHZ(DAP_Data.clock_delay)); cached_delay = DAP_Data.clock_delay; } - debugprobe_debug("SWD_transfer\n"); + probe_debug("SWD_transfer\n"); /* Generate the request packet */ prq |= (1 << 0); /* Start Bit */ for (n = 1; n < 5; n++) { @@ -149,7 +149,7 @@ } if (data) *data = val; - debugprobe_debug("Read %02x ack %02x 0x%08x parity %01x\n", + probe_debug("Read %02x ack %02x 0x%08x parity %01x\n", prq, ack, val, bit); /* Turnaround for line idle */ probe_hiz_clocks(DAP_Data.swd_conf.turnaround); @@ -163,7 +163,7 @@ parity = __builtin_popcount(val); /* Write Parity Bit */ probe_write_bits(1, parity & 0x1); - debugprobe_debug("write %02x ack %02x 0x%08x parity %01x\n", + probe_debug("write %02x ack %02x 0x%08x parity %01x\n", prq, ack, val, parity); } /* Capture Timestamp */
diff --git a/src/tusb_edpt_handler.c b/src/tusb_edpt_handler.c index 93d4b58..a77d6df 100644 --- a/src/tusb_edpt_handler.c +++ b/src/tusb_edpt_handler.c
@@ -198,20 +198,20 @@ */ n = USBRequestBuffer.rptr; while (USBRequestBuffer.data[n % DAP_PACKET_COUNT][0] == ID_DAP_QueueCommands) { - debugprobe_info("%u %u DAP queued cmd %s len %02x\n", + probe_info("%u %u DAP queued cmd %s len %02x\n", USBRequestBuffer.wptr, USBRequestBuffer.rptr, dap_cmd_string[USBRequestBuffer.data[n % DAP_PACKET_COUNT][0]], USBRequestBuffer.data[n % DAP_PACKET_COUNT][1]); USBRequestBuffer.data[n % DAP_PACKET_COUNT][0] = ID_DAP_ExecuteCommands; n++; while (n == USBRequestBuffer.wptr) { /* Need yield in a loop here, as IN callbacks will also wake the thread */ - debugprobe_info("DAP wait\n"); + probe_info("DAP wait\n"); vTaskSuspend(dap_taskhandle); } } // Read a single packet from the USB buffer into the DAP Request buffer memcpy(DAPRequestBuffer, RD_SLOT_PTR(USBRequestBuffer), DAP_PACKET_SIZE); - debugprobe_info("%u %u DAP cmd %s len %02x\n", + probe_info("%u %u DAP cmd %s len %02x\n", USBRequestBuffer.wptr, USBRequestBuffer.rptr, dap_cmd_string[DAPRequestBuffer[0]], DAPRequestBuffer[1]); USBRequestBuffer.rptr++; @@ -227,7 +227,7 @@ } _resp_len = DAP_ExecuteCommand(DAPRequestBuffer, DAPResponseBuffer); - debugprobe_info("%u %u DAP resp %s\n", + probe_info("%u %u DAP resp %s\n", USBResponseBuffer.wptr, USBResponseBuffer.rptr, dap_cmd_string[DAPResponseBuffer[0]]);
diff --git a/src/tusb_edpt_handler.h b/src/tusb_edpt_handler.h index f4e9ab2..be1fdd0 100644 --- a/src/tusb_edpt_handler.h +++ b/src/tusb_edpt_handler.h
@@ -29,10 +29,10 @@ void dap_thread(void *ptr); /* Endpoint Handling */ -void debugprobe_edpt_init(void); -uint16_t debugprobe_edpt_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len); -bool debugprobe_edpt_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const *request); -bool debugprobe_edpt_xfer_cb(uint8_t __unused rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); +void dap_edpt_init(void); +uint16_t dap_edpt_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len); +bool dap_edpt_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const *request); +bool dap_edpt_xfer_cb(uint8_t __unused rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); /* Helper Functions */ bool buffer_full(buffer_t *buffer);
diff --git a/src/usb_descriptors.c b/src/usb_descriptors.c index 8f306f6..9c49842 100644 --- a/src/usb_descriptors.c +++ b/src/usb_descriptors.c
@@ -27,7 +27,7 @@ #include "tusb.h" #include "get_serial.h" -#include "debugprobe_config.h" +#include "probe_config.h" //--------------------------------------------------------------------+ // Device Descriptors @@ -36,7 +36,7 @@ { .bLength = sizeof(tusb_desc_device_t), .bDescriptorType = TUSB_DESC_DEVICE, -#if (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) +#if (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) .bcdUSB = 0x0210, // USB Specification version 2.1 for BOS #else .bcdUSB = 0x0110, @@ -77,10 +77,10 @@ #define CDC_NOTIFICATION_EP_NUM 0x81 #define CDC_DATA_OUT_EP_NUM 0x02 #define CDC_DATA_IN_EP_NUM 0x83 -#define PROBE_OUT_EP_NUM 0x04 -#define PROBE_IN_EP_NUM 0x85 +#define DAP_OUT_EP_NUM 0x04 +#define DAP_IN_EP_NUM 0x85 -#if (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V1) +#if (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V1) #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_HID_INOUT_DESC_LEN) #else #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_VENDOR_DESC_LEN) @@ -101,15 +101,15 @@ { TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 100), // Interface 0 -#if (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V1) +#if (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V1) // HID (named interface) - TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_PROBE, 4, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), PROBE_OUT_EP_NUM, PROBE_IN_EP_NUM, CFG_TUD_HID_EP_BUFSIZE, 1), -#elif (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) + TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_PROBE, 4, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), DAP_OUT_EP_NUM, DAP_IN_EP_NUM, CFG_TUD_HID_EP_BUFSIZE, 1), +#elif (PROBE_DEBUG_PROTOCOL == PROTO_DAP_V2) // Bulk (named interface) - TUD_VENDOR_DESCRIPTOR(ITF_NUM_PROBE, 5, PROBE_OUT_EP_NUM, PROBE_IN_EP_NUM, 64), -#elif (DEBUGPROBE_DEBUG_PROTOCOL == PROTO_OPENOCD_CUSTOM) + TUD_VENDOR_DESCRIPTOR(ITF_NUM_PROBE, 5, DAP_OUT_EP_NUM, DAP_IN_EP_NUM, 64), +#elif (PROBE_DEBUG_PROTOCOL == PROTO_OPENOCD_CUSTOM) // Bulk - TUD_VENDOR_DESCRIPTOR(ITF_NUM_PROBE, 0, PROBE_OUT_EP_NUM, PROBE_IN_EP_NUM, 64), + TUD_VENDOR_DESCRIPTOR(ITF_NUM_PROBE, 0, DAP_OUT_EP_NUM, DAP_IN_EP_NUM, 64), #endif // Interface 1 + 2 TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_COM, 6, CDC_NOTIFICATION_EP_NUM, 64, CDC_DATA_OUT_EP_NUM, CDC_DATA_IN_EP_NUM, 64),