OpenOCD
arm-jtag-ew.c File Reference
Include dependency graph for arm-jtag-ew.c:

Go to the source code of this file.

Data Structures

struct  armjtagew
 
struct  pending_scan_result
 

Macros

#define ARMJTAGEW_EPT_BULK_IN   0x82u
 
#define ARMJTAGEW_EPT_BULK_OUT   0x01u
 
#define ARMJTAGEW_IN_BUFFER_SIZE   (4*1024)
 
#define ARMJTAGEW_OUT_BUFFER_SIZE   (4*1024)
 
#define ARMJTAGEW_TAP_BUFFER_SIZE   2048
 
#define ARMJTAGEW_USB_TIMEOUT   2000
 
#define CMD_GET_TAPHW_STATE   0x21
 
#define CMD_GET_TCK_FREQUENCY   0x12
 
#define CMD_GET_VERSION   0x00
 
#define CMD_MEASURE_MAX_TCK_FREQ   0x15
 
#define CMD_MEASURE_RTCK_RESPONSE   0x16
 
#define CMD_SELECT_DPIMPL   0x10
 
#define CMD_SET_TAPHW_STATE   0x20
 
#define CMD_SET_TCK_FREQUENCY   0x11
 
#define CMD_TAP_SHIFT   0x17
 
#define CMD_TGPWR_SETUP   0x22
 
#define MAX_PENDING_SCAN_RESULTS   256
 
#define USB_PID   0x001e
 
#define USB_VID   0x15ba
 

Functions

static void armjtagew_end_state (tap_state_t state)
 
static int armjtagew_execute_queue (struct jtag_command *cmd_queue)
 
static int armjtagew_get_status (void)
 
static int armjtagew_get_version_info (void)
 
static int armjtagew_init (void)
 
static int armjtagew_khz (int khz, int *jtag_speed)
 
static void armjtagew_path_move (int num_states, tap_state_t *path)
 
static int armjtagew_quit (void)
 
static void armjtagew_reset (int trst, int srst)
 
static void armjtagew_runtest (int num_cycles)
 
static void armjtagew_scan (bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, struct scan_command *command)
 
static int armjtagew_speed (int speed)
 
static int armjtagew_speed_div (int speed, int *khz)
 
static void armjtagew_state_move (void)
 
static void armjtagew_tap_append_scan (int length, uint8_t *buffer, struct scan_command *command)
 
static void armjtagew_tap_append_step (int tms, int tdi)
 
static void armjtagew_tap_ensure_space (int scans, int bits)
 
static int armjtagew_tap_execute (void)
 
static void armjtagew_tap_init (void)
 
static void armjtagew_usb_close (struct armjtagew *armjtagew)
 
static int armjtagew_usb_message (struct armjtagew *armjtagew, int out_length, int in_length)
 
static struct armjtagewarmjtagew_usb_open (void)
 
static int armjtagew_usb_read (struct armjtagew *armjtagew, int exp_in_length)
 
static int armjtagew_usb_write (struct armjtagew *armjtagew, int out_length)
 
 COMMAND_HANDLER (armjtagew_handle_armjtagew_info_command)
 

Variables

struct adapter_driver armjtagew_adapter_driver
 
static const struct command_registration armjtagew_command_handlers []
 
static struct armjtagewarmjtagew_handle
 
static struct jtag_interface armjtagew_interface
 
static int last_tms
 
static struct pending_scan_result pending_scan_results_buffer [MAX_PENDING_SCAN_RESULTS]
 
static int pending_scan_results_length
 
static int tap_length
 
static uint8_t tdi_buffer [ARMJTAGEW_TAP_BUFFER_SIZE]
 
static uint8_t tdo_buffer [ARMJTAGEW_TAP_BUFFER_SIZE]
 
static uint8_t tms_buffer [ARMJTAGEW_TAP_BUFFER_SIZE]
 
static uint8_t usb_in_buffer [ARMJTAGEW_IN_BUFFER_SIZE]
 
static uint8_t usb_out_buffer [ARMJTAGEW_OUT_BUFFER_SIZE]
 

Macro Definition Documentation

◆ ARMJTAGEW_EPT_BULK_IN

#define ARMJTAGEW_EPT_BULK_IN   0x82u

Definition at line 21 of file arm-jtag-ew.c.

◆ ARMJTAGEW_EPT_BULK_OUT

#define ARMJTAGEW_EPT_BULK_OUT   0x01u

Definition at line 20 of file arm-jtag-ew.c.

◆ ARMJTAGEW_IN_BUFFER_SIZE

#define ARMJTAGEW_IN_BUFFER_SIZE   (4*1024)

Definition at line 25 of file arm-jtag-ew.c.

◆ ARMJTAGEW_OUT_BUFFER_SIZE

#define ARMJTAGEW_OUT_BUFFER_SIZE   (4*1024)

Definition at line 26 of file arm-jtag-ew.c.

◆ ARMJTAGEW_TAP_BUFFER_SIZE

#define ARMJTAGEW_TAP_BUFFER_SIZE   2048

Definition at line 509 of file arm-jtag-ew.c.

◆ ARMJTAGEW_USB_TIMEOUT

#define ARMJTAGEW_USB_TIMEOUT   2000

Definition at line 23 of file arm-jtag-ew.c.

◆ CMD_GET_TAPHW_STATE

#define CMD_GET_TAPHW_STATE   0x21

Definition at line 37 of file arm-jtag-ew.c.

◆ CMD_GET_TCK_FREQUENCY

#define CMD_GET_TCK_FREQUENCY   0x12

Definition at line 32 of file arm-jtag-ew.c.

◆ CMD_GET_VERSION

#define CMD_GET_VERSION   0x00

Definition at line 29 of file arm-jtag-ew.c.

◆ CMD_MEASURE_MAX_TCK_FREQ

#define CMD_MEASURE_MAX_TCK_FREQ   0x15

Definition at line 33 of file arm-jtag-ew.c.

◆ CMD_MEASURE_RTCK_RESPONSE

#define CMD_MEASURE_RTCK_RESPONSE   0x16

Definition at line 34 of file arm-jtag-ew.c.

◆ CMD_SELECT_DPIMPL

#define CMD_SELECT_DPIMPL   0x10

Definition at line 30 of file arm-jtag-ew.c.

◆ CMD_SET_TAPHW_STATE

#define CMD_SET_TAPHW_STATE   0x20

Definition at line 36 of file arm-jtag-ew.c.

◆ CMD_SET_TCK_FREQUENCY

#define CMD_SET_TCK_FREQUENCY   0x11

Definition at line 31 of file arm-jtag-ew.c.

◆ CMD_TAP_SHIFT

#define CMD_TAP_SHIFT   0x17

Definition at line 35 of file arm-jtag-ew.c.

◆ CMD_TGPWR_SETUP

#define CMD_TGPWR_SETUP   0x22

Definition at line 38 of file arm-jtag-ew.c.

◆ MAX_PENDING_SCAN_RESULTS

#define MAX_PENDING_SCAN_RESULTS   256

Definition at line 523 of file arm-jtag-ew.c.

◆ USB_PID

#define USB_PID   0x001e

Definition at line 18 of file arm-jtag-ew.c.

◆ USB_VID

#define USB_VID   0x15ba

Definition at line 17 of file arm-jtag-ew.c.

Function Documentation

◆ armjtagew_end_state()

static void armjtagew_end_state ( tap_state_t  state)
static

◆ armjtagew_execute_queue()

◆ armjtagew_get_status()

static int armjtagew_get_status ( void  )
static

◆ armjtagew_get_version_info()

static int armjtagew_get_version_info ( void  )
static

◆ armjtagew_init()

◆ armjtagew_khz()

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

Definition at line 196 of file arm-jtag-ew.c.

References ERROR_OK.

◆ armjtagew_path_move()

static void armjtagew_path_move ( int  num_states,
tap_state_t path 
)
static

◆ armjtagew_quit()

static int armjtagew_quit ( void  )
static

Definition at line 247 of file arm-jtag-ew.c.

References armjtagew_handle, armjtagew_usb_close(), and ERROR_OK.

◆ armjtagew_reset()

static void armjtagew_reset ( int  trst,
int  srst 
)
static

◆ armjtagew_runtest()

static void armjtagew_runtest ( int  num_cycles)
static

◆ armjtagew_scan()

static void armjtagew_scan ( bool  ir_scan,
enum scan_type  type,
uint8_t *  buffer,
int  scan_size,
struct scan_command command 
)
static

◆ armjtagew_speed()

◆ armjtagew_speed_div()

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

Definition at line 203 of file arm-jtag-ew.c.

References ERROR_OK.

◆ armjtagew_state_move()

static void armjtagew_state_move ( void  )
static

◆ armjtagew_tap_append_scan()

void armjtagew_tap_append_scan ( int  length,
uint8_t *  buffer,
struct scan_command command 
)
static

◆ armjtagew_tap_append_step()

static void armjtagew_tap_append_step ( int  tms,
int  tdi 
)
static

◆ armjtagew_tap_ensure_space()

static void armjtagew_tap_ensure_space ( int  scans,
int  bits 
)
static

◆ armjtagew_tap_execute()

◆ armjtagew_tap_init()

static void armjtagew_tap_init ( void  )
static

Definition at line 530 of file arm-jtag-ew.c.

References pending_scan_results_length, and tap_length.

Referenced by armjtagew_init(), and armjtagew_tap_execute().

◆ armjtagew_usb_close()

static void armjtagew_usb_close ( struct armjtagew armjtagew)
static

Definition at line 704 of file arm-jtag-ew.c.

References armjtagew::usb_handle.

Referenced by armjtagew_quit().

◆ armjtagew_usb_message()

static int armjtagew_usb_message ( struct armjtagew armjtagew,
int  out_length,
int  in_length 
)
static

◆ armjtagew_usb_open()

static struct armjtagew * armjtagew_usb_open ( void  )
static

Definition at line 674 of file arm-jtag-ew.c.

References config, ERROR_OK, jtag_libusb_open(), NULL, armjtagew::usb_handle, USB_PID, and USB_VID.

Referenced by armjtagew_init().

◆ armjtagew_usb_read()

static int armjtagew_usb_read ( struct armjtagew armjtagew,
int  exp_in_length 
)
static

◆ armjtagew_usb_write()

static int armjtagew_usb_write ( struct armjtagew armjtagew,
int  out_length 
)
static

◆ COMMAND_HANDLER()

COMMAND_HANDLER ( armjtagew_handle_armjtagew_info_command  )

Definition at line 466 of file arm-jtag-ew.c.

Variable Documentation

◆ armjtagew_adapter_driver

struct adapter_driver armjtagew_adapter_driver
Initial value:
= {
.name = "arm-jtag-ew",
.transports = jtag_only,
.init = armjtagew_init,
.quit = armjtagew_quit,
.speed = armjtagew_speed,
.khz = armjtagew_khz,
.speed_div = armjtagew_speed_div,
.jtag_ops = &armjtagew_interface,
}
const char *const jtag_only[]
Definition: adapter.c:27
static int armjtagew_init(void)
Definition: arm-jtag-ew.c:210
static int armjtagew_khz(int khz, int *jtag_speed)
Definition: arm-jtag-ew.c:196
static int armjtagew_speed_div(int speed, int *khz)
Definition: arm-jtag-ew.c:203
static const struct command_registration armjtagew_command_handlers[]
Definition: arm-jtag-ew.c:476
static struct jtag_interface armjtagew_interface
Definition: arm-jtag-ew.c:487
static int armjtagew_quit(void)
Definition: arm-jtag-ew.c:247
static int armjtagew_speed(int speed)
Definition: arm-jtag-ew.c:168

Definition at line 466 of file arm-jtag-ew.c.

◆ armjtagew_command_handlers

const struct command_registration armjtagew_command_handlers[]
static
Initial value:
= {
{
.name = "armjtagew_info",
.handler = &armjtagew_handle_armjtagew_info_command,
.mode = COMMAND_EXEC,
.help = "query armjtagew info",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 466 of file arm-jtag-ew.c.

◆ armjtagew_handle

◆ armjtagew_interface

struct jtag_interface armjtagew_interface
static
Initial value:
= {
.execute_queue = armjtagew_execute_queue,
}
static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
Definition: arm-jtag-ew.c:88

Definition at line 466 of file arm-jtag-ew.c.

◆ last_tms

int last_tms
static

◆ pending_scan_results_buffer

struct pending_scan_result pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS]
static

Definition at line 525 of file arm-jtag-ew.c.

Referenced by armjtagew_tap_append_scan(), and armjtagew_tap_execute().

◆ pending_scan_results_length

int pending_scan_results_length
static

◆ tap_length

◆ tdi_buffer

◆ tdo_buffer

◆ tms_buffer

uint8_t tms_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]
static

◆ usb_in_buffer

◆ usb_out_buffer