OpenOCD
libjaylink-internal.h File Reference

Internal libjaylink header file. More...

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

Go to the source code of this file.

Data Structures

struct  jaylink_context
 Opaque structure representing a libjaylink context. More...
 
struct  jaylink_device
 Opaque structure representing a device. More...
 
struct  jaylink_device_handle
 Opaque structure representing a handle of a device. More...
 
struct  list
 

Macros

#define JAYLINK_PRIV   __attribute__ ((visibility ("hidden")))
 Macro to mark private libjaylink symbol. More...
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 Calculate the minimum of two numeric values. More...
 

Typedefs

typedef bool(* list_compare_callback) (const void *data, const void *user_data)
 

Functions

JAYLINK_PRIV uint16_t buffer_get_u16 (const uint8_t *buffer, size_t offset)
 Read a 16-bit unsigned integer value from a buffer. More...
 
JAYLINK_PRIV uint32_t buffer_get_u32 (const uint8_t *buffer, size_t offset)
 Read a 32-bit unsigned integer value from a buffer. More...
 
JAYLINK_PRIV void buffer_set_u16 (uint8_t *buffer, uint16_t value, size_t offset)
 Write a 16-bit unsigned integer value to a buffer. More...
 
JAYLINK_PRIV void buffer_set_u32 (uint8_t *buffer, uint32_t value, size_t offset)
 Write a 32-bit unsigned integer value to a buffer. More...
 
JAYLINK_PRIV struct jaylink_devicedevice_allocate (struct jaylink_context *ctx)
 
JAYLINK_PRIV int discovery_tcp_scan (struct jaylink_context *ctx)
 
JAYLINK_PRIV int discovery_usb_scan (struct jaylink_context *ctx)
 
JAYLINK_PRIV struct listlist_find_custom (struct list *list, list_compare_callback callback, const void *user_data)
 
JAYLINK_PRIV void list_free (struct list *list)
 
JAYLINK_PRIV size_t list_length (struct list *list)
 
JAYLINK_PRIV struct listlist_prepend (struct list *list, void *data)
 
JAYLINK_PRIV struct listlist_remove (struct list *list, const void *data)
 
JAYLINK_PRIV void log_dbg (const struct jaylink_context *ctx, const char *format,...)
 
JAYLINK_PRIV void log_dbgio (const struct jaylink_context *ctx, const char *format,...)
 
JAYLINK_PRIV void log_err (const struct jaylink_context *ctx, const char *format,...)
 
JAYLINK_PRIV void log_info (const struct jaylink_context *ctx, const char *format,...)
 
JAYLINK_PRIV int log_vprintf (const struct jaylink_context *ctx, enum jaylink_log_level level, const char *format, va_list args, void *user_data)
 
JAYLINK_PRIV void log_warn (const struct jaylink_context *ctx, const char *format,...)
 
JAYLINK_PRIV bool socket_bind (int sock, const struct sockaddr *address, size_t length)
 Bind an address to a socket. More...
 
JAYLINK_PRIV bool socket_close (int sock)
 Close a socket. More...
 
JAYLINK_PRIV bool socket_recv (int sock, void *buffer, size_t *length, int flags)
 Receive a message from a socket. More...
 
JAYLINK_PRIV bool socket_recvfrom (int sock, void *buffer, size_t *length, int flags, struct sockaddr *address, size_t *address_length)
 Receive a message from a socket. More...
 
JAYLINK_PRIV bool socket_send (int sock, const void *buffer, size_t *length, int flags)
 Send a message on a socket. More...
 
JAYLINK_PRIV bool socket_sendto (int sock, const void *buffer, size_t *length, int flags, const struct sockaddr *address, size_t address_length)
 Send a message on a socket. More...
 
JAYLINK_PRIV bool socket_set_option (int sock, int level, int option, const void *value, size_t length)
 Set an option on a socket. More...
 
JAYLINK_PRIV int transport_close (struct jaylink_device_handle *devh)
 Close a device. More...
 
JAYLINK_PRIV int transport_open (struct jaylink_device_handle *devh)
 Open a device. More...
 
JAYLINK_PRIV int transport_read (struct jaylink_device_handle *devh, uint8_t *buffer, size_t length)
 Read data from a device. More...
 
JAYLINK_PRIV int transport_start_read (struct jaylink_device_handle *devh, size_t length)
 Start a read operation for a device. More...
 
JAYLINK_PRIV int transport_start_write (struct jaylink_device_handle *devh, size_t length, bool has_command)
 Start a write operation for a device. More...
 
JAYLINK_PRIV int transport_start_write_read (struct jaylink_device_handle *devh, size_t write_length, size_t read_length, bool has_command)
 Start a write and read operation for a device. More...
 
JAYLINK_PRIV int transport_tcp_close (struct jaylink_device_handle *devh)
 
JAYLINK_PRIV int transport_tcp_open (struct jaylink_device_handle *devh)
 
JAYLINK_PRIV int transport_tcp_read (struct jaylink_device_handle *devh, uint8_t *buffer, size_t length)
 
JAYLINK_PRIV int transport_tcp_start_read (struct jaylink_device_handle *devh, size_t length)
 
JAYLINK_PRIV int transport_tcp_start_write (struct jaylink_device_handle *devh, size_t length, bool has_command)
 
JAYLINK_PRIV int transport_tcp_start_write_read (struct jaylink_device_handle *devh, size_t write_length, size_t read_length, bool has_command)
 
JAYLINK_PRIV int transport_tcp_write (struct jaylink_device_handle *devh, const uint8_t *buffer, size_t length)
 
JAYLINK_PRIV int transport_usb_close (struct jaylink_device_handle *devh)
 
JAYLINK_PRIV int transport_usb_open (struct jaylink_device_handle *devh)
 
JAYLINK_PRIV int transport_usb_read (struct jaylink_device_handle *devh, uint8_t *buffer, size_t length)
 
JAYLINK_PRIV int transport_usb_start_read (struct jaylink_device_handle *devh, size_t length)
 
JAYLINK_PRIV int transport_usb_start_write (struct jaylink_device_handle *devh, size_t length, bool has_command)
 
JAYLINK_PRIV int transport_usb_start_write_read (struct jaylink_device_handle *devh, size_t write_length, size_t read_length, bool has_command)
 
JAYLINK_PRIV int transport_usb_write (struct jaylink_device_handle *devh, const uint8_t *buffer, size_t length)
 
JAYLINK_PRIV int transport_write (struct jaylink_device_handle *devh, const uint8_t *buffer, size_t length)
 Write data to a device. More...
 

Detailed Description

Internal libjaylink header file.

Definition in file libjaylink-internal.h.

Macro Definition Documentation

◆ JAYLINK_PRIV

#define JAYLINK_PRIV   __attribute__ ((visibility ("hidden")))

Macro to mark private libjaylink symbol.

Definition at line 55 of file libjaylink-internal.h.

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Calculate the minimum of two numeric values.

Definition at line 59 of file libjaylink-internal.h.

Typedef Documentation

◆ list_compare_callback

typedef bool(* list_compare_callback) (const void *data, const void *user_data)

Definition at line 207 of file libjaylink-internal.h.

Function Documentation

◆ buffer_get_u16()

JAYLINK_PRIV uint16_t buffer_get_u16 ( const uint8_t *  buffer,
size_t  offset 
)

Read a 16-bit unsigned integer value from a buffer.

The value in the buffer is expected to be stored in device byte order.

Parameters
[in]bufferBuffer to read the value from.
[in]offsetOffset of the value within the buffer in bytes.
Returns
The value read from the buffer in host byte order.

Definition at line 68 of file buffer.c.

Referenced by handle_server_hello(), jaylink_get_firmware_version(), jaylink_get_hardware_status(), jaylink_get_speeds(), jaylink_register(), jaylink_unregister(), and parse_conn_table().

◆ buffer_get_u32()

JAYLINK_PRIV uint32_t buffer_get_u32 ( const uint8_t *  buffer,
size_t  offset 
)

Read a 32-bit unsigned integer value from a buffer.

The value in the buffer is expected to be stored in device byte order.

Parameters
[in]bufferBuffer to read the value from.
[in]offsetOffset of the value within the buffer in bytes.
Returns
The value read from the buffer in host byte order.

Definition at line 122 of file buffer.c.

Referenced by 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_counters(), jaylink_get_free_memory(), jaylink_get_hardware_info(), jaylink_get_hardware_version(), jaylink_get_selected_interface(), jaylink_get_speeds(), jaylink_select_interface(), jaylink_swo_get_speeds(), jaylink_swo_read(), jaylink_swo_start(), jaylink_swo_stop(), parse_adv_message(), and parse_conn_table().

◆ buffer_set_u16()

JAYLINK_PRIV void buffer_set_u16 ( uint8_t *  buffer,
uint16_t  value,
size_t  offset 
)

Write a 16-bit unsigned integer value to a buffer.

The value is stored in the buffer in device byte order.

Parameters
[out]bufferBuffer to write the value into.
[in]valueValue to write into the buffer in host byte order.
[in]offsetOffset of the value within the buffer in bytes.

Definition at line 43 of file buffer.c.

Referenced by jaylink_jtag_io(), jaylink_register(), jaylink_set_speed(), jaylink_swd_io(), and jaylink_unregister().

◆ buffer_set_u32()

JAYLINK_PRIV void buffer_set_u32 ( uint8_t *  buffer,
uint32_t  value,
size_t  offset 
)

Write a 32-bit unsigned integer value to a buffer.

The value is stored in the buffer in device byte order.

Parameters
[out]bufferBuffer to write the value into.
[in]valueValue to write into the buffer in host byte order.
[in]offsetOffset of the value within the buffer in bytes.

Definition at line 95 of file buffer.c.

Referenced by jaylink_emucom_read(), jaylink_emucom_write(), jaylink_file_read(), jaylink_file_write(), jaylink_get_counters(), jaylink_get_hardware_info(), jaylink_register(), jaylink_swo_get_speeds(), jaylink_swo_read(), jaylink_swo_start(), and jaylink_unregister().

◆ device_allocate()

JAYLINK_PRIV struct jaylink_device* device_allocate ( struct jaylink_context ctx)

Definition at line 77 of file device.c.

References jaylink_device::ctx, jaylink_context::devs, list_prepend(), NULL, and jaylink_device::ref_count.

Referenced by probe_device().

◆ discovery_tcp_scan()

◆ discovery_usb_scan()

◆ list_find_custom()

JAYLINK_PRIV struct list* list_find_custom ( struct list list,
list_compare_callback  callback,
const void *  user_data 
)

Definition at line 78 of file list.c.

References list::data, list::next, and NULL.

Referenced by find_device().

◆ list_free()

JAYLINK_PRIV void list_free ( struct list list)

Definition at line 106 of file list.c.

References list::next.

Referenced by jaylink_exit().

◆ list_length()

JAYLINK_PRIV size_t list_length ( struct list list)

Definition at line 95 of file list.c.

References length, and list::next.

Referenced by jaylink_get_devices().

◆ list_prepend()

JAYLINK_PRIV struct list* list_prepend ( struct list list,
void *  data 
)

Definition at line 31 of file list.c.

References list::data, list::next, and NULL.

Referenced by device_allocate(), discovery_tcp_scan(), and discovery_usb_scan().

◆ list_remove()

JAYLINK_PRIV struct list* list_remove ( struct list list,
const void *  data 
)

Definition at line 47 of file list.c.

References list::data, list::next, and NULL.

Referenced by jaylink_unref_device().

◆ log_dbg()

◆ log_dbgio()

◆ log_err()

JAYLINK_PRIV void log_err ( const struct jaylink_context ctx,
const char *  format,
  ... 
)

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

References JAYLINK_LOG_LEVEL_ERROR, jaylink_context::log_callback, and jaylink_context::log_callback_data.

Referenced by _recv(), _send(), adjust_buffer(), discovery_tcp_scan(), discovery_usb_scan(), handle_server_hello(), initialize_handle(), jaylink_clear_reset(), jaylink_device_get_usb_bus_ports(), jaylink_discovery_scan(), 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_devices(), 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_open(), 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_unref_device(), jaylink_unregister(), jaylink_write_raw_config(), set_socket_timeouts(), transport_close(), transport_open(), transport_read(), transport_start_read(), transport_start_write(), transport_start_write_read(), transport_tcp_open(), transport_tcp_read(), transport_tcp_write(), transport_usb_close(), transport_usb_open(), transport_usb_read(), transport_usb_write(), transport_write(), usb_recv(), and usb_send().

◆ log_info()

JAYLINK_PRIV void log_info ( const struct jaylink_context ctx,
const char *  format,
  ... 
)

◆ log_vprintf()

JAYLINK_PRIV int log_vprintf ( const struct jaylink_context ctx,
enum jaylink_log_level  level,
const char *  format,
va_list  args,
void *  user_data 
)

◆ log_warn()

◆ socket_bind()

JAYLINK_PRIV bool socket_bind ( int  sock,
const struct sockaddr *  address,
size_t  length 
)

Bind an address to a socket.

Parameters
[in]sockSocket descriptor.
[in]addressAddress to be bound to the socket.
[in]lengthLength of the structure pointed to by address in bytes.
Returns
Whether the address was successfully assigned to the socket.

Definition at line 69 of file socket.c.

Referenced by discovery_tcp_scan().

◆ socket_close()

JAYLINK_PRIV bool socket_close ( int  sock)

Close a socket.

Parameters
[in]sockSocket descriptor.
Returns
Whether the socket was successfully closed.

Definition at line 44 of file socket.c.

Referenced by discovery_tcp_scan(), and transport_tcp_open().

◆ socket_recv()

JAYLINK_PRIV bool socket_recv ( int  sock,
void *  buffer,
size_t *  length,
int  flags 
)

Receive a message from a socket.

Parameters
[in]sockSocket descriptor.
[out]bufferBuffer to store the received message on success. Its content is undefined on failure.
[in,out]lengthMaximum length of the message in bytes. On success, the value gets updated with the actual number of received bytes. The value is undefined on failure.
[in]flagsFlags to modify the function behaviour. Use bitwise OR to specify multiple flags.
Returns
Whether a message was successfully received.

Definition at line 132 of file socket.c.

Referenced by _recv().

◆ socket_recvfrom()

JAYLINK_PRIV bool socket_recvfrom ( int  sock,
void *  buffer,
size_t *  length,
int  flags,
struct sockaddr *  address,
size_t *  address_length 
)

Receive a message from a socket.

Parameters
[in]sockSocket descriptor.
[out]bufferBuffer to store the received message on success. Its content is undefined on failure.
[in,out]lengthMaximum length of the message in bytes. On success, the value gets updated with the actual number of received bytes. The value is undefined on failure.
[in]flagsFlags to modify the function behaviour. Use bitwise OR to specify multiple flags.
[out]addressStructure to store the source address of the message on success. Its content is undefined on failure. Can be NULL.
[in,out]address_lengthLength of the structure pointed to by address in bytes. On success, the value gets updated with the actual length of the structure. The value is undefined on failure. Should be NULL if address is NULL.
Returns
Whether a message was successfully received.

Definition at line 211 of file socket.c.

Referenced by discovery_tcp_scan().

◆ socket_send()

JAYLINK_PRIV bool socket_send ( int  sock,
const void *  buffer,
size_t *  length,
int  flags 
)

Send a message on a socket.

Parameters
[in]sockSocket descriptor.
[in]bufferBuffer of the message to be sent.
[in,out]lengthLength of the message in bytes. On success, the value gets updated with the actual number of bytes sent. The value is undefined on failure.
[in]flagsFlags to modify the function behaviour. Use bitwise OR to specify multiple flags.
Returns
Whether the message was sent successfully.

Definition at line 100 of file socket.c.

Referenced by _send().

◆ socket_sendto()

JAYLINK_PRIV bool socket_sendto ( int  sock,
const void *  buffer,
size_t *  length,
int  flags,
const struct sockaddr *  address,
size_t  address_length 
)

Send a message on a socket.

Parameters
[in]sockSocket descriptor.
[in]bufferBuffer to send message from.
[in,out]lengthNumber of bytes to send. On success, the value gets updated with the actual number of bytes sent. The value is undefined on failure.
[in]flagsFlags to modify the function behaviour. Use bitwise OR to specify multiple flags.
[in]addressDestination address of the message.
[in]address_lengthLength of the structure pointed to by address in bytes.
Returns
Whether the message was successfully sent.

Definition at line 168 of file socket.c.

Referenced by discovery_tcp_scan().

◆ socket_set_option()

JAYLINK_PRIV bool socket_set_option ( int  sock,
int  level,
int  option,
const void *  value,
size_t  length 
)

Set an option on a socket.

Parameters
[in]sockSocket descriptor.
[in]levelLevel at which the option is defined.
[in]optionOption to set the value for.
[in]valueBuffer of the value to be set.
[in]lengthLength of the value buffer in bytes.
Returns
Whether the option was set successfully.

Definition at line 250 of file socket.c.

Referenced by discovery_tcp_scan(), and set_socket_timeouts().

◆ transport_close()

JAYLINK_PRIV int transport_close ( struct jaylink_device_handle devh)

Close a device.

After this function has been called no other function of the transport abstraction layer for the given device handle must be called.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERROther error conditions.

Definition at line 82 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_close(), and transport_usb_close().

Referenced by jaylink_close().

◆ transport_open()

JAYLINK_PRIV int transport_open ( struct jaylink_device_handle devh)

Open a device.

This function must be called before any other function of the transport abstraction layer for the given device handle is called.

Parameters
[in,out]devhDevice handle.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.

Definition at line 49 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_open(), and transport_usb_open().

Referenced by jaylink_open().

◆ transport_read()

JAYLINK_PRIV int transport_read ( struct jaylink_device_handle devh,
uint8_t *  buffer,
size_t  length 
)

Read data from a device.

Before this function is used transport_start_read() or transport_start_write_read() must be called to start a read operation. The total number of read bytes must not exceed the number of bytes of the read operation.

Parameters
[in,out]devhDevice handle.
[out]bufferBuffer to read data into on success. Its content is undefined on failure.
[in]lengthNumber of bytes to read.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.

Definition at line 288 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_read(), and transport_usb_read().

Referenced by 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_io(), jaylink_read_raw_config(), jaylink_register(), jaylink_select_interface(), jaylink_swd_io(), jaylink_swo_get_speeds(), jaylink_swo_read(), jaylink_swo_start(), jaylink_swo_stop(), and jaylink_unregister().

◆ transport_start_read()

JAYLINK_PRIV int transport_start_read ( struct jaylink_device_handle devh,
size_t  length 
)

Start a read operation for a device.

The data of a read operation must be read with at least one call of transport_read(). It is required that all data of a read operation is read before an other write and/or read operation is started.

Parameters
[in,out]devhDevice handle.
[in]lengthNumber of bytes of the read operation.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.

Definition at line 155 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_start_read(), and transport_usb_start_read().

Referenced by jaylink_emucom_read(), jaylink_file_delete(), jaylink_file_get_size(), jaylink_file_read(), jaylink_file_write(), jaylink_get_firmware_version(), jaylink_register(), jaylink_swo_get_speeds(), jaylink_swo_read(), and jaylink_unregister().

◆ transport_start_write()

JAYLINK_PRIV int transport_start_write ( struct jaylink_device_handle devh,
size_t  length,
bool  has_command 
)

Start a write operation for a device.

The data of a write operation must be written with at least one call of transport_write(). It is required that all data of a write operation is written before an other write and/or read operation is started.

Parameters
[in,out]devhDevice handle.
[in]lengthNumber of bytes of the write operation.
[in]has_commandDetermines whether the data of the write operation contains the protocol command.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.

Definition at line 119 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_start_write(), and transport_usb_start_write().

Referenced by jaylink_clear_reset(), jaylink_emucom_write(), jaylink_file_delete(), jaylink_file_get_size(), jaylink_file_read(), jaylink_file_write(), jaylink_jtag_clear_trst(), jaylink_jtag_set_trst(), jaylink_set_reset(), jaylink_set_speed(), jaylink_set_target_power(), and jaylink_write_raw_config().

◆ transport_start_write_read()

JAYLINK_PRIV int transport_start_write_read ( struct jaylink_device_handle devh,
size_t  write_length,
size_t  read_length,
bool  has_command 
)

Start a write and read operation for a device.

This function starts a write and read operation as the consecutive call of transport_start_write() and transport_start_read() but has a different meaning from the protocol perspective and can therefore not be replaced by these functions and vice versa.

Note
The write operation must be completed first before the read operation must be processed.
Parameters
[in,out]devhDevice handle.
[in]write_lengthNumber of bytes of the write operation.
[in]read_lengthNumber of bytes of the read operation.
[in]has_commandDetermines whether the data of the write operation contains the protocol command.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.

Definition at line 198 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_start_write_read(), and transport_usb_start_write_read().

Referenced by jaylink_emucom_read(), jaylink_emucom_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_io(), jaylink_read_raw_config(), jaylink_register(), jaylink_select_interface(), jaylink_swd_io(), jaylink_swo_get_speeds(), jaylink_swo_read(), jaylink_swo_start(), jaylink_swo_stop(), and jaylink_unregister().

◆ transport_tcp_close()

JAYLINK_PRIV int transport_tcp_close ( struct jaylink_device_handle devh)

◆ transport_tcp_open()

◆ transport_tcp_read()

◆ transport_tcp_start_read()

◆ transport_tcp_start_write()

◆ transport_tcp_start_write_read()

◆ transport_tcp_write()

◆ transport_usb_close()

JAYLINK_PRIV int transport_usb_close ( struct jaylink_device_handle devh)

◆ transport_usb_open()

◆ transport_usb_read()

◆ transport_usb_start_read()

◆ transport_usb_start_write()

JAYLINK_PRIV int transport_usb_start_write ( struct jaylink_device_handle devh,
size_t  length,
bool  has_command 
)

◆ transport_usb_start_write_read()

◆ transport_usb_write()

◆ transport_write()

JAYLINK_PRIV int transport_write ( struct jaylink_device_handle devh,
const uint8_t *  buffer,
size_t  length 
)

Write data to a device.

Before this function is used transport_start_write() or transport_start_write_read() must be called to start a write operation. The total number of written bytes must not exceed the number of bytes of the write operation.

Note
A write operation will be performed and the data will be sent to the device when the number of written bytes reaches the number of bytes of the write operation. Before that the data will be written into a buffer.
Parameters
[in,out]devhDevice handle.
[in]bufferBuffer to write data from.
[in]lengthNumber of bytes to write.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_IOInput/output error.
JAYLINK_ERROther error conditions.

Definition at line 246 of file jtag/drivers/libjaylink/libjaylink/transport.c.

References jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::iface, JAYLINK_ERR, JAYLINK_HIF_TCP, JAYLINK_HIF_USB, log_err(), transport_tcp_write(), and transport_usb_write().

Referenced by 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(), and jaylink_write_raw_config().