Skip to content

Legacy:API

Bence Cs edited this page Oct 27, 2018 · 3 revisions

Legacy driver API

This document summarizes the API of the legacy driver

logsys-common.h

TO_WORD

This macro creates a 16-bit word from the high and low bytes. This is because LibUSB does the host-endian -> little endian (USB endian) conversion of outgoing traffic for us, but not the other way around.

LogsysStatus

This struct holds the response of logsys_tx_get_status(). See also: logsys-status.h

LogsysClkStatus

This struct holds the response of logsys_tx_clk_status(). See also: logsys-status.h

LogsysPwrLimit

This enumeration represents the over-current detector's mode on the VCC pin

LogsysFunction

The response of logsys_tx_get_active_func().

JTAG_RW: JTAG Write & Echo mode: data from the FPGA board's TAP controller is sent back via USB

JTAG_CHK: JTAG Write & Compare mode: the computer sends the expected response to the dev cable, and the cable responds whether it matched or not. See logsys_jtag_check_error()

LogsysJtagMode

JTAG modes, see above.

logsys_create_clk_status()

Calculate clock registers for the given frequency. Note: currently, the active flag is not set by this method!

logsys-status.h

Parsing of individual items in the structs. The method names are self-descriptive

logsys-usb.h

logsys_hotplug_enable()

evt_type: the type of event to listen for (connect, disconnect etc.)

callback: a function pointer

hndl: a handle. Make sure you pass it to libusb_hotplug_deregister_callback() on exit!

You will need to call libusb_handle_events_completed() in the main thread

logsys_tx_get_status

logsys_tx_clk_status

Reads power & clock status

logsys_clk_start

logsys_clk_stop

Starts/stops the clock connected to the FPGA's CLK input.

logsys_tx_set_reset

logsys_tx_get_reset

Sets/gets the RST pin's value

logsys_tx_get_pwr_limit

logsys_tx_set_pwr_limit

Gets/sets the maximum amount of current allowed to flow from the cable to the FPGA. See also: LogsysPwrLimit

logsys_tx_get_pwr_corr

Gets the correction coefficients. There's no struct for it currently.

logsys_tx_set_vcc

logsys_tx_get_vcc

Sets/gets the VCC pin

logsys_tx_get_rev_curr

logsys_tx_set_rev_curr

Gets/sets the reverse current tolerance. Values in milliamps.

logsys_tx_get_active_func

Gets the active function on EP1/EP2 endpoints

logsys_tx_jtag_begin

logsys_tx_jtag_end

JTAG open/close methods. Currently, there's no method to writing to the interface, apart from directly bulk transferring to EP1/EP2.

logsys_tx_serial_begin

logsys_tx_serial_end

Serial port open/close methods. Currently, there's no method to writing to the interface, apart from directly bulk transferring to EP3/EP4.

logsys_jtag_scan

Performs a boundary-scan. Must be in Write&Echo JTAG mode!

logsys_jtag_get_mode

logsys_jtag_set_mode

Gets/sets the JTAG mode

logsys_jtag_check_error

In Write&Compare mode, checks the result of the comparison