include: nuttx: usb: nxstyle error fix

Nxstyle error fix to silence the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2021-01-28 19:21:44 +01:00
committed by Xiang Xiao
parent 30a5a3edad
commit b288986ccd
21 changed files with 821 additions and 611 deletions
+76 -72
View File
@@ -1,4 +1,4 @@
/********************************************************************************************
/****************************************************************************
* include/nuttx/usb/audio.h
* Audio Device Class (ADC) definitions
*
@@ -42,29 +42,31 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_AUDIO_H
#define __INCLUDE_NUTTX_USB_AUDIO_H
/********************************************************************************************
/****************************************************************************
* Included Files
********************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/usb.h>
/********************************************************************************************
/****************************************************************************
* Preprocessor definitions
********************************************************************************************/
****************************************************************************/
/* Device Descriptor
*
* Because audio functionality is always considered to reside at the interface level, this
* class specification does not define a specific audio device descriptor. For both composite
* devices and audio-only devices, the device descriptor must indicate that class information
* is to be found at the interface level. Therefore, the bDeviceClass, bDeviceSubClass and
* bDeviceProtocol fields of the device descriptor must contain the values 0xef, 0x02, and
* 0x01 respectively.
* Because audio functionality is always considered to reside at the
* interface level, this class specification does not define a specific audio
* device descriptor. For both composite devices and audio-only devices, the
* device descriptor must indicate that class information is to be found at
* the interface level. Therefore, the bDeviceClass, bDeviceSubClass and
* bDeviceProtocol fields of the device descriptor must contain the values
* 0xef, 0x02, and 0x01 respectively.
*/
#define ADC_DEVICE_CLASS USB_CLASS_MISC
@@ -470,22 +472,23 @@
/* Encoder Error Codes */
/* <0: Reserved for vendor extensions */
#define ADC_ENCODER_SUCCESS 0 /* No Error */
#define ADC_ENCODER_ERROR_NOMEM 1 /* Out of Memory */
#define ADC_ENCODER_ERROR_BW 2 /* Out of Bandwidth */
#define ADC_ENCODER_ERROR_CYCLE 3 /* Out of Processing Cycles */
#define ADC_ENCODER_ERROR_FRAME 4 /* General Format Frame Error */
#define ADC_ENCODER_ERROR_TOOSMALL 5 /* Format Frame Too Small */
#define ADC_ENCODER_ERROR_TOOBIG 6 /* Format Frame Too Large */
#define ADC_ENCODER_ERROR_BADFORMAT 7 /* Bad Data Format */
#define ADC_ENCODER_ERROR_NCHAN 8 /* Incorrect Number of Channels */
#define ADC_ENCODER_ERROR_RATE 9 /* Incorrect Sampling Rate */
#define ADC_ENCODER_ERROR_BITRATE 10 /* Unable to Meet Target Bitrate */
#define ADC_ENCODER_ERROR_PARMS 11 /* Inconsistent Set of Parameters */
#define ADC_ENCODER_ERROR_NOTREADY 12 /* Not Ready */
#define ADC_ENCODER_ERROR_BUSY 13 /* Busy */
/* >13: Reserved */
/* <0: Reserved for vendor extensions */
#define ADC_ENCODER_SUCCESS 0 /* No Error */
#define ADC_ENCODER_ERROR_NOMEM 1 /* Out of Memory */
#define ADC_ENCODER_ERROR_BW 2 /* Out of Bandwidth */
#define ADC_ENCODER_ERROR_CYCLE 3 /* Out of Processing Cycles */
#define ADC_ENCODER_ERROR_FRAME 4 /* General Format Frame Error */
#define ADC_ENCODER_ERROR_TOOSMALL 5 /* Format Frame Too Small */
#define ADC_ENCODER_ERROR_TOOBIG 6 /* Format Frame Too Large */
#define ADC_ENCODER_ERROR_BADFORMAT 7 /* Bad Data Format */
#define ADC_ENCODER_ERROR_NCHAN 8 /* Incorrect Number of Channels */
#define ADC_ENCODER_ERROR_RATE 9 /* Incorrect Sampling Rate */
#define ADC_ENCODER_ERROR_BITRATE 10 /* Unable to Meet Target Bitrate */
#define ADC_ENCODER_ERROR_PARMS 11 /* Inconsistent Set of Parameters */
#define ADC_ENCODER_ERROR_NOTREADY 12 /* Not Ready */
#define ADC_ENCODER_ERROR_BUSY 13 /* Busy */
/* >13: Reserved */
/* Format Type Codes */
@@ -517,7 +520,6 @@
/* Audio Data Format Type III Bit Allocations */
#define ADC_FORMAT_TYPEIII_IEC61937_AC3 (1 << 0)
#define ADC_FORMAT_TYPEIII_IEC61937_MPEG1_L1 (1 << 1)
#define ADC_FORMAT_TYPEIII_IEC61937_MPEG1_L2_3 (1 << 1)
@@ -649,9 +651,10 @@
#define ADC_EMBEDTERM_PERCUSSON 0x0716 /* Percussion Instrument */
#define ADC_EMBEDTERM_INSTRUMENT 0x0717 /* Other Musical Instrument */
/********************************************************************************************
/****************************************************************************
* Public Types
********************************************************************************************/
****************************************************************************/
/* Audio Channel Cluster Descriptor */
struct adc_cluster_desc_s
@@ -666,7 +669,7 @@ struct adc_cluster_desc_s
struct adc_ac_ifdesc_s
{
uint8_t ac_len; /* 0: Descriptor length (9)*/
uint8_t ac_len; /* 0: Descriptor length (9) */
uint8_t ac_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */
uint8_t ac_subtype; /* 2: Descriptor sub-type (ADC_AC_HEADER) */
uint8_t ac_adc[2]; /* 3: ADC spec version in BCD */
@@ -680,7 +683,7 @@ struct adc_ac_ifdesc_s
struct adc_clksrc_desc_s
{
uint8_t cs_len; /* 0: Descriptor length (8)*/
uint8_t cs_len; /* 0: Descriptor length (8) */
uint8_t cs_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */
uint8_t cs_subtype; /* 2: Descriptor sub-type (ADC_AC_CLOCK_SOURCE) */
uint8_t cs_clockid; /* 3: Identifies clock source entity */
@@ -695,7 +698,7 @@ struct adc_clksrc_desc_s
struct adc_clksel_desc_s
{
uint8_t cl_len; /* 0: Descriptor length (7+npins)*/
uint8_t cl_len; /* 0: Descriptor length (7+npins) */
uint8_t cl_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */
uint8_t cl_subtype; /* 2: Descriptor sub-type (ADC_AC_CLOCK_SELECTOR) */
uint8_t cl_clockid; /* 3: Identifies clock source entity */
@@ -723,7 +726,7 @@ struct adc_clkmult_desc_s
uint8_t cm_clockid; /* 3: Identifies clock source entity */
uint8_t cm_csrcid; /* 4: ID of clock input to list pin n */
uint8_t cm_controls; /* 5: Bits 0-1: Clock numerator control,
* Bits 2-3: Clock denominator control */
* Bits 2-3: Clock denominator control */
uint8_t cm_clkmult; /* 6: Index of clock multiplier name string */
};
#define USB_SIZEOF_ADC_CLKMULT_DESC 7
@@ -779,7 +782,7 @@ struct adc_outterm_desc_s
struct adc_mixerunit_desc_s
{
uint8_t mu_len; /* 0: Descriptor length (13+npins+nchan)*/
uint8_t mu_len; /* 0: Descriptor length (13+npins+nchan) */
uint8_t mu_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */
uint8_t mu_subtype; /* 2: Descriptor sub-type (ADC_AC_MIXER_UNIT) */
uint8_t mu_unitid; /* 3: Identifies unit in audio function */
@@ -1105,7 +1108,7 @@ struct adc_extunit_desc_s
struct adc_as_ifdesc_s
{
uint8_t as_len; /* 0: Descriptor length (9)*/
uint8_t as_len; /* 0: Descriptor length (9) */
uint8_t as_type; /* 1: Descriptor type (ADC_CS_INTERFACE) */
uint8_t as_subtype; /* 2: Descriptor sub-type (ADC_AS_GENERAL) */
uint8_t as_terminal; /* 3: ID of connected terminal */
@@ -1314,7 +1317,8 @@ struct adc_audio_epdesc_s
struct adc_l1_curparm_s
{
uint8_t l1_cur; /* 0: Setting of the CUR attribute of the addressed control */
uint8_t l1_cur; /* 0: Setting of the CUR attribute of the
* addressed control */
};
#define USB_SIZEOF_ADC_LI_CURPARM 1
@@ -1323,15 +1327,15 @@ struct adc_l1_curparm_s
begin_packed_struct struct adc_l1_subrange_s
{
uint8_t l1_min; /* 0: MIN attribute */
uint8_t l1_max; /* 1: MAX attribute */
uint8_t l1_res; /* 2: RES attribute */
uint8_t l1_min; /* 0: MIN attribute */
uint8_t l1_max; /* 1: MAX attribute */
uint8_t l1_res; /* 2: RES attribute */
} end_packed_struct;
begin_packed_struct struct adc_l1_rangeparm_s
{
uint8_t l1_nranges; /* 0: Number of sub-ranges */
struct adc_l1_subrange_s l1_subrange[1];
uint8_t l1_nranges; /* 0: Number of sub-ranges */
struct adc_l1_subrange_s l1_subrange[1];
} end_packed_struct;
#define USB_SIZEOF_ADC_LI_RANGEPARM(nranges) (1+3*(nranges))
@@ -1340,7 +1344,7 @@ begin_packed_struct struct adc_l1_rangeparm_s
struct adc_l2_curparm_s
{
uint8_t l2_cur[2]; /* 0: Setting of the CUR attribute of the addressed control */
uint8_t l2_cur[2]; /* 0: Setting of the CUR attribute of the addressed control */
};
#define USB_SIZEOF_ADC_L2_CURPARM 2
@@ -1349,15 +1353,15 @@ struct adc_l2_curparm_s
struct adc_l2_subrange_s
{
uint8_t l2_min[2]; /* 0: MIN attribute */
uint8_t l2_max[2]; /* 2: MAX attribute */
uint8_t l2_res[2]; /* 4: RES attribute */
uint8_t l2_min[2]; /* 0: MIN attribute */
uint8_t l2_max[2]; /* 2: MAX attribute */
uint8_t l2_res[2]; /* 4: RES attribute */
};
struct adc_l2_rangeparm_s
{
uint8_t l2_nranges[2]; /* 0: Number of sub-ranges */
struct adc_l2_subrange_s l2_subrange[1];
uint8_t l2_nranges[2]; /* 0: Number of sub-ranges */
struct adc_l2_subrange_s l2_subrange[1];
};
#define USB_SIZEOF_ADC_L2_RANGEPARM(nranges) (2+6*(nranges))
@@ -1366,7 +1370,7 @@ struct adc_l2_rangeparm_s
struct adc_l3_curparm_s
{
uint8_t l3_cur[4]; /* 0: Setting of the CUR attribute of the addressed control */
uint8_t l3_cur[4]; /* 0: Setting of the CUR attribute of the addressed control */
};
#define USB_SIZEOF_ADC_L3_CURPARM 4
@@ -1375,15 +1379,15 @@ struct adc_l3_curparm_s
struct adc_l3_subrange_s
{
uint8_t l3_min[4]; /* 0: MIN attribute */
uint8_t l3_max[4]; /* 2: MAX attribute */
uint8_t l3_res[4]; /* 4: RES attribute */
uint8_t l3_min[4]; /* 0: MIN attribute */
uint8_t l3_max[4]; /* 2: MAX attribute */
uint8_t l3_res[4]; /* 4: RES attribute */
};
struct adc_l3_rangeparm_s
{
uint8_t l3_nranges[2]; /* 0: Number of sub-ranges */
struct adc_l3_subrange_s l3_subrange[1];
uint8_t l3_nranges[2]; /* 0: Number of sub-ranges */
struct adc_l3_subrange_s l3_subrange[1];
};
#define USB_SIZEOF_ADC_L3_RANGEPARM(nranges) (2+12*(nranges))
@@ -1424,15 +1428,15 @@ struct adc_equalizer_curparm_s
begin_packed_struct struct adc_eq_subrange_s
{
uint8_t eq_min; /* 0: MIN attribute */
uint8_t eq_max; /* 1: MAX attribute */
uint8_t eq_res; /* 2: RES attribute */
uint8_t eq_min; /* 0: MIN attribute */
uint8_t eq_max; /* 1: MAX attribute */
uint8_t eq_res; /* 2: RES attribute */
} end_packed_struct;
begin_packed_struct struct adc_equalizer_rangeparm_s
{
uint8_t eq_nranges; /* 0: Number of sub-ranges */
struct adc_eq_subrange_s eq_subrange[1];
uint8_t eq_nranges; /* 0: Number of sub-ranges */
struct adc_eq_subrange_s eq_subrange[1];
} end_packed_struct;
#define USB_SIZEOF_ADC_EQUALIZER_RANGEPARM(nranges) (1+3*(nranges))
@@ -1451,23 +1455,23 @@ struct adc_altsettings_curparm_s
struct adc_hilo_curparm_s
{
uint8_t hl_lo; /* 0: CUR value of the low level scaling control */
uint8_t hl_hi; /* 0: CUR value of the high level scaling control */
uint8_t hl_lo; /* 0: CUR value of the low level scaling control */
uint8_t hl_hi; /* 0: CUR value of the high level scaling control */
};
/* High/Low Scaling Control RANGE Parameter Block */
begin_packed_struct struct adc_hl_subrange_s
{
uint8_t hl_min; /* 0: MIN attribute */
uint8_t hl_max; /* 1: MAX attribute */
uint8_t hl_res; /* 2: RES attribute */
uint8_t hl_min; /* 0: MIN attribute */
uint8_t hl_max; /* 1: MAX attribute */
uint8_t hl_res; /* 2: RES attribute */
} end_packed_struct;
begin_packed_struct struct adc_hilo_rangeparm_s
{
uint8_t hl_nranges[2]; /* 0: Number of sub-ranges */
struct adc_hl_subrange_s hl_subrange[1];
uint8_t hl_nranges[2]; /* 0: Number of sub-ranges */
struct adc_hl_subrange_s hl_subrange[1];
} end_packed_struct;
#define USB_SIZEOF_ADC_HILO_RANGEPARM(nranges) (2+3*(nranges))
@@ -1510,7 +1514,7 @@ struct adc_t2_format_desc_s
uint8_t t2_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */
uint8_t t2_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEII) */
uint8_t t2_bitrate[2]; /* 4 Maximum number of bits per second */
uint8_t t2_slotsperframe[2]; /* 6: Number of PCM audio slots in one encoded audio frame*/
uint8_t t2_slotsperframe[2]; /* 6: Number of PCM audio slots in one encoded audio frame */
};
#define USB_SIZEOF_ADC_T2_FORMAT_DESC 8
@@ -1567,7 +1571,7 @@ struct adc_x2_format_desc_s
uint8_t x2_subtype; /* 2: Descriptor sub-type (ADC_AS_FORMAT_TYPE) */
uint8_t x2_fmttype; /* 3: Identifies the format type (ADC_FORMAT_TYPEII) */
uint8_t x2_bitrate[2]; /* 4 Maximum number of bits per second */
uint8_t x2_samperframe[2]; /* 6: Number of PCM audio samples in one encoded audio frame*/
uint8_t x2_samperframe[2]; /* 6: Number of PCM audio samples in one encoded audio frame */
uint8_t x2_hdrlen; /* 8: Size of packet header (in bytes) */
uint8_t x2_sbproto; /* 9: Sideband protocol used in packet header and ctrl channel */
};
@@ -1590,7 +1594,7 @@ struct adc_x3_format_desc_s
#define USB_SIZEOF_ADC_X3_FORMAT_DESC 8
/* Hi-Res Presentation TimeStamp Layout*/
/* Hi-Res Presentation TimeStamp Layout */
struct adc_hires_timestamp_s
{
@@ -1598,9 +1602,9 @@ struct adc_hires_timestamp_s
uint8_t hr_nsec[8]; /* Offset in nanoseconds from the beginning of the stream */
};
/********************************************************************************************
/****************************************************************************
* Public Function Prototypes
********************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
+11 -11
View File
@@ -1,4 +1,4 @@
/*******************************************************************************
/****************************************************************************
* include/nuttx/usb/cdcecm.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_CDCECM_H
#define __INCLUDE_NUTTX_USB_CDCECM_H
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -54,9 +54,9 @@
#define CDCECM_EP_BULKIN_IDX (1)
#define CDCECM_EP_BULKOUT_IDX (2)
/******************************************************************************
/****************************************************************************
* Public Data
******************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -67,16 +67,16 @@ extern "C"
# define EXTERN extern
#endif
/******************************************************************************
* Public Functions
******************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
/****************************************************************************
* Name: cdcecm_initialize
*
* Description:
* Register CDC/ECM USB device interface. Register the corresponding network
* driver to NuttX and bring up the network.
* Register CDC/ECM USB device interface. Register the corresponding
* network driver to NuttX and bring up the network.
*
* Input Parameters:
* minor - Device minor number.
+5 -3
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/composite.h
*
* Copyright (C) 2008-2011, 2015, 2017 Gregory Nutt. All rights reserved.
@@ -50,6 +50,7 @@
****************************************************************************/
/* Configuration ************************************************************/
/* CONFIG_USBDEV_COMPOSITE
* Enables USB composite device support
*/
@@ -83,7 +84,7 @@ extern "C"
struct composite_devdesc_s;
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
/****************************************************************************
@@ -120,7 +121,8 @@ FAR void *composite_initialize(uint8_t ndevices,
* class objects for each of the members of the composite.
*
* Input Parameters:
* handle - The handle returned by a previous call to composite_initialize().
* handle - The handle returned by a previous call to
* composite_initialize().
*
* Returned Value:
* None
+5 -5
View File
@@ -36,16 +36,16 @@
#ifndef __INCLUDE_NUTTX_USB_DFU_H
#define __INCLUDE_NUTTX_USB_DFU_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/usbdev.h>
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Functions Defintions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
+166 -69
View File
File diff suppressed because it is too large Load Diff
+8 -2
View File
@@ -37,6 +37,10 @@
#ifndef __INCLUDE_NUTTX_USB_FUSB301_H
#define __INCLUDE_NUTTX_USB_FUSB301_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/fs/ioctl.h>
/****************************************************************************
@@ -223,8 +227,10 @@ struct fusb301_config_s
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/usbc0"
* i2c - An instance of the I2C interface to use to communicate with FUSB301
* addr - The I2C address of the FUSB301. The I2C address of the FUSB301 is 0x25.
* i2c - An instance of the I2C interface to use to communicate with
* FUSB301
* addr - The I2C address of the FUSB301.
* The I2C address of the FUSB301 is 0x25.
* config - Pointer to FUSB301 configuration
*
* Returned Value:
+15
View File
@@ -37,6 +37,10 @@
#ifndef __INCLUDE_NUTTX_USB_FUSB303_H
#define __INCLUDE_NUTTX_USB_FUSB303_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/fs/ioctl.h>
/****************************************************************************
@@ -115,6 +119,7 @@ enum fusb303_mode_e
MODE_TRY_SNK = (1 << 4), /* For DRP only */
MODE_TRY_SRC = (1 << 5), /* For DRP only */
MODE_ORIENTDEB = (1 << 6),
/* Bit 7 reserved */
};
@@ -169,6 +174,7 @@ enum fusb303_manual_e
MANUAL_UNATT_SNK = (1 << 3),
MANUAL_FORCE_SNK = (1 << 4),
MANUAL_FORCE_SRC = (1 << 5),
/* Bits 6:7 reserved */
};
@@ -190,6 +196,7 @@ enum fusb303_int_mask_e
INT_MASK_VBUS_CHG = (1 << 4),
INT_MASK_FAULT = (1 << 5),
INT_MASK_ORIENT = (1 << 6),
/* Bit 7 reserved */
};
@@ -200,10 +207,13 @@ enum fusb303_int_mask1_e
INT_MASK1_REMEDY = (1 << 0),
INT_MASK1_FRC_SUCC = (1 << 1),
INT_MASK1_FRC_FAIL = (1 << 2),
/* Bit 4 reserved */
INT_MASK1_REM_FAIL = (1 << 3),
INT_MASK1_REM_VBON = (1 << 5),
INT_MASK1_REM_VBOFF = (1 << 6),
/* Bit 7 reserved */
};
@@ -244,6 +254,7 @@ enum fusb303_type_e
TYPE_SINK = (1 << 4),
TYPE_DEBUGSNK = (1 << 5),
TYPE_DEBUGSRC = (1 << 6),
/* Bit 7 reserved */
};
@@ -258,6 +269,7 @@ enum fusb303_interrupt_e
INTERRUPT_VBUS_CHG = (1 << 4),
INTERRUPT_FAULT = (1 << 5),
INTERRUPT_ORIENT = (1 << 6),
/* Bit 7 reserved */
};
@@ -269,9 +281,12 @@ enum fusb303_interrupt1_e
INTERRUPT1_FRC_SUCC = (1 << 1),
INTERRUPT1_FRC_FAIL = (1 << 2),
INTERRUPT1_REM_FAIL = (1 << 3),
/* Bit 4 reserved */
INTERRUPT1_REM_VBON = (1 << 5),
INTERRUPT1_REM_VBOFF = (1 << 6),
/* Bit 7 reserved */
};
+13 -5
View File
@@ -56,6 +56,7 @@
****************************************************************************/
/* Subclass and Protocol ****************************************************/
/* Subclass codes (HID 4.2) */
#define USBHID_SUBCLASS_NONE 0 /* No subclass */
@@ -71,6 +72,7 @@
#define USBHID_PROTOCOL_MOUSE 2
/* Descriptor Requests ******************************************************/
/* "When a Get_Descriptor(Configuration) request is issued, it returns the
* Configuration descriptor, all Interface descriptors, all Endpoint
* descriptors, and the HID descriptor for each interface."
@@ -79,7 +81,8 @@
/* Standard Requests (HID 7.1)
* GET_DESCRIPTOR (HID 7.1.1):
*
* bmRequestType (USB_REQ_DIR_IN | USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_INTERFACE)
* bmRequestType (USB_REQ_DIR_IN | USB_REQ_TYPE_STANDARD |
* USB_REQ_RECIPIENT_INTERFACE)
* bRequest (USB_REQ_GETDESCRIPTOR)
* wValue Descriptor Type (MS) and Descriptor Index (LS)
* wIndex Interface Number
@@ -104,8 +107,9 @@
/* Class-specific requests (HID 7.2)
*
* bmRequestType ( USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE) -or-
* (USB_REQ_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE)
* bmRequestType (USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE) -or-
* (USB_REQ_DIR_IN | USB_REQ_TYPE_CLASS |
* USB_REQ_RECIPIENT_INTERFACE)
* bRequest Class-specific request
* wValue Varies according to request
* wIndex Varies according to request
@@ -262,7 +266,7 @@
#define USBHID_LOCAL_STRINGIDX_PREFIX 0x78 /* String Index */
#define USBHID_LOCAL_STRINGMIN_PREFIX 0x88 /* String Minimum */
#define USBHID_LOCAL_STRINGMAX_PREFIX 0x98 /* xx */
#define USBHID_LOCAL_DELIMITER_PREFIX 0xa8 /*Delimiter */
#define USBHID_LOCAL_DELIMITER_PREFIX 0xa8 /* Delimiter */
/* Modifier Keys (HID 8.3) */
@@ -627,6 +631,7 @@
/****************************************************************************
* Public Types
****************************************************************************/
/* HID Descriptor (HID 6.2.1) ***********************************************/
struct usbhid_descriptor_s
@@ -652,6 +657,7 @@ struct usbhid_optdesc_s
};
/* Standard Reports *********************************************************/
/* Keyboard input report (8 bytes) (HID B.1) */
struct usbhid_kbdreport_s
@@ -661,7 +667,9 @@ struct usbhid_kbdreport_s
uint8_t key[6]; /* Keycode 1-6 */
};
/* Keyboard output report (1 byte) (HID B.1), see USBHID_KBDOUT_* definitions */
/* Keyboard output report (1 byte) (HID B.1),
* see USBHID_KBDOUT_* definitions
*/
/* Mouse input report (HID B.2) */
+8 -8
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/hub.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
@@ -31,21 +31,21 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_HUB_H
#define __INCLUDE_NUTTX_USB_HUB_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Hub request types */
@@ -150,9 +150,9 @@
#define USBHUB_MAX_PORTS (7)
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/* Hub descriptor */
+4 -1
View File
@@ -55,7 +55,8 @@
* Pre-processor Definitions
****************************************************************************/
/* Configuration ***************************************************************/
/* Configuration ************************************************************/
/* MAX3421E USB Host Driver Support
*
* Pre-requisites
@@ -74,6 +75,7 @@
*/
/* Host Mode Register Addresses *********************************************/
/* The command byte contains the register address, a direction bit, and an
* ACKSTAT bit:
*
@@ -108,6 +110,7 @@
#define MAX3421E_USBHOST_HRSL (31 << 3)
/* Peripheral Mode Register Addresses ***************************************/
/* The command byte contains the register address, a direction bit, and an
* ACKSTAT bit:
*
+12 -3
View File
@@ -51,6 +51,7 @@
****************************************************************************/
/* Register offsets *********************************************************/
/* Control and status registers (section 7.1) */
#define OHCI_HCIREV_OFFSET 0x0000 /* HcRevision: Version of HCI specification */
@@ -154,6 +155,7 @@
#define OHCI_INT_OC (1 << 30) /* Bit 30: Ownership change */
#define OHCI_INT_MIE (1 << 31) /* Bit 31: Master interrupt enable
* (Enable/disable only) */
/* HcHCCA: HC communication area (7.2.1):
*
* 32-bits aligned to 256 byte boundary.
@@ -190,16 +192,19 @@
#define OHCI_FMNO_FI_SHIFT (0) /* Bits 0-15: Frame number */
#define OHCI_FMNO_FI_MASK (0xffff << OHCI_FMINT_FI_SHIFT)
/* Bits 16-31: Reserved */
/* HcPeriodicStart: Time to start processing periodic list (7.3.4) */
#define OHCI_PERSTART_SHIFT (0) /* Bits 0-13: Periodic start */
#define OHCI_PERSTART_MASK (0x3fff << OHCI_PERSTART_SHIFT)
/* Bits 14-31: Reserved */
/* HcLSThreshold: Commit to transfer threshold (7.3.5) */
#define OHCI_LSTHRES_SHIFT (0) /* Bits 0-11: LS threshold */
#define OHCI_LSTHRES_MASK (0x0fff << OHCI_PERSTART_SHIFT)
/* Bits 12-31: Reserved */
/* HcRhDescriptorN: Describes root hub (part A) (7.4.1) */
#define OHCI_RHDESCA_NDP_SHIFT (0) /* Bits 0-7: Number downstream ports */
@@ -254,6 +259,7 @@
/* Bits 21-31: Reserved */
/* Transfer Descriptors *****************************************************/
/* Endpoint Descriptor Offsets (4.2.1) */
#define ED_CONTROL_OFFSET (0x00) /* ED status/control bits */
@@ -273,6 +279,7 @@
# define ED_CONTROL_D_OUT (1 << ED_CONTROL_D_SHIFT) /* OUT */
# define ED_CONTROL_D_IN (2 << ED_CONTROL_D_SHIFT) /* IN */
# define ED_CONTROL_D_TD2 (3 << ED_CONTROL_D_SHIFT) /* Get direction from TD */
#define ED_CONTROL_S (1 << 13) /* Bit 13: Speed (low) */
#define ED_CONTROL_K (1 << 14) /* Bit 14: Skip */
#define ED_CONTROL_F (1 << 15) /* Bit 15: Format (isochronous) */
@@ -292,13 +299,16 @@
#define GTD_BE_OFFSET (0x0c) /* Buffer End (BE) */
/* General Transfer Descriptor Bit Definitions */
/* Bits 0-17: Reserved */
#define GTD_STATUS_R (1 << 18) /* Bit 18: Buffer rounding */
#define GTD_STATUS_DP_SHIFT (19) /* Bits 19-20: Direction/PID */
#define GTD_STATUS_DP_MASK (3 << GTD_STATUS_DP_SHIFT)
# define GTD_STATUS_DP_SETUP (0 << GTD_STATUS_DP_SHIFT) /* To endpoint */
# define GTD_STATUS_DP_OUT (1 << GTD_STATUS_DP_SHIFT) /* To endpoint */
# define GTD_STATUS_DP_IN (2 << GTD_STATUS_DP_SHIFT) /* From endpoint */
#define GTD_STATUS_DI_SHIFT (21) /* Bits 21-23: Delay input */
#define GTD_STATUS_DI_MASK (7 << GTD_STATUS_DI_SHIFT)
#define GTD_STATUS_T_SHIFT (24) /* Bits 24-25: Data Toggle */
@@ -434,8 +444,8 @@ struct ohci_hcca_s
volatile uint16_t pad1;
/* HccaDoneHead: When the HC reaches the end of a frame and its deferred
* interrupt register is 0, it writes the current value of its HcDoneHead to
* this location and generates an interrupt.
* interrupt register is 0, it writes the current value of its HcDoneHead
* to this location and generates an interrupt.
*/
volatile uint32_t donehead;
@@ -459,7 +469,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#ifdef __cplusplus
}
+17 -16
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/pl2303.h
*
* Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
@@ -37,28 +37,28 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_PL2303_H
#define __INCLUDE_NUTTX_USB_PL2303_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -69,17 +69,18 @@ extern "C"
# define EXTERN extern
#endif
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: usbdev_serialinit
*
* Description:
* Register PL2303 USB serial port (and USB serial console if so configured).
* Register PL2303 USB serial port
* (and USB serial console if so configured).
*
************************************************************************************/
****************************************************************************/
int usbdev_serialinitialize(int minor);
+21 -18
View File
@@ -1,9 +1,9 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/rndis.h
*
* Copyright (C) 2011-2018 Gregory Nutt. All rights reserved.
* Authors: Sakari Kapanen <sakari.m.kapanen@gmail.com>,
Petteri Aimonen <jpa@git.mail.kapsi.fi>
* Petteri Aimonen <jpa@git.mail.kapsi.fi>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +32,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_RNDIS_H
#define __INCLUDE_NUTTX_USB_RNDIS_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/usbdev.h>
@@ -48,13 +48,15 @@
* Preprocessor definitions
****************************************************************************/
/* Indexes for devinfo.epno[] array. Used for composite device configuration. */
/* Indexes for devinfo.epno[] array.
* Used for composite device configuration.
*/
#define RNDIS_EP_INTIN_IDX (0)
#define RNDIS_EP_BULKIN_IDX (1)
#define RNDIS_EP_BULKOUT_IDX (2)
/* Endpoint configuration ****************************************************/
/* Endpoint configuration ***************************************************/
#define RNDIS_MKEPINTIN(desc) (USB_DIR_IN | (desc)->epno[RNDIS_EP_INTIN_IDX])
#define RNDIS_EPINTIN_ATTR (USB_EP_ATTR_XFER_INT)
@@ -89,9 +91,9 @@
# define CONFIG_RNDIS_EPBULKOUT_HSSIZE 512
#endif
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -102,25 +104,26 @@ extern "C"
# define EXTERN extern
#endif
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: usbdev_rndis_initialize
*
* Description:
* Register RNDIS USB device interface. Register the corresponding network driver
* to NuttX and bring up the network.
* Register RNDIS USB device interface.
* Register the corresponding network driver to NuttX and bring up the
* network.
*
* Input Parameters:
* mac_address: an array of 6 bytes which make the MAC address of the host side
* of the network.
* mac_address: an array of 6 bytes which make the MAC address of the host
* side of the network.
*
* Returned Value:
* 0 on success; -errno on failure
*
************************************************************************************/
****************************************************************************/
#ifndef CONFIG_RNDIS_COMPOSITE
int usbdev_rndis_initialize(FAR const uint8_t *mac_address);
+13 -13
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/storage.h
*
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
@@ -38,21 +38,21 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_STORAGE_H
#define __INCLUDE_NUTTX_USB_STORAGE_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Mass storage requests */
@@ -93,9 +93,9 @@
#define USBMSC_CSWSTATUS_FAIL (1)
#define USBMSC_CSWSTATUS_PHASEERROR (2)
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/* Command Block Wrapper (CBW) */
@@ -120,12 +120,12 @@ struct usbmsc_csw_s
uint8_t status; /* Status of transfer */
};
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
#endif /* __INCLUDE_NUTTX_USB_STORAGE_H */
+39 -34
View File
@@ -1,7 +1,8 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/usb.h
*
* Copyright (C) 2008, 2009-2010, 2012, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009-2010, 2012, 2008 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -31,26 +32,27 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_USB_H
#define __INCLUDE_NUTTX_USB_USB_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* A packet identifier (PID) immediately follows the SYNC field of every USB packet.
* A PID consists of a four-bit packet type field followed by a four-bit check field
* USB Tokens (See Table 8-1 in the USB specification)
/* A packet identifier (PID) immediately follows the SYNC field of every USB
* packet.
* A PID consists of a four-bit packet type field followed by a four-bit
* check field USB Tokens (See Table 8-1 in the USB specification)
*/
#define USB_PID_OUT_TOKEN (0x01) /* Tokens */
@@ -267,9 +269,9 @@
#define MSFTOSDESC_INDEX_FUNCTION 4
#define MSFTOSDESC_INDEX_EXTPROP 5
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/* This structure is used to send control requests to a USB device. */
@@ -412,12 +414,12 @@ struct usb_qualdesc_s
/* Interface association descriptor
*
* The Universal Serial Bus Specification, revision 2.0, does not support grouping
* more than one interface of a composite device within a single function. However,
* the USB Device Working Group (DWG) created USB device classes that allow for
* functions with multiple interfaces, and the USB Implementor's Forum issued an
* Engineering Change Notification (ECN) that defines a mechanism for grouping
* interfaces.
* The Universal Serial Bus Specification, revision 2.0, does not support
* grouping more than one interface of a composite device within a single
* function. However, the USB Device Working Group (DWG) created USB device
* classes that allow for functions with multiple interfaces, and the USB
* Implementor's Forum issued an Engineering Change Notification (ECN) that
* defines a mechanism for grouping interfaces.
*/
struct usb_iaddesc_s
@@ -435,15 +437,17 @@ struct usb_iaddesc_s
#define USB_SIZEOF_IADDESC 8
/* Microsoft OS function descriptor.
* This can be used to request a specific driver (such as WINUSB) to be loaded
* on Windows. Unlike other descriptors, it is requested by a special request
* USB_REQ_GETMSFTOSDESCRIPTOR.
* More details: https://msdn.microsoft.com/en-us/windows/hardware/gg463179
* And excellent explanation: https://github.com/pbatard/libwdi/wiki/WCID-Devices
* This can be used to request a specific driver (such as WINUSB) to be
* loaded on Windows. Unlike other descriptors, it is requested by a special
* request USB_REQ_GETMSFTOSDESCRIPTOR.
* More details:
* https://msdn.microsoft.com/en-us/windows/hardware/gg463179
* And excellent explanation:
* https://github.com/pbatard/libwdi/wiki/WCID-Devices
*
* The device will have exactly one "Extended Compat ID Feature Descriptor",
* which may contain multiple "Function Descriptors" associated with different
* interfaces.
* which may contain multiple "Function Descriptors" associated with
* different interfaces.
*/
struct usb_msft_os_function_desc_s
@@ -466,11 +470,12 @@ struct usb_msft_os_feature_desc_s
};
/* Microsoft OS extended property descriptor.
* This can be used to set specific registry values, such as interface GUID for
* a device. It is requested per-interface by special request USB_REQ_GETMSFTOSDESCRIPTOR.
* This can be used to set specific registry values, such as interface GUID
* for a device. It is requested per-interface by special request
* USB_REQ_GETMSFTOSDESCRIPTOR.
*
* The interface will have one extended properties descriptor, which may contain
* multiple properties inside it.
* The interface will have one extended properties descriptor, which may
* contain multiple properties inside it.
*/
struct usb_msft_os_extprop_hdr_s
@@ -490,12 +495,12 @@ struct usb_msft_os_extprop_hdr_s
*/
};
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Functions Definitions
****************************************************************************/
#endif /* __INCLUDE_NUTTX_USB_USB_H */
+60 -46
View File
@@ -1,7 +1,8 @@
/************************************************************************************
/****************************************************************************
* include/nuttx/usb/usbdev.h
*
* Copyright (C) 2008-2010, 2012-2013, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2010, 2012-2013, 2017 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* NOTE: This interface was inspired by the Linux gadget interface by
@@ -37,14 +38,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __INCLUDE_NUTTX_USB_USBDEV_H
#define __INCLUDE_NUTTX_USB_USBDEV_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -57,19 +58,21 @@
#include <nuttx/usb/usbmsc.h>
#include <nuttx/usb/composite.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Endpoint helpers *****************************************************************/
/* Endpoint helpers *********************************************************/
/* Configure endpoint, making it usable. The class driver may deallocate or re-use
* the 'desc' structure after returning:
/* Configure endpoint, making it usable.
* The class driver may deallocate or re-use the 'desc' structure after
* returning:
*
* ep - the struct usbdev_ep_s instance obtained from allocep()
* desc - A struct usb_epdesc_s instance describing the endpoint
* last - true if this is the last endpoint to be configured. Some hardware needs
* to take special action when all of the endpoints have been configured.
* last - true if this is the last endpoint to be configured. Some hardware
* needs to take special action when all of the endpoints have been
* configured.
*/
#define EP_CONFIGURE(ep,desc,last) (ep)->ops->configure(ep,desc,last)
@@ -78,12 +81,16 @@
#define EP_DISABLE(ep) (ep)->ops->disable(ep)
/* Allocate/free I/O requests. Should not be called from interrupt processing! */
/* Allocate/free I/O requests.
* Should not be called from interrupt processing!
*/
#define EP_ALLOCREQ(ep) (ep)->ops->allocreq(ep)
#define EP_FREEREQ(ep,req) (ep)->ops->freereq(ep,req)
/* Allocate/free an I/O buffer. Should not be called from interrupt processing! */
/* Allocate/free an I/O buffer.
* Should not be called from interrupt processing!
*/
#ifdef CONFIG_USBDEV_DMA
# define EP_ALLOCBUFFER(ep,nb) (ep)->ops->allocbuffer(ep,nb)
@@ -106,16 +113,17 @@
#define EP_STALL(ep) (ep)->ops->stall(ep,false)
#define EP_RESUME(ep) (ep)->ops->stall(ep,true)
/* USB Device Driver Helpers ********************************************************/
/* USB Device Driver Helpers ************************************************/
/* Allocate an endpoint:
*
* ep - 7-bit logical endpoint number (direction bit ignored). Zero means
* that any endpoint matching the other requirements will suffice. The
* assigned endpoint can be found in the eplog field.
* ep - 7-bit logical endpoint number (direction bit ignored).
* Zero means that any endpoint matching the other requirements
* will suffice.
* The assigned endpoint can be found in the eplog field.
* in - true: IN (device-to-host) endpoint requested
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC,
* USB_EP_ATTR_XFER_BULK, USB_EP_ATTR_XFER_INT}
*/
#define DEV_ALLOCEP(dev,ep,in,type) (dev)->ops->allocep(dev,ep,in,type)
@@ -140,9 +148,9 @@
#define DEV_CLRSELFPOWERED(dev) (dev)->ops->selfpowered(dev, false)
/* Software-controlled connect to USB host. All USB class drivers need to call
* DEV_CONNECT() when they are ready to be enumerated. That is, (1) initially when
* bound to the USB driver, and (2) after a USB reset.
/* Software-controlled connect to USB host. All USB class drivers need to
* call DEV_CONNECT() when they are ready to be enumerated. That is, (1)
* initially when bound to the USB driver, and (2) after a USB reset.
*/
#define DEV_CONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,true) : -EOPNOTSUPP
@@ -151,9 +159,11 @@
#define DEV_DISCONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,false) : -EOPNOTSUPP
/* USB Class Driver Helpers *********************************************************/
/* USB Class Driver Helpers *************************************************/
/* All may be called from interrupt handling logic except bind() and unbind() */
/* All may be called from interrupt handling logic except bind() and
* unbind()
*/
/* Invoked when the driver is bound to a USB device driver. */
@@ -163,7 +173,9 @@
#define CLASS_UNBIND(drvr,dev) (drvr)->ops->unbind(drvr,dev)
/* Invoked after all transfers have been stopped, when the host is disconnected. */
/* Invoked after all transfers have been stopped, when the host is
* disconnected.
*/
#define CLASS_DISCONNECT(drvr,dev) (drvr)->ops->disconnect(drvr,dev)
@@ -191,11 +203,11 @@
#define USBDEV_REQFLAGS_NULLPKT 1 /* Bit 0: Terminate w/short packet; null packet if necessary */
/* Bits 1-7: Available */
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/* USB Controller Structures ********************************************************/
/* USB Controller Structures ************************************************/
/* usbdev_devinfo_s - describes the low level bindings of an usb device */
@@ -257,7 +269,8 @@ struct usbdev_req_s
/* Callback when the transfer completes */
CODE void (*callback)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req);
CODE void (*callback)(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req);
FAR void *priv; /* Used only by callee */
};
@@ -341,7 +354,7 @@ struct usbdev_s
uint8_t dualspeed:1; /* 1:supports high and full speed operation */
};
/* USB Device Class Implementations *************************************************/
/* USB Device Class Implementations *****************************************/
struct usbdevclass_driver_s;
struct usbdevclass_driverops_s
@@ -367,9 +380,9 @@ struct usbdevclass_driver_s
uint8_t speed; /* Highest speed that the driver handles */
};
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -380,34 +393,35 @@ extern "C"
# define EXTERN extern
#endif
/************************************************************************************
/****************************************************************************
* Public Function Prototypes
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: usbdevclass_register
*
* Description:
* Register a USB device class driver. The class driver's bind() method will be
* called to bind it to a USB device driver.
* Register a USB device class driver. The class driver's bind() method
* will be called to bind it to a USB device driver.
*
************************************************************************************/
****************************************************************************/
int usbdev_register(FAR struct usbdevclass_driver_s *driver);
/************************************************************************************
/****************************************************************************
* Name: usbdev_unregister
*
* Description:
* Un-register usbdev class driver.If the USB device is connected to a USB host,
* it will first disconnect(). The driver is also requested to unbind() and clean
* up any device state, before this procedure finally returns.
* Un-register usbdev class driver.If the USB device is connected to a USB
* host, it will first disconnect().
* The driver is also requested to unbind() and clean up any device state,
* before this procedure finally returns.
*
************************************************************************************/
****************************************************************************/
int usbdev_unregister(FAR struct usbdevclass_driver_s *driver);
/************************************************************************************
/****************************************************************************
* Name: usbdev_dma_alloc and usbdev_dma_free
*
* Description:
@@ -431,7 +445,7 @@ int usbdev_unregister(FAR struct usbdevclass_driver_s *driver);
* does require the size of the allocation to be freed; that would need
* to be managed in the board-specific logic.
*
************************************************************************************/
****************************************************************************/
#if defined(CONFIG_USBDEV_DMA) && defined(CONFIG_USBDEV_DMAMEMORY)
FAR void *usbdev_dma_alloc(size_t size);
+11 -6
View File
@@ -1,7 +1,8 @@
/****************************************************************************
* include/nuttx/usb/usbdev_trace.h
*
* Copyright (C) 2008, 2009-2010, 2012-2013, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009-2010, 2012-2013, 2017 Gregory Nutt.
* All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +55,7 @@
#define TRACE_ID(event) ((event) & 0xff00)
#define TRACE_DATA(event) ((event) & 0x00ff)
/* Events ******************************************************************/
/* Events *******************************************************************/
/* Event class IDs */
@@ -144,7 +145,7 @@
#define TRACE_CLASSSTATE(id) TRACE_EVENT(TRACE_CLASSSTATE_ID, id)
/* USB device controller interrupt events. The 'id' is specific to the driver.
/* USB device controller interrupt events.The 'id' is specific to the driver.
* Particular values for 'id' are unique for a given implementation of a
* controller driver
*/
@@ -175,6 +176,7 @@
#define TRACE_CLSERROR(id) TRACE_EVENT(TRACE_CLSERROR_ID, id)
/* Event string descriptions ************************************************/
/* Macros for defining the string arrays for display of the traces. */
#ifdef CONFIG_USBDEV_TRACE_STRINGS
@@ -183,7 +185,9 @@
#endif
/* USB Serial driver class events *******************************************/
/* Used by both the CDC/ACM and the PL2303 serial class drivers */
/* UART interface API calls */
#define USBSER_TRACECLASSAPI_SETUP 0x0001
@@ -467,11 +471,12 @@ EXTERN const struct trace_msg_t g_usb_trace_strings_intdecode[];
* Name: usbtrace_enable
*
* Description:
* Enable/disable tracing per trace ID. The initial state is all IDs enabled.
* Enable/disable tracing per trace ID.
* The initial state is all IDs enabled.
*
* Input Parameters:
* idset - The bitset of IDs to be masked. TRACE_ALLIDS enables all IDS; zero
* masks all IDs.
* idset - The bitset of IDs to be masked.
* TRACE_ALLIDS enables all IDS; zero masks all IDs.
*
* Returned Value:
* The previous idset value.
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -87,7 +87,7 @@ extern "C"
#endif
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
struct usbhost_hubport_s; /* Forward reference */
@@ -133,12 +133,12 @@ int usbhost_devaddr_create(FAR struct usbhost_hubport_s *hport);
* Name: usbhost_devaddr_destroy
*
* Description:
* Release a device address previously assigned by usbhost_devaddr_create().
* Release a device address previously assigned by usbhost_devaddr_create().
*
* Input Parameters:
* hport - A reference to a hub port structure from which a device has been
* hport - A reference to a hub port structure from which a device has been
* disconnected and so no longer needs the function address.
* devaddr - The address to be released.
* devaddr - The address to be released.
*
* Returned Value:
* None
+6 -2
View File
@@ -45,7 +45,9 @@
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Debug/Trace-related definitions */
#ifndef CONFIG_DEBUG_FEATURES
@@ -57,7 +59,9 @@
# undef CONFIG_USBHOST_TRACE_VERBOSE
#endif
/* Trace support is needed if either USB host tracing or USB debug output is enabled */
/* Trace support is needed if either USB host tracing or USB debug output is
* enabled
*/
#if defined(CONFIG_USBHOST_TRACE) || defined(CONFIG_DEBUG_USB)
# define HAVE_USBHOST_TRACE 1
@@ -101,7 +105,7 @@ extern "C"
#endif
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
/****************************************************************************
+11 -6
View File
@@ -85,7 +85,7 @@ extern "C"
#endif
/****************************************************************************
* Public Functions
* Public Functions Definitions
****************************************************************************/
/****************************************************************************
@@ -133,8 +133,12 @@ int usbmsc_configure(unsigned int nluns, FAR void **handle);
*
****************************************************************************/
int usbmsc_bindlun(FAR void *handle, FAR const char *drvrpath, unsigned int lunno,
off_t startsector, size_t nsectors, bool readonly);
int usbmsc_bindlun(FAR void *handle,
FAR const char *drvrpath,
unsigned int lunno,
off_t startsector,
size_t nsectors,
bool readonly);
/****************************************************************************
* Name: usbmsc_unbindlun
@@ -187,7 +191,8 @@ int usbmsc_exportluns(FAR void *handle);
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBMSC_COMPOSITE)
struct usbdevclass_driver_s;
int usbmsc_classobject(FAR void *handle, FAR struct usbdev_devinfo_s *devinfo,
int usbmsc_classobject(FAR void *handle,
FAR struct usbdev_devinfo_s *devinfo,
FAR struct usbdevclass_driver_s **classdev);
#endif
@@ -214,8 +219,8 @@ void usbmsc_uninitialize(FAR void *handle);
* Name: usbmsc_get_composite_devdesc
*
* Description:
* Helper function to fill in some constants into the composite configuration
* structure.
* Helper function to fill in some constants into the composite
* configuration structure.
*
* Input Parameters:
* dev - Pointer to the configuration struct we should fill