blob: 7171c68b5d4b11beb2a9f0ddcf1253356e9c84b6 [file] [log] [blame]
Harald Welte8e7fca32017-05-07 16:14:33 +02001#pragma once
2
Harald Welte9d90d282018-06-29 22:25:42 +02003#include <osmocom/core/linuxlist.h>
4#include <osmocom/core/msgb.h>
Harald Welte8e7fca32017-05-07 16:14:33 +02005
6/* buffered USB endpoint (with queue of msgb) */
7struct usb_buffered_ep {
8 /* endpoint number */
9 uint8_t ep;
10 /* OUT endpoint (1) or IN/IRQ (0)? */
11 uint8_t out_from_host;
12 /* currently any transfer in progress? */
13 volatile uint32_t in_progress;
14 /* Tx queue (IN) / Rx queue (OUT) */
15 struct llist_head queue;
16};
17
18struct msgb *usb_buf_alloc(uint8_t ep);
19void usb_buf_free(struct msgb *msg);
20int usb_buf_submit(struct msgb *msg);
21struct llist_head *usb_get_queue(uint8_t ep);
22int usb_drain_queue(uint8_t ep);
23
24void usb_buf_init(void);
25struct usb_buffered_ep *usb_get_buf_ep(uint8_t ep);
26
27int usb_refill_to_host(uint8_t ep);
28int usb_refill_from_host(uint8_t ep);