Skip to content

Commit 0761424

Browse files
committed
probe: hook up reset functionality to DAP commands
1 parent d47b308 commit 0761424

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

include/DAP_config.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ __STATIC_FORCEINLINE void PIN_nTRST_OUT (uint32_t bit) {
460460
\return Current status of the nRESET DAP hardware I/O pin.
461461
*/
462462
__STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
463+
#ifdef PROBE_PIN_RESET
464+
return probe_reset_level();
465+
#else
463466
return (0U);
467+
#endif
464468
}
465469

466470
/** nRESET I/O pin: Set Output.
@@ -469,7 +473,11 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
469473
- 1: release device hardware reset.
470474
*/
471475
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
472-
;
476+
#ifdef PROBE_PIN_RESET
477+
probe_assert_reset(!!bit);
478+
#else
479+
(void) bit;
480+
#endif
473481
}
474482

475483
///@}

include/board_example_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/* Include CDC interface to bridge to target UART. Omit if not used. */
3939
#define PROBE_CDC_UART
4040
/* Target reset GPIO (active-low). Omit if not used.*/
41-
#define PROBE_PIN_RESET 0
41+
#define PROBE_PIN_RESET 1
4242

4343
#define PROBE_SM 0
4444
#define PROBE_PIN_OFFSET 12

include/board_pico_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
#define PROBE_PIN_SWCLK (PROBE_PIN_OFFSET + 0) // 2
3636
#define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 1) // 3
3737
// Target reset config
38+
#if false
3839
#define PROBE_PIN_RESET 1
40+
#endif
3941

4042
// UART config
4143
#define PICOPROBE_UART_TX 4

src/probe.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ void probe_assert_reset(bool state)
7676
#endif
7777
}
7878

79+
int probe_reset_level(void)
80+
{
81+
#if defined(PROBE_PIN_RESET)
82+
return gpio_get(PROBE_PIN_RESET);
83+
#else
84+
return 0;
85+
#endif
86+
}
87+
7988
typedef enum probe_pio_command {
8089
CMD_WRITE = 0,
8190
CMD_SKIP,

src/probe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ void probe_write_mode(void);
4646

4747
void probe_init(void);
4848
void probe_deinit(void);
49+
void probe_assert_reset(bool state);
50+
int probe_reset_level(void);
4951

5052
#endif

0 commit comments

Comments
 (0)