mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-19 06:48:34 +03:00
migrate from req_ctx to msgb
We now generalize the USB communiction and abandon the 'req_ctx' structure inherited from openpcd. Instead we use the libosmocore 'msgb' structure to handle incoming and outgoing USB tranfers. We also use linuxlist-based msgb-queues for each endpoint.
This commit is contained in:
28
firmware/libcommon/include/usb_buf.h
Normal file
28
firmware/libcommon/include/usb_buf.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "osmocom/core/linuxlist.h"
|
||||
#include "osmocom/core/msgb.h"
|
||||
|
||||
/* buffered USB endpoint (with queue of msgb) */
|
||||
struct usb_buffered_ep {
|
||||
/* endpoint number */
|
||||
uint8_t ep;
|
||||
/* OUT endpoint (1) or IN/IRQ (0)? */
|
||||
uint8_t out_from_host;
|
||||
/* currently any transfer in progress? */
|
||||
volatile uint32_t in_progress;
|
||||
/* Tx queue (IN) / Rx queue (OUT) */
|
||||
struct llist_head queue;
|
||||
};
|
||||
|
||||
struct msgb *usb_buf_alloc(uint8_t ep);
|
||||
void usb_buf_free(struct msgb *msg);
|
||||
int usb_buf_submit(struct msgb *msg);
|
||||
struct llist_head *usb_get_queue(uint8_t ep);
|
||||
int usb_drain_queue(uint8_t ep);
|
||||
|
||||
void usb_buf_init(void);
|
||||
struct usb_buffered_ep *usb_get_buf_ep(uint8_t ep);
|
||||
|
||||
int usb_refill_to_host(uint8_t ep);
|
||||
int usb_refill_from_host(uint8_t ep);
|
||||
Reference in New Issue
Block a user