Browse Source

misc: Renamed platform_nrst_{get,set}_val to clarify naming and provide consistency

pull/1078/head
dragonmux 2 years ago
committed by Piotr Esden-Tempski
parent
commit
a8e12d716d
  1. 18
      src/command.c
  2. 4
      src/include/platform_support.h
  3. 4
      src/platforms/96b_carbon/platform.c
  4. 4
      src/platforms/blackpillv2/platform.c
  5. 4
      src/platforms/f072/platform.c
  6. 4
      src/platforms/f3/platform.c
  7. 4
      src/platforms/f4discovery/platform.c
  8. 4
      src/platforms/hosted/bmp_remote.c
  9. 4
      src/platforms/hosted/bmp_remote.h
  10. 6
      src/platforms/hosted/cli.c
  11. 2
      src/platforms/hosted/cmsis_dap.c
  12. 4
      src/platforms/hosted/cmsis_dap.h
  13. 2
      src/platforms/hosted/dap.h
  14. 4
      src/platforms/hosted/ftdi_bmp.c
  15. 8
      src/platforms/hosted/ftdi_bmp.h
  16. 4
      src/platforms/hosted/jlink.c
  17. 8
      src/platforms/hosted/jlink.h
  18. 22
      src/platforms/hosted/platform.c
  19. 4
      src/platforms/hosted/stlinkv2.c
  20. 8
      src/platforms/hosted/stlinkv2.h
  21. 4
      src/platforms/hydrabus/platform.c
  22. 4
      src/platforms/launchpad-icdi/platform.c
  23. 6
      src/platforms/native/platform.c
  24. 6
      src/platforms/stlink/platform.c
  25. 6
      src/platforms/swlink/platform.c
  26. 6
      src/remote.c
  27. 4
      src/target/adiv5.c
  28. 8
      src/target/cortexa.c
  29. 8
      src/target/cortexm.c
  30. 2
      src/target/samd.c
  31. 2
      src/target/samx5x.c

18
src/command.c

@ -196,7 +196,7 @@ static bool cmd_jtag_scan(target *t, int argc, char **argv)
} }
if(connect_assert_srst) if(connect_assert_srst)
platform_srst_set_val(true); /* will be deasserted after attach */ platform_nrst_set_val(true); /* will be deasserted after attach */
int devs = -1; int devs = -1;
volatile struct exception e; volatile struct exception e;
@ -217,7 +217,7 @@ static bool cmd_jtag_scan(target *t, int argc, char **argv)
} }
if(devs <= 0) { if(devs <= 0) {
platform_srst_set_val(false); platform_nrst_set_val(false);
gdb_out("JTAG device scan failed!\n"); gdb_out("JTAG device scan failed!\n");
return false; return false;
} }
@ -237,7 +237,7 @@ bool cmd_swdp_scan(target *t, int argc, char **argv)
gdb_outf("Target voltage: %s\n", platform_target_voltage()); gdb_outf("Target voltage: %s\n", platform_target_voltage());
if(connect_assert_srst) if(connect_assert_srst)
platform_srst_set_val(true); /* will be deasserted after attach */ platform_nrst_set_val(true); /* will be deasserted after attach */
int devs = -1; int devs = -1;
volatile struct exception e; volatile struct exception e;
@ -258,7 +258,7 @@ bool cmd_swdp_scan(target *t, int argc, char **argv)
} }
if(devs <= 0) { if(devs <= 0) {
platform_srst_set_val(false); platform_nrst_set_val(false);
gdb_out("SW-DP scan failed!\n"); gdb_out("SW-DP scan failed!\n");
return false; return false;
} }
@ -277,7 +277,7 @@ bool cmd_auto_scan(target *t, int argc, char **argv)
if (platform_target_voltage()) if (platform_target_voltage())
gdb_outf("Target voltage: %s\n", platform_target_voltage()); gdb_outf("Target voltage: %s\n", platform_target_voltage());
if (connect_assert_srst) if (connect_assert_srst)
platform_srst_set_val(true); /* will be deasserted after attach */ platform_nrst_set_val(true); /* will be deasserted after attach */
int devs = -1; int devs = -1;
volatile struct exception e; volatile struct exception e;
@ -299,7 +299,7 @@ bool cmd_auto_scan(target *t, int argc, char **argv)
if (devs > 0) if (devs > 0)
break; break;
platform_srst_set_val(false); platform_nrst_set_val(false);
gdb_out("SW-DP scan failed!\n"); gdb_out("SW-DP scan failed!\n");
return false; return false;
} }
@ -312,7 +312,7 @@ bool cmd_auto_scan(target *t, int argc, char **argv)
break; break;
} }
if (devs <= 0) { if (devs <= 0) {
platform_srst_set_val(false); platform_nrst_set_val(false);
gdb_out("auto scan failed!\n"); gdb_out("auto scan failed!\n");
return false; return false;
} }
@ -444,8 +444,8 @@ static bool cmd_hard_srst(target *t, int argc, const char **argv)
(void)argc; (void)argc;
(void)argv; (void)argv;
target_list_free(); target_list_free();
platform_srst_set_val(true); platform_nrst_set_val(true);
platform_srst_set_val(false); platform_nrst_set_val(false);
return true; return true;
} }

4
src/include/platform_support.h

@ -42,8 +42,8 @@ extern bool connect_assert_srst;
uint32_t platform_target_voltage_sense(void); uint32_t platform_target_voltage_sense(void);
const char *platform_target_voltage(void); const char *platform_target_voltage(void);
int platform_hwversion(void); int platform_hwversion(void);
void platform_srst_set_val(bool assert); void platform_nrst_set_val(bool assert);
bool platform_srst_get_val(void); bool platform_nrst_get_val(void);
bool platform_target_get_power(void); bool platform_target_get_power(void);
void platform_target_set_power(bool power); void platform_target_set_power(bool power);
void platform_request_boot(void); void platform_request_boot(void);

4
src/platforms/96b_carbon/platform.c

@ -72,7 +72,7 @@ void platform_init(void)
cdcacm_init(); cdcacm_init();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
if (assert) if (assert)
gpio_clear(SRST_PORT, SRST_PIN); gpio_clear(SRST_PORT, SRST_PIN);
@ -80,7 +80,7 @@ void platform_srst_set_val(bool assert)
gpio_set(SRST_PORT, SRST_PIN); gpio_set(SRST_PORT, SRST_PIN);
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
return gpio_get(SRST_PORT, SRST_PIN); return gpio_get(SRST_PORT, SRST_PIN);
} }

4
src/platforms/blackpillv2/platform.c

@ -115,8 +115,8 @@ void platform_init(void)
OTG_FS_GCCFG &= ~(OTG_GCCFG_VBUSBSEN | OTG_GCCFG_VBUSASEN); OTG_FS_GCCFG &= ~(OTG_GCCFG_VBUSBSEN | OTG_GCCFG_VBUSASEN);
} }
void platform_srst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }
bool platform_srst_get_val(void) { return false; } bool platform_nrst_get_val(void) { return false; }
const char *platform_target_voltage(void) const char *platform_target_voltage(void)
{ {

4
src/platforms/f072/platform.c

@ -88,12 +88,12 @@ void platform_init(void)
usbuart_init(); usbuart_init();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
gpio_set_val(SRST_PORT, SRST_PIN, !assert); gpio_set_val(SRST_PORT, SRST_PIN, !assert);
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true; return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true;
} }

4
src/platforms/f3/platform.c

@ -92,12 +92,12 @@ void platform_init(void)
usbuart_init(); usbuart_init();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
gpio_set_val(SRST_PORT, SRST_PIN, !assert); gpio_set_val(SRST_PORT, SRST_PIN, !assert);
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true; return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true;
} }

4
src/platforms/f4discovery/platform.c

@ -110,8 +110,8 @@ void platform_init(void)
cdcacm_init(); cdcacm_init();
} }
void platform_srst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }
bool platform_srst_get_val(void) { return false; } bool platform_nrst_get_val(void) { return false; }
const char *platform_target_voltage(void) const char *platform_target_voltage(void)
{ {

4
src/platforms/hosted/bmp_remote.c

@ -90,7 +90,7 @@ bool remote_target_set_power(bool power)
return true; return true;
} }
void remote_srst_set_val(bool assert) void remote_nrst_set_val(bool assert)
{ {
uint8_t construct[REMOTE_MAX_MSG_SIZE]; uint8_t construct[REMOTE_MAX_MSG_SIZE];
int s; int s;
@ -108,7 +108,7 @@ void remote_srst_set_val(bool assert)
} }
} }
bool remote_srst_get_val(void) bool remote_nrst_get_val(void)
{ {
uint8_t construct[REMOTE_MAX_MSG_SIZE]; uint8_t construct[REMOTE_MAX_MSG_SIZE];
int s; int s;

4
src/platforms/hosted/bmp_remote.h

@ -34,8 +34,8 @@ int remote_jtagtap_init(jtag_proc_t *jtag_proc);
bool remote_target_get_power(void); bool remote_target_get_power(void);
const char *remote_target_voltage(void); const char *remote_target_voltage(void);
bool remote_target_set_power(bool power); bool remote_target_set_power(bool power);
void remote_srst_set_val(bool assert); void remote_nrst_set_val(bool assert);
bool remote_srst_get_val(void); bool remote_nrst_get_val(void);
void remote_max_frequency_set(uint32_t freq); void remote_max_frequency_set(uint32_t freq);
uint32_t remote_max_frequency_get(void); uint32_t remote_max_frequency_get(void);
const char *platform_target_voltage(void); const char *platform_target_voltage(void);

6
src/platforms/hosted/cli.c

@ -413,15 +413,15 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
platform_delay(500); platform_delay(500);
} }
if (opt->opt_mode == BMP_MODE_RESET_HW) { if (opt->opt_mode == BMP_MODE_RESET_HW) {
platform_srst_set_val(true); platform_nrst_set_val(true);
platform_delay(1); platform_delay(1);
platform_srst_set_val(false); platform_nrst_set_val(false);
return res; return res;
} }
if (opt->opt_connect_under_reset) if (opt->opt_connect_under_reset)
DEBUG_INFO("Connecting under reset\n"); DEBUG_INFO("Connecting under reset\n");
connect_assert_srst = opt->opt_connect_under_reset; connect_assert_srst = opt->opt_connect_under_reset;
platform_srst_set_val(opt->opt_connect_under_reset); platform_nrst_set_val(opt->opt_connect_under_reset);
if (opt->opt_mode == BMP_MODE_TEST) if (opt->opt_mode == BMP_MODE_TEST)
DEBUG_INFO("Running in Test Mode\n"); DEBUG_INFO("Running in Test Mode\n");
DEBUG_INFO("Target voltage: %s Volt\n", platform_target_voltage()); DEBUG_INFO("Target voltage: %s Volt\n", platform_target_voltage());

2
src/platforms/hosted/cmsis_dap.c

@ -138,7 +138,7 @@ int dap_init(bmp_info_t *info)
return 0; return 0;
} }
void dap_srst_set_val(bool assert) void dap_nrst_set_val(bool assert)
{ {
dap_reset_pin(!assert); dap_reset_pin(!assert);
} }

4
src/platforms/hosted/cmsis_dap.h

@ -31,7 +31,7 @@ int dap_swdptap_init(ADIv5_DP_t *dp);
int dap_jtag_dp_init(ADIv5_DP_t *dp); int dap_jtag_dp_init(ADIv5_DP_t *dp);
uint32_t dap_swj_clock(uint32_t clock); uint32_t dap_swj_clock(uint32_t clock);
void dap_swd_configure(uint8_t cfg); void dap_swd_configure(uint8_t cfg);
void dap_srst_set_val(bool assert); void dap_nrst_set_val(bool assert);
#else #else
int dap_init(bmp_info_t *info) int dap_init(bmp_info_t *info)
{ {
@ -48,7 +48,7 @@ int cmsis_dap_jtagtap_init(jtag_proc_t *jtag_proc) {return -1;}
int dap_swdptap_init(ADIv5_DP_t *dp) {return -1;} int dap_swdptap_init(ADIv5_DP_t *dp) {return -1;}
int dap_jtag_dp_init(ADIv5_DP_t *dp) {return -1;} int dap_jtag_dp_init(ADIv5_DP_t *dp) {return -1;}
void dap_swd_configure(uint8_t cfg) {}; void dap_swd_configure(uint8_t cfg) {};
void dap_srst_set_val(bool assert) {}; void dap_nrst_set_val(bool assert) {};
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif

2
src/platforms/hosted/dap.h

@ -69,7 +69,7 @@ void dap_transfer_configure(uint8_t idle, uint16_t count, uint16_t retry);
void dap_swd_configure(uint8_t cfg); void dap_swd_configure(uint8_t cfg);
int dap_info(int info, uint8_t *data, int size); int dap_info(int info, uint8_t *data, int size);
void dap_reset_target(void); void dap_reset_target(void);
void dap_srst_set_val(bool assert); void dap_nrst_set_val(bool assert);
void dap_trst_reset(void); void dap_trst_reset(void);
void dap_reset_target_hw(int state); void dap_reset_target_hw(int state);
void dap_reset_pin(int state); void dap_reset_pin(int state);

4
src/platforms/hosted/ftdi_bmp.c

@ -529,7 +529,7 @@ static void libftdi_set_data(data_desc_t* data)
} }
} }
void libftdi_srst_set_val(bool assert) void libftdi_nrst_set_val(bool assert)
{ {
if (assert) if (assert)
libftdi_set_data(&active_cable->assert_srst); libftdi_set_data(&active_cable->assert_srst);
@ -537,7 +537,7 @@ void libftdi_srst_set_val(bool assert)
libftdi_set_data(&active_cable->deassert_srst); libftdi_set_data(&active_cable->deassert_srst);
} }
bool libftdi_srst_get_val(void) bool libftdi_nrst_get_val(void)
{ {
uint8_t cmd[1] = {0}; uint8_t cmd[1] = {0};
uint8_t pin = 0; uint8_t pin = 0;

8
src/platforms/hosted/ftdi_bmp.h

@ -114,8 +114,8 @@ void libftdi_jtagtap_tdi_tdo_seq(
bool libftdi_swd_possible(bool *do_mpsse, bool *direct_bb_swd) {return false;}; bool libftdi_swd_possible(bool *do_mpsse, bool *direct_bb_swd) {return false;};
void libftdi_max_frequency_set(uint32_t freq) {}; void libftdi_max_frequency_set(uint32_t freq) {};
uint32_t libftdi_max_frequency_get(void) {return 0;}; uint32_t libftdi_max_frequency_get(void) {return 0;};
void libftdi_srst_set_val(bool assert){}; void libftdi_nrst_set_val(bool assert) { }
bool libftdi_srst_get_val(void) { return false;}; bool libftdi_nrst_get_val(void) { return false; }
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#else #else
#include <ftdi.h> #include <ftdi.h>
@ -136,8 +136,8 @@ void libftdi_jtagtap_tdi_tdo_seq(
bool libftdi_swd_possible(bool *do_mpsse, bool *direct_bb_swd); bool libftdi_swd_possible(bool *do_mpsse, bool *direct_bb_swd);
void libftdi_max_frequency_set(uint32_t freq); void libftdi_max_frequency_set(uint32_t freq);
uint32_t libftdi_max_frequency_get(void); uint32_t libftdi_max_frequency_get(void);
void libftdi_srst_set_val(bool assert); void libftdi_nrst_set_val(bool assert);
bool libftdi_srst_get_val(void); bool libftdi_nrst_get_val(void);
#endif #endif
#define MPSSE_SK 1 #define MPSSE_SK 1

4
src/platforms/hosted/jlink.c

@ -230,7 +230,7 @@ const char *jlink_target_voltage(bmp_info_t *info)
} }
static bool srst_status = false; static bool srst_status = false;
void jlink_srst_set_val(bmp_info_t *info, bool assert) void jlink_nrst_set_val(bmp_info_t *info, bool assert)
{ {
uint8_t cmd[1]; uint8_t cmd[1];
cmd[0]= (assert)? CMD_HW_RESET0: CMD_HW_RESET1; cmd[0]= (assert)? CMD_HW_RESET0: CMD_HW_RESET1;
@ -239,7 +239,7 @@ void jlink_srst_set_val(bmp_info_t *info, bool assert)
srst_status = assert; srst_status = assert;
} }
bool jlink_srst_get_val(bmp_info_t *info) { bool jlink_nrst_get_val(bmp_info_t *info) {
uint8_t cmd[1] = {CMD_GET_HW_STATUS}; uint8_t cmd[1] = {CMD_GET_HW_STATUS};
uint8_t res[8]; uint8_t res[8];
send_recv(info->usb_link, cmd, 1, res, sizeof(res)); send_recv(info->usb_link, cmd, 1, res, sizeof(res));

8
src/platforms/hosted/jlink.h

@ -53,8 +53,8 @@ int jlink_init(bmp_info_t *info) {return -1;};
int jlink_swdp_scan(bmp_info_t *info) {return 0;}; int jlink_swdp_scan(bmp_info_t *info) {return 0;};
int jlink_jtagtap_init(bmp_info_t *info, jtag_proc_t *jtag_proc) {return 0;}; int jlink_jtagtap_init(bmp_info_t *info, jtag_proc_t *jtag_proc) {return 0;};
const char *jlink_target_voltage(bmp_info_t *info) {return "ERROR";}; const char *jlink_target_voltage(bmp_info_t *info) {return "ERROR";};
void jlink_srst_set_val(bmp_info_t *info, bool assert) {}; void jlink_nrst_set_val(bmp_info_t *info, bool assert) { }
bool jlink_srst_get_val(bmp_info_t *info) {return true;}; bool jlink_nrst_get_val(bmp_info_t *info) { return true; }
void jlink_max_frequency_set(bmp_info_t *info, uint32_t freq) {}; void jlink_max_frequency_set(bmp_info_t *info, uint32_t freq) {};
uint32_t jlink_max_frequency_get(bmp_info_t *info) {return 0;}; uint32_t jlink_max_frequency_get(bmp_info_t *info) {return 0;};
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
@ -100,8 +100,8 @@ int jlink_init(bmp_info_t *info);
int jlink_swdp_scan(bmp_info_t *info); int jlink_swdp_scan(bmp_info_t *info);
int jlink_jtagtap_init(bmp_info_t *info, jtag_proc_t *jtag_proc); int jlink_jtagtap_init(bmp_info_t *info, jtag_proc_t *jtag_proc);
const char *jlink_target_voltage(bmp_info_t *info); const char *jlink_target_voltage(bmp_info_t *info);
void jlink_srst_set_val(bmp_info_t *info, bool assert); void jlink_nrst_set_val(bmp_info_t *info, bool assert);
bool jlink_srst_get_val(bmp_info_t *info); bool jlink_nrst_get_val(bmp_info_t *info);
void jlink_max_frequency_set(bmp_info_t *info, uint32_t freq); void jlink_max_frequency_set(bmp_info_t *info, uint32_t freq);
uint32_t jlink_max_frequency_get(bmp_info_t *info); uint32_t jlink_max_frequency_get(bmp_info_t *info);
#endif #endif

22
src/platforms/hosted/platform.c

@ -287,35 +287,35 @@ const char *platform_target_voltage(void)
return NULL; return NULL;
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
switch (info.bmp_type) { switch (info.bmp_type) {
case BMP_TYPE_STLINKV2: case BMP_TYPE_STLINKV2:
return stlink_srst_set_val(&info, assert); return stlink_nrst_set_val(&info, assert);
case BMP_TYPE_BMP: case BMP_TYPE_BMP:
return remote_srst_set_val(assert); return remote_nrst_set_val(assert);
case BMP_TYPE_JLINK: case BMP_TYPE_JLINK:
return jlink_srst_set_val(&info, assert); return jlink_nrst_set_val(&info, assert);
case BMP_TYPE_LIBFTDI: case BMP_TYPE_LIBFTDI:
return libftdi_srst_set_val(assert); return libftdi_nrst_set_val(assert);
case BMP_TYPE_CMSIS_DAP: case BMP_TYPE_CMSIS_DAP:
return dap_srst_set_val(assert); return dap_nrst_set_val(assert);
default: default:
break; break;
} }
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
switch (info.bmp_type) { switch (info.bmp_type) {
case BMP_TYPE_BMP: case BMP_TYPE_BMP:
return remote_srst_get_val(); return remote_nrst_get_val();
case BMP_TYPE_STLINKV2: case BMP_TYPE_STLINKV2:
return stlink_srst_get_val(); return stlink_nrst_get_val();
case BMP_TYPE_JLINK: case BMP_TYPE_JLINK:
return jlink_srst_get_val(&info); return jlink_nrst_get_val(&info);
case BMP_TYPE_LIBFTDI: case BMP_TYPE_LIBFTDI:
return libftdi_srst_get_val(); return libftdi_nrst_get_val();
default: default:
break; break;
} }

4
src/platforms/hosted/stlinkv2.c

@ -641,7 +641,7 @@ int stlink_init(bmp_info_t *info)
return 0; return 0;
} }
void stlink_srst_set_val(bmp_info_t *info, bool assert) void stlink_nrst_set_val(bmp_info_t *info, bool assert)
{ {
uint8_t cmd[16] = {STLINK_DEBUG_COMMAND, uint8_t cmd[16] = {STLINK_DEBUG_COMMAND,
STLINK_DEBUG_APIV2_DRIVE_NRST, STLINK_DEBUG_APIV2_DRIVE_NRST,
@ -653,7 +653,7 @@ void stlink_srst_set_val(bmp_info_t *info, bool assert)
stlink_usb_error_check(data, true); stlink_usb_error_check(data, true);
} }
bool stlink_srst_get_val(void) bool stlink_nrst_get_val(void)
{ {
return Stlink.srst; return Stlink.srst;
} }

8
src/platforms/hosted/stlinkv2.h

@ -30,8 +30,8 @@
int stlink_init(bmp_info_t *info) {return -1;}; int stlink_init(bmp_info_t *info) {return -1;};
int stlink_hwversion(void) {return -1;}; int stlink_hwversion(void) {return -1;};
const char *stlink_target_voltage(bmp_info_t *info) {return "ERROR";}; const char *stlink_target_voltage(bmp_info_t *info) {return "ERROR";};
void stlink_srst_set_val(bmp_info_t *info, bool assert) {}; void stlink_nrst_set_val(bmp_info_t *info, bool assert) { }
bool stlink_srst_get_val(void) {return true;}; bool stlink_nrst_get_val(void) { return true; }
int stlink_enter_debug_swd(bmp_info_t *info, ADIv5_DP_t *dp) {return -1;}; int stlink_enter_debug_swd(bmp_info_t *info, ADIv5_DP_t *dp) {return -1;};
void stlink_adiv5_dp_defaults(ADIv5_DP_t *dp) {}; void stlink_adiv5_dp_defaults(ADIv5_DP_t *dp) {};
int stlink_jtag_dp_init(ADIv5_DP_t *dp) {return false;}; int stlink_jtag_dp_init(ADIv5_DP_t *dp) {return false;};
@ -44,8 +44,8 @@ uint32_t stlink_max_frequency_get(bmp_info_t *info) {return 0;};
int stlink_init(bmp_info_t *info); int stlink_init(bmp_info_t *info);
int stlink_hwversion(void); int stlink_hwversion(void);
const char *stlink_target_voltage(bmp_info_t *info); const char *stlink_target_voltage(bmp_info_t *info);
void stlink_srst_set_val(bmp_info_t *info, bool assert); void stlink_nrst_set_val(bmp_info_t *info, bool assert);
bool stlink_srst_get_val(void); bool stlink_nrst_get_val(void);
int stlink_enter_debug_swd(bmp_info_t *info, ADIv5_DP_t *dp); int stlink_enter_debug_swd(bmp_info_t *info, ADIv5_DP_t *dp);
void stlink_adiv5_dp_defaults(ADIv5_DP_t *dp); void stlink_adiv5_dp_defaults(ADIv5_DP_t *dp);
int stlink_jtag_dp_init(ADIv5_DP_t *dp); int stlink_jtag_dp_init(ADIv5_DP_t *dp);

4
src/platforms/hydrabus/platform.c

@ -80,8 +80,8 @@ void platform_init(void)
cdcacm_init(); cdcacm_init();
} }
void platform_srst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }
bool platform_srst_get_val(void) { return false; } bool platform_nrst_get_val(void) { return false; }
const char *platform_target_voltage(void) const char *platform_target_voltage(void)
{ {

4
src/platforms/launchpad-icdi/platform.c

@ -89,7 +89,7 @@ platform_init(void)
0xff, 0xff); 0xff, 0xff);
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
volatile int i; volatile int i;
if (assert) { if (assert) {
@ -100,7 +100,7 @@ void platform_srst_set_val(bool assert)
} }
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
return gpio_get(SRST_PORT, SRST_PIN) == 0; return gpio_get(SRST_PORT, SRST_PIN) == 0;
} }

6
src/platforms/native/platform.c

@ -181,7 +181,7 @@ void platform_init(void)
* output HIGH asserts. Mini is directly connected so use open drain output * output HIGH asserts. Mini is directly connected so use open drain output
* and set LOW to assert. * and set LOW to assert.
*/ */
platform_srst_set_val(false); platform_nrst_set_val(false);
gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_50_MHZ,
(((platform_hwversion() == 0) || (((platform_hwversion() == 0) ||
(platform_hwversion() >= 3)) (platform_hwversion() >= 3))
@ -233,7 +233,7 @@ void platform_init(void)
setup_vbus_irq(); setup_vbus_irq();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
gpio_set_val(TMS_PORT, TMS_PIN, 1); gpio_set_val(TMS_PORT, TMS_PIN, 1);
if ((platform_hwversion() == 0) || if ((platform_hwversion() == 0) ||
@ -247,7 +247,7 @@ void platform_srst_set_val(bool assert)
} }
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
if (platform_hwversion() == 0) { if (platform_hwversion() == 0) {
return gpio_get(SRST_SENSE_PORT, SRST_SENSE_PIN) == 0; return gpio_get(SRST_SENSE_PORT, SRST_SENSE_PIN) == 0;

6
src/platforms/stlink/platform.c

@ -68,7 +68,7 @@ void platform_init(void)
gpio_set_mode(TDI_PORT, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(TDI_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, TDI_PIN); GPIO_CNF_OUTPUT_PUSHPULL, TDI_PIN);
platform_srst_set_val(false); platform_nrst_set_val(false);
gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, led_idle_run); GPIO_CNF_OUTPUT_PUSHPULL, led_idle_run);
@ -87,7 +87,7 @@ void platform_init(void)
adc_init(); adc_init();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
if (assert) { if (assert) {
gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_2_MHZ, gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_2_MHZ,
@ -100,7 +100,7 @@ void platform_srst_set_val(bool assert)
} }
} }
bool platform_srst_get_val() bool platform_nrst_get_val()
{ {
return gpio_get(SRST_PORT, srst_pin) == 0; return gpio_get(SRST_PORT, srst_pin) == 0;
} }

6
src/platforms/swlink/platform.c

@ -93,7 +93,7 @@ void platform_init(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO8); GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO8);
break; break;
} }
platform_srst_set_val(false); platform_nrst_set_val(false);
/* Remap TIM2 TIM2_REMAP[1] /* Remap TIM2 TIM2_REMAP[1]
* TIM2_CH1_ETR -> PA15 (TDI, set as output above) * TIM2_CH1_ETR -> PA15 (TDI, set as output above)
@ -113,7 +113,7 @@ void platform_init(void)
usbuart_init(); usbuart_init();
} }
void platform_srst_set_val(bool assert) void platform_nrst_set_val(bool assert)
{ {
/* We reuse JSRST as SRST.*/ /* We reuse JSRST as SRST.*/
if (assert) { if (assert) {
@ -131,7 +131,7 @@ void platform_srst_set_val(bool assert)
} }
} }
bool platform_srst_get_val(void) bool platform_nrst_get_val(void)
{ {
return gpio_get(JRST_PORT, JRST_PIN) == 0; return gpio_get(JRST_PORT, JRST_PIN) == 0;
} }

6
src/remote.c

@ -278,12 +278,12 @@ static void remotePacketProcessGEN(unsigned i, char *packet)
break; break;
case REMOTE_SRST_SET: case REMOTE_SRST_SET:
platform_srst_set_val(packet[2]=='1'); platform_nrst_set_val(packet[2] == '1');
_respond(REMOTE_RESP_OK,0); _respond(REMOTE_RESP_OK, 0);
break; break;
case REMOTE_SRST_GET: case REMOTE_SRST_GET:
_respond(REMOTE_RESP_OK,platform_srst_get_val()); _respond(REMOTE_RESP_OK, platform_nrst_get_val());
break; break;
case REMOTE_FREQ_SET: case REMOTE_FREQ_SET:
platform_max_frequency_set( remotehston(8, packet + 2)); platform_max_frequency_set( remotehston(8, packet + 2));

4
src/target/adiv5.c

@ -421,13 +421,13 @@ static bool cortexm_prepare(ADIv5_AP_t *ap)
adiv5_mem_write(ap, CORTEXM_DEMCR, &demcr, sizeof(demcr)); adiv5_mem_write(ap, CORTEXM_DEMCR, &demcr, sizeof(demcr));
platform_timeout to ; platform_timeout to ;
platform_timeout_set(&to, cortexm_wait_timeout); platform_timeout_set(&to, cortexm_wait_timeout);
platform_srst_set_val(false); platform_nrst_set_val(false);
while (1) { while (1) {
dhcsr = adiv5_mem_read32(ap, CORTEXM_DHCSR); dhcsr = adiv5_mem_read32(ap, CORTEXM_DHCSR);
if (!(dhcsr & CORTEXM_DHCSR_S_RESET_ST)) if (!(dhcsr & CORTEXM_DHCSR_S_RESET_ST))
break; break;
if (platform_timeout_is_expired(&to)) { if (platform_timeout_is_expired(&to)) {
DEBUG_WARN("Error releasing from srst\n"); DEBUG_WARN("Error releasing from reset\n");
return false; return false;
} }
} }

8
src/target/cortexa.c

@ -408,7 +408,7 @@ bool cortexa_attach(target *t)
target_halt_request(t); target_halt_request(t);
tries = 10; tries = 10;
while(!platform_srst_get_val() && !target_halt_poll(t, NULL) && --tries) while(!platform_nrst_get_val() && !target_halt_poll(t, NULL) && --tries)
platform_delay(200); platform_delay(200);
if(!tries) if(!tries)
return false; return false;
@ -420,7 +420,7 @@ bool cortexa_attach(target *t)
priv->hw_breakpoint_mask = 0; priv->hw_breakpoint_mask = 0;
priv->bcr0 = 0; priv->bcr0 = 0;
platform_srst_set_val(false); platform_nrst_set_val(false);
return true; return true;
} }
@ -591,8 +591,8 @@ static void cortexa_reset(target *t)
target_mem_write32(t, ZYNQ_SLCR_PSS_RST_CTRL, 1); target_mem_write32(t, ZYNQ_SLCR_PSS_RST_CTRL, 1);
/* Try hard reset too */ /* Try hard reset too */
platform_srst_set_val(true); platform_nrst_set_val(true);
platform_srst_set_val(false); platform_nrst_set_val(false);
/* Spin until Xilinx reconnects us */ /* Spin until Xilinx reconnects us */
platform_timeout timeout; platform_timeout timeout;

8
src/target/cortexm.c

@ -545,7 +545,7 @@ bool cortexm_attach(target *t)
uint32_t dhcsr = target_mem_read32(t, CORTEXM_DHCSR); uint32_t dhcsr = target_mem_read32(t, CORTEXM_DHCSR);
dhcsr = target_mem_read32(t, CORTEXM_DHCSR); dhcsr = target_mem_read32(t, CORTEXM_DHCSR);
if (dhcsr & CORTEXM_DHCSR_S_RESET_ST) { if (dhcsr & CORTEXM_DHCSR_S_RESET_ST) {
platform_srst_set_val(false); platform_nrst_set_val(false);
platform_timeout timeout; platform_timeout timeout;
platform_timeout_set(&timeout, 1000); platform_timeout_set(&timeout, 1000);
while (1) { while (1) {
@ -553,7 +553,7 @@ bool cortexm_attach(target *t)
if (!(dhcsr & CORTEXM_DHCSR_S_RESET_ST)) if (!(dhcsr & CORTEXM_DHCSR_S_RESET_ST))
break; break;
if (platform_timeout_is_expired(&timeout)) { if (platform_timeout_is_expired(&timeout)) {
DEBUG_WARN("Error releasing from srst\n"); DEBUG_WARN("Error releasing from reset\n");
return false; return false;
} }
} }
@ -743,8 +743,8 @@ static void cortexm_reset(target *t)
target_mem_read32(t, CORTEXM_DHCSR); target_mem_read32(t, CORTEXM_DHCSR);
platform_timeout to; platform_timeout to;
if ((t->target_options & CORTEXM_TOPT_INHIBIT_SRST) == 0) { if ((t->target_options & CORTEXM_TOPT_INHIBIT_SRST) == 0) {
platform_srst_set_val(true); platform_nrst_set_val(true);
platform_srst_set_val(false); platform_nrst_set_val(false);
/* Some NRF52840 users saw invalid SWD transaction with /* Some NRF52840 users saw invalid SWD transaction with
* native/firmware without this delay.*/ * native/firmware without this delay.*/
platform_delay(10); platform_delay(10);

2
src/target/samd.c

@ -541,7 +541,7 @@ bool samd_probe(target *t)
target_add_commands(t, samd_cmd_list, "SAMD"); target_add_commands(t, samd_cmd_list, "SAMD");
/* If we're not in reset here */ /* If we're not in reset here */
if (!platform_srst_get_val()) { if (!platform_nrst_get_val()) {
/* We'll have to release the target from /* We'll have to release the target from
* extended reset to make attach possible */ * extended reset to make attach possible */
if (target_mem_read32(t, SAMD_DSU_CTRLSTAT) & if (target_mem_read32(t, SAMD_DSU_CTRLSTAT) &

2
src/target/samx5x.c

@ -433,7 +433,7 @@ bool samx5x_probe(target *t)
target_add_commands(t, samx5x_cmd_list, "SAMD5x/E5x"); target_add_commands(t, samx5x_cmd_list, "SAMD5x/E5x");
/* If we're not in reset here */ /* If we're not in reset here */
if (!platform_srst_get_val()) { if (!platform_nrst_get_val()) {
/* We'll have to release the target from /* We'll have to release the target from
* extended reset to make attach possible */ * extended reset to make attach possible */
if (target_mem_read32(t, SAMX5X_DSU_CTRLSTAT) & if (target_mem_read32(t, SAMX5X_DSU_CTRLSTAT) &

Loading…
Cancel
Save