20 #ifndef LIBJAYLINK_LIBJAYLINK_H 21 #define LIBJAYLINK_LIBJAYLINK_H 30 #include <arpa/inet.h> 90 #define JAYLINK_LOG_DOMAIN_DEFAULT "jaylink: " 93 #define JAYLINK_LOG_DOMAIN_MAX_LENGTH 32 339 char hid[INET_ADDRSTRLEN];
353 #define JAYLINK_SPEED_ADAPTIVE_CLOCKING 0xffff 356 #define JAYLINK_DEV_CONFIG_SIZE 256 359 #define JAYLINK_DEV_CAPS_SIZE 4 362 #define JAYLINK_DEV_EXT_CAPS_SIZE 32 365 #define JAYLINK_MAX_CONNECTIONS 16 368 #define JAYLINK_MAC_ADDRESS_LENGTH 6 374 #define JAYLINK_NICKNAME_MAX_LENGTH 32 380 #define JAYLINK_PRODUCT_NAME_MAX_LENGTH 32 383 #define JAYLINK_FILE_NAME_MAX_LENGTH 255 386 #define JAYLINK_FILE_MAX_TRANSFER_SIZE 0x100000 394 #define JAYLINK_EMUCOM_CHANNEL_TIME 0x0 402 #define JAYLINK_EMUCOM_CHANNEL_USER 0x10000 429 #define JAYLINK_API __attribute__ ((visibility ("default"))) 470 uint8_t **ports,
size_t *
length);
496 uint32_t
mask, uint32_t *values);
529 uint32_t channel,
const uint8_t *
buffer, uint32_t *
length);
542 const char *filename,
const uint8_t *
buffer, uint32_t
offset,
545 const char *filename, uint32_t *
size);
547 const char *filename);
552 const uint8_t *tms,
const uint8_t *tdi, uint8_t *tdo,
578 const uint8_t *
direction,
const uint8_t *out, uint8_t *in,
JAYLINK_API int jaylink_device_get_ipv4_address(const struct jaylink_device *dev, char *address)
Get the IPv4 address string of a device.
jaylink_host_interface
Host interfaces.
Current consumption of the target in mA.
JAYLINK_API int jaylink_register(struct jaylink_device_handle *devh, struct jaylink_connection *connection, struct jaylink_connection *connections, size_t *count)
Register a connection on a device.
JAYLINK_API struct jaylink_device * jaylink_ref_device(struct jaylink_device *dev)
Increment the reference count of a device.
Joint Test Action Group, IEEE 1149.1 (JTAG).
JAYLINK_API bool jaylink_has_cap(const uint8_t *caps, uint32_t cap)
Check for a capability.
JAYLINK_API int jaylink_clear_reset(struct jaylink_device_handle *devh)
Clear the target reset signal.
JAYLINK_API int jaylink_version_library_get_current(void)
Get the current version number of the libjaylink libtool interface.
JAYLINK_API int jaylink_write_raw_config(struct jaylink_device_handle *devh, const uint8_t *config)
Write the raw configuration data of a device.
jaylink_usb_address
USB addresses.
JAYLINK_API int jaylink_swo_stop(struct jaylink_device_handle *devh)
Stop SWO capture.
JAYLINK_API int jaylink_device_get_product_name(const struct jaylink_device *dev, char *name)
Get the product name of a device.
static uint16_t direction
jaylink_counter
Device counters.
JAYLINK_API int jaylink_swo_get_speeds(struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, struct jaylink_swo_speed *speed)
Retrieve SWO speeds.
JAYLINK_API int jaylink_init(struct jaylink_context **ctx)
Initialize libjaylink.
JAYLINK_API int jaylink_file_get_size(struct jaylink_device_handle *devh, const char *filename, uint32_t *size)
Retrieve the size of a file.
JAYLINK_API int jaylink_get_hardware_status(struct jaylink_device_handle *devh, struct jaylink_hardware_status *status)
Retrieve the hardware status of a device.
jaylink_log_level
libjaylink log levels.
JAYLINK_API int jaylink_emucom_write(struct jaylink_device_handle *devh, uint32_t channel, const uint8_t *buffer, uint32_t *length)
Write to an EMUCOM channel.
Device supports retrieval of counter values.
JAYLINK_API int jaylink_set_speed(struct jaylink_device_handle *devh, uint16_t speed)
Set the target interface speed.
JAYLINK_API int jaylink_unregister(struct jaylink_device_handle *devh, const struct jaylink_connection *connection, struct jaylink_connection *connections, size_t *count)
Unregister a connection from a device.
uint32_t freq
Base frequency in Hz.
IPv4 netmask in network byte order.
Library supports USB as host interface.
JAYLINK_API int jaylink_swd_io(struct jaylink_device_handle *devh, const uint8_t *direction, const uint8_t *out, uint8_t *in, uint16_t length)
Perform a SWD I/O operation.
JAYLINK_API int jaylink_log_set_level(struct jaylink_context *ctx, enum jaylink_log_level level)
Set the libjaylink log level.
Device's IPv4 address in network byte order.
JAYLINK_API int jaylink_version_library_get_age(void)
Get the age version number of the libjaylink libtool interface.
JAYLINK_API int jaylink_get_selected_interface(struct jaylink_device_handle *devh, enum jaylink_target_interface *iface)
Retrieve the selected target interface.
JAYLINK_API int jaylink_version_package_get_minor(void)
Get the minor version number of the libjaylink package.
static libusb_device ** devs
The usb device list.
JAYLINK_API int jaylink_open(struct jaylink_device *dev, struct jaylink_device_handle **devh)
Open a device.
uint8_t minor
Minor version.
JAYLINK_API int jaylink_get_firmware_version(struct jaylink_device_handle *devh, char **version, size_t *length)
Retrieve the firmware version of a device.
Universal Serial Bus (USB).
uint32_t max_div
Maximum frequency divider.
USB address 2 (Product ID 0x0103).
Opaque structure representing a device.
jaylink_swo_mode
Serial Wire Output (SWO) capture modes.
static uint8_t caps[JAYLINK_DEV_EXT_CAPS_SIZE]
static struct ublast_lowlevel_priv info
JAYLINK_API int jaylink_close(struct jaylink_device_handle *devh)
Close a device.
JAYLINK_API int jaylink_discovery_scan(struct jaylink_context *ctx, uint32_t ifaces)
Scan for devices.
JAYLINK_API int jaylink_get_hardware_info(struct jaylink_device_handle *devh, uint32_t mask, uint32_t *info)
Retrieve the hardware information of a device.
JAYLINK_API int jaylink_log_get_level(const struct jaylink_context *ctx, enum jaylink_log_level *level)
Get the libjaylink log level.
JAYLINK_API int jaylink_get_devices(struct jaylink_context *ctx, struct jaylink_device ***devs, size_t *count)
Get available devices.
JAYLINK_API int jaylink_device_get_nickname(const struct jaylink_device *dev, char *nickname)
Get the nickname of a device.
Time the device is connected to a target in milliseconds.
JAYLINK_API void jaylink_unref_device(struct jaylink_device *dev)
Decrement the reference count of a device.
Device supports writing configuration data.
uint8_t major
Major version.
JAYLINK_API int jaylink_device_get_hardware_version(const struct jaylink_device *dev, struct jaylink_hardware_version *version)
Get the hardware version of a device.
JAYLINK_API int jaylink_swo_start(struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, uint32_t baudrate, uint32_t size)
Start SWO capture.
Device supports ethernet connectivity.
jaylink_device_capability
Device capabilities.
jaylink_hardware_type
Device hardware types.
JAYLINK_API const char * jaylink_version_package_get_string(void)
Get the version number string of the libjaylink package.
Serial Wire Output (SWO) speed information.
Device supports retrieval of hardware information.
JAYLINK_API int jaylink_jtag_set_trst(struct jaylink_device_handle *devh)
Set the JTAG test reset (TRST) signal.
uint32_t freq
Base frequency in Hz.
USB address 1 (Product ID 0x0102).
JAYLINK_API struct jaylink_device * jaylink_get_device(struct jaylink_device_handle *devh)
Get the device instance from a device handle.
JAYLINK_API int jaylink_version_package_get_major(void)
Get the major version number of the libjaylink package.
Opaque structure representing a libjaylink context.
uint16_t target_voltage
Target reference voltage in mV.
uint32_t timestamp
Timestamp of the last registration in milliseconds.
Device supports reading configuration data.
Device supports retrieval of free memory size.
Status of the target power supply.
Device supports retrieval of target interface speeds.
JAYLINK_API bool jaylink_library_has_cap(enum jaylink_capability cap)
Check for a capability of libjaylink.
static struct device_config config
JAYLINK_API int jaylink_device_get_usb_bus_ports(const struct jaylink_device *dev, uint8_t *bus, uint8_t **ports, size_t *length)
Get the USB bus and port numbers of a device.
jaylink_error
Error codes returned by libjaylink functions.
JAYLINK_API int jaylink_jtag_io(struct jaylink_device_handle *devh, const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo, uint16_t length, enum jaylink_jtag_version version)
Perform a JTAG I/O operation.
JAYLINK_API int jaylink_swo_read(struct jaylink_device_handle *devh, uint8_t *buffer, uint32_t *length)
Read SWO trace data.
JAYLINK_API int jaylink_get_extended_caps(struct jaylink_device_handle *devh, uint8_t *caps)
Retrieve the extended capabilities of a device.
jaylink_target_interface
Target interfaces.
jaylink_capability
libjaylink capabilities.
Renesas’ single-wire debug interface (FINE).
Transmission Control Protocol (TCP).
JAYLINK_API const char * jaylink_strerror_name(int error_code)
Return the name of a libjaylink error code.
JAYLINK_API int jaylink_device_get_mac_address(const struct jaylink_device *dev, uint8_t *address)
Get the MAC address of a device.
JAYLINK_API void jaylink_free_devices(struct jaylink_device **devs, bool unref)
Free devices.
Device supports retrieval of the hardware version.
JAYLINK_API int jaylink_device_get_serial_number(const struct jaylink_device *dev, uint32_t *serial_number)
Get the serial number of a device.
static enum jaylink_target_interface iface
Peak current consumption of the target in mA.
JAYLINK_API int jaylink_file_read(struct jaylink_device_handle *devh, const char *filename, uint8_t *buffer, uint32_t offset, uint32_t *length)
Read from a file.
JAYLINK_API int jaylink_read_raw_config(struct jaylink_device_handle *devh, uint8_t *config)
Read the raw configuration data of a device.
Package and library version macros.
JAYLINK_API int jaylink_version_package_get_micro(void)
Get the micro version number of the libjaylink package.
size_t size
Size of the control block search area.
JAYLINK_API int jaylink_jtag_clear_trst(struct jaylink_device_handle *devh)
Clear the JTAG test reset (TRST) signal.
uint8_t revision
Revision number.
int(* jaylink_log_callback)(const struct jaylink_context *ctx, enum jaylink_log_level level, const char *format, va_list args, void *user_data)
Log callback function type.
Opaque structure representing a handle of a device.
JAYLINK_API int jaylink_log_set_domain(struct jaylink_context *ctx, const char *domain)
Set the libjaylink log domain.
Device supports registration of connections.
JAYLINK_API const char * jaylink_strerror(int error_code)
Return a human-readable description of a libjaylink error code.
JAYLINK_API int jaylink_file_write(struct jaylink_device_handle *devh, const char *filename, const uint8_t *buffer, uint32_t offset, uint32_t *length)
Write to a file.
Device supports capturing of SWO trace data.
Device supports target interface selection.
JAYLINK_API const char * jaylink_log_get_domain(const struct jaylink_context *ctx)
Get the libjaylink log domain.
JAYLINK_API int jaylink_parse_serial_number(const char *str, uint32_t *serial_number)
Convert a string representation of a serial number to an integer.
Universal Asynchronous Receiver Transmitter (UART).
Device supports the setting of the target power supply.
JAYLINK_API int jaylink_set_target_power(struct jaylink_device_handle *devh, bool enable)
Set the target power supply.
JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, struct jaylink_speed *speed)
Retrieve target interface speeds.
Device: entity not available.
Device supports file I/O operations.
JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, enum jaylink_target_interface iface, enum jaylink_target_interface *prev_iface)
Select the target interface.
static struct jaylink_device_handle * devh
Device supports retrieval of extended capabilities.
Device supports adaptive clocking.
USB address 3 (Product ID 0x0104).
Output I/O debug messages.
uint32_t max_prescaler
Maximum prescaler.
JAYLINK_API int jaylink_emucom_read(struct jaylink_device_handle *devh, uint32_t channel, uint8_t *buffer, uint32_t *length)
Read from an EMUCOM channel.
uint32_t min_prescaler
Minimum prescaler.
#define JAYLINK_API
Macro to mark public libjaylink API symbol.
Number of times the device was connected or disconnected from a target.
2-wire JTAG for PIC32 compliant devices.
JAYLINK_API const char * jaylink_version_library_get_string(void)
Get the version number string of the libjaylink libtool interface.
jaylink_hardware_info
Hardware information.
Device: operation not supported.
Device: not enough memory to perform operation.
USB address 0 (Product ID 0x0101).
JAYLINK_API int jaylink_get_caps(struct jaylink_device_handle *devh, uint8_t *caps)
Retrieve the capabilities of a device.
Output informational messages.
JAYLINK_API int jaylink_get_counters(struct jaylink_device_handle *devh, uint32_t mask, uint32_t *values)
Retrieve the counter values of a device.
JAYLINK_API int jaylink_file_delete(struct jaylink_device_handle *devh, const char *filename)
Delete a file.
JAYLINK_API int jaylink_get_hardware_version(struct jaylink_device_handle *devh, struct jaylink_hardware_version *version)
Retrieve the hardware version of a device.
Device: unspecified error.
JAYLINK_API int jaylink_log_set_callback(struct jaylink_context *ctx, jaylink_log_callback callback, void *user_data)
Set the libjaylink log callback function.
JAYLINK_API int jaylink_set_reset(struct jaylink_device_handle *devh)
Set the target reset signal.
JAYLINK_API int jaylink_get_free_memory(struct jaylink_device_handle *devh, uint32_t *size)
Retrieve the size of free memory of a device.
static uint32_t serial_number
JAYLINK_API int jaylink_device_get_host_interface(const struct jaylink_device *dev, enum jaylink_host_interface *iface)
Get the host interface of a device.
JAYLINK_API int jaylink_exit(struct jaylink_context *ctx)
Shutdown libjaylink.
uint16_t div
Minimum frequency divider.
JAYLINK_API int jaylink_version_library_get_revision(void)
Get the revision version number of the libjaylink libtool interface.
JAYLINK_API int jaylink_get_available_interfaces(struct jaylink_device_handle *devh, uint32_t *ifaces)
Retrieve the available target interfaces.
DNS server IPv4 address in network byte order.
Target interface speed information.
Background Debug Mode 3 (BDM3).
Gateway IPv4 address in network byte order.
uint32_t min_div
Minimum frequency divider.
uint32_t pid
Process ID (PID).
jaylink_jtag_version
JTAG command versions.
JAYLINK_API int jaylink_device_get_usb_address(const struct jaylink_device *dev, enum jaylink_usb_address *address)
Get the USB address of a device.