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

Go to the source code of this file.

Data Structures

struct  icdi_usb_handle
 

Macros

#define ICDI_PACKET_SIZE   2048
 
#define ICDI_READ_ENDPOINT   0x83
 
#define ICDI_READ_TIMEOUT   (LIBUSB_TIMEOUT_MS)
 
#define ICDI_WRITE_ENDPOINT   0x02
 
#define ICDI_WRITE_TIMEOUT   (LIBUSB_TIMEOUT_MS)
 
#define PACKET_END   "#"
 
#define PACKET_START   "$"
 

Functions

static int icdi_get_cmd_result (void *handle)
 
static int icdi_send_cmd (void *handle, const char *cmd)
 
static int icdi_send_packet (void *handle, int len)
 
static int icdi_send_remote_cmd (void *handle, const char *data)
 
static int icdi_usb_assert_srst (void *handle, int srst)
 
static int icdi_usb_close (void *handle)
 
static int icdi_usb_halt (void *handle)
 
static int icdi_usb_idcode (void *handle, uint32_t *idcode)
 
static int icdi_usb_open (struct hl_interface_param *param, void **fd)
 
static int icdi_usb_override_target (const char *targetname)
 
static int icdi_usb_query (void *handle)
 
static int icdi_usb_read_mem (void *handle, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer)
 
static int icdi_usb_read_mem_int (void *handle, uint32_t addr, uint32_t len, uint8_t *buffer)
 
static int icdi_usb_read_reg (void *handle, unsigned int regsel, uint32_t *val)
 
static int icdi_usb_read_regs (void *handle)
 
static int icdi_usb_reset (void *handle)
 
static int icdi_usb_run (void *handle)
 
static enum target_state icdi_usb_state (void *handle)
 
static int icdi_usb_step (void *handle)
 
static int icdi_usb_version (void *handle)
 
static int icdi_usb_write_debug_reg (void *handle, uint32_t addr, uint32_t val)
 
static int icdi_usb_write_mem (void *handle, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer)
 
static int icdi_usb_write_mem_int (void *handle, uint32_t addr, uint32_t len, const uint8_t *buffer)
 
static int icdi_usb_write_reg (void *handle, unsigned int regsel, uint32_t val)
 
static int remote_escape_output (const char *buffer, int len, char *out_buf, int *out_len, int out_maxlen)
 
static int remote_unescape_input (const char *buffer, int len, char *out_buf, int out_maxlen)
 

Variables

struct hl_layout_api icdi_usb_layout_api
 

Macro Definition Documentation

◆ ICDI_PACKET_SIZE

#define ICDI_PACKET_SIZE   2048

Definition at line 31 of file ti_icdi_usb.c.

◆ ICDI_READ_ENDPOINT

#define ICDI_READ_ENDPOINT   0x83

Definition at line 27 of file ti_icdi_usb.c.

◆ ICDI_READ_TIMEOUT

#define ICDI_READ_TIMEOUT   (LIBUSB_TIMEOUT_MS)

Definition at line 30 of file ti_icdi_usb.c.

◆ ICDI_WRITE_ENDPOINT

#define ICDI_WRITE_ENDPOINT   0x02

Definition at line 26 of file ti_icdi_usb.c.

◆ ICDI_WRITE_TIMEOUT

#define ICDI_WRITE_TIMEOUT   (LIBUSB_TIMEOUT_MS)

Definition at line 29 of file ti_icdi_usb.c.

◆ PACKET_END

#define PACKET_END   "#"

Definition at line 34 of file ti_icdi_usb.c.

◆ PACKET_START

#define PACKET_START   "$"

Definition at line 33 of file ti_icdi_usb.c.

Function Documentation

◆ icdi_get_cmd_result()

◆ icdi_send_cmd()

static int icdi_send_cmd ( void *  handle,
const char *  cmd 
)
static

◆ icdi_send_packet()

◆ icdi_send_remote_cmd()

static int icdi_send_remote_cmd ( void *  handle,
const char *  data 
)
static

◆ icdi_usb_assert_srst()

static int icdi_usb_assert_srst ( void *  handle,
int  srst 
)
static

Definition at line 399 of file ti_icdi_usb.c.

References ERROR_COMMAND_NOTFOUND.

◆ icdi_usb_close()

static int icdi_usb_close ( void *  handle)
static

◆ icdi_usb_halt()

static int icdi_usb_halt ( void *  handle)
static

Definition at line 424 of file ti_icdi_usb.c.

References ERROR_FAIL, ERROR_OK, icdi_get_cmd_result(), icdi_send_cmd(), and LOG_ERROR.

◆ icdi_usb_idcode()

static int icdi_usb_idcode ( void *  handle,
uint32_t *  idcode 
)
static

Definition at line 269 of file ti_icdi_usb.c.

References ERROR_OK.

◆ icdi_usb_open()

static int icdi_usb_open ( struct hl_interface_param param,
void **  fd 
)
static

Definition at line 657 of file ti_icdi_usb.c.

◆ icdi_usb_override_target()

static int icdi_usb_override_target ( const char *  targetname)
static

Definition at line 636 of file ti_icdi_usb.c.

◆ icdi_usb_query()

◆ icdi_usb_read_mem()

static int icdi_usb_read_mem ( void *  handle,
uint32_t  addr,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)
static

◆ icdi_usb_read_mem_int()

static int icdi_usb_read_mem_int ( void *  handle,
uint32_t  addr,
uint32_t  len,
uint8_t *  buffer 
)
static

◆ icdi_usb_read_reg()

static int icdi_usb_read_reg ( void *  handle,
unsigned int  regsel,
uint32_t *  val 
)
static

◆ icdi_usb_read_regs()

static int icdi_usb_read_regs ( void *  handle)
static

Definition at line 462 of file ti_icdi_usb.c.

References ERROR_OK.

◆ icdi_usb_reset()

static int icdi_usb_reset ( void *  handle)
static

Definition at line 393 of file ti_icdi_usb.c.

References ERROR_OK.

◆ icdi_usb_run()

static int icdi_usb_run ( void *  handle)
static

Definition at line 405 of file ti_icdi_usb.c.

References ERROR_FAIL, ERROR_OK, icdi_get_cmd_result(), icdi_send_cmd(), and LOG_ERROR.

◆ icdi_usb_state()

static enum target_state icdi_usb_state ( void *  handle)
static

Definition at line 275 of file ti_icdi_usb.c.

References addr, h_u32_to_le(), and icdi_usb_write_mem().

◆ icdi_usb_step()

static int icdi_usb_step ( void *  handle)
static

Definition at line 443 of file ti_icdi_usb.c.

References ERROR_FAIL, ERROR_OK, icdi_get_cmd_result(), icdi_send_cmd(), and LOG_ERROR.

◆ icdi_usb_version()

static int icdi_usb_version ( void *  handle)
static

◆ icdi_usb_write_debug_reg()

static int icdi_usb_write_debug_reg ( void *  handle,
uint32_t  addr,
uint32_t  val 
)
static

Definition at line 275 of file ti_icdi_usb.c.

◆ icdi_usb_write_mem()

static int icdi_usb_write_mem ( void *  handle,
uint32_t  addr,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)
static

Definition at line 608 of file ti_icdi_usb.c.

References addr, buffer, count, ERROR_OK, icdi_usb_write_mem_int(), icdi_usb_handle::max_rw_packet, and size.

Referenced by icdi_usb_state().

◆ icdi_usb_write_mem_int()

static int icdi_usb_write_mem_int ( void *  handle,
uint32_t  addr,
uint32_t  len,
const uint8_t *  buffer 
)
static

◆ icdi_usb_write_reg()

static int icdi_usb_write_reg ( void *  handle,
unsigned int  regsel,
uint32_t  val 
)
static

◆ remote_escape_output()

static int remote_escape_output ( const char *  buffer,
int  len,
char *  out_buf,
int *  out_len,
int  out_maxlen 
)
static

Definition at line 51 of file ti_icdi_usb.c.

References buffer.

Referenced by icdi_usb_write_mem_int().

◆ remote_unescape_input()

static int remote_unescape_input ( const char *  buffer,
int  len,
char *  out_buf,
int  out_maxlen 
)
static

Definition at line 78 of file ti_icdi_usb.c.

References buffer, and LOG_ERROR.

Referenced by icdi_usb_read_mem_int().

Variable Documentation

◆ icdi_usb_layout_api

struct hl_layout_api icdi_usb_layout_api
Initial value:
= {
.open = icdi_usb_open,
.close = icdi_usb_close,
.idcode = icdi_usb_idcode,
.state = icdi_usb_state,
.reset = icdi_usb_reset,
.assert_srst = icdi_usb_assert_srst,
.run = icdi_usb_run,
.halt = icdi_usb_halt,
.step = icdi_usb_step,
.read_regs = icdi_usb_read_regs,
.read_reg = icdi_usb_read_reg,
.write_reg = icdi_usb_write_reg,
.read_mem = icdi_usb_read_mem,
.write_mem = icdi_usb_write_mem,
.write_debug_reg = icdi_usb_write_debug_reg,
.override_target = icdi_usb_override_target,
.custom_command = icdi_send_remote_cmd,
}
static int icdi_send_remote_cmd(void *handle, const char *data)
Definition: ti_icdi_usb.c:229
static int icdi_usb_read_mem(void *handle, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: ti_icdi_usb.c:580
static int icdi_usb_override_target(const char *targetname)
Definition: ti_icdi_usb.c:636
static enum target_state icdi_usb_state(void *handle)
Definition: ti_icdi_usb.c:284
static int icdi_usb_assert_srst(void *handle, int srst)
Definition: ti_icdi_usb.c:399
static int icdi_usb_step(void *handle)
Definition: ti_icdi_usb.c:443
static int icdi_usb_idcode(void *handle, uint32_t *idcode)
Definition: ti_icdi_usb.c:269
static int icdi_usb_halt(void *handle)
Definition: ti_icdi_usb.c:424
static int icdi_usb_write_mem(void *handle, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: ti_icdi_usb.c:608
static int icdi_usb_close(void *handle)
Definition: ti_icdi_usb.c:641
static int icdi_usb_write_reg(void *handle, unsigned int regsel, uint32_t val)
Definition: ti_icdi_usb.c:497
static int icdi_usb_read_regs(void *handle)
Definition: ti_icdi_usb.c:462
static int icdi_usb_run(void *handle)
Definition: ti_icdi_usb.c:405
static int icdi_usb_open(struct hl_interface_param *param, void **fd)
Definition: ti_icdi_usb.c:657
static int icdi_usb_reset(void *handle)
Definition: ti_icdi_usb.c:393
static int icdi_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
Definition: ti_icdi_usb.c:275
static int icdi_usb_read_reg(void *handle, unsigned int regsel, uint32_t *val)
Definition: ti_icdi_usb.c:468

Definition at line 657 of file ti_icdi_usb.c.