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

Go to the source code of this file.

Data Structures

struct  opendous_jtag
 
struct  opendous_probe
 
struct  pending_scan_result
 

Macros

#define FUNC_READ_DATA   0x51
 
#define FUNC_START_BOOTLOADER   30
 
#define FUNC_WRITE_DATA   0x50
 
#define JTAG_CMD_READ_CONFIG   0x7
 
#define JTAG_CMD_READ_INPUT   0x3
 
#define JTAG_CMD_SET_DELAY   0x5
 
#define JTAG_CMD_SET_SRST   0x2
 
#define JTAG_CMD_SET_SRST_TRST   0x6
 
#define JTAG_CMD_SET_TRST   0x1
 
#define JTAG_CMD_TAP_OUTPUT   0x0
 
#define JTAG_CMD_TAP_OUTPUT_EMU   0x4
 
#define MAX_PENDING_SCAN_RESULTS   (OPENDOUS_MAX_INPUT_DATA)
 
#define OPENDOUS_IN_BUFFER_SIZE   (OPENDOUS_USB_BUFFER_SIZE)
 
#define OPENDOUS_MAX_INPUT_DATA   (OPENDOUS_MAX_TAP_TRANSMIT*4)
 
#define OPENDOUS_MAX_SPEED   66
 
#define OPENDOUS_MAX_TAP_TRANSMIT   ((opendous_probe->BUFFERSIZE)-10)
 
#define OPENDOUS_MAX_VIDS_PIDS   4
 
#define OPENDOUS_OUT_BUFFER_SIZE   (OPENDOUS_USB_BUFFER_SIZE)
 
#define OPENDOUS_READ_ENDPOINT   (opendous_probe->READ_EP)
 
#define OPENDOUS_TAP_BUFFER_SIZE   65536
 
#define OPENDOUS_USB_BUFFER_SIZE   (opendous_probe->BUFFERSIZE)
 
#define OPENDOUS_USB_TIMEOUT   1000
 
#define OPENDOUS_WRITE_ENDPOINT   (opendous_probe->WRITE_EP)
 

Functions

 COMMAND_HANDLER (opendous_handle_opendous_hw_jtag_command)
 
 COMMAND_HANDLER (opendous_handle_opendous_info_command)
 
 COMMAND_HANDLER (opendous_handle_opendous_type_command)
 
static void opendous_end_state (tap_state_t state)
 
static int opendous_execute_queue (struct jtag_command *cmd_queue)
 
static int opendous_get_status (void)
 
static int opendous_get_version_info (void)
 
static int opendous_init (void)
 
static void opendous_path_move (int num_states, tap_state_t *path)
 
static int opendous_quit (void)
 
static void opendous_reset (int trst, int srst)
 
static void opendous_runtest (int num_cycles)
 
static void opendous_scan (int ir_scan, enum scan_type type, uint8_t *buffer, int scan_size, struct scan_command *command)
 
static void opendous_simple_command (uint8_t command, uint8_t _data)
 
static void opendous_state_move (void)
 
static void opendous_tap_append_scan (int length, uint8_t *buffer, struct scan_command *command)
 
static void opendous_tap_append_step (int tms, int tdi)
 
static void opendous_tap_ensure_space (int scans, int bits)
 
static int opendous_tap_execute (void)
 
static void opendous_tap_init (void)
 
static void opendous_usb_close (struct opendous_jtag *opendous_jtag)
 
static int opendous_usb_message (struct opendous_jtag *opendous_jtag, int out_length, int in_length)
 
static struct opendous_jtagopendous_usb_open (void)
 
static int opendous_usb_read (struct opendous_jtag *opendous_jtag)
 
static int opendous_usb_write (struct opendous_jtag *opendous_jtag, int out_length)
 

Variables

static int last_tms
 
struct adapter_driver opendous_adapter_driver
 
static const struct command_registration opendous_command_handlers []
 
static unsigned int opendous_hw_jtag_version = 1
 
static struct jtag_interface opendous_interface
 
static struct opendous_jtagopendous_jtag_handle
 
static const struct opendous_probeopendous_probe
 
static const struct opendous_probe opendous_probes []
 
static char * opendous_type
 
static struct pending_scan_resultpending_scan_results_buffer
 
static int pending_scan_results_length
 
static int tap_length
 
static uint8_t tdo_buffer [OPENDOUS_TAP_BUFFER_SIZE]
 
static uint8_t tms_buffer [OPENDOUS_TAP_BUFFER_SIZE]
 
static uint8_t * usb_in_buffer
 
static uint8_t * usb_out_buffer
 

Macro Definition Documentation

◆ FUNC_READ_DATA

#define FUNC_READ_DATA   0x51

Definition at line 96 of file opendous.c.

◆ FUNC_START_BOOTLOADER

#define FUNC_START_BOOTLOADER   30

Definition at line 94 of file opendous.c.

◆ FUNC_WRITE_DATA

#define FUNC_WRITE_DATA   0x50

Definition at line 95 of file opendous.c.

◆ JTAG_CMD_READ_CONFIG

#define JTAG_CMD_READ_CONFIG   0x7

Definition at line 91 of file opendous.c.

◆ JTAG_CMD_READ_INPUT

#define JTAG_CMD_READ_INPUT   0x3

Definition at line 87 of file opendous.c.

◆ JTAG_CMD_SET_DELAY

#define JTAG_CMD_SET_DELAY   0x5

Definition at line 89 of file opendous.c.

◆ JTAG_CMD_SET_SRST

#define JTAG_CMD_SET_SRST   0x2

Definition at line 86 of file opendous.c.

◆ JTAG_CMD_SET_SRST_TRST

#define JTAG_CMD_SET_SRST_TRST   0x6

Definition at line 90 of file opendous.c.

◆ JTAG_CMD_SET_TRST

#define JTAG_CMD_SET_TRST   0x1

Definition at line 85 of file opendous.c.

◆ JTAG_CMD_TAP_OUTPUT

#define JTAG_CMD_TAP_OUTPUT   0x0

Definition at line 84 of file opendous.c.

◆ JTAG_CMD_TAP_OUTPUT_EMU

#define JTAG_CMD_TAP_OUTPUT_EMU   0x4

Definition at line 88 of file opendous.c.

◆ MAX_PENDING_SCAN_RESULTS

#define MAX_PENDING_SCAN_RESULTS   (OPENDOUS_MAX_INPUT_DATA)

Definition at line 81 of file opendous.c.

◆ OPENDOUS_IN_BUFFER_SIZE

#define OPENDOUS_IN_BUFFER_SIZE   (OPENDOUS_USB_BUFFER_SIZE)

Definition at line 55 of file opendous.c.

◆ OPENDOUS_MAX_INPUT_DATA

#define OPENDOUS_MAX_INPUT_DATA   (OPENDOUS_MAX_TAP_TRANSMIT*4)

Definition at line 66 of file opendous.c.

◆ OPENDOUS_MAX_SPEED

#define OPENDOUS_MAX_SPEED   66

Definition at line 64 of file opendous.c.

◆ OPENDOUS_MAX_TAP_TRANSMIT

#define OPENDOUS_MAX_TAP_TRANSMIT   ((opendous_probe->BUFFERSIZE)-10)

Definition at line 65 of file opendous.c.

◆ OPENDOUS_MAX_VIDS_PIDS

#define OPENDOUS_MAX_VIDS_PIDS   4

Definition at line 28 of file opendous.c.

◆ OPENDOUS_OUT_BUFFER_SIZE

#define OPENDOUS_OUT_BUFFER_SIZE   (OPENDOUS_USB_BUFFER_SIZE)

Definition at line 56 of file opendous.c.

◆ OPENDOUS_READ_ENDPOINT

#define OPENDOUS_READ_ENDPOINT   (opendous_probe->READ_EP)

Definition at line 48 of file opendous.c.

◆ OPENDOUS_TAP_BUFFER_SIZE

#define OPENDOUS_TAP_BUFFER_SIZE   65536

Definition at line 69 of file opendous.c.

◆ OPENDOUS_USB_BUFFER_SIZE

#define OPENDOUS_USB_BUFFER_SIZE   (opendous_probe->BUFFERSIZE)

Definition at line 54 of file opendous.c.

◆ OPENDOUS_USB_TIMEOUT

#define OPENDOUS_USB_TIMEOUT   1000

Definition at line 52 of file opendous.c.

◆ OPENDOUS_WRITE_ENDPOINT

#define OPENDOUS_WRITE_ENDPOINT   (opendous_probe->WRITE_EP)

Definition at line 47 of file opendous.c.

Function Documentation

◆ COMMAND_HANDLER() [1/3]

COMMAND_HANDLER ( opendous_handle_opendous_hw_jtag_command  )

◆ COMMAND_HANDLER() [2/3]

COMMAND_HANDLER ( opendous_handle_opendous_info_command  )

Definition at line 163 of file opendous.c.

References ERROR_OK, opendous_get_status(), and opendous_get_version_info().

◆ COMMAND_HANDLER() [3/3]

COMMAND_HANDLER ( opendous_handle_opendous_type_command  )

Definition at line 147 of file opendous.c.

References CMD_ARGC, CMD_ARGV, ERROR_OK, and opendous_type.

◆ opendous_end_state()

void opendous_end_state ( tap_state_t  state)
static

◆ opendous_execute_queue()

◆ opendous_get_status()

int opendous_get_status ( void  )
static

Definition at line 531 of file opendous.c.

References ERROR_OK.

Referenced by COMMAND_HANDLER(), and opendous_init().

◆ opendous_get_version_info()

static int opendous_get_version_info ( void  )
static

Definition at line 536 of file opendous.c.

References ERROR_OK.

Referenced by COMMAND_HANDLER(), and opendous_init().

◆ opendous_init()

◆ opendous_path_move()

void opendous_path_move ( int  num_states,
tap_state_t path 
)
static

◆ opendous_quit()

static int opendous_quit ( void  )
static

◆ opendous_reset()

void opendous_reset ( int  trst,
int  srst 
)
static

◆ opendous_runtest()

void opendous_runtest ( int  num_cycles)
static

◆ opendous_scan()

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

◆ opendous_simple_command()

void opendous_simple_command ( uint8_t  command,
uint8_t  _data 
)
static

Definition at line 515 of file opendous.c.

References LOG_DEBUG_IO, LOG_ERROR, opendous_jtag_handle, opendous_usb_message(), and usb_out_buffer.

Referenced by opendous_reset().

◆ opendous_state_move()

void opendous_state_move ( void  )
static

◆ opendous_tap_append_scan()

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

◆ opendous_tap_append_step()

void opendous_tap_append_step ( int  tms,
int  tdi 
)
static

◆ opendous_tap_ensure_space()

void opendous_tap_ensure_space ( int  scans,
int  bits 
)
static

◆ opendous_tap_execute()

◆ opendous_tap_init()

void opendous_tap_init ( void  )
static

Definition at line 550 of file opendous.c.

References pending_scan_results_length, and tap_length.

Referenced by opendous_init(), and opendous_tap_execute().

◆ opendous_usb_close()

void opendous_usb_close ( struct opendous_jtag opendous_jtag)
static

Definition at line 709 of file opendous.c.

References jtag_libusb_close(), and opendous_jtag::usb_handle.

Referenced by opendous_quit().

◆ opendous_usb_message()

int opendous_usb_message ( struct opendous_jtag opendous_jtag,
int  out_length,
int  in_length 
)
static

Definition at line 716 of file opendous.c.

References LOG_ERROR, opendous_usb_read(), and opendous_usb_write().

Referenced by opendous_simple_command(), and opendous_tap_execute().

◆ opendous_usb_open()

struct opendous_jtag * opendous_usb_open ( void  )
static

◆ opendous_usb_read()

◆ opendous_usb_write()

Variable Documentation

◆ last_tms

int last_tms
static

Definition at line 548 of file opendous.c.

Referenced by opendous_tap_append_step().

◆ opendous_adapter_driver

struct adapter_driver opendous_adapter_driver
Initial value:
= {
.name = "opendous",
.transports = jtag_only,
.init = opendous_init,
.quit = opendous_quit,
.jtag_ops = &opendous_interface,
}
const char *const jtag_only[]
Definition: adapter.c:27
static int opendous_quit(void)
Definition: opendous.c:374
static int opendous_init(void)
Definition: opendous.c:316
static struct jtag_interface opendous_interface
Definition: opendous.c:226
static const struct command_registration opendous_command_handlers[]
Definition: opendous.c:201

Definition at line 173 of file opendous.c.

◆ opendous_command_handlers

const struct command_registration opendous_command_handlers[]
static
Initial value:
= {
{
.name = "opendous_info",
.handler = &opendous_handle_opendous_info_command,
.mode = COMMAND_EXEC,
.help = "show opendous info",
.usage = "",
},
{
.name = "opendous_hw_jtag",
.handler = &opendous_handle_opendous_hw_jtag_command,
.mode = COMMAND_EXEC,
.help = "access opendous HW JTAG command version",
.usage = "[2|3]",
},
{
.name = "opendous_type",
.handler = &opendous_handle_opendous_type_command,
.mode = COMMAND_CONFIG,
.help = "set opendous type",
.usage = "[usbvlab|usbprog-jtag|opendous]",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_CONFIG
Definition: command.h:41
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 173 of file opendous.c.

◆ opendous_hw_jtag_version

unsigned int opendous_hw_jtag_version = 1
static

Definition at line 50 of file opendous.c.

Referenced by COMMAND_HANDLER().

◆ opendous_interface

struct jtag_interface opendous_interface
static
Initial value:
= {
.execute_queue = opendous_execute_queue,
}
static int opendous_execute_queue(struct jtag_command *cmd_queue)
Definition: opendous.c:241

Definition at line 173 of file opendous.c.

◆ opendous_jtag_handle

struct opendous_jtag* opendous_jtag_handle
static

◆ opendous_probe

const struct opendous_probe* opendous_probe
static

Definition at line 99 of file opendous.c.

◆ opendous_probes

const struct opendous_probe opendous_probes[]
static
Initial value:
= {
{"usbprog-jtag", {0x1781, 0}, {0x0C63, 0}, 0x82, 0x02, 0x00, 510 },
{"opendous", {0x1781, 0x03EB, 0}, {0xC0C0, 0x204F, 0}, 0x81, 0x02, 0x00, 360 },
{"usbvlab", {0x16C0, 0}, {0x05DC, 0}, 0x81, 0x02, 0x01, 360 },
{NULL, {0x0000}, {0x0000}, 0x00, 0x00, 0x00, 0 }
}
#define NULL
Definition: usb.h:16

Definition at line 1 of file opendous.c.

Referenced by opendous_init().

◆ opendous_type

char* opendous_type
static

Definition at line 98 of file opendous.c.

Referenced by COMMAND_HANDLER(), opendous_init(), and opendous_quit().

◆ pending_scan_results_buffer

struct pending_scan_result* pending_scan_results_buffer
static

◆ pending_scan_results_length

int pending_scan_results_length
static

◆ tap_length

◆ tdo_buffer

uint8_t tdo_buffer[OPENDOUS_TAP_BUFFER_SIZE]
static

Definition at line 546 of file opendous.c.

Referenced by opendous_tap_execute().

◆ tms_buffer

uint8_t tms_buffer[OPENDOUS_TAP_BUFFER_SIZE]
static

Definition at line 545 of file opendous.c.

Referenced by opendous_tap_append_step(), and opendous_tap_execute().

◆ usb_in_buffer

uint8_t* usb_in_buffer
static

Definition at line 59 of file opendous.c.

Referenced by opendous_init(), opendous_quit(), opendous_tap_execute(), and opendous_usb_read().

◆ usb_out_buffer

uint8_t* usb_out_buffer
static