OpenOCD
libjaylink.h File Reference

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

Include dependency graph for libjaylink.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

Macros

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

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

Enumerations

enum  jaylink_capability { JAYLINK_CAP_HIF_USB = 0 }
 libjaylink capabilities. More...
 
enum  jaylink_counter { JAYLINK_COUNTER_TARGET_TIME = (1 << 0), JAYLINK_COUNTER_TARGET_CONNECTIONS = (1 << 1) }
 Device counters. 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
}
 Device capabilities. More...
 
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_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)
}
 Hardware information. 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_host_interface { JAYLINK_HIF_USB = (1 << 0), JAYLINK_HIF_TCP = (1 << 1) }
 Host interfaces. More...
 
enum  jaylink_jtag_version { JAYLINK_JTAG_VERSION_2 = 1, JAYLINK_JTAG_VERSION_3 = 2 }
 JTAG command versions. 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_swo_mode { JAYLINK_SWO_MODE_UART = 0 }
 Serial Wire Output (SWO) capture modes. 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
}
 Target 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...
 

Functions

JAYLINK_API int jaylink_clear_reset (struct jaylink_device_handle *devh)
 Clear the target reset signal. More...
 
JAYLINK_API int jaylink_close (struct jaylink_device_handle *devh)
 Close a device. More...
 
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. More...
 
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. More...
 
JAYLINK_API int jaylink_device_get_ipv4_address (const struct jaylink_device *dev, char *address)
 Get the IPv4 address string of a device. More...
 
JAYLINK_API int jaylink_device_get_mac_address (const struct jaylink_device *dev, uint8_t *address)
 Get the MAC address of a device. More...
 
JAYLINK_API int jaylink_device_get_nickname (const struct jaylink_device *dev, char *nickname)
 Get the nickname of a device. More...
 
JAYLINK_API int jaylink_device_get_product_name (const struct jaylink_device *dev, char *name)
 Get the product name of a device. More...
 
JAYLINK_API int jaylink_device_get_serial_number (const struct jaylink_device *dev, uint32_t *serial_number)
 Get the serial number of a device. More...
 
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. More...
 
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. More...
 
JAYLINK_API int jaylink_discovery_scan (struct jaylink_context *ctx, uint32_t ifaces)
 Scan for devices. More...
 
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. More...
 
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. More...
 
JAYLINK_API int jaylink_exit (struct jaylink_context *ctx)
 Shutdown libjaylink. More...
 
JAYLINK_API int jaylink_file_delete (struct jaylink_device_handle *devh, const char *filename)
 Delete a file. More...
 
JAYLINK_API int jaylink_file_get_size (struct jaylink_device_handle *devh, const char *filename, uint32_t *size)
 Retrieve the size of a file. More...
 
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. More...
 
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. More...
 
JAYLINK_API void jaylink_free_devices (struct jaylink_device **devs, bool unref)
 Free devices. More...
 
JAYLINK_API int jaylink_get_available_interfaces (struct jaylink_device_handle *devh, uint32_t *ifaces)
 Retrieve the available target interfaces. More...
 
JAYLINK_API int jaylink_get_caps (struct jaylink_device_handle *devh, uint8_t *caps)
 Retrieve the capabilities of a device. More...
 
JAYLINK_API int jaylink_get_counters (struct jaylink_device_handle *devh, uint32_t mask, uint32_t *values)
 Retrieve the counter values of a device. More...
 
JAYLINK_API struct jaylink_devicejaylink_get_device (struct jaylink_device_handle *devh)
 Get the device instance from a device handle. More...
 
JAYLINK_API int jaylink_get_devices (struct jaylink_context *ctx, struct jaylink_device ***devs, size_t *count)
 Get available devices. More...
 
JAYLINK_API int jaylink_get_extended_caps (struct jaylink_device_handle *devh, uint8_t *caps)
 Retrieve the extended capabilities of a device. More...
 
JAYLINK_API int jaylink_get_firmware_version (struct jaylink_device_handle *devh, char **version, size_t *length)
 Retrieve the firmware version of a device. More...
 
JAYLINK_API int jaylink_get_free_memory (struct jaylink_device_handle *devh, uint32_t *size)
 Retrieve the size of free memory of a device. More...
 
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. More...
 
JAYLINK_API int jaylink_get_hardware_status (struct jaylink_device_handle *devh, struct jaylink_hardware_status *status)
 Retrieve the hardware status of a device. More...
 
JAYLINK_API int jaylink_get_hardware_version (struct jaylink_device_handle *devh, struct jaylink_hardware_version *version)
 Retrieve the hardware version of a device. More...
 
JAYLINK_API int jaylink_get_selected_interface (struct jaylink_device_handle *devh, enum jaylink_target_interface *iface)
 Retrieve the selected target interface. More...
 
JAYLINK_API int jaylink_get_speeds (struct jaylink_device_handle *devh, struct jaylink_speed *speed)
 Retrieve target interface speeds. More...
 
JAYLINK_API bool jaylink_has_cap (const uint8_t *caps, uint32_t cap)
 Check for a capability. More...
 
JAYLINK_API int jaylink_init (struct jaylink_context **ctx)
 Initialize libjaylink. More...
 
JAYLINK_API int jaylink_jtag_clear_trst (struct jaylink_device_handle *devh)
 Clear the JTAG test reset (TRST) signal. More...
 
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. More...
 
JAYLINK_API int jaylink_jtag_set_trst (struct jaylink_device_handle *devh)
 Set the JTAG test reset (TRST) signal. More...
 
JAYLINK_API bool jaylink_library_has_cap (enum jaylink_capability cap)
 Check for a capability of libjaylink. More...
 
JAYLINK_API const char * jaylink_log_get_domain (const struct jaylink_context *ctx)
 Get the libjaylink log domain. More...
 
JAYLINK_API int jaylink_log_get_level (const struct jaylink_context *ctx, enum jaylink_log_level *level)
 Get the libjaylink log level. More...
 
JAYLINK_API int jaylink_log_set_callback (struct jaylink_context *ctx, jaylink_log_callback callback, void *user_data)
 Set the libjaylink log callback function. More...
 
JAYLINK_API int jaylink_log_set_domain (struct jaylink_context *ctx, const char *domain)
 Set the libjaylink log domain. More...
 
JAYLINK_API int jaylink_log_set_level (struct jaylink_context *ctx, enum jaylink_log_level level)
 Set the libjaylink log level. More...
 
JAYLINK_API int jaylink_open (struct jaylink_device *dev, struct jaylink_device_handle **devh)
 Open a device. More...
 
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. More...
 
JAYLINK_API int jaylink_read_raw_config (struct jaylink_device_handle *devh, uint8_t *config)
 Read the raw configuration data of a device. More...
 
JAYLINK_API struct jaylink_devicejaylink_ref_device (struct jaylink_device *dev)
 Increment the reference count of a device. More...
 
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. More...
 
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. More...
 
JAYLINK_API int jaylink_set_reset (struct jaylink_device_handle *devh)
 Set the target reset signal. More...
 
JAYLINK_API int jaylink_set_speed (struct jaylink_device_handle *devh, uint16_t speed)
 Set the target interface speed. More...
 
JAYLINK_API int jaylink_set_target_power (struct jaylink_device_handle *devh, bool enable)
 Set the target power supply. More...
 
JAYLINK_API const char * jaylink_strerror (int error_code)
 Return a human-readable description of a libjaylink error code. More...
 
JAYLINK_API const char * jaylink_strerror_name (int error_code)
 Return the name of a libjaylink error code. More...
 
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. More...
 
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. More...
 
JAYLINK_API int jaylink_swo_read (struct jaylink_device_handle *devh, uint8_t *buffer, uint32_t *length)
 Read SWO trace data. More...
 
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. More...
 
JAYLINK_API int jaylink_swo_stop (struct jaylink_device_handle *devh)
 Stop SWO capture. More...
 
JAYLINK_API void jaylink_unref_device (struct jaylink_device *dev)
 Decrement the reference count of a device. More...
 
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. More...
 
JAYLINK_API int jaylink_version_library_get_age (void)
 Get the age version number of the libjaylink libtool interface. More...
 
JAYLINK_API int jaylink_version_library_get_current (void)
 Get the current version number of the libjaylink libtool interface. More...
 
JAYLINK_API int jaylink_version_library_get_revision (void)
 Get the revision version number of the libjaylink libtool interface. More...
 
JAYLINK_API const char * jaylink_version_library_get_string (void)
 Get the version number string of the libjaylink libtool interface. More...
 
JAYLINK_API int jaylink_version_package_get_major (void)
 Get the major version number of the libjaylink package. More...
 
JAYLINK_API int jaylink_version_package_get_micro (void)
 Get the micro version number of the libjaylink package. More...
 
JAYLINK_API int jaylink_version_package_get_minor (void)
 Get the minor version number of the libjaylink package. More...
 
JAYLINK_API const char * jaylink_version_package_get_string (void)
 Get the version number string of the libjaylink package. More...
 
JAYLINK_API int jaylink_write_raw_config (struct jaylink_device_handle *devh, const uint8_t *config)
 Write the raw configuration data of a device. More...
 

Detailed Description

Public libjaylink header file to be used by applications.

Definition in file libjaylink.h.

Macro Definition Documentation

◆ JAYLINK_API

#define JAYLINK_API   __attribute__ ((visibility ("default")))

Macro to mark public libjaylink API symbol.

Definition at line 429 of file libjaylink.h.

◆ JAYLINK_DEV_CAPS_SIZE

#define JAYLINK_DEV_CAPS_SIZE   4

Number of bytes required to store device capabilities.

Definition at line 359 of file libjaylink.h.

Referenced by jaylink_get_caps().

◆ JAYLINK_DEV_CONFIG_SIZE

#define JAYLINK_DEV_CONFIG_SIZE   256

Size of the device configuration data in bytes.

Definition at line 356 of file libjaylink.h.

Referenced by jaylink_read_raw_config(), and jaylink_write_raw_config().

◆ JAYLINK_DEV_EXT_CAPS_SIZE

#define JAYLINK_DEV_EXT_CAPS_SIZE   32

Number of bytes required to store extended device capabilities.

Definition at line 362 of file libjaylink.h.

Referenced by jaylink_get_extended_caps(), and jlink_init().

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

Definition at line 394 of file libjaylink.h.

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

Definition at line 402 of file libjaylink.h.

◆ JAYLINK_FILE_MAX_TRANSFER_SIZE

#define JAYLINK_FILE_MAX_TRANSFER_SIZE   0x100000

Maximum transfer size for a file in bytes.

Definition at line 386 of file libjaylink.h.

Referenced by jaylink_file_read(), and jaylink_file_write().

◆ JAYLINK_FILE_NAME_MAX_LENGTH

#define JAYLINK_FILE_NAME_MAX_LENGTH   255

Maximum length of a filename in bytes.

Definition at line 383 of file libjaylink.h.

Referenced by jaylink_file_delete(), jaylink_file_get_size(), jaylink_file_read(), and jaylink_file_write().

◆ JAYLINK_LOG_DOMAIN_DEFAULT

#define JAYLINK_LOG_DOMAIN_DEFAULT   "jaylink: "

Default libjaylink log domain.

Definition at line 90 of file libjaylink.h.

Referenced by jaylink_init().

◆ JAYLINK_LOG_DOMAIN_MAX_LENGTH

#define JAYLINK_LOG_DOMAIN_MAX_LENGTH   32

Maximum length of a libjaylink log domain in bytes.

Definition at line 93 of file libjaylink.h.

Referenced by jaylink_log_set_domain().

◆ JAYLINK_MAC_ADDRESS_LENGTH

#define JAYLINK_MAC_ADDRESS_LENGTH   6

Media Access Control (MAC) address length in bytes.

Definition at line 368 of file libjaylink.h.

◆ JAYLINK_MAX_CONNECTIONS

#define JAYLINK_MAX_CONNECTIONS   16

Maximum number of connections that can be registered on a device.

Definition at line 365 of file libjaylink.h.

Referenced by jaylink_register(), and jaylink_unregister().

◆ JAYLINK_NICKNAME_MAX_LENGTH

#define JAYLINK_NICKNAME_MAX_LENGTH   32

Maximum length of a device's nickname including trailing null-terminator in bytes.

Definition at line 374 of file libjaylink.h.

Referenced by parse_adv_message().

◆ JAYLINK_PRODUCT_NAME_MAX_LENGTH

#define JAYLINK_PRODUCT_NAME_MAX_LENGTH   32

Maximum length of a device's product name including trailing null-terminator in bytes.

Definition at line 380 of file libjaylink.h.

Referenced by parse_adv_message().

◆ JAYLINK_SPEED_ADAPTIVE_CLOCKING

#define JAYLINK_SPEED_ADAPTIVE_CLOCKING   0xffff

Target interface speed value for adaptive clocking.

Definition at line 353 of file libjaylink.h.

Referenced by jlink_speed().

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.

Definition at line 444 of file libjaylink.h.

Enumeration Type Documentation

◆ jaylink_capability

libjaylink capabilities.

Enumerator
JAYLINK_CAP_HIF_USB 

Library supports USB as host interface.

Definition at line 96 of file libjaylink.h.

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

Definition at line 211 of file libjaylink.h.

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

Definition at line 127 of file libjaylink.h.

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

Definition at line 44 of file libjaylink.h.

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

Definition at line 163 of file libjaylink.h.

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

Definition at line 222 of file libjaylink.h.

◆ jaylink_host_interface

Host interfaces.

Enumerator
JAYLINK_HIF_USB 

Universal Serial Bus (USB).

JAYLINK_HIF_TCP 

Transmission Control Protocol (TCP).

Definition at line 102 of file libjaylink.h.

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

Definition at line 251 of file libjaylink.h.

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

Definition at line 74 of file libjaylink.h.

◆ jaylink_swo_mode

Serial Wire Output (SWO) capture modes.

Enumerator
JAYLINK_SWO_MODE_UART 

Universal Asynchronous Receiver Transmitter (UART).

Definition at line 264 of file libjaylink.h.

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

Definition at line 232 of file libjaylink.h.

◆ 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).

Definition at line 115 of file libjaylink.h.

Function Documentation

◆ jaylink_clear_reset()

JAYLINK_API 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

Definition at line 406 of file jtag/drivers/libjaylink/libjaylink/target.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by jlink_reset().

◆ jaylink_close()

JAYLINK_API 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

Definition at line 646 of file device.c.

References free_device_handle(), JAYLINK_ERR_ARG, and transport_close().

Referenced by jlink_init(), and jlink_quit().

◆ jaylink_device_get_hardware_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.

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

Definition at line 425 of file device.c.

References jaylink_device::has_hw_version, jaylink_device::hw_version, jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_TCP, and JAYLINK_OK.

◆ jaylink_device_get_host_interface()

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.

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

Definition at line 208 of file device.c.

References jaylink_device::iface, JAYLINK_ERR_ARG, and JAYLINK_OK.

◆ jaylink_device_get_ipv4_address()

JAYLINK_API 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

Definition at line 360 of file device.c.

References jaylink_device::iface, jaylink_device::ipv4_address, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_TCP, and JAYLINK_OK.

◆ jaylink_device_get_mac_address()

JAYLINK_API 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

Definition at line 390 of file device.c.

References jaylink_device::has_mac_address, jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_TCP, JAYLINK_OK, and jaylink_device::mac_address.

◆ jaylink_device_get_nickname()

JAYLINK_API 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

Definition at line 492 of file device.c.

References jaylink_device::has_nickname, jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_TCP, JAYLINK_OK, and jaylink_device::nickname.

◆ jaylink_device_get_product_name()

JAYLINK_API 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

Definition at line 459 of file device.c.

References jaylink_device::has_product_name, jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_TCP, JAYLINK_OK, and jaylink_device::product_name.

◆ jaylink_device_get_serial_number()

JAYLINK_API 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

Definition at line 236 of file device.c.

References jaylink_device::has_serial_number, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_OK, and jaylink_device::serial_number.

Referenced by jlink_init().

◆ jaylink_device_get_usb_address()

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.

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

Definition at line 269 of file device.c.

References jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_USB, and JAYLINK_OK.

Referenced by jlink_init().

◆ jaylink_device_get_usb_bus_ports()

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.

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

Definition at line 308 of file device.c.

References jaylink_device::ctx, jaylink_device::iface, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_HIF_USB, JAYLINK_OK, and log_err().

Referenced by jlink_usb_location_equal().

◆ jaylink_discovery_scan()

JAYLINK_API 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

Definition at line 72 of file discovery.c.

References clear_discovery_list(), discovery_tcp_scan(), discovery_usb_scan(), JAYLINK_ERR_ARG, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, JAYLINK_OK, and log_err().

Referenced by jlink_init().

◆ jaylink_emucom_read()

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.

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

Definition at line 93 of file emucom.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NOT_AVAILABLE, JAYLINK_ERR_DEV_NOT_SUPPORTED, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by COMMAND_HANDLER().

◆ jaylink_emucom_write()

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.

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

Definition at line 206 of file emucom.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NOT_SUPPORTED, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write(), transport_start_write_read(), and transport_write().

Referenced by COMMAND_HANDLER().

◆ jaylink_exit()

JAYLINK_API 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

Definition at line 171 of file jtag/drivers/libjaylink/libjaylink/core.c.

References list::data, jaylink_context::devs, jaylink_context::discovered_devs, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_unref_device(), list_free(), and list::next.

Referenced by jlink_init(), and jlink_quit().

◆ jaylink_file_delete()

JAYLINK_API 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

Definition at line 430 of file jtag/drivers/libjaylink/libjaylink/fileio.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().

◆ jaylink_file_get_size()

JAYLINK_API 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

Definition at line 338 of file jtag/drivers/libjaylink/libjaylink/fileio.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().

◆ jaylink_file_read()

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.

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

Definition at line 77 of file jtag/drivers/libjaylink/libjaylink/fileio.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_MAX_TRANSFER_SIZE, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().

◆ jaylink_file_write()

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.

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

Definition at line 212 of file jtag/drivers/libjaylink/libjaylink/fileio.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_MAX_TRANSFER_SIZE, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().

◆ jaylink_free_devices()

JAYLINK_API 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

Definition at line 183 of file device.c.

References jaylink_unref_device().

Referenced by jlink_init().

◆ jaylink_get_available_interfaces()

JAYLINK_API 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

Definition at line 283 of file jtag/drivers/libjaylink/libjaylink/target.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by select_interface().

◆ jaylink_get_caps()

JAYLINK_API 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

Definition at line 1094 of file device.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_DEV_CAPS_SIZE, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_init().

◆ jaylink_get_counters()

JAYLINK_API 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

Definition at line 880 of file device.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_write_read(), and transport_write().

◆ jaylink_get_device()

JAYLINK_API 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

Definition at line 670 of file device.c.

References jaylink_device_handle::dev, and NULL.

◆ jaylink_get_devices()

JAYLINK_API 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

Definition at line 137 of file device.c.

References allocate_device_list(), list::data, jaylink_context::discovered_devs, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_OK, jaylink_ref_device(), list_length(), log_err(), and list::next.

Referenced by jlink_init().

◆ jaylink_get_extended_caps()

JAYLINK_API 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

Definition at line 1161 of file device.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_DEV_EXT_CAPS_SIZE, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_init().

◆ jaylink_get_firmware_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.

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

Definition at line 700 of file device.c.

References buffer_get_u16(), CMD_GET_VERSION, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_init().

◆ jaylink_get_free_memory()

JAYLINK_API 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

Definition at line 1220 of file device.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by adjust_swd_buffer_size(), calculate_trace_buffer_size(), and COMMAND_HANDLER().

◆ jaylink_get_hardware_info()

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.

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

Definition at line 801 of file device.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_write_read(), and transport_write().

◆ jaylink_get_hardware_status()

JAYLINK_API 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

Definition at line 1019 of file device.c.

References buffer_get_u16(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), jaylink_hardware_status::target_voltage, jaylink_hardware_status::tck, jaylink_hardware_status::tdi, jaylink_hardware_status::tdo, jaylink_hardware_status::tms, transport_read(), transport_start_write_read(), transport_write(), jaylink_hardware_status::tres, and jaylink_hardware_status::trst.

Referenced by COMMAND_HANDLER(), and jlink_init().

◆ jaylink_get_hardware_version()

JAYLINK_API 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

Definition at line 956 of file device.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), jaylink_hardware_version::major, jaylink_hardware_version::minor, jaylink_hardware_version::revision, transport_read(), transport_start_write_read(), transport_write(), and jaylink_hardware_version::type.

Referenced by jlink_init().

◆ jaylink_get_selected_interface()

JAYLINK_API 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

Definition at line 349 of file jtag/drivers/libjaylink/libjaylink/target.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

◆ jaylink_get_speeds()

JAYLINK_API 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

Definition at line 128 of file jtag/drivers/libjaylink/libjaylink/target.c.

References buffer_get_u16(), buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, jaylink_speed::div, jaylink_speed::freq, JAYLINK_ERR_ARG, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_speed().

◆ jaylink_has_cap()

JAYLINK_API 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

Definition at line 47 of file jtag/drivers/libjaylink/libjaylink/util.c.

Referenced by adjust_swd_buffer_size(), calculate_trace_buffer_size(), COMMAND_HANDLER(), config_trace(), jlink_init(), jlink_quit(), jlink_register(), jlink_speed(), select_interface(), and show_config().

◆ jaylink_init()

JAYLINK_API 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

Definition at line 91 of file jtag/drivers/libjaylink/libjaylink/core.c.

References jaylink_context::devs, jaylink_context::discovered_devs, JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_LOG_DOMAIN_DEFAULT, JAYLINK_LOG_LEVEL_WARNING, jaylink_log_set_domain(), JAYLINK_OK, jaylink_context::log_callback, jaylink_context::log_callback_data, jaylink_context::log_level, log_vprintf(), and NULL.

Referenced by jlink_init().

◆ jaylink_jtag_clear_trst()

JAYLINK_API 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

Definition at line 186 of file libjaylink/libjaylink/jtag.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by jlink_reset().

◆ jaylink_jtag_io()

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.

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

Definition at line 75 of file libjaylink/libjaylink/jtag.c.

References buffer_set_u16(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NO_MEMORY, JAYLINK_JTAG_VERSION_2, JAYLINK_JTAG_VERSION_3, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_flush().

◆ jaylink_jtag_set_trst()

JAYLINK_API 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

Definition at line 230 of file libjaylink/libjaylink/jtag.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by jlink_reset().

◆ jaylink_library_has_cap()

JAYLINK_API 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

Definition at line 209 of file jtag/drivers/libjaylink/libjaylink/core.c.

References JAYLINK_CAP_HIF_USB.

Referenced by jlink_init().

◆ jaylink_log_get_domain()

JAYLINK_API 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

Definition at line 161 of file jtag/drivers/libjaylink/libjaylink/log.c.

References jaylink_context::log_domain, and NULL.

◆ jaylink_log_get_level()

JAYLINK_API 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

Definition at line 72 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_OK, and jaylink_context::log_level.

◆ jaylink_log_set_callback()

JAYLINK_API 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

Definition at line 96 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_context::log_callback, jaylink_context::log_callback_data, log_vprintf(), and NULL.

Referenced by jlink_init().

◆ jaylink_log_set_domain()

JAYLINK_API 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

Definition at line 133 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_LOG_DOMAIN_MAX_LENGTH, JAYLINK_OK, and jaylink_context::log_domain.

Referenced by jaylink_init().

◆ jaylink_log_set_level()

JAYLINK_API 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

Definition at line 47 of file jtag/drivers/libjaylink/libjaylink/log.c.

References JAYLINK_ERR_ARG, JAYLINK_LOG_LEVEL_DEBUG_IO, JAYLINK_OK, and jaylink_context::log_level.

◆ jaylink_open()

JAYLINK_API 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

Definition at line 607 of file device.c.

References allocate_device_handle(), jaylink_device::ctx, free_device_handle(), JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_OK, log_err(), and transport_open().

Referenced by jlink_init().

◆ jaylink_parse_serial_number()

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.

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

Definition at line 48 of file strutil.c.

References JAYLINK_ERR, JAYLINK_ERR_ARG, and JAYLINK_OK.

Referenced by COMMAND_HANDLER(), and parse_serial_number().

◆ jaylink_read_raw_config()

JAYLINK_API 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

Definition at line 1282 of file device.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_DEV_CONFIG_SIZE, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by read_device_config().

◆ jaylink_ref_device()

JAYLINK_API 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

Definition at line 518 of file device.c.

References NULL, and jaylink_device::ref_count.

Referenced by allocate_device_handle(), jaylink_get_devices(), and probe_device().

◆ jaylink_register()

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.

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,
{
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;
}
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

Definition at line 1515 of file device.c.

References _inet_pton(), buffer_get_u16(), buffer_set_u16(), buffer_set_u32(), jaylink_connection::cid, jaylink_device::ctx, jaylink_device_handle::dev, jaylink_connection::handle, jaylink_connection::hid, jaylink_connection::iid, JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_ERR_PROTO, JAYLINK_MAX_CONNECTIONS, JAYLINK_OK, jaylink_strerror(), log_err(), parse_conn_table(), jaylink_connection::pid, size, transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_register().

◆ jaylink_select_interface()

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.

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

Definition at line 203 of file jtag/drivers/libjaylink/libjaylink/target.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, iface, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), JAYLINK_TIF_2W_JTAG_PIC32, JAYLINK_TIF_BDM3, JAYLINK_TIF_FINE, JAYLINK_TIF_JTAG, JAYLINK_TIF_SWD, log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by select_interface().

◆ jaylink_set_reset()

JAYLINK_API 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

Definition at line 450 of file jtag/drivers/libjaylink/libjaylink/target.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by jlink_reset().

◆ jaylink_set_speed()

JAYLINK_API 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

Definition at line 63 of file jtag/drivers/libjaylink/libjaylink/target.c.

References buffer_set_u16(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by jlink_speed().

◆ jaylink_set_target_power()

JAYLINK_API 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

Definition at line 502 of file jtag/drivers/libjaylink/libjaylink/target.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by COMMAND_HANDLER().

◆ jaylink_strerror()

JAYLINK_API 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

Definition at line 40 of file error.c.

References JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NO_MEMORY, JAYLINK_ERR_DEV_NOT_AVAILABLE, JAYLINK_ERR_DEV_NOT_SUPPORTED, JAYLINK_ERR_IO, JAYLINK_ERR_MALLOC, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_ERR_PROTO, JAYLINK_ERR_TIMEOUT, and JAYLINK_OK.

Referenced by adjust_swd_buffer_size(), calculate_trace_buffer_size(), COMMAND_HANDLER(), config_trace(), jaylink_clear_reset(), jaylink_emucom_read(), jaylink_emucom_write(), jaylink_file_delete(), jaylink_file_get_size(), jaylink_file_read(), jaylink_file_write(), jaylink_get_available_interfaces(), jaylink_get_caps(), jaylink_get_counters(), jaylink_get_extended_caps(), jaylink_get_firmware_version(), jaylink_get_free_memory(), jaylink_get_hardware_info(), jaylink_get_hardware_status(), jaylink_get_hardware_version(), jaylink_get_selected_interface(), jaylink_get_speeds(), jaylink_jtag_clear_trst(), jaylink_jtag_io(), jaylink_jtag_set_trst(), jaylink_read_raw_config(), jaylink_register(), jaylink_select_interface(), jaylink_set_reset(), jaylink_set_speed(), jaylink_set_target_power(), jaylink_swd_io(), jaylink_swo_get_speeds(), jaylink_swo_read(), jaylink_swo_start(), jaylink_swo_stop(), jaylink_unregister(), jaylink_write_raw_config(), jlink_flush(), jlink_init(), jlink_quit(), jlink_register(), jlink_speed(), jlink_swd_run_queue(), jlink_usb_location_equal(), poll_trace(), read_device_config(), and select_interface().

◆ jaylink_strerror_name()

JAYLINK_API 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

Definition at line 86 of file error.c.

References JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NO_MEMORY, JAYLINK_ERR_DEV_NOT_AVAILABLE, JAYLINK_ERR_DEV_NOT_SUPPORTED, JAYLINK_ERR_IO, JAYLINK_ERR_MALLOC, JAYLINK_ERR_NOT_AVAILABLE, JAYLINK_ERR_NOT_SUPPORTED, JAYLINK_ERR_PROTO, JAYLINK_ERR_TIMEOUT, and JAYLINK_OK.

◆ jaylink_swd_io()

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.

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

Definition at line 71 of file swd.c.

References buffer_set_u16(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_DEV_NO_MEMORY, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_swd_run_queue().

◆ jaylink_swo_get_speeds()

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.

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

Definition at line 345 of file swo.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, jaylink_swo_speed::freq, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), JAYLINK_SWO_MODE_UART, length, log_err(), jaylink_swo_speed::max_div, jaylink_swo_speed::max_prescaler, jaylink_swo_speed::min_div, jaylink_swo_speed::min_prescaler, transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by config_trace().

◆ jaylink_swo_read()

JAYLINK_API 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

Definition at line 230 of file swo.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_ERR_PROTO, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by poll_trace().

◆ jaylink_swo_start()

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.

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

Definition at line 71 of file swo.c.

References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_OK, jaylink_strerror(), JAYLINK_SWO_MODE_UART, log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by config_trace().

◆ jaylink_swo_stop()

JAYLINK_API 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

Definition at line 156 of file swo.c.

References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_write_read(), and transport_write().

Referenced by config_trace(), and jlink_quit().

◆ jaylink_unref_device()

JAYLINK_API void jaylink_unref_device ( struct jaylink_device dev)

Decrement the reference count of a device.

Parameters
[in,out]devDevice instance.
Since
0.1.0

Definition at line 536 of file device.c.

References jaylink_device::ctx, jaylink_context::devs, jaylink_device::iface, jaylink_device::ipv4_address, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, list_remove(), log_dbg(), log_err(), and jaylink_device::ref_count.

Referenced by clear_discovery_list(), free_device_handle(), jaylink_exit(), and jaylink_free_devices().

◆ jaylink_unregister()

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.

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

Definition at line 1656 of file device.c.

References _inet_pton(), buffer_get_u16(), buffer_set_u16(), buffer_set_u32(), jaylink_connection::cid, jaylink_device::ctx, jaylink_device_handle::dev, jaylink_connection::handle, jaylink_connection::hid, jaylink_connection::iid, JAYLINK_ERR, JAYLINK_ERR_ARG, JAYLINK_ERR_PROTO, JAYLINK_MAX_CONNECTIONS, JAYLINK_OK, jaylink_strerror(), log_err(), parse_conn_table(), jaylink_connection::pid, size, transport_read(), transport_start_read(), transport_start_write_read(), and transport_write().

Referenced by jlink_quit().

◆ jaylink_version_library_get_age()

JAYLINK_API 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

Definition at line 111 of file version.c.

References JAYLINK_VERSION_LIBRARY_AGE.

◆ jaylink_version_library_get_current()

JAYLINK_API 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

Definition at line 86 of file version.c.

References JAYLINK_VERSION_LIBRARY_CURRENT.

◆ jaylink_version_library_get_revision()

JAYLINK_API 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

Definition at line 99 of file version.c.

References JAYLINK_VERSION_LIBRARY_REVISION.

◆ jaylink_version_library_get_string()

JAYLINK_API 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

Definition at line 125 of file version.c.

References JAYLINK_VERSION_LIBRARY_STRING.

◆ jaylink_version_package_get_major()

JAYLINK_API 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

Definition at line 35 of file version.c.

References JAYLINK_VERSION_PACKAGE_MAJOR.

◆ jaylink_version_package_get_micro()

JAYLINK_API 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

Definition at line 59 of file version.c.

References JAYLINK_VERSION_PACKAGE_MICRO.

◆ jaylink_version_package_get_minor()

JAYLINK_API 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

Definition at line 47 of file version.c.

References JAYLINK_VERSION_PACKAGE_MINOR.

◆ jaylink_version_package_get_string()

JAYLINK_API 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

Definition at line 73 of file version.c.

References JAYLINK_VERSION_PACKAGE_STRING.

Referenced by jlink_init().

◆ jaylink_write_raw_config()

JAYLINK_API 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

Definition at line 1342 of file device.c.

References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_DEV_CONFIG_SIZE, JAYLINK_ERR_ARG, JAYLINK_OK, jaylink_strerror(), log_err(), transport_start_write(), and transport_write().

Referenced by COMMAND_HANDLER().