platforms: NRST and TRST naming consistency

This aligns the nRST and nTRST pin naming with the bulk of the README's for the platforms along with the hardware
This commit is contained in:
dragonmux 2022-06-15 21:34:09 -04:00 committed by Piotr Esden-Tempski
parent a8e12d716d
commit 2eaa579965
19 changed files with 83 additions and 83 deletions

View File

@ -61,7 +61,7 @@ void platform_init(void)
TDO_PIN);
gpio_mode_setup(TRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, TRST_PIN);
gpio_mode_setup(SRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, SRST_PIN);
gpio_mode_setup(NRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, NRST_PIN);
gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_IDLE_RUN);
gpio_mode_setup(LED_PORT_UART, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_UART);
@ -75,14 +75,14 @@ void platform_init(void)
void platform_nrst_set_val(bool assert)
{
if (assert)
gpio_clear(SRST_PORT, SRST_PIN);
gpio_clear(NRST_PORT, NRST_PIN);
else
gpio_set(SRST_PORT, SRST_PIN);
gpio_set(NRST_PORT, NRST_PIN);
}
bool platform_nrst_get_val(void)
{
return gpio_get(SRST_PORT, SRST_PIN);
return gpio_get(NRST_PORT, NRST_PIN);
}
const char *platform_target_voltage(void)

View File

@ -68,8 +68,8 @@
#define TRST_PORT GPIOC
#define TRST_PIN GPIO3
#define SRST_PORT GPIOC
#define SRST_PIN GPIO5
#define NRST_PORT GPIOC
#define NRST_PIN GPIO5
#define LED_PORT GPIOA
#define LED_IDLE_RUN GPIO15

View File

@ -66,8 +66,8 @@
#define TRST_PORT GPIOB
#define TRST_PIN GPIO5
#define SRST_PORT GPIOB
#define SRST_PIN GPIO4
#define NRST_PORT GPIOB
#define NRST_PIN GPIO4
#define PWR_BR_PORT GPIOB
#define PWR_BR_PIN GPIO8

View File

@ -79,10 +79,10 @@ void platform_init(void)
gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT,
GPIO_PUPD_NONE,
LED_UART | LED_IDLE_RUN | LED_ERROR | LED_BOOTLOADER);
gpio_mode_setup(SRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, SRST_PIN);
gpio_set(SRST_PORT, SRST_PIN);
gpio_set_output_options(SRST_PORT, GPIO_OTYPE_OD,
GPIO_OSPEED_2MHZ, SRST_PIN);
gpio_mode_setup(NRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, NRST_PIN);
gpio_set(NRST_PORT, NRST_PIN);
gpio_set_output_options(NRST_PORT, GPIO_OTYPE_OD,
GPIO_OSPEED_2MHZ, NRST_PIN);
platform_timing_init();
cdcacm_init();
usbuart_init();
@ -90,12 +90,12 @@ void platform_init(void)
void platform_nrst_set_val(bool assert)
{
gpio_set_val(SRST_PORT, SRST_PIN, !assert);
gpio_set_val(NRST_PORT, NRST_PIN, !assert);
}
bool platform_nrst_get_val(void)
{
return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true;
return (gpio_get(NRST_PORT, NRST_PIN)) ? false : true;
}
const char *platform_target_voltage(void)

View File

@ -69,8 +69,8 @@
#define SWDIO_PIN TMS_PIN
#define SWCLK_PIN TCK_PIN
#define SRST_PORT GPIOA
#define SRST_PIN GPIO5
#define NRST_PORT GPIOA
#define NRST_PIN GPIO5
#define LED_PORT GPIOB
#define LED_PORT_UART GPIOB

View File

@ -80,10 +80,10 @@ void platform_init(void)
gpio_mode_setup(TDO_PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, TDO_PIN);
gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
LED_UART | LED_IDLE_RUN | LED_ERROR | LED_BOOTLOADER);
gpio_mode_setup(SRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, SRST_PIN);
gpio_set(SRST_PORT, SRST_PIN);
gpio_set_output_options(SRST_PORT, GPIO_OTYPE_OD,
GPIO_OSPEED_2MHZ, SRST_PIN);
gpio_mode_setup(NRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, NRST_PIN);
gpio_set(NRST_PORT, NRST_PIN);
gpio_set_output_options(NRST_PORT, GPIO_OTYPE_OD,
GPIO_OSPEED_2MHZ, NRST_PIN);
platform_timing_init();
/* Set up USB Pins and alternate function*/
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
@ -94,12 +94,12 @@ void platform_init(void)
void platform_nrst_set_val(bool assert)
{
gpio_set_val(SRST_PORT, SRST_PIN, !assert);
gpio_set_val(NRST_PORT, NRST_PIN, !assert);
}
bool platform_nrst_get_val(void)
{
return (gpio_get(SRST_PORT, SRST_PIN)) ? false : true;
return (gpio_get(NRST_PORT, NRST_PIN)) ? false : true;
}
const char *platform_target_voltage(void)

View File

@ -69,8 +69,8 @@
#define SWDIO_PIN TMS_PIN
#define SWCLK_PIN TCK_PIN
#define SRST_PORT GPIOA
#define SRST_PIN GPIO5
#define NRST_PORT GPIOA
#define NRST_PIN GPIO5
#define LED_PORT GPIOB
#define LED_PORT_UART GPIOB

View File

@ -69,8 +69,8 @@
#define TRST_PORT GPIOC
#define TRST_PIN GPIO1
#define SRST_PORT GPIOC
#define SRST_PIN GPIO8
#define NRST_PORT GPIOC
#define NRST_PIN GPIO8
#define LED_PORT GPIOD
#define LED_PORT_UART GPIOD

View File

@ -229,14 +229,14 @@ const char *jlink_target_voltage(bmp_info_t *info)
return ret;
}
static bool srst_status = false;
static bool nrst_status = false;
void jlink_nrst_set_val(bmp_info_t *info, bool assert)
{
uint8_t cmd[1];
cmd[0]= (assert)? CMD_HW_RESET0: CMD_HW_RESET1;
send_recv(info->usb_link, cmd, 1, NULL, 0);
platform_delay(2);
srst_status = assert;
nrst_status = assert;
}
bool jlink_nrst_get_val(bmp_info_t *info) {

View File

@ -190,7 +190,7 @@ typedef struct {
libusb_context* libusb_ctx;
uint16_t vid;
uint16_t pid;
bool srst;
bool nrst;
uint8_t dap_select;
uint8_t ep_tx;
uint8_t ver_hw; /* 20, 21 or 31 deciphered from USB PID.*/
@ -648,14 +648,14 @@ void stlink_nrst_set_val(bmp_info_t *info, bool assert)
(assert)? STLINK_DEBUG_APIV2_DRIVE_NRST_LOW
: STLINK_DEBUG_APIV2_DRIVE_NRST_HIGH};
uint8_t data[2];
Stlink.srst = assert;
Stlink.nrst = assert;
send_recv(info->usb_link, cmd, 16, data, 2);
stlink_usb_error_check(data, true);
}
bool stlink_nrst_get_val(void)
{
return Stlink.srst;
return Stlink.nrst;
}
int stlink_hwversion(void)

View File

@ -70,8 +70,8 @@
#define TRST_PORT GPIOC
#define TRST_PIN GPIO5
#define SRST_PORT GPIOC
#define SRST_PIN GPIO4
#define NRST_PORT GPIOC
#define NRST_PIN GPIO4
#define LED_PORT GPIOA
#define LED_PORT_UART GPIOA

View File

@ -65,9 +65,9 @@ platform_init(void)
gpio_mode_setup(TCK_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, TCK_PIN);
gpio_mode_setup(TDI_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, TDI_PIN);
gpio_mode_setup(TDO_PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, TDO_PIN);
gpio_mode_setup(SRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, SRST_PIN);
gpio_set_output_config(SRST_PORT, GPIO_OTYPE_OD, GPIO_DRIVE_2MA, SRST_PIN);
gpio_set(SRST_PORT, SRST_PIN);
gpio_mode_setup(NRST_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, NRST_PIN);
gpio_set_output_config(NRST_PORT, GPIO_OTYPE_OD, GPIO_DRIVE_2MA, NRST_PIN);
gpio_set(NRST_PORT, NRST_PIN);
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);
systick_set_reload(rcc_get_system_clock_frequency() / (SYSTICKHZ * 8));
@ -93,16 +93,16 @@ void platform_nrst_set_val(bool assert)
{
volatile int i;
if (assert) {
gpio_clear(SRST_PORT, SRST_PIN);
gpio_clear(NRST_PORT, NRST_PIN);
for(i = 0; i < 10000; i++) asm("nop");
} else {
gpio_set(SRST_PORT, SRST_PIN);
gpio_set(NRST_PORT, NRST_PIN);
}
}
bool platform_nrst_get_val(void)
{
return gpio_get(SRST_PORT, SRST_PIN) == 0;
return gpio_get(NRST_PORT, NRST_PIN) == 0;
}
void platform_delay(uint32_t ms)

View File

@ -48,8 +48,8 @@ extern uint32_t swd_delay_cnt;
#define SWCLK_PORT TCK_PORT
#define SWCLK_PIN TCK_PIN
#define SRST_PORT GPIOA_BASE
#define SRST_PIN GPIO6
#define NRST_PORT GPIOA_BASE
#define NRST_PIN GPIO6
#define TMS_SET_MODE() { \
gpio_mode_setup(TMS_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, TMS_PIN); \

View File

@ -177,27 +177,27 @@ void platform_init(void)
GPIO_CNF_OUTPUT_PUSHPULL,
LED_UART | LED_IDLE_RUN | LED_ERROR);
/* Enable SRST output. Original uses a NPN to pull down, so setting the
/* Enable nRST output. Original uses a NPN to pull down, so setting the
* output HIGH asserts. Mini is directly connected so use open drain output
* and set LOW to assert.
*/
platform_nrst_set_val(false);
gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_50_MHZ,
gpio_set_mode(NRST_PORT, GPIO_MODE_OUTPUT_50_MHZ,
(((platform_hwversion() == 0) ||
(platform_hwversion() >= 3))
? GPIO_CNF_OUTPUT_PUSHPULL
: GPIO_CNF_OUTPUT_OPENDRAIN),
SRST_PIN);
NRST_PIN);
/* FIXME: Gareth, Esden, what versions need this fix? */
if (platform_hwversion() < 3) {
/* FIXME: This pin in intended to be input, but the TXS0108 fails
* to release the device from reset if this floats. */
gpio_set_mode(SRST_SENSE_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, SRST_SENSE_PIN);
gpio_set_mode(NRST_SENSE_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, NRST_SENSE_PIN);
} else {
gpio_set(SRST_SENSE_PORT, SRST_SENSE_PIN);
gpio_set_mode(SRST_SENSE_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, SRST_SENSE_PIN);
gpio_set(NRST_SENSE_PORT, NRST_SENSE_PIN);
gpio_set_mode(NRST_SENSE_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, NRST_SENSE_PIN);
}
/* Enable internal pull-up on PWR_BR so that we don't drive
TPWR locally or inadvertently supply power to the target. */
@ -238,9 +238,9 @@ void platform_nrst_set_val(bool assert)
gpio_set_val(TMS_PORT, TMS_PIN, 1);
if ((platform_hwversion() == 0) ||
(platform_hwversion() >= 3)) {
gpio_set_val(SRST_PORT, SRST_PIN, assert);
gpio_set_val(NRST_PORT, NRST_PIN, assert);
} else {
gpio_set_val(SRST_PORT, SRST_PIN, !assert);
gpio_set_val(NRST_PORT, NRST_PIN, !assert);
}
if (assert) {
for(int i = 0; i < 10000; i++) asm("nop");
@ -250,11 +250,11 @@ void platform_nrst_set_val(bool assert)
bool platform_nrst_get_val(void)
{
if (platform_hwversion() == 0) {
return gpio_get(SRST_SENSE_PORT, SRST_SENSE_PIN) == 0;
return gpio_get(NRST_SENSE_PORT, NRST_SENSE_PIN) == 0;
} else if (platform_hwversion() >= 3) {
return gpio_get(SRST_SENSE_PORT, SRST_SENSE_PIN) != 0;
return gpio_get(NRST_SENSE_PORT, NRST_SENSE_PIN) != 0;
} else {
return gpio_get(SRST_PORT, SRST_PIN) == 0;
return gpio_get(NRST_PORT, NRST_PIN) == 0;
}
}

View File

@ -127,10 +127,10 @@ int usbuart_debug_write(const char *buf, size_t len);
#define TRST_PIN GPIO1
#define PWR_BR_PORT GPIOB
#define PWR_BR_PIN GPIO1
#define SRST_PORT GPIOA
#define SRST_PIN HW_SWITCH(6, GPIO2, GPIO9)
#define SRST_SENSE_PORT GPIOA
#define SRST_SENSE_PIN HW_SWITCH(6, GPIO7, GPIO13)
#define NRST_PORT GPIOA
#define NRST_PIN HW_SWITCH(6, GPIO2, GPIO9)
#define NRST_SENSE_PORT GPIOA
#define NRST_SENSE_PIN HW_SWITCH(6, GPIO7, GPIO13)
#define USB_PU_PORT GPIOA
#define USB_PU_PIN GPIO8

View File

@ -35,7 +35,7 @@
#include <libopencm3/stm32/adc.h>
uint16_t led_idle_run;
uint16_t srst_pin;
uint16_t nrst_pin;
static uint32_t rev;
static void adc_init(void);
@ -55,10 +55,10 @@ void platform_init(void)
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
if (rev == 0) {
led_idle_run = GPIO8;
srst_pin = SRST_PIN_V1;
nrst_pin = NRST_PIN_V1;
} else {
led_idle_run = GPIO9;
srst_pin = SRST_PIN_V2;
nrst_pin = NRST_PIN_V2;
}
/* Setup GPIO ports */
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_2_MHZ,
@ -90,19 +90,19 @@ void platform_init(void)
void platform_nrst_set_val(bool assert)
{
if (assert) {
gpio_set_mode(SRST_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_OPENDRAIN, srst_pin);
gpio_clear(SRST_PORT, srst_pin);
gpio_set_mode(NRST_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_OPENDRAIN, nrst_pin);
gpio_clear(NRST_PORT, nrst_pin);
} else {
gpio_set_mode(SRST_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, srst_pin);
gpio_set(SRST_PORT, srst_pin);
gpio_set_mode(NRST_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, nrst_pin);
gpio_set(NRST_PORT, nrst_pin);
}
}
bool platform_nrst_get_val()
{
return gpio_get(SRST_PORT, srst_pin) == 0;
return gpio_get(NRST_PORT, nrst_pin) == 0;
}
static void adc_init(void)

View File

@ -56,9 +56,9 @@ int usbuart_debug_write(const char *buf, size_t len);
#define SWDIO_PIN TMS_PIN
#define SWCLK_PIN TCK_PIN
#define SRST_PORT GPIOB
#define SRST_PIN_V1 GPIO1
#define SRST_PIN_V2 GPIO0
#define NRST_PORT GPIOB
#define NRST_PIN_V1 GPIO1
#define NRST_PIN_V2 GPIO0
#define LED_PORT GPIOA
/* Use PC14 for a "dummy" uart led. So we can observere at least with scope*/

View File

@ -115,25 +115,25 @@ void platform_init(void)
void platform_nrst_set_val(bool assert)
{
/* We reuse JSRST as SRST.*/
/* We reuse nTRST as nRST.*/
if (assert) {
gpio_set_mode(JRST_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_OPENDRAIN, JRST_PIN);
gpio_set_mode(TRST_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_OPENDRAIN, TRST_PIN);
/* Wait until requested value is active.*/
while (gpio_get(JRST_PORT, JRST_PIN))
gpio_clear(JRST_PORT, JRST_PIN);
while (gpio_get(TRST_PORT, TRST_PIN))
gpio_clear(TRST_PORT, TRST_PIN);
} else {
gpio_set_mode(JRST_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, JRST_PIN);
gpio_set_mode(TRST_PORT, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_PULL_UPDOWN, TRST_PIN);
/* Wait until requested value is active.*/
while (!gpio_get(JRST_PORT, JRST_PIN))
gpio_set(JRST_PORT, JRST_PIN);
while (!gpio_get(TRST_PORT, TRST_PIN))
gpio_set(TRST_PORT, TRST_PIN);
}
}
bool platform_nrst_get_val(void)
{
return gpio_get(JRST_PORT, JRST_PIN) == 0;
return gpio_get(TRST_PORT, TRST_PIN) == 0;
}
static void adc_init(void)

View File

@ -43,12 +43,12 @@ int usbuart_debug_write(const char *buf, size_t len);
#define TCK_PORT GPIOA
#define TDI_PORT GPIOA
#define TDO_PORT GPIOB
#define JRST_PORT GPIOB
#define TRST_PORT GPIOB
#define TMS_PIN GPIO13
#define TCK_PIN GPIO14
#define TDI_PIN GPIO15
#define TDO_PIN GPIO3
#define JRST_PIN GPIO4
#define TRST_PIN GPIO4
#define SWDIO_PORT TMS_PORT
#define SWCLK_PORT TCK_PORT