OpenOCD
transport_usb.c File Reference

Transport abstraction layer (USB). More...

Include dependency graph for transport_usb.c:

Go to the source code of this file.

Macros

#define CHUNK_SIZE   2048
 Chunk size in bytes in which data is transferred. More...
 
#define NUM_TIMEOUTS   2
 Number of consecutive timeouts before an USB transfer will be treated as timed out. More...
 
#define USB_TIMEOUT   1000
 Timeout of an USB transfer in milliseconds. More...
 

Functions

static bool adjust_buffer (struct jaylink_device_handle *devh, size_t size)
 
static void cleanup_handle (struct jaylink_device_handle *devh)
 
static int initialize_handle (struct jaylink_device_handle *devh)
 
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)
 
static int usb_recv (struct jaylink_device_handle *devh, uint8_t *buffer, size_t *length)
 
static int usb_send (struct jaylink_device_handle *devh, const uint8_t *buffer, size_t length)
 

Detailed Description

Transport abstraction layer (USB).

Definition in file transport_usb.c.

Macro Definition Documentation

◆ CHUNK_SIZE

#define CHUNK_SIZE   2048

Chunk size in bytes in which data is transferred.

Definition at line 44 of file transport_usb.c.

Referenced by adjust_buffer(), initialize_handle(), transport_usb_read(), transport_usb_write(), usb_recv(), and usb_send().

◆ NUM_TIMEOUTS

#define NUM_TIMEOUTS   2

Number of consecutive timeouts before an USB transfer will be treated as timed out.

Definition at line 41 of file transport_usb.c.

Referenced by usb_recv(), and usb_send().

◆ USB_TIMEOUT

#define USB_TIMEOUT   1000

Timeout of an USB transfer in milliseconds.

Definition at line 35 of file transport_usb.c.

Referenced by usb_recv(), and usb_send().

Function Documentation

◆ adjust_buffer()

static bool adjust_buffer ( struct jaylink_device_handle devh,
size_t  size 
)
static

◆ cleanup_handle()

static void cleanup_handle ( struct jaylink_device_handle devh)
static

Definition at line 148 of file transport_usb.c.

References jaylink_device_handle::buffer.

Referenced by transport_usb_close(), and transport_usb_open().

◆ initialize_handle()

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

◆ usb_recv()

static int usb_recv ( struct jaylink_device_handle devh,
uint8_t *  buffer,
size_t *  length 
)
static

◆ usb_send()

static int usb_send ( struct jaylink_device_handle devh,
const uint8_t *  buffer,
size_t  length 
)
static