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

Go to the source code of this file.

Macros

#define CPU_RESET   1
 
#define EZUSB_CPUCS   0xe600
 
#define SECTION_BUFFERSIZE   16384
 Maximum size of a single firmware section. More...
 
#define USBBLASTER_CTRL_LOAD_FIRM   0xA0
 
#define USBBLASTER_CTRL_READ_REV   0x94
 
#define USBBLASTER_EPIN   8
 
#define USBBLASTER_EPOUT   4
 

Functions

static int load_usb_blaster_firmware (struct libusb_device_handle *libusb_dev, struct ublast_lowlevel *low)
 
static int ublast2_libusb_init (struct ublast_lowlevel *low)
 
static int ublast2_libusb_quit (struct ublast_lowlevel *low)
 
static int ublast2_libusb_read (struct ublast_lowlevel *low, uint8_t *buf, unsigned size, uint32_t *bytes_read)
 
static int ublast2_libusb_write (struct ublast_lowlevel *low, uint8_t *buf, int size, uint32_t *bytes_written)
 
struct ublast_lowlevelublast2_register_libusb (void)
 
static int ublast2_write_firmware_section (struct libusb_device_handle *libusb_dev, struct image *firmware_image, int section_index)
 

Variables

static struct ublast_lowlevel low
 

Macro Definition Documentation

◆ CPU_RESET

#define CPU_RESET   1

Definition at line 27 of file ublast2_access_libusb.c.

◆ EZUSB_CPUCS

#define EZUSB_CPUCS   0xe600

Definition at line 26 of file ublast2_access_libusb.c.

◆ SECTION_BUFFERSIZE

#define SECTION_BUFFERSIZE   16384

Maximum size of a single firmware section.

Entire EZ-USB code space = 16kB

Definition at line 30 of file ublast2_access_libusb.c.

◆ USBBLASTER_CTRL_LOAD_FIRM

#define USBBLASTER_CTRL_LOAD_FIRM   0xA0

Definition at line 22 of file ublast2_access_libusb.c.

◆ USBBLASTER_CTRL_READ_REV

#define USBBLASTER_CTRL_READ_REV   0x94

Definition at line 21 of file ublast2_access_libusb.c.

◆ USBBLASTER_EPIN

#define USBBLASTER_EPIN   8

Definition at line 24 of file ublast2_access_libusb.c.

◆ USBBLASTER_EPOUT

#define USBBLASTER_EPOUT   4

Definition at line 23 of file ublast2_access_libusb.c.

Function Documentation

◆ load_usb_blaster_firmware()

static int load_usb_blaster_firmware ( struct libusb_device_handle *  libusb_dev,
struct ublast_lowlevel low 
)
static

A host loader program must write 0x01 to the CPUCS register to put the CPU into RESET, load all or part of the EZUSB RAM with firmware, then reload the CPUCS register with ‘0’ to take the CPU out of RESET. The CPUCS register (at 0xE600) is the only EZ-USB register that can be written using the Firmware Download command.

Definition at line 117 of file ublast2_access_libusb.c.

References image::base_address, image::base_address_set, CPU_RESET, ERROR_FAIL, ERROR_JTAG_INIT_FAILED, ERROR_OK, EZUSB_CPUCS, ublast_lowlevel::firmware_path, image_close(), image_open(), jtag_libusb_control_transfer(), LOG_ERROR, low, NULL, image::num_sections, ublast2_write_firmware_section(), and USBBLASTER_CTRL_LOAD_FIRM.

Referenced by ublast2_libusb_init().

◆ ublast2_libusb_init()

◆ ublast2_libusb_quit()

static int ublast2_libusb_quit ( struct ublast_lowlevel low)
static

Definition at line 259 of file ublast2_access_libusb.c.

◆ ublast2_libusb_read()

static int ublast2_libusb_read ( struct ublast_lowlevel low,
uint8_t *  buf,
unsigned  size,
uint32_t *  bytes_read 
)
static

◆ ublast2_libusb_write()

static int ublast2_libusb_write ( struct ublast_lowlevel low,
uint8_t *  buf,
int  size,
uint32_t *  bytes_written 
)
static

◆ ublast2_register_libusb()

struct ublast_lowlevel* ublast2_register_libusb ( void  )

Definition at line 276 of file ublast2_access_libusb.c.

References low.

◆ ublast2_write_firmware_section()

static int ublast2_write_firmware_section ( struct libusb_device_handle *  libusb_dev,
struct image firmware_image,
int  section_index 
)
static

Variable Documentation

◆ low

struct ublast_lowlevel low
static
Initial value:
= {
.flags = COPY_TDO_BUFFER,
}
static int ublast2_libusb_write(struct ublast_lowlevel *low, uint8_t *buf, int size, uint32_t *bytes_written)
static int ublast2_libusb_read(struct ublast_lowlevel *low, uint8_t *buf, unsigned size, uint32_t *bytes_read)
static int ublast2_libusb_quit(struct ublast_lowlevel *low)
static int ublast2_libusb_init(struct ublast_lowlevel *low)
#define COPY_TDO_BUFFER
Definition: ublast_access.h:21

Definition at line 259 of file ublast2_access_libusb.c.

Referenced by angie_append_set_signals_cmd(), angie_reset(), jtag_set_signals(), load_usb_blaster_firmware(), mem_ap_write(), parse_ranges(), ublast2_libusb_init(), ublast2_libusb_read(), ublast2_libusb_write(), ublast2_register_libusb(), ulink_append_set_signals_cmd(), and ulink_queue_reset().