Harald Welte | 8e7fca3 | 2017-05-07 16:14:33 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Harald Welte | 9d90d28 | 2018-06-29 22:25:42 +0200 | [diff] [blame] | 3 | #include <osmocom/core/linuxlist.h> |
| 4 | #include <osmocom/core/msgb.h> |
Harald Welte | 8e7fca3 | 2017-05-07 16:14:33 +0200 | [diff] [blame] | 5 | |
| 6 | /* buffered USB endpoint (with queue of msgb) */ |
| 7 | struct 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 | |
| 18 | struct msgb *usb_buf_alloc(uint8_t ep); |
| 19 | void usb_buf_free(struct msgb *msg); |
| 20 | int usb_buf_submit(struct msgb *msg); |
| 21 | struct llist_head *usb_get_queue(uint8_t ep); |
| 22 | int usb_drain_queue(uint8_t ep); |
| 23 | |
| 24 | void usb_buf_init(void); |
| 25 | struct usb_buffered_ep *usb_get_buf_ep(uint8_t ep); |
| 26 | |
| 27 | int usb_refill_to_host(uint8_t ep); |
| 28 | int usb_refill_from_host(uint8_t ep); |