OpenOCD
|
Public libjaylink header file to be used by applications. More...
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... | |
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_device * | jaylink_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_device * | jaylink_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... | |
Public libjaylink header file to be used by applications.
Definition in file libjaylink.h.
#define JAYLINK_API __attribute__ ((visibility ("default"))) |
Macro to mark public libjaylink API symbol.
Definition at line 429 of file libjaylink.h.
#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().
#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().
#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().
#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.
#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.
#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().
#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().
#define JAYLINK_LOG_DOMAIN_DEFAULT "jaylink: " |
Default libjaylink log domain.
Definition at line 90 of file libjaylink.h.
Referenced by jaylink_init().
#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().
#define JAYLINK_MAC_ADDRESS_LENGTH 6 |
Media Access Control (MAC) address length in bytes.
Definition at line 368 of file libjaylink.h.
#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().
#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().
#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().
#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 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.
[in] | ctx | libjaylink context. |
[in] | level | Log level. |
[in] | format | Message format in printf()-style. |
[in] | args | Message arguments. |
[in,out] | user_data | User data passed to the callback function. |
Definition at line 444 of file libjaylink.h.
enum jaylink_capability |
libjaylink capabilities.
Enumerator | |
---|---|
JAYLINK_CAP_HIF_USB | Library supports USB as host interface. |
Definition at line 96 of file libjaylink.h.
enum jaylink_counter |
Device counters.
Definition at line 211 of file libjaylink.h.
Device capabilities.
Definition at line 127 of file libjaylink.h.
enum jaylink_error |
Error codes returned by libjaylink functions.
Definition at line 44 of file libjaylink.h.
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.
|
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).
|
JAYLINK_HW_INFO_IPV4_NETMASK | IPv4 netmask in network byte order.
|
JAYLINK_HW_INFO_IPV4_GATEWAY | Gateway IPv4 address in network byte order.
|
JAYLINK_HW_INFO_IPV4_DNS | DNS server IPv4 address in network byte order.
|
Definition at line 163 of file libjaylink.h.
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.
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.
enum 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.
enum jaylink_log_level |
libjaylink log levels.
Definition at line 74 of file libjaylink.h.
enum 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.
Target interfaces.
Definition at line 232 of file libjaylink.h.
enum 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.
Definition at line 115 of file libjaylink.h.
JAYLINK_API int jaylink_clear_reset | ( | struct jaylink_device_handle * | devh | ) |
Clear the target reset signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_close | ( | struct jaylink_device_handle * | devh | ) |
Close a device.
[in,out] | devh | Device instance. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_device_get_hardware_version | ( | const struct jaylink_device * | dev, |
struct jaylink_hardware_version * | version | ||
) |
Get the hardware version of a device.
[in] | dev | Device instance. |
[out] | version | Hardware version of the device on success and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_TCP only. |
JAYLINK_ERR_NOT_AVAILABLE | Hardware version is not available. |
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_API int jaylink_device_get_host_interface | ( | const struct jaylink_device * | dev, |
enum jaylink_host_interface * | iface | ||
) |
Get the host interface of a device.
[in] | dev | Device instance. |
[out] | iface | Host interface of the device on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
Definition at line 208 of file device.c.
References jaylink_device::iface, JAYLINK_ERR_ARG, and JAYLINK_OK.
JAYLINK_API int jaylink_device_get_ipv4_address | ( | const struct jaylink_device * | dev, |
char * | address | ||
) |
Get the IPv4 address string of a device.
[in] | dev | Device instance. |
[out] | address | IPv4 address string in quad-dotted decimal format of the device on success and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_TCP only. |
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_API int jaylink_device_get_mac_address | ( | const struct jaylink_device * | dev, |
uint8_t * | address | ||
) |
Get the MAC address of a device.
[in] | dev | Device instance. |
[out] | address | MAC address of the device on success and undefined on failure. The length of the MAC address is JAYLINK_MAC_ADDRESS_LENGTH bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_TCP only. |
JAYLINK_ERR_NOT_AVAILABLE | MAC address is not available. |
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_API int jaylink_device_get_nickname | ( | const struct jaylink_device * | dev, |
char * | nickname | ||
) |
Get the nickname of a device.
[in] | dev | Device instance. |
[out] | nickname | Nickname of the device on success and undefined on failure. The maximum length of the nickname is JAYLINK_NICKNAME_MAX_LENGTH bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_TCP only. |
JAYLINK_ERR_NOT_AVAILABLE | Nickname is not available. |
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_API int jaylink_device_get_product_name | ( | const struct jaylink_device * | dev, |
char * | name | ||
) |
Get the product name of a device.
[in] | dev | Device instance. |
[out] | name | Product name of the device on success and undefined on failure. The maximum length of the product name is JAYLINK_PRODUCT_NAME_MAX_LENGTH bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_TCP only. |
JAYLINK_ERR_NOT_AVAILABLE | Product name is not available. |
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_API int jaylink_device_get_serial_number | ( | const struct jaylink_device * | dev, |
uint32_t * | serial_number | ||
) |
Get the serial number of a device.
[in] | dev | Device instance. |
[out] | serial_number | Serial number of the device on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_AVAILABLE | Serial number is not available. |
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_API int jaylink_device_get_usb_address | ( | const struct jaylink_device * | dev, |
enum jaylink_usb_address * | address | ||
) |
Get the USB address of a device.
[in] | dev | Device instance. |
[out] | address | USB address of the device on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_USB only. |
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_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.
[in] | dev | Device instance. |
[out] | bus | The bus number of the device on success and undefined on failure. |
[out] | ports | Newly allocated array which contains the port numbers on success and is undefined on failure. The array must be free'd by the caller. |
[out] | length | Length of the port array on success and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_MALLOC | Memory allocation error. |
JAYLINK_ERR_NOT_SUPPORTED | Supported for devices with host interface JAYLINK_HIF_USB only. |
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_API int jaylink_discovery_scan | ( | struct jaylink_context * | ctx, |
uint32_t | ifaces | ||
) |
Scan for devices.
[in,out] | ctx | libjaylink context. |
[in] | ifaces | Host 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_emucom_read | ( | struct jaylink_device_handle * | devh, |
uint32_t | channel, | ||
uint8_t * | buffer, | ||
uint32_t * | length | ||
) |
Read from an EMUCOM channel.
[in,out] | devh | Device handle. |
[in] | channel | Channel to read data from. |
[out] | buffer | Buffer to store read data on success. Its content is undefined on failure. |
[in,out] | length | Number 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV_NOT_SUPPORTED | Channel is not supported by the device. |
JAYLINK_ERR_DEV_NOT_AVAILABLE | Channel is not available for the requested amount of data. length is updated with the number of bytes available on this channel. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[in] | channel | Channel to write data to. |
[in] | buffer | Buffer to write data from. |
[in,out] | length | Number of bytes to write. On success, the value gets updated with the actual number of bytes written. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV_NOT_SUPPORTED | Channel is not supported by the device. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_exit | ( | struct jaylink_context * | ctx | ) |
Shutdown libjaylink.
[in,out] | ctx | libjaylink context. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
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_API int jaylink_file_delete | ( | struct jaylink_device_handle * | devh, |
const char * | filename | ||
) |
Delete a file.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to delete. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_file_get_size | ( | struct jaylink_device_handle * | devh, |
const char * | filename, | ||
uint32_t * | size | ||
) |
Retrieve the size of a file.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to retrieve the size of. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[out] | size | Size of the file in bytes on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to read from. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[out] | buffer | Buffer to store read data on success. Its content is undefined on failure |
[in] | offset | Offset in bytes relative to the beginning of the file from where to start reading. |
[in,out] | length | Number of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to write to. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[in] | buffer | Buffer to write data from. |
[in] | offset | Offset in bytes relative to the beginning of the file from where to start writing. |
[in,out] | length | Number of bytes to write. On success, the value gets updated with the actual number of bytes written. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
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_API void jaylink_free_devices | ( | struct jaylink_device ** | devs, |
bool | unref | ||
) |
Free devices.
[in,out] | devs | Array of device instances. Must be NULL-terminated. |
[in] | unref | Determines whether the device instances should be unreferenced. |
Definition at line 183 of file device.c.
References jaylink_unref_device().
Referenced by jlink_init().
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.
[in,out] | devh | Device handle. |
[out] | ifaces | Target interfaces on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[out] | caps | Buffer 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_counters | ( | struct jaylink_device_handle * | devh, |
uint32_t | mask, | ||
uint32_t * | values | ||
) |
Retrieve the counter values of a device.
[in,out] | devh | Device handle. |
[in] | mask | A 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] | values | Array 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 . |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API struct jaylink_device* jaylink_get_device | ( | struct jaylink_device_handle * | devh | ) |
Get the device instance from a device handle.
[in] | devh | Device handle. |
Definition at line 670 of file device.c.
References jaylink_device_handle::dev, and NULL.
JAYLINK_API int jaylink_get_devices | ( | struct jaylink_context * | ctx, |
struct jaylink_device *** | devs, | ||
size_t * | count | ||
) |
Get available devices.
[in,out] | ctx | libjaylink context. |
[out] | devs | Newly 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] | count | Number of available devices on success, and undefined on failure. Can be NULL. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_MALLOC | Memory allocation error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[out] | caps | Buffer 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_firmware_version | ( | struct jaylink_device_handle * | devh, |
char ** | version, | ||
size_t * | length | ||
) |
Retrieve the firmware version of a device.
[in,out] | devh | Device handle. |
[out] | version | Newly 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] | length | Length of the firmware version string including trailing null-terminator on success, and undefined on failure. Zero if no firmware version string is available. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_MALLOC | Memory allocation error. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_free_memory | ( | struct jaylink_device_handle * | devh, |
uint32_t * | size | ||
) |
Retrieve the size of free memory of a device.
[in,out] | devh | Device handle. |
[out] | size | Size of free memory in bytes on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_hardware_info | ( | struct jaylink_device_handle * | devh, |
uint32_t | mask, | ||
uint32_t * | info | ||
) |
Retrieve the hardware information of a device.
[in,out] | devh | Device handle. |
[in] | mask | A 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] | info | Array 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_hardware_status | ( | struct jaylink_device_handle * | devh, |
struct jaylink_hardware_status * | status | ||
) |
Retrieve the hardware status of a device.
[in,out] | devh | Device handle. |
[out] | status | Hardware status on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_hardware_version | ( | struct jaylink_device_handle * | devh, |
struct jaylink_hardware_version * | version | ||
) |
Retrieve the hardware version of a device.
version
where jaylink_hardware_version::type is not covered by jaylink_hardware_type.[in,out] | devh | Device handle. |
[out] | version | Hardware version on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_get_selected_interface | ( | struct jaylink_device_handle * | devh, |
enum jaylink_target_interface * | iface | ||
) |
Retrieve the selected target interface.
iface
which is not covered by jaylink_target_interface.[in,out] | devh | Device handle. |
[out] | iface | Selected target interface on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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 integerAssuming, 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.
[in,out] | devh | Device handle. |
[out] | speed | Speed information on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in] | caps | Buffer with capabilities. |
[in] | cap | Bit position of the capability to check for. |
true | Capability is supported. |
false | Capability is not supported or invalid argument. |
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_API int jaylink_init | ( | struct jaylink_context ** | ctx | ) |
Initialize libjaylink.
This function must be called before any other libjaylink function is called.
[out] | ctx | Newly allocated libjaylink context on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_MALLOC | Memory allocation error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_jtag_clear_trst | ( | struct jaylink_device_handle * | devh | ) |
Clear the JTAG test reset (TRST) signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[in] | tms | Buffer to read TMS data from. |
[in] | tdi | Buffer to read TDI data from. |
[out] | tdo | Buffer 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] | length | Number of bits to transfer. |
[in] | version | Version of the JTAG command to use. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV_NO_MEMORY | Not enough memory on the device to perform the operation. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_jtag_set_trst | ( | struct jaylink_device_handle * | devh | ) |
Set the JTAG test reset (TRST) signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API bool jaylink_library_has_cap | ( | enum jaylink_capability | cap | ) |
Check for a capability of libjaylink.
[in] | cap | Capability to check for. |
true | Capability is supported. |
false | Capability is not supported or invalid argument. |
Definition at line 209 of file jtag/drivers/libjaylink/libjaylink/core.c.
References JAYLINK_CAP_HIF_USB.
Referenced by jlink_init().
JAYLINK_API const char* jaylink_log_get_domain | ( | const struct jaylink_context * | ctx | ) |
Get the libjaylink log domain.
[in] | ctx | libjaylink context. |
Definition at line 161 of file jtag/drivers/libjaylink/libjaylink/log.c.
References jaylink_context::log_domain, and NULL.
JAYLINK_API int jaylink_log_get_level | ( | const struct jaylink_context * | ctx, |
enum jaylink_log_level * | level | ||
) |
Get the libjaylink log level.
[in] | ctx | libjaylink context. |
[out] | level | Log level on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
Definition at line 72 of file jtag/drivers/libjaylink/libjaylink/log.c.
References JAYLINK_ERR_ARG, JAYLINK_OK, and jaylink_context::log_level.
JAYLINK_API int jaylink_log_set_callback | ( | struct jaylink_context * | ctx, |
jaylink_log_callback | callback, | ||
void * | user_data | ||
) |
Set the libjaylink log callback function.
[in,out] | ctx | libjaylink context. |
[in] | callback | Callback function to use, or NULL to use the default log function. |
[in] | user_data | User data to be passed to the callback function. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
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_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.
[in,out] | ctx | libjaylink context. |
[in] | domain | Log domain to use. To set the default log domain, use JAYLINK_LOG_DOMAIN_DEFAULT. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_log_set_level | ( | struct jaylink_context * | ctx, |
enum jaylink_log_level | level | ||
) |
Set the libjaylink log level.
[in,out] | ctx | libjaylink context. |
[in] | level | Log level to set. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
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_API int jaylink_open | ( | struct jaylink_device * | dev, |
struct jaylink_device_handle ** | devh | ||
) |
Open a device.
[in,out] | dev | Device instance. |
[out] | devh | Newly allocated handle for the opened device on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_MALLOC | Memory allocation error. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in] | str | String representation to convert. |
[out] | serial_number | Serial number on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR | Conversion error. Serial number is invalid or string representation contains invalid character(s). |
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_API int jaylink_read_raw_config | ( | struct jaylink_device_handle * | devh, |
uint8_t * | config | ||
) |
Read the raw configuration data of a device.
[in,out] | devh | Device handle. |
[out] | config | Buffer 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API struct jaylink_device* jaylink_ref_device | ( | struct jaylink_device * | dev | ) |
Increment the reference count of a device.
[in,out] | dev | Device instance. |
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_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.
Example code:
[in,out] | devh | Device handle. |
[in,out] | connection | Connection to register on the device. |
[out] | connections | Array 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] | count | Number of device connections on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
prev_iface
which is not covered by jaylink_target_interface.[in,out] | devh | Device handle. |
[in] | iface | Target interface to select. |
[out] | prev_iface | Previously selected target interface on success, and undefined on failure. Can be NULL. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_set_reset | ( | struct jaylink_device_handle * | devh | ) |
Set the target reset signal.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_set_speed | ( | struct jaylink_device_handle * | devh, |
uint16_t | speed | ||
) |
Set the target interface speed.
[in,out] | devh | Device handle. |
[in] | speed | Speed 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. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_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.
[in,out] | devh | Device handle. |
[in] | enable | Determines whether to enable or disable the target power supply. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API const char* jaylink_strerror | ( | int | error_code | ) |
Return a human-readable description of a libjaylink error code.
[in] | error_code | A libjaylink error code. See jaylink_error for valid values. |
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_API const char* jaylink_strerror_name | ( | int | error_code | ) |
Return the name of a libjaylink error code.
[in] | error_code | A libjaylink error code. See jaylink_error for valid values. |
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_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.
[in,out] | devh | Device handle. |
[in] | direction | Buffer to read the transfer direction from. |
[in] | out | Buffer to read host-to-target data from. |
[out] | in | Buffer 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] | length | Total number of bits to transfer from host to target and vice versa. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV_NO_MEMORY | Not enough memory on the device to perform the operation. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_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 integerAssuming, 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.
[in,out] | devh | Device handle. |
[in] | mode | Capture mode to retrieve speeds for. |
[out] | speed | Speed information on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_swo_read | ( | struct jaylink_device_handle * | devh, |
uint8_t * | buffer, | ||
uint32_t * | length | ||
) |
Read SWO trace data.
[in,out] | devh | Device handle. |
[out] | buffer | Buffer to store trace data on success. Its content is undefined on failure. |
[in,out] | length | Maximum number of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_swo_start | ( | struct jaylink_device_handle * | devh, |
enum jaylink_swo_mode | mode, | ||
uint32_t | baudrate, | ||
uint32_t | size | ||
) |
Start SWO capture.
[in,out] | devh | Device handle. |
[in] | mode | Mode to capture data with. |
[in] | baudrate | Baudrate to capture data in bit per second. |
[in] | size | Device internal buffer size in bytes to use for capturing. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_swo_stop | ( | struct jaylink_device_handle * | devh | ) |
Stop SWO capture.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error. |
JAYLINK_ERR | Other error conditions. |
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_API void jaylink_unref_device | ( | struct jaylink_device * | dev | ) |
Decrement the reference count of a device.
[in,out] | dev | Device instance. |
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_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.
[in,out] | devh | Device handle. |
[in,out] | connection | Connection to unregister from the device. |
[out] | connections | Array 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] | count | Number of device connections on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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_API int jaylink_version_library_get_age | ( | void | ) |
Get the age version number of the libjaylink libtool interface.
Definition at line 111 of file version.c.
References JAYLINK_VERSION_LIBRARY_AGE.
JAYLINK_API int jaylink_version_library_get_current | ( | void | ) |
Get the current version number of the libjaylink libtool interface.
Definition at line 86 of file version.c.
References JAYLINK_VERSION_LIBRARY_CURRENT.
JAYLINK_API int jaylink_version_library_get_revision | ( | void | ) |
Get the revision version number of the libjaylink libtool interface.
Definition at line 99 of file version.c.
References JAYLINK_VERSION_LIBRARY_REVISION.
JAYLINK_API const char* jaylink_version_library_get_string | ( | void | ) |
Get the version number string of the libjaylink libtool interface.
Definition at line 125 of file version.c.
References JAYLINK_VERSION_LIBRARY_STRING.
JAYLINK_API int jaylink_version_package_get_major | ( | void | ) |
Get the major version number of the libjaylink package.
Definition at line 35 of file version.c.
References JAYLINK_VERSION_PACKAGE_MAJOR.
JAYLINK_API int jaylink_version_package_get_micro | ( | void | ) |
Get the micro version number of the libjaylink package.
Definition at line 59 of file version.c.
References JAYLINK_VERSION_PACKAGE_MICRO.
JAYLINK_API int jaylink_version_package_get_minor | ( | void | ) |
Get the minor version number of the libjaylink package.
Definition at line 47 of file version.c.
References JAYLINK_VERSION_PACKAGE_MINOR.
JAYLINK_API const char* jaylink_version_package_get_string | ( | void | ) |
Get the version number string of the libjaylink package.
Definition at line 73 of file version.c.
References JAYLINK_VERSION_PACKAGE_STRING.
Referenced by jlink_init().
JAYLINK_API int jaylink_write_raw_config | ( | struct jaylink_device_handle * | devh, |
const uint8_t * | config | ||
) |
Write the raw configuration data of a device.
[in,out] | devh | Device handle. |
[in] | config | Buffer to write configuration data from. The size of the configuration data is expected to be JAYLINK_DEV_CONFIG_SIZE bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other error conditions. |
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().