PortaPack: Conditionally claim JTAG pins in SCU #defines

This commit is contained in:
Jared Boone
2018-12-27 10:10:01 -08:00
parent ccc86aad14
commit 88fb406a55
4 changed files with 37 additions and 0 deletions

View File

@ -34,11 +34,19 @@ void cpld_jtag_setup(jtag_t* const jtag) {
scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
#ifdef USER_INTERFACE_PORTAPACK
scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
#endif
gpio_input(jtag->gpio->gpio_tdo); gpio_input(jtag->gpio->gpio_tdo);
gpio_output(jtag->gpio->gpio_tck); gpio_output(jtag->gpio->gpio_tck);
gpio_output(jtag->gpio->gpio_tms); gpio_output(jtag->gpio->gpio_tms);
gpio_output(jtag->gpio->gpio_tdi); gpio_output(jtag->gpio->gpio_tdi);
#ifdef USER_INTERFACE_PORTAPACK
gpio_output(jtag->gpio->gpio_pp_tms);
gpio_input(jtag->gpio->gpio_pp_tdo);
#endif
} }
/* set pins as inputs so we don't interfere with an external JTAG device */ /* set pins as inputs so we don't interfere with an external JTAG device */
@ -47,11 +55,19 @@ void cpld_jtag_release(jtag_t* const jtag) {
scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
#ifdef USER_INTERFACE_PORTAPACK
scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
#endif
gpio_input(jtag->gpio->gpio_tdo); gpio_input(jtag->gpio->gpio_tdo);
gpio_input(jtag->gpio->gpio_tck); gpio_input(jtag->gpio->gpio_tck);
gpio_input(jtag->gpio->gpio_tms); gpio_input(jtag->gpio->gpio_tms);
gpio_input(jtag->gpio->gpio_tdi); gpio_input(jtag->gpio->gpio_tdi);
#ifdef USER_INTERFACE_PORTAPACK
gpio_input(jtag->gpio->gpio_pp_tms);
gpio_input(jtag->gpio->gpio_pp_tdo);
#endif
} }
/* return 0 if success else return error code see xsvfExecute() */ /* return 0 if success else return error code see xsvfExecute() */

View File

@ -31,6 +31,10 @@ typedef struct jtag_gpio_t {
gpio_t gpio_tck; gpio_t gpio_tck;
gpio_t gpio_tdi; gpio_t gpio_tdi;
gpio_t gpio_tdo; gpio_t gpio_tdo;
#ifdef USER_INTERFACE_PORTAPACK
gpio_t gpio_pp_tms;
gpio_t gpio_pp_tdo;
#endif
} jtag_gpio_t; } jtag_gpio_t;
typedef struct jtag_t { typedef struct jtag_t {

View File

@ -123,6 +123,11 @@ static struct gpio_t gpio_cpld_tms = GPIO(3, 1);
static struct gpio_t gpio_cpld_tdi = GPIO(3, 4); static struct gpio_t gpio_cpld_tdi = GPIO(3, 4);
#endif #endif
#ifdef USER_INTERFACE_PORTAPACK
static struct gpio_t gpio_cpld_pp_tms = GPIO(1, 1);
static struct gpio_t gpio_cpld_pp_tdo = GPIO(1, 8);
#endif
static struct gpio_t gpio_hw_sync_enable = GPIO(5,12); static struct gpio_t gpio_hw_sync_enable = GPIO(5,12);
static struct gpio_t gpio_rx_q_invert = GPIO(0, 13); static struct gpio_t gpio_rx_q_invert = GPIO(0, 13);
@ -270,6 +275,10 @@ jtag_gpio_t jtag_gpio_cpld = {
.gpio_tck = &gpio_cpld_tck, .gpio_tck = &gpio_cpld_tck,
.gpio_tdi = &gpio_cpld_tdi, .gpio_tdi = &gpio_cpld_tdi,
.gpio_tdo = &gpio_cpld_tdo, .gpio_tdo = &gpio_cpld_tdo,
#ifdef USER_INTERFACE_PORTAPACK
.gpio_pp_tms = &gpio_cpld_pp_tms,
.gpio_pp_tdo = &gpio_cpld_pp_tdo,
#endif
}; };
jtag_t jtag_cpld = { jtag_t jtag_cpld = {

View File

@ -235,9 +235,17 @@ extern "C"
#define SCU_PINMUX_GPIO3_15 (P7_7) /* GPIO3[15] */ #define SCU_PINMUX_GPIO3_15 (P7_7) /* GPIO3[15] */
#endif #endif
#ifdef USER_INTERFACE_PORTAPACK
#define SCU_PINMUX_PP_TDO (P1_5) /* GPIO1[8] */
#else
#define SCU_PINMUX_SD_POW (P1_5) /* GPIO1[8] */ #define SCU_PINMUX_SD_POW (P1_5) /* GPIO1[8] */
#endif
#define SCU_PINMUX_SD_CMD (P1_6) /* GPIO1[9] */ #define SCU_PINMUX_SD_CMD (P1_6) /* GPIO1[9] */
#ifdef USER_INTERFACE_PORTAPACK
#define SCU_PINMUX_PP_TMS (P1_8) /* GPIO1[1] */
#else
#define SCU_PINMUX_SD_VOLT0 (P1_8) /* GPIO1[1] */ #define SCU_PINMUX_SD_VOLT0 (P1_8) /* GPIO1[1] */
#endif
#define SCU_PINMUX_SD_DAT0 (P1_9) /* GPIO1[2] */ #define SCU_PINMUX_SD_DAT0 (P1_9) /* GPIO1[2] */
#define SCU_PINMUX_SD_DAT1 (P1_10) /* GPIO1[3] */ #define SCU_PINMUX_SD_DAT1 (P1_10) /* GPIO1[3] */
#define SCU_PINMUX_SD_DAT2 (P1_11) /* GPIO1[4] */ #define SCU_PINMUX_SD_DAT2 (P1_11) /* GPIO1[4] */