From ccc86aad1415ac5a5213eaed08d64794262aaca1 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 1 Aug 2018 21:05:10 -0700 Subject: [PATCH 01/36] Add support for PortaPack user interface add-on board. --- firmware/common/hackrf-ui.h | 4 + firmware/common/hackrf_core.c | 4 +- firmware/common/hackrf_core.h | 24 + firmware/common/rf_path.c | 4 + firmware/common/ui_portapack.c | 931 +++++++++++++++++++++++++++++++++ firmware/common/ui_portapack.h | 59 +++ firmware/hackrf-common.cmake | 17 +- 7 files changed, 1041 insertions(+), 2 deletions(-) create mode 100644 firmware/common/ui_portapack.c create mode 100644 firmware/common/ui_portapack.h diff --git a/firmware/common/hackrf-ui.h b/firmware/common/hackrf-ui.h index 95b82489..2bff25e8 100644 --- a/firmware/common/hackrf-ui.h +++ b/firmware/common/hackrf-ui.h @@ -14,4 +14,8 @@ void hackrf_ui_setBBLNAGain(const uint32_t gain_db) __attribute__((weak)); void hackrf_ui_setBBVGAGain(const uint32_t gain_db) __attribute__((weak)); void hackrf_ui_setBBTXVGAGain(const uint32_t gain_db) __attribute__((weak)); +void hackrf_ui_setFirstIFFrequency(const uint64_t freq) __attribute__((weak)); +void hackrf_ui_setFilter(const rf_path_filter_t filter) __attribute__((weak)); +void hackrf_ui_setAntennaBias(bool antenna_bias) __attribute__((weak)); + #endif diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index 64448206..028f9cc7 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -796,9 +796,11 @@ void pin_setup(void) { /* Configure RF power supply (VAA) switch control signal as output */ gpio_output(&gpio_vaa_disable); +#ifndef USER_INTERFACE_PORTAPACK + /* Not sure why this is necessary for stock HackRF. Just "rhyming" with the RAD1O code? */ scu_pinmux(SCU_PINMUX_GPIO3_10, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_GPIO3_11, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); - +#endif #endif #ifdef RAD1O diff --git a/firmware/common/hackrf_core.h b/firmware/common/hackrf_core.h index 36c03759..1b1fc5f7 100644 --- a/firmware/common/hackrf_core.h +++ b/firmware/common/hackrf_core.h @@ -77,8 +77,16 @@ extern "C" /* GPIO Input PinMux */ #define SCU_PINMUX_BOOT0 (P1_1) /* GPIO0[8] on P1_1 */ #define SCU_PINMUX_BOOT1 (P1_2) /* GPIO0[9] on P1_2 */ +#ifdef USER_INTERFACE_PORTAPACK +#define SCU_PINMUX_PP_LCD_TE (P2_3) /* GPIO5[3] on P2_3 */ +#define SCU_PINMUX_PP_LCD_RDX (P2_4) /* GPIO5[4] on P2_4 */ +#define SCU_PINMUX_PP_UNUSED (P2_8) /* GPIO5[7] on P2_8 */ +#define SCU_PINMUX_PP_LCD_WRX (P2_9) /* GPIO1[10] on P2_9 */ +#define SCU_PINMUX_PP_DIR (P2_13) /* GPIO1[13] on P2_13 */ +#else #define SCU_PINMUX_BOOT2 (P2_8) /* GPIO5[7] on P2_8 */ #define SCU_PINMUX_BOOT3 (P2_9) /* GPIO1[10] on P2_9 */ +#endif /* USB peripheral */ #ifdef JAWBREAKER @@ -206,6 +214,16 @@ extern "C" #define SCU_RX_LNA (P6_7) /* GPIO5[15] on P6_7 */ #endif +#ifdef USER_INTERFACE_PORTAPACK +#define SCU_PINMUX_PP_D0 (P7_0) /* GPIO3[8] */ +#define SCU_PINMUX_PP_D1 (P7_1) /* GPIO3[9] */ +#define SCU_PINMUX_PP_D2 (P7_2) /* GPIO3[10] */ +#define SCU_PINMUX_PP_D3 (P7_3) /* GPIO3[11] */ +#define SCU_PINMUX_PP_D4 (P7_4) /* GPIO3[12] */ +#define SCU_PINMUX_PP_D5 (P7_5) /* GPIO3[13] */ +#define SCU_PINMUX_PP_D6 (P7_6) /* GPIO3[14] */ +#define SCU_PINMUX_PP_D7 (P7_7) /* GPIO3[15] */ +#else /* TODO add other Pins */ #define SCU_PINMUX_GPIO3_8 (P7_0) /* GPIO3[8] */ #define SCU_PINMUX_GPIO3_9 (P7_1) /* GPIO3[9] */ @@ -215,6 +233,7 @@ extern "C" #define SCU_PINMUX_GPIO3_13 (P7_5) /* GPIO3[13] */ #define SCU_PINMUX_GPIO3_14 (P7_6) /* GPIO3[14] */ #define SCU_PINMUX_GPIO3_15 (P7_7) /* GPIO3[15] */ +#endif #define SCU_PINMUX_SD_POW (P1_5) /* GPIO1[8] */ #define SCU_PINMUX_SD_CMD (P1_6) /* GPIO1[9] */ @@ -225,8 +244,13 @@ extern "C" #define SCU_PINMUX_SD_DAT3 (P1_12) /* GPIO1[5] */ #define SCU_PINMUX_SD_CD (P1_13) /* GPIO1[6] */ +#ifdef USER_INTERFACE_PORTAPACK +#define SCU_PINMUX_PP_IO_STBX (P2_0) /* GPIO5[0] */ +#define SCU_PINMUX_PP_ADDR (P2_1) /* GPIO5[1] */ +#else #define SCU_PINMUX_U0_TXD (P2_0) /* GPIO5[0] */ #define SCU_PINMUX_U0_RXD (P2_1) /* GPIO5[1] */ +#endif #define SCU_PINMUX_ISP (P2_7) /* GPIO0[7] */ diff --git a/firmware/common/rf_path.c b/firmware/common/rf_path.c index 05a627bd..a854367c 100644 --- a/firmware/common/rf_path.c +++ b/firmware/common/rf_path.c @@ -415,6 +415,8 @@ void rf_path_set_filter(rf_path_t* const rf_path, const rf_path_filter_t filter) } switchctrl_set(rf_path, rf_path->switchctrl); + + hackrf_ui_setFilter(filter); } void rf_path_set_lna(rf_path_t* const rf_path, const uint_fast8_t enable) { @@ -447,4 +449,6 @@ void rf_path_set_antenna(rf_path_t* const rf_path, const uint_fast8_t enable) { } switchctrl_set(rf_path, rf_path->switchctrl); + + hackrf_ui_setAntennaBias(enable); } diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c new file mode 100644 index 00000000..7ba19e22 --- /dev/null +++ b/firmware/common/ui_portapack.c @@ -0,0 +1,931 @@ +/* + * Copyright 2018 Jared Boone + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include "hackrf-ui.h" + +#include "ui_portapack.h" + +#include "hackrf_core.h" +#include "gpio_lpc.h" + +#include + +#include + +#ifdef USER_INTERFACE_PORTAPACK + +/* Pixel data within a font or bitmap byte is "reversed": LSB is left-most pixel. */ + +static const uint8_t font_fixed_8x16_glyph_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xff, 0x24, 0x24, 0xff, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x78, 0x14, 0x14, 0x14, 0x18, 0x30, 0x50, 0x50, 0x50, 0x3c, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x46, 0x29, 0x29, 0x19, 0x16, 0x68, 0x98, 0x94, 0x94, 0x62, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x14, 0x88, 0x54, 0x72, 0x22, 0x62, 0x9c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x2a, 0x1c, 0x2a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x5a, 0x5a, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0x20, 0x20, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0x20, 0x20, 0x10, 0x0c, 0x10, 0x20, 0x20, 0x10, 0x0e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x30, 0x28, 0x28, 0x24, 0x24, 0x22, 0x7e, 0x20, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x04, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x04, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x44, 0x38, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1c, 0x22, 0x42, 0x42, 0x62, 0x5c, 0x40, 0x40, 0x20, 0x1c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x18, 0x04, 0x18, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x30, 0x40, 0x30, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x30, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1c, 0x22, 0x41, 0x59, 0x55, 0x55, 0x55, 0x39, 0x01, 0x02, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x14, 0x14, 0x14, 0x14, 0x22, 0x3e, 0x22, 0x41, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x44, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x38, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0x22, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x22, 0x1e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x02, 0x7e, 0x02, 0x02, 0x02, 0x02, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x02, 0x7e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x44, 0x02, 0x02, 0x02, 0x72, 0x42, 0x42, 0x44, 0x38, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x82, 0x42, 0x22, 0x12, 0x0a, 0x0e, 0x12, 0x22, 0x42, 0x82, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x66, 0x66, 0x5a, 0x5a, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x46, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x62, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x10, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x12, 0x22, 0x22, 0x42, 0x82, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x0c, 0x30, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x22, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x49, 0x49, 0x55, 0x55, 0x55, 0x22, 0x22, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x14, 0x22, 0x22, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x7c, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x1a, 0x26, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x04, 0x02, 0x02, 0x02, 0x04, 0x78, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x64, 0x58, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x7e, 0x02, 0x04, 0x78, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x08, 0x08, 0x7e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x22, 0x22, 0x22, 0x1c, 0x02, 0x3e, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x22, 0x12, 0x0a, 0x0e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x26, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x02, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x42, 0x42, 0x42, 0x64, 0x58, 0x40, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x02, 0x02, 0x3c, 0x40, 0x40, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x22, 0x22, 0x36, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x49, 0x55, 0x55, 0x22, 0x22, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x24, 0x18, 0x18, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x22, 0x22, 0x14, 0x14, 0x14, 0x08, 0x08, 0x04, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x20, 0x10, 0x08, 0x08, 0x04, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const ui_font_t font_fixed_8x16 = { + { 8, 16 }, + font_fixed_8x16_glyph_data, + 0x20, 95, + (8 * 16 + 7U) >> 3 +}; + +static const uint8_t font_fixed_24x19_glyph_data[] = { + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, + 0x00, 0x78, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7f, 0x00, 0x80, 0x77, 0x00, 0xc0, 0x73, 0x00, 0xc0, 0x71, 0x00, 0xc0, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x3c, 0x00, 0xfc, 0x1f, 0xe0, 0xff, 0x1f, 0xf8, 0xff, 0x07, 0xfc, 0x07, 0x00, 0x3c, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x1c, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x3f, 0x3c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0xfe, 0x3f, 0x00, 0xfe, 0x1f, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x38, 0xf8, 0xff, 0x3f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, + 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x0f, 0x00, 0xe0, 0x0f, 0x00, 0xf8, 0x0f, 0x00, 0x7c, 0x0f, 0x00, 0x1e, 0x0f, 0x00, 0x0f, 0x0f, 0xc0, 0x07, 0x0f, 0xe0, 0x01, 0x0f, 0xf0, 0x00, 0x0f, 0x7c, 0x00, 0x0f, 0x1e, 0x00, 0x0f, 0xfe, 0xff, 0x7f, 0xfe, 0xff, 0x7f, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, + 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, 0x1c, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x1c, 0x00, 0x00, 0xdc, 0xff, 0x07, 0xfc, 0xff, 0x1f, 0xfc, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x00, 0xdc, 0xff, 0x07, 0xfc, 0xff, 0x1f, 0xfc, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, + 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x7f, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0f, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x03, 0x00, 0xe0, 0x01, 0x00, 0xf0, 0x01, 0x00, 0xf0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x03, 0x00, + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf0, 0xff, 0x0f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, + 0xe0, 0xff, 0x07, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x3f, 0xf8, 0xff, 0x3f, 0xe0, 0xff, 0x3b, 0x00, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x1c, 0x00, 0x38, 0x3c, 0x00, 0x3c, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xe0, 0xff, 0x07, +}; + +static const ui_font_t font_fixed_24x19 = { + { 24, 19 }, + font_fixed_24x19_glyph_data, + 0x30, 10, + (24 * 19 + 7U) >> 3 +}; + +static const uint8_t font_fixed_16x14_glyph_data[] = { + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, + 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x03, 0x70, 0x03, 0x20, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x00, 0x60, 0x00, 0x70, 0x80, 0x3f, 0xf8, 0x1f, 0xfc, 0x00, 0x0e, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x00, 0x60, 0x00, 0x60, 0xc0, 0x3f, 0xc0, 0x7f, 0x00, 0x60, 0x00, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, + 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f, 0x80, 0x1b, 0xc0, 0x19, 0xe0, 0x18, 0x70, 0x18, 0x38, 0x18, 0x1c, 0x18, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, + 0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf6, 0x1f, 0xfe, 0x3f, 0x0e, 0x70, 0x00, 0x60, 0x00, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x00, 0xf6, 0x1f, 0xfe, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, + 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x70, 0x00, 0x30, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x00, 0x60, 0x00, + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, + 0xf8, 0x1f, 0xfc, 0x3f, 0x0e, 0x70, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x7f, 0xf8, 0x6f, 0x00, 0x60, 0x06, 0x60, 0x0e, 0x70, 0xfc, 0x3f, 0xf8, 0x1f, +}; + +static const ui_font_t font_fixed_16x14 = { + { 16, 14 }, + font_fixed_16x14_glyph_data, + 0x30, 10, + (16 * 14 + 7U) >> 3 +}; + +static const uint8_t bitmap_amp_rx_data[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x18, 0x00, 0x18, 0x18, 0x00, 0x18, 0x30, 0x00, 0x0c, 0x30, 0x00, 0x0c, 0x60, 0x00, 0x06, 0x60, 0x00, 0x06, 0xc0, 0x00, 0x03, 0xc0, 0x00, 0x03, 0x80, 0x81, 0x01, 0x80, 0x81, 0x01, 0x00, 0xc3, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x66, 0x00, 0x00, 0x66, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00 +}; + +static const ui_bitmap_t bitmap_amp_rx = { + { 24, 24 }, bitmap_amp_rx_data +}; + +static const uint8_t bitmap_amp_tx_data[] = { + 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x66, 0x00, 0x00, 0x66, 0x00, 0x00, 0xc3, 0x00, 0x00, 0xc3, 0x00, 0x80, 0x81, 0x01, 0x80, 0x81, 0x01, 0xc0, 0x00, 0x03, 0xc0, 0x00, 0x03, 0x60, 0x00, 0x06, 0x60, 0x00, 0x06, 0x30, 0x00, 0x0c, 0x30, 0x00, 0x0c, 0x18, 0x00, 0x18, 0x18, 0x00, 0x18, 0x0c, 0x00, 0x30, 0x0c, 0x00, 0x30, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static const ui_bitmap_t bitmap_amp_tx = { + { 24, 24 }, bitmap_amp_tx_data +}; + +static const uint8_t bitmap_antenna_data[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x06, 0x18, 0x60, 0x06, 0x18, 0x60, 0x0c, 0x18, 0x30, 0x0c, 0x18, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x18, 0x0c, 0x30, 0x18, 0x0c, 0x60, 0x18, 0x06, 0x60, 0x18, 0x06, 0xc0, 0x18, 0x03, 0xc0, 0x18, 0x03, 0x80, 0x99, 0x01, 0x80, 0x99, 0x01, 0x00, 0xdb, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00 +}; + +static const ui_bitmap_t bitmap_antenna = { + { 24, 24 }, bitmap_antenna_data +}; + +static const uint8_t bitmap_filter_hp_data[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0xf8, 0xc7, 0x03, 0xfc, 0xc7, 0x03, 0x0e, 0xc0, 0x03, 0x06, 0xc0, 0x03, 0x03, 0xc0, 0x03, 0x03, 0xc0, 0x83, 0x01, 0xc0, 0x83, 0x01, 0xc0, 0xc3, 0x00, 0xc0, 0xc3, 0x00, 0xc0, 0x63, 0x00, 0xc0, 0x63, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static const ui_bitmap_t bitmap_filter_hp = { + { 24, 24 }, bitmap_filter_hp_data +}; + +static const uint8_t bitmap_filter_lp_data[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0xe3, 0x1f, 0xc0, 0xe3, 0x3f, 0xc0, 0x03, 0x70, 0xc0, 0x03, 0x60, 0xc0, 0x03, 0xc0, 0xc0, 0x03, 0xc0, 0xc0, 0x03, 0x80, 0xc1, 0x03, 0x80, 0xc1, 0x03, 0x00, 0xc3, 0x03, 0x00, 0xc3, 0x03, 0x00, 0xc6, 0x03, 0x00, 0xc6, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static const ui_bitmap_t bitmap_filter_lp = { + { 24, 24 }, bitmap_filter_lp_data +}; + +static const uint8_t bitmap_mixer_data[] = { + 0x00, 0x7e, 0x00, 0xc0, 0xff, 0x03, 0xe0, 0x81, 0x07, 0x70, 0x00, 0x0e, 0x38, 0x00, 0x1c, 0x7c, 0x00, 0x3e, 0xee, 0x00, 0x77, 0xc6, 0x81, 0x63, 0x86, 0xc3, 0x61, 0x03, 0xe7, 0xc0, 0x03, 0x7e, 0xc0, 0x03, 0x3c, 0xc0, 0x03, 0x3c, 0xc0, 0x03, 0x7e, 0xc0, 0x03, 0xe7, 0xc0, 0x86, 0xc3, 0x61, 0xc6, 0x81, 0x63, 0xee, 0x00, 0x77, 0x7c, 0x00, 0x3e, 0x38, 0x00, 0x1c, 0x70, 0x00, 0x0e, 0xe0, 0x81, 0x07, 0xc0, 0xff, 0x03, 0x00, 0x7e, 0x00 +}; + +static const ui_bitmap_t bitmap_mixer = { + { 24, 24 }, bitmap_mixer_data +}; + +static const uint8_t bitmap_wire_8_data[] = { + 0xff, 0xff +}; + +static const ui_bitmap_t bitmap_wire_8 = { + { 2, 8 }, bitmap_wire_8_data +}; + +static const uint8_t bitmap_wire_24_data[] = { + 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00 +}; + +static const ui_bitmap_t bitmap_wire_24 = { + { 24, 24 }, bitmap_wire_24_data +}; + +static const uint8_t bitmap_waves_data[] = { + 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x30, 0x06, 0x30, 0x06, 0x30, 0x06, 0x60, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x60, 0x0c, 0x30, 0x06, 0x30, 0x06, 0x30, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03 +}; + +static const ui_bitmap_t bitmap_waves = { + { 16, 20 }, bitmap_waves_data +}; + +static ui_color_t portapack_color_rgb( + const uint_fast8_t r, + const uint_fast8_t g, + const uint_fast8_t b +) { + const ui_color_t result = { + .v = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3) + }; + return result; +} + +#define ARRAY_SIZEOF(x) (sizeof(x) / sizeof(x[0])) + +static void portapack_sleep_milliseconds(const uint32_t milliseconds) { + /* NOTE: Naively assumes 204 MHz instruction cycle clock and five instructions per count */ + delay(milliseconds * 40800); +} + +static struct gpio_t gpio_io_stbx = GPIO(5, 0); /* P2_0 */ +static struct gpio_t gpio_addr = GPIO(5, 1); /* P2_1 */ +static struct gpio_t gpio_lcd_te = GPIO(5, 3); /* P2_3 */ +static struct gpio_t gpio_unused = GPIO(5, 7); /* P2_8 */ +static struct gpio_t gpio_lcd_rdx = GPIO(5, 4); /* P2_4 */ +static struct gpio_t gpio_lcd_wrx = GPIO(1, 10); /* P2_9 */ +static struct gpio_t gpio_dir = GPIO(1, 13); /* P2_13 */ + +typedef struct portapack_t { + gpio_t gpio_dir; + gpio_t gpio_lcd_rdx; + gpio_t gpio_lcd_wrx; + gpio_t gpio_io_stbx; + gpio_t gpio_addr; + gpio_port_t* const gpio_port_data; + uint8_t io_reg; +} portapack_t; + +portapack_t portapack = { + .gpio_dir = &gpio_dir, + .gpio_lcd_rdx = &gpio_lcd_rdx, + .gpio_lcd_wrx = &gpio_lcd_wrx, + .gpio_io_stbx = &gpio_io_stbx, + .gpio_addr = &gpio_addr, + .gpio_port_data = GPIO_LPC_PORT(3), + .io_reg = 0x03, +}; + +/* NOTE: Code below assumes the shift value is "8". */ +#define GPIO_DATA_SHIFT (8) +static const uint32_t gpio_data_mask = 0xFFU << GPIO_DATA_SHIFT; + +static void portapack_data_mask_set(portapack_t* const portapack) { + portapack->gpio_port_data->mask = ~gpio_data_mask; +} + +static void portapack_data_write_low(portapack_t* const portapack, const uint32_t value) { + portapack->gpio_port_data->mpin = (value << GPIO_DATA_SHIFT); +} + +static void portapack_data_write_high(portapack_t* const portapack, const uint32_t value) { + /* NOTE: Assumes no other bits in the port are masked. */ + /* NOTE: Assumes that bits 15 through 8 are masked. */ + portapack->gpio_port_data->mpin = value; +} + +static void portapack_dir_read(portapack_t* const portapack) { + portapack->gpio_port_data->dir &= ~gpio_data_mask; + gpio_set(portapack->gpio_dir); +} + +static void portapack_dir_write(portapack_t* const portapack) { + gpio_clear(portapack->gpio_dir); + portapack->gpio_port_data->dir |= gpio_data_mask; + /* TODO: Manipulating DIR[3] makes me queasy. The RFFC5072 DATA pin + * is also on port 3, and switches direction periodically... + * Time to resort to bit-banding to enforce atomicity? But then, how + * to change direction on eight bits efficiently? Or do I care, since + * the PortaPack data bus shouldn't change direction too frequently? + */ +} + +static void portapack_lcd_rd_assert(portapack_t* const portapack) { + gpio_clear(portapack->gpio_lcd_rdx); +} + +static void portapack_lcd_rd_deassert(portapack_t* const portapack) { + gpio_set(portapack->gpio_lcd_rdx); +} + +static void portapack_lcd_wr_assert(portapack_t* const portapack) { + gpio_clear(portapack->gpio_lcd_wrx); +} + +static void portapack_lcd_wr_deassert(portapack_t* const portapack) { + gpio_set(portapack->gpio_lcd_wrx); +} + +static void portapack_io_stb_assert(portapack_t* const portapack) { + gpio_clear(portapack->gpio_io_stbx); +} + +static void portapack_io_stb_deassert(portapack_t* const portapack) { + gpio_set(portapack->gpio_io_stbx); +} + +static void portapack_addr(portapack_t* const portapack, const bool value) { + gpio_write(portapack->gpio_addr, value); +} + +static void portapack_lcd_command(portapack_t* const portapack, const uint32_t value) { + portapack_data_write_high(portapack, 0); /* Drive high byte (with zero -- don't care) */ + portapack_dir_write(portapack); /* Turn around data bus, MCU->CPLD */ + portapack_addr(portapack, 0); /* Indicate command */ + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + portapack_lcd_wr_assert(portapack); /* Latch high byte */ + + portapack_data_write_low(portapack, value); /* Drive low byte (pass-through) */ + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + portapack_lcd_wr_deassert(portapack); /* Complete write operation */ + + portapack_addr(portapack, 1); /* Set up for data phase (most likely after a command) */ +} + +static void portapack_lcd_write_data(portapack_t* const portapack, const uint32_t value) { + // NOTE: Assumes and DIR=0 and ADDR=1 from command phase. + portapack_data_write_high(portapack, value); /* Drive high byte */ + __asm__("nop"); + portapack_lcd_wr_assert(portapack); /* Latch high byte */ + + portapack_data_write_low(portapack, value); /* Drive low byte (pass-through) */ + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + portapack_lcd_wr_deassert(portapack); /* Complete write operation */ +} + +static void portapack_io_write(portapack_t* const portapack, const bool address, const uint_fast16_t value) { + portapack_data_write_low(portapack, value); + portapack_dir_write(portapack); + portapack_addr(portapack, address); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + portapack_io_stb_assert(portapack); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + portapack_io_stb_deassert(portapack); +} + +static void portapack_lcd_data_write_command_and_data( + portapack_t* const portapack, + const uint_fast8_t command, + const uint8_t* data, + const size_t data_count +) { + portapack_lcd_command(portapack, command); + for(size_t i=0; iio_reg = (portapack->io_reg & 0x7f) | (on ? (1 << 7) : 0); + portapack_io_write(portapack, 1, portapack->io_reg); +} + +static void portapack_lcd_reset_state(portapack_t* const portapack, const bool active) { + portapack->io_reg = (portapack->io_reg & 0xfe) | (active ? (1 << 0) : 0); + portapack_io_write(portapack, 1, portapack->io_reg); +} + +static void portapack_lcd_sleep_out(portapack_t* const portapack) { + const uint8_t cmd_11[] = {}; + portapack_lcd_data_write_command_and_data(portapack, 0x11, cmd_11, ARRAY_SIZEOF(cmd_11)); + // "It will be necessary to wait 120msec after sending Sleep Out + // command (when in Sleep In Mode) before Sleep In command can be + // sent." + portapack_sleep_milliseconds(120); +} + +static void portapack_lcd_display_on(portapack_t* const portapack) { + const uint8_t cmd_29[] = {}; + portapack_lcd_data_write_command_and_data(portapack, 0x29, cmd_29, ARRAY_SIZEOF(cmd_29)); +} + +static void portapack_lcd_wake(portapack_t* const portapack) { + portapack_lcd_sleep_out(portapack); + portapack_lcd_display_on(portapack); +} + +static void portapack_if_init(portapack_t* const portapack) { + portapack_data_mask_set(portapack); + portapack_data_write_high(portapack, 0); + + portapack_dir_read(portapack); + portapack_lcd_rd_deassert(portapack); + portapack_lcd_wr_deassert(portapack); + portapack_io_stb_deassert(portapack); + portapack_addr(portapack, 0); + + gpio_output(portapack->gpio_dir); + gpio_output(portapack->gpio_lcd_rdx); + gpio_output(portapack->gpio_lcd_wrx); + gpio_output(portapack->gpio_io_stbx); + gpio_output(portapack->gpio_addr); + /* gpio_input(portapack->gpio_rot_a); */ + /* gpio_input(portapack->gpio_rot_b); */ + + scu_pinmux(SCU_PINMUX_PP_D0, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D1, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D2, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D3, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D4, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D5, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D6, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + scu_pinmux(SCU_PINMUX_PP_D7, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); + + scu_pinmux(SCU_PINMUX_PP_DIR, SCU_CONF_FUNCTION0 | SCU_GPIO_NOPULL); + scu_pinmux(SCU_PINMUX_PP_LCD_RDX, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); + scu_pinmux(SCU_PINMUX_PP_LCD_WRX, SCU_CONF_FUNCTION0 | SCU_GPIO_NOPULL); + scu_pinmux(SCU_PINMUX_PP_IO_STBX, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); + scu_pinmux(SCU_PINMUX_PP_ADDR, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); + /* scu_pinmux(SCU_PINMUX_PP_LCD_TE, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); */ + /* scu_pinmux(SCU_PINMUX_PP_UNUSED, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); */ +} + +static void portapack_lcd_reset(portapack_t* const portapack) { + portapack_lcd_reset_state(portapack, false); + portapack_sleep_milliseconds(1); + portapack_lcd_reset_state(portapack, true); + portapack_sleep_milliseconds(10); + portapack_lcd_reset_state(portapack, false); + portapack_sleep_milliseconds(120); +} + +static void portapack_lcd_init(portapack_t* const portapack) { + // LCDs are configured for IM[2:0] = 001 + // 8080-I system, 16-bit parallel bus + + // + // 0x3a: DBI[2:0] = 101 + // MDT[1:0] = XX (if not in 18-bit mode, right?) + + // Power control B + // 0 + // PCEQ=1, DRV_ena=0, Power control=3 + const uint8_t cmd_cf[] = { 0x00, 0xD9, 0x30 }; + portapack_lcd_data_write_command_and_data(portapack, 0xCF, cmd_cf, ARRAY_SIZEOF(cmd_cf)); + + // Power on sequence control + const uint8_t cmd_ed[] = { 0x64, 0x03, 0x12, 0x81 }; + portapack_lcd_data_write_command_and_data(portapack, 0xED, cmd_ed, ARRAY_SIZEOF(cmd_ed)); + + // Driver timing control A + const uint8_t cmd_e8[] = { 0x85, 0x10, 0x78 }; + portapack_lcd_data_write_command_and_data(portapack, 0xE8, cmd_e8, ARRAY_SIZEOF(cmd_e8)); + + // Power control A + const uint8_t cmd_cb[] = { 0x39, 0x2C, 0x00, 0x34, 0x02 }; + portapack_lcd_data_write_command_and_data(portapack, 0xCB, cmd_cb, ARRAY_SIZEOF(cmd_cb)); + + // Pump ratio control + const uint8_t cmd_f7[] = { 0x20 }; + portapack_lcd_data_write_command_and_data(portapack, 0xF7, cmd_f7, ARRAY_SIZEOF(cmd_f7)); + + // Driver timing control B + const uint8_t cmd_ea[] = { 0x00, 0x00 }; + portapack_lcd_data_write_command_and_data(portapack, 0xEA, cmd_ea, ARRAY_SIZEOF(cmd_ea)); + + const uint8_t cmd_b1[] = { 0x00, 0x1B }; + portapack_lcd_data_write_command_and_data(portapack, 0xB1, cmd_b1, ARRAY_SIZEOF(cmd_b1)); + + // Blanking Porch Control + // VFP = 0b0000010 = 2 (number of HSYNC of vertical front porch) + // VBP = 0b0000010 = 2 (number of HSYNC of vertical back porch) + // HFP = 0b0001010 = 10 (number of DOTCLOCK of horizontal front porch) + // HBP = 0b0010100 = 20 (number of DOTCLOCK of horizontal back porch) + const uint8_t cmd_b5[] = { 0x02, 0x02, 0x0a, 0x14 }; + portapack_lcd_data_write_command_and_data(portapack, 0xB5, cmd_b5, ARRAY_SIZEOF(cmd_b5)); + + // Display Function Control + // PT[1:0] = 0b10 + // PTG[1:0] = 0b10 + // ISC[3:0] = 0b0010 (scan cycle interval of gate driver: 5 frames) + // SM = 0 (gate driver pin arrangement in combination with GS) + // SS = 1 (source output scan direction S720 -> S1) + // GS = 0 (gate output scan direction G1 -> G320) + // REV = 1 (normally white) + // NL = 0b100111 (default) + // PCDIV = 0b000000 (default?) + const uint8_t cmd_b6[] = { 0x0A, 0xA2, 0x27, 0x00 }; + portapack_lcd_data_write_command_and_data(portapack, 0xB6, cmd_b6, ARRAY_SIZEOF(cmd_b6)); + + // Power Control 1 + //VRH[5:0] + const uint8_t cmd_c0[] = { 0x1B }; + portapack_lcd_data_write_command_and_data(portapack, 0xC0, cmd_c0, ARRAY_SIZEOF(cmd_c0)); + + // Power Control 2 + //SAP[2:0];BT[3:0] + const uint8_t cmd_c1[] = { 0x12 }; + portapack_lcd_data_write_command_and_data(portapack, 0xC1, cmd_c1, ARRAY_SIZEOF(cmd_c1)); + + // VCOM Control 1 + const uint8_t cmd_c5[] = { 0x32, 0x3C }; + portapack_lcd_data_write_command_and_data(portapack, 0xC5, cmd_c5, ARRAY_SIZEOF(cmd_c5)); + + // VCOM Control 2 + const uint8_t cmd_c7[] = { 0x9B }; + portapack_lcd_data_write_command_and_data(portapack, 0xC7, cmd_c7, ARRAY_SIZEOF(cmd_c7)); + + // Memory Access Control + // Invert X and Y memory access order, so upper-left of + // screen is (0,0) when writing to display. + const uint8_t cmd_36[] = { + (1 << 7) | // MY=1 + (1 << 6) | // MX=1 + (0 << 5) | // MV=0 + (1 << 4) | // ML=1: reverse vertical refresh to simplify scrolling logic + (1 << 3) // BGR=1: For Kingtech LCD, BGR filter. + }; + portapack_lcd_data_write_command_and_data(portapack, 0x36, cmd_36, ARRAY_SIZEOF(cmd_36)); + + // COLMOD: Pixel Format Set + // DPI=101 (16 bits/pixel), DBI=101 (16 bits/pixel) + const uint8_t cmd_3a[] = { 0x55 }; + portapack_lcd_data_write_command_and_data(portapack, 0x3A, cmd_3a, ARRAY_SIZEOF(cmd_3a)); + + //portapack_lcd_data_write_command_and_data(0xF6, { 0x01, 0x30 }); + // WEMODE=1 (reset column and page number on overflow) + // MDT[1:0] + // EPF[1:0]=00 (use channel MSB for LSB) + // RIM=0 (If COLMOD[6:4]=101 (65k color), 16-bit RGB interface (1 transfer/pixel)) + // RM=0 (system interface/VSYNC interface) + // DM[1:0]=00 (internal clock operation) + // ENDIAN=0 (doesn't matter with 16-bit interface) + const uint8_t cmd_f6[] = { 0x01, 0x30, 0x00 }; + portapack_lcd_data_write_command_and_data(portapack, 0xF6, cmd_f6, ARRAY_SIZEOF(cmd_f6)); + + // 3Gamma Function Disable + const uint8_t cmd_f2[] = { 0x00 }; + portapack_lcd_data_write_command_and_data(portapack, 0xF2, cmd_f2, ARRAY_SIZEOF(cmd_f2)); + + // Gamma curve selected + const uint8_t cmd_26[] = { 0x01 }; + portapack_lcd_data_write_command_and_data(portapack, 0x26, cmd_26, ARRAY_SIZEOF(cmd_26)); + + // Set Gamma + const uint8_t cmd_e0[] = { + 0x0F, 0x1D, 0x19, 0x0E, 0x10, 0x07, 0x4C, 0x63, + 0x3F, 0x03, 0x0D, 0x00, 0x26, 0x24, 0x04 + }; + portapack_lcd_data_write_command_and_data(portapack, 0xE0, cmd_e0, ARRAY_SIZEOF(cmd_e0)); + + // Set Gamma + const uint8_t cmd_e1[] = { + 0x00, 0x1C, 0x1F, 0x02, 0x0F, 0x03, 0x35, 0x25, + 0x47, 0x04, 0x0C, 0x0B, 0x29, 0x2F, 0x05 + }; + portapack_lcd_data_write_command_and_data(portapack, 0xE1, cmd_e1, ARRAY_SIZEOF(cmd_e1)); + + portapack_lcd_wake(portapack); + + // Turn on Tearing Effect Line (TE) output signal. + const uint8_t cmd_35[] = { 0b00000000 }; + portapack_lcd_data_write_command_and_data(portapack, 0x35, cmd_35, ARRAY_SIZEOF(cmd_35)); +} + +static void portapack_lcd_ramwr_start(portapack_t* const portapack) { + const uint8_t cmd_2c[] = {}; + portapack_lcd_data_write_command_and_data(portapack, 0x2c, cmd_2c, ARRAY_SIZEOF(cmd_2c)); +} + +static void portapack_lcd_set(portapack_t* const portapack, const uint_fast8_t command, const uint_fast16_t start, const uint_fast16_t end) { + const uint8_t data[] = { + (start >> 8), (start & 0xff), + (end >> 8), (end & 0xff) + }; + portapack_lcd_data_write_command_and_data(portapack, command, data, ARRAY_SIZEOF(data)); +} + +static void portapack_lcd_caset(portapack_t* const portapack, const uint_fast16_t start_column, uint_fast16_t end_column) { + portapack_lcd_set(portapack, 0x2a, start_column, end_column); +} + +static void portapack_lcd_paset(portapack_t* const portapack, const uint_fast16_t start_page, const uint_fast16_t end_page) { + portapack_lcd_set(portapack, 0x2b, start_page, end_page); +} + + +static void portapack_lcd_start_ram_write( + portapack_t* const portapack, + ui_rect_t rect +) { + portapack_lcd_caset(portapack, rect.point.x, rect.point.x + rect.size.width - 1); + portapack_lcd_paset(portapack, rect.point.y, rect.point.y + rect.size.height - 1); + portapack_lcd_ramwr_start(portapack); +} + +static void portapack_lcd_fill_rectangle( + portapack_t* const portapack, + ui_rect_t rect, + ui_color_t color +) { + portapack_lcd_start_ram_write(portapack, rect); + portapack_lcd_write_pixels_color(portapack, color, rect.size.width * rect.size.height); +} + +static void portapack_draw_bitmap( + portapack_t* const portapack, + const ui_point_t point, + const ui_bitmap_t bitmap, + const ui_color_t foreground, + const ui_color_t background +) { + const ui_rect_t rect = { + .point = point, + .size = bitmap.size + }; + + portapack_lcd_start_ram_write(portapack, rect); + + const size_t count = bitmap.size.width * bitmap.size.height; + for(size_t i=0; i> 3] & (1U << (i & 0x7)); + portapack_lcd_write_pixel(portapack, pixel ? foreground : background); + } +} + +static ui_bitmap_t portapack_font_glyph( + const ui_font_t* const font, + const char c +) { + if( c >= font->c_start ) { + const uint_fast8_t index = c - font->c_start; + if( index < font->c_count ) { + const ui_bitmap_t bitmap = { + .size = font->glyph_size, + .data = &font->data[index * font->data_stride] + }; + return bitmap; + } + } + + const ui_bitmap_t bitmap = { + .size = font->glyph_size, + .data = font->data, + }; + return bitmap; +} + +static void portapack_lcd_draw_int(portapack_t* const portapack, const ui_point_t point, uint64_t value, size_t field_width) { + ui_point_t point_next = { + .x = point.x + font_fixed_8x16.glyph_size.width * field_width, + .y = point.y + }; + + const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); + const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); + + while(value) { + const char c = '0' + value % 10; + value /= 10; + + const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); + point_next.x -= glyph.size.width; + portapack_draw_bitmap(portapack, point_next, glyph, color_foreground, color_background); + } + + while(point_next.x > point.x) { + const char c = ' '; + const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); + point_next.x -= glyph.size.width; + portapack_draw_bitmap(portapack, point_next, glyph, color_foreground, color_background); + } +} + +static void portapack_lcd_clear(portapack_t* const portapack) { + const ui_rect_t rect_screen = { { 0, 0 }, { 240, 320 } }; + const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); + portapack_lcd_fill_rectangle(portapack, rect_screen, color_background); +} + +typedef struct draw_list_t { + const ui_bitmap_t* bitmap; + const ui_point_t point; +} draw_list_t; + +static draw_list_t radio_draw_list[] = { + { &bitmap_antenna, { 32, 64 } }, + { &bitmap_wire_8, { 43, 88 } }, + { &bitmap_amp_rx, { 32, 96 } }, + { &bitmap_wire_8, { 43, 120 } }, + { &bitmap_filter_hp, { 32, 128 } }, + { &bitmap_wire_8, { 43, 152 } }, + { &bitmap_mixer, { 32, 160 } }, + { &bitmap_wire_8, { 43, 184 } }, + { &bitmap_amp_rx, { 32, 192 } }, + { &bitmap_wire_8, { 43, 216 } }, + { &bitmap_mixer, { 32, 224 } }, + { &bitmap_wire_8, { 43, 248 } }, + { &bitmap_filter_lp, { 32, 256 } }, + { &bitmap_wire_8, { 43, 280 } }, + { &bitmap_amp_rx, { 32, 288 } }, + { &bitmap_wire_8, { 43, 312 } }, +}; + +typedef enum { + RADIO_DRAW_LIST_ITEM_ANTENNA = 0, + RADIO_DRAW_LIST_ITEM_RF_AMP = 2, + RADIO_DRAW_LIST_ITEM_IMAGE_FILTER = 4, + RADIO_DRAW_LIST_ITEM_RF_MIXER = 6, + RADIO_DRAW_LIST_ITEM_BB_LNA_AMP = 8, + RADIO_DRAW_LIST_ITEM_BB_MIXER = 10, + RADIO_DRAW_LIST_ITEM_BB_FILTER = 12, + RADIO_DRAW_LIST_ITEM_BB_VGA_AMP = 14 +} radio_draw_list_item_t; + +static const uint8_t VALUES_X = 72; + +static void portapack_draw_radio_path( + portapack_t* const portapack, + const draw_list_t* const draw_list, + const size_t count +) { + const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); + const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); + + for( size_t i=0; i0) && (value == 0) ) { + const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_24x19, '0'); + point.x -= glyph.size.width; + const ui_rect_t rect = { point, glyph.size }; + portapack_lcd_fill_rectangle(&portapack, rect, color_background); + } else { + const char c = '0' + value % 10; + value /= 10; + + const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_24x19, c); + point.x -= glyph.size.width; + portapack_draw_bitmap(&portapack, point, glyph, color_foreground, color_background); + } + } +} + +static rf_path_direction_t portapack_direction = RF_PATH_DIRECTION_OFF; + +static void portapack_radio_path_redraw() { + portapack_draw_radio_path(&portapack, radio_draw_list, ARRAY_SIZEOF(radio_draw_list)); +} + +void hackrf_ui_setDirection(const rf_path_direction_t direction) { + switch(direction) { + case RF_PATH_DIRECTION_TX: + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = &bitmap_amp_tx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].bitmap = &bitmap_amp_tx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].bitmap = &bitmap_wire_24; + break; + + case RF_PATH_DIRECTION_RX: + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = &bitmap_amp_rx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].bitmap = &bitmap_amp_rx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].bitmap = &bitmap_amp_rx; + break; + + case RF_PATH_DIRECTION_OFF: + default: + break; + } + + portapack_radio_path_redraw(); + + portapack_direction = direction; +} + +void hackrf_ui_setLNAPower(bool lna_on) { + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = lna_on + ? ((portapack_direction == RF_PATH_DIRECTION_TX) ? &bitmap_amp_tx : &bitmap_amp_rx) + : &bitmap_wire_24; + portapack_radio_path_redraw(); +} + +void hackrf_ui_setFilter(const rf_path_filter_t filter) { + const ui_bitmap_t* bitmap = &bitmap_wire_24; + + switch(filter) { + case RF_PATH_FILTER_BYPASS: + bitmap = &bitmap_wire_24; + break; + + case RF_PATH_FILTER_LOW_PASS: + bitmap = &bitmap_filter_lp; + break; + + case RF_PATH_FILTER_HIGH_PASS: + bitmap = &bitmap_filter_hp; + break; + } + + radio_draw_list[RADIO_DRAW_LIST_ITEM_IMAGE_FILTER].bitmap = bitmap; + portapack_radio_path_redraw(); +} + +void hackrf_ui_setBBLNAGain(const uint32_t gain_db) { + ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].point.y + 4 }; + portapack_lcd_draw_int(&portapack, point, gain_db, 2); +} + +void hackrf_ui_setFilterBW(uint32_t bandwidth) { + ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_FILTER].point.y + 4 }; + portapack_lcd_draw_int(&portapack, point, bandwidth, 8); +} + +void hackrf_ui_setBBVGAGain(const uint32_t gain_db) { + ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].point.y + 4 }; + portapack_lcd_draw_int(&portapack, point, gain_db, 2); +} + +void hackrf_ui_setSampleRate(uint32_t sample_rate) { + ui_point_t point = { VALUES_X, 320 - 1 * 16 }; + portapack_lcd_draw_int(&portapack, point, sample_rate, 8); +} + +#endif diff --git a/firmware/common/ui_portapack.h b/firmware/common/ui_portapack.h new file mode 100644 index 00000000..d4ddda18 --- /dev/null +++ b/firmware/common/ui_portapack.h @@ -0,0 +1,59 @@ +/* + * Copyright 2018 Jared Boone + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __UI_PORTAPACK_H__ +#define __UI_PORTAPACK_H__ + +#include + +typedef struct ui_color_t { + uint16_t v; +} ui_color_t; + +typedef struct ui_point_t { + int16_t x; + int16_t y; +} ui_point_t; + +typedef struct ui_size_t { + int16_t width; + int16_t height; +} ui_size_t; + +typedef struct ui_rect_t { + ui_point_t point; + ui_size_t size; +} ui_rect_t; + +typedef struct ui_bitmap_t { + ui_size_t size; + const uint8_t* const data; +} ui_bitmap_t; + +typedef struct ui_font_t { + const ui_size_t glyph_size; + const uint8_t* const data; + char c_start; + size_t c_count; + size_t data_stride; +} ui_font_t; + +#endif/*__UI_PORTAPACK_H__*/ diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index 8a456e04..baa77b78 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -58,11 +58,19 @@ else() set(MCU_PARTNO LPC4330) endif() +if(BOARD STREQUAL "RAD1O") + set(USER_INTERFACE RAD1O) +endif() + +if(NOT DEFINED USER_INTERFACE) + set(USER_INTERFACE NONE) +endif() + if(NOT DEFINED SRC_M0) set(SRC_M0 "${PATH_HACKRF_FIRMWARE_COMMON}/m0_sleep.c") endif() -SET(HACKRF_OPTS "-D${BOARD} -DLPC43XX -D${MCU_PARTNO} -DTX_ENABLE -D'VERSION_STRING=\"git-${VERSION}\"'") +SET(HACKRF_OPTS "-D${BOARD} -DUSER_INTERFACE_${USER_INTERFACE} -DLPC43XX -D${MCU_PARTNO} -DTX_ENABLE -D'VERSION_STRING=\"git-${VERSION}\"'") SET(LDSCRIPT_M4 "-T${PATH_HACKRF_FIRMWARE_COMMON}/${MCU_PARTNO}_M4_memory.ld -Tlibopencm3_lpc43xx_rom_to_ram.ld -T${PATH_HACKRF_FIRMWARE_COMMON}/LPC43xx_M4_M0_image_from_text.ld") @@ -129,6 +137,13 @@ macro(DeclareTargets) ) endif() + if(USER_INTERFACE STREQUAL "PORTAPACK") + SET(SRC_M4 + ${SRC_M4} + ${PATH_HACKRF_FIRMWARE_COMMON}/ui_portapack.c + ) + endif() + configure_file( ${PATH_HACKRF_FIRMWARE_COMMON}/m0_bin.s.cmake m0_bin.s From 88fb406a558f7a671d40aaab3c00c82b0d44087a Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 10:10:01 -0800 Subject: [PATCH 02/36] PortaPack: Conditionally claim JTAG pins in SCU #defines --- firmware/common/cpld_jtag.c | 16 ++++++++++++++++ firmware/common/cpld_jtag.h | 4 ++++ firmware/common/hackrf_core.c | 9 +++++++++ firmware/common/hackrf_core.h | 8 ++++++++ 4 files changed, 37 insertions(+) diff --git a/firmware/common/cpld_jtag.c b/firmware/common/cpld_jtag.c index ca117ccc..3e34f0b9 100644 --- a/firmware/common/cpld_jtag.c +++ b/firmware/common/cpld_jtag.c @@ -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_TMS, 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_output(jtag->gpio->gpio_tck); gpio_output(jtag->gpio->gpio_tms); 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 */ @@ -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_TMS, 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_tck); gpio_input(jtag->gpio->gpio_tms); 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() */ diff --git a/firmware/common/cpld_jtag.h b/firmware/common/cpld_jtag.h index 5805bbc8..f8ce0b0e 100644 --- a/firmware/common/cpld_jtag.h +++ b/firmware/common/cpld_jtag.h @@ -31,6 +31,10 @@ typedef struct jtag_gpio_t { gpio_t gpio_tck; gpio_t gpio_tdi; gpio_t gpio_tdo; +#ifdef USER_INTERFACE_PORTAPACK + gpio_t gpio_pp_tms; + gpio_t gpio_pp_tdo; +#endif } jtag_gpio_t; typedef struct jtag_t { diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index 028f9cc7..81fbf1f8 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -123,6 +123,11 @@ static struct gpio_t gpio_cpld_tms = GPIO(3, 1); static struct gpio_t gpio_cpld_tdi = GPIO(3, 4); #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_rx_q_invert = GPIO(0, 13); @@ -270,6 +275,10 @@ jtag_gpio_t jtag_gpio_cpld = { .gpio_tck = &gpio_cpld_tck, .gpio_tdi = &gpio_cpld_tdi, .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 = { diff --git a/firmware/common/hackrf_core.h b/firmware/common/hackrf_core.h index 1b1fc5f7..ddfbbf60 100644 --- a/firmware/common/hackrf_core.h +++ b/firmware/common/hackrf_core.h @@ -235,9 +235,17 @@ extern "C" #define SCU_PINMUX_GPIO3_15 (P7_7) /* GPIO3[15] */ #endif +#ifdef USER_INTERFACE_PORTAPACK +#define SCU_PINMUX_PP_TDO (P1_5) /* GPIO1[8] */ +#else #define SCU_PINMUX_SD_POW (P1_5) /* GPIO1[8] */ +#endif #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] */ +#endif #define SCU_PINMUX_SD_DAT0 (P1_9) /* GPIO1[2] */ #define SCU_PINMUX_SD_DAT1 (P1_10) /* GPIO1[3] */ #define SCU_PINMUX_SD_DAT2 (P1_11) /* GPIO1[4] */ From 0b46745aedd4b52e616733208e816db433951b93 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 15:14:52 -0800 Subject: [PATCH 03/36] OperaCake code conflicts with PortaPack code, make compile-time conditional. --- firmware/common/tuning.c | 2 ++ firmware/hackrf_usb/CMakeLists.txt | 8 +++++++- firmware/hackrf_usb/hackrf_usb.c | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/firmware/common/tuning.c b/firmware/common/tuning.c index d4c27a5c..95ff7ed8 100644 --- a/firmware/common/tuning.c +++ b/firmware/common/tuning.c @@ -116,7 +116,9 @@ bool set_freq(const uint64_t freq) if( success ) { freq_cache = freq; hackrf_ui_setFrequency(freq); +#ifndef USER_INTERFACE_PORTAPACK operacake_set_range(freq_mhz); +#endif } return success; } diff --git a/firmware/hackrf_usb/CMakeLists.txt b/firmware/hackrf_usb/CMakeLists.txt index 820ec089..d950535d 100644 --- a/firmware/hackrf_usb/CMakeLists.txt +++ b/firmware/hackrf_usb/CMakeLists.txt @@ -42,7 +42,6 @@ set(SRC_M4 usb_api_register.c usb_api_spiflash.c usb_api_transceiver.c - "${PATH_HACKRF_FIRMWARE_COMMON}/operacake.c" usb_api_operacake.c usb_api_sweep.c "${PATH_HACKRF_FIRMWARE_COMMON}/usb_queue.c" @@ -54,4 +53,11 @@ set(SRC_M4 "${PATH_HACKRF_FIRMWARE_COMMON}/rom_iap.c" ) +if(NOT USER_INTERFACE STREQUAL "PORTAPACK") + SET(SRC_M4 + ${SRC_M4} + "${PATH_HACKRF_FIRMWARE_COMMON}/operacake.c" + ) +endif() + DeclareTargets() diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 280ad4b2..43d70142 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -85,15 +85,28 @@ static const usb_request_handler_fn vendor_request_handler[] = { usb_vendor_request_set_freq_explicit, usb_vendor_request_read_wcid, // USB_WCID_VENDOR_REQ usb_vendor_request_init_sweep, +#ifdef USER_INTERFACE_PORTAPACK + NULL, + NULL, +#else usb_vendor_request_operacake_get_boards, usb_vendor_request_operacake_set_ports, +#endif usb_vendor_request_set_hw_sync_mode, usb_vendor_request_reset, +#ifdef USER_INTERFACE_PORTAPACK + NULL, +#else usb_vendor_request_operacake_set_ranges, +#endif usb_vendor_request_set_clkout_enable, usb_vendor_request_spiflash_status, usb_vendor_request_spiflash_clear_status, +#ifdef USER_INTERFACE_PORTAPACK + NULL +#else usb_vendor_request_operacake_gpio_test +#endif }; static const uint32_t vendor_request_handler_count = @@ -198,7 +211,10 @@ int main(void) { usb_run(&usb_device); rf_path_init(&rf_path); + +#ifndef USER_INTERFACE_PORTAPACK operacake_init(); +#endif unsigned int phase = 0; From 5535cf059effcea83f6ef3b4a636eb2c466dc549 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 20:26:55 -0800 Subject: [PATCH 04/36] Pin setup: Make GPIO direction reset the *first* step. --- firmware/common/hackrf_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index 81fbf1f8..7d5ca8ae 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -759,6 +759,9 @@ void ssp1_set_mode_max5864(void) } void pin_setup(void) { + /* Configure all GPIO as Input (safe state) */ + gpio_init(); + /* Release CPLD JTAG pins */ scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4); scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); @@ -786,9 +789,6 @@ void pin_setup(void) { scu_pinmux(SCU_PINMUX_USB_LED1, SCU_CONF_FUNCTION3); #endif - /* Configure all GPIO as Input (safe state) */ - gpio_init(); - gpio_output(&gpio_led[0]); gpio_output(&gpio_led[1]); gpio_output(&gpio_led[2]); From 610e6b58cc1ebef004652e19136a218cb3295c76 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 20:29:25 -0800 Subject: [PATCH 05/36] Set VAA_ENABLE# state before setting GPIO to output. ...to avoid glitching the output voltage. --- firmware/common/hackrf_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index 7d5ca8ae..b17bee7e 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -813,12 +813,12 @@ void pin_setup(void) { #endif #ifdef RAD1O - /* Configure RF power supply (VAA) switch control signal as output */ - gpio_output(&gpio_vaa_enable); - /* Safe state: start with VAA turned off: */ disable_rf_power(); + /* Configure RF power supply (VAA) switch control signal as output */ + gpio_output(&gpio_vaa_enable); + /* Disable unused clock outputs. They generate noise. */ scu_pinmux(CLK0, SCU_CLK_IN | SCU_CONF_FUNCTION7); scu_pinmux(CLK2, SCU_CLK_IN | SCU_CONF_FUNCTION7); From bfd3b1b7689b2ef1c45a88572f18b04c4bd8fe6c Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 20:31:31 -0800 Subject: [PATCH 06/36] Set 1V8 enable state before configuring pin function or to output mode ...to avoid glitching 1V8 enable voltage. --- firmware/common/hackrf_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index b17bee7e..d1842557 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -781,8 +781,6 @@ void pin_setup(void) { scu_pinmux(SCU_PINMUX_LED4, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4); #endif - scu_pinmux(SCU_PINMUX_EN1V8, SCU_GPIO_NOPULL); - /* Configure USB indicators */ #ifdef JAWBREAKER scu_pinmux(SCU_PINMUX_USB_LED0, SCU_CONF_FUNCTION3); @@ -796,7 +794,9 @@ void pin_setup(void) { gpio_output(&gpio_led[3]); #endif + disable_1v8_power(); gpio_output(&gpio_1v8_enable); + scu_pinmux(SCU_PINMUX_EN1V8, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); #ifdef HACKRF_ONE /* Safe state: start with VAA turned off: */ From 816d435dc5887ddcd01a133ef2f1c0b75315b559 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 20:33:33 -0800 Subject: [PATCH 07/36] Pin setup: Break out JTAG configuration, rework to consider PortaPack. --- firmware/common/cpld_jtag.c | 43 ----------------------------- firmware/common/cpld_jtag.h | 2 -- firmware/common/hackrf_core.c | 51 +++++++++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 56 deletions(-) diff --git a/firmware/common/cpld_jtag.c b/firmware/common/cpld_jtag.c index 3e34f0b9..0948858c 100644 --- a/firmware/common/cpld_jtag.c +++ b/firmware/common/cpld_jtag.c @@ -29,47 +29,6 @@ static refill_buffer_cb refill_buffer; static uint32_t xsvf_buffer_len, xsvf_pos; static unsigned char* xsvf_buffer; -void cpld_jtag_setup(jtag_t* const jtag) { - scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4); - 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_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_output(jtag->gpio->gpio_tck); - gpio_output(jtag->gpio->gpio_tms); - 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 */ -void cpld_jtag_release(jtag_t* const jtag) { - scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4); - 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_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_tck); - gpio_input(jtag->gpio->gpio_tms); - 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() */ int cpld_jtag_program( jtag_t* const jtag, @@ -78,12 +37,10 @@ int cpld_jtag_program( refill_buffer_cb refill ) { int error; - cpld_jtag_setup(jtag); xsvf_buffer = buffer; xsvf_buffer_len = buffer_length; refill_buffer = refill; error = xsvfExecute(jtag->gpio); - cpld_jtag_release(jtag); return error; } diff --git a/firmware/common/cpld_jtag.h b/firmware/common/cpld_jtag.h index f8ce0b0e..04292d22 100644 --- a/firmware/common/cpld_jtag.h +++ b/firmware/common/cpld_jtag.h @@ -43,8 +43,6 @@ typedef struct jtag_t { typedef void (*refill_buffer_cb)(void); -void cpld_jtag_release(jtag_t* const jtag); - /* Return 0 if success else return error code see xsvfExecute() see micro.h. * * We expect the buffer to be initially full of data. After the entire diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index d1842557..74becd01 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -758,21 +758,50 @@ void ssp1_set_mode_max5864(void) spi_bus_start(max5864.bus, &ssp_config_max5864); } +static void jtag_setup(void) { + /* TDI and TMS pull-ups are required in all JTAG-compliant devices. + * Therefore, do not pull up TDI and TMS on HackRF CPLD, which is always present. + * HackRF TMS and TDI are dedicated, just drive instead of pulling up/down. + * TCK is recommended to be held low. + * TDO is undriven except when in Shift-IR or Shift-DR phases, so pull down to keep from floating. + * Nail down other signals before causing any transitions on TCK, to prevent undesired + * state changes. + */ + /* LPC43xx pull-up and pull-down resistors are approximately 53K. */ +#ifdef USER_INTERFACE_PORTAPACK + gpio_set(jtag_gpio_cpld.gpio_pp_tms); +#endif + gpio_set(jtag_gpio_cpld.gpio_tms); + gpio_set(jtag_gpio_cpld.gpio_tdi); + gpio_clear(jtag_gpio_cpld.gpio_tck); + +#ifdef USER_INTERFACE_PORTAPACK + /* Do not drive PortaPack-specific pins, initially, just to be cautious. */ + gpio_input(jtag_gpio_cpld.gpio_pp_tms); + gpio_input(jtag_gpio_cpld.gpio_pp_tdo); +#endif + gpio_output(jtag_gpio_cpld.gpio_tms); + gpio_output(jtag_gpio_cpld.gpio_tdi); + gpio_output(jtag_gpio_cpld.gpio_tck); + gpio_input(jtag_gpio_cpld.gpio_tdo); + + /* Configure CPLD JTAG pins */ +#ifdef USER_INTERFACE_PORTAPACK + scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0); + scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); +#endif + 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_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION4); + scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); +} + void pin_setup(void) { /* Configure all GPIO as Input (safe state) */ gpio_init(); - /* Release CPLD JTAG pins */ - scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4); - 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_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); - - gpio_input(&gpio_cpld_tdo); - gpio_input(&gpio_cpld_tck); - gpio_input(&gpio_cpld_tms); - gpio_input(&gpio_cpld_tdi); - + jtag_setup(); + /* Configure SCU Pin Mux as GPIO */ scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_NOPULL); scu_pinmux(SCU_PINMUX_LED2, SCU_GPIO_NOPULL); From b35ec285b6d8d79163673d1d6c9692826d352833 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 21:11:00 -0800 Subject: [PATCH 08/36] PortaPack UI: Miscellaneous clean-up Remove "portapack" arg to many static functions, no idea why I thought that was necessary. Add PortaPack presence detect function using JTAG. Create a "hackrf_ui_t" type that has function pointers to a specific UI implementation, returned by a UI detection function. --- firmware/common/ui_portapack.c | 475 +++++++++++++++++++++------------ firmware/common/ui_portapack.h | 28 ++ 2 files changed, 332 insertions(+), 171 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 7ba19e22..f5162a40 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -287,7 +287,7 @@ typedef struct portapack_t { uint8_t io_reg; } portapack_t; -portapack_t portapack = { +static portapack_t portapack = { .gpio_dir = &gpio_dir, .gpio_lcd_rdx = &gpio_lcd_rdx, .gpio_lcd_wrx = &gpio_lcd_wrx, @@ -301,28 +301,28 @@ portapack_t portapack = { #define GPIO_DATA_SHIFT (8) static const uint32_t gpio_data_mask = 0xFFU << GPIO_DATA_SHIFT; -static void portapack_data_mask_set(portapack_t* const portapack) { - portapack->gpio_port_data->mask = ~gpio_data_mask; +static void portapack_data_mask_set() { + portapack.gpio_port_data->mask = ~gpio_data_mask; } -static void portapack_data_write_low(portapack_t* const portapack, const uint32_t value) { - portapack->gpio_port_data->mpin = (value << GPIO_DATA_SHIFT); +static void portapack_data_write_low(const uint32_t value) { + portapack.gpio_port_data->mpin = (value << GPIO_DATA_SHIFT); } -static void portapack_data_write_high(portapack_t* const portapack, const uint32_t value) { +static void portapack_data_write_high(const uint32_t value) { /* NOTE: Assumes no other bits in the port are masked. */ /* NOTE: Assumes that bits 15 through 8 are masked. */ - portapack->gpio_port_data->mpin = value; + portapack.gpio_port_data->mpin = value; } -static void portapack_dir_read(portapack_t* const portapack) { - portapack->gpio_port_data->dir &= ~gpio_data_mask; - gpio_set(portapack->gpio_dir); +static void portapack_dir_read() { + portapack.gpio_port_data->dir &= ~gpio_data_mask; + gpio_set(portapack.gpio_dir); } -static void portapack_dir_write(portapack_t* const portapack) { - gpio_clear(portapack->gpio_dir); - portapack->gpio_port_data->dir |= gpio_data_mask; +static void portapack_dir_write() { + gpio_clear(portapack.gpio_dir); + portapack.gpio_port_data->dir |= gpio_data_mask; /* TODO: Manipulating DIR[3] makes me queasy. The RFFC5072 DATA pin * is also on port 3, and switches direction periodically... * Time to resort to bit-banding to enforce atomicity? But then, how @@ -331,147 +331,207 @@ static void portapack_dir_write(portapack_t* const portapack) { */ } -static void portapack_lcd_rd_assert(portapack_t* const portapack) { - gpio_clear(portapack->gpio_lcd_rdx); +static void portapack_lcd_rd_assert() { + gpio_clear(portapack.gpio_lcd_rdx); } -static void portapack_lcd_rd_deassert(portapack_t* const portapack) { - gpio_set(portapack->gpio_lcd_rdx); +static void portapack_lcd_rd_deassert() { + gpio_set(portapack.gpio_lcd_rdx); } -static void portapack_lcd_wr_assert(portapack_t* const portapack) { - gpio_clear(portapack->gpio_lcd_wrx); +static void portapack_lcd_wr_assert() { + gpio_clear(portapack.gpio_lcd_wrx); } -static void portapack_lcd_wr_deassert(portapack_t* const portapack) { - gpio_set(portapack->gpio_lcd_wrx); +static void portapack_lcd_wr_deassert() { + gpio_set(portapack.gpio_lcd_wrx); } -static void portapack_io_stb_assert(portapack_t* const portapack) { - gpio_clear(portapack->gpio_io_stbx); +static void portapack_io_stb_assert() { + gpio_clear(portapack.gpio_io_stbx); } -static void portapack_io_stb_deassert(portapack_t* const portapack) { - gpio_set(portapack->gpio_io_stbx); +static void portapack_io_stb_deassert() { + gpio_set(portapack.gpio_io_stbx); } -static void portapack_addr(portapack_t* const portapack, const bool value) { - gpio_write(portapack->gpio_addr, value); +static void portapack_addr(const bool value) { + gpio_write(portapack.gpio_addr, value); } -static void portapack_lcd_command(portapack_t* const portapack, const uint32_t value) { - portapack_data_write_high(portapack, 0); /* Drive high byte (with zero -- don't care) */ - portapack_dir_write(portapack); /* Turn around data bus, MCU->CPLD */ - portapack_addr(portapack, 0); /* Indicate command */ +static void portapack_lcd_command(const uint32_t value) { + portapack_data_write_high(0); /* Drive high byte (with zero -- don't care) */ + portapack_dir_write(); /* Turn around data bus, MCU->CPLD */ + portapack_addr(0); /* Indicate command */ __asm__("nop"); __asm__("nop"); __asm__("nop"); - portapack_lcd_wr_assert(portapack); /* Latch high byte */ + portapack_lcd_wr_assert(); /* Latch high byte */ - portapack_data_write_low(portapack, value); /* Drive low byte (pass-through) */ + portapack_data_write_low(value); /* Drive low byte (pass-through) */ __asm__("nop"); __asm__("nop"); __asm__("nop"); - portapack_lcd_wr_deassert(portapack); /* Complete write operation */ + portapack_lcd_wr_deassert(); /* Complete write operation */ - portapack_addr(portapack, 1); /* Set up for data phase (most likely after a command) */ + portapack_addr(1); /* Set up for data phase (most likely after a command) */ } -static void portapack_lcd_write_data(portapack_t* const portapack, const uint32_t value) { +static void portapack_lcd_write_data(const uint32_t value) { // NOTE: Assumes and DIR=0 and ADDR=1 from command phase. - portapack_data_write_high(portapack, value); /* Drive high byte */ + portapack_data_write_high(value); /* Drive high byte */ __asm__("nop"); - portapack_lcd_wr_assert(portapack); /* Latch high byte */ + portapack_lcd_wr_assert(); /* Latch high byte */ - portapack_data_write_low(portapack, value); /* Drive low byte (pass-through) */ + portapack_data_write_low(value); /* Drive low byte (pass-through) */ __asm__("nop"); __asm__("nop"); __asm__("nop"); - portapack_lcd_wr_deassert(portapack); /* Complete write operation */ + portapack_lcd_wr_deassert(); /* Complete write operation */ } -static void portapack_io_write(portapack_t* const portapack, const bool address, const uint_fast16_t value) { - portapack_data_write_low(portapack, value); - portapack_dir_write(portapack); - portapack_addr(portapack, address); +static void portapack_io_write(const bool address, const uint_fast16_t value) { + portapack_data_write_low(value); + portapack_dir_write(); + portapack_addr(address); __asm__("nop"); __asm__("nop"); __asm__("nop"); - portapack_io_stb_assert(portapack); + portapack_io_stb_assert(); __asm__("nop"); __asm__("nop"); __asm__("nop"); - portapack_io_stb_deassert(portapack); + portapack_io_stb_deassert(); } static void portapack_lcd_data_write_command_and_data( - portapack_t* const portapack, const uint_fast8_t command, const uint8_t* data, const size_t data_count ) { - portapack_lcd_command(portapack, command); + portapack_lcd_command(command); for(size_t i=0; iio_reg = (portapack->io_reg & 0x7f) | (on ? (1 << 7) : 0); - portapack_io_write(portapack, 1, portapack->io_reg); +static void portapack_backlight(const bool on) { + portapack.io_reg = (portapack.io_reg & 0x7f) | (on ? (1 << 7) : 0); + portapack_io_write(1, portapack.io_reg); } -static void portapack_lcd_reset_state(portapack_t* const portapack, const bool active) { - portapack->io_reg = (portapack->io_reg & 0xfe) | (active ? (1 << 0) : 0); - portapack_io_write(portapack, 1, portapack->io_reg); +static void portapack_lcd_reset_state(const bool active) { + portapack.io_reg = (portapack.io_reg & 0xfe) | (active ? (1 << 0) : 0); + portapack_io_write(1, portapack.io_reg); } -static void portapack_lcd_sleep_out(portapack_t* const portapack) { +static void portapack_lcd_sleep_out() { const uint8_t cmd_11[] = {}; - portapack_lcd_data_write_command_and_data(portapack, 0x11, cmd_11, ARRAY_SIZEOF(cmd_11)); + portapack_lcd_data_write_command_and_data(0x11, cmd_11, ARRAY_SIZEOF(cmd_11)); // "It will be necessary to wait 120msec after sending Sleep Out // command (when in Sleep In Mode) before Sleep In command can be // sent." portapack_sleep_milliseconds(120); } -static void portapack_lcd_display_on(portapack_t* const portapack) { +static void portapack_lcd_display_on() { const uint8_t cmd_29[] = {}; - portapack_lcd_data_write_command_and_data(portapack, 0x29, cmd_29, ARRAY_SIZEOF(cmd_29)); + portapack_lcd_data_write_command_and_data(0x29, cmd_29, ARRAY_SIZEOF(cmd_29)); } -static void portapack_lcd_wake(portapack_t* const portapack) { - portapack_lcd_sleep_out(portapack); - portapack_lcd_display_on(portapack); +static void portapack_lcd_wake() { + portapack_lcd_sleep_out(); + portapack_lcd_display_on(); } -static void portapack_if_init(portapack_t* const portapack) { - portapack_data_mask_set(portapack); - portapack_data_write_high(portapack, 0); +static bool jtag_pp_tck(const bool tms_value) { + gpio_write(jtag_cpld.gpio->gpio_pp_tms, tms_value); - portapack_dir_read(portapack); - portapack_lcd_rd_deassert(portapack); - portapack_lcd_wr_deassert(portapack); - portapack_io_stb_deassert(portapack); - portapack_addr(portapack, 0); + // 8 ns TMS/TDI to TCK setup + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); - gpio_output(portapack->gpio_dir); - gpio_output(portapack->gpio_lcd_rdx); - gpio_output(portapack->gpio_lcd_wrx); - gpio_output(portapack->gpio_io_stbx); - gpio_output(portapack->gpio_addr); - /* gpio_input(portapack->gpio_rot_a); */ - /* gpio_input(portapack->gpio_rot_b); */ + gpio_set(jtag_cpld.gpio->gpio_tck); + + // 15 ns TCK to TMS/TDI hold time + // 20 ns TCK high time + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + + gpio_clear(jtag_cpld.gpio->gpio_tck); + + // 20 ns TCK low time + // 25 ns TCK falling edge to TDO valid + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + __asm__("nop"); + + return gpio_read(jtag_cpld.gpio->gpio_pp_tdo); +} + +static uint32_t jtag_pp_shift(const uint32_t tms_bits, const size_t count) { + uint32_t result = 0; + size_t bit_in_index = count - 1; + size_t bit_out_index = 0; + while(bit_out_index < count) { + const uint32_t tdo = jtag_pp_tck((tms_bits >> bit_in_index) & 1) & 1; + result |= (tdo << bit_out_index); + + bit_in_index--; + bit_out_index++; + } + + return result; +} + +static uint32_t jtag_pp_idcode() { + /* Test-Logic/Reset -> Run-Test/Idle -> Select-DR/Scan -> Capture-DR */ + jtag_pp_shift(0b11111010, 8); + + /* Shift-DR */ + const uint32_t idcode = jtag_pp_shift(0, 32); + + /* Exit1-DR -> Update-DR -> Run-Test/Idle -> ... -> Test-Logic/Reset */ + jtag_pp_shift(0b11011111, 8); + + return idcode; +} + +static void portapack_if_init() { + portapack_data_mask_set(); + portapack_data_write_high(0); + + portapack_dir_read(); + portapack_lcd_rd_deassert(); + portapack_lcd_wr_deassert(); + portapack_io_stb_deassert(); + portapack_addr(0); + + gpio_output(portapack.gpio_dir); + gpio_output(portapack.gpio_lcd_rdx); + gpio_output(portapack.gpio_lcd_wrx); + gpio_output(portapack.gpio_io_stbx); + gpio_output(portapack.gpio_addr); + /* gpio_input(portapack.gpio_rot_a); */ + /* gpio_input(portapack.gpio_rot_b); */ scu_pinmux(SCU_PINMUX_PP_D0, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); scu_pinmux(SCU_PINMUX_PP_D1, SCU_CONF_FUNCTION0 | SCU_GPIO_PDN); @@ -491,16 +551,16 @@ static void portapack_if_init(portapack_t* const portapack) { /* scu_pinmux(SCU_PINMUX_PP_UNUSED, SCU_CONF_FUNCTION4 | SCU_GPIO_NOPULL); */ } -static void portapack_lcd_reset(portapack_t* const portapack) { - portapack_lcd_reset_state(portapack, false); +static void portapack_lcd_reset() { + portapack_lcd_reset_state(false); portapack_sleep_milliseconds(1); - portapack_lcd_reset_state(portapack, true); + portapack_lcd_reset_state(true); portapack_sleep_milliseconds(10); - portapack_lcd_reset_state(portapack, false); + portapack_lcd_reset_state(false); portapack_sleep_milliseconds(120); } -static void portapack_lcd_init(portapack_t* const portapack) { +static void portapack_lcd_init() { // LCDs are configured for IM[2:0] = 001 // 8080-I system, 16-bit parallel bus @@ -512,30 +572,30 @@ static void portapack_lcd_init(portapack_t* const portapack) { // 0 // PCEQ=1, DRV_ena=0, Power control=3 const uint8_t cmd_cf[] = { 0x00, 0xD9, 0x30 }; - portapack_lcd_data_write_command_and_data(portapack, 0xCF, cmd_cf, ARRAY_SIZEOF(cmd_cf)); + portapack_lcd_data_write_command_and_data(0xCF, cmd_cf, ARRAY_SIZEOF(cmd_cf)); // Power on sequence control const uint8_t cmd_ed[] = { 0x64, 0x03, 0x12, 0x81 }; - portapack_lcd_data_write_command_and_data(portapack, 0xED, cmd_ed, ARRAY_SIZEOF(cmd_ed)); + portapack_lcd_data_write_command_and_data(0xED, cmd_ed, ARRAY_SIZEOF(cmd_ed)); // Driver timing control A const uint8_t cmd_e8[] = { 0x85, 0x10, 0x78 }; - portapack_lcd_data_write_command_and_data(portapack, 0xE8, cmd_e8, ARRAY_SIZEOF(cmd_e8)); + portapack_lcd_data_write_command_and_data(0xE8, cmd_e8, ARRAY_SIZEOF(cmd_e8)); // Power control A const uint8_t cmd_cb[] = { 0x39, 0x2C, 0x00, 0x34, 0x02 }; - portapack_lcd_data_write_command_and_data(portapack, 0xCB, cmd_cb, ARRAY_SIZEOF(cmd_cb)); + portapack_lcd_data_write_command_and_data(0xCB, cmd_cb, ARRAY_SIZEOF(cmd_cb)); // Pump ratio control const uint8_t cmd_f7[] = { 0x20 }; - portapack_lcd_data_write_command_and_data(portapack, 0xF7, cmd_f7, ARRAY_SIZEOF(cmd_f7)); + portapack_lcd_data_write_command_and_data(0xF7, cmd_f7, ARRAY_SIZEOF(cmd_f7)); // Driver timing control B const uint8_t cmd_ea[] = { 0x00, 0x00 }; - portapack_lcd_data_write_command_and_data(portapack, 0xEA, cmd_ea, ARRAY_SIZEOF(cmd_ea)); + portapack_lcd_data_write_command_and_data(0xEA, cmd_ea, ARRAY_SIZEOF(cmd_ea)); const uint8_t cmd_b1[] = { 0x00, 0x1B }; - portapack_lcd_data_write_command_and_data(portapack, 0xB1, cmd_b1, ARRAY_SIZEOF(cmd_b1)); + portapack_lcd_data_write_command_and_data(0xB1, cmd_b1, ARRAY_SIZEOF(cmd_b1)); // Blanking Porch Control // VFP = 0b0000010 = 2 (number of HSYNC of vertical front porch) @@ -543,7 +603,7 @@ static void portapack_lcd_init(portapack_t* const portapack) { // HFP = 0b0001010 = 10 (number of DOTCLOCK of horizontal front porch) // HBP = 0b0010100 = 20 (number of DOTCLOCK of horizontal back porch) const uint8_t cmd_b5[] = { 0x02, 0x02, 0x0a, 0x14 }; - portapack_lcd_data_write_command_and_data(portapack, 0xB5, cmd_b5, ARRAY_SIZEOF(cmd_b5)); + portapack_lcd_data_write_command_and_data(0xB5, cmd_b5, ARRAY_SIZEOF(cmd_b5)); // Display Function Control // PT[1:0] = 0b10 @@ -556,25 +616,25 @@ static void portapack_lcd_init(portapack_t* const portapack) { // NL = 0b100111 (default) // PCDIV = 0b000000 (default?) const uint8_t cmd_b6[] = { 0x0A, 0xA2, 0x27, 0x00 }; - portapack_lcd_data_write_command_and_data(portapack, 0xB6, cmd_b6, ARRAY_SIZEOF(cmd_b6)); + portapack_lcd_data_write_command_and_data(0xB6, cmd_b6, ARRAY_SIZEOF(cmd_b6)); // Power Control 1 //VRH[5:0] const uint8_t cmd_c0[] = { 0x1B }; - portapack_lcd_data_write_command_and_data(portapack, 0xC0, cmd_c0, ARRAY_SIZEOF(cmd_c0)); + portapack_lcd_data_write_command_and_data(0xC0, cmd_c0, ARRAY_SIZEOF(cmd_c0)); // Power Control 2 //SAP[2:0];BT[3:0] const uint8_t cmd_c1[] = { 0x12 }; - portapack_lcd_data_write_command_and_data(portapack, 0xC1, cmd_c1, ARRAY_SIZEOF(cmd_c1)); + portapack_lcd_data_write_command_and_data(0xC1, cmd_c1, ARRAY_SIZEOF(cmd_c1)); // VCOM Control 1 const uint8_t cmd_c5[] = { 0x32, 0x3C }; - portapack_lcd_data_write_command_and_data(portapack, 0xC5, cmd_c5, ARRAY_SIZEOF(cmd_c5)); + portapack_lcd_data_write_command_and_data(0xC5, cmd_c5, ARRAY_SIZEOF(cmd_c5)); // VCOM Control 2 const uint8_t cmd_c7[] = { 0x9B }; - portapack_lcd_data_write_command_and_data(portapack, 0xC7, cmd_c7, ARRAY_SIZEOF(cmd_c7)); + portapack_lcd_data_write_command_and_data(0xC7, cmd_c7, ARRAY_SIZEOF(cmd_c7)); // Memory Access Control // Invert X and Y memory access order, so upper-left of @@ -586,12 +646,12 @@ static void portapack_lcd_init(portapack_t* const portapack) { (1 << 4) | // ML=1: reverse vertical refresh to simplify scrolling logic (1 << 3) // BGR=1: For Kingtech LCD, BGR filter. }; - portapack_lcd_data_write_command_and_data(portapack, 0x36, cmd_36, ARRAY_SIZEOF(cmd_36)); + portapack_lcd_data_write_command_and_data(0x36, cmd_36, ARRAY_SIZEOF(cmd_36)); // COLMOD: Pixel Format Set // DPI=101 (16 bits/pixel), DBI=101 (16 bits/pixel) const uint8_t cmd_3a[] = { 0x55 }; - portapack_lcd_data_write_command_and_data(portapack, 0x3A, cmd_3a, ARRAY_SIZEOF(cmd_3a)); + portapack_lcd_data_write_command_and_data(0x3A, cmd_3a, ARRAY_SIZEOF(cmd_3a)); //portapack_lcd_data_write_command_and_data(0xF6, { 0x01, 0x30 }); // WEMODE=1 (reset column and page number on overflow) @@ -602,79 +662,76 @@ static void portapack_lcd_init(portapack_t* const portapack) { // DM[1:0]=00 (internal clock operation) // ENDIAN=0 (doesn't matter with 16-bit interface) const uint8_t cmd_f6[] = { 0x01, 0x30, 0x00 }; - portapack_lcd_data_write_command_and_data(portapack, 0xF6, cmd_f6, ARRAY_SIZEOF(cmd_f6)); + portapack_lcd_data_write_command_and_data(0xF6, cmd_f6, ARRAY_SIZEOF(cmd_f6)); // 3Gamma Function Disable const uint8_t cmd_f2[] = { 0x00 }; - portapack_lcd_data_write_command_and_data(portapack, 0xF2, cmd_f2, ARRAY_SIZEOF(cmd_f2)); + portapack_lcd_data_write_command_and_data(0xF2, cmd_f2, ARRAY_SIZEOF(cmd_f2)); // Gamma curve selected const uint8_t cmd_26[] = { 0x01 }; - portapack_lcd_data_write_command_and_data(portapack, 0x26, cmd_26, ARRAY_SIZEOF(cmd_26)); + portapack_lcd_data_write_command_and_data(0x26, cmd_26, ARRAY_SIZEOF(cmd_26)); // Set Gamma const uint8_t cmd_e0[] = { 0x0F, 0x1D, 0x19, 0x0E, 0x10, 0x07, 0x4C, 0x63, 0x3F, 0x03, 0x0D, 0x00, 0x26, 0x24, 0x04 }; - portapack_lcd_data_write_command_and_data(portapack, 0xE0, cmd_e0, ARRAY_SIZEOF(cmd_e0)); + portapack_lcd_data_write_command_and_data(0xE0, cmd_e0, ARRAY_SIZEOF(cmd_e0)); // Set Gamma const uint8_t cmd_e1[] = { 0x00, 0x1C, 0x1F, 0x02, 0x0F, 0x03, 0x35, 0x25, 0x47, 0x04, 0x0C, 0x0B, 0x29, 0x2F, 0x05 }; - portapack_lcd_data_write_command_and_data(portapack, 0xE1, cmd_e1, ARRAY_SIZEOF(cmd_e1)); + portapack_lcd_data_write_command_and_data(0xE1, cmd_e1, ARRAY_SIZEOF(cmd_e1)); - portapack_lcd_wake(portapack); + portapack_lcd_wake(); // Turn on Tearing Effect Line (TE) output signal. const uint8_t cmd_35[] = { 0b00000000 }; - portapack_lcd_data_write_command_and_data(portapack, 0x35, cmd_35, ARRAY_SIZEOF(cmd_35)); + portapack_lcd_data_write_command_and_data(0x35, cmd_35, ARRAY_SIZEOF(cmd_35)); } -static void portapack_lcd_ramwr_start(portapack_t* const portapack) { +static void portapack_lcd_ramwr_start() { const uint8_t cmd_2c[] = {}; - portapack_lcd_data_write_command_and_data(portapack, 0x2c, cmd_2c, ARRAY_SIZEOF(cmd_2c)); + portapack_lcd_data_write_command_and_data(0x2c, cmd_2c, ARRAY_SIZEOF(cmd_2c)); } -static void portapack_lcd_set(portapack_t* const portapack, const uint_fast8_t command, const uint_fast16_t start, const uint_fast16_t end) { +static void portapack_lcd_set(const uint_fast8_t command, const uint_fast16_t start, const uint_fast16_t end) { const uint8_t data[] = { (start >> 8), (start & 0xff), (end >> 8), (end & 0xff) }; - portapack_lcd_data_write_command_and_data(portapack, command, data, ARRAY_SIZEOF(data)); + portapack_lcd_data_write_command_and_data(command, data, ARRAY_SIZEOF(data)); } -static void portapack_lcd_caset(portapack_t* const portapack, const uint_fast16_t start_column, uint_fast16_t end_column) { - portapack_lcd_set(portapack, 0x2a, start_column, end_column); +static void portapack_lcd_caset(const uint_fast16_t start_column, uint_fast16_t end_column) { + portapack_lcd_set(0x2a, start_column, end_column); } -static void portapack_lcd_paset(portapack_t* const portapack, const uint_fast16_t start_page, const uint_fast16_t end_page) { - portapack_lcd_set(portapack, 0x2b, start_page, end_page); +static void portapack_lcd_paset(const uint_fast16_t start_page, const uint_fast16_t end_page) { + portapack_lcd_set(0x2b, start_page, end_page); } static void portapack_lcd_start_ram_write( - portapack_t* const portapack, ui_rect_t rect ) { - portapack_lcd_caset(portapack, rect.point.x, rect.point.x + rect.size.width - 1); - portapack_lcd_paset(portapack, rect.point.y, rect.point.y + rect.size.height - 1); - portapack_lcd_ramwr_start(portapack); + portapack_lcd_caset(rect.point.x, rect.point.x + rect.size.width - 1); + portapack_lcd_paset(rect.point.y, rect.point.y + rect.size.height - 1); + portapack_lcd_ramwr_start(); } static void portapack_lcd_fill_rectangle( - portapack_t* const portapack, ui_rect_t rect, ui_color_t color ) { - portapack_lcd_start_ram_write(portapack, rect); - portapack_lcd_write_pixels_color(portapack, color, rect.size.width * rect.size.height); + portapack_lcd_start_ram_write(rect); + portapack_lcd_write_pixels_color(color, rect.size.width * rect.size.height); } static void portapack_draw_bitmap( - portapack_t* const portapack, const ui_point_t point, const ui_bitmap_t bitmap, const ui_color_t foreground, @@ -685,12 +742,12 @@ static void portapack_draw_bitmap( .size = bitmap.size }; - portapack_lcd_start_ram_write(portapack, rect); + portapack_lcd_start_ram_write(rect); const size_t count = bitmap.size.width * bitmap.size.height; for(size_t i=0; i> 3] & (1U << (i & 0x7)); - portapack_lcd_write_pixel(portapack, pixel ? foreground : background); + portapack_lcd_write_pixel(pixel ? foreground : background); } } @@ -716,7 +773,7 @@ static ui_bitmap_t portapack_font_glyph( return bitmap; } -static void portapack_lcd_draw_int(portapack_t* const portapack, const ui_point_t point, uint64_t value, size_t field_width) { +static void portapack_lcd_draw_int(const ui_point_t point, uint64_t value, size_t field_width) { ui_point_t point_next = { .x = point.x + font_fixed_8x16.glyph_size.width * field_width, .y = point.y @@ -731,21 +788,21 @@ static void portapack_lcd_draw_int(portapack_t* const portapack, const ui_point_ const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); point_next.x -= glyph.size.width; - portapack_draw_bitmap(portapack, point_next, glyph, color_foreground, color_background); + portapack_draw_bitmap(point_next, glyph, color_foreground, color_background); } while(point_next.x > point.x) { const char c = ' '; const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); point_next.x -= glyph.size.width; - portapack_draw_bitmap(portapack, point_next, glyph, color_foreground, color_background); + portapack_draw_bitmap(point_next, glyph, color_foreground, color_background); } } -static void portapack_lcd_clear(portapack_t* const portapack) { +static void portapack_lcd_clear() { const ui_rect_t rect_screen = { { 0, 0 }, { 240, 320 } }; const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); - portapack_lcd_fill_rectangle(portapack, rect_screen, color_background); + portapack_lcd_fill_rectangle(rect_screen, color_background); } typedef struct draw_list_t { @@ -786,7 +843,6 @@ typedef enum { static const uint8_t VALUES_X = 72; static void portapack_draw_radio_path( - portapack_t* const portapack, const draw_list_t* const draw_list, const size_t count ) { @@ -794,30 +850,25 @@ static void portapack_draw_radio_path( const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); for( size_t i=0; igpio_pp_tms); + + if( jtag_pp_idcode() == 0x020A50DD ) { + return &portapack_ui; + } else { + return NULL; + } } -void hackrf_ui_setBBVGAGain(const uint32_t gain_db) { - ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].point.y + 4 }; - portapack_lcd_draw_int(&portapack, point, gain_db, 2); +static const hackrf_ui_t* ui = NULL; + +void hackrf_ui_init(void) { + ui = portapack_detect(); + if( ui != NULL ) { + ui->init(); + } +} + +void hackrf_ui_setFrequency(uint64_t frequency) { + if( ui != NULL ) ui->set_frequency(frequency); } void hackrf_ui_setSampleRate(uint32_t sample_rate) { - ui_point_t point = { VALUES_X, 320 - 1 * 16 }; - portapack_lcd_draw_int(&portapack, point, sample_rate, 8); + if( ui != NULL ) ui->set_sample_rate(sample_rate); +} + +void hackrf_ui_setDirection(const rf_path_direction_t direction) { + if( ui != NULL ) ui->set_direction(direction); +} + +void hackrf_ui_setFilterBW(uint32_t bw) { + if( ui != NULL ) ui->set_filter_bw(bw); +} + +void hackrf_ui_setLNAPower(bool lna_on) { + if( ui != NULL ) ui->set_lna_power(lna_on); +} + +void hackrf_ui_setBBLNAGain(const uint32_t gain_db) { + if( ui != NULL ) ui->set_bb_lna_gain(gain_db); +} + +void hackrf_ui_setBBVGAGain(const uint32_t gain_db) { + if( ui != NULL ) ui->set_bb_vga_gain(gain_db); +} + +void hackrf_ui_setBBTXVGAGain(const uint32_t gain_db) { + if( ui != NULL ) ui->set_bb_tx_vga_gain(gain_db); +} + +void hackrf_ui_setFirstIFFrequency(const uint64_t frequency) { + if( ui != NULL ) ui->set_first_if_frequency(frequency); +} + +void hackrf_ui_setFilter(const rf_path_filter_t filter) { + if( ui != NULL ) ui->set_filter(filter); +} + +void hackrf_ui_setAntennaBias(bool antenna_bias) { + if( ui != NULL ) ui->set_antenna_bias(antenna_bias); } #endif diff --git a/firmware/common/ui_portapack.h b/firmware/common/ui_portapack.h index d4ddda18..dffcdf47 100644 --- a/firmware/common/ui_portapack.h +++ b/firmware/common/ui_portapack.h @@ -56,4 +56,32 @@ typedef struct ui_font_t { size_t data_stride; } ui_font_t; +typedef void (*hackrf_ui_init_fn)(void); +typedef void (*hackrf_ui_set_frequency_fn)(uint64_t frequency); +typedef void (*hackrf_ui_set_sample_rate_fn)(uint32_t sample_rate); +typedef void (*hackrf_ui_set_direction_fn)(const rf_path_direction_t direction); +typedef void (*hackrf_ui_set_filter_bw_fn)(uint32_t bandwidth); +typedef void (*hackrf_ui_set_lna_power_fn)(bool lna_on); +typedef void (*hackrf_ui_set_bb_lna_gain_fn)(const uint32_t gain_db); +typedef void (*hackrf_ui_set_bb_vga_gain_fn)(const uint32_t gain_db); +typedef void (*hackrf_ui_set_bb_tx_vga_gain_fn)(const uint32_t gain_db); +typedef void (*hackrf_ui_set_first_if_frequency_fn)(const uint64_t frequency); +typedef void (*hackrf_ui_set_filter_fn)(const rf_path_filter_t filter); +typedef void (*hackrf_ui_set_antenna_bias_fn)(bool antenna_bias); + +typedef struct { + hackrf_ui_init_fn init; + hackrf_ui_set_frequency_fn set_frequency; + hackrf_ui_set_sample_rate_fn set_sample_rate; + hackrf_ui_set_direction_fn set_direction; + hackrf_ui_set_filter_bw_fn set_filter_bw; + hackrf_ui_set_lna_power_fn set_lna_power; + hackrf_ui_set_bb_lna_gain_fn set_bb_lna_gain; + hackrf_ui_set_bb_vga_gain_fn set_bb_vga_gain; + hackrf_ui_set_bb_tx_vga_gain_fn set_bb_tx_vga_gain; + hackrf_ui_set_first_if_frequency_fn set_first_if_frequency; + hackrf_ui_set_filter_fn set_filter; + hackrf_ui_set_antenna_bias_fn set_antenna_bias; +} hackrf_ui_t; + #endif/*__UI_PORTAPACK_H__*/ From 2e6153a653f0ad0b2e4832d4bb3ec478e34d9869 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 27 Dec 2018 21:11:35 -0800 Subject: [PATCH 09/36] I2C: Device probe function I wrote, didn't need, but thought might be useful in the future. --- firmware/common/i2c_lpc.c | 11 +++++++++++ firmware/common/i2c_lpc.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/firmware/common/i2c_lpc.c b/firmware/common/i2c_lpc.c index 607a1a0a..04f3788e 100644 --- a/firmware/common/i2c_lpc.c +++ b/firmware/common/i2c_lpc.c @@ -66,3 +66,14 @@ void i2c_lpc_transfer(i2c_bus_t* const bus, i2c_stop(port); } + +bool i2c_probe(i2c_bus_t* const bus, const uint_fast8_t device_address) { + const uint32_t port = (uint32_t)bus->obj; + + i2c_tx_start(port); + i2c_tx_byte(port, (device_address << 1) | I2C_WRITE); + const bool detected = (I2C_STAT(port) == 0x18); + i2c_stop(port); + + return detected; +} diff --git a/firmware/common/i2c_lpc.h b/firmware/common/i2c_lpc.h index 32c79fcd..41a2dd6a 100644 --- a/firmware/common/i2c_lpc.h +++ b/firmware/common/i2c_lpc.h @@ -24,6 +24,7 @@ #include #include +#include #include "i2c_bus.h" @@ -38,5 +39,6 @@ void i2c_lpc_transfer(i2c_bus_t* const bus, const uint8_t* const data_tx, const size_t count_tx, uint8_t* const data_rx, const size_t count_rx ); +bool i2c_probe(i2c_bus_t* const bus, const uint_fast8_t device_address); #endif/*__I2C_LPC_H__*/ From 961ad732faba677ad35ea3ea40e8e2c1903573cf Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 28 Dec 2018 17:07:30 -0800 Subject: [PATCH 10/36] CMake: Create DFU path variable. --- firmware/hackrf-common.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index 2782bda5..d1c74f16 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -31,6 +31,7 @@ SET(PATH_HACKRF ../..) SET(PATH_HACKRF_FIRMWARE ${PATH_HACKRF}/firmware) SET(PATH_HACKRF_FIRMWARE_COMMON ${PATH_HACKRF_FIRMWARE}/common) SET(LIBOPENCM3 ${PATH_HACKRF_FIRMWARE}/libopencm3) +SET(PATH_DFU_PY ${PATH_HACKRF_FIRMWARE}/dfu.py) include(${PATH_HACKRF_FIRMWARE}/dfu-util.cmake) @@ -228,7 +229,7 @@ macro(DeclareTargets) COMMAND rm -f _tmp.dfu _header.bin COMMAND cp ${PROJECT_NAME}_dfu.bin _tmp.dfu COMMAND dfu-suffix --vid=0x1fc9 --pid=0x000c --did=0x0 -a _tmp.dfu - COMMAND python ../../dfu.py ${PROJECT_NAME} + COMMAND python ${PATH_DFU_PY} ${PROJECT_NAME} COMMAND cat _header.bin _tmp.dfu >${PROJECT_NAME}.dfu COMMAND rm -f _tmp.dfu _header.bin ) From bb2fe4259c9f6dd1271d9b39c441ac0be2d76594 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 28 Dec 2018 17:07:51 -0800 Subject: [PATCH 11/36] CMake: Base paths off location of hackrf-common.cmake. --- firmware/hackrf-common.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index d1c74f16..82310efc 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -27,8 +27,8 @@ enable_language(C CXX ASM) -SET(PATH_HACKRF ../..) -SET(PATH_HACKRF_FIRMWARE ${PATH_HACKRF}/firmware) +SET(PATH_HACKRF_FIRMWARE ${CMAKE_CURRENT_LIST_DIR}) +SET(PATH_HACKRF ${PATH_HACKRF_FIRMWARE}/..) SET(PATH_HACKRF_FIRMWARE_COMMON ${PATH_HACKRF_FIRMWARE}/common) SET(LIBOPENCM3 ${PATH_HACKRF_FIRMWARE}/libopencm3) SET(PATH_DFU_PY ${PATH_HACKRF_FIRMWARE}/dfu.py) From 1d26b59b2d3179fc3ecea4e930c37efbdff392fe Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 30 Dec 2018 13:42:01 -0800 Subject: [PATCH 12/36] CMake: incorporate libopencm3 into build process. --- firmware/README | 3 --- firmware/hackrf-common.cmake | 13 +++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/firmware/README b/firmware/README index 380b79bd..0e47a391 100644 --- a/firmware/README +++ b/firmware/README @@ -18,9 +18,6 @@ submodule: $ cd .. $ git submodule init $ git submodule update -$ cd firmware/libopencm3 -$ make - To build and install a standard firmware image for HackRF One: diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index 82310efc..9c3d48d6 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -106,6 +106,15 @@ set(BUILD_SHARED_LIBS OFF) include_directories("${LIBOPENCM3}/include/") include_directories("${PATH_HACKRF_FIRMWARE_COMMON}") +include(ExternalProject) +ExternalProject_Add(libopencm3 + SOURCE_DIR "${LIBOPENCM3}" + BUILD_IN_SOURCE true + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" +) + macro(DeclareTargets) SET(SRC_M4 ${SRC_M4} @@ -181,7 +190,7 @@ macro(DeclareTargets) # Object files to be linked for SPI flash versions add_library(${PROJECT_NAME}_objects OBJECT ${SRC_M4} m0_bin.s) set_target_properties(${PROJECT_NAME}_objects PROPERTIES COMPILE_FLAGS "${CFLAGS_M4}") - add_dependencies(${PROJECT_NAME}_objects ${PROJECT_NAME}_m0.bin) + add_dependencies(${PROJECT_NAME}_objects ${PROJECT_NAME}_m0.bin libopencm3) add_executable(${PROJECT_NAME}.elf $) target_link_libraries( @@ -204,7 +213,7 @@ macro(DeclareTargets) # Object files to be linked for DFU flash versions add_library(${PROJECT_NAME}_dfu_objects OBJECT ${SRC_M4} m0_bin.s) set_target_properties(${PROJECT_NAME}_dfu_objects PROPERTIES COMPILE_FLAGS "${CFLAGS_M4_DFU}") - add_dependencies(${PROJECT_NAME}_dfu_objects ${PROJECT_NAME}_m0.bin) + add_dependencies(${PROJECT_NAME}_dfu_objects ${PROJECT_NAME}_m0.bin libopencm3) add_executable(${PROJECT_NAME}_dfu.elf $) target_link_libraries( From cd24e01d7514c5a5f8fbad96c010e5ddeb491750 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 30 Dec 2018 14:11:11 -0800 Subject: [PATCH 13/36] CMake: Put libopencm3 dependencies in the right place. --- firmware/hackrf-common.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index 9c3d48d6..402e9c6c 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -170,6 +170,7 @@ macro(DeclareTargets) ) add_executable(${PROJECT_NAME}_m0.elf ${SRC_M0}) + add_dependencies(${PROJECT_NAME}_m0.elf libopencm3) target_link_libraries( ${PROJECT_NAME}_m0.elf @@ -190,8 +191,9 @@ macro(DeclareTargets) # Object files to be linked for SPI flash versions add_library(${PROJECT_NAME}_objects OBJECT ${SRC_M4} m0_bin.s) set_target_properties(${PROJECT_NAME}_objects PROPERTIES COMPILE_FLAGS "${CFLAGS_M4}") - add_dependencies(${PROJECT_NAME}_objects ${PROJECT_NAME}_m0.bin libopencm3) + add_dependencies(${PROJECT_NAME}_objects ${PROJECT_NAME}_m0.bin) add_executable(${PROJECT_NAME}.elf $) + add_dependencies(${PROJECT_NAME}.elf libopencm3) target_link_libraries( ${PROJECT_NAME}.elf @@ -213,8 +215,9 @@ macro(DeclareTargets) # Object files to be linked for DFU flash versions add_library(${PROJECT_NAME}_dfu_objects OBJECT ${SRC_M4} m0_bin.s) set_target_properties(${PROJECT_NAME}_dfu_objects PROPERTIES COMPILE_FLAGS "${CFLAGS_M4_DFU}") - add_dependencies(${PROJECT_NAME}_dfu_objects ${PROJECT_NAME}_m0.bin libopencm3) + add_dependencies(${PROJECT_NAME}_dfu_objects ${PROJECT_NAME}_m0.bin) add_executable(${PROJECT_NAME}_dfu.elf $) + add_dependencies(${PROJECT_NAME}_dfu.elf libopencm3) target_link_libraries( ${PROJECT_NAME}_dfu.elf From f60b2479fb10d7957ec7d54b2fc2d705f9828901 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 10:12:28 -0800 Subject: [PATCH 14/36] JTAG: Restore CPLD pin config functions, leave pins in pull-only state when not actively operating. --- firmware/common/cpld_jtag.c | 71 ++++++++++++++++++++++++++++++++++ firmware/common/cpld_jtag.h | 4 ++ firmware/common/hackrf_core.c | 41 +------------------- firmware/common/ui_portapack.c | 10 +++-- 4 files changed, 84 insertions(+), 42 deletions(-) diff --git a/firmware/common/cpld_jtag.c b/firmware/common/cpld_jtag.c index 0948858c..478626c3 100644 --- a/firmware/common/cpld_jtag.c +++ b/firmware/common/cpld_jtag.c @@ -29,6 +29,75 @@ static refill_buffer_cb refill_buffer; static uint32_t xsvf_buffer_len, xsvf_pos; static unsigned char* xsvf_buffer; +void cpld_jtag_init(jtag_t* const jtag) { + /* Initialize pin GPIOs in "released" state. */ + cpld_jtag_release(jtag); + + /* TDI and TMS pull-ups are required in all JTAG-compliant devices. + * + * The HackRF CPLD is always present, so let the CPLD pull up its TDI and TMS. + * + * The PortaPack may not be present, so pull up the PortaPack TMS pin from the + * microcontroller. + * + * TCK is recommended to be held low, so use microcontroller pull-down. + * + * TDO is undriven except when in Shift-IR or Shift-DR phases. + * Use the microcontroller to pull down to keep from floating. + * + * LPC43xx pull-up and pull-down resistors are approximately 53K. + */ +#ifdef USER_INTERFACE_PORTAPACK + scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0); + scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); +#endif + 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_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION4); + scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); +} + +void cpld_jtag_take(jtag_t* const jtag) { + const jtag_gpio_t* const gpio = jtag->gpio; + +#ifdef USER_INTERFACE_PORTAPACK + /* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */ + gpio_input(gpio->gpio_pp_tms); + gpio_input(gpio->gpio_pp_tdo); +#endif + gpio_output(gpio->gpio_tms); + gpio_output(gpio->gpio_tdi); + gpio_output(gpio->gpio_tck); + gpio_input(gpio->gpio_tdo); +} + +void cpld_jtag_release(jtag_t* const jtag) { + const jtag_gpio_t* const gpio = jtag->gpio; + + /* Make all pins inputs when JTAG interface not active. + * Let the pull-ups/downs do the work. + */ +#ifdef USER_INTERFACE_PORTAPACK + /* Do not drive PortaPack-specific pins, initially, just to be cautious. */ + gpio_input(gpio->gpio_pp_tms); + gpio_input(gpio->gpio_pp_tdo); +#endif + gpio_input(gpio->gpio_tms); + gpio_input(gpio->gpio_tdi); + gpio_input(gpio->gpio_tck); + gpio_input(gpio->gpio_tdo); + + /* Set initial GPIO state to the voltages of the internal or external pull-ups/downs, + * to avoid any glitches. + */ +#ifdef USER_INTERFACE_PORTAPACK + gpio_set(gpio->gpio_pp_tms); +#endif + gpio_set(gpio->gpio_tms); + gpio_set(gpio->gpio_tdi); + gpio_clear(gpio->gpio_tck); +} + /* return 0 if success else return error code see xsvfExecute() */ int cpld_jtag_program( jtag_t* const jtag, @@ -37,10 +106,12 @@ int cpld_jtag_program( refill_buffer_cb refill ) { int error; + cpld_jtag_take(jtag); xsvf_buffer = buffer; xsvf_buffer_len = buffer_length; refill_buffer = refill; error = xsvfExecute(jtag->gpio); + cpld_jtag_release(jtag); return error; } diff --git a/firmware/common/cpld_jtag.h b/firmware/common/cpld_jtag.h index 04292d22..012b0516 100644 --- a/firmware/common/cpld_jtag.h +++ b/firmware/common/cpld_jtag.h @@ -43,6 +43,10 @@ typedef struct jtag_t { typedef void (*refill_buffer_cb)(void); +void cpld_jtag_init(jtag_t* const jtag); +void cpld_jtag_take(jtag_t* const jtag); +void cpld_jtag_release(jtag_t* const jtag); + /* Return 0 if success else return error code see xsvfExecute() see micro.h. * * We expect the buffer to be initially full of data. After the entire diff --git a/firmware/common/hackrf_core.c b/firmware/common/hackrf_core.c index 74becd01..d363b2ac 100644 --- a/firmware/common/hackrf_core.c +++ b/firmware/common/hackrf_core.c @@ -33,6 +33,7 @@ #include "w25q80bv_target.h" #include "i2c_bus.h" #include "i2c_lpc.h" +#include "cpld_jtag.h" #include #include #include @@ -758,49 +759,11 @@ void ssp1_set_mode_max5864(void) spi_bus_start(max5864.bus, &ssp_config_max5864); } -static void jtag_setup(void) { - /* TDI and TMS pull-ups are required in all JTAG-compliant devices. - * Therefore, do not pull up TDI and TMS on HackRF CPLD, which is always present. - * HackRF TMS and TDI are dedicated, just drive instead of pulling up/down. - * TCK is recommended to be held low. - * TDO is undriven except when in Shift-IR or Shift-DR phases, so pull down to keep from floating. - * Nail down other signals before causing any transitions on TCK, to prevent undesired - * state changes. - */ - /* LPC43xx pull-up and pull-down resistors are approximately 53K. */ -#ifdef USER_INTERFACE_PORTAPACK - gpio_set(jtag_gpio_cpld.gpio_pp_tms); -#endif - gpio_set(jtag_gpio_cpld.gpio_tms); - gpio_set(jtag_gpio_cpld.gpio_tdi); - gpio_clear(jtag_gpio_cpld.gpio_tck); - -#ifdef USER_INTERFACE_PORTAPACK - /* Do not drive PortaPack-specific pins, initially, just to be cautious. */ - gpio_input(jtag_gpio_cpld.gpio_pp_tms); - gpio_input(jtag_gpio_cpld.gpio_pp_tdo); -#endif - gpio_output(jtag_gpio_cpld.gpio_tms); - gpio_output(jtag_gpio_cpld.gpio_tdi); - gpio_output(jtag_gpio_cpld.gpio_tck); - gpio_input(jtag_gpio_cpld.gpio_tdo); - - /* Configure CPLD JTAG pins */ -#ifdef USER_INTERFACE_PORTAPACK - scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0); - scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); -#endif - 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_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION4); - scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); -} - void pin_setup(void) { /* Configure all GPIO as Input (safe state) */ gpio_init(); - jtag_setup(); + cpld_jtag_init(&jtag_cpld); /* Configure SCU Pin Mux as GPIO */ scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_NOPULL); diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index f5162a40..abee326b 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -503,6 +503,11 @@ static uint32_t jtag_pp_shift(const uint32_t tms_bits, const size_t count) { } static uint32_t jtag_pp_idcode() { + cpld_jtag_take(&jtag_cpld); + + /* TODO: Check if PortaPack TMS is floating or driven by an external device. */ + gpio_output(jtag_cpld.gpio->gpio_pp_tms); + /* Test-Logic/Reset -> Run-Test/Idle -> Select-DR/Scan -> Capture-DR */ jtag_pp_shift(0b11111010, 8); @@ -512,6 +517,8 @@ static uint32_t jtag_pp_idcode() { /* Exit1-DR -> Update-DR -> Run-Test/Idle -> ... -> Test-Logic/Reset */ jtag_pp_shift(0b11011111, 8); + cpld_jtag_release(&jtag_cpld); + return idcode; } @@ -998,9 +1005,6 @@ static const hackrf_ui_t portapack_ui = { }; const hackrf_ui_t* portapack_detect(void) { - /* TODO: Check if PortaPack TMS is floating or driven by an external device. */ - gpio_output(jtag_cpld.gpio->gpio_pp_tms); - if( jtag_pp_idcode() == 0x020A50DD ) { return &portapack_ui; } else { From 494f203f8db5d4b449095ffe4d4db9caadf87490 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 10:36:17 -0800 Subject: [PATCH 15/36] PortaPack: Clean up tuning frequency rendering, add spaces per 3-digit group for readability. --- firmware/common/ui_portapack.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index abee326b..3c060ab5 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -876,35 +876,31 @@ static void portapack_ui_init() { } static void portapack_ui_set_frequency(uint64_t frequency) { - ui_point_t point = { 240 - 24, 16 }; + ui_point_t point = { 240 - 20, 16 }; const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); uint64_t value = frequency; - for(int i=0; i<6; i++) { + for(int i=0; i<10; i++) { const char c = '0' + value % 10; - value /= 10; - const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_16x14, c); + const ui_font_t* const font = (i > 5) ? &font_fixed_24x19 : &font_fixed_16x14; + const ui_bitmap_t glyph = portapack_font_glyph(font, c); point.x -= glyph.size.width; - portapack_draw_bitmap(point, glyph, color_foreground, color_background); - } + if( (i==3) || (i==6) || (i==9) ) { + point.x -= 4; + } - for(int i=0; i<4; i++) { - if( (i>0) && (value == 0) ) { - const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_24x19, '0'); - point.x -= glyph.size.width; + if( (i>=6) && (value == 0) ) { + /* Blank out leading zeros. */ const ui_rect_t rect = { point, glyph.size }; portapack_lcd_fill_rectangle(rect, color_background); } else { - const char c = '0' + value % 10; - value /= 10; - - const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_24x19, c); - point.x -= glyph.size.width; portapack_draw_bitmap(point, glyph, color_foreground, color_background); } + + value /= 10; } } From de3f5a0e9fb427688a5deb43e8efd8c107e2679d Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 10:47:18 -0800 Subject: [PATCH 16/36] PortaPack: Add string draw fn, +dB draw fn. --- firmware/common/ui_portapack.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 3c060ab5..30580ea2 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -780,11 +780,12 @@ static ui_bitmap_t portapack_font_glyph( return bitmap; } -static void portapack_lcd_draw_int(const ui_point_t point, uint64_t value, size_t field_width) { - ui_point_t point_next = { +static ui_point_t portapack_lcd_draw_int(const ui_point_t point, uint64_t value, size_t field_width) { + const ui_point_t point_done = { .x = point.x + font_fixed_8x16.glyph_size.width * field_width, .y = point.y }; + ui_point_t point_next = point_done; const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); @@ -804,6 +805,22 @@ static void portapack_lcd_draw_int(const ui_point_t point, uint64_t value, size_ point_next.x -= glyph.size.width; portapack_draw_bitmap(point_next, glyph, color_foreground, color_background); } + + return point_done; +} + +static ui_point_t portapack_lcd_draw_string(ui_point_t point, const char* s) { + const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); + const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); + + while(*s) { + const char c = *(s++); + const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); + portapack_draw_bitmap(point, glyph, color_foreground, color_background); + point.x += glyph.size.width; + } + + return point; } static void portapack_lcd_clear() { @@ -887,6 +904,7 @@ static void portapack_ui_set_frequency(uint64_t frequency) { const ui_font_t* const font = (i > 5) ? &font_fixed_24x19 : &font_fixed_16x14; const ui_bitmap_t glyph = portapack_font_glyph(font, c); + point.x -= glyph.size.width; if( (i==3) || (i==6) || (i==9) ) { point.x -= 4; @@ -945,14 +963,20 @@ static void portapack_ui_set_lna_power(bool lna_on) { portapack_radio_path_redraw(); } +static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { + point = portapack_lcd_draw_string(point, "+"); + point = portapack_lcd_draw_int(point, db, 2); + return portapack_lcd_draw_string(point, "dB"); +} + static void portapack_ui_set_bb_lna_gain(const uint32_t gain_db) { ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].point.y + 4 }; - portapack_lcd_draw_int(point, gain_db, 2); + portapack_ui_draw_db(point, gain_db); } static void portapack_ui_set_bb_vga_gain(const uint32_t gain_db) { ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].point.y + 4 }; - portapack_lcd_draw_int(point, gain_db, 2); + portapack_ui_draw_db(point, gain_db); } static void portapack_ui_set_bb_tx_vga_gain(const uint32_t gain_db) { From 53b125006169ba874f5245d1767ee48e05193bba Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 10:59:40 -0800 Subject: [PATCH 17/36] PortaPack: Fix integer rendering so a 0 value doesn't show up as an empty string. --- firmware/common/ui_portapack.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 30580ea2..6e76e978 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -790,8 +790,8 @@ static ui_point_t portapack_lcd_draw_int(const ui_point_t point, uint64_t value, const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); - while(value) { - const char c = '0' + value % 10; + for(size_t i=0; i point.x) { - const char c = ' '; - const ui_bitmap_t glyph = portapack_font_glyph(&font_fixed_8x16, c); - point_next.x -= glyph.size.width; - portapack_draw_bitmap(point_next, glyph, color_foreground, color_background); - } - return point_done; } From c09f76a92c93c0e0206f415846fe163716e2b4e9 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:07:39 -0800 Subject: [PATCH 18/36] PortaPack: Consolidate color palette. --- firmware/common/ui_portapack.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 6e76e978..460bd76e 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -262,6 +262,9 @@ static ui_color_t portapack_color_rgb( return result; } +static const ui_color_t color_background = { 0x001f }; +static const ui_color_t color_foreground = { 0xffff }; + #define ARRAY_SIZEOF(x) (sizeof(x) / sizeof(x[0])) static void portapack_sleep_milliseconds(const uint32_t milliseconds) { @@ -787,9 +790,6 @@ static ui_point_t portapack_lcd_draw_int(const ui_point_t point, uint64_t value, }; ui_point_t point_next = point_done; - const ui_color_t color_background = portapack_color_rgb(0x00, 0x00, 0xff); - const ui_color_t color_foreground = portapack_color_rgb(0xff, 0xff, 0xff); - for(size_t i=0; i Date: Mon, 31 Dec 2018 14:21:08 -0800 Subject: [PATCH 19/36] PortaPack: Don't draw sample rate. It looks ugly, needs fixing. --- firmware/common/ui_portapack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 460bd76e..367fcf7f 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -906,8 +906,10 @@ static void portapack_ui_set_frequency(uint64_t frequency) { } static void portapack_ui_set_sample_rate(uint32_t sample_rate) { +#if 0 ui_point_t point = { VALUES_X, 320 - 1 * 16 }; portapack_lcd_draw_int(point, sample_rate, 8); +#endif } static void portapack_ui_set_direction(const rf_path_direction_t direction) { From 9cce90b02e965ce7e61619ec38e20220758c5433 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:21:47 -0800 Subject: [PATCH 20/36] PortaPack: Define draw-dB function earier so it can be used for LNA. --- firmware/common/ui_portapack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 367fcf7f..618893cd 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -855,6 +855,12 @@ typedef enum { static const uint8_t VALUES_X = 72; +static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { + point = portapack_lcd_draw_string(point, "+"); + point = portapack_lcd_draw_int(point, db, 2); + return portapack_lcd_draw_string(point, "dB"); +} + static void portapack_draw_radio_path( const draw_list_t* const draw_list, const size_t count @@ -948,12 +954,6 @@ static void portapack_ui_set_lna_power(bool lna_on) { portapack_radio_path_redraw(); } -static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { - point = portapack_lcd_draw_string(point, "+"); - point = portapack_lcd_draw_int(point, db, 2); - return portapack_lcd_draw_string(point, "dB"); -} - static void portapack_ui_set_bb_lna_gain(const uint32_t gain_db) { ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].point.y + 4 }; portapack_ui_draw_db(point, gain_db); From fd65f35872276c767e65e306e2b93be309fe1227 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:22:22 -0800 Subject: [PATCH 21/36] PortaPack: Draw gain value for LNA. --- firmware/common/ui_portapack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 618893cd..349ac299 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -951,6 +951,9 @@ static void portapack_ui_set_lna_power(bool lna_on) { radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = lna_on ? ((portapack_direction == RF_PATH_DIRECTION_TX) ? &bitmap_amp_tx : &bitmap_amp_rx) : &bitmap_wire_24; + const char* const label = lna_on ? "+14dB" : " "; + ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].point.y + 4 }; + portapack_lcd_draw_string(point, label); portapack_radio_path_redraw(); } From bb059ddfa78492cf03ec5b1004b71f7eb60ae6ee Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:22:49 -0800 Subject: [PATCH 22/36] PortaPack: Store LNA state for use when radio path direction changes. --- firmware/common/ui_portapack.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 349ac299..9b36ac5b 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -871,6 +871,7 @@ static void portapack_draw_radio_path( } static rf_path_direction_t portapack_direction = RF_PATH_DIRECTION_OFF; +static bool portapack_lna_on = false; static void portapack_radio_path_redraw() { portapack_draw_radio_path(radio_draw_list, ARRAY_SIZEOF(radio_draw_list)); @@ -921,13 +922,13 @@ static void portapack_ui_set_sample_rate(uint32_t sample_rate) { static void portapack_ui_set_direction(const rf_path_direction_t direction) { switch(direction) { case RF_PATH_DIRECTION_TX: - radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = &bitmap_amp_tx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = portapack_lna_on ? &bitmap_amp_tx : &bitmap_wire_24; radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].bitmap = &bitmap_amp_tx; radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].bitmap = &bitmap_wire_24; break; case RF_PATH_DIRECTION_RX: - radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = &bitmap_amp_rx; + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = portapack_lna_on ? &bitmap_amp_rx : &bitmap_wire_24; radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].bitmap = &bitmap_amp_rx; radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_VGA_AMP].bitmap = &bitmap_amp_rx; break; @@ -948,6 +949,7 @@ static void portapack_ui_set_filter_bw(uint32_t bandwidth) { } static void portapack_ui_set_lna_power(bool lna_on) { + portapack_lna_on = lna_on; radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = lna_on ? ((portapack_direction == RF_PATH_DIRECTION_TX) ? &bitmap_amp_tx : &bitmap_amp_rx) : &bitmap_wire_24; From d0681933e6f168f273b6db0359337e6a963b4063 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:47:42 -0800 Subject: [PATCH 23/36] PortaPack: Update TX gain label. Turns out the HackRF code refers to MAX2837 TX VGA gain, which is mis-labeled as a baseband setting. It's actually in the IF portion of the TX path. --- firmware/common/ui_portapack.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 9b36ac5b..3f536f73 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -970,6 +970,12 @@ static void portapack_ui_set_bb_vga_gain(const uint32_t gain_db) { } static void portapack_ui_set_bb_tx_vga_gain(const uint32_t gain_db) { + /* TODO: This function (and code throughout the HackRF project) is mis-labeled? + * According to the MAX2837 datasheet diagram, there is no baseband gain in the TX path. + * This gets called when the TX IF gain is changed. + */ + ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_LNA_AMP].point.y + 4 }; + portapack_ui_draw_db(point, gain_db); } static void portapack_ui_set_first_if_frequency(const uint64_t frequency) { From a2902d7d3a58fe368335f7694b8e210a7f58a409 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 31 Dec 2018 14:58:10 -0800 Subject: [PATCH 24/36] PortaPack: Hide first-IF mixer icon when bypassed. --- firmware/common/ui_portapack.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 3f536f73..ff15438d 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -982,23 +982,22 @@ static void portapack_ui_set_first_if_frequency(const uint64_t frequency) { } static void portapack_ui_set_filter(const rf_path_filter_t filter) { - const ui_bitmap_t* bitmap = &bitmap_wire_24; + radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_MIXER].bitmap = (filter == RF_PATH_FILTER_BYPASS) ? &bitmap_wire_24 : &bitmap_mixer; switch(filter) { - case RF_PATH_FILTER_BYPASS: - bitmap = &bitmap_wire_24; + default: + radio_draw_list[RADIO_DRAW_LIST_ITEM_IMAGE_FILTER].bitmap = &bitmap_wire_24; break; case RF_PATH_FILTER_LOW_PASS: - bitmap = &bitmap_filter_lp; + radio_draw_list[RADIO_DRAW_LIST_ITEM_IMAGE_FILTER].bitmap = &bitmap_filter_lp; break; case RF_PATH_FILTER_HIGH_PASS: - bitmap = &bitmap_filter_hp; + radio_draw_list[RADIO_DRAW_LIST_ITEM_IMAGE_FILTER].bitmap = &bitmap_filter_hp; break; } - radio_draw_list[RADIO_DRAW_LIST_ITEM_IMAGE_FILTER].bitmap = bitmap; portapack_radio_path_redraw(); } From c477317408301ad12b866e9191aed03a1dffb3e7 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 2 Jan 2019 09:35:15 -0800 Subject: [PATCH 25/36] PortaPack: Improve baseband filter frequency label readability. --- firmware/common/ui_portapack.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index ff15438d..9412c196 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -861,6 +861,22 @@ static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { return portapack_lcd_draw_string(point, "dB"); } +static ui_point_t portapack_ui_draw_bw_mhz(ui_point_t point, const uint64_t hz) { + const uint32_t frac_digits = 2; + const uint32_t lsd = 1000000 / 100; + const uint32_t round_offset = lsd / 2; + + const uint64_t hz_offset = hz + round_offset; + const uint32_t mhz = hz_offset / 1000000; + const uint32_t hz_remainder = hz_offset - (mhz * 1000000); + const uint32_t frac = hz_offset / lsd; + + point = portapack_lcd_draw_int(point, mhz, 2); + point = portapack_lcd_draw_string(point, "."); + point = portapack_lcd_draw_int(point, frac, 2); + return portapack_lcd_draw_string(point, " MHz"); +} + static void portapack_draw_radio_path( const draw_list_t* const draw_list, const size_t count @@ -945,7 +961,7 @@ static void portapack_ui_set_direction(const rf_path_direction_t direction) { static void portapack_ui_set_filter_bw(uint32_t bandwidth) { ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_BB_FILTER].point.y + 4 }; - portapack_lcd_draw_int(point, bandwidth, 8); + portapack_ui_draw_bw_mhz(point, bandwidth); } static void portapack_ui_set_lna_power(bool lna_on) { From 46ba0512d407fa449b33db4f75196b4b14f49c1e Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 2 Jan 2019 09:37:43 -0800 Subject: [PATCH 26/36] PortaPack: Remove noisy, extraneous "+" for amplifier gain labels, add space before "dB". --- firmware/common/ui_portapack.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 9412c196..34a3e155 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -856,9 +856,8 @@ typedef enum { static const uint8_t VALUES_X = 72; static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { - point = portapack_lcd_draw_string(point, "+"); point = portapack_lcd_draw_int(point, db, 2); - return portapack_lcd_draw_string(point, "dB"); + return portapack_lcd_draw_string(point, " dB"); } static ui_point_t portapack_ui_draw_bw_mhz(ui_point_t point, const uint64_t hz) { @@ -969,7 +968,7 @@ static void portapack_ui_set_lna_power(bool lna_on) { radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].bitmap = lna_on ? ((portapack_direction == RF_PATH_DIRECTION_TX) ? &bitmap_amp_tx : &bitmap_amp_rx) : &bitmap_wire_24; - const char* const label = lna_on ? "+14dB" : " "; + const char* const label = lna_on ? "14 dB" : " "; ui_point_t point = { VALUES_X, radio_draw_list[RADIO_DRAW_LIST_ITEM_RF_AMP].point.y + 4 }; portapack_lcd_draw_string(point, label); portapack_radio_path_redraw(); From c7d761089fe61478e57f4e62cee26e2bb33270ac Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 7 Jan 2019 15:29:18 -0800 Subject: [PATCH 27/36] USB: Make vendor request handler table read/write (not const). --- firmware/hackrf_usb/hackrf_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 43d70142..ca83abfc 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -48,7 +48,7 @@ #include "hackrf-ui.h" -static const usb_request_handler_fn vendor_request_handler[] = { +static usb_request_handler_fn vendor_request_handler[] = { NULL, usb_vendor_request_set_transceiver_mode, usb_vendor_request_write_max2837, From 0666dc961de9c82f912ad0e483986d98d45cd477 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 7 Jan 2019 15:29:51 -0800 Subject: [PATCH 28/36] USB: Bring in constants from host source code. TODO: Deduplicate this when I'm not feeling so lazy. --- firmware/hackrf_usb/hackrf_usb.c | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index ca83abfc..efc74f6b 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -48,6 +48,50 @@ #include "hackrf-ui.h" +// TODO: Duplicate code/knowledge, copied from /host/libhackrf/src/hackrf.c +// TODO: Factor this into a shared #include so that firmware can use +// the same values. +typedef enum { + HACKRF_VENDOR_REQUEST_SET_TRANSCEIVER_MODE = 1, + HACKRF_VENDOR_REQUEST_MAX2837_WRITE = 2, + HACKRF_VENDOR_REQUEST_MAX2837_READ = 3, + HACKRF_VENDOR_REQUEST_SI5351C_WRITE = 4, + HACKRF_VENDOR_REQUEST_SI5351C_READ = 5, + HACKRF_VENDOR_REQUEST_SAMPLE_RATE_SET = 6, + HACKRF_VENDOR_REQUEST_BASEBAND_FILTER_BANDWIDTH_SET = 7, + HACKRF_VENDOR_REQUEST_RFFC5071_WRITE = 8, + HACKRF_VENDOR_REQUEST_RFFC5071_READ = 9, + HACKRF_VENDOR_REQUEST_SPIFLASH_ERASE = 10, + HACKRF_VENDOR_REQUEST_SPIFLASH_WRITE = 11, + HACKRF_VENDOR_REQUEST_SPIFLASH_READ = 12, + _HACKRF_VENDOR_REQUEST_WRITE_CPLD = 13, + HACKRF_VENDOR_REQUEST_BOARD_ID_READ = 14, + HACKRF_VENDOR_REQUEST_VERSION_STRING_READ = 15, + HACKRF_VENDOR_REQUEST_SET_FREQ = 16, + HACKRF_VENDOR_REQUEST_AMP_ENABLE = 17, + HACKRF_VENDOR_REQUEST_BOARD_PARTID_SERIALNO_READ = 18, + HACKRF_VENDOR_REQUEST_SET_LNA_GAIN = 19, + HACKRF_VENDOR_REQUEST_SET_VGA_GAIN = 20, + HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21, + _HACKRF_VENDOR_REQUEST_SET_IF_FREQ = 22, + HACKRF_VENDOR_REQUEST_ANTENNA_ENABLE = 23, + HACKRF_VENDOR_REQUEST_SET_FREQ_EXPLICIT = 24, + HACKRF_VENDOR_REQUEST_USB_WCID_VENDOR_REQ = 25, + HACKRF_VENDOR_REQUEST_INIT_SWEEP = 26, + HACKRF_VENDOR_REQUEST_OPERACAKE_GET_BOARDS = 27, + HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS = 28, + HACKRF_VENDOR_REQUEST_SET_HW_SYNC_MODE = 29, + HACKRF_VENDOR_REQUEST_RESET = 30, + HACKRF_VENDOR_REQUEST_OPERACAKE_SET_RANGES = 31, + HACKRF_VENDOR_REQUEST_CLKOUT_ENABLE = 32, + HACKRF_VENDOR_REQUEST_SPIFLASH_STATUS = 33, + HACKRF_VENDOR_REQUEST_SPIFLASH_CLEAR_STATUS = 34, + HACKRF_VENDOR_REQUEST_OPERACAKE_GPIO_TEST = 35, + + /* Update to be the next integer after the highest-numbered request. */ + _HACKRF_VENDOR_REQUEST_ARRAY_SIZE +} hackrf_vendor_request; + static usb_request_handler_fn vendor_request_handler[] = { NULL, usb_vendor_request_set_transceiver_mode, From 5e88bb8565084a27ac433c63215678595d48c0b9 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 7 Jan 2019 15:30:32 -0800 Subject: [PATCH 29/36] USB: Set Opera Cake USB handlers to null unless hardware is detected. --- firmware/hackrf_usb/hackrf_usb.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index efc74f6b..7574f4a6 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -129,33 +129,27 @@ static usb_request_handler_fn vendor_request_handler[] = { usb_vendor_request_set_freq_explicit, usb_vendor_request_read_wcid, // USB_WCID_VENDOR_REQ usb_vendor_request_init_sweep, -#ifdef USER_INTERFACE_PORTAPACK NULL, NULL, -#else - usb_vendor_request_operacake_get_boards, - usb_vendor_request_operacake_set_ports, -#endif usb_vendor_request_set_hw_sync_mode, usb_vendor_request_reset, -#ifdef USER_INTERFACE_PORTAPACK NULL, -#else - usb_vendor_request_operacake_set_ranges, -#endif usb_vendor_request_set_clkout_enable, usb_vendor_request_spiflash_status, usb_vendor_request_spiflash_clear_status, -#ifdef USER_INTERFACE_PORTAPACK NULL -#else - usb_vendor_request_operacake_gpio_test -#endif }; static const uint32_t vendor_request_handler_count = sizeof(vendor_request_handler) / sizeof(vendor_request_handler[0]); +static void operacake_usb_handlers_init(void) { + vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GET_BOARDS] = usb_vendor_request_operacake_get_boards; + vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS ] = usb_vendor_request_operacake_set_ports; + vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_RANGES] = usb_vendor_request_operacake_set_ranges; + vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GPIO_TEST ] = usb_vendor_request_operacake_gpio_test; +} + usb_request_status_t usb_vendor_request( usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage @@ -257,6 +251,7 @@ int main(void) { rf_path_init(&rf_path); #ifndef USER_INTERFACE_PORTAPACK + operacake_usb_handlers_init(); operacake_init(); #endif From e05677ab0d3eca81de52cb4ad7495af68a44f9cd Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 7 Jan 2019 15:35:41 -0800 Subject: [PATCH 30/36] OperaCake: Bring together with PortaPack code. The plan is to have them coexist in the firmware binary, even if the hardware is mutually exclusive at runtime. --- firmware/common/hackrf_core.h | 12 ------------ firmware/hackrf_usb/CMakeLists.txt | 8 +------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/firmware/common/hackrf_core.h b/firmware/common/hackrf_core.h index ddfbbf60..b30cfdff 100644 --- a/firmware/common/hackrf_core.h +++ b/firmware/common/hackrf_core.h @@ -214,7 +214,6 @@ extern "C" #define SCU_RX_LNA (P6_7) /* GPIO5[15] on P6_7 */ #endif -#ifdef USER_INTERFACE_PORTAPACK #define SCU_PINMUX_PP_D0 (P7_0) /* GPIO3[8] */ #define SCU_PINMUX_PP_D1 (P7_1) /* GPIO3[9] */ #define SCU_PINMUX_PP_D2 (P7_2) /* GPIO3[10] */ @@ -223,7 +222,6 @@ extern "C" #define SCU_PINMUX_PP_D5 (P7_5) /* GPIO3[13] */ #define SCU_PINMUX_PP_D6 (P7_6) /* GPIO3[14] */ #define SCU_PINMUX_PP_D7 (P7_7) /* GPIO3[15] */ -#else /* TODO add other Pins */ #define SCU_PINMUX_GPIO3_8 (P7_0) /* GPIO3[8] */ #define SCU_PINMUX_GPIO3_9 (P7_1) /* GPIO3[9] */ @@ -233,32 +231,22 @@ extern "C" #define SCU_PINMUX_GPIO3_13 (P7_5) /* GPIO3[13] */ #define SCU_PINMUX_GPIO3_14 (P7_6) /* GPIO3[14] */ #define SCU_PINMUX_GPIO3_15 (P7_7) /* GPIO3[15] */ -#endif -#ifdef USER_INTERFACE_PORTAPACK #define SCU_PINMUX_PP_TDO (P1_5) /* GPIO1[8] */ -#else #define SCU_PINMUX_SD_POW (P1_5) /* GPIO1[8] */ -#endif #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] */ -#endif #define SCU_PINMUX_SD_DAT0 (P1_9) /* GPIO1[2] */ #define SCU_PINMUX_SD_DAT1 (P1_10) /* GPIO1[3] */ #define SCU_PINMUX_SD_DAT2 (P1_11) /* GPIO1[4] */ #define SCU_PINMUX_SD_DAT3 (P1_12) /* GPIO1[5] */ #define SCU_PINMUX_SD_CD (P1_13) /* GPIO1[6] */ -#ifdef USER_INTERFACE_PORTAPACK #define SCU_PINMUX_PP_IO_STBX (P2_0) /* GPIO5[0] */ #define SCU_PINMUX_PP_ADDR (P2_1) /* GPIO5[1] */ -#else #define SCU_PINMUX_U0_TXD (P2_0) /* GPIO5[0] */ #define SCU_PINMUX_U0_RXD (P2_1) /* GPIO5[1] */ -#endif #define SCU_PINMUX_ISP (P2_7) /* GPIO0[7] */ diff --git a/firmware/hackrf_usb/CMakeLists.txt b/firmware/hackrf_usb/CMakeLists.txt index d950535d..9af27a13 100644 --- a/firmware/hackrf_usb/CMakeLists.txt +++ b/firmware/hackrf_usb/CMakeLists.txt @@ -51,13 +51,7 @@ set(SRC_M4 "${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/micro.c" "${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/ports.c" "${PATH_HACKRF_FIRMWARE_COMMON}/rom_iap.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/operacake.c" ) -if(NOT USER_INTERFACE STREQUAL "PORTAPACK") - SET(SRC_M4 - ${SRC_M4} - "${PATH_HACKRF_FIRMWARE_COMMON}/operacake.c" - ) -endif() - DeclareTargets() From 8721fe606a86e1e836778533f7b41b495f31fbca Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 9 Jan 2019 15:07:08 -0800 Subject: [PATCH 31/36] Host: Add USB request ordinal for WCID --- host/libhackrf/src/hackrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index 322bb448..56e9318d 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -73,7 +73,7 @@ typedef enum { HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21, HACKRF_VENDOR_REQUEST_ANTENNA_ENABLE = 23, HACKRF_VENDOR_REQUEST_SET_FREQ_EXPLICIT = 24, - // USB_WCID_VENDOR_REQ = 25 + HACKRF_VENDOR_REQUEST_USB_WCID_VENDOR_REQ = 25, HACKRF_VENDOR_REQUEST_INIT_SWEEP = 26, HACKRF_VENDOR_REQUEST_OPERACAKE_GET_BOARDS = 27, HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS = 28, From e87b3f4feaccd7810cde8ab74c8e6fdb042da8b1 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 9 Jan 2019 15:30:24 -0800 Subject: [PATCH 32/36] PortaPack: Address some unused variable/function warnings. --- firmware/common/ui_portapack.c | 6 ++++-- firmware/hackrf_usb/hackrf_usb.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index 34a3e155..f24f5ae4 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -861,13 +861,11 @@ static ui_point_t portapack_ui_draw_db(ui_point_t point, const uint32_t db) { } static ui_point_t portapack_ui_draw_bw_mhz(ui_point_t point, const uint64_t hz) { - const uint32_t frac_digits = 2; const uint32_t lsd = 1000000 / 100; const uint32_t round_offset = lsd / 2; const uint64_t hz_offset = hz + round_offset; const uint32_t mhz = hz_offset / 1000000; - const uint32_t hz_remainder = hz_offset - (mhz * 1000000); const uint32_t frac = hz_offset / lsd; point = portapack_lcd_draw_int(point, mhz, 2); @@ -931,6 +929,8 @@ static void portapack_ui_set_sample_rate(uint32_t sample_rate) { #if 0 ui_point_t point = { VALUES_X, 320 - 1 * 16 }; portapack_lcd_draw_int(point, sample_rate, 8); +#else + (void)sample_rate; #endif } @@ -994,6 +994,7 @@ static void portapack_ui_set_bb_tx_vga_gain(const uint32_t gain_db) { } static void portapack_ui_set_first_if_frequency(const uint64_t frequency) { + (void)frequency; } static void portapack_ui_set_filter(const rf_path_filter_t filter) { @@ -1017,6 +1018,7 @@ static void portapack_ui_set_filter(const rf_path_filter_t filter) { } static void portapack_ui_set_antenna_bias(bool antenna_bias) { + (void)antenna_bias; } static const hackrf_ui_t portapack_ui = { diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 7574f4a6..47885032 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -143,12 +143,14 @@ static usb_request_handler_fn vendor_request_handler[] = { static const uint32_t vendor_request_handler_count = sizeof(vendor_request_handler) / sizeof(vendor_request_handler[0]); +#ifndef USER_INTERFACE_PORTAPACK static void operacake_usb_handlers_init(void) { vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GET_BOARDS] = usb_vendor_request_operacake_get_boards; vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS ] = usb_vendor_request_operacake_set_ports; vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_RANGES] = usb_vendor_request_operacake_set_ranges; vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GPIO_TEST ] = usb_vendor_request_operacake_gpio_test; } +#endif usb_request_status_t usb_vendor_request( usb_endpoint_t* const endpoint, From 07f370bfbadd34453117af288a67ae18b63abdac Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 9 Jan 2019 15:48:59 -0800 Subject: [PATCH 33/36] PortaPack: Silence warnings about unused functions/variables I'm liable to use soon. I don't like the __attribute__((unused)) markup, but woud rather not delete or comment out the code. --- firmware/common/ui_portapack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/common/ui_portapack.c b/firmware/common/ui_portapack.c index f24f5ae4..b68a2e07 100644 --- a/firmware/common/ui_portapack.c +++ b/firmware/common/ui_portapack.c @@ -247,11 +247,11 @@ static const uint8_t bitmap_waves_data[] = { 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x30, 0x06, 0x30, 0x06, 0x30, 0x06, 0x60, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x60, 0x0c, 0x30, 0x06, 0x30, 0x06, 0x30, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03 }; -static const ui_bitmap_t bitmap_waves = { +__attribute__((unused)) static const ui_bitmap_t bitmap_waves = { { 16, 20 }, bitmap_waves_data }; -static ui_color_t portapack_color_rgb( +__attribute__((unused)) static ui_color_t portapack_color_rgb( const uint_fast8_t r, const uint_fast8_t g, const uint_fast8_t b @@ -274,8 +274,8 @@ static void portapack_sleep_milliseconds(const uint32_t milliseconds) { static struct gpio_t gpio_io_stbx = GPIO(5, 0); /* P2_0 */ static struct gpio_t gpio_addr = GPIO(5, 1); /* P2_1 */ -static struct gpio_t gpio_lcd_te = GPIO(5, 3); /* P2_3 */ -static struct gpio_t gpio_unused = GPIO(5, 7); /* P2_8 */ +__attribute__((unused)) static struct gpio_t gpio_lcd_te = GPIO(5, 3); /* P2_3 */ +__attribute__((unused)) static struct gpio_t gpio_unused = GPIO(5, 7); /* P2_8 */ static struct gpio_t gpio_lcd_rdx = GPIO(5, 4); /* P2_4 */ static struct gpio_t gpio_lcd_wrx = GPIO(1, 10); /* P2_9 */ static struct gpio_t gpio_dir = GPIO(1, 13); /* P2_13 */ @@ -334,7 +334,7 @@ static void portapack_dir_write() { */ } -static void portapack_lcd_rd_assert() { +__attribute__((unused)) static void portapack_lcd_rd_assert() { gpio_clear(portapack.gpio_lcd_rdx); } From 909066cdf8383f12aad8b1b508bd47e269c0038c Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 14 Jan 2019 20:42:39 -0800 Subject: [PATCH 34/36] PortaPack: Replace OperaCake handlers, they were tripping up host tools. Skip operacake_init if PortaPack compiled in, letting operacake_boards be all zero. Should be safe, right? --- firmware/hackrf_usb/hackrf_usb.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 47885032..75601f42 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -129,29 +129,20 @@ static usb_request_handler_fn vendor_request_handler[] = { usb_vendor_request_set_freq_explicit, usb_vendor_request_read_wcid, // USB_WCID_VENDOR_REQ usb_vendor_request_init_sweep, - NULL, - NULL, + usb_vendor_request_operacake_get_boards, + usb_vendor_request_operacake_set_ports, usb_vendor_request_set_hw_sync_mode, usb_vendor_request_reset, - NULL, + usb_vendor_request_operacake_set_ranges, usb_vendor_request_set_clkout_enable, usb_vendor_request_spiflash_status, usb_vendor_request_spiflash_clear_status, - NULL + usb_vendor_request_operacake_gpio_test }; static const uint32_t vendor_request_handler_count = sizeof(vendor_request_handler) / sizeof(vendor_request_handler[0]); -#ifndef USER_INTERFACE_PORTAPACK -static void operacake_usb_handlers_init(void) { - vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GET_BOARDS] = usb_vendor_request_operacake_get_boards; - vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_PORTS ] = usb_vendor_request_operacake_set_ports; - vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_SET_RANGES] = usb_vendor_request_operacake_set_ranges; - vendor_request_handler[HACKRF_VENDOR_REQUEST_OPERACAKE_GPIO_TEST ] = usb_vendor_request_operacake_gpio_test; -} -#endif - usb_request_status_t usb_vendor_request( usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage @@ -253,7 +244,6 @@ int main(void) { rf_path_init(&rf_path); #ifndef USER_INTERFACE_PORTAPACK - operacake_usb_handlers_init(); operacake_init(); #endif From 97806e8159988f15a6849d11729de547b6f15246 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 15 Jan 2019 11:31:39 -0800 Subject: [PATCH 35/36] PortaPack: Build DFU binary without forcing serial number to "RunningFromRAM". This was causing problems for HackRF mode, where some host PC software was depending on a valid serial number. --- firmware/hackrf-common.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake index 402e9c6c..add10b23 100644 --- a/firmware/hackrf-common.cmake +++ b/firmware/hackrf-common.cmake @@ -98,7 +98,11 @@ SET(CPUFLAGS_M4 "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16") SET(CFLAGS_M4 "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") SET(CXXFLAGS_M4 "-std=gnu++0x ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") SET(LDFLAGS_M4 "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4} -Xlinker -Map=m4.map") -SET(CFLAGS_M4_DFU "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4 -DDFU_MODE") + +SET(CFLAGS_M4_DFU "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") +if(NOT USER_INTERFACE STREQUAL "PORTAPACK") + SET(CFLAGS_M4_DFU "${CFLAGS_M4_DFU} -DDFU_MODE") +endif() SET(LDFLAGS_M4_DFU "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4_DFU} -Xlinker -Map=m4.map") set(BUILD_SHARED_LIBS OFF) From 3932c5694eb481c76f96b5b634bd3f8d61f512f5 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 15 Jan 2019 15:31:53 -0800 Subject: [PATCH 36/36] PortaPack: Add .SVF of current JEDEC bitstream file. PortaPack build consumes this file to embed the bitstream into the firmware. --- firmware/cpld/sgpio_if/default.svf | 2079 ++++++++++++++++++++++++++++ 1 file changed, 2079 insertions(+) create mode 100644 firmware/cpld/sgpio_if/default.svf diff --git a/firmware/cpld/sgpio_if/default.svf b/firmware/cpld/sgpio_if/default.svf new file mode 100644 index 00000000..202d985c --- /dev/null +++ b/firmware/cpld/sgpio_if/default.svf @@ -0,0 +1,2079 @@ +// Created using Xilinx Cse Software [ISE - 14.7] +// Date: Tue Jan 15 14:51:59 2019 + +TRST OFF; +ENDIR IDLE; +ENDDR IDLE; +STATE RESET; +STATE IDLE; +FREQUENCY 1E6 HZ; +//Operation: Erase -p 0 +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) SMASK (ff) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +//Boundary Scan Chain Contents +//Position 1: xc2c64a +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) TDO (f6e5f093) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +// Loading devices with 'enable' or 'bypass' instruction. +SIR 8 TDI (e8) ; +// Loading devices with 'erase' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ed) SMASK (ff) ; +ENDIR IDLE; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRPAUSE; +RUNTEST DRPAUSE 20 TCK; +STATE IDLE; +RUNTEST IDLE 100000 TCK; +STATE DRPAUSE; +RUNTEST DRPAUSE 5000 TCK; +RUNTEST IDLE 1 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +SIR 8 TDI (ff) ; +SDR 1 TDI (00) SMASK (01) ; +//Operation: Program -p 0 -e -v +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +//Boundary Scan Chain Contents +//Position 1: xc2c64a +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) TDO (f6e5f093) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +// Loading devices with 'enable' or 'bypass' instruction. +SIR 8 TDI (e8) ; +// Loading devices with 'erase' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ed) SMASK (ff) ; +ENDIR IDLE; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRPAUSE; +RUNTEST DRPAUSE 20 TCK; +STATE IDLE; +RUNTEST IDLE 100000 TCK; +STATE DRPAUSE; +RUNTEST DRPAUSE 5000 TCK; +RUNTEST IDLE 1 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +// Loading devices with 'enable' or 'bypass' instruction. +SIR 8 TDI (e8) ; +// Programming. +// Loading devices with 'program' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ea) ; +SDR 281 TDI (0003c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) SMASK (01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +ENDIR IDLE; +RUNTEST 10000 TCK; +SDR 281 TDI (0103f9ffffffffffffffffffffffffffffffff777efbffffffffffffffffff777777767f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0180f9dfffffffffffffffffffffffffffe9de7fffffffffffffffffffffffff3ffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0083c1fffffffffffffffffffffffffffffddf7fffffffffffffffffffffffffff3ffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00c3f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffff3fffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01c0f8fffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0143c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0043f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0060f9dffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0163c1fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffffff3fe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01e3f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffffffffff3e7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00e0f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00a3c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01a3f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0120f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffff3fffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0023c1fffffffffffffffffffffffffffff5ff7fffffffffffffffffffffffbbbbbbba4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0033f9fffffffffffffffffffffffffffffd7f7ffffffffffffffffffffffffffffff27c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0130f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01b3c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00b3f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00f0f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01f3c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffebffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0173f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0070f9ffffffffffffffffffffffffffffffe587fffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0053c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5fffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0153f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bfe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01d0f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4b83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00d3c15ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0093f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffff3fffffe7d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0190f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0113c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0013f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0018f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (011bc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (019bf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0098f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00dbc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01dbf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0158f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (005bc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (007bf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0178f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01fbc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00fbf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00b8f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01bbc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (013b99fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (003af9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (002bc8bffffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0128d9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01ab01332ef7ffffffffffffffffffffffebfefffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00abc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00eae1fffffffffffffffff7fffffffffffbeefffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01e8f932dbfffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (016bc9fffffffffff7fffffffffffffffff96e7ffffff7ffffffffffffffffffffeffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0068e1f5fffffffffffffffffffffffffffdf67efbfffffffffffffffffffffffffbfe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (004bc5ffffffffffffffffffdffffffffffbeefffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (014bc1ffffffff7ffffffffffffffffffffbeefffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01cbf9ffffffffffffffffffffffffdffffbeefffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00c8f9ffffffffffffffffffffffffff7ffbbefffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (008bc9ffff2ffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0188e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (010bc5ff5ffffffffffffffffffffffffffffefebffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (000bc1fffffffffffffffffffffffffffdfbbefffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (000ff9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (010cf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (018fc9ffeedffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (008ce1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00cfc0aabffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01cfc1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (014ee1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (004cf9fffeaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (006fc9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (016ce1fffffffffffffffffffffffffffffff9fffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01efc5fff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00efc9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00ace1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01afc5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (012fc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (002ee1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (003cf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (013fc1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01bee1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00bcf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00ffc1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff67) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01fff9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09) ; +RUNTEST 10000 TCK; +SDR 281 TDI (017cf9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (007fc9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (005ce0abfffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe7d) ; +RUNTEST 10000 TCK; +SDR 281 TDI (015fc5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) ; +RUNTEST 10000 TCK; +SDR 281 TDI (01dfc9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (00dce1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (009fc5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (019fc9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (011ce1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) ; +RUNTEST 10000 TCK; +SDR 281 TDI (001fc5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 10000 TCK; +SDR 281 TDI (0117ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 10000 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +// Loading devices with 'init' or 'bypass' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +// Loading devices with 'conld' or 'bypass' instruction. +SIR 8 TDI (c0) ; +RUNTEST 100 TCK; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +// Verification. +// Loading device with a 'verify' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ee) ; +ENDDR DRPAUSE; +SDR 7 TDI (00) SMASK (7f) ; +ENDIR IDLE; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (40) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffffffffff777efbffffffffffffffffff777777767f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (60) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9dfffffffffffffffffffffffffffe9de7fffffffffffffffffffffffff3ffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (20) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffddf7fffffffffffffffffffffffffff3ffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (30) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffff3fffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (70) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f8fffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (50) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (10) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (18) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9dffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (58) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffffff3fe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (78) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffffffffff3e7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (38) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (28) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (68) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (48) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffff3fffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (08) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffff5ff7fffffffffffffffffffffffbbbbbbba4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffd7f7ffffffffffffffffffffffffffffff27c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffebffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bffffe1d) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffe587fffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe001ff801ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (14) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5fffe4f) MASK ( +03fffffffffffffffffffffffffffffe001f8001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (54) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bfe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (74) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4b83) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (34) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c15ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (24) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffff3fffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (64) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (44) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (04) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (06) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (46) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (66) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (26) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (36) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (76) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (56) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (16) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (0399fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c8bffffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00d9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (0301332ef7ffffffffffffffffffffffebfefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffff7fffffffffffbeefffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f932dbfffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffff7fffffffffffffffff96e7ffffff7ffffffffffffffffffffeffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1f5fffffffffffffffffffffffffffdf67efbfffffffffffffffffffffffffbfe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (12) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5ffffffffffffffffffdffffffffffbeefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (52) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffffffff7ffffffffffffffffffffbeefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (72) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffdffffbeefffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (32) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffff7ffbbefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (22) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffff2ffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (62) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (42) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5ff5ffffffffffffffffffffffffffffefebffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (02) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffdfbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (03) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (43) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (63) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffeedffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (23) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (33) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c0aabffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (73) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (53) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (13) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffeaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffff9fffffffffffffffffffffffffffffffe7f) MASK ( +03fffffffffffffffffffffffffffffe00078001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff67) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (17) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e0abfffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (57) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (77) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (37) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (27) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (67) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (47) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (07) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (05) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) MASK ( +0000000000000000000000000000000000000000000000000000000000000000000000) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (45) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +// masking lower UES bits. +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) MASK ( +0000000000000000000000000000000000000000000000000000000000000000000000) ; +RUNTEST 100 TCK; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +//Loading device with 'conld' instruction. +SIR 8 TDI (c0) ; +RUNTEST IDLE 100 TCK; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +// Setting Done bit ... +// Loading device with a 'program' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ea) ; +SDR 281 TDI (0017fdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +ENDIR IDLE; +RUNTEST 10000 TCK; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +//Loading device with 'conld' instruction. +SIR 8 TDI (c0) ; +RUNTEST IDLE 100 TCK; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ; +//Check for Done bit. +SIR 8 TDI (ff) TDO (05) MASK (07) ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +SIR 8 TDI (ff) ; +SDR 1 TDI (00) SMASK (01) ; +//Operation: Verify -p 0 +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +//Boundary Scan Chain Contents +//Position 1: xc2c64a +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) TDO (f6e5f093) ; +//Check for Read/Write Protect. +SIR 8 TDI (ff) TDO (01) MASK (03) ; +//Loading device with 'bypass' instruction. +SIR 8 TDI (ff) ; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +//Loading device with 'enable' instruction. +SIR 8 TDI (e8) ; +// Verification. +// Loading device with a 'verify' instruction. +ENDIR IRPAUSE; +SIR 8 TDI (ee) ; +ENDDR DRPAUSE; +SDR 7 TDI (00) SMASK (7f) ; +ENDIR IDLE; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (40) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffffffffff777efbffffffffffffffffff777777767f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (60) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9dfffffffffffffffffffffffffffe9de7fffffffffffffffffffffffff3ffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (20) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffddf7fffffffffffffffffffffffffff3ffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (30) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffff3fffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (70) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f8fffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (50) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (10) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (18) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9dffffffffffffffffffffffffffff99e7fffffffffffffffffffffffbbbbbbba7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (58) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffffffff3fe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (78) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffffffffff3e7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (38) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (28) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (68) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (48) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffd7f7fffffffffffffffffffffff3fffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (08) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffff5ff7fffffffffffffffffffffffbbbbbbba4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffd7f7ffffffffffffffffffffffffffffff27c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffebffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bffffe1d) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1c) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffe587fffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe001ff801ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (14) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5fffe4f) MASK ( +03fffffffffffffffffffffffffffffe001f8001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (54) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4bfe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (74) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4b83) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (34) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c15ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (24) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffddf7ffffffffffffffffffffffff3fffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (64) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (44) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (04) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (06) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (46) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (66) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (26) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (36) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (76) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (56) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (16) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe4f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (0399fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0e) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c8bffffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00d9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (0301332ef7ffffffffffffffffffffffebfefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffff7fffffffffffbeefffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f932dbfffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffff7fffffffffffffffff96e7ffffff7ffffffffffffffffffffeffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1a) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1f5fffffffffffffffffffffffffffdf67efbfffffffffffffffffffffffffbfe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (12) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5ffffffffffffffffffdffffffffffbeefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (52) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffffffff7ffffffffffffffffffffbeefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (72) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9ffffffffffffffffffffffffdffffbeefffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (32) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9ffffffffffffffffffffffffff7ffbbefffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (22) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffff2ffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (62) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (42) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5ff5ffffffffffffffffffffffffffffefebffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (02) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffdfbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (03) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (43) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (63) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffeedffffffffffffffffffffffffbbefffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (23) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (33) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c0aabffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (73) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (53) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1ffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1d) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (13) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffeaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffff9fffffffffffffffffffffffffffffffe7f) MASK ( +03fffffffffffffffffffffffffffffe00078001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9ffe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03fffffffffffffffffffffffffffffe00000001ffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0b) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (0f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (4f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (6f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (02e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (2f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (3f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff67) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (7f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (5f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00f9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (1f) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (17) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e0abfffffffffffffffffffffffffffafefffffffffffffffffffffffffffffffe7d) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (57) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe83) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (77) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (37) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (27) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (67) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c9fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (47) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (00e1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (07) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03c5fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7c) MASK ( +03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (05) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) MASK ( +0000000000000000000000000000000000000000000000000000000000000000000000) ; +RUNTEST 100 TCK; +ENDDR DRPAUSE; +SDR 7 TDI (45) SMASK (7f) ; +RUNTEST DRPAUSE 20 TCK; +ENDDR IDLE; +RUNTEST IDLE 100 TCK; +// masking lower UES bits. +SDR 274 TDI (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) SMASK (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) TDO (03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) MASK ( +0000000000000000000000000000000000000000000000000000000000000000000000) ; +RUNTEST 100 TCK; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IDLE; +RUNTEST IDLE 20 TCK; +ENDIR IRPAUSE; +SIR 8 TDI (f0) SMASK (ff) ; +STATE IREXIT2 IRUPDATE DRSELECT DRCAPTURE DREXIT1 DRUPDATE IDLE; +RUNTEST 800 TCK; +ENDIR IDLE; +//Loading device with 'conld' instruction. +SIR 8 TDI (c0) ; +RUNTEST IDLE 100 TCK; +//Loading device with 'idcode' instruction. +SIR 8 TDI (01) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (f6e5f093) MASK (0fff8fff) ; +//Check for Done bit. +SIR 8 TDI (ff) TDO (05) MASK (07) ; +//Loading device with 'conld' instruction. +SIR 8 TDI (c0) ; +RUNTEST IDLE 100 TCK; +//Loading device with 'bypass' instruction. +SIR 8 TDI (ff) ; +TIR 0 ; +HIR 0 ; +HDR 0 ; +TDR 0 ; +TIR 0 ; +HIR 0 ; +TDR 0 ; +HDR 0 ; +SIR 8 TDI (ff) ; +SDR 1 TDI (00) SMASK (01) ;