summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapps/ChangeLog.txt1
-rw-r--r--apps/examples/README.txt22
-rw-r--r--apps/examples/composite/composite_main.c4
-rw-r--r--nuttx/ChangeLog6
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html9
-rw-r--r--nuttx/configs/README.txt7
-rwxr-xr-xnuttx/configs/stm3210e-eval/README.txt353
-rwxr-xr-xnuttx/configs/stm3210e-eval/composite/defconfig58
-rw-r--r--nuttx/drivers/usbdev/cdcacm.h22
-rw-r--r--nuttx/drivers/usbdev/cdcacm_descriptors.c31
-rw-r--r--nuttx/drivers/usbdev/composite.h12
-rw-r--r--nuttx/drivers/usbdev/composite_descriptors.c36
-rw-r--r--nuttx/drivers/usbdev/usbmsc.c4
-rw-r--r--nuttx/drivers/usbdev/usbmsc.h7
-rw-r--r--nuttx/drivers/usbdev/usbmsc_descriptors.c30
-rw-r--r--nuttx/include/nuttx/usb/usb.h24
16 files changed, 381 insertions, 245 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 486639fb8..77b92d12c 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -163,3 +163,4 @@
* apps/nshlib/nsh_serial.c and nsh_usbdev.c: If NuttX is configured to use
a USB serial console, then NSH needs to wait until the USB console is
connected and available.
+ * apps/examples/composite: Add a test of the USB composite device.
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index 136e0b57d..d9f30f191 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -118,12 +118,22 @@ examples/composite
Required overall configuration:
- CONFIG_USBDEV - USB device support
- CONFIG_USBDEV_COMPOSITE - USB composite device support
- CONFIG_CDCACM - USB CDC/ACM serial device support
- CONFIG_CDCACM_COMPOSITE - USB CDC/ACM serial composite device support
- CONFIG_USBMSC - USB mass storage device support
- CONFIG_USBMSC_COMPOSITE - USB mass storage composite device support
+ CONFIG_USBDEV=y - USB device support
+ CONFIG_USBDEV_COMPOSITE=y - USB composite device support
+ CONFIG_COMPOSITE_IAD=y - Interface associate descriptor needed
+
+ CONFIG_CDCACM=y - USB CDC/ACM serial device support
+ CONFIG_CDCACM_COMPOSITE=y - USB CDC/ACM serial composite device support
+ CONFIG_CDCACM_IFNOBASE=0 - CDC/ACM interfaces start with number 0
+ CONFIG_CDCACM_EPINTIN=1 - Endpoint numbers must be unique
+ CONFIG_CDCACM_EPBULKIN=2
+ CONFIG_CDCACM_EPBULKOUT=3
+
+ CONFIG_USBMSC - USB mass storage device support
+ CONFIG_USBMSC_COMPOSITE - USB mass storage composite device support
+ CONFIG_USBMSC_IFNOBASE=2 - USB mass storage interfaces start with number 2
+ CONFIG_USBMSC_EPBULKOUT=4 - Endpoint numbers must be unique
+ CONFIG_USBMSC_EPBULKIN=5
CONFIG_NSH_BUILTIN_APPS
This example can be built as two NSH "built-in" commands if this option
diff --git a/apps/examples/composite/composite_main.c b/apps/examples/composite/composite_main.c
index b6e9bec9d..961716116 100644
--- a/apps/examples/composite/composite_main.c
+++ b/apps/examples/composite/composite_main.c
@@ -503,7 +503,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev)
{
int ret;
- DEBUGASSERT(g_composite.mschandle != NULL);
+ DEBUGASSERT(g_composite.mschandle == NULL);
/* Initialize USB trace output IDs */
@@ -657,7 +657,7 @@ void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev)
}
/****************************************************************************
- * user_start/msconn_main
+ * user_start/conn_main
*
* Description:
* This is the main program that configures the USB mass storage device
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 7f67fbc0f..715ff15a4 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2397,3 +2397,9 @@
* drivers/usbdev/: Lots of name changes: cdc_serial->cdcacm, usbstrg->usbmsc,
usbser->pl2303
* drivers/usbdev/composite*: Fleshed out support for a composite USB device.
+ * drivers/stm3210e-eval/composite and drivers/stm3210e-eval/src/up_composite.c:
+ Add a configuration test the USB composite device.
+ * include/nuttx/usb/usb.h, drivers/usbdev/composite_descriptors.c, and
+ drivers/usbdev/cdcacm_descriptors.c: Add support for the USB Interface
+ Association Descriptor (IAD)
+
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index d69a85a11..9c1dd07c9 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -5054,11 +5054,18 @@ build
(only if CONFIG_USBDEV_COMPOSITE is also defined)
</li>
<li>
- <code>CONFIG_COMPOSITE_COMPOSITE</code>:
+ <code>CONFIG_UBMSC_COMPOSITE</code>:
Configure the mass storage driver as part of a composite driver
(only if CONFIG_USBDEV_COMPOSITE is also defined)
</li>
<li>
+ <code>CONFIG_COMPOSITE_IAD</code>:
+ If one of the members of the composite has multiple interfaces
+ (such as CDC/ACM), then an Interface Association Descriptor (IAD)
+ will be necessary. Default: IAD will be used automatically if
+ needed. It should not be necessary to set this.
+ </li>
+ <li>
<code>CONFIG_COMPOSITE_EP0MAXPACKET</code>:
Max packet size for endpoint 0
</li>
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index 0a75bf017..f53cb2a82 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -1093,9 +1093,14 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_CDCACM_COMPOSITE
Configure the CDC serial driver as part of a composite driver
(only if CONFIG_USBDEV_COMPOSITE is also defined)
- CONFIG_COMPOSITE_COMPOSITE
+ CONFIG_USBMSC_COMPOSITE
Configure the mass storage driver as part of a composite driver
(only if CONFIG_USBDEV_COMPOSITE is also defined)
+ CONFIG_COMPOSITE_IAD
+ If one of the members of the composite has multiple interfaces
+ (such as CDC/ACM), then an Interface Association Descriptor (IAD)
+ will be necessary. Default: IAD will be used automatically if
+ needed. It should not be necessary to set this.
CONFIG_COMPOSITE_EP0MAXPACKET
Max packet size for endpoint 0
CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_VENDORSTR
diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt
index a86b32526..9b1615f42 100755
--- a/nuttx/configs/stm3210e-eval/README.txt
+++ b/nuttx/configs/stm3210e-eval/README.txt
@@ -49,7 +49,7 @@ GNU Toolchain Options
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
- CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
the PATH in the setenv.h file if your make cannot find the tools.
@@ -271,20 +271,20 @@ LEDs
The STM3210E-EVAL board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
board.. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
defined. In that case, the usage by the board port is defined in
-include/board.h and src/up_leds.c. The LEDs are used to encode OS-related\
+include/board.h and src/up_leds.c. The LEDs are used to encode OS-related
events as follows:
- SYMBOL Meaning LED1* LED2 LED3 LED4
- ------------------- ----------------------- ------- ------- ------- ------
- LED_STARTED NuttX has been started ON OFF OFF OFF
- LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
- LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
- LED_STACKCREATED Idle stack created OFF OFF ON OFF
- LED_INIRQ In an interrupt** ON N/C N/C OFF
- LED_SIGNAL In a signal handler*** N/C ON N/C OFF
- LED_ASSERTION An assertion failed ON ON N/C OFF
- LED_PANIC The system has crashed N/C N/C N/C ON
- LED_IDLE STM32 is is sleep mode (Optional, not used)
+ SYMBOL Meaning LED1* LED2 LED3 LED4
+ ---------------- ----------------------- ----- ----- ----- -----
+ LED_STARTED NuttX has been started ON OFF OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
+ LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
+ LED_STACKCREATED Idle stack created OFF OFF ON OFF
+ LED_INIRQ In an interrupt** ON N/C N/C OFF
+ LED_SIGNAL In a signal handler*** N/C ON N/C OFF
+ LED_ASSERTION An assertion failed ON ON N/C OFF
+ LED_PANIC The system has crashed N/C N/C N/C ON
+ LED_IDLE STM32 is is sleep mode (Optional, not used)
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
and these LEDs will give you some indication of where the failure was
@@ -354,126 +354,126 @@ RTC
STM3210E-EVAL-specific Configuration Options
============================================
- CONFIG_ARCH - Identifies the arch/ subdirectory. This should
- be set to:
+ CONFIG_ARCH - Identifies the arch/ subdirectory. This should
+ be set to:
- CONFIG_ARCH=arm
+ CONFIG_ARCH=arm
- CONFIG_ARCH_family - For use in C code:
+ CONFIG_ARCH_family - For use in C code:
- CONFIG_ARCH_ARM=y
+ CONFIG_ARCH_ARM=y
- CONFIG_ARCH_architecture - For use in C code:
+ CONFIG_ARCH_architecture - For use in C code:
- CONFIG_ARCH_CORTEXM3=y
+ CONFIG_ARCH_CORTEXM3=y
- CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
+ CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
- CONFIG_ARCH_CHIP=stm32
+ CONFIG_ARCH_CHIP=stm32
- CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
- chip:
+ CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
+ chip:
- CONFIG_ARCH_CHIP_STM32F103ZET6
+ CONFIG_ARCH_CHIP_STM32F103ZET6
CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
configuration features.
CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
- CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
- hence, the board that supports the particular chip or SoC.
+ CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
+ hence, the board that supports the particular chip or SoC.
- CONFIG_ARCH_BOARD=stm3210e_eval (for the STM3210E-EVAL development board)
+ CONFIG_ARCH_BOARD=stm3210e_eval (for the STM3210E-EVAL development board)
- CONFIG_ARCH_BOARD_name - For use in C code
+ CONFIG_ARCH_BOARD_name - For use in C code
- CONFIG_ARCH_BOARD_STM3210E_EVAL=y
+ CONFIG_ARCH_BOARD_STM3210E_EVAL=y
- CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
- of delay loops
+ CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
+ of delay loops
- CONFIG_ENDIAN_BIG - define if big endian (default is little
- endian)
+ CONFIG_ENDIAN_BIG - define if big endian (default is little
+ endian)
- CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
+ CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
- CONFIG_DRAM_SIZE=0x00010000 (64Kb)
+ CONFIG_DRAM_SIZE=0x00010000 (64Kb)
- CONFIG_DRAM_START - The start address of installed DRAM
+ CONFIG_DRAM_START - The start address of installed DRAM
- CONFIG_DRAM_START=0x20000000
+ CONFIG_DRAM_START=0x20000000
- CONFIG_DRAM_END - Last address+1 of installed RAM
+ CONFIG_DRAM_END - Last address+1 of installed RAM
- CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
+ CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
- CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
+ CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
- CONFIG_ARCH_IRQPRIO=y
+ CONFIG_ARCH_IRQPRIO=y
- CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
- have LEDs
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
+ have LEDs
- CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
- stack. If defined, this symbol is the size of the interrupt
- stack in bytes. If not defined, the user task stacks will be
- used during interrupt handling.
+ CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
+ stack. If defined, this symbol is the size of the interrupt
+ stack in bytes. If not defined, the user task stacks will be
+ used during interrupt handling.
- CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
+ CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
- CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
+ CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
- CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
- cause a 100 second delay during boot-up. This 100 second delay
- serves no purpose other than it allows you to calibratre
- CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
- the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
- the delay actually is 100 seconds.
+ CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
+ cause a 100 second delay during boot-up. This 100 second delay
+ serves no purpose other than it allows you to calibratre
+ CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
+ the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
+ the delay actually is 100 seconds.
Individual subsystems can be enabled:
- AHB
- ---
- CONFIG_STM32_DMA1
- CONFIG_STM32_DMA2
- CONFIG_STM32_CRC
- CONFIG_STM32_FSMC
- CONFIG_STM32_SDIO
-
- APB1
- ----
- CONFIG_STM32_TIM2
- CONFIG_STM32_TIM3
- CONFIG_STM32_TIM4
- CONFIG_STM32_TIM5
- CONFIG_STM32_TIM6
- CONFIG_STM32_TIM7
- CONFIG_STM32_WWDG
- CONFIG_STM32_SPI2
- CONFIG_STM32_SPI4
- CONFIG_STM32_USART2
- CONFIG_STM32_USART3
- CONFIG_STM32_UART4
- CONFIG_STM32_UART5
- CONFIG_STM32_I2C1
- CONFIG_STM32_I2C2
- CONFIG_STM32_USB
- CONFIG_STM32_CAN
- CONFIG_STM32_BKP
- CONFIG_STM32_PWR
- CONFIG_STM32_DAC1
- CONFIG_STM32_DAC2
- CONFIG_STM32_USB
-
- APB2
- ----
- CONFIG_STM32_ADC1
- CONFIG_STM32_ADC2
- CONFIG_STM32_TIM1
- CONFIG_STM32_SPI1
- CONFIG_STM32_TIM8
- CONFIG_STM32_USART1
- CONFIG_STM32_ADC3
+ AHB
+ ---
+ CONFIG_STM32_DMA1
+ CONFIG_STM32_DMA2
+ CONFIG_STM32_CRC
+ CONFIG_STM32_FSMC
+ CONFIG_STM32_SDIO
+
+ APB1
+ ----
+ CONFIG_STM32_TIM2
+ CONFIG_STM32_TIM3
+ CONFIG_STM32_TIM4
+ CONFIG_STM32_TIM5
+ CONFIG_STM32_TIM6
+ CONFIG_STM32_TIM7
+ CONFIG_STM32_WWDG
+ CONFIG_STM32_SPI2
+ CONFIG_STM32_SPI4
+ CONFIG_STM32_USART2
+ CONFIG_STM32_USART3
+ CONFIG_STM32_UART4
+ CONFIG_STM32_UART5
+ CONFIG_STM32_I2C1
+ CONFIG_STM32_I2C2
+ CONFIG_STM32_USB
+ CONFIG_STM32_CAN
+ CONFIG_STM32_BKP
+ CONFIG_STM32_PWR
+ CONFIG_STM32_DAC1
+ CONFIG_STM32_DAC2
+ CONFIG_STM32_USB
+
+ APB2
+ ----
+ CONFIG_STM32_ADC1
+ CONFIG_STM32_ADC2
+ CONFIG_STM32_TIM1
+ CONFIG_STM32_SPI1
+ CONFIG_STM32_TIM8
+ CONFIG_STM32_USART1
+ CONFIG_STM32_ADC3
Timer and I2C devices may need to the following to force power to be applied
unconditionally at power up. (Otherwise, the device is powered when it is
@@ -489,16 +489,16 @@ STM3210E-EVAL-specific Configuration Options
to assign the timer (n) for used by the ADC or DAC, but then you also have to
configure which ADC or DAC (m) it is assigned to.
- CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,8
- CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,8
- CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,8, m=1,..,3
- CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,8
- CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,8, m=1,..,2
+ CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,8
+ CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,8
+ CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,8, m=1,..,3
+ CONFIG_STM32_TIMn_DAC Reserve timer n for use by DAC, n=1,..,8
+ CONFIG_STM32_TIMn_DACm Reserve timer n to trigger DACm, n=1,..,8, m=1,..,2
For each timer that is enabled for PWM usage, we need the following additional
configuration settings:
- CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
+ CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
NOTE: The STM32 timers are each capable of generating different signals on
each of the four channels with different duty cycles. That capability is
@@ -506,76 +506,76 @@ STM3210E-EVAL-specific Configuration Options
Alternate pin mappings (should not be used with the STM3210E-EVAL board):
- CONFIG_STM32_TIM1_FULL_REMAP
- CONFIG_STM32_TIM1_PARTIAL_REMAP
- CONFIG_STM32_TIM2_FULL_REMAP
- CONFIG_STM32_TIM2_PARTIAL_REMAP_1
- CONFIG_STM32_TIM2_PARTIAL_REMAP_2
- CONFIG_STM32_TIM3_FULL_REMAP
- CONFIG_STM32_TIM3_PARTIAL_REMAP
- CONFIG_STM32_TIM4_REMAP
- CONFIG_STM32_USART1_REMAP
- CONFIG_STM32_USART2_REMAP
- CONFIG_STM32_USART3_FULL_REMAP
- CONFIG_STM32_USART3_PARTIAL_REMAP
- CONFIG_STM32_SPI1_REMAP
- CONFIG_STM32_SPI3_REMAP
- CONFIG_STM32_I2C1_REMAP
- CONFIG_STM32_CAN1_FULL_REMAP
- CONFIG_STM32_CAN1_PARTIAL_REMAP
- CONFIG_STM32_CAN2_REMAP
+ CONFIG_STM32_TIM1_FULL_REMAP
+ CONFIG_STM32_TIM1_PARTIAL_REMAP
+ CONFIG_STM32_TIM2_FULL_REMAP
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_1
+ CONFIG_STM32_TIM2_PARTIAL_REMAP_2
+ CONFIG_STM32_TIM3_FULL_REMAP
+ CONFIG_STM32_TIM3_PARTIAL_REMAP
+ CONFIG_STM32_TIM4_REMAP
+ CONFIG_STM32_USART1_REMAP
+ CONFIG_STM32_USART2_REMAP
+ CONFIG_STM32_USART3_FULL_REMAP
+ CONFIG_STM32_USART3_PARTIAL_REMAP
+ CONFIG_STM32_SPI1_REMAP
+ CONFIG_STM32_SPI3_REMAP
+ CONFIG_STM32_I2C1_REMAP
+ CONFIG_STM32_CAN1_FULL_REMAP
+ CONFIG_STM32_CAN1_PARTIAL_REMAP
+ CONFIG_STM32_CAN2_REMAP
JTAG Enable settings (by default JTAG-DP and SW-DP are disabled):
- CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
- CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
- but without JNTRST.
- CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
+ CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
+ but without JNTRST.
+ CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
STM32F103Z specific device driver settings
- CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
+ CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
m (m=4,5) for the console and ttys0 (default is the USART1).
- CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
- This specific the size of the receive buffer
- CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
- being sent. This specific the size of the transmit buffer
- CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
- CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
- CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
- CONFIG_U[S]ARTn_2STOP - Two stop bits
-
- CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
- support. Non-interrupt-driven, poll-waiting is recommended if the
- interrupt rate would be to high in the interrupt driven case.
- CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
- Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
-
- CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
- and CONFIG_STM32_DMA2.
- CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
- CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
- Default: Medium
- CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
- 4-bit transfer mode.
+ CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
+ This specific the size of the receive buffer
+ CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
+ being sent. This specific the size of the transmit buffer
+ CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
+ CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
+ CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
+ CONFIG_U[S]ARTn_2STOP - Two stop bits
+
+ CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
+ support. Non-interrupt-driven, poll-waiting is recommended if the
+ interrupt rate would be to high in the interrupt driven case.
+ CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
+ Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
+
+ CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
+ and CONFIG_STM32_DMA2.
+ CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
+ CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
+ Default: Medium
+ CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
+ 4-bit transfer mode.
STM3210E-EVAL CAN Configuration
- CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
- CONFIG_STM32_CAN2 must also be defined)
- CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
- Standard 11-bit IDs.
- CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
- Default: 8
- CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
- Default: 4
- CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
- mode for testing. The STM32 CAN driver does support loopback mode.
- CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
- CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
- CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
- CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
- CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
- dump of all CAN registers.
+ CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
+ CONFIG_STM32_CAN2 must also be defined)
+ CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
+ Standard 11-bit IDs.
+ CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
+ Default: 8
+ CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
+ Default: 4
+ CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
+ mode for testing. The STM32 CAN driver does support loopback mode.
+ CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1 is defined.
+ CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2 is defined.
+ CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
+ CONFIG_CAN_TSEG2 - the number of CAN time quanta in segment 2. Default: 7
+ CONFIG_CAN_REGDEBUG - If CONFIG_DEBUG is set, this will generate an
+ dump of all CAN registers.
STM3210E-EVAL LCD Hardware Configuration
@@ -615,10 +615,10 @@ Configurations
Each STM3210E-EVAL configuration is maintained in a sudirectory and
can be selected as follow:
- cd tools
- ./configure.sh stm3210e-eval/<subdir>
- cd -
- . ./setenv.sh
+ cd tools
+ ./configure.sh stm3210e-eval/<subdir>
+ cd -
+ . ./setenv.sh
Where <subdir> is one of the following:
@@ -630,6 +630,13 @@ Where <subdir> is one of the following:
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ composite
+ ---------
+
+ This configuration exercises a composite USB interface consisting
+ of a CDC/ACM device and a USB mass storage device. This configuration
+ uses apps/examples/composite.
+
nsh and nsh2:
------------
Configure the NuttShell (nsh) located at examples/nsh.
@@ -716,7 +723,7 @@ Where <subdir> is one of the following:
windows occur. Text should continue to update normally with
or without the popup windows present.
- CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
NOTE: When I tried building this example with the CodeSourcery
@@ -730,7 +737,7 @@ Where <subdir> is one of the following:
examples/ostest. By default, this project assumes that you are
using the DFU bootloader.
- CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
RIDE
----
@@ -745,7 +752,7 @@ Where <subdir> is one of the following:
driver at examples/usbserial. See examples/README.txt for
more information.
- CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
USB debug output can be enabled as by changing the following
settings in the configuration file:
@@ -795,5 +802,5 @@ Where <subdir> is one of the following:
class driver at examples/usbstorage. See examples/README.txt for
more information.
- CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
+ CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
diff --git a/nuttx/configs/stm3210e-eval/composite/defconfig b/nuttx/configs/stm3210e-eval/composite/defconfig
index 0680b53e3..46fa44814 100755
--- a/nuttx/configs/stm3210e-eval/composite/defconfig
+++ b/nuttx/configs/stm3210e-eval/composite/defconfig
@@ -646,8 +646,6 @@ CONFIG_NET_RESOLV_ENTRIES=4
#
# CONFIG_USBDEV
# Enables USB device support
-# CONFIG_USBDEV_COMPOSITE
-# Enables USB composite device support
# CONFIG_USBDEV_ISOCHRONOUS
# Build in extra support for isochronous endpoints
# CONFIG_USBDEV_DUALSPEED
@@ -663,7 +661,6 @@ CONFIG_NET_RESOLV_ENTRIES=4
# Number of trace entries to remember
#
CONFIG_USBDEV=y
-CONFIG_USBDEV_COMPOSITE=y
CONFIG_USBDEV_ISOCHRONOUS=n
CONFIG_USBDEV_DUALSPEED=n
CONFIG_USBDEV_SELFPOWERED=y
@@ -744,7 +741,7 @@ CONFIG_USBMSC=y
CONFIG_USBMSC_COMPOSITE=y
CONFIG_USBMSC_IFNOBASE=2
CONFIG_USBMSC_EP0MAXPACKET=64
-CONFIG_USBMSC_EPBULKOUT=2
+CONFIG_USBMSC_EPBULKOUT=4
CONFIG_USBMSC_EPBULKIN=5
CONFIG_USBMSC_NRDREQS=2
CONFIG_USBMSC_NWRREQS=2
@@ -818,13 +815,13 @@ CONFIG_CDCACM=y
CONFIG_CDCACM_COMPOSITE=y
CONFIG_CDCACM_IFNOBASE=0
#CONFIG_CDCACM_EP0MAXPACKET
-#CONFIG_CDCACM_EPINTIN
+CONFIG_CDCACM_EPINTIN=1
#CONFIG_CDCACM_EPINTIN_FSSIZE
#CONFIG_CDCACM_EPINTIN_HSSIZE
-#CONFIG_CDCACM_EPBULKOUT
+CONFIG_CDCACM_EPBULKOUT=3
#CONFIG_CDCACM_EPBULKOUT_FSSIZE
#CONFIG_CDCACM_EPBULKOUT_HSSIZE
-#CONFIG_CDCACM_EPBULKIN
+CONFIG_CDCACM_EPBULKIN=2
#CONFIG_CDCACM_EPBULKIN_FSSIZE
#CONFIG_CDCACM_EPBULKIN_HSSIZE
#CONFIG_CDCACM_NWRREQS
@@ -837,6 +834,40 @@ CONFIG_CDCACM_IFNOBASE=0
#CONFIG_CDCACM_TXBUFSIZE
#
+# USB Composite Device Configuration
+#
+# CONFIG_USBDEV_COMPOSITE
+# Enables USB composite device support
+# CONFIG_COMPOSITE_IAD
+# If one of the members of the composite has multiple interfaces
+# (such as CDC/ACM), then an Interface Association Descriptor (IAD)
+# will be necessary. Default: IAD will be used automatically if
+# needed. It should not be necessary to set this.
+# CONFIG_COMPOSITE_EP0MAXPACKET
+# Max packet size for endpoint 0
+# CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_VENDORSTR
+# The vendor ID code/string
+# CONFIG_COMPOSITE_PRODUCTID and CONFIG_COMPOSITE_PRODUCTSTR
+# The product ID code/string
+# CONFIG_COMPOSITE_SERIALSTR
+# Device serial number string
+# CONFIG_COMPOSITE_CONFIGSTR
+# Configuration string
+# CONFIG_COMPOSITE_VERSIONNO
+# The device version number
+#
+CONFIG_USBDEV_COMPOSITE=y
+CONFIG_COMPOSITE_IAD=y
+#CONFIG_COMPOSITE_EP0MAXPACKET
+CONFIG_COMPOSITE_VENDORID=0x03eb
+CONFIG_COMPOSITE_PRODUCTID=0x2022
+CONFIG_COMPOSITE_VENDORSTR="NuttX"
+CONFIG_COMPOSITE_PRODUCTSTR="Composite Device"
+CONFIG_COMPOSITE_SERIALSTR="12345"
+CONFIG_COMPOSITE_CONFIGSTR="examples/composite"
+CONFIG_COMPOSITE_VERSIONNO=0x0101
+
+#
# Settings for examples/uip
#
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
@@ -1015,12 +1046,6 @@ CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
#
# CONFIG_EXAMPLES_COMPOSITE_DEBUGMM
# Enables some debug tests to check for memory usage and memory leaks.
-# CONFIG_COMPOSITE_VENDORID and CONFIG_COMPOSITE_PRODUCTID
-# The vendor ID code/string
-# CONFIG_USBMSC_PRODUCTID and CONFIG_USBMSC_PRODUCTSTR
-# The product ID code/string
-# CONFIG_COMPOSITE_VERSIONNO
-# The device version number
#
# CONFIG_EXAMPLES_COMPOSITE_NLUNS
# Defines the number of logical units (LUNs) exported by the USB storage
@@ -1062,16 +1087,11 @@ CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
# Show interrupt-related events.
#
CONFIG_EXAMPLES_COMPOSITE_DEBUGMM=n
-CONFIG_COMPOSITE_VENDORID=0x03eb
-CONFIG_COMPOSITE_PRODUCTID=0x2022
-CONFIG_COMPOSITE_VENDORSTR="NuttX"
-CONFIG_COMPOSITE_PRODUCTSTR="Composite Device"
-CONFIG_COMPOSITE_VERSIONNO
CONFIG_EXAMPLES_COMPOSITE_NLUNS=1
CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1=0
CONFIG_EXAMPLES_COMPOSITE_DEVPATH1="/dev/mmcsd0"
CONFIG_EXAMPLES_COMPOSITE_TTYUSB=0
-CCONFIG_EXAMPLES_COMPOSITE_SERDEV="/dev/ttyUSB0"
+CONFIG_EXAMPLES_COMPOSITE_SERDEV="/dev/ttyUSB0"
CONFIG_EXAMPLES_COMPOSITE_BUFSIZE=256
CONFIG_EXAMPLES_COMPOSITE_TRACEINIT=n
CONFIG_EXAMPLES_COMPOSITE_TRACECLASS=n
diff --git a/nuttx/drivers/usbdev/cdcacm.h b/nuttx/drivers/usbdev/cdcacm.h
index 13007d18c..a107fd060 100644
--- a/nuttx/drivers/usbdev/cdcacm.h
+++ b/nuttx/drivers/usbdev/cdcacm.h
@@ -64,6 +64,10 @@
# define CONFIG_CDCACM_STRBASE (4)
#endif
+#if defined(CONFIG_CDCACM_COMPOSITE) && !defined(CONFIG_COMPOSITE_IAD)
+# warning "CONFIG_COMPOSITE_IAD may be needed"
+#endif
+
/* Packet and request buffer sizes */
#ifndef CONFIG_CDCACM_COMPOSITE
@@ -158,7 +162,7 @@
/* Configuration descriptor size */
-#ifndef CONFIG_CDCACM_COMPOSITE
+#if !defined(CONFIG_CDCACM_COMPOSITE)
/* Number of individual descriptors in the configuration descriptor:
* Configuration descriptor + (2) interface descriptors + (3) endpoint
@@ -172,6 +176,22 @@
# define SIZEOF_CDCACM_CFGDESC \
(USB_SIZEOF_CFGDESC + 2*USB_SIZEOF_IFDESC + 3*USB_SIZEOF_EPDESC + \
SIZEOF_ACM_FUNCDESC + SIZEOF_HDR_FUNCDESC + SIZEOF_UNION_FUNCDESC(1))
+
+#elif defined(CONFIG_COMPOSITE_IAD)
+
+/* Number of individual descriptors in the configuration descriptor:
+ * (1) interface association descriptor + (2) interface descriptors +
+ * (3) endpoint descriptors + (3) ACM descriptors.
+ */
+
+# define CDCACM_CFGGROUP_SIZE (9)
+
+/* The size of the config descriptor: (8 + 2*9 + 3*7 + 4 + 5 + 5) = 61 */
+
+# define SIZEOF_CDCACM_CFGDESC \
+ (USB_SIZEOF_IADDESC +2*USB_SIZEOF_IFDESC + 3*USB_SIZEOF_EPDESC + \
+ SIZEOF_ACM_FUNCDESC + SIZEOF_HDR_FUNCDESC + SIZEOF_UNION_FUNCDESC(1))
+
#else
/* Number of individual descriptors in the configuration descriptor:
diff --git a/nuttx/drivers/usbdev/cdcacm_descriptors.c b/nuttx/drivers/usbdev/cdcacm_descriptors.c
index 80bbfbfd1..11a83541e 100644
--- a/nuttx/drivers/usbdev/cdcacm_descriptors.c
+++ b/nuttx/drivers/usbdev/cdcacm_descriptors.c
@@ -139,6 +139,22 @@ static const struct usb_cfgdesc_s g_cfgdesc =
};
#endif
+/* Interface association descriptor */
+
+#if defined(CONFIG_CDCACM_COMPOSITE) && defined(CONFIG_COMPOSITE_IAD)
+static const struct usb_iaddesc_s g_iaddesc =
+{
+ USB_SIZEOF_IADDESC, /* len */
+ USB_DESC_TYPE_INTERFACEASSOCIATION, /* type */
+ CONFIG_CDCACM_IFNOBASE, /* firstif */
+ CDCACM_NINTERFACES, /* nifs */
+ USB_CLASS_CDC, /* class */
+ CDC_SUBCLASS_ACM, /* subclass */
+ CDC_PROTO_NONE, /* protocol */
+ 0 /* ifunction */
+};
+#endif
+
/* Notification interface */
static const struct usb_ifdesc_s g_notifdesc =
@@ -273,12 +289,25 @@ static const struct cfgdecsc_group_s g_cfggroup[CDCACM_CFGGROUP_SIZE] =
* provided by the composite device logic.
*/
-#ifndef CONFIG_CDCACM_COMPOSITE
+#if !defined(CONFIG_CDCACM_COMPOSITE)
{
USB_SIZEOF_CFGDESC, /* 1. Configuration descriptor */
0,
(FAR void *)&g_cfgdesc
},
+
+ /* If the serial device is part of a composite device, then it should
+ * begin with an interface association descriptor (IAD) because the
+ * CDC/ACM device consists of more than one interface. The IAD associates
+ * the two CDC/ACM interfaces with the same CDC/ACM device.
+ */
+
+#elif defined(CONFIG_COMPOSITE_IAD)
+ {
+ USB_SIZEOF_IADDESC, /* 1. Interface association descriptor */
+ 0,
+ (FAR void *)&g_iaddesc
+ },
#endif
{
USB_SIZEOF_IFDESC, /* 2. Notification interface */
diff --git a/nuttx/drivers/usbdev/composite.h b/nuttx/drivers/usbdev/composite.h
index f1f624c1c..aaddfad34 100644
--- a/nuttx/drivers/usbdev/composite.h
+++ b/nuttx/drivers/usbdev/composite.h
@@ -185,6 +185,18 @@
# warning "Interface numbers are not contiguous"
#endif
+/* Check if an IAD is needed */
+
+#ifdef CONFIG_COMPOSITE_IAD
+# if DEV1_NINTERFACES == 1 && DEV2_NINTERFACES == 1
+# warning "CONFIG_COMPOSITE_IAD not needed"
+# endif
+#endif
+
+#if !defined(CONFIG_COMPOSITE_IAD) && DEV1_NINTERFACES > 1 && DEV2_NINTERFACES > 1
+# warning "CONFIG_COMPOSITE_IAD may be needed"
+#endif
+
/* Total size of the configuration descriptor: */
#define COMPOSITE_CFGDESCSIZE (USB_SIZEOF_CFGDESC + DEV1_CFGDESCSIZE + DEV2_CFGDESCSIZE)
diff --git a/nuttx/drivers/usbdev/composite_descriptors.c b/nuttx/drivers/usbdev/composite_descriptors.c
index 349a54c6c..5c9e586d8 100644
--- a/nuttx/drivers/usbdev/composite_descriptors.c
+++ b/nuttx/drivers/usbdev/composite_descriptors.c
@@ -84,9 +84,15 @@ static const struct usb_devdesc_s g_devdesc =
LSBYTE(0x0200),
MSBYTE(0x0200)
},
+#ifdef CONFIG_COMPOSITE_IAD
+ USB_CLASS_MISC, /* class */
+ 2, /* subclass */
+ 1, /* protocol */
+#else
USB_CLASS_PER_INTERFACE, /* class */
0, /* subclass */
0, /* protocol */
+#endif
CONFIG_COMPOSITE_EP0MAXPACKET, /* maxpacketsize */
{
LSBYTE(CONFIG_COMPOSITE_VENDORID), /* vendor */
@@ -240,31 +246,31 @@ int16_t composite_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type)
int16_t composite_mkcfgdesc(uint8_t *buf)
#endif
{
- FAR struct usb_cfgdesc_s *cfgdesc = (struct usb_cfgdesc_s*)buf;
int16_t len;
+ int16_t total;
/* Configuration descriptor -- Copy the canned configuration descriptor. */
- memcpy(cfgdesc, &g_cfgdesc, USB_SIZEOF_CFGDESC);
- len = USB_SIZEOF_CFGDESC;
- buf += USB_SIZEOF_CFGDESC;
+ memcpy(buf, &g_cfgdesc, USB_SIZEOF_CFGDESC);
+ total = USB_SIZEOF_CFGDESC;
+ buf += USB_SIZEOF_CFGDESC;
- /* Copy DEV1/DEV2 configuration descriptors */
+ /* Copy DEV1/DEV2 interface descriptors */
#ifdef CONFIG_USBDEV_DUALSPEED
- len = DEV1_MKCFGDESC(buf, speed, type);
- buf += len;
- len = DEV2_MKCFGDESC(buf, speed, type);
- buf += len;
+ len = DEV1_MKCFGDESC(buf, speed, type);
+ total += len;
+ buf += len;
+ total += DEV2_MKCFGDESC(buf, speed, type);
#else
- len = DEV1_MKCFGDESC(buf);
- buf += len;
- len = DEV2_MKCFGDESC(buf);
- buf += len;
+ len = DEV1_MKCFGDESC(buf);
+ total += len;
+ buf += len;
+ total += DEV2_MKCFGDESC(buf);
#endif
- DEBUGASSERT(len == COMPOSITE_CFGDESCSIZE);
- return COMPOSITE_CFGDESCSIZE;
+ DEBUGASSERT(total == COMPOSITE_CFGDESCSIZE);
+ return total;
}
/****************************************************************************
diff --git a/nuttx/drivers/usbdev/usbmsc.c b/nuttx/drivers/usbdev/usbmsc.c
index 0c444c156..f521c0a2d 100644
--- a/nuttx/drivers/usbdev/usbmsc.c
+++ b/nuttx/drivers/usbdev/usbmsc.c
@@ -1660,6 +1660,7 @@ errout_with_mutex:
int usbmsc_classobject(FAR void *handle,
FAR struct usbdevclass_driver_s **classdev)
{
+ FAR struct usbmsc_alloc_s *alloc = (FAR struct usbmsc_alloc_s *)handle;
int ret;
DEBUGASSERT(handle && classdev);
@@ -1673,8 +1674,7 @@ int usbmsc_classobject(FAR void *handle,
{
/* On sucess, return an (typed) instance of the class instance */
- *classdev = (FAR struct usbdevclass_driver_s *)
- &((FAR struct usbmsc_alloc_s *)handle)->dev;
+ *classdev = &alloc->drvr.drvr;
}
return ret;
}
diff --git a/nuttx/drivers/usbdev/usbmsc.h b/nuttx/drivers/usbdev/usbmsc.h
index 910aef8bd..a656872a2 100644
--- a/nuttx/drivers/usbdev/usbmsc.h
+++ b/nuttx/drivers/usbdev/usbmsc.h
@@ -369,7 +369,8 @@
/* The size of the config descriptor: (9 + 9 + 2*7) = 32 */
# define SIZEOF_USBMSC_CFGDESC \
- (USB_SIZEOF_CFGDESC + USB_SIZEOF_IFDESC + 2*USB_SIZEOF_EPDESC)
+ (USB_SIZEOF_CFGDESC + USB_SIZEOF_IFDESC + USBMSC_NENDPOINTS * USB_SIZEOF_EPDESC)
+
#else
/* Number of individual descriptors in the configuration descriptor:
@@ -380,7 +381,9 @@
/* The size of the config descriptor: (9 + 2*7) = 23 */
-# define SIZEOF_USBMSC_CFGDESC (USB_SIZEOF_IFDESC + 2*USB_SIZEOF_EPDESC)
+# define SIZEOF_USBMSC_CFGDESC \
+ (USB_SIZEOF_IFDESC + USBMSC_NENDPOINTS * USB_SIZEOF_EPDESC)
+
#endif
/* Block driver helpers *****************************************************/
diff --git a/nuttx/drivers/usbdev/usbmsc_descriptors.c b/nuttx/drivers/usbdev/usbmsc_descriptors.c
index 30a48f1bf..5d8efd448 100644
--- a/nuttx/drivers/usbdev/usbmsc_descriptors.c
+++ b/nuttx/drivers/usbdev/usbmsc_descriptors.c
@@ -109,7 +109,10 @@ static const struct usb_cfgdesc_s g_cfgdesc =
{
USB_SIZEOF_CFGDESC, /* len */
USB_DESC_TYPE_CONFIG, /* type */
- {0, 0}, /* totallen -- to be provided */
+ { /* totallen */
+ LSBYTE(SIZEOF_USBMSC_CFGDESC),
+ MSBYTE(SIZEOF_USBMSC_CFGDESC)
+ },
USBMSC_NINTERFACES, /* ninterfaces */
USBMSC_CONFIGID, /* cfgvalue */
USBMSC_CONFIGSTRID, /* icfg */
@@ -353,30 +356,19 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type)
int16_t usbmsc_mkcfgdesc(uint8_t *buf)
#endif
{
-#ifndef CONFIG_USBMSC_COMPOSITE
- FAR struct usb_cfgdesc_s *cfgdesc = (struct usb_cfgdesc_s*)buf;
-#endif
#ifdef CONFIG_USBDEV_DUALSPEED
FAR const struct usb_epdesc_s *epdesc;
bool hispeed = (speed == USB_SPEED_HIGH);
uint16_t bulkmxpacket;
#endif
- uint16_t totallen;
-
- /* This is the total length of the configuration (not necessarily the
- * size that we will be sending now.
- */
- totallen = USB_SIZEOF_CFGDESC + USB_SIZEOF_IFDESC + USBMSC_NENDPOINTS * USB_SIZEOF_EPDESC;
-
- /* Configuration descriptor -- Copy the canned descriptor and fill in the
- * type (we'll also need to update the size below). If the USB mass storage
- * device is configured as part of a composite device, then the configuration
+ /* Configuration descriptor. If the USB mass storage device is
+ * configured as part of a composite device, then the configuration
* descriptor will be provided by the composite device logic.
*/
#ifndef CONFIG_USBMSC_COMPOSITE
- memcpy(cfgdesc, &g_cfgdesc, USB_SIZEOF_CFGDESC);
+ memcpy(buf, &g_cfgdesc, USB_SIZEOF_CFGDESC);
buf += USB_SIZEOF_CFGDESC;
#endif
@@ -409,13 +401,7 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf)
memcpy(buf, &g_fsepbulkindesc, USB_SIZEOF_EPDESC);
#endif
- /* Finally, fill in the total size of the configuration descriptor */
-
-#ifndef CONFIG_USBMSC_COMPOSITE
- cfgdesc->totallen[0] = LSBYTE(totallen);
- cfgdesc->totallen[1] = MSBYTE(totallen);
-#endif
- return totallen;
+ return SIZEOF_USBMSC_CFGDESC;
}
/****************************************************************************
diff --git a/nuttx/include/nuttx/usb/usb.h b/nuttx/include/nuttx/usb/usb.h
index 2c20c69fc..446acb4b2 100644
--- a/nuttx/include/nuttx/usb/usb.h
+++ b/nuttx/include/nuttx/usb/usb.h
@@ -198,6 +198,7 @@
#define USB_CLASS_CONTENT_SEC (0x0d)
#define USB_CLASS_VIDEO (0x0e)
#define USB_CLASS_WIRELESS_CONTROLLER (0xe0)
+#define USB_CLASS_MISC (0xef)
#define USB_CLASS_APP_SPEC (0xfe)
#define USB_CLASS_VENDOR_SPEC (0xff)
@@ -377,6 +378,29 @@ struct usb_qualdesc_s
};
#define USB_SIZEOF_QUALDESC 10
+/* 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.
+ */
+
+struct usb_iaddesc_s
+{
+ uint8_t len; /* Descriptor length */
+ uint8_t type; /* Descriptor type */
+ uint8_t firstif; /* Number of first interface of the function */
+ uint8_t nifs; /* Number of interfaces associated with the function */
+ uint8_t class; /* Class code*/
+ uint8_t subclass; /* Sub-class code */
+ uint8_t protocol; /* Protocol code */
+ uint8_t ifunction; /* Index to string identifying the function */
+};
+#define USB_SIZEOF_IADDESC 8
+
/************************************************************************************
* Public Data
************************************************************************************/