OpenOCD
|
Internal libjaylink header file. More...
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_device * | device_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 list * | list_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 list * | list_prepend (struct list *list, void *data) |
JAYLINK_PRIV struct list * | list_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... | |
Internal libjaylink header file.
Definition in file libjaylink-internal.h.
#define JAYLINK_PRIV __attribute__ ((visibility ("hidden"))) |
Macro to mark private libjaylink symbol.
Definition at line 55 of file libjaylink-internal.h.
#define MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Calculate the minimum of two numeric values.
Definition at line 59 of file libjaylink-internal.h.
typedef bool(* list_compare_callback) (const void *data, const void *user_data) |
Definition at line 207 of file libjaylink-internal.h.
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.
[in] | buffer | Buffer to read the value from. |
[in] | offset | Offset of the value within the buffer in bytes. |
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().
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.
[in] | buffer | Buffer to read the value from. |
[in] | offset | Offset of the value within the buffer in bytes. |
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().
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.
[out] | buffer | Buffer to write the value into. |
[in] | value | Value to write into the buffer in host byte order. |
[in] | offset | Offset 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().
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.
[out] | buffer | Buffer to write the value into. |
[in] | value | Value to write into the buffer in host byte order. |
[in] | offset | Offset 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().
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().
JAYLINK_PRIV int discovery_tcp_scan | ( | struct jaylink_context * | ctx | ) |
Definition at line 229 of file discovery_tcp.c.
References jaylink_context::discovered_devs, JAYLINK_ERR, JAYLINK_ERR_IO, JAYLINK_OK, length, list_prepend(), log_dbg(), log_err(), log_warn(), NULL, probe_device(), socket_bind(), socket_close(), socket_recvfrom(), socket_sendto(), socket_set_option(), timeval::tv_sec, and timeval::tv_usec.
Referenced by jaylink_discovery_scan().
JAYLINK_PRIV int discovery_usb_scan | ( | struct jaylink_context * | ctx | ) |
Definition at line 250 of file discovery_usb.c.
References devs, jaylink_context::discovered_devs, JAYLINK_ERR, JAYLINK_ERR_IO, JAYLINK_OK, list_prepend(), log_dbg(), log_err(), and probe_device().
Referenced by jaylink_discovery_scan().
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().
JAYLINK_PRIV void list_free | ( | struct list * | list | ) |
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().
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().
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().
JAYLINK_PRIV void log_dbg | ( | const struct jaylink_context * | ctx, |
const char * | format, | ||
... | |||
) |
Definition at line 239 of file jtag/drivers/libjaylink/libjaylink/log.c.
References JAYLINK_LOG_LEVEL_DEBUG, jaylink_context::log_callback, and jaylink_context::log_callback_data.
Referenced by adjust_buffer(), discovery_tcp_scan(), discovery_usb_scan(), handle_server_hello(), initialize_handle(), jaylink_unref_device(), probe_device(), transport_tcp_close(), transport_tcp_open(), transport_tcp_start_read(), transport_usb_close(), transport_usb_open(), and transport_usb_start_read().
JAYLINK_PRIV void log_dbgio | ( | const struct jaylink_context * | ctx, |
const char * | format, | ||
... | |||
) |
Definition at line 254 of file jtag/drivers/libjaylink/libjaylink/log.c.
References JAYLINK_LOG_LEVEL_DEBUG_IO, jaylink_context::log_callback, and jaylink_context::log_callback_data.
Referenced by _recv(), _send(), transport_tcp_read(), transport_tcp_start_read(), transport_tcp_start_write(), transport_tcp_start_write_read(), transport_tcp_write(), transport_usb_read(), transport_usb_start_read(), transport_usb_start_write(), transport_usb_start_write_read(), transport_usb_write(), usb_recv(), and usb_send().
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().
JAYLINK_PRIV void log_info | ( | const struct jaylink_context * | ctx, |
const char * | format, | ||
... | |||
) |
Definition at line 224 of file jtag/drivers/libjaylink/libjaylink/log.c.
References JAYLINK_LOG_LEVEL_INFO, jaylink_context::log_callback, and jaylink_context::log_callback_data.
JAYLINK_PRIV int log_vprintf | ( | const struct jaylink_context * | ctx, |
enum jaylink_log_level | level, | ||
const char * | format, | ||
va_list | args, | ||
void * | user_data | ||
) |
Definition at line 171 of file jtag/drivers/libjaylink/libjaylink/log.c.
References jaylink_context::log_domain, and jaylink_context::log_level.
Referenced by jaylink_init(), and jaylink_log_set_callback().
JAYLINK_PRIV void log_warn | ( | const struct jaylink_context * | ctx, |
const char * | format, | ||
... | |||
) |
Definition at line 209 of file jtag/drivers/libjaylink/libjaylink/log.c.
References JAYLINK_LOG_LEVEL_WARNING, jaylink_context::log_callback, and jaylink_context::log_callback_data.
Referenced by discovery_tcp_scan(), probe_device(), transport_tcp_start_read(), transport_tcp_start_write(), transport_tcp_start_write_read(), transport_usb_start_read(), transport_usb_start_write(), transport_usb_start_write_read(), usb_recv(), and usb_send().
JAYLINK_PRIV bool socket_bind | ( | int | sock, |
const struct sockaddr * | address, | ||
size_t | length | ||
) |
Bind an address to a socket.
[in] | sock | Socket descriptor. |
[in] | address | Address to be bound to the socket. |
[in] | length | Length of the structure pointed to by address in bytes. |
Definition at line 69 of file socket.c.
Referenced by discovery_tcp_scan().
JAYLINK_PRIV bool socket_close | ( | int | sock | ) |
Close a socket.
[in] | sock | Socket descriptor. |
Definition at line 44 of file socket.c.
Referenced by discovery_tcp_scan(), and transport_tcp_open().
JAYLINK_PRIV bool socket_recv | ( | int | sock, |
void * | buffer, | ||
size_t * | length, | ||
int | flags | ||
) |
Receive a message from a socket.
[in] | sock | Socket descriptor. |
[out] | buffer | Buffer to store the received message on success. Its content is undefined on failure. |
[in,out] | length | Maximum 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] | flags | Flags to modify the function behaviour. Use bitwise OR to specify multiple flags. |
Definition at line 132 of file socket.c.
Referenced by _recv().
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.
[in] | sock | Socket descriptor. |
[out] | buffer | Buffer to store the received message on success. Its content is undefined on failure. |
[in,out] | length | Maximum 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] | flags | Flags to modify the function behaviour. Use bitwise OR to specify multiple flags. |
[out] | address | Structure to store the source address of the message on success. Its content is undefined on failure. Can be NULL. |
[in,out] | address_length | Length 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. |
Definition at line 211 of file socket.c.
Referenced by discovery_tcp_scan().
JAYLINK_PRIV bool socket_send | ( | int | sock, |
const void * | buffer, | ||
size_t * | length, | ||
int | flags | ||
) |
Send a message on a socket.
[in] | sock | Socket descriptor. |
[in] | buffer | Buffer of the message to be sent. |
[in,out] | length | Length 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] | flags | Flags to modify the function behaviour. Use bitwise OR to specify multiple flags. |
Definition at line 100 of file socket.c.
Referenced by _send().
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.
[in] | sock | Socket descriptor. |
[in] | buffer | Buffer to send message from. |
[in,out] | length | Number of bytes to send. On success, the value gets updated with the actual number of bytes sent. The value is undefined on failure. |
[in] | flags | Flags to modify the function behaviour. Use bitwise OR to specify multiple flags. |
[in] | address | Destination address of the message. |
[in] | address_length | Length of the structure pointed to by address in bytes. |
Definition at line 168 of file socket.c.
Referenced by discovery_tcp_scan().
JAYLINK_PRIV bool socket_set_option | ( | int | sock, |
int | level, | ||
int | option, | ||
const void * | value, | ||
size_t | length | ||
) |
Set an option on a socket.
[in] | sock | Socket descriptor. |
[in] | level | Level at which the option is defined. |
[in] | option | Option to set the value for. |
[in] | value | Buffer of the value to be set. |
[in] | length | Length of the value buffer in bytes. |
Definition at line 250 of file socket.c.
Referenced by discovery_tcp_scan(), and set_socket_timeouts().
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.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR | Other 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().
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.
[in,out] | devh | Device handle. |
JAYLINK_OK | Success. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR | Other 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().
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.
[in,out] | devh | Device handle. |
[out] | buffer | Buffer to read data into on success. Its content is undefined on failure. |
[in] | length | Number of bytes to read. |
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 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().
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.
[in,out] | devh | Device handle. |
[in] | length | Number of bytes of the read operation. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid 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().
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.
[in,out] | devh | Device handle. |
[in] | length | Number of bytes of the write operation. |
[in] | has_command | Determines whether the data of the write operation contains the protocol command. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid 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().
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.
[in,out] | devh | Device handle. |
[in] | write_length | Number of bytes of the write operation. |
[in] | read_length | Number of bytes of the read operation. |
[in] | has_command | Determines whether the data of the write operation contains the protocol command. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid 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().
JAYLINK_PRIV int transport_tcp_close | ( | struct jaylink_device_handle * | devh | ) |
Definition at line 307 of file transport_tcp.c.
References cleanup_handle(), jaylink_device::ctx, jaylink_device_handle::dev, jaylink_device::ipv4_address, JAYLINK_OK, and log_dbg().
Referenced by transport_close().
JAYLINK_PRIV int transport_tcp_open | ( | struct jaylink_device_handle * | devh | ) |
Definition at line 227 of file transport_tcp.c.
References cleanup_handle(), jaylink_device::ctx, jaylink_device_handle::dev, handle_server_hello(), info, initialize_handle(), jaylink_device::ipv4_address, JAYLINK_ERR, JAYLINK_OK, log_dbg(), log_err(), NULL, set_socket_timeouts(), jaylink_device_handle::sock, and socket_close().
Referenced by transport_open().
JAYLINK_PRIV int transport_tcp_read | ( | struct jaylink_device_handle * | devh, |
uint8_t * | buffer, | ||
size_t | length | ||
) |
Definition at line 551 of file transport_tcp.c.
References _recv(), jaylink_device_handle::buffer, jaylink_device_handle::bytes_available, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbgio(), log_err(), jaylink_device_handle::read_length, and jaylink_device_handle::read_pos.
Referenced by transport_read().
JAYLINK_PRIV int transport_tcp_start_read | ( | struct jaylink_device_handle * | devh, |
size_t | length | ||
) |
Definition at line 354 of file transport_tcp.c.
References jaylink_device_handle::bytes_available, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbg(), log_dbgio(), log_warn(), and jaylink_device_handle::read_length.
Referenced by transport_start_read().
JAYLINK_PRIV int transport_tcp_start_write | ( | struct jaylink_device_handle * | devh, |
size_t | length, | ||
bool | has_command | ||
) |
Definition at line 323 of file transport_tcp.c.
References jaylink_device_handle::buffer, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbgio(), log_warn(), jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by transport_start_write().
JAYLINK_PRIV int transport_tcp_start_write_read | ( | struct jaylink_device_handle * | devh, |
size_t | write_length, | ||
size_t | read_length, | ||
bool | has_command | ||
) |
Definition at line 380 of file transport_tcp.c.
References jaylink_device_handle::buffer, jaylink_device_handle::bytes_available, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, log_dbgio(), log_warn(), jaylink_device_handle::read_length, jaylink_device_handle::read_pos, jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by transport_start_write_read().
JAYLINK_PRIV int transport_tcp_write | ( | struct jaylink_device_handle * | devh, |
const uint8_t * | buffer, | ||
size_t | length | ||
) |
Definition at line 480 of file transport_tcp.c.
References _send(), adjust_buffer(), jaylink_device_handle::buffer, jaylink_device_handle::buffer_size, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_OK, length, log_dbgio(), log_err(), MIN, jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by transport_write().
JAYLINK_PRIV int transport_usb_close | ( | struct jaylink_device_handle * | devh | ) |
Definition at line 200 of file transport_usb.c.
References cleanup_handle(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR, JAYLINK_OK, log_dbg(), and log_err().
Referenced by transport_close().
JAYLINK_PRIV int transport_usb_open | ( | struct jaylink_device_handle * | devh | ) |
Definition at line 153 of file transport_usb.c.
References cleanup_handle(), jaylink_device::ctx, jaylink_device_handle::dev, initialize_handle(), JAYLINK_ERR, JAYLINK_OK, log_dbg(), and log_err().
Referenced by transport_open().
JAYLINK_PRIV int transport_usb_read | ( | struct jaylink_device_handle * | devh, |
uint8_t * | buffer, | ||
size_t | length | ||
) |
Definition at line 526 of file transport_usb.c.
References jaylink_device_handle::buffer, jaylink_device_handle::bytes_available, CHUNK_SIZE, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbgio(), log_err(), MIN, jaylink_device_handle::read_length, jaylink_device_handle::read_pos, and usb_recv().
Referenced by transport_read().
JAYLINK_PRIV int transport_usb_start_read | ( | struct jaylink_device_handle * | devh, |
size_t | length | ||
) |
Definition at line 256 of file transport_usb.c.
References jaylink_device_handle::bytes_available, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbg(), log_dbgio(), log_warn(), and jaylink_device_handle::read_length.
Referenced by transport_start_read().
JAYLINK_PRIV int transport_usb_start_write | ( | struct jaylink_device_handle * | devh, |
size_t | length, | ||
bool | has_command | ||
) |
Definition at line 229 of file transport_usb.c.
References jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, length, log_dbgio(), log_warn(), jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by transport_start_write().
JAYLINK_PRIV int transport_usb_start_write_read | ( | struct jaylink_device_handle * | devh, |
size_t | write_length, | ||
size_t | read_length, | ||
bool | has_command | ||
) |
Definition at line 282 of file transport_usb.c.
References jaylink_device_handle::bytes_available, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_OK, log_dbgio(), log_warn(), jaylink_device_handle::read_length, jaylink_device_handle::read_pos, jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by transport_start_write_read().
JAYLINK_PRIV int transport_usb_write | ( | struct jaylink_device_handle * | devh, |
const uint8_t * | buffer, | ||
size_t | length | ||
) |
Definition at line 441 of file transport_usb.c.
References adjust_buffer(), jaylink_device_handle::buffer, jaylink_device_handle::buffer_size, CHUNK_SIZE, jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_MALLOC, JAYLINK_OK, length, log_dbgio(), log_err(), MIN, usb_send(), jaylink_device_handle::write_length, and jaylink_device_handle::write_pos.
Referenced by 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.
[in,out] | devh | Device handle. |
[in] | buffer | Buffer to write data from. |
[in] | length | Number of bytes to write. |
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 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().