OpenOCD
xds110.c File Reference
Include dependency graph for xds110.c:

Go to the source code of this file.

Data Structures

struct  scan_result
 
struct  xds110_info
 

Macros

#define CJTAG_CONNECT   0x2b /* Switch from JTAG to cJTAG connection */
 
#define CJTAG_DISCONNECT   0x2c /* Switch from cJTAG to JTAG connection */
 
#define CMAPI_ACQUIRE   0x11 /* CMAPI acquire */
 
#define CMAPI_CONNECT   0x0f /* CMAPI connect */
 
#define CMAPI_DISCONNECT   0x10 /* CMAPI disconnect */
 
#define CMAPI_REG_READ   0x15 /* CMAPI DAP register read */
 
#define CMAPI_REG_WRITE   0x16 /* CMAPI DAP register write */
 
#define CMAPI_RELEASE   0x12 /* CMAPI release */
 
#define CMD_DR_SCAN   2
 
#define CMD_IR_SCAN   1
 
#define CMD_RUNTEST   3
 
#define CMD_STABLECLOCKS   4
 
#define DAP_AP   0 /* DAP AP register type */
 
#define DAP_AP_BD0   0x10 /* DAP AP Banked Data 0 */
 
#define DAP_AP_BD1   0x14 /* DAP AP Banked Data 1 */
 
#define DAP_AP_BD2   0x18 /* DAP AP Banked Data 2 */
 
#define DAP_AP_BD3   0x1C /* DAP AP Banked Data 3 */
 
#define DAP_AP_CSW   0x00 /* DAP AP Control Status Word */
 
#define DAP_AP_DRW   0x0C /* DAP AP Data Read/Write */
 
#define DAP_AP_IDR   0xFC /* DAP AP Identification Register */
 
#define DAP_AP_RTBL   0xF8 /* DAP AP Debug ROM Table */
 
#define DAP_AP_TAR   0x04 /* DAP AP Transfer Address */
 
#define DAP_DP   1 /* DAP DP register type */
 
#define DAP_DP_ABORT   0x0 /* DAP DP ABORT register (write only) */
 
#define DAP_DP_ADDR   0x8 /* DAP DP SELECT register (legacy name) */
 
#define DAP_DP_CTRL   0x4 /* DAP DP CTRL register (for write only) */
 
#define DAP_DP_IDCODE   0x0 /* DAP DP IDCODE register (read only) */
 
#define DAP_DP_RDBUFF   0xc /* DAP DP RDBUFF Read Buffer register */
 
#define DAP_DP_RESEND   0x8 /* DAP DP RESEND register (read only) */
 
#define DAP_DP_SELECT   0x8 /* DAP DP SELECT register (write only) */
 
#define DAP_DP_STAT   0x4 /* DAP DP STAT register (for read only) */
 
#define DEFAULT_ATTEMPTS   (1)
 
#define DEFAULT_TIMEOUT   (4000)
 
#define FAST_TCK_DELAY_10000_KHZ   0xfffffffd
 
#define FAST_TCK_DELAY_12000_KHZ   0xfffffffe
 
#define FAST_TCK_DELAY_14000_KHZ   0
 
#define FAST_TCK_DELAY_5500_KHZ   2
 
#define FAST_TCK_DELAY_8500_KHZ   1
 
#define FAST_TCK_FIRMWARE_VERSION   0x03000000
 
#define FAST_TCK_PLUS_FIRMWARE_VERSION   0x03000003
 
#define MAX_DATA_BLOCK   4096
 
#define MAX_PACKET   1024
 
#define MAX_RESULT_QUEUE   (MAX_DATA_BLOCK / 4)
 
#define MODE_JTAG   1
 
#define OCD_DAP_REQUEST   0x3a /* Handle block of DAP requests */
 
#define OCD_FIRMWARE_UPGRADE    "XDS110: upgrade to version 2.3.0.11+ for improved support"
 
#define OCD_FIRMWARE_VERSION   0x02030011
 
#define OCD_PATHMOVE   0x3c /* Handle PATHMOVE to navigate JTAG states */
 
#define OCD_SCAN_REQUEST   0x3b /* Handle block of JTAG scan requests */
 
#define SC_ERR_NONE   0
 
#define SC_ERR_SWD_DEVICE_ID   -617
 
#define SC_ERR_SWD_FAULT   -614
 
#define SC_ERR_SWD_PARITY   -616
 
#define SC_ERR_SWD_PROTOCOL   -615
 
#define SC_ERR_SWD_WAIT   -613
 
#define SC_ERR_XDS110_FAIL   -261
 
#define SWD_CONNECT   0x17 /* Switch from JTAG to SWD connection */
 
#define SWD_DISCONNECT   0x18 /* Switch from SWD to JTAG connection */
 
#define USB_PAYLOAD_SIZE   (MAX_DATA_BLOCK + 60)
 
#define XDS110_DEFAULT_TCK_SPEED   2500 /* kHz */
 
#define XDS110_MAX_FAST_TCK_SPEED   14000 /* kHz */
 
#define XDS110_MAX_SLOW_TCK_SPEED   2500 /* kHz */
 
#define XDS110_MAX_VOLTAGE   3600
 
#define XDS110_MIN_TCK_SPEED   100 /* kHz */
 
#define XDS110_MIN_VOLTAGE   1800
 
#define XDS110_STAND_ALONE_ID   0x21
 
#define XDS_CONNECT   0x01 /* Connect JTAG connection */
 
#define XDS_CYCLE_TCK   0x07 /* Toggle TCK for a number of cycles */
 
#define XDS_DISCONNECT   0x02 /* Disconnect JTAG connection */
 
#define XDS_GOTO_STATE   0x09 /* Go to requested JTAG state */
 
#define XDS_IN_LEN   4 /* error code (int) */
 
#define XDS_JTAG_SCAN   0x0c /* Send and receive JTAG scan */
 
#define XDS_JTAG_STATE_CAPTURE_DR   16
 
#define XDS_JTAG_STATE_CAPTURE_IR   17
 
#define XDS_JTAG_STATE_EXIT1_DR   8
 
#define XDS_JTAG_STATE_EXIT1_IR   9
 
#define XDS_JTAG_STATE_EXIT2_DR   10
 
#define XDS_JTAG_STATE_EXIT2_IR   11
 
#define XDS_JTAG_STATE_IDLE   2
 
#define XDS_JTAG_STATE_PAUSE_DR   5
 
#define XDS_JTAG_STATE_PAUSE_IR   6
 
#define XDS_JTAG_STATE_RESET   1
 
#define XDS_JTAG_STATE_SELECT_DR   12
 
#define XDS_JTAG_STATE_SELECT_IR   13
 
#define XDS_JTAG_STATE_SHIFT_DR   3
 
#define XDS_JTAG_STATE_SHIFT_IR   4
 
#define XDS_JTAG_STATE_UPDATE_DR   14
 
#define XDS_JTAG_STATE_UPDATE_IR   15
 
#define XDS_JTAG_TRANSIT_QUICKEST   1
 
#define XDS_JTAG_TRANSIT_VIA_CAPTURE   2
 
#define XDS_JTAG_TRANSIT_VIA_IDLE   3
 
#define XDS_OUT_LEN   1 /* command (byte) */
 
#define XDS_SET_SRST   0x0e /* Assert or deassert nSRST signal */
 
#define XDS_SET_SUPPLY   0x32 /* Set up stand-alone probe upply voltage */
 
#define XDS_SET_TCK   0x04 /* Set TCK delay (to set TCK frequency) */
 
#define XDS_SET_TRST   0x05 /* Assert or deassert nTRST signal */
 
#define XDS_VERSION   0x03 /* Get firmware version and hardware ID */
 

Functions

static bool cjtag_connect (uint32_t format)
 
static bool cjtag_disconnect (void)
 
static bool cmapi_acquire (void)
 
static bool cmapi_connect (uint32_t *idcode)
 
static bool cmapi_disconnect (void)
 
static bool cmapi_read_dap_reg (uint32_t type, uint32_t ap_num, uint32_t address, uint32_t *value)
 
static bool cmapi_release (void)
 
static bool cmapi_write_dap_reg (uint32_t type, uint32_t ap_num, uint32_t address, uint32_t *value)
 
 COMMAND_HANDLER (xds110_handle_info_command)
 
 COMMAND_HANDLER (xds110_handle_supply_voltage_command)
 
static bool ocd_dap_request (uint8_t *dap_requests, uint32_t request_size, uint32_t *dap_results, uint32_t result_count)
 
static bool ocd_pathmove (uint32_t num_states, uint8_t *path)
 
static bool ocd_scan_request (uint8_t *scan_requests, uint32_t request_size, uint8_t *scan_results, uint32_t result_size)
 
static bool swd_connect (void)
 
static bool swd_disconnect (void)
 
static bool usb_connect (void)
 
static void usb_disconnect (void)
 
static bool usb_get_response (uint32_t *total_bytes_read, uint32_t timeout)
 
static bool usb_read (unsigned char *buffer, int size, int *bytes_read, int timeout)
 
static bool usb_send_command (uint16_t size)
 
static bool usb_write (unsigned char *buffer, int size, int *written)
 
static void xds110_execute_command (struct jtag_command *cmd)
 
static void xds110_execute_pathmove (struct jtag_command *cmd)
 
static int xds110_execute_queue (void)
 
static void xds110_execute_sleep (struct jtag_command *cmd)
 
static void xds110_execute_tlr_reset (struct jtag_command *cmd)
 
static void xds110_flush (void)
 
static uint16_t xds110_get_u16 (uint8_t *buffer)
 
static uint32_t xds110_get_u32 (uint8_t *buffer)
 
static int xds110_init (void)
 
static int xds110_khz (int khz, int *jtag_speed)
 
static bool xds110_legacy_read_reg (uint8_t cmd, uint32_t *value)
 
static void xds110_legacy_runtest (uint32_t clocks, uint32_t end_state)
 
static void xds110_legacy_scan (uint32_t shift_state, uint32_t total_bits, uint32_t end_state, uint8_t *data_out, uint8_t *data_in)
 
static void xds110_legacy_stableclocks (uint32_t clocks)
 
static bool xds110_legacy_write_reg (uint8_t cmd, uint32_t value)
 
static void xds110_queue_runtest (struct jtag_command *cmd)
 
static void xds110_queue_scan (struct jtag_command *cmd)
 
static void xds110_queue_stableclocks (struct jtag_command *cmd)
 
static int xds110_quit (void)
 
static int xds110_reset (int trst, int srst)
 
static void xds110_set_u16 (uint8_t *buffer, uint16_t value)
 
static void xds110_set_u32 (uint8_t *buffer, uint32_t value)
 
static void xds110_show_info (void)
 
static int xds110_speed (int speed)
 
static int xds110_speed_div (int speed, int *khz)
 
static int xds110_swd_init (void)
 
static void xds110_swd_queue_cmd (uint8_t cmd, uint32_t *value)
 
static void xds110_swd_read_reg (uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
 
static int xds110_swd_run_queue (void)
 
static int xds110_swd_switch_seq (enum swd_special_seq seq)
 
static void xds110_swd_write_reg (uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
 
static bool xds_connect (void)
 
static bool xds_cycle_tck (uint32_t count)
 
static bool xds_disconnect (void)
 
static bool xds_execute (uint32_t out_length, uint32_t in_length, uint32_t attempts, uint32_t timeout)
 
static bool xds_goto_state (uint32_t state)
 
static bool xds_jtag_scan (uint32_t shift_state, uint16_t shift_bits, uint32_t end_state, uint8_t *data_out, uint8_t *data_in)
 
static bool xds_set_srst (uint8_t srst)
 
static bool xds_set_supply (uint32_t voltage)
 
static bool xds_set_tck_delay (uint32_t delay)
 
static bool xds_set_trst (uint8_t trst)
 
static bool xds_version (uint32_t *firmware_id, uint16_t *hardware_id)
 

Variables

static struct xds110_info xds110
 
struct adapter_driver xds110_adapter_driver
 
static const struct command_registration xds110_command_handlers []
 
static struct jtag_interface xds110_interface
 
static const struct command_registration xds110_subcommand_handlers []
 
static const struct swd_driver xds110_swd_driver
 
static const char *const xds110_transport [] = { "swd", "jtag", NULL }
 
static const uint32_t xds_jtag_state []
 

Macro Definition Documentation

◆ CJTAG_CONNECT

#define CJTAG_CONNECT   0x2b /* Switch from JTAG to cJTAG connection */

Definition at line 163 of file xds110.c.

◆ CJTAG_DISCONNECT

#define CJTAG_DISCONNECT   0x2c /* Switch from cJTAG to JTAG connection */

Definition at line 164 of file xds110.c.

◆ CMAPI_ACQUIRE

#define CMAPI_ACQUIRE   0x11 /* CMAPI acquire */

Definition at line 157 of file xds110.c.

◆ CMAPI_CONNECT

#define CMAPI_CONNECT   0x0f /* CMAPI connect */

Definition at line 155 of file xds110.c.

◆ CMAPI_DISCONNECT

#define CMAPI_DISCONNECT   0x10 /* CMAPI disconnect */

Definition at line 156 of file xds110.c.

◆ CMAPI_REG_READ

#define CMAPI_REG_READ   0x15 /* CMAPI DAP register read */

Definition at line 159 of file xds110.c.

◆ CMAPI_REG_WRITE

#define CMAPI_REG_WRITE   0x16 /* CMAPI DAP register write */

Definition at line 160 of file xds110.c.

◆ CMAPI_RELEASE

#define CMAPI_RELEASE   0x12 /* CMAPI release */

Definition at line 158 of file xds110.c.

◆ CMD_DR_SCAN

#define CMD_DR_SCAN   2

Definition at line 171 of file xds110.c.

◆ CMD_IR_SCAN

#define CMD_IR_SCAN   1

Definition at line 170 of file xds110.c.

◆ CMD_RUNTEST

#define CMD_RUNTEST   3

Definition at line 172 of file xds110.c.

◆ CMD_STABLECLOCKS

#define CMD_STABLECLOCKS   4

Definition at line 173 of file xds110.c.

◆ DAP_AP

#define DAP_AP   0 /* DAP AP register type */

Definition at line 118 of file xds110.c.

◆ DAP_AP_BD0

#define DAP_AP_BD0   0x10 /* DAP AP Banked Data 0 */

Definition at line 133 of file xds110.c.

◆ DAP_AP_BD1

#define DAP_AP_BD1   0x14 /* DAP AP Banked Data 1 */

Definition at line 134 of file xds110.c.

◆ DAP_AP_BD2

#define DAP_AP_BD2   0x18 /* DAP AP Banked Data 2 */

Definition at line 135 of file xds110.c.

◆ DAP_AP_BD3

#define DAP_AP_BD3   0x1C /* DAP AP Banked Data 3 */

Definition at line 136 of file xds110.c.

◆ DAP_AP_CSW

#define DAP_AP_CSW   0x00 /* DAP AP Control Status Word */

Definition at line 130 of file xds110.c.

◆ DAP_AP_DRW

#define DAP_AP_DRW   0x0C /* DAP AP Data Read/Write */

Definition at line 132 of file xds110.c.

◆ DAP_AP_IDR

#define DAP_AP_IDR   0xFC /* DAP AP Identification Register */

Definition at line 138 of file xds110.c.

◆ DAP_AP_RTBL

#define DAP_AP_RTBL   0xF8 /* DAP AP Debug ROM Table */

Definition at line 137 of file xds110.c.

◆ DAP_AP_TAR

#define DAP_AP_TAR   0x04 /* DAP AP Transfer Address */

Definition at line 131 of file xds110.c.

◆ DAP_DP

#define DAP_DP   1 /* DAP DP register type */

Definition at line 119 of file xds110.c.

◆ DAP_DP_ABORT

#define DAP_DP_ABORT   0x0 /* DAP DP ABORT register (write only) */

Definition at line 122 of file xds110.c.

◆ DAP_DP_ADDR

#define DAP_DP_ADDR   0x8 /* DAP DP SELECT register (legacy name) */

Definition at line 125 of file xds110.c.

◆ DAP_DP_CTRL

#define DAP_DP_CTRL   0x4 /* DAP DP CTRL register (for write only) */

Definition at line 124 of file xds110.c.

◆ DAP_DP_IDCODE

#define DAP_DP_IDCODE   0x0 /* DAP DP IDCODE register (read only) */

Definition at line 121 of file xds110.c.

◆ DAP_DP_RDBUFF

#define DAP_DP_RDBUFF   0xc /* DAP DP RDBUFF Read Buffer register */

Definition at line 128 of file xds110.c.

◆ DAP_DP_RESEND

#define DAP_DP_RESEND   0x8 /* DAP DP RESEND register (read only) */

Definition at line 126 of file xds110.c.

◆ DAP_DP_SELECT

#define DAP_DP_SELECT   0x8 /* DAP DP SELECT register (write only) */

Definition at line 127 of file xds110.c.

◆ DAP_DP_STAT

#define DAP_DP_STAT   0x4 /* DAP DP STAT register (for read only) */

Definition at line 123 of file xds110.c.

◆ DEFAULT_ATTEMPTS

#define DEFAULT_ATTEMPTS   (1)

Definition at line 64 of file xds110.c.

◆ DEFAULT_TIMEOUT

#define DEFAULT_TIMEOUT   (4000)

Definition at line 65 of file xds110.c.

◆ FAST_TCK_DELAY_10000_KHZ

#define FAST_TCK_DELAY_10000_KHZ   0xfffffffd

Definition at line 84 of file xds110.c.

◆ FAST_TCK_DELAY_12000_KHZ

#define FAST_TCK_DELAY_12000_KHZ   0xfffffffe

Definition at line 85 of file xds110.c.

◆ FAST_TCK_DELAY_14000_KHZ

#define FAST_TCK_DELAY_14000_KHZ   0

Definition at line 83 of file xds110.c.

◆ FAST_TCK_DELAY_5500_KHZ

#define FAST_TCK_DELAY_5500_KHZ   2

Definition at line 87 of file xds110.c.

◆ FAST_TCK_DELAY_8500_KHZ

#define FAST_TCK_DELAY_8500_KHZ   1

Definition at line 86 of file xds110.c.

◆ FAST_TCK_FIRMWARE_VERSION

#define FAST_TCK_FIRMWARE_VERSION   0x03000000

Definition at line 32 of file xds110.c.

◆ FAST_TCK_PLUS_FIRMWARE_VERSION

#define FAST_TCK_PLUS_FIRMWARE_VERSION   0x03000003

Definition at line 35 of file xds110.c.

◆ MAX_DATA_BLOCK

#define MAX_DATA_BLOCK   4096

Definition at line 48 of file xds110.c.

◆ MAX_PACKET

#define MAX_PACKET   1024

Definition at line 42 of file xds110.c.

◆ MAX_RESULT_QUEUE

#define MAX_RESULT_QUEUE   (MAX_DATA_BLOCK / 4)

Definition at line 54 of file xds110.c.

◆ MODE_JTAG

#define MODE_JTAG   1

Definition at line 91 of file xds110.c.

◆ OCD_DAP_REQUEST

#define OCD_DAP_REQUEST   0x3a /* Handle block of DAP requests */

Definition at line 166 of file xds110.c.

◆ OCD_FIRMWARE_UPGRADE

#define OCD_FIRMWARE_UPGRADE    "XDS110: upgrade to version 2.3.0.11+ for improved support"

Definition at line 28 of file xds110.c.

◆ OCD_FIRMWARE_VERSION

#define OCD_FIRMWARE_VERSION   0x02030011

Definition at line 27 of file xds110.c.

◆ OCD_PATHMOVE

#define OCD_PATHMOVE   0x3c /* Handle PATHMOVE to navigate JTAG states */

Definition at line 168 of file xds110.c.

◆ OCD_SCAN_REQUEST

#define OCD_SCAN_REQUEST   0x3b /* Handle block of JTAG scan requests */

Definition at line 167 of file xds110.c.

◆ SC_ERR_NONE

#define SC_ERR_NONE   0

Definition at line 68 of file xds110.c.

◆ SC_ERR_SWD_DEVICE_ID

#define SC_ERR_SWD_DEVICE_ID   -617

Definition at line 74 of file xds110.c.

◆ SC_ERR_SWD_FAULT

#define SC_ERR_SWD_FAULT   -614

Definition at line 71 of file xds110.c.

◆ SC_ERR_SWD_PARITY

#define SC_ERR_SWD_PARITY   -616

Definition at line 73 of file xds110.c.

◆ SC_ERR_SWD_PROTOCOL

#define SC_ERR_SWD_PROTOCOL   -615

Definition at line 72 of file xds110.c.

◆ SC_ERR_SWD_WAIT

#define SC_ERR_SWD_WAIT   -613

Definition at line 70 of file xds110.c.

◆ SC_ERR_XDS110_FAIL

#define SC_ERR_XDS110_FAIL   -261

Definition at line 69 of file xds110.c.

◆ SWD_CONNECT

#define SWD_CONNECT   0x17 /* Switch from JTAG to SWD connection */

Definition at line 161 of file xds110.c.

◆ SWD_DISCONNECT

#define SWD_DISCONNECT   0x18 /* Switch from SWD to JTAG connection */

Definition at line 162 of file xds110.c.

◆ USB_PAYLOAD_SIZE

#define USB_PAYLOAD_SIZE   (MAX_DATA_BLOCK + 60)

Definition at line 52 of file xds110.c.

◆ XDS110_DEFAULT_TCK_SPEED

#define XDS110_DEFAULT_TCK_SPEED   2500 /* kHz */

Definition at line 80 of file xds110.c.

◆ XDS110_MAX_FAST_TCK_SPEED

#define XDS110_MAX_FAST_TCK_SPEED   14000 /* kHz */

Definition at line 79 of file xds110.c.

◆ XDS110_MAX_SLOW_TCK_SPEED

#define XDS110_MAX_SLOW_TCK_SPEED   2500 /* kHz */

Definition at line 78 of file xds110.c.

◆ XDS110_MAX_VOLTAGE

#define XDS110_MAX_VOLTAGE   3600

Definition at line 21 of file xds110.c.

◆ XDS110_MIN_TCK_SPEED

#define XDS110_MIN_TCK_SPEED   100 /* kHz */

Definition at line 77 of file xds110.c.

◆ XDS110_MIN_VOLTAGE

#define XDS110_MIN_VOLTAGE   1800

Definition at line 20 of file xds110.c.

◆ XDS110_STAND_ALONE_ID

#define XDS110_STAND_ALONE_ID   0x21

Definition at line 24 of file xds110.c.

◆ XDS_CONNECT

#define XDS_CONNECT   0x01 /* Connect JTAG connection */

Definition at line 146 of file xds110.c.

◆ XDS_CYCLE_TCK

#define XDS_CYCLE_TCK   0x07 /* Toggle TCK for a number of cycles */

Definition at line 151 of file xds110.c.

◆ XDS_DISCONNECT

#define XDS_DISCONNECT   0x02 /* Disconnect JTAG connection */

Definition at line 147 of file xds110.c.

◆ XDS_GOTO_STATE

#define XDS_GOTO_STATE   0x09 /* Go to requested JTAG state */

Definition at line 152 of file xds110.c.

◆ XDS_IN_LEN

#define XDS_IN_LEN   4 /* error code (int) */

Definition at line 143 of file xds110.c.

◆ XDS_JTAG_SCAN

#define XDS_JTAG_SCAN   0x0c /* Send and receive JTAG scan */

Definition at line 153 of file xds110.c.

◆ XDS_JTAG_STATE_CAPTURE_DR

#define XDS_JTAG_STATE_CAPTURE_DR   16

Definition at line 108 of file xds110.c.

◆ XDS_JTAG_STATE_CAPTURE_IR

#define XDS_JTAG_STATE_CAPTURE_IR   17

Definition at line 109 of file xds110.c.

◆ XDS_JTAG_STATE_EXIT1_DR

#define XDS_JTAG_STATE_EXIT1_DR   8

Definition at line 100 of file xds110.c.

◆ XDS_JTAG_STATE_EXIT1_IR

#define XDS_JTAG_STATE_EXIT1_IR   9

Definition at line 101 of file xds110.c.

◆ XDS_JTAG_STATE_EXIT2_DR

#define XDS_JTAG_STATE_EXIT2_DR   10

Definition at line 102 of file xds110.c.

◆ XDS_JTAG_STATE_EXIT2_IR

#define XDS_JTAG_STATE_EXIT2_IR   11

Definition at line 103 of file xds110.c.

◆ XDS_JTAG_STATE_IDLE

#define XDS_JTAG_STATE_IDLE   2

Definition at line 95 of file xds110.c.

◆ XDS_JTAG_STATE_PAUSE_DR

#define XDS_JTAG_STATE_PAUSE_DR   5

Definition at line 98 of file xds110.c.

◆ XDS_JTAG_STATE_PAUSE_IR

#define XDS_JTAG_STATE_PAUSE_IR   6

Definition at line 99 of file xds110.c.

◆ XDS_JTAG_STATE_RESET

#define XDS_JTAG_STATE_RESET   1

Definition at line 94 of file xds110.c.

◆ XDS_JTAG_STATE_SELECT_DR

#define XDS_JTAG_STATE_SELECT_DR   12

Definition at line 104 of file xds110.c.

◆ XDS_JTAG_STATE_SELECT_IR

#define XDS_JTAG_STATE_SELECT_IR   13

Definition at line 105 of file xds110.c.

◆ XDS_JTAG_STATE_SHIFT_DR

#define XDS_JTAG_STATE_SHIFT_DR   3

Definition at line 96 of file xds110.c.

◆ XDS_JTAG_STATE_SHIFT_IR

#define XDS_JTAG_STATE_SHIFT_IR   4

Definition at line 97 of file xds110.c.

◆ XDS_JTAG_STATE_UPDATE_DR

#define XDS_JTAG_STATE_UPDATE_DR   14

Definition at line 106 of file xds110.c.

◆ XDS_JTAG_STATE_UPDATE_IR

#define XDS_JTAG_STATE_UPDATE_IR   15

Definition at line 107 of file xds110.c.

◆ XDS_JTAG_TRANSIT_QUICKEST

#define XDS_JTAG_TRANSIT_QUICKEST   1

Definition at line 112 of file xds110.c.

◆ XDS_JTAG_TRANSIT_VIA_CAPTURE

#define XDS_JTAG_TRANSIT_VIA_CAPTURE   2

Definition at line 113 of file xds110.c.

◆ XDS_JTAG_TRANSIT_VIA_IDLE

#define XDS_JTAG_TRANSIT_VIA_IDLE   3

Definition at line 114 of file xds110.c.

◆ XDS_OUT_LEN

#define XDS_OUT_LEN   1 /* command (byte) */

Definition at line 142 of file xds110.c.

◆ XDS_SET_SRST

#define XDS_SET_SRST   0x0e /* Assert or deassert nSRST signal */

Definition at line 154 of file xds110.c.

◆ XDS_SET_SUPPLY

#define XDS_SET_SUPPLY   0x32 /* Set up stand-alone probe upply voltage */

Definition at line 165 of file xds110.c.

◆ XDS_SET_TCK

#define XDS_SET_TCK   0x04 /* Set TCK delay (to set TCK frequency) */

Definition at line 149 of file xds110.c.

◆ XDS_SET_TRST

#define XDS_SET_TRST   0x05 /* Assert or deassert nTRST signal */

Definition at line 150 of file xds110.c.

◆ XDS_VERSION

#define XDS_VERSION   0x03 /* Get firmware version and hardware ID */

Definition at line 148 of file xds110.c.

Function Documentation

◆ cjtag_connect()

static bool cjtag_connect ( uint32_t  format)
static

◆ cjtag_disconnect()

static bool cjtag_disconnect ( void  )
static

◆ cmapi_acquire()

static bool cmapi_acquire ( void  )
static

◆ cmapi_connect()

static bool cmapi_connect ( uint32_t *  idcode)
static

◆ cmapi_disconnect()

static bool cmapi_disconnect ( void  )
static

◆ cmapi_read_dap_reg()

static bool cmapi_read_dap_reg ( uint32_t  type,
uint32_t  ap_num,
uint32_t  address,
uint32_t *  value 
)
static

◆ cmapi_release()

static bool cmapi_release ( void  )
static

◆ cmapi_write_dap_reg()

static bool cmapi_write_dap_reg ( uint32_t  type,
uint32_t  ap_num,
uint32_t  address,
uint32_t *  value 
)
static

◆ COMMAND_HANDLER() [1/2]

COMMAND_HANDLER ( xds110_handle_info_command  )

Definition at line 2007 of file xds110.c.

References ERROR_OK, and xds110_show_info().

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( xds110_handle_supply_voltage_command  )

◆ ocd_dap_request()

static bool ocd_dap_request ( uint8_t *  dap_requests,
uint32_t  request_size,
uint32_t *  dap_results,
uint32_t  result_count 
)
static

◆ ocd_pathmove()

static bool ocd_pathmove ( uint32_t  num_states,
uint8_t *  path 
)
static

◆ ocd_scan_request()

static bool ocd_scan_request ( uint8_t *  scan_requests,
uint32_t  request_size,
uint8_t *  scan_results,
uint32_t  result_size 
)
static

◆ swd_connect()

static bool swd_connect ( void  )
static

◆ swd_disconnect()

static bool swd_disconnect ( void  )
static

◆ usb_connect()

◆ usb_disconnect()

static void usb_disconnect ( void  )
static

Definition at line 438 of file xds110.c.

References xds110_info::ctx, xds110_info::dev, xds110_info::interface, LOG_INFO, NULL, and xds110.

Referenced by xds110_quit().

◆ usb_get_response()

static bool usb_get_response ( uint32_t *  total_bytes_read,
uint32_t  timeout 
)
static

◆ usb_read()

static bool usb_read ( unsigned char *  buffer,
int  size,
int *  bytes_read,
int  timeout 
)
static

Definition at line 454 of file xds110.c.

References buffer, DEFAULT_TIMEOUT, xds110_info::dev, xds110_info::endpoint_in, size, true, and xds110.

Referenced by usb_get_response().

◆ usb_send_command()

static bool usb_send_command ( uint16_t  size)
static

Definition at line 580 of file xds110.c.

References size, USB_PAYLOAD_SIZE, usb_write(), xds110_info::write_packet, xds110, and xds110_set_u16().

Referenced by xds_execute().

◆ usb_write()

static bool usb_write ( unsigned char *  buffer,
int  size,
int *  written 
)
static

Definition at line 472 of file xds110.c.

References buffer, xds110_info::dev, xds110_info::endpoint_out, size, true, and xds110.

Referenced by usb_send_command().

◆ xds110_execute_command()

◆ xds110_execute_pathmove()

static void xds110_execute_pathmove ( struct jtag_command cmd)
static

◆ xds110_execute_queue()

static int xds110_execute_queue ( void  )
static

Definition at line 1852 of file xds110.c.

References cmd, ERROR_OK, jtag_command_queue, xds110_execute_command(), and xds110_flush().

◆ xds110_execute_sleep()

static void xds110_execute_sleep ( struct jtag_command cmd)
static

Definition at line 1669 of file xds110.c.

References cmd, and jtag_sleep().

Referenced by xds110_execute_command().

◆ xds110_execute_tlr_reset()

static void xds110_execute_tlr_reset ( struct jtag_command cmd)
static

Definition at line 1674 of file xds110.c.

References xds_goto_state(), and XDS_JTAG_STATE_RESET.

Referenced by xds110_execute_command().

◆ xds110_flush()

◆ xds110_get_u16()

static uint16_t xds110_get_u16 ( uint8_t *  buffer)
inlinestatic

Definition at line 288 of file xds110.c.

References buffer.

Referenced by usb_get_response(), and xds_version().

◆ xds110_get_u32()

static uint32_t xds110_get_u32 ( uint8_t *  buffer)
inlinestatic

Definition at line 279 of file xds110.c.

References buffer.

Referenced by cmapi_connect(), cmapi_read_dap_reg(), xds_execute(), and xds_version().

◆ xds110_init()

◆ xds110_khz()

static int xds110_khz ( int  khz,
int *  jtag_speed 
)
static

Definition at line 2001 of file xds110.c.

References ERROR_OK.

◆ xds110_legacy_read_reg()

static bool xds110_legacy_read_reg ( uint8_t  cmd,
uint32_t *  value 
)
static

◆ xds110_legacy_runtest()

static void xds110_legacy_runtest ( uint32_t  clocks,
uint32_t  end_state 
)
static

Definition at line 1520 of file xds110.c.

References xds_cycle_tck(), xds_goto_state(), and XDS_JTAG_STATE_IDLE.

Referenced by xds110_flush().

◆ xds110_legacy_scan()

static void xds110_legacy_scan ( uint32_t  shift_state,
uint32_t  total_bits,
uint32_t  end_state,
uint8_t *  data_out,
uint8_t *  data_in 
)
static

Definition at line 1514 of file xds110.c.

References xds_jtag_scan().

Referenced by xds110_flush().

◆ xds110_legacy_stableclocks()

static void xds110_legacy_stableclocks ( uint32_t  clocks)
static

Definition at line 1527 of file xds110.c.

References xds_cycle_tck().

Referenced by xds110_flush().

◆ xds110_legacy_write_reg()

static bool xds110_legacy_write_reg ( uint8_t  cmd,
uint32_t  value 
)
static

◆ xds110_queue_runtest()

static void xds110_queue_runtest ( struct jtag_command cmd)
static

◆ xds110_queue_scan()

◆ xds110_queue_stableclocks()

static void xds110_queue_stableclocks ( struct jtag_command cmd)
static

◆ xds110_quit()

◆ xds110_reset()

static int xds110_reset ( int  trst,
int  srst 
)
static

◆ xds110_set_u16()

static void xds110_set_u16 ( uint8_t *  buffer,
uint16_t  value 
)
inlinestatic

Definition at line 273 of file xds110.c.

References buffer.

Referenced by usb_send_command(), and xds_jtag_scan().

◆ xds110_set_u32()

static void xds110_set_u32 ( uint8_t *  buffer,
uint32_t  value 
)
inlinestatic

◆ xds110_show_info()

◆ xds110_speed()

◆ xds110_speed_div()

static int xds110_speed_div ( int  speed,
int *  khz 
)
static

Definition at line 1995 of file xds110.c.

References ERROR_OK.

◆ xds110_swd_init()

static int xds110_swd_init ( void  )
static

Definition at line 1094 of file xds110.c.

References ERROR_OK, xds110_info::is_swd_mode, and xds110.

◆ xds110_swd_queue_cmd()

◆ xds110_swd_read_reg()

static void xds110_swd_read_reg ( uint8_t  cmd,
uint32_t *  value,
uint32_t  ap_delay_clk 
)
static

Definition at line 1354 of file xds110.c.

References cmd, SWD_CMD_RNW, and xds110_swd_queue_cmd().

◆ xds110_swd_run_queue()

◆ xds110_swd_switch_seq()

◆ xds110_swd_write_reg()

static void xds110_swd_write_reg ( uint8_t  cmd,
uint32_t  value,
uint32_t  ap_delay_clk 
)
static

Definition at line 1360 of file xds110.c.

References cmd, SWD_CMD_RNW, and xds110_swd_queue_cmd().

◆ xds_connect()

static bool xds_connect ( void  )
static

◆ xds_cycle_tck()

◆ xds_disconnect()

static bool xds_disconnect ( void  )
static

◆ xds_execute()

◆ xds_goto_state()

◆ xds_jtag_scan()

static bool xds_jtag_scan ( uint32_t  shift_state,
uint16_t  shift_bits,
uint32_t  end_state,
uint8_t *  data_out,
uint8_t *  data_in 
)
static

◆ xds_set_srst()

static bool xds_set_srst ( uint8_t  srst)
static

◆ xds_set_supply()

static bool xds_set_supply ( uint32_t  voltage)
static

◆ xds_set_tck_delay()

static bool xds_set_tck_delay ( uint32_t  delay)
static

◆ xds_set_trst()

static bool xds_set_trst ( uint8_t  trst)
static

◆ xds_version()

static bool xds_version ( uint32_t *  firmware_id,
uint16_t *  hardware_id 
)
static

Variable Documentation

◆ xds110

struct xds110_info xds110
static

◆ xds110_adapter_driver

struct adapter_driver xds110_adapter_driver
Initial value:
= {
.name = "xds110",
.transports = xds110_transport,
.init = xds110_init,
.quit = xds110_quit,
.reset = xds110_reset,
.speed = xds110_speed,
.khz = xds110_khz,
.speed_div = xds110_speed_div,
.jtag_ops = &xds110_interface,
.swd_ops = &xds110_swd_driver,
}
static int xds110_quit(void)
Definition: xds110.c:1401
static int xds110_reset(int trst, int srst)
Definition: xds110.c:1625
static const struct command_registration xds110_command_handlers[]
Definition: xds110.c:2053
static int xds110_init(void)
Definition: xds110.c:1429
static struct jtag_interface xds110_interface
Definition: xds110.c:2074
static int xds110_speed(int speed)
Definition: xds110.c:1866
static int xds110_speed_div(int speed, int *khz)
Definition: xds110.c:1995
static const char *const xds110_transport[]
Definition: xds110.c:2072
static const struct swd_driver xds110_swd_driver
Definition: xds110.c:2064
static int xds110_khz(int khz, int *jtag_speed)
Definition: xds110.c:2001

Definition at line 2072 of file xds110.c.

◆ xds110_command_handlers

const struct command_registration xds110_command_handlers[]
static
Initial value:
= {
{
.name = "xds110",
.mode = COMMAND_ANY,
.help = "perform XDS110 management",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_ANY
Definition: command.h:42
static const struct command_registration xds110_subcommand_handlers[]
Definition: xds110.c:2035

Definition at line 2013 of file xds110.c.

◆ xds110_interface

struct jtag_interface xds110_interface
static
Initial value:
= {
.execute_queue = xds110_execute_queue,
}
static int xds110_execute_queue(void)
Definition: xds110.c:1852

Definition at line 2072 of file xds110.c.

◆ xds110_subcommand_handlers

const struct command_registration xds110_subcommand_handlers[]
static
Initial value:
= {
{
.name = "info",
.handler = &xds110_handle_info_command,
.mode = COMMAND_EXEC,
.help = "show XDS110 info",
.usage = "",
},
{
.name = "supply",
.handler = &xds110_handle_supply_voltage_command,
.mode = COMMAND_CONFIG,
.help = "set the XDS110 probe supply voltage",
.usage = "voltage_in_millivolts",
},
}
@ COMMAND_CONFIG
Definition: command.h:41
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 2013 of file xds110.c.

◆ xds110_swd_driver

const struct swd_driver xds110_swd_driver
static
Initial value:
= {
.init = xds110_swd_init,
.switch_seq = xds110_swd_switch_seq,
.read_reg = xds110_swd_read_reg,
.write_reg = xds110_swd_write_reg,
}
static int xds110_swd_init(void)
Definition: xds110.c:1094
static void xds110_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
Definition: xds110.c:1360
static int xds110_swd_run_queue(void)
Definition: xds110.c:1258
static void xds110_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
Definition: xds110.c:1354
static int xds110_swd_switch_seq(enum swd_special_seq seq)
Definition: xds110.c:1100

Definition at line 2013 of file xds110.c.

◆ xds110_transport

const char* const xds110_transport[] = { "swd", "jtag", NULL }
static

Definition at line 2072 of file xds110.c.

◆ xds_jtag_state

const uint32_t xds_jtag_state[]
static
Initial value:
= {
}
#define XDS_JTAG_STATE_UPDATE_IR
Definition: xds110.c:107
#define XDS_JTAG_STATE_IDLE
Definition: xds110.c:95
#define XDS_JTAG_STATE_EXIT1_IR
Definition: xds110.c:101
#define XDS_JTAG_STATE_SELECT_IR
Definition: xds110.c:105
#define XDS_JTAG_STATE_EXIT1_DR
Definition: xds110.c:100
#define XDS_JTAG_STATE_CAPTURE_IR
Definition: xds110.c:109
#define XDS_JTAG_STATE_PAUSE_IR
Definition: xds110.c:99
#define XDS_JTAG_STATE_EXIT2_DR
Definition: xds110.c:102
#define XDS_JTAG_STATE_CAPTURE_DR
Definition: xds110.c:108
#define XDS_JTAG_STATE_SELECT_DR
Definition: xds110.c:104
#define XDS_JTAG_STATE_UPDATE_DR
Definition: xds110.c:106
#define XDS_JTAG_STATE_RESET
Definition: xds110.c:94
#define XDS_JTAG_STATE_PAUSE_DR
Definition: xds110.c:98
#define XDS_JTAG_STATE_SHIFT_IR
Definition: xds110.c:97
#define XDS_JTAG_STATE_SHIFT_DR
Definition: xds110.c:96
#define XDS_JTAG_STATE_EXIT2_IR
Definition: xds110.c:103

Definition at line 176 of file xds110.c.

Referenced by xds110_execute_pathmove(), xds110_queue_runtest(), and xds110_queue_scan().