libjaylink 0.3.1
Library to access J-Link devices
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
libjaylink.h File Reference

Public libjaylink header file to be used by applications. More...

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <arpa/inet.h>
#include "version.h"

Go to the source code of this file.

Data Structures

struct  jaylink_speed
 Target interface speed information. More...
 
struct  jaylink_swo_speed
 Serial Wire Output (SWO) speed information. More...
 
struct  jaylink_hardware_version
 Device hardware version. More...
 
struct  jaylink_hardware_status
 Device hardware status. More...
 
struct  jaylink_connection
 Device connection. More...
 

Macros

#define JAYLINK_LOG_DOMAIN_DEFAULT   "jaylink: "
 Default libjaylink log domain.
 
#define JAYLINK_LOG_DOMAIN_MAX_LENGTH   32
 Maximum length of a libjaylink log domain in bytes.
 
#define JAYLINK_SPEED_ADAPTIVE_CLOCKING   0xffff
 Target interface speed value for adaptive clocking.
 
#define JAYLINK_DEV_CONFIG_SIZE   256
 Size of the device configuration data in bytes.
 
#define JAYLINK_DEV_CAPS_SIZE   4
 Number of bytes required to store device capabilities.
 
#define JAYLINK_DEV_EXT_CAPS_SIZE   32
 Number of bytes required to store extended device capabilities.
 
#define JAYLINK_MAX_CONNECTIONS   16
 Maximum number of connections that can be registered on a device.
 
#define JAYLINK_MAC_ADDRESS_LENGTH   6
 Media Access Control (MAC) address length in bytes.
 
#define JAYLINK_NICKNAME_MAX_LENGTH   32
 Maximum length of a device's nickname including trailing null-terminator in bytes.
 
#define JAYLINK_PRODUCT_NAME_MAX_LENGTH   32
 Maximum length of a device's product name including trailing null-terminator in bytes.
 
#define JAYLINK_FILE_NAME_MAX_LENGTH   255
 Maximum length of a filename in bytes.
 
#define JAYLINK_FILE_MAX_TRANSFER_SIZE   0x100000
 Maximum transfer size for a file in bytes.
 
#define JAYLINK_EMUCOM_CHANNEL_TIME   0x0
 EMUCOM channel with the system time of the device in milliseconds.
 
#define JAYLINK_EMUCOM_CHANNEL_USER   0x10000
 Offset of EMUCOM user channels.
 
#define JAYLINK_C2_MAX_LENGTH   64
 Maximum length of a 2-wire (C2) interface data transfer.
 
#define JAYLINK_API   __attribute__ ((visibility ("default")))
 Macro to mark public libjaylink API symbol.
 

Typedefs

typedef 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.
 

Enumerations

enum  jaylink_error {
  JAYLINK_OK = 0 ,
  JAYLINK_ERR = -1 ,
  JAYLINK_ERR_ARG = -2 ,
  JAYLINK_ERR_MALLOC = -3 ,
  JAYLINK_ERR_TIMEOUT = -4 ,
  JAYLINK_ERR_PROTO = -5 ,
  JAYLINK_ERR_NOT_AVAILABLE = -6 ,
  JAYLINK_ERR_NOT_SUPPORTED = -7 ,
  JAYLINK_ERR_IO = -8 ,
  JAYLINK_ERR_DEV = -1000 ,
  JAYLINK_ERR_DEV_NOT_SUPPORTED = -1001 ,
  JAYLINK_ERR_DEV_NOT_AVAILABLE = -1002 ,
  JAYLINK_ERR_DEV_NO_MEMORY = -1003
}
 Error codes returned by libjaylink functions. More...
 
enum  jaylink_log_level {
  JAYLINK_LOG_LEVEL_NONE = 0 ,
  JAYLINK_LOG_LEVEL_ERROR = 1 ,
  JAYLINK_LOG_LEVEL_WARNING = 2 ,
  JAYLINK_LOG_LEVEL_INFO = 3 ,
  JAYLINK_LOG_LEVEL_DEBUG = 4 ,
  JAYLINK_LOG_LEVEL_DEBUG_IO = 5
}
 libjaylink log levels. More...
 
enum  jaylink_capability { JAYLINK_CAP_HIF_USB = 0 }
 libjaylink capabilities. More...
 
enum  jaylink_host_interface {
  JAYLINK_HIF_USB = (1 << 0) ,
  JAYLINK_HIF_TCP = (1 << 1)
}
 Host interfaces. More...
 
enum  jaylink_usb_address {
  JAYLINK_USB_ADDRESS_0 = 0 ,
  JAYLINK_USB_ADDRESS_1 = 1 ,
  JAYLINK_USB_ADDRESS_2 = 2 ,
  JAYLINK_USB_ADDRESS_3 = 3
}
 USB addresses. More...
 
enum  jaylink_device_capability {
  JAYLINK_DEV_CAP_GET_HW_VERSION = 1 ,
  JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING = 3 ,
  JAYLINK_DEV_CAP_READ_CONFIG = 4 ,
  JAYLINK_DEV_CAP_WRITE_CONFIG = 5 ,
  JAYLINK_DEV_CAP_GET_SPEEDS = 9 ,
  JAYLINK_DEV_CAP_GET_FREE_MEMORY = 11 ,
  JAYLINK_DEV_CAP_GET_HW_INFO = 12 ,
  JAYLINK_DEV_CAP_SET_TARGET_POWER = 13 ,
  JAYLINK_DEV_CAP_SELECT_TIF = 17 ,
  JAYLINK_DEV_CAP_GET_COUNTERS = 19 ,
  JAYLINK_DEV_CAP_SWO = 23 ,
  JAYLINK_DEV_CAP_FILE_IO = 26 ,
  JAYLINK_DEV_CAP_REGISTER = 27 ,
  JAYLINK_DEV_CAP_GET_EXT_CAPS = 31 ,
  JAYLINK_DEV_CAP_EMUCOM = 33 ,
  JAYLINK_DEV_CAP_ETHERNET = 38 ,
  JAYLINK_DEV_CAP_SPI = 56
}
 Device capabilities. More...
 
enum  jaylink_hardware_info {
  JAYLINK_HW_INFO_TARGET_POWER = (1 << 0) ,
  JAYLINK_HW_INFO_ITARGET = (1 << 2) ,
  JAYLINK_HW_INFO_ITARGET_PEAK = (1 << 3) ,
  JAYLINK_HW_INFO_IPV4_ADDRESS = (1 << 16) ,
  JAYLINK_HW_INFO_IPV4_NETMASK = (1 << 17) ,
  JAYLINK_HW_INFO_IPV4_GATEWAY = (1 << 18) ,
  JAYLINK_HW_INFO_IPV4_DNS = (1 << 19) ,
  JAYLINK_HW_INFO_VUSB = (1 << 23)
}
 Hardware information. More...
 
enum  jaylink_counter {
  JAYLINK_COUNTER_TARGET_TIME = (1 << 0) ,
  JAYLINK_COUNTER_TARGET_CONNECTIONS = (1 << 1)
}
 Device counters. More...
 
enum  jaylink_hardware_type {
  JAYLINK_HW_TYPE_JLINK = 0 ,
  JAYLINK_HW_TYPE_FLASHER = 2 ,
  JAYLINK_HW_TYPE_JLINK_PRO = 3
}
 Device hardware types. More...
 
enum  jaylink_target_interface {
  JAYLINK_TIF_JTAG = 0 ,
  JAYLINK_TIF_SWD = 1 ,
  JAYLINK_TIF_BDM3 = 2 ,
  JAYLINK_TIF_FINE = 3 ,
  JAYLINK_TIF_2W_JTAG_PIC32 = 4 ,
  JAYLINK_TIF_SPI = 5 ,
  JAYLINK_TIF_C2 = 6 ,
  JAYLINK_TIF_CJTAG = 7
}
 Target interfaces. More...
 
enum  jaylink_jtag_version {
  JAYLINK_JTAG_VERSION_2 = 1 ,
  JAYLINK_JTAG_VERSION_3 = 2
}
 JTAG command versions. More...
 
enum  jaylink_swo_mode { JAYLINK_SWO_MODE_UART = 0 }
 Serial Wire Output (SWO) capture modes. More...
 
enum  jaylink_spi_flag {
  JAYLINK_SPI_FLAG_CS_START_U = 0x00 ,
  JAYLINK_SPI_FLAG_CS_START_0 = 0x02 ,
  JAYLINK_SPI_FLAG_CS_START_1 = 0x03 ,
  JAYLINK_SPI_FLAG_CS_END_U = 0x00 ,
  JAYLINK_SPI_FLAG_CS_END_0 = 0x08 ,
  JAYLINK_SPI_FLAG_CS_END_1 = 0x0c
}
 Serial Peripheral Interface (SPI) flags. More...
 

Functions

int jaylink_init (struct jaylink_context **ctx)
 Initialize libjaylink.
 
int jaylink_exit (struct jaylink_context *ctx)
 Shutdown libjaylink.
 
bool jaylink_library_has_cap (enum jaylink_capability cap)
 Check for a capability of libjaylink.
 
int jaylink_c2_read_address (struct jaylink_device_handle *devh, uint8_t *address)
 Read the C2 address register.
 
int jaylink_c2_write_address (struct jaylink_device_handle *devh, uint8_t address)
 Write to the C2 address register.
 
int jaylink_c2_read_data (struct jaylink_device_handle *devh, uint8_t *data, uint8_t length)
 Read the C2 data register.
 
int jaylink_c2_write_data (struct jaylink_device_handle *devh, const uint8_t *data, uint8_t length)
 Write to the C2 data register.
 
int jaylink_get_devices (struct jaylink_context *ctx, struct jaylink_device ***devs, size_t *count)
 Get available devices.
 
void jaylink_free_devices (struct jaylink_device **devs, bool unref)
 Free devices.
 
int jaylink_device_get_host_interface (const struct jaylink_device *dev, enum jaylink_host_interface *iface)
 Get the host interface of a device.
 
int jaylink_device_get_serial_number (const struct jaylink_device *dev, uint32_t *serial_number)
 Get the serial number of a device.
 
int jaylink_device_get_usb_address (const struct jaylink_device *dev, enum jaylink_usb_address *address)
 Get the USB address of a device.
 
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.
 
int jaylink_device_get_ipv4_address (const struct jaylink_device *dev, char *address)
 Get the IPv4 address string of a device.
 
int jaylink_device_get_mac_address (const struct jaylink_device *dev, uint8_t *address)
 Get the MAC address of a device.
 
int jaylink_device_get_hardware_version (const struct jaylink_device *dev, struct jaylink_hardware_version *version)
 Get the hardware version of a device.
 
int jaylink_device_get_product_name (const struct jaylink_device *dev, char *name)
 Get the product name of a device.
 
int jaylink_device_get_nickname (const struct jaylink_device *dev, char *nickname)
 Get the nickname of a device.
 
struct jaylink_devicejaylink_ref_device (struct jaylink_device *dev)
 Increment the reference count of a device.
 
void jaylink_unref_device (struct jaylink_device *dev)
 Decrement the reference count of a device.
 
int jaylink_open (struct jaylink_device *dev, struct jaylink_device_handle **devh)
 Open a device.
 
int jaylink_close (struct jaylink_device_handle *devh)
 Close a device.
 
struct jaylink_devicejaylink_get_device (struct jaylink_device_handle *devh)
 Get the device instance from a device handle.
 
int jaylink_get_firmware_version (struct jaylink_device_handle *devh, char **version, size_t *length)
 Retrieve the firmware version of a device.
 
int jaylink_get_hardware_info (struct jaylink_device_handle *devh, uint32_t mask, uint32_t *info)
 Retrieve the hardware information of a device.
 
int jaylink_get_counters (struct jaylink_device_handle *devh, uint32_t mask, uint32_t *values)
 Retrieve the counter values of a device.
 
int jaylink_get_hardware_version (struct jaylink_device_handle *devh, struct jaylink_hardware_version *version)
 Retrieve the hardware version of a device.
 
int jaylink_get_hardware_status (struct jaylink_device_handle *devh, struct jaylink_hardware_status *status)
 Retrieve the hardware status of a device.
 
int jaylink_get_caps (struct jaylink_device_handle *devh, uint8_t *caps)
 Retrieve the capabilities of a device.
 
int jaylink_get_extended_caps (struct jaylink_device_handle *devh, uint8_t *caps)
 Retrieve the extended capabilities of a device.
 
int jaylink_get_free_memory (struct jaylink_device_handle *devh, uint32_t *size)
 Retrieve the size of free memory of a device.
 
int jaylink_read_raw_config (struct jaylink_device_handle *devh, uint8_t *config)
 Read the raw configuration data of a device.
 
int jaylink_write_raw_config (struct jaylink_device_handle *devh, const uint8_t *config)
 Write the raw configuration data of a device.
 
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.
 
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.
 
int jaylink_discovery_scan (struct jaylink_context *ctx, uint32_t ifaces)
 Scan for devices.
 
int jaylink_emucom_read (struct jaylink_device_handle *devh, uint32_t channel, uint8_t *buffer, uint32_t *length)
 Read from an EMUCOM channel.
 
int jaylink_emucom_write (struct jaylink_device_handle *devh, uint32_t channel, const uint8_t *buffer, uint32_t *length)
 Write to an EMUCOM channel.
 
const char * jaylink_strerror (int error_code)
 Return a human-readable description of a libjaylink error code.
 
const char * jaylink_strerror_name (int error_code)
 Return the name of a libjaylink error code.
 
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.
 
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.
 
int jaylink_file_get_size (struct jaylink_device_handle *devh, const char *filename, uint32_t *size)
 Retrieve the size of a file.
 
int jaylink_file_delete (struct jaylink_device_handle *devh, const char *filename)
 Delete a file.
 
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.
 
int jaylink_jtag_clear_trst (struct jaylink_device_handle *devh)
 Clear the JTAG test reset (TRST) signal.
 
int jaylink_jtag_set_trst (struct jaylink_device_handle *devh)
 Set the JTAG test reset (TRST) signal.
 
int jaylink_jtag_clear_tms (struct jaylink_device_handle *devh)
 Clear the JTAG test mode select (TMS) signal.
 
int jaylink_jtag_set_tms (struct jaylink_device_handle *devh)
 Set the JTAG test mode select (TMS) signal.
 
int jaylink_jtag_clear_tck (struct jaylink_device_handle *devh)
 Clear the JTAG test clock (TCK) signal.
 
int jaylink_jtag_set_tck (struct jaylink_device_handle *devh)
 Set the JTAG test clock (TCK) signal.
 
int jaylink_log_set_level (struct jaylink_context *ctx, enum jaylink_log_level level)
 Set the libjaylink log level.
 
int jaylink_log_get_level (const struct jaylink_context *ctx, enum jaylink_log_level *level)
 Get the libjaylink log level.
 
int jaylink_log_set_callback (struct jaylink_context *ctx, jaylink_log_callback callback, void *user_data)
 Set the libjaylink log callback function.
 
int jaylink_log_set_domain (struct jaylink_context *ctx, const char *domain)
 Set the libjaylink log domain.
 
const char * jaylink_log_get_domain (const struct jaylink_context *ctx)
 Get the libjaylink log domain.
 
int jaylink_spi_io (struct jaylink_device_handle *devh, const uint8_t *mosi, uint8_t *miso, uint32_t length, uint32_t flags)
 Perform SPI I/O operation.
 
int jaylink_parse_serial_number (const char *str, uint32_t *serial_number)
 Convert a string representation of a serial number to an integer.
 
const char * jaylink_hardware_type_string (enum jaylink_hardware_type type)
 Get the string representation of a hardware type.
 
const char * jaylink_target_interface_string (enum jaylink_target_interface iface)
 Get the string representation of a target interface.
 
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.
 
int jaylink_swo_start (struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, uint32_t baudrate, uint32_t size)
 Start SWO capture.
 
int jaylink_swo_stop (struct jaylink_device_handle *devh)
 Stop SWO capture.
 
int jaylink_swo_read (struct jaylink_device_handle *devh, uint8_t *buffer, uint32_t *length)
 Read SWO trace data.
 
int jaylink_swo_get_speeds (struct jaylink_device_handle *devh, enum jaylink_swo_mode mode, struct jaylink_swo_speed *speed)
 Retrieve SWO speeds.
 
int jaylink_set_speed (struct jaylink_device_handle *devh, uint16_t speed)
 Set the target interface speed.
 
int jaylink_get_speeds (struct jaylink_device_handle *devh, struct jaylink_speed *speed)
 Retrieve target interface speeds.
 
int jaylink_select_interface (struct jaylink_device_handle *devh, enum jaylink_target_interface iface, enum jaylink_target_interface *prev_iface)
 Select the target interface.
 
int jaylink_get_available_interfaces (struct jaylink_device_handle *devh, uint32_t *ifaces)
 Retrieve the available target interfaces.
 
int jaylink_get_selected_interface (struct jaylink_device_handle *devh, enum jaylink_target_interface *iface)
 Retrieve the selected target interface.
 
int jaylink_clear_reset (struct jaylink_device_handle *devh)
 Clear the target reset signal.
 
int jaylink_set_reset (struct jaylink_device_handle *devh)
 Set the target reset signal.
 
int jaylink_set_target_power (struct jaylink_device_handle *devh, bool enable)
 Set the target power supply.
 
bool jaylink_has_cap (const uint8_t *caps, uint32_t cap)
 Check for a capability.
 
int jaylink_version_package_get_major (void)
 Get the major version number of the libjaylink package.
 
int jaylink_version_package_get_minor (void)
 Get the minor version number of the libjaylink package.
 
int jaylink_version_package_get_micro (void)
 Get the micro version number of the libjaylink package.
 
const char * jaylink_version_package_get_string (void)
 Get the version number string of the libjaylink package.
 
int jaylink_version_library_get_current (void)
 Get the current version number of the libjaylink libtool interface.
 
int jaylink_version_library_get_revision (void)
 Get the revision version number of the libjaylink libtool interface.
 
int jaylink_version_library_get_age (void)
 Get the age version number of the libjaylink libtool interface.
 
const char * jaylink_version_library_get_string (void)
 Get the version number string of the libjaylink libtool interface.
 

Detailed Description

Public libjaylink header file to be used by applications.

Macro Definition Documentation

◆ JAYLINK_EMUCOM_CHANNEL_TIME

#define JAYLINK_EMUCOM_CHANNEL_TIME   0x0

EMUCOM channel with the system time of the device in milliseconds.

The channel is read-only and the time is encoded in 4 bytes. The byte order is little-endian.

◆ JAYLINK_EMUCOM_CHANNEL_USER

#define JAYLINK_EMUCOM_CHANNEL_USER   0x10000

Offset of EMUCOM user channels.

User channels are available to implement vendor and/or device specific functionalities. All channels below are reserved.

Typedef Documentation

◆ jaylink_log_callback

typedef 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.

Parameters
[in]ctxlibjaylink context.
[in]levelLog level.
[in]formatMessage format in printf()-style.
[in]argsMessage arguments.
[in,out]user_dataUser data passed to the callback function.
Returns
Number of characters printed on success, or a negative error code on failure.

Enumeration Type Documentation

◆ jaylink_capability

libjaylink capabilities.

Enumerator
JAYLINK_CAP_HIF_USB 

Library supports USB as host interface.

◆ jaylink_counter

Device counters.

Enumerator
JAYLINK_COUNTER_TARGET_TIME 

Time the device is connected to a target in milliseconds.

JAYLINK_COUNTER_TARGET_CONNECTIONS 

Number of times the device was connected or disconnected from a target.

◆ jaylink_device_capability

Device capabilities.

Enumerator
JAYLINK_DEV_CAP_GET_HW_VERSION 

Device supports retrieval of the hardware version.

JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING 

Device supports adaptive clocking.

JAYLINK_DEV_CAP_READ_CONFIG 

Device supports reading configuration data.

JAYLINK_DEV_CAP_WRITE_CONFIG 

Device supports writing configuration data.

JAYLINK_DEV_CAP_GET_SPEEDS 

Device supports retrieval of target interface speeds.

JAYLINK_DEV_CAP_GET_FREE_MEMORY 

Device supports retrieval of free memory size.

JAYLINK_DEV_CAP_GET_HW_INFO 

Device supports retrieval of hardware information.

JAYLINK_DEV_CAP_SET_TARGET_POWER 

Device supports the setting of the target power supply.

JAYLINK_DEV_CAP_SELECT_TIF 

Device supports target interface selection.

JAYLINK_DEV_CAP_GET_COUNTERS 

Device supports retrieval of counter values.

JAYLINK_DEV_CAP_SWO 

Device supports capturing of SWO trace data.

JAYLINK_DEV_CAP_FILE_IO 

Device supports file I/O operations.

JAYLINK_DEV_CAP_REGISTER 

Device supports registration of connections.

JAYLINK_DEV_CAP_GET_EXT_CAPS 

Device supports retrieval of extended capabilities.

JAYLINK_DEV_CAP_EMUCOM 

Device supports EMUCOM.

JAYLINK_DEV_CAP_ETHERNET 

Device supports ethernet connectivity.

JAYLINK_DEV_CAP_SPI 

Device supports SPI.

◆ jaylink_error

Error codes returned by libjaylink functions.

Enumerator
JAYLINK_OK 

No error.

JAYLINK_ERR 

Unspecified error.

JAYLINK_ERR_ARG 

Invalid argument.

JAYLINK_ERR_MALLOC 

Memory allocation error.

JAYLINK_ERR_TIMEOUT 

Timeout occurred.

JAYLINK_ERR_PROTO 

Protocol violation.

JAYLINK_ERR_NOT_AVAILABLE 

Entity not available.

JAYLINK_ERR_NOT_SUPPORTED 

Operation not supported.

JAYLINK_ERR_IO 

Input/output error.

JAYLINK_ERR_DEV 

Device: unspecified error.

JAYLINK_ERR_DEV_NOT_SUPPORTED 

Device: operation not supported.

JAYLINK_ERR_DEV_NOT_AVAILABLE 

Device: entity not available.

JAYLINK_ERR_DEV_NO_MEMORY 

Device: not enough memory to perform operation.

◆ jaylink_hardware_info

Hardware information.

Enumerator
JAYLINK_HW_INFO_TARGET_POWER 

Status of the target power supply.

This indicates whether the target power supply on pin 19 of the 20-pin JTAG / SWD connector is enabled or disabled.

See also
jaylink_set_target_power()
JAYLINK_HW_INFO_ITARGET 

Current consumption of the target in mA.

JAYLINK_HW_INFO_ITARGET_PEAK 

Peak current consumption of the target in mA.

JAYLINK_HW_INFO_IPV4_ADDRESS 

Device's IPv4 address in network byte order.

If the address is 0.0.0.0 and DHCP is enabled, no address is assigned (yet).

Note
The value is valid only if the device is configured in DHCP mode.
JAYLINK_HW_INFO_IPV4_NETMASK 

IPv4 netmask in network byte order.

Note
The value is valid only if the device is configured in DHCP mode.
JAYLINK_HW_INFO_IPV4_GATEWAY 

Gateway IPv4 address in network byte order.

Note
The value is valid only if the device is configured in DHCP mode.
JAYLINK_HW_INFO_IPV4_DNS 

DNS server IPv4 address in network byte order.

Note
The value is valid only if the device is configured in DHCP mode.
JAYLINK_HW_INFO_VUSB 

USB voltage in mV.

◆ jaylink_hardware_type

Device hardware types.

Enumerator
JAYLINK_HW_TYPE_JLINK 

J-Link.

JAYLINK_HW_TYPE_FLASHER 

Flasher.

JAYLINK_HW_TYPE_JLINK_PRO 

J-Link Pro.

◆ jaylink_host_interface

Host interfaces.

Enumerator
JAYLINK_HIF_USB 

Universal Serial Bus (USB).

JAYLINK_HIF_TCP 

Transmission Control Protocol (TCP).

◆ jaylink_jtag_version

JTAG command versions.

The JTAG command version only affects the device and the communication protocol. The behaviour of a JTAG operation is not affected at all.

Enumerator
JAYLINK_JTAG_VERSION_2 

JTAG command version 2.

This version is obsolete for major hardware version 5 and above. Use JAYLINK_JTAG_VERSION_3 for these versions instead.

JAYLINK_JTAG_VERSION_3 

JTAG command version 3.

◆ jaylink_log_level

libjaylink log levels.

Enumerator
JAYLINK_LOG_LEVEL_NONE 

Output no messages.

JAYLINK_LOG_LEVEL_ERROR 

Output error messages.

JAYLINK_LOG_LEVEL_WARNING 

Output warnings.

JAYLINK_LOG_LEVEL_INFO 

Output informational messages.

JAYLINK_LOG_LEVEL_DEBUG 

Output debug messages.

JAYLINK_LOG_LEVEL_DEBUG_IO 

Output I/O debug messages.

◆ jaylink_spi_flag

Serial Peripheral Interface (SPI) flags.

Enumerator
JAYLINK_SPI_FLAG_CS_START_U 

Do not drive chip select (CS) before the transfer begins.

JAYLINK_SPI_FLAG_CS_START_0 

Drive chip select (CS) low before the transfer begins.

JAYLINK_SPI_FLAG_CS_START_1 

Drive chip select (CS) high before the transfer begins.

JAYLINK_SPI_FLAG_CS_END_U 

Do not drive chip select (CS) after the transfer is complete.

JAYLINK_SPI_FLAG_CS_END_0 

Drive chip select (CS) low after the transfer is complete.

JAYLINK_SPI_FLAG_CS_END_1 

Drive chip select (CS) high after the transfer is complete.

◆ jaylink_swo_mode

Serial Wire Output (SWO) capture modes.

Enumerator
JAYLINK_SWO_MODE_UART 

Universal Asynchronous Receiver Transmitter (UART).

◆ jaylink_target_interface

Target interfaces.

Enumerator
JAYLINK_TIF_JTAG 

Joint Test Action Group, IEEE 1149.1 (JTAG).

JAYLINK_TIF_SWD 

Serial Wire Debug (SWD).

JAYLINK_TIF_BDM3 

Background Debug Mode 3 (BDM3).

JAYLINK_TIF_FINE 

Renesas’ single-wire debug interface (FINE).

JAYLINK_TIF_2W_JTAG_PIC32 

2-wire JTAG for PIC32 compliant devices.

JAYLINK_TIF_SPI 

Serial Peripheral Interface (SPI).

JAYLINK_TIF_C2 

Silicon Labs 2-wire interface (C2).

JAYLINK_TIF_CJTAG 

Compact JTAG (cJTAG).

◆ jaylink_usb_address

USB addresses.

The USB address is a way to identify USB devices and is related to the USB Product ID (PID) of a device.

Enumerator
JAYLINK_USB_ADDRESS_0 

USB address 0 (Product ID 0x0101).

JAYLINK_USB_ADDRESS_1 

USB address 1 (Product ID 0x0102).

JAYLINK_USB_ADDRESS_2 

USB address 2 (Product ID 0x0103).

JAYLINK_USB_ADDRESS_3 

USB address 3 (Product ID 0x0104).

Function Documentation

◆ jaylink_c2_read_address()

int jaylink_c2_read_address ( struct jaylink_device_handle * devh,
uint8_t * address )

Read the C2 address register.

Note
This function must only be used if the JAYLINK_TIF_C2 interface is available and selected.
Parameters
[in,out]devhDevice handle.
[out]addressValue read from the address register on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_c2_read_data()

int jaylink_c2_read_data ( struct jaylink_device_handle * devh,
uint8_t * data,
uint8_t length )

Read the C2 data register.

Note
This function must only be used if the JAYLINK_TIF_C2 interface is available and selected.
Parameters
[in,out]devhDevice handle.
[out]dataBuffer to store the read data on success. Its content is undefined on failure.
[in]lengthNumber of bytes to read, but not more than JAYLINK_C2_MAX_LENGTH.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_c2_write_address()

int jaylink_c2_write_address ( struct jaylink_device_handle * devh,
uint8_t address )

Write to the C2 address register.

Note
This function must only be used if the JAYLINK_TIF_C2 interface is available and selected.
Parameters
[in,out]devhDevice handle.
[in]addressValue to write into the address register.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_c2_write_data()

int jaylink_c2_write_data ( struct jaylink_device_handle * devh,
const uint8_t * data,
uint8_t length )

Write to the C2 data register.

Note
This function must only be used if the JAYLINK_TIF_C2 interface is available and selected.
Parameters
[in,out]devhDevice handle.
[in]dataBuffer to be written into the data register.
[in]lengthNumber of bytes to write, but not more than JAYLINK_C2_MAX_LENGTH.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_clear_reset()

int jaylink_clear_reset ( struct jaylink_device_handle * devh)

Clear the target reset signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_close()

int jaylink_close ( struct jaylink_device_handle * devh)

Close a device.

Parameters
[in,out]devhDevice instance.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_device_get_hardware_version()

int jaylink_device_get_hardware_version ( const struct jaylink_device * dev,
struct jaylink_hardware_version * version )

Get the hardware version of a device.

Note
The hardware type can not be obtained by this function, use jaylink_get_hardware_version() instead.
Parameters
[in]devDevice instance.
[out]versionHardware version of the device on success and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_TCP only.
JAYLINK_ERR_NOT_AVAILABLEHardware version is not available.
Since
0.2.0

◆ jaylink_device_get_host_interface()

int jaylink_device_get_host_interface ( const struct jaylink_device * dev,
enum jaylink_host_interface * iface )

Get the host interface of a device.

Parameters
[in]devDevice instance.
[out]ifaceHost interface of the device on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

◆ jaylink_device_get_ipv4_address()

int jaylink_device_get_ipv4_address ( const struct jaylink_device * dev,
char * address )

Get the IPv4 address string of a device.

Parameters
[in]devDevice instance.
[out]addressIPv4 address string in quad-dotted decimal format of the device on success and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_TCP only.
Since
0.2.0

◆ jaylink_device_get_mac_address()

int jaylink_device_get_mac_address ( const struct jaylink_device * dev,
uint8_t * address )

Get the MAC address of a device.

Parameters
[in]devDevice instance.
[out]addressMAC address of the device on success and undefined on failure. The length of the MAC address is JAYLINK_MAC_ADDRESS_LENGTH bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_TCP only.
JAYLINK_ERR_NOT_AVAILABLEMAC address is not available.
Since
0.2.0

◆ jaylink_device_get_nickname()

int jaylink_device_get_nickname ( const struct jaylink_device * dev,
char * nickname )

Get the nickname of a device.

Parameters
[in]devDevice instance.
[out]nicknameNickname of the device on success and undefined on failure. The maximum length of the nickname is JAYLINK_NICKNAME_MAX_LENGTH bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_TCP only.
JAYLINK_ERR_NOT_AVAILABLENickname is not available.
Since
0.2.0

◆ jaylink_device_get_product_name()

int jaylink_device_get_product_name ( const struct jaylink_device * dev,
char * name )

Get the product name of a device.

Parameters
[in]devDevice instance.
[out]nameProduct name of the device on success and undefined on failure. The maximum length of the product name is JAYLINK_PRODUCT_NAME_MAX_LENGTH bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_TCP only.
JAYLINK_ERR_NOT_AVAILABLEProduct name is not available.
Since
0.2.0

◆ jaylink_device_get_serial_number()

int jaylink_device_get_serial_number ( const struct jaylink_device * dev,
uint32_t * serial_number )

Get the serial number of a device.

Note
This serial number is for enumeration purpose only and might differ from the real serial number of the device.
Parameters
[in]devDevice instance.
[out]serial_numberSerial number of the device on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_AVAILABLESerial number is not available.
Since
0.1.0

◆ jaylink_device_get_usb_address()

int jaylink_device_get_usb_address ( const struct jaylink_device * dev,
enum jaylink_usb_address * address )

Get the USB address of a device.

Note
Identification of a device with the USB address is deprecated and the serial number should be used instead.
Parameters
[in]devDevice instance.
[out]addressUSB address of the device on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_USB only.
See also
jaylink_device_get_serial_number()
Since
0.1.0

◆ jaylink_device_get_usb_bus_ports()

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.

Parameters
[in]devDevice instance.
[out]busThe bus number of the device on success and undefined on failure.
[out]portsNewly allocated array which contains the port numbers on success and is undefined on failure. The array must be free'd by the caller.
[out]lengthLength of the port array on success and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_MALLOCMemory allocation error.
JAYLINK_ERR_NOT_SUPPORTEDSupported for devices with host interface JAYLINK_HIF_USB only.
Since
0.2.0

◆ jaylink_discovery_scan()

int jaylink_discovery_scan ( struct jaylink_context * ctx,
uint32_t ifaces )

Scan for devices.

Parameters
[in,out]ctxlibjaylink context.
[in]ifacesHost interfaces to scan for devices. Use bitwise OR to specify multiple interfaces, or 0 to use all available interfaces. See jaylink_host_interface for a description of the interfaces.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_get_devices()
Since
0.1.0

◆ jaylink_emucom_read()

int jaylink_emucom_read ( struct jaylink_device_handle * devh,
uint32_t channel,
uint8_t * buffer,
uint32_t * length )

Read from an EMUCOM channel.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_EMUCOM capability.
Parameters
[in,out]devhDevice handle.
[in]channelChannel to read data from.
[out]bufferBuffer to store read data on success. Its content is undefined on failure.
[in,out]lengthNumber of bytes to read. On success, the value gets updated with the actual number of bytes read. Unless otherwise specified, the value is undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEV_NOT_SUPPORTEDChannel is not supported by the device.
JAYLINK_ERR_DEV_NOT_AVAILABLEChannel is not available for the requested amount of data. length is updated with the number of bytes available on this channel.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_emucom_write()

int jaylink_emucom_write ( struct jaylink_device_handle * devh,
uint32_t channel,
const uint8_t * buffer,
uint32_t * length )

Write to an EMUCOM channel.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_EMUCOM capability.
Parameters
[in,out]devhDevice handle.
[in]channelChannel to write data to.
[in]bufferBuffer to write data from.
[in,out]lengthNumber of bytes to write. On success, the value gets updated with the actual number of bytes written. The value is undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEV_NOT_SUPPORTEDChannel is not supported by the device.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_exit()

int jaylink_exit ( struct jaylink_context * ctx)

Shutdown libjaylink.

Parameters
[in,out]ctxlibjaylink context.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

◆ jaylink_file_delete()

int jaylink_file_delete ( struct jaylink_device_handle * devh,
const char * filename )

Delete a file.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_FILE_IO capability.
Parameters
[in,out]devhDevice handle.
[in]filenameName of the file to delete. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error, or the file was not found.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_file_get_size()

int jaylink_file_get_size ( struct jaylink_device_handle * devh,
const char * filename,
uint32_t * size )

Retrieve the size of a file.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_FILE_IO capability.
Parameters
[in,out]devhDevice handle.
[in]filenameName of the file to retrieve the size of. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes.
[out]sizeSize of the file in bytes on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error, or the file was not found.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_file_read()

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.

The maximum amount of data that can be read from a file at once is JAYLINK_FILE_MAX_TRANSFER_SIZE bytes. Multiple reads in conjunction with the offset parameter are needed for larger files.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_FILE_IO capability.
Parameters
[in,out]devhDevice handle.
[in]filenameName of the file to read from. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes.
[out]bufferBuffer to store read data on success. Its content is undefined on failure
[in]offsetOffset in bytes relative to the beginning of the file from where to start reading.
[in,out]lengthNumber of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error, or the file was not found.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_file_write()

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.

If a file does not exist, a new file is created.

The maximum amount of data that can be written to a file at once is JAYLINK_FILE_MAX_TRANSFER_SIZE bytes. Multiple writes in conjunction with the offset parameter are needed for larger files.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_FILE_IO capability.
Parameters
[in,out]devhDevice handle.
[in]filenameName of the file to write to. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes.
[in]bufferBuffer to write data from.
[in]offsetOffset in bytes relative to the beginning of the file from where to start writing.
[in,out]lengthNumber of bytes to write. On success, the value gets updated with the actual number of bytes written. The value is undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error, or the file was not found.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_free_devices()

void jaylink_free_devices ( struct jaylink_device ** devs,
bool unref )

Free devices.

Parameters
[in,out]devsArray of device instances. Must be NULL-terminated.
[in]unrefDetermines whether the device instances should be unreferenced.
See also
jaylink_get_devices()
Since
0.1.0

◆ jaylink_get_available_interfaces()

int jaylink_get_available_interfaces ( struct jaylink_device_handle * devh,
uint32_t * ifaces )

Retrieve the available target interfaces.

The target interfaces are stored in a 32-bit bit field where each individual bit represents a target interface. A set bit indicates an available target interface. See jaylink_target_interface for a description of the target interfaces and their bit positions.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SELECT_TIF capability.
Parameters
[in,out]devhDevice handle.
[out]ifacesTarget interfaces on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_select_interface()
Since
0.1.0

◆ jaylink_get_caps()

int jaylink_get_caps ( struct jaylink_device_handle * devh,
uint8_t * caps )

Retrieve the capabilities of a device.

The capabilities are stored in a 32-bit bit array consisting of JAYLINK_DEV_CAPS_SIZE bytes where each individual bit represents a capability. The first bit of this array is the least significant bit of the first byte and the following bits are sequentially numbered in order of increasing bit significance and byte index. A set bit indicates a supported capability. See jaylink_device_capability for a description of the capabilities and their bit positions.

Parameters
[in,out]devhDevice handle.
[out]capsBuffer to store capabilities on success. Its content is undefined on failure. The buffer must be large enough to contain at least JAYLINK_DEV_CAPS_SIZE bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_get_extended_caps()
jaylink_has_cap()
Since
0.1.0

◆ jaylink_get_counters()

int jaylink_get_counters ( struct jaylink_device_handle * devh,
uint32_t mask,
uint32_t * values )

Retrieve the counter values of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_COUNTERS capability.
Parameters
[in,out]devhDevice handle.
[in]maskA bit field where each set bit represents a counter value to request. See jaylink_counter for a description of the counters and their bit positions.
[out]valuesArray to store the counter values on success. Its content is undefined on failure. The array must be large enough to contain at least as many elements as bits set in mask.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.2.0

◆ jaylink_get_device()

struct jaylink_device * jaylink_get_device ( struct jaylink_device_handle * devh)

Get the device instance from a device handle.

Note
The reference count of the device instance is not increased.
Parameters
[in]devhDevice handle.
Returns
The device instance on success, or NULL on invalid argument.
Since
0.1.0

◆ jaylink_get_devices()

int jaylink_get_devices ( struct jaylink_context * ctx,
struct jaylink_device *** devs,
size_t * count )

Get available devices.

Parameters
[in,out]ctxlibjaylink context.
[out]devsNewly allocated array which contains instances of available devices on success, and undefined on failure. The array is NULL-terminated and must be free'd by the caller with jaylink_free_devices().
[out]countNumber of available devices on success, and undefined on failure. Can be NULL.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_MALLOCMemory allocation error.
JAYLINK_ERROther error conditions.
See also
jaylink_discovery_scan()
Since
0.1.0

◆ jaylink_get_extended_caps()

int jaylink_get_extended_caps ( struct jaylink_device_handle * devh,
uint8_t * caps )

Retrieve the extended capabilities of a device.

The extended capabilities are stored in a 256-bit bit array consisting of JAYLINK_DEV_EXT_CAPS_SIZE bytes. See jaylink_get_caps() for a further description of how the capabilities are represented in this bit array. For a description of the capabilities and their bit positions, see jaylink_device_capability.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_EXT_CAPS capability.
Parameters
[in,out]devhDevice handle.
[out]capsBuffer to store capabilities on success. Its content is undefined on failure. The buffer must be large enough to contain at least JAYLINK_DEV_EXT_CAPS_SIZE bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_get_caps()
Since
0.1.0

◆ jaylink_get_firmware_version()

int jaylink_get_firmware_version ( struct jaylink_device_handle * devh,
char ** version,
size_t * length )

Retrieve the firmware version of a device.

Parameters
[in,out]devhDevice handle.
[out]versionNewly allocated string which contains the firmware version on success, and undefined if length is zero or on failure. The string is null-terminated and must be free'd by the caller.
[out]lengthLength of the firmware version string including trailing null-terminator on success, and undefined on failure. Zero if no firmware version string is available.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_MALLOCMemory allocation error.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_get_free_memory()

int jaylink_get_free_memory ( struct jaylink_device_handle * devh,
uint32_t * size )

Retrieve the size of free memory of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_FREE_MEMORY capability.
Parameters
[in,out]devhDevice handle.
[out]sizeSize of free memory in bytes on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_get_hardware_info()

int jaylink_get_hardware_info ( struct jaylink_device_handle * devh,
uint32_t mask,
uint32_t * info )

Retrieve the hardware information of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_HW_INFO capability.
Parameters
[in,out]devhDevice handle.
[in]maskA bit field where each set bit represents hardware information to request. See jaylink_hardware_info for a description of the hardware information and their bit positions.
[out]infoArray to store the hardware information on success. Its content is undefined on failure. The array must be large enough to contain at least as many elements as bits set in mask.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_get_hardware_status()

int jaylink_get_hardware_status ( struct jaylink_device_handle * devh,
struct jaylink_hardware_status * status )

Retrieve the hardware status of a device.

Parameters
[in,out]devhDevice handle.
[out]statusHardware status on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_get_hardware_version()

int jaylink_get_hardware_version ( struct jaylink_device_handle * devh,
struct jaylink_hardware_version * version )

Retrieve the hardware version of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_HW_VERSION capability.
Warning
This function may return a value for version where jaylink_hardware_version::type is not covered by jaylink_hardware_type.
Parameters
[in,out]devhDevice handle.
[out]versionHardware version on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_get_selected_interface()

int jaylink_get_selected_interface ( struct jaylink_device_handle * devh,
enum jaylink_target_interface * iface )

Retrieve the selected target interface.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SELECT_TIF capability.
Warning
This function may return a value for iface which is not covered by jaylink_target_interface.
Parameters
[in,out]devhDevice handle.
[out]ifaceSelected target interface on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_select_interface()
Since
0.1.0

◆ jaylink_get_speeds()

int jaylink_get_speeds ( struct jaylink_device_handle * devh,
struct jaylink_speed * speed )

Retrieve target interface speeds.

The speeds are applicable for the currently selected target interface only and calculated as follows:

speeds = freq / n with n >= div, where n is an integer

Assuming, for example, a base frequency freq of 4 MHz and a minimum divider div of 4 then the highest possible target interface speed is 4 MHz / 4 = 1 MHz. The next highest speed is 800 kHz for a divider of 5, and so on.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_GET_SPEEDS capability.
Parameters
[in,out]devhDevice handle.
[out]speedSpeed information on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_select_interface()
Since
0.1.0

◆ jaylink_hardware_type_string()

const char * jaylink_hardware_type_string ( enum jaylink_hardware_type type)

Get the string representation of a hardware type.

Parameters
[in]typeHardware type.
Returns
The string representation of the given hardware type, or NULL for an unknown type.
Since
0.3.0

◆ jaylink_has_cap()

bool jaylink_has_cap ( const uint8_t * caps,
uint32_t cap )

Check for a capability.

The capabilities are expected to be stored in a bit array consisting of one or more bytes where each individual bit represents a capability. The first bit of this array is the least significant bit of the first byte and the following bits are sequentially numbered in order of increasing bit significance and byte index. A set bit indicates a supported capability.

Parameters
[in]capsBuffer with capabilities.
[in]capBit position of the capability to check for.
Return values
trueCapability is supported.
falseCapability is not supported or invalid argument.
Since
0.1.0

◆ jaylink_init()

int jaylink_init ( struct jaylink_context ** ctx)

Initialize libjaylink.

This function must be called before any other libjaylink function is called.

Parameters
[out]ctxNewly allocated libjaylink context on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_MALLOCMemory allocation error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_jtag_clear_tck()

int jaylink_jtag_clear_tck ( struct jaylink_device_handle * devh)

Clear the JTAG test clock (TCK) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_jtag_clear_tms()

int jaylink_jtag_clear_tms ( struct jaylink_device_handle * devh)

Clear the JTAG test mode select (TMS) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_jtag_clear_trst()

int jaylink_jtag_clear_trst ( struct jaylink_device_handle * devh)

Clear the JTAG test reset (TRST) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_jtag_io()

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.

Note
This function must only be used if the JAYLINK_TIF_JTAG interface is available and selected. Nevertheless, this function can be used if the device doesn't have the JAYLINK_DEV_CAP_SELECT_TIF capability.
Parameters
[in,out]devhDevice handle.
[in]tmsBuffer to read TMS data from.
[in]tdiBuffer to read TDI data from.
[out]tdoBuffer to store TDO data on success. Its content is undefined on failure. The buffer must be large enough to contain at least the specified number of bits to transfer.
[in]lengthNumber of bits to transfer.
[in]versionVersion of the JTAG command to use.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEV_NO_MEMORYNot enough memory on the device to perform the operation.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
See also
jaylink_select_interface()
jaylink_set_speed()
Since
0.1.0

◆ jaylink_jtag_set_tck()

int jaylink_jtag_set_tck ( struct jaylink_device_handle * devh)

Set the JTAG test clock (TCK) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_jtag_set_tms()

int jaylink_jtag_set_tms ( struct jaylink_device_handle * devh)

Set the JTAG test mode select (TMS) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_jtag_set_trst()

int jaylink_jtag_set_trst ( struct jaylink_device_handle * devh)

Set the JTAG test reset (TRST) signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_library_has_cap()

bool jaylink_library_has_cap ( enum jaylink_capability cap)

Check for a capability of libjaylink.

Parameters
[in]capCapability to check for.
Return values
trueCapability is supported.
falseCapability is not supported or invalid argument.
Since
0.1.0

◆ jaylink_log_get_domain()

const char * jaylink_log_get_domain ( const struct jaylink_context * ctx)

Get the libjaylink log domain.

Parameters
[in]ctxlibjaylink context.
Returns
A string which contains the current log domain on success, or NULL on failure. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

◆ jaylink_log_get_level()

int jaylink_log_get_level ( const struct jaylink_context * ctx,
enum jaylink_log_level * level )

Get the libjaylink log level.

Parameters
[in]ctxlibjaylink context.
[out]levelLog level on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

◆ jaylink_log_set_callback()

int jaylink_log_set_callback ( struct jaylink_context * ctx,
jaylink_log_callback callback,
void * user_data )

Set the libjaylink log callback function.

Parameters
[in,out]ctxlibjaylink context.
[in]callbackCallback function to use, or NULL to use the default log function.
[in]user_dataUser data to be passed to the callback function.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

◆ jaylink_log_set_domain()

int jaylink_log_set_domain ( struct jaylink_context * ctx,
const char * domain )

Set the libjaylink log domain.

The log domain is a string which is used as prefix for all log messages to differentiate them from messages of other libraries.

The maximum length of the log domain is JAYLINK_LOG_DOMAIN_MAX_LENGTH bytes, excluding the trailing null-terminator. A log domain which exceeds this length will be silently truncated.

Parameters
[in,out]ctxlibjaylink context.
[in]domainLog domain to use. To set the default log domain, use JAYLINK_LOG_DOMAIN_DEFAULT.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_log_set_level()

int jaylink_log_set_level ( struct jaylink_context * ctx,
enum jaylink_log_level level )

Set the libjaylink log level.

Parameters
[in,out]ctxlibjaylink context.
[in]levelLog level to set.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
Since
0.1.0

◆ jaylink_open()

int jaylink_open ( struct jaylink_device * dev,
struct jaylink_device_handle ** devh )

Open a device.

Parameters
[in,out]devDevice instance.
[out]devhNewly allocated handle for the opened device on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_MALLOCMemory allocation error.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_parse_serial_number()

int jaylink_parse_serial_number ( const char * str,
uint32_t * serial_number )

Convert a string representation of a serial number to an integer.

The string representation of the serial number must be in decimal form.

Parameters
[in]strString representation to convert.
[out]serial_numberSerial number on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERRConversion error. Serial number is invalid or string representation contains invalid character(s).
Since
0.1.0

◆ jaylink_read_raw_config()

int jaylink_read_raw_config ( struct jaylink_device_handle * devh,
uint8_t * config )

Read the raw configuration data of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_READ_CONFIG capability.
Parameters
[in,out]devhDevice handle.
[out]configBuffer to store configuration data on success. Its content is undefined on failure. The buffer must be large enough to contain at least JAYLINK_DEV_CONFIG_SIZE bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_ref_device()

struct jaylink_device * jaylink_ref_device ( struct jaylink_device * dev)

Increment the reference count of a device.

Parameters
[in,out]devDevice instance.
Returns
The given device instance on success, or NULL on invalid argument.
Since
0.1.0

◆ jaylink_register()

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.

A connection can be registered by using 0 as handle. Additional information about the connection can be attached whereby the timestamp is a read-only value and therefore ignored for registration. On success, a new handle greater than 0 is obtained from the device.

However, if an obtained handle does not appear in the list of device connections, the connection was not registered because the maximum number of connections on the device is reached.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_REGISTER capability.

Example code:

static bool register_connection(struct jaylink_device_handle *devh,
struct jaylink_connection *conn)
{
int ret;
bool found_handle;
size_t count;
conn->handle = 0;
conn->pid = 0;
strcpy(conn->hid, "0.0.0.0");
conn->iid = 0;
conn->cid = 0;
ret = jaylink_register(devh, conn, conns, &count);
if (ret != JAYLINK_OK) {
printf("jaylink_register() failed: %s.\n",
return false;
}
found_handle = false;
for (size_t i = 0; i < count; i++) {
if (conns[i].handle == conn->handle) {
found_handle = true;
break;
}
}
if (!found_handle) {
printf("Maximum number of connections reached.\n");
return false;
}
printf("Connection successfully registered.\n");
return true;
}
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.
Definition device.c:1515
const char * jaylink_strerror(int error_code)
Return a human-readable description of a libjaylink error code.
Definition error.c:40
Parameters
[in,out]devhDevice handle.
[in,out]connectionConnection to register on the device.
[out]connectionsArray to store device connections on success. Its content is undefined on failure. The array must be large enough to contain at least JAYLINK_MAX_CONNECTIONS elements.
[out]countNumber of device connections on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_unregister()
Since
0.1.0

◆ jaylink_select_interface()

int jaylink_select_interface ( struct jaylink_device_handle * devh,
enum jaylink_target_interface iface,
enum jaylink_target_interface * prev_iface )

Select the target interface.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SELECT_TIF capability.
Warning
This function may return a value for prev_iface which is not covered by jaylink_target_interface.
Parameters
[in,out]devhDevice handle.
[in]ifaceTarget interface to select.
[out]prev_ifacePreviously selected target interface on success, and undefined on failure. Can be NULL.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_get_available_interfaces()
Since
0.1.0

◆ jaylink_set_reset()

int jaylink_set_reset ( struct jaylink_device_handle * devh)

Set the target reset signal.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_set_speed()

int jaylink_set_speed ( struct jaylink_device_handle * devh,
uint16_t speed )

Set the target interface speed.

Parameters
[in,out]devhDevice handle.
[in]speedSpeed in kHz or JAYLINK_SPEED_ADAPTIVE_CLOCKING for adaptive clocking. Speed of 0 kHz is not allowed and adaptive clocking must only be used if the device has the JAYLINK_DEV_CAP_ADAPTIVE_CLOCKING capability.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_get_speeds()
Since
0.1.0

◆ jaylink_set_target_power()

int jaylink_set_target_power ( struct jaylink_device_handle * devh,
bool enable )

Set the target power supply.

If enabled, the target is supplied with 5 V from pin 19 of the 20-pin JTAG / SWD connector.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SET_TARGET_POWER capability.
Parameters
[in,out]devhDevice handle.
[in]enableDetermines whether to enable or disable the target power supply.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_spi_io()

int jaylink_spi_io ( struct jaylink_device_handle * devh,
const uint8_t * mosi,
uint8_t * miso,
uint32_t length,
uint32_t flags )

Perform SPI I/O operation.

The device acts as master and operates in mode 3 (CPOL = 1, CPHA = 1). Data is transferred with the most significant bit (MSB) first.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SPI capability and if the JAYLINK_TIF_SPI interface is available and selected.
Parameters
[in,out]devhDevice handle.
[in]mosiBuffer to read MOSI data from. Can be NULL.
[out]misoBuffer to store MISO data on success. Its content is undefined on failure. The buffer must be large enough to contain at least the specified number of bytes to transfer. Can be NULL.
[in]lengthNumber of bytes to transfer.
[in]flagsFlags, see jaylink_spi_flag for more details.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERROther error conditions.
Since
0.3.0

◆ jaylink_strerror()

const char * jaylink_strerror ( int error_code)

Return a human-readable description of a libjaylink error code.

Parameters
[in]error_codeA libjaylink error code. See jaylink_error for valid values.
Returns
A string which describes the given error code, or the string unknown error if the error code is not known. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

◆ jaylink_strerror_name()

const char * jaylink_strerror_name ( int error_code)

Return the name of a libjaylink error code.

Parameters
[in]error_codeA libjaylink error code. See jaylink_error for valid values.
Returns
A string which contains the name for the given error code, or the string unknown error code if the error code is not known. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

◆ jaylink_swd_io()

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.

Note
This function must only be used if the JAYLINK_TIF_SWD interface is available and selected.
Parameters
[in,out]devhDevice handle.
[in]directionBuffer to read the transfer direction from.
[in]outBuffer to read host-to-target data from.
[out]inBuffer to store target-to-host data on success. Its content is undefined on failure. The buffer must be large enough to contain at least the specified number of bits to transfer.
[in]lengthTotal number of bits to transfer from host to target and vice versa.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEV_NO_MEMORYNot enough memory on the device to perform the operation.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
See also
jaylink_select_interface()
jaylink_set_speed()
Since
0.1.0

◆ jaylink_swo_get_speeds()

int jaylink_swo_get_speeds ( struct jaylink_device_handle * devh,
enum jaylink_swo_mode mode,
struct jaylink_swo_speed * speed )

Retrieve SWO speeds.

The speeds are calculated as follows:

speeds = freq / n with n >= min_div and n <= max_div, where n is an integer

Assuming, for example, a base frequency freq of 4500 kHz, a minimum divider min_div of 1 and a maximum divider max_div of 8 then the highest possible SWO speed is 4500 kHz / 1 = 4500 kHz. The next highest speed is 2250 kHz for a divider of 2, and so on. Accordingly, the lowest possible speed is 4500 kHz / 8 = 562.5 kHz.

Note
This function must be used only if the device has the JAYLINK_DEV_CAP_SWO capability.
Parameters
[in,out]devhDevice handle.
[in]modeCapture mode to retrieve speeds for.
[out]speedSpeed information on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
Since
0.1.0

◆ jaylink_swo_read()

int jaylink_swo_read ( struct jaylink_device_handle * devh,
uint8_t * buffer,
uint32_t * length )

Read SWO trace data.

Note
This function must be used only if the device has the JAYLINK_DEV_CAP_SWO capability.
Parameters
[in,out]devhDevice handle.
[out]bufferBuffer to store trace data on success. Its content is undefined on failure.
[in,out]lengthMaximum number of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
See also
jaylink_swo_start()
Since
0.1.0

◆ jaylink_swo_start()

int jaylink_swo_start ( struct jaylink_device_handle * devh,
enum jaylink_swo_mode mode,
uint32_t baudrate,
uint32_t size )

Start SWO capture.

Note
This function must be used only if the device has the JAYLINK_DEV_CAP_SWO capability.
Parameters
[in,out]devhDevice handle.
[in]modeMode to capture data with.
[in]baudrateBaudrate to capture data in bit per second.
[in]sizeDevice internal buffer size in bytes to use for capturing.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
See also
jaylink_swo_get_speeds()
jaylink_get_free_memory()
Since
0.1.0

◆ jaylink_swo_stop()

int jaylink_swo_stop ( struct jaylink_device_handle * devh)

Stop SWO capture.

Note
This function must be used only if the device has the JAYLINK_DEV_CAP_SWO capability.
Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERR_DEVUnspecified device error.
JAYLINK_ERROther error conditions.
See also
jaylink_swo_start()
Since
0.1.0

◆ jaylink_target_interface_string()

const char * jaylink_target_interface_string ( enum jaylink_target_interface iface)

Get the string representation of a target interface.

Parameters
[in]ifaceTarget interface.
Returns
The string representation of the given target interface, or NULL for an unknown interface.
Since
0.3.0

◆ jaylink_unref_device()

void jaylink_unref_device ( struct jaylink_device * dev)

Decrement the reference count of a device.

Parameters
[in,out]devDevice instance.
Since
0.1.0

◆ jaylink_unregister()

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.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_REGISTER capability.
Parameters
[in,out]devhDevice handle.
[in,out]connectionConnection to unregister from the device.
[out]connectionsArray to store device connections on success. Its content is undefined on failure. The array must be large enough to contain at least JAYLINK_MAX_CONNECTIONS elements.
[out]countNumber of device connections on success, and undefined on failure.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
See also
jaylink_register()
Since
0.1.0

◆ jaylink_version_library_get_age()

int jaylink_version_library_get_age ( void )

Get the age version number of the libjaylink libtool interface.

Returns
The age version number of the libjaylink libtool interface.
Since
0.1.0

◆ jaylink_version_library_get_current()

int jaylink_version_library_get_current ( void )

Get the current version number of the libjaylink libtool interface.

Returns
The current version number of the libjaylink libtool interface.
Since
0.1.0

◆ jaylink_version_library_get_revision()

int jaylink_version_library_get_revision ( void )

Get the revision version number of the libjaylink libtool interface.

Returns
The revision version number of the libjaylink libtool interface.
Since
0.1.0

◆ jaylink_version_library_get_string()

const char * jaylink_version_library_get_string ( void )

Get the version number string of the libjaylink libtool interface.

Returns
A string which contains the version number of the libjaylink libtool interface. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

◆ jaylink_version_package_get_major()

int jaylink_version_package_get_major ( void )

Get the major version number of the libjaylink package.

Returns
The major version number of the libjaylink package.
Since
0.1.0

◆ jaylink_version_package_get_micro()

int jaylink_version_package_get_micro ( void )

Get the micro version number of the libjaylink package.

Returns
The micro version number of the libjaylink package.
Since
0.1.0

◆ jaylink_version_package_get_minor()

int jaylink_version_package_get_minor ( void )

Get the minor version number of the libjaylink package.

Returns
The minor version number of the libjaylink package.
Since
0.1.0

◆ jaylink_version_package_get_string()

const char * jaylink_version_package_get_string ( void )

Get the version number string of the libjaylink package.

Returns
A string which contains the version number of the libjaylink package. The string is null-terminated and must not be free'd by the caller.
Since
0.1.0

◆ jaylink_write_raw_config()

int jaylink_write_raw_config ( struct jaylink_device_handle * devh,
const uint8_t * config )

Write the raw configuration data of a device.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_WRITE_CONFIG capability.
Parameters
[in,out]devhDevice handle.
[in]configBuffer to write configuration data from. The size of the configuration data is expected to be JAYLINK_DEV_CONFIG_SIZE bytes.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.
Since
0.1.0