probe: hook up reset functionality to DAP commands
diff --git a/include/DAP_config.h b/include/DAP_config.h index 4e2e155..f95a2a7 100755 --- a/include/DAP_config.h +++ b/include/DAP_config.h
@@ -460,7 +460,11 @@ \return Current status of the nRESET DAP hardware I/O pin. */ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) { +#ifdef PROBE_PIN_RESET + return probe_reset_level(); +#else return (0U); +#endif } /** nRESET I/O pin: Set Output. @@ -469,7 +473,11 @@ - 1: release device hardware reset. */ __STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) { - ; +#ifdef PROBE_PIN_RESET + probe_assert_reset(!!bit); +#else + (void) bit; +#endif } ///@}
diff --git a/include/board_example_config.h b/include/board_example_config.h index 0e10ad9..74c8535 100644 --- a/include/board_example_config.h +++ b/include/board_example_config.h
@@ -38,7 +38,7 @@ /* Include CDC interface to bridge to target UART. Omit if not used. */ #define PROBE_CDC_UART /* Target reset GPIO (active-low). Omit if not used.*/ -#define PROBE_PIN_RESET 0 +#define PROBE_PIN_RESET 1 #define PROBE_SM 0 #define PROBE_PIN_OFFSET 12
diff --git a/include/board_pico_config.h b/include/board_pico_config.h index 4c90080..dd5f766 100644 --- a/include/board_pico_config.h +++ b/include/board_pico_config.h
@@ -35,7 +35,9 @@ #define PROBE_PIN_SWCLK (PROBE_PIN_OFFSET + 0) // 2 #define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 1) // 3 // Target reset config +#if false #define PROBE_PIN_RESET 1 +#endif // UART config #define PICOPROBE_UART_TX 4
diff --git a/src/probe.c b/src/probe.c index 0abf9ca..8e55879 100644 --- a/src/probe.c +++ b/src/probe.c
@@ -76,6 +76,15 @@ #endif } +int probe_reset_level(void) +{ +#if defined(PROBE_PIN_RESET) + return gpio_get(PROBE_PIN_RESET); +#else + return 0; +#endif +} + typedef enum probe_pio_command { CMD_WRITE = 0, CMD_SKIP,
diff --git a/src/probe.h b/src/probe.h index 6b57721..76c12c8 100644 --- a/src/probe.h +++ b/src/probe.h
@@ -46,5 +46,7 @@ void probe_init(void); void probe_deinit(void); +void probe_assert_reset(bool state); +int probe_reset_level(void); #endif