31#define USBL_RX_SIZE 1024u
32#define USBL_TX_SIZE 4096u
33#define USBL_CMD_MAX 32u
34#define USBL_OPEN_MS 3000u
61int usbl_send_src(uint8_t src, uint8_t type,
const void *payload, uint8_t len);
static void cmd(uint8_t port, const uint8_t *c, uint32_t n, uint8_t armed, uint32_t now)
static uint32_t usbl_tx_free(void)
the LogTask's ring (log answers)
void usbl_tx_consume(uint32_t n)
static int usbl_send(uint8_t type, const void *payload, uint8_t len)
int usbl_put_frame(uint8_t src, const uint8_t *frame, uint32_t n)
a frame already encoded; 0 = queued whole
void usbl_rx_isr(const uint8_t *p, uint32_t n)
bytes that do not fit are dropped
void usbl_set_dtr(uint8_t on)
uint8_t usbl_open(uint32_t now_ms)
a program has the port open: host and (DTR or a command in the last USBL_OPEN_MS)
void usbl_tx_flush(void)
nobody listening: empties every ring
uint32_t usbl_tx_dropped(uint8_t src)
frames that did not fit
void usbl_set_configured(uint8_t on)
host state: configured by a host, DTR set (any context, single writer each)
uint32_t usbl_poll(uint8_t *cmd, uint32_t cap, uint32_t now_ms)
next CMD frame payload; returns its length (>= 2), 0 if none.
int usbl_send_src(uint8_t src, uint8_t type, const void *payload, uint8_t len)
a whole v2 frame built from type and payload; 0 = queued whole
uint32_t usbl_rx_errors(void)
frames with a bad CRC
uint32_t usbl_tx_free_src(uint8_t src)
uint32_t usbl_tx_peek(uint8_t *buf, uint32_t cap)
uint8_t usbl_host(void)
a USB host has configured the device (cable to a PC): ARM is refused