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

Go to the source code of this file.

Data Structures

struct  usbprog_jtag
 

Macros

#define PID   0x0c63
 
#define PORT_DIRECTION   0x01
 
#define PORT_GET   0x03
 
#define PORT_GETBIT   0x05
 
#define PORT_SET   0x02
 
#define PORT_SETBIT   0x04
 
#define READ_TDO   0x07
 
#define TCK_BIT   2
 
#define TDI_BIT   3
 
#define TDO_BIT   0
 
#define TMS_BIT   1
 
#define UNKNOWN_COMMAND   0x00
 
#define VID   0x1781
 
#define WRITE_AND_READ   0x08
 
#define WRITE_TDI   0x06
 
#define WRITE_TMS   0x09
 
#define WRITE_TMS_CHAIN   0x0A
 

Functions

static void usbprog_end_state (tap_state_t state)
 
static int usbprog_execute_queue (struct jtag_command *cmd_queue)
 
static int usbprog_init (void)
 
static void usbprog_jtag_init (struct usbprog_jtag *usbprog_jtag)
 
static unsigned char usbprog_jtag_message (struct usbprog_jtag *usbprog_jtag, char *msg, int msglen)
 
static struct usbprog_jtagusbprog_jtag_open (void)
 
static void usbprog_jtag_read_tdo (struct usbprog_jtag *usbprog_jtag, char *buffer, int size)
 
static void usbprog_jtag_set_bit (struct usbprog_jtag *usbprog_jtag, int bit, int value)
 
static void usbprog_jtag_set_direction (struct usbprog_jtag *usbprog_jtag, unsigned char direction)
 
static void usbprog_jtag_tms_collect (char tms_scan)
 
static void usbprog_jtag_tms_send (struct usbprog_jtag *usbprog_jtag)
 
static void usbprog_jtag_write_and_read (struct usbprog_jtag *usbprog_jtag, char *buffer, int size)
 
static void usbprog_jtag_write_slice (struct usbprog_jtag *usbprog_jtag, unsigned char value)
 
static void usbprog_jtag_write_tdi (struct usbprog_jtag *usbprog_jtag, char *buffer, int size)
 
static void usbprog_jtag_write_tms (struct usbprog_jtag *usbprog_jtag, char tms_scan)
 
static void usbprog_path_move (struct pathmove_command *cmd)
 
static int usbprog_quit (void)
 
static void usbprog_reset (int trst, int srst)
 
static void usbprog_runtest (unsigned int num_cycles)
 
static void usbprog_scan (bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size)
 
static void usbprog_state_move (void)
 
static void usbprog_write (int tck, int tms, int tdi)
 

Variables

static char tms_chain [64]
 
static int tms_chain_index
 
struct adapter_driver usbprog_adapter_driver
 
static struct jtag_interface usbprog_interface
 
static struct usbprog_jtagusbprog_jtag_handle
 

Macro Definition Documentation

◆ PID

#define PID   0x0c63

Definition at line 29 of file usbprog.c.

◆ PORT_DIRECTION

#define PORT_DIRECTION   0x01

Definition at line 44 of file usbprog.c.

◆ PORT_GET

#define PORT_GET   0x03

Definition at line 46 of file usbprog.c.

◆ PORT_GETBIT

#define PORT_GETBIT   0x05

Definition at line 48 of file usbprog.c.

◆ PORT_SET

#define PORT_SET   0x02

Definition at line 45 of file usbprog.c.

◆ PORT_SETBIT

#define PORT_SETBIT   0x04

Definition at line 47 of file usbprog.c.

◆ READ_TDO

#define READ_TDO   0x07

Definition at line 50 of file usbprog.c.

◆ TCK_BIT

#define TCK_BIT   2

Definition at line 34 of file usbprog.c.

◆ TDI_BIT

#define TDI_BIT   3

Definition at line 33 of file usbprog.c.

◆ TDO_BIT

#define TDO_BIT   0

Definition at line 32 of file usbprog.c.

◆ TMS_BIT

#define TMS_BIT   1

Definition at line 35 of file usbprog.c.

◆ UNKNOWN_COMMAND

#define UNKNOWN_COMMAND   0x00

Definition at line 43 of file usbprog.c.

◆ VID

#define VID   0x1781

Definition at line 28 of file usbprog.c.

◆ WRITE_AND_READ

#define WRITE_AND_READ   0x08

Definition at line 51 of file usbprog.c.

◆ WRITE_TDI

#define WRITE_TDI   0x06

Definition at line 49 of file usbprog.c.

◆ WRITE_TMS

#define WRITE_TMS   0x09

Definition at line 52 of file usbprog.c.

◆ WRITE_TMS_CHAIN

#define WRITE_TMS_CHAIN   0x0A

Definition at line 53 of file usbprog.c.

Function Documentation

◆ usbprog_end_state()

static void usbprog_end_state ( tap_state_t  state)
static

◆ usbprog_execute_queue()

◆ usbprog_init()

static int usbprog_init ( void  )
static

◆ usbprog_jtag_init()

static void usbprog_jtag_init ( struct usbprog_jtag usbprog_jtag)
static

Definition at line 383 of file usbprog.c.

References usbprog_jtag_set_direction().

Referenced by usbprog_init().

◆ usbprog_jtag_message()

static unsigned char usbprog_jtag_message ( struct usbprog_jtag usbprog_jtag,
char *  msg,
int  msglen 
)
static

◆ usbprog_jtag_open()

struct usbprog_jtag * usbprog_jtag_open ( void  )
static

Definition at line 336 of file usbprog.c.

References ERROR_OK, jtag_libusb_open(), NULL, PID, usbprog_jtag::usb_handle, and VID.

Referenced by usbprog_init().

◆ usbprog_jtag_read_tdo()

static void usbprog_jtag_read_tdo ( struct usbprog_jtag usbprog_jtag,
char *  buffer,
int  size 
)
static

◆ usbprog_jtag_set_bit()

static void usbprog_jtag_set_bit ( struct usbprog_jtag usbprog_jtag,
int  bit,
int  value 
)
static

Definition at line 540 of file usbprog.c.

References bit(), PORT_SETBIT, and usbprog_jtag_message().

Referenced by usbprog_reset().

◆ usbprog_jtag_set_direction()

static void usbprog_jtag_set_direction ( struct usbprog_jtag usbprog_jtag,
unsigned char  direction 
)
static

Definition at line 514 of file usbprog.c.

References direction, PORT_DIRECTION, and usbprog_jtag_message().

Referenced by usbprog_jtag_init().

◆ usbprog_jtag_tms_collect()

static void usbprog_jtag_tms_collect ( char  tms_scan)
static

Definition at line 566 of file usbprog.c.

References tms_chain, and tms_chain_index.

Referenced by usbprog_jtag_write_tms().

◆ usbprog_jtag_tms_send()

static void usbprog_jtag_tms_send ( struct usbprog_jtag usbprog_jtag)
static

Definition at line 572 of file usbprog.c.

Referenced by usbprog_path_move(), usbprog_runtest(), and usbprog_scan().

◆ usbprog_jtag_write_and_read()

static void usbprog_jtag_write_and_read ( struct usbprog_jtag usbprog_jtag,
char *  buffer,
int  size 
)
static

◆ usbprog_jtag_write_slice()

static void usbprog_jtag_write_slice ( struct usbprog_jtag usbprog_jtag,
unsigned char  value 
)
static

Definition at line 522 of file usbprog.c.

References PORT_SET, and usbprog_jtag_message().

Referenced by usbprog_write().

◆ usbprog_jtag_write_tdi()

static void usbprog_jtag_write_tdi ( struct usbprog_jtag usbprog_jtag,
char *  buffer,
int  size 
)
static

Definition at line 478 of file usbprog.c.

References buffer, jtag_libusb_bulk_write(), size, usbprog_jtag::usb_handle, and WRITE_TDI.

Referenced by usbprog_scan().

◆ usbprog_jtag_write_tms()

static void usbprog_jtag_write_tms ( struct usbprog_jtag usbprog_jtag,
char  tms_scan 
)
static

Definition at line 509 of file usbprog.c.

References usbprog_jtag_tms_collect().

Referenced by usbprog_state_move().

◆ usbprog_path_move()

static void usbprog_path_move ( struct pathmove_command cmd)
static

◆ usbprog_quit()

static int usbprog_quit ( void  )
static

Definition at line 165 of file usbprog.c.

References ERROR_OK.

◆ usbprog_reset()

static void usbprog_reset ( int  trst,
int  srst 
)
static

Definition at line 319 of file usbprog.c.

References LOG_DEBUG, usbprog_jtag_handle, and usbprog_jtag_set_bit().

Referenced by usbprog_execute_queue(), and usbprog_init().

◆ usbprog_runtest()

static void usbprog_runtest ( unsigned int  num_cycles)
static

◆ usbprog_scan()

◆ usbprog_state_move()

static void usbprog_state_move ( void  )
static

◆ usbprog_write()

static void usbprog_write ( int  tck,
int  tms,
int  tdi 
)
static

Variable Documentation

◆ tms_chain

char tms_chain[64]
static

Definition at line 71 of file usbprog.c.

Referenced by usbprog_jtag_tms_collect().

◆ tms_chain_index

int tms_chain_index
static

Definition at line 72 of file usbprog.c.

Referenced by usbprog_init(), and usbprog_jtag_tms_collect().

◆ usbprog_adapter_driver

struct adapter_driver usbprog_adapter_driver
Initial value:
= {
.name = "usbprog",
.transports = jtag_only,
.init = usbprog_init,
.quit = usbprog_quit,
.jtag_ops = &usbprog_interface,
}
const char *const jtag_only[]
Definition: adapter.c:27
static struct jtag_interface usbprog_interface
Definition: usbprog.c:587
static int usbprog_init(void)
Definition: usbprog.c:146
static int usbprog_quit(void)
Definition: usbprog.c:165

Definition at line 572 of file usbprog.c.

◆ usbprog_interface

struct jtag_interface usbprog_interface
static
Initial value:
= {
.execute_queue = usbprog_execute_queue,
}
static int usbprog_execute_queue(struct jtag_command *cmd_queue)
Definition: usbprog.c:86

Definition at line 572 of file usbprog.c.

◆ usbprog_jtag_handle

struct usbprog_jtag* usbprog_jtag_handle
static