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

Go to the source code of this file.

Data Structures

struct  angie
 Angie device main context. More...
 
struct  read_queue
 List of elements used in a multiple commands reply. More...
 
struct  read_queue_entry
 Entry element used to forge a reply buffer for openocd JTAG core. More...
 

Macros

#define ANGIE_BITSTREAM_FILE   PKGDATADIR "/angie/angie_bitstream.bit"
 Default location of ANGIE firmware image. More...
 
#define ANGIE_FIRMWARE_FILE   PKGDATADIR "/angie/angie_firmware.bin"
 Default location of ANGIE firmware image. More...
 
#define ANGIE_FW_SECTION_SIZE   16384
 Maximum size of a single firmware section. More...
 
#define ANGIE_NPROG_PID   0x424E /* ANGIE non programmed */
 
#define ANGIE_PROG_NXB2_PID   0x4a55 /* ANGIE programmed Nxbase2 */
 
#define ANGIE_PROG_OOCD_PID   0x414F /* ANGIE programmed OpenOCD */
 
#define ANGIE_RENUMERATION_DELAY_US   800000
 Delay (in microseconds) to wait while EZ-USB performs ReNumeration. More...
 
#define ANGIE_USB_BULK_SIZE   512
 
#define ANGIE_USB_TIMEOUT_MS   1000
 USB timeout delay in milliseconds. More...
 
#define ANGIE_VID   0x584E /* NX Vendor id */
 
#define ANGIE_XFER_BUFFER_TOTAL_SIZE   (16 * 1024)
 
#define CPU_RESET   0x01
 Value to write into CPUCS to put EZ-USB ANGIE into reset. More...
 
#define CPU_START   0x00
 Value to write into CPUCS to put EZ-USB ANGIE out of reset. More...
 
#define CPUCS_REG   0xE600
 Address of EZ-USB ANGIE CPU Control & Status register. More...
 
#define FIRMWARE_ADDR   0x0000
 Base address of firmware in EZ-USB ANGIE code space. More...
 
#define IN_EP   0x84
 USB endpoints. More...
 
#define NSYSRST_GPIO   6
 
#define NTRST_GPIO   4
 
#define OUT_EP   0x02
 
#define REQUEST_FIRMWARE_LOAD   0xA0
 USB Control EP0 bRequest: "Firmware Load". More...
 
#define TCK_GPIO   0
 
#define TDI_GPIO   1
 
#define TDO_GPIO   2
 
#define TMS_GPIO   3
 
#define VR_CFGOPEN   0xB0
 Vendor Requests. More...
 
#define VR_DATAOUTOPEN   0xB2
 

Functions

static int angie_buffer_append (struct angie *device, int tck, int tms, int tdi)
 Append a bit-bang JTAG value to the transfer buffer. More...
 
static int angie_buffer_append_simple (struct angie *device, uint8_t value)
 Append a single byte value to the transfer buffer. More...
 
static int angie_buffer_flush (struct angie *device)
 Flush Angie transfer buffer. More...
 
static int angie_buffer_flush_check (struct angie *device, size_t size)
 Check if transfer buffer has enough remaining space for a given size. More...
 
static int angie_buffer_flush_chunk (struct angie *device, int xfer_size, int offset, int *bytes_sent)
 Flush a chunk of Angie's buffer. More...
 
static size_t angie_cmd_size (struct angie *device, const struct jtag_command *cmd)
 Process command size in bytes. More...
 
static int angie_cpu_reset (struct angie *device, char reset_bit)
 Writes '0' or '1' to the CPUCS register, putting the EZ-USB CPU into reset or out of reset. More...
 
static int angie_init (void)
 Angie initialization method. More...
 
static bool angie_is_firmware_needed (struct angie *device)
 Check if Angie firmware must be updated. More...
 
static int angie_jtag_execute_pathmove (struct angie *device, const struct pathmove_command *cmd)
 Execute JTAG PATHMOVE command. More...
 
static int angie_jtag_execute_queue (struct jtag_command *cmd_queue)
 Execute JTAG commands queue. More...
 
static int angie_jtag_execute_reset (struct angie *device, const struct reset_command *cmd)
 Execute JTAG RESET command Control /TRST and /SYSRST pins. More...
 
static int angie_jtag_execute_runtest (struct angie *device, const struct runtest_command *cmd)
 Execute JTAG RUNTEST command. More...
 
static int angie_jtag_execute_scan (struct angie *device, const struct scan_command *cmd)
 Execute JTAG SCAN command. More...
 
static int angie_jtag_execute_stableclocks (struct angie *device, const struct stableclocks_command *cmd)
 Execute JTAG STABLECLOCKS command Issues a number of clock cycles while staying in a stable state. More...
 
static int angie_jtag_execute_statemove (struct angie *device, const struct statemove_command *cmd)
 Execute JTAG STATEMOVE command. More...
 
static int angie_jtag_execute_tms (struct angie *device, const struct tms_command *cmd)
 Execute JTAG TMS command Clock a bunch of TMS transitions, to change the JTAG state machine. More...
 
static int angie_jtag_runtest_size (struct angie *device, const struct runtest_command *cmd)
 Return JTAG RUNTEST command size in bytes. More...
 
static int angie_jtag_scan_size (struct angie *device, const struct scan_command *cmd)
 Return JTAG SCAN command size in bytes. More...
 
static int angie_khz (int khz, int *divisor)
 Angie set khz method. More...
 
static int angie_load_bitstream (struct angie *device, const char *filename)
 Downloads a bitstream file to the ANGIE's FPGA through the EZ-USB microcontroller over the USB bus. More...
 
static int angie_load_firmware (struct angie *device, const char *filename)
 Downloads a firmware image to the ANGIE's EZ-USB microcontroller over the USB bus. More...
 
static int angie_load_firmware_and_renumerate (struct angie *device, const char *filename, uint32_t delay_us)
 Puts the ANGIE's EZ-USB microcontroller into reset state, downloads the firmware image, resumes the microcontroller and re-enumerates USB devices. More...
 
static int angie_quit (void)
 Angie quit method. More...
 
static void angie_read_queue_add (struct read_queue *queue, struct read_queue_entry *entry)
 Add a single entry to the read queue. More...
 
static void angie_read_queue_clean (struct read_queue *queue)
 Clear the read queue list. More...
 
static void angie_read_queue_execute (struct read_queue *queue, struct angie *device)
 Execute elements enqueued in the read queue list. More...
 
static void angie_read_queue_init (struct read_queue *queue)
 Init read queue list. More...
 
static void angie_set_end_state (enum tap_state state)
 Set TAP end state. More...
 
static int angie_speed (int divisor)
 Angie set speed method. More...
 
static int angie_speed_div (int divisor, int *khz)
 Angie set speed div. More...
 
static int angie_state_move (struct angie *device, int skip)
 Move TAP to given state. More...
 
static int angie_usb_close (struct angie *device)
 Releases the ANGIE interface and closes the USB device handle. More...
 
static int angie_usb_open (struct angie *device)
 Open Angie USB interface. More...
 
static int angie_write_firmware_section (struct angie *device, uint16_t address, uint8_t *data, size_t size)
 Send one contiguous firmware section to the ANGIE's EZ-USB microcontroller over the USB bus. More...
 

Variables

struct adapter_driver angie_adapter_driver
 
struct angieangie_handle
 Angie device singleton. More...
 
static struct jtag_interface angie_interface
 

Macro Definition Documentation

◆ ANGIE_BITSTREAM_FILE

#define ANGIE_BITSTREAM_FILE   PKGDATADIR "/angie/angie_bitstream.bit"

Default location of ANGIE firmware image.

Definition at line 73 of file angie.c.

◆ ANGIE_FIRMWARE_FILE

#define ANGIE_FIRMWARE_FILE   PKGDATADIR "/angie/angie_firmware.bin"

Default location of ANGIE firmware image.

Definition at line 70 of file angie.c.

◆ ANGIE_FW_SECTION_SIZE

#define ANGIE_FW_SECTION_SIZE   16384

Maximum size of a single firmware section.

Entire EZ-USB ANGIE code space = 16kB

Definition at line 79 of file angie.c.

◆ ANGIE_NPROG_PID

#define ANGIE_NPROG_PID   0x424E /* ANGIE non programmed */

Definition at line 86 of file angie.c.

◆ ANGIE_PROG_NXB2_PID

#define ANGIE_PROG_NXB2_PID   0x4a55 /* ANGIE programmed Nxbase2 */

Definition at line 88 of file angie.c.

◆ ANGIE_PROG_OOCD_PID

#define ANGIE_PROG_OOCD_PID   0x414F /* ANGIE programmed OpenOCD */

Definition at line 87 of file angie.c.

◆ ANGIE_RENUMERATION_DELAY_US

#define ANGIE_RENUMERATION_DELAY_US   800000

Delay (in microseconds) to wait while EZ-USB performs ReNumeration.

Definition at line 67 of file angie.c.

◆ ANGIE_USB_BULK_SIZE

#define ANGIE_USB_BULK_SIZE   512

Definition at line 98 of file angie.c.

◆ ANGIE_USB_TIMEOUT_MS

#define ANGIE_USB_TIMEOUT_MS   1000

USB timeout delay in milliseconds.

Definition at line 101 of file angie.c.

◆ ANGIE_VID

#define ANGIE_VID   0x584E /* NX Vendor id */

Definition at line 85 of file angie.c.

◆ ANGIE_XFER_BUFFER_TOTAL_SIZE

#define ANGIE_XFER_BUFFER_TOTAL_SIZE   (16 * 1024)

Definition at line 97 of file angie.c.

◆ CPU_RESET

#define CPU_RESET   0x01

Value to write into CPUCS to put EZ-USB ANGIE into reset.

Definition at line 58 of file angie.c.

◆ CPU_START

#define CPU_START   0x00

Value to write into CPUCS to put EZ-USB ANGIE out of reset.

Definition at line 61 of file angie.c.

◆ CPUCS_REG

#define CPUCS_REG   0xE600

Address of EZ-USB ANGIE CPU Control & Status register.

This register can be written by issuing a Control EP0 vendor request.

Definition at line 52 of file angie.c.

◆ FIRMWARE_ADDR

#define FIRMWARE_ADDR   0x0000

Base address of firmware in EZ-USB ANGIE code space.

Definition at line 64 of file angie.c.

◆ IN_EP

#define IN_EP   0x84

USB endpoints.

Definition at line 45 of file angie.c.

◆ NSYSRST_GPIO

#define NSYSRST_GPIO   6

Definition at line 95 of file angie.c.

◆ NTRST_GPIO

#define NTRST_GPIO   4

Definition at line 94 of file angie.c.

◆ OUT_EP

#define OUT_EP   0x02

Definition at line 46 of file angie.c.

◆ REQUEST_FIRMWARE_LOAD

#define REQUEST_FIRMWARE_LOAD   0xA0

USB Control EP0 bRequest: "Firmware Load".

Definition at line 55 of file angie.c.

◆ TCK_GPIO

#define TCK_GPIO   0

Definition at line 90 of file angie.c.

◆ TDI_GPIO

#define TDI_GPIO   1

Definition at line 91 of file angie.c.

◆ TDO_GPIO

#define TDO_GPIO   2

Definition at line 92 of file angie.c.

◆ TMS_GPIO

#define TMS_GPIO   3

Definition at line 93 of file angie.c.

◆ VR_CFGOPEN

#define VR_CFGOPEN   0xB0

Vendor Requests.

Definition at line 82 of file angie.c.

◆ VR_DATAOUTOPEN

#define VR_DATAOUTOPEN   0xB2

Definition at line 83 of file angie.c.

Function Documentation

◆ angie_buffer_append()

static int angie_buffer_append ( struct angie device,
int  tck,
int  tms,
int  tdi 
)
static

Append a bit-bang JTAG value to the transfer buffer.

Parameters
deviceAngie device pointer
tckvalue
tmsvalue
tdivalue
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 354 of file angie.c.

References angie_buffer_append_simple(), device, NSYSRST_GPIO, NTRST_GPIO, TCK_GPIO, TDI_GPIO, and TMS_GPIO.

Referenced by angie_jtag_execute_pathmove(), angie_jtag_execute_runtest(), angie_jtag_execute_scan(), angie_jtag_execute_stableclocks(), angie_jtag_execute_tms(), and angie_state_move().

◆ angie_buffer_append_simple()

static int angie_buffer_append_simple ( struct angie device,
uint8_t  value 
)
static

Append a single byte value to the transfer buffer.

Parameters
deviceAngie device pointer
valueto append
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 334 of file angie.c.

References angie_buffer_flush(), ANGIE_XFER_BUFFER_TOTAL_SIZE, device, and ERROR_OK.

Referenced by angie_buffer_append(), and angie_jtag_execute_reset().

◆ angie_buffer_flush()

static int angie_buffer_flush ( struct angie device)
static

Flush Angie transfer buffer.

Flush is done by chunks of 512 bytes to match hardware internal FIFOs. Then the read queue list is executed once the read buffer has been retrieved.

Parameters
deviceAngie device pointer
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 289 of file angie.c.

References angie_buffer_flush_chunk(), angie_read_queue_execute(), ANGIE_USB_BULK_SIZE, device, ERROR_OK, and MIN.

Referenced by angie_buffer_append_simple(), angie_buffer_flush_check(), and angie_jtag_execute_queue().

◆ angie_buffer_flush_check()

static int angie_buffer_flush_check ( struct angie device,
size_t  size 
)
static

Check if transfer buffer has enough remaining space for a given size.

If the buffer is not large enough, flush it.

Parameters
deviceAngie device pointer
sizeto check
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 320 of file angie.c.

References angie_buffer_flush(), ANGIE_XFER_BUFFER_TOTAL_SIZE, device, ERROR_OK, and size.

Referenced by angie_jtag_execute_queue().

◆ angie_buffer_flush_chunk()

static int angie_buffer_flush_chunk ( struct angie device,
int  xfer_size,
int  offset,
int *  bytes_sent 
)
static

Flush a chunk of Angie's buffer.

USB write is done by configuring GPIF register on the target and calling a USB bulk transfer. Sequentially a USB read transferred is issued of the same size. All the operation are synchronous. Then the read queue list is executed once the read buffer has been retrieved.

Parameters
deviceAngie device pointer
xfer_sizeamount of bytes to transfer
offsettotal bytes already sent during this transfer, this will offset the receive buffer accordingly
bytes_sentwill contain the amount of bytes sent
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 230 of file angie.c.

References ANGIE_USB_TIMEOUT_MS, device, ERROR_FAIL, ERROR_OK, h_u32_to_be(), IN_EP, jtag_libusb_bulk_read(), jtag_libusb_bulk_write(), jtag_libusb_control_transfer(), LOG_ERROR, NULL, offset, OUT_EP, and VR_DATAOUTOPEN.

Referenced by angie_buffer_flush().

◆ angie_cmd_size()

static size_t angie_cmd_size ( struct angie device,
const struct jtag_command cmd 
)
static

Process command size in bytes.

Parameters
deviceAngie device pointer
cmdJTAG command
Returns
command size in the transfer buffer in bytes

Definition at line 1109 of file angie.c.

References angie_jtag_runtest_size(), angie_jtag_scan_size(), cmd, device, JTAG_PATHMOVE, JTAG_RESET, JTAG_RUNTEST, JTAG_SCAN, JTAG_SLEEP, JTAG_STABLECLOCKS, JTAG_TLR_RESET, JTAG_TMS, LOG_DEBUG_IO, LOG_ERROR, tap_get_state(), and tap_get_tms_path_len().

Referenced by angie_jtag_execute_queue().

◆ angie_cpu_reset()

static int angie_cpu_reset ( struct angie device,
char  reset_bit 
)
static

Writes '0' or '1' to the CPUCS register, putting the EZ-USB CPU into reset or out of reset.

Parameters
deviceAngie device pointer
reset_bit0 to put CPU into reset, 1 to put CPU out of reset.
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 431 of file angie.c.

References ANGIE_USB_TIMEOUT_MS, CPUCS_REG, device, jtag_libusb_control_transfer(), NULL, and REQUEST_FIRMWARE_LOAD.

Referenced by angie_load_firmware().

◆ angie_init()

static int angie_init ( void  )
static

◆ angie_is_firmware_needed()

static bool angie_is_firmware_needed ( struct angie device)
static

Check if Angie firmware must be updated.

Parameters
deviceAngie device pointer
Returns
true if update is needed, false otherwise

Definition at line 679 of file angie.c.

References angie_handle, ANGIE_PROG_OOCD_PID, and angie::usbdev.

Referenced by angie_init().

◆ angie_jtag_execute_pathmove()

static int angie_jtag_execute_pathmove ( struct angie device,
const struct pathmove_command cmd 
)
static

Execute JTAG PATHMOVE command.

Parameters
deviceAngie device pointer
cmdPATHMOVE command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1059 of file angie.c.

References angie_buffer_append(), cmd, device, ERROR_JTAG_DEVICE_ERROR, ERROR_OK, LOG_DEBUG_IO, LOG_ERROR, tap_get_state(), tap_set_end_state(), tap_set_state, tap_state_name(), and tap_state_transition().

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_execute_queue()

◆ angie_jtag_execute_reset()

static int angie_jtag_execute_reset ( struct angie device,
const struct reset_command cmd 
)
static

Execute JTAG RESET command Control /TRST and /SYSRST pins.

Perform immediate bitbang transaction.

Parameters
deviceAngie device pointer
cmdRESET command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 981 of file angie.c.

References angie_buffer_append_simple(), cmd, device, jtag_get_reset_config(), LOG_DEBUG_IO, NSYSRST_GPIO, NTRST_GPIO, RESET_SRST_PULLS_TRST, TAP_RESET, and tap_set_state.

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_execute_runtest()

static int angie_jtag_execute_runtest ( struct angie device,
const struct runtest_command cmd 
)
static

Execute JTAG RUNTEST command.

Parameters
deviceAngie device pointer
cmdSCAN command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 901 of file angie.c.

References angie_buffer_append(), angie_set_end_state(), angie_state_move(), cmd, device, ERROR_OK, LOG_DEBUG_IO, tap_get_end_state(), tap_get_state(), and TAP_IDLE.

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_execute_scan()

static int angie_jtag_execute_scan ( struct angie device,
const struct scan_command cmd 
)
static

◆ angie_jtag_execute_stableclocks()

static int angie_jtag_execute_stableclocks ( struct angie device,
const struct stableclocks_command cmd 
)
static

Execute JTAG STABLECLOCKS command Issues a number of clock cycles while staying in a stable state.

Because the TMS value required to stay in the RESET state is a 1, whereas the TMS value required to stay in any of the other stable states is a 0, this function checks the current stable state to decide on the value of TMS to use.

Parameters
deviceAngie device pointer
cmdSTABLECLOCKS command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1016 of file angie.c.

References angie_buffer_append(), cmd, device, ERROR_OK, LOG_DEBUG_IO, tap_get_state(), TAP_RESET, and tap_state_name().

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_execute_statemove()

static int angie_jtag_execute_statemove ( struct angie device,
const struct statemove_command cmd 
)
static

Execute JTAG STATEMOVE command.

Parameters
deviceAngie device pointer
cmdSTATEMOVE command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1044 of file angie.c.

References angie_set_end_state(), angie_state_move(), cmd, device, LOG_DEBUG_IO, and tap_state_name().

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_execute_tms()

static int angie_jtag_execute_tms ( struct angie device,
const struct tms_command cmd 
)
static

Execute JTAG TMS command Clock a bunch of TMS transitions, to change the JTAG state machine.

Parameters
deviceAngie device pointer
cmdTMS command
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 950 of file angie.c.

References angie_buffer_append(), bits, cmd, device, ERROR_OK, and LOG_DEBUG_IO.

Referenced by angie_jtag_execute_queue().

◆ angie_jtag_runtest_size()

static int angie_jtag_runtest_size ( struct angie device,
const struct runtest_command cmd 
)
static

Return JTAG RUNTEST command size in bytes.

Parameters
deviceAngie device pointer
cmdRUNTEST command
Returns
size of command in the transfer buffer in bytes

Definition at line 880 of file angie.c.

References cmd, tap_get_end_state(), tap_get_state(), tap_get_tms_path_len(), and TAP_IDLE.

Referenced by angie_cmd_size().

◆ angie_jtag_scan_size()

static int angie_jtag_scan_size ( struct angie device,
const struct scan_command cmd 
)
static

Return JTAG SCAN command size in bytes.

Parameters
deviceAngie device pointer
cmdSCAN command
Returns
size of command in the transfer buffer in bytes

Definition at line 750 of file angie.c.

References cmd, count, jtag_scan_size(), TAP_DRSHIFT, tap_get_state(), tap_get_tms_path_len(), and TAP_IRSHIFT.

Referenced by angie_cmd_size().

◆ angie_khz()

static int angie_khz ( int  khz,
int *  divisor 
)
static

Angie set khz method.

Parameters
khz
divisorreturned to caller
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1320 of file angie.c.

References ERROR_FAIL, ERROR_OK, and LOG_DEBUG.

◆ angie_load_bitstream()

static int angie_load_bitstream ( struct angie device,
const char *  filename 
)
static

Downloads a bitstream file to the ANGIE's FPGA through the EZ-USB microcontroller over the USB bus.

Parameters
deviceAngie device pointer
filenamean absolute or relative path to the Xilinx .bit file containing the bitstream data.
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 607 of file angie.c.

References ANGIE_USB_TIMEOUT_MS, device, ERROR_FAIL, ERROR_OK, h_u32_to_be(), jtag_libusb_bulk_write(), jtag_libusb_control_transfer(), LOG_ERROR, LOG_INFO, NULL, OUT_EP, and VR_CFGOPEN.

Referenced by angie_init().

◆ angie_load_firmware()

static int angie_load_firmware ( struct angie device,
const char *  filename 
)
static

Downloads a firmware image to the ANGIE's EZ-USB microcontroller over the USB bus.

Parameters
deviceAngie device pointer
filenamean absolute or relative path to the Intel HEX file containing the firmware image.
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 494 of file angie.c.

References addr, angie_cpu_reset(), ANGIE_FW_SECTION_SIZE, angie_write_firmware_section(), imagesection::base_address, image::base_address, image::base_address_set, CPU_RESET, CPU_START, device, ERROR_FAIL, ERROR_OK, image_close(), image_open(), image_read_section(), LOG_DEBUG, LOG_ERROR, image::num_sections, image::sections, size, and imagesection::size.

Referenced by angie_load_firmware_and_renumerate().

◆ angie_load_firmware_and_renumerate()

static int angie_load_firmware_and_renumerate ( struct angie device,
const char *  filename,
uint32_t  delay_us 
)
static

Puts the ANGIE's EZ-USB microcontroller into reset state, downloads the firmware image, resumes the microcontroller and re-enumerates USB devices.

Parameters
deviceAngie device pointer The usb_handle member will be modified during re-enumeration.
filenamepath to the Intel HEX file containing the firmware image.
delay_usthe delay to wait for the device to re-enumerate.
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 568 of file angie.c.

References angie_handle, angie_load_firmware(), angie_usb_close(), angie_usb_open(), delay_us(), device, ERROR_FAIL, ERROR_OK, and angie::usbdev.

Referenced by angie_init().

◆ angie_quit()

static int angie_quit ( void  )
static

Angie quit method.

Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1225 of file angie.c.

References angie_handle, angie_read_queue_clean(), angie_usb_close(), ERROR_OK, NULL, and angie::read_queue.

Referenced by angie_init().

◆ angie_read_queue_add()

static void angie_read_queue_add ( struct read_queue queue,
struct read_queue_entry entry 
)
static

Add a single entry to the read queue.

Parameters
queueread queue list
entryto append

Definition at line 154 of file angie.c.

References read_queue_entry::list, and list_add_tail().

Referenced by angie_jtag_execute_scan().

◆ angie_read_queue_clean()

static void angie_read_queue_clean ( struct read_queue queue)
static

Clear the read queue list.

Parameters
queueread queue list

Definition at line 202 of file angie.c.

References read_queue_entry::buffer, read_queue_entry::list, list_del(), and list_for_each_entry_safe.

Referenced by angie_quit().

◆ angie_read_queue_execute()

static void angie_read_queue_execute ( struct read_queue queue,
struct angie device 
)
static

Execute elements enqueued in the read queue list.

Parameters
queueread queue list
devicepointer on the angie device

Definition at line 166 of file angie.c.

References read_queue_entry::buffer, read_queue_entry::cmd, device, jtag_read_buffer(), jtag_scan_size(), read_queue_entry::list, list_del(), list_for_each_entry_safe, read_queue_entry::reply_buffer_offset, and TDO_GPIO.

Referenced by angie_buffer_flush().

◆ angie_read_queue_init()

static void angie_read_queue_init ( struct read_queue queue)
static

Init read queue list.

Parameters
queuepointer on the read queue head

Definition at line 142 of file angie.c.

References INIT_LIST_HEAD().

Referenced by angie_init().

◆ angie_set_end_state()

static void angie_set_end_state ( enum tap_state  state)
static

Set TAP end state.

Parameters
state

Definition at line 700 of file angie.c.

References LOG_ERROR, state, tap_is_state_stable(), and tap_set_end_state().

Referenced by angie_jtag_execute_runtest(), angie_jtag_execute_scan(), and angie_jtag_execute_statemove().

◆ angie_speed()

static int angie_speed ( int  divisor)
static

Angie set speed method.

Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1303 of file angie.c.

References ERROR_OK, and LOG_DEBUG.

◆ angie_speed_div()

static int angie_speed_div ( int  divisor,
int *  khz 
)
static

Angie set speed div.

Parameters
divisor
khzreturned to caller
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 1347 of file angie.c.

◆ angie_state_move()

static int angie_state_move ( struct angie device,
int  skip 
)
static

Move TAP to given state.

Parameters
deviceAngie device pointer
skipnumber of state to skip during move
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 717 of file angie.c.

References angie_buffer_append(), device, ERROR_OK, tap_get_end_state(), tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), and tap_set_state.

Referenced by angie_jtag_execute_runtest(), angie_jtag_execute_scan(), and angie_jtag_execute_statemove().

◆ angie_usb_close()

static int angie_usb_close ( struct angie device)
static

Releases the ANGIE interface and closes the USB device handle.

Parameters
deviceAngie device pointer
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 406 of file angie.c.

References device, ERROR_FAIL, ERROR_OK, jtag_libusb_close(), LOG_ERROR, and NULL.

Referenced by angie_load_firmware_and_renumerate(), and angie_quit().

◆ angie_usb_open()

static int angie_usb_open ( struct angie device)
static

Open Angie USB interface.

Parameters
deviceAngie device pointer
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 373 of file angie.c.

References ANGIE_NPROG_PID, ANGIE_PROG_NXB2_PID, ANGIE_PROG_OOCD_PID, ANGIE_VID, device, ERROR_OK, jtag_libusb_open(), LOG_ERROR, and NULL.

Referenced by angie_init(), and angie_load_firmware_and_renumerate().

◆ angie_write_firmware_section()

static int angie_write_firmware_section ( struct angie device,
uint16_t  address,
uint8_t *  data,
size_t  size 
)
static

Send one contiguous firmware section to the ANGIE's EZ-USB microcontroller over the USB bus.

Parameters
deviceAngie device pointer
addressaddress of the firmware section
datapointer to the data to be sent
sizesize of the data
Returns
ERROR_OK on success, negative error code otherwise

Definition at line 449 of file angie.c.

References address, ANGIE_USB_TIMEOUT_MS, device, ERROR_FAIL, ERROR_OK, FIRMWARE_ADDR, jtag_libusb_control_transfer(), REQUEST_FIRMWARE_LOAD, and size.

Referenced by angie_load_firmware().

Variable Documentation

◆ angie_adapter_driver

struct adapter_driver angie_adapter_driver
Initial value:
= {
.name = "angie",
.transport_ids = TRANSPORT_JTAG,
.transport_preferred_id = TRANSPORT_JTAG,
.init = angie_init,
.quit = angie_quit,
.speed = angie_speed,
.khz = angie_khz,
.speed_div = angie_speed_div,
.jtag_ops = &angie_interface,
}
static int angie_init(void)
Angie initialization method.
Definition: angie.c:1247
static struct jtag_interface angie_interface
Definition: angie.c:1359
static int angie_speed(int divisor)
Angie set speed method.
Definition: angie.c:1303
static int angie_khz(int khz, int *divisor)
Angie set khz method.
Definition: angie.c:1320
static int angie_quit(void)
Angie quit method.
Definition: angie.c:1225
static int angie_speed_div(int divisor, int *khz)
Angie set speed div.
Definition: angie.c:1347
#define TRANSPORT_JTAG
Definition: transport.h:19

Definition at line 1347 of file angie.c.

◆ angie_handle

struct angie* angie_handle

Angie device singleton.

Definition at line 135 of file angie.c.

Referenced by angie_init(), angie_is_firmware_needed(), angie_jtag_execute_queue(), angie_load_firmware_and_renumerate(), and angie_quit().

◆ angie_interface

struct jtag_interface angie_interface
static
Initial value:
= {
.supported = DEBUG_CAP_TMS_SEQ,
.execute_queue = angie_jtag_execute_queue,
}
static int angie_jtag_execute_queue(struct jtag_command *cmd_queue)
Execute JTAG commands queue.
Definition: angie.c:1142
#define DEBUG_CAP_TMS_SEQ
Definition: interface.h:188

Definition at line 1347 of file angie.c.