mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
g: Add USB_STREAM_CONFIG_FULL macro to usb-stream.h
It's handy to use the usb-stream interfaces to avoid a lot of typing. But not all the endpoints are traditional serial ports. This just adds a new macro that lets us specify additional parameters. BUG=chrome-os-partner:50707 BRANCH=none TEST=make buildall; test on Cr50 Verified that all the previous endpoints still work as before. There are no endpoints that use the new macro yet. Change-Id: Ia37901cbe3adc4a4650ab91db3596efa15a110de Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338086 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
7ec7e0d4a1
commit
f3552a6863
@@ -66,6 +66,10 @@ extern struct producer_ops const usb_stream_producer_ops;
|
||||
* INTERFACE is the index of the USB interface to associate with this
|
||||
* stream.
|
||||
*
|
||||
* INTERFACE_CLASS, INTERFACE_SUBCLASS, INTERFACE_PROTOCOL are the
|
||||
* .bInterfaceClass, .bInterfaceSubClass, and .bInterfaceProtocol fields
|
||||
* respectively in the USB interface descriptor.
|
||||
*
|
||||
* INTERFACE_NAME is the index of the USB string descriptor (iInterface).
|
||||
*
|
||||
* ENDPOINT is the index of the USB bulk endpoint used for receiving and
|
||||
@@ -87,14 +91,17 @@ extern struct producer_ops const usb_stream_producer_ops;
|
||||
* BUILD_ASSERT(RX_QUEUE.unit_bytes == 1);
|
||||
* BUILD_ASSERT(TX_QUEUE.unit_bytes == 1);
|
||||
*/
|
||||
#define USB_STREAM_CONFIG(NAME, \
|
||||
INTERFACE, \
|
||||
INTERFACE_NAME, \
|
||||
ENDPOINT, \
|
||||
RX_SIZE, \
|
||||
TX_SIZE, \
|
||||
RX_QUEUE, \
|
||||
TX_QUEUE) \
|
||||
#define USB_STREAM_CONFIG_FULL(NAME, \
|
||||
INTERFACE, \
|
||||
INTERFACE_CLASS, \
|
||||
INTERFACE_SUBCLASS, \
|
||||
INTERFACE_PROTOCOL, \
|
||||
INTERFACE_NAME, \
|
||||
ENDPOINT, \
|
||||
RX_SIZE, \
|
||||
TX_SIZE, \
|
||||
RX_QUEUE, \
|
||||
TX_QUEUE) \
|
||||
\
|
||||
static struct g_usb_desc CONCAT2(NAME, _out_desc_); \
|
||||
static struct g_usb_desc CONCAT2(NAME, _in_desc_); \
|
||||
@@ -130,9 +137,9 @@ extern struct producer_ops const usb_stream_producer_ops;
|
||||
.bInterfaceNumber = INTERFACE, \
|
||||
.bAlternateSetting = 0, \
|
||||
.bNumEndpoints = 2, \
|
||||
.bInterfaceClass = USB_CLASS_VENDOR_SPEC, \
|
||||
.bInterfaceSubClass = USB_SUBCLASS_GOOGLE_SERIAL, \
|
||||
.bInterfaceProtocol = USB_PROTOCOL_GOOGLE_SERIAL, \
|
||||
.bInterfaceClass = INTERFACE_CLASS, \
|
||||
.bInterfaceSubClass = INTERFACE_SUBCLASS, \
|
||||
.bInterfaceProtocol = INTERFACE_PROTOCOL, \
|
||||
.iInterface = INTERFACE_NAME, \
|
||||
}; \
|
||||
const struct usb_endpoint_descriptor \
|
||||
@@ -174,7 +181,29 @@ extern struct producer_ops const usb_stream_producer_ops;
|
||||
USB_DECLARE_EP(ENDPOINT, \
|
||||
CONCAT2(NAME, _ep_tx), \
|
||||
CONCAT2(NAME, _ep_rx), \
|
||||
CONCAT2(NAME, _ep_reset)); \
|
||||
CONCAT2(NAME, _ep_reset));
|
||||
|
||||
/* This is a short version for declaring Google serial endpoints */
|
||||
#define USB_STREAM_CONFIG(NAME, \
|
||||
INTERFACE, \
|
||||
INTERFACE_NAME, \
|
||||
ENDPOINT, \
|
||||
RX_SIZE, \
|
||||
TX_SIZE, \
|
||||
RX_QUEUE, \
|
||||
TX_QUEUE) \
|
||||
USB_STREAM_CONFIG_FULL(NAME, \
|
||||
INTERFACE, \
|
||||
USB_CLASS_VENDOR_SPEC, \
|
||||
USB_SUBCLASS_GOOGLE_SERIAL, \
|
||||
USB_PROTOCOL_GOOGLE_SERIAL, \
|
||||
INTERFACE_NAME, \
|
||||
ENDPOINT, \
|
||||
RX_SIZE, \
|
||||
TX_SIZE, \
|
||||
RX_QUEUE, \
|
||||
TX_QUEUE)
|
||||
|
||||
/*
|
||||
* Handle USB and Queue request in a deferred callback.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user