mirror of https://github.com/FOME-Tech/openblt.git
Refs #1655, #1797. Added support for automatic WinUSB driver install and used unique ID for the USB serial number, where available.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@1078 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
c280af5b89
commit
afd5cb10d7
|
@ -1,73 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{"fItems":[{"fIsFromMainTab":true,"fPath":"Debug/openblt_stm32l552.elf","fProjectName":"Boot","fPerformBuild":true,"fDownload":true,"fLoadSymbols":true}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_div" value="8"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="C:\Work\software\OpenBLT_STM32L5\Target\Demo\ARMCM33_STM32L5_Nucleo_L552ZE_CubeIDE\Boot\Debug\st-link_gdbserver_log.txt"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Reset","fResetStrategies":[{"fDisplayName":"Reset","fLaunchAttribute":"monitor reset","fGdbCommands":["monitor reset"],"fCmdOptions":[]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":[]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]}}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.swv.swv_wait_for_sync" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/openblt_stm32l552.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Boot"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1328000127"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Boot"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"> <gdbmemoryBlockExpression address="134479864" label="0x0803fff8"/> </memoryBlockExpressionList> "/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{"fItems":[{"fIsFromMainTab":true,"fPath":"Debug/openblt_stm32l552.elf","fProjectName":"Boot","fPerformBuild":true,"fDownload":true,"fLoadSymbols":true}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_div" value="8"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="C:\Work\software\OpenBLT_STM32L5\Target\Demo\ARMCM33_STM32L5_Nucleo_L552ZE_CubeIDE\Boot\Debug\st-link_gdbserver_log.txt"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fVersion":1,"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]},"fStartApplication":true}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.swv.swv_wait_for_sync" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/openblt_stm32l552.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Boot"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1328000127"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Boot"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><memoryBlockExpressionList context="reserved-for-future-use"><gdbmemoryBlockExpression address="134479864" label="0x0803fff8"/></memoryBlockExpressionList>"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : App/usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : This file implements the USB device descriptors.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,9 +69,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -109,7 +113,7 @@ static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
|||
*/
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @brief Private functions declaration for FS.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -120,6 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -139,6 +146,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -149,7 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -159,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -168,6 +183,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -182,7 +228,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
|
||||
/** USB lang indentifier descriptor. */
|
||||
/** USB lang identifier descriptor. */
|
||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
||||
{
|
||||
USB_LEN_LANGID_STR_DESC,
|
||||
|
@ -287,7 +333,7 @@ uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
* ID */
|
||||
Get_SerialNum();
|
||||
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
|
||||
|
||||
|
||||
/* USER CODE END USBD_FS_SerialStrDescriptor */
|
||||
return (uint8_t *) USBD_StringSerial;
|
||||
}
|
||||
|
@ -330,9 +376,24 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : Header for usbd_conf.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -18,10 +18,9 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -51,7 +50,7 @@
|
|||
#define DEVICE_ID2 (UID_BASE + 0x4)
|
||||
#define DEVICE_ID3 (UID_BASE + 0x8)
|
||||
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
|
||||
/* USER CODE BEGIN EXPORTED_CONSTANTS */
|
||||
|
||||
|
@ -141,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -53,9 +52,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
/* USER CODE END PV */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -74,9 +70,13 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -94,21 +94,30 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc (void *)USBD_static_malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free USBD_static_free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
||||
/* DEBUG macros */
|
||||
|
||||
#if (USBD_DEBUG_LEVEL > 0)
|
||||
|
@ -154,8 +163,6 @@
|
|||
*/
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void *USBD_static_malloc(uint32_t size);
|
||||
void USBD_static_free(void *p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -53,9 +52,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
/* USER CODE END PV */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -74,9 +70,13 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -94,21 +94,30 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc (void *)USBD_static_malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free USBD_static_free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
||||
/* DEBUG macros */
|
||||
|
||||
#if (USBD_DEBUG_LEVEL > 0)
|
||||
|
@ -154,8 +163,6 @@
|
|||
*/
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void *USBD_static_malloc(uint32_t size);
|
||||
void USBD_static_free(void *p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : App/usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : This file implements the USB device descriptors.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,9 +69,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -109,7 +113,7 @@ static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
|||
*/
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @brief Private functions declaration for FS.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -120,6 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -139,6 +146,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -149,7 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -159,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -168,6 +183,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -182,7 +228,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
|
||||
/** USB lang indentifier descriptor. */
|
||||
/** USB lang identifier descriptor. */
|
||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
||||
{
|
||||
USB_LEN_LANGID_STR_DESC,
|
||||
|
@ -287,7 +333,7 @@ uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
* ID */
|
||||
Get_SerialNum();
|
||||
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
|
||||
|
||||
|
||||
/* USER CODE END USBD_FS_SerialStrDescriptor */
|
||||
return (uint8_t *) USBD_StringSerial;
|
||||
}
|
||||
|
@ -330,9 +376,24 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : Header for usbd_conf.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -18,10 +18,9 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -51,7 +50,7 @@
|
|||
#define DEVICE_ID2 (UID_BASE + 0x4)
|
||||
#define DEVICE_ID3 (UID_BASE + 0x8)
|
||||
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
|
||||
/* USER CODE BEGIN EXPORTED_CONSTANTS */
|
||||
|
||||
|
@ -141,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -53,9 +52,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
/* USER CODE END PV */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -74,9 +70,13 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -94,21 +94,30 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc (void *)USBD_static_malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free USBD_static_free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
||||
/* DEBUG macros */
|
||||
|
||||
#if (USBD_DEBUG_LEVEL > 0)
|
||||
|
@ -154,8 +163,6 @@
|
|||
*/
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void *USBD_static_malloc(uint32_t size);
|
||||
void USBD_static_free(void *p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : App/usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : This file implements the USB device descriptors.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,9 +69,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -109,7 +113,7 @@ static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
|||
*/
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @brief Private functions declaration for FS.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -120,6 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -139,6 +146,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -149,7 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -159,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -168,6 +183,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -182,7 +228,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
|
||||
/** USB lang indentifier descriptor. */
|
||||
/** USB lang identifier descriptor. */
|
||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
||||
{
|
||||
USB_LEN_LANGID_STR_DESC,
|
||||
|
@ -287,7 +333,7 @@ uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
* ID */
|
||||
Get_SerialNum();
|
||||
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
|
||||
|
||||
|
||||
/* USER CODE END USBD_FS_SerialStrDescriptor */
|
||||
return (uint8_t *) USBD_StringSerial;
|
||||
}
|
||||
|
@ -330,9 +376,24 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : Header for usbd_conf.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -18,10 +18,9 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -51,7 +50,7 @@
|
|||
#define DEVICE_ID2 (UID_BASE + 0x4)
|
||||
#define DEVICE_ID3 (UID_BASE + 0x8)
|
||||
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
|
||||
/* USER CODE BEGIN EXPORTED_CONSTANTS */
|
||||
|
||||
|
@ -141,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -53,9 +52,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
/* USER CODE END PV */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -74,9 +70,13 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -94,21 +94,30 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc (void *)USBD_static_malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free USBD_static_free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
||||
/* DEBUG macros */
|
||||
|
||||
#if (USBD_DEBUG_LEVEL > 0)
|
||||
|
@ -154,8 +163,6 @@
|
|||
*/
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
void *USBD_static_malloc(uint32_t size);
|
||||
void USBD_static_free(void *p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : App/usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : This file implements the USB device descriptors.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,9 +69,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -109,7 +113,7 @@ static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
|||
*/
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @brief Private functions declaration for FS.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -120,6 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -139,6 +146,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -149,7 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -159,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -168,6 +183,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -182,7 +228,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
|
||||
/** USB lang indentifier descriptor. */
|
||||
/** USB lang identifier descriptor. */
|
||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
||||
{
|
||||
USB_LEN_LANGID_STR_DESC,
|
||||
|
@ -287,7 +333,7 @@ uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
* ID */
|
||||
Get_SerialNum();
|
||||
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
|
||||
|
||||
|
||||
/* USER CODE END USBD_FS_SerialStrDescriptor */
|
||||
return (uint8_t *) USBD_StringSerial;
|
||||
}
|
||||
|
@ -330,9 +376,24 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file : usbd_desc.c
|
||||
* @version : v3.0_Cube
|
||||
* @version : v2.0_Cube
|
||||
* @brief : Header for usbd_conf.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -18,10 +18,9 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -51,7 +50,7 @@
|
|||
#define DEVICE_ID2 (UID_BASE + 0x4)
|
||||
#define DEVICE_ID3 (UID_BASE + 0x8)
|
||||
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
||||
|
||||
/* USER CODE BEGIN EXPORTED_CONSTANTS */
|
||||
|
||||
|
@ -141,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,10 +69,11 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x0C
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
|
@ -122,9 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -144,7 +146,7 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
@ -157,13 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
0x01, /*bcdUSB */ /* changed to USB version 2.01
|
||||
in order to support LPM L1 suspend
|
||||
resume test of USBCV3.0*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -173,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -183,27 +184,36 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x5,
|
||||
USB_DESC_TYPE_BOS,
|
||||
0xC,
|
||||
0x0,
|
||||
0x1, /* 1 device capability*/
|
||||
/* device capability*/
|
||||
0x7,
|
||||
USB_DEVICE_CAPABITY_TYPE,
|
||||
0x2,
|
||||
0x2, /* LPM capability bit set*/
|
||||
0x0,
|
||||
0x0,
|
||||
0x0
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -366,7 +376,7 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
|
@ -379,11 +389,11 @@ uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -140,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,14 +70,21 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
#define DEVICE_FS 0
|
||||
|
||||
/* Inform USB core that a full speed device is used. */
|
||||
#define USE_USB_FS
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -88,19 +94,26 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,14 +70,21 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
#define DEVICE_FS 0
|
||||
|
||||
/* Inform USB core that a full speed device is used. */
|
||||
#define USE_USB_FS
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -88,19 +94,26 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,10 +69,11 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x0C
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
|
@ -122,9 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -144,7 +146,7 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
@ -157,13 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
0x01, /*bcdUSB */ /* changed to USB version 2.01
|
||||
in order to support LPM L1 suspend
|
||||
resume test of USBCV3.0*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -173,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -183,27 +184,36 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x5,
|
||||
USB_DESC_TYPE_BOS,
|
||||
0xC,
|
||||
0x0,
|
||||
0x1, /* 1 device capability*/
|
||||
/* device capability*/
|
||||
0x7,
|
||||
USB_DEVICE_CAPABITY_TYPE,
|
||||
0x2,
|
||||
0x2, /* LPM capability bit set*/
|
||||
0x0,
|
||||
0x0,
|
||||
0x0
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -366,7 +376,7 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
|
@ -379,11 +389,11 @@ uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -140,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,14 +70,21 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
#define DEVICE_FS 0
|
||||
|
||||
/* Inform USB core that a full speed device is used. */
|
||||
#define USE_USB_FS
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -88,19 +94,26 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,10 +69,11 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x0C
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
|
@ -122,9 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -144,7 +146,7 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
@ -157,13 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
0x01, /*bcdUSB */ /* changed to USB version 2.01
|
||||
in order to support LPM L1 suspend
|
||||
resume test of USBCV3.0*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -173,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -183,27 +184,36 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x5,
|
||||
USB_DESC_TYPE_BOS,
|
||||
0xC,
|
||||
0x0,
|
||||
0x1, /* 1 device capability*/
|
||||
/* device capability*/
|
||||
0x7,
|
||||
USB_DEVICE_CAPABITY_TYPE,
|
||||
0x2,
|
||||
0x2, /* LPM capability bit set*/
|
||||
0x0,
|
||||
0x0,
|
||||
0x0
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -366,7 +376,7 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
|
@ -379,11 +389,11 @@ uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -140,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,8 +101,8 @@ __ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER
|
|||
{
|
||||
USB_LEN_DEV_QUALIFIER_DESC,
|
||||
USB_DESC_TYPE_DEVICE_QUALIFIER,
|
||||
0x00,
|
||||
0x02,
|
||||
0x10,
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* USER CODE END INCLUDE */
|
||||
|
||||
/** @addtogroup USBD_OTG_DRIVER
|
||||
* @brief Driver for Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -71,14 +70,21 @@
|
|||
/*---------- -----------*/
|
||||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_LPM_ENABLED 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
#define DEVICE_FS 0
|
||||
|
||||
/* Inform USB core that a full speed device is used. */
|
||||
#define USE_USB_FS
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -88,19 +94,26 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
#define USBD_malloc malloc
|
||||
#define USBD_malloc /* Not used */
|
||||
|
||||
/** Alias for memory release. */
|
||||
#define USBD_free free
|
||||
#define USBD_free /* Not used */
|
||||
|
||||
/** Alias for memory set. */
|
||||
#define USBD_memset memset
|
||||
#define USBD_memset /* Not used */
|
||||
|
||||
/** Alias for memory copy. */
|
||||
#define USBD_memcpy memcpy
|
||||
#define USBD_memcpy /* Not used */
|
||||
|
||||
/** Alias for delay. */
|
||||
#define USBD_Delay HAL_Delay
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -68,10 +69,11 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x0C
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
|
@ -122,9 +124,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -144,7 +146,7 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
@ -157,13 +159,12 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
0x01, /*bcdUSB */ /* changed to USB version 2.01
|
||||
in order to support LPM L1 suspend
|
||||
resume test of USBCV3.0*/
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
|
@ -173,8 +174,8 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x02,
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||
|
@ -183,27 +184,36 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x5,
|
||||
USB_DESC_TYPE_BOS,
|
||||
0xC,
|
||||
0x0,
|
||||
0x1, /* 1 device capability*/
|
||||
/* device capability*/
|
||||
0x7,
|
||||
USB_DEVICE_CAPABITY_TYPE,
|
||||
0x2,
|
||||
0x2, /* LPM capability bit set*/
|
||||
0x0,
|
||||
0x0,
|
||||
0x0
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -366,7 +376,7 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_LPM_ENABLED == 1)
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
|
@ -379,11 +389,11 @@ uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
#ifndef __USBD_DESC__H__
|
||||
#define __USBD_DESC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -140,6 +140,6 @@ extern USBD_DescriptorsTypeDef FS_Desc;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBD_DESC__C__ */
|
||||
#endif /* __USBD_DESC__H__ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{"fItems":[{"fIsFromMainTab":true,"fPath":"Debug/openblt_olimex_stm32h103.elf","fProjectName":"Boot","fPerformBuild":true,"fDownload":true,"fLoadSymbols":true}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_div" value="8"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="C:\Work\software\OpenBLT\Target\Demo\ARMCM3_STM32F1_Olimex_STM32H103_CubeIDE\Boot\Debug\st-link_gdbserver_log.txt"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Reset","fResetStrategies":[{"fDisplayName":"Reset","fLaunchAttribute":"monitor reset","fGdbCommands":["monitor reset"],"fCmdOptions":[]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":[]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]}}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.swv.swv_wait_for_sync" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/openblt_olimex_stm32h103.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Boot"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1718631919"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Boot"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{"fItems":[{"fIsFromMainTab":true,"fPath":"Debug/openblt_olimex_stm32h103.elf","fProjectName":"Boot","fPerformBuild":true,"fDownload":true,"fLoadSymbols":true}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_div" value="8"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="C:\Work\software\OpenBLT\Target\Demo\ARMCM3_STM32F1_Olimex_STM32H103_CubeIDE\Boot\Debug\st-link_gdbserver_log.txt"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fVersion":1,"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]},"fStartApplication":true}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.swv.swv_wait_for_sync" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/openblt_olimex_stm32h103.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Boot"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1718631919"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/Boot"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><memoryBlockExpressionList context="reserved-for-future-use"/>"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -310,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -310,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -310,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -310,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -310,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -96,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -123,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -149,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -168,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -178,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -188,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -197,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -359,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,9 +31,8 @@
|
|||
#include "usbd_bulk.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_ctlreq.h"
|
||||
#include "boot.h"
|
||||
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
|
||||
/** @addtogroup STM32_USB_DEVICE_LIBRARY
|
||||
* @{
|
||||
*/
|
||||
|
@ -193,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -270,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
@ -397,6 +471,5 @@ uint8_t * USBD_Bulk_GetRxBufferPtr(void)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define USB_BULK_CONFIG_DESC_SIZ 32
|
||||
#define USB_BULK_DESC_SIZ (32-9)
|
||||
|
||||
#define USB_BULK_MS_VENDORCODE 0x01 /* bMS_VendorCode */
|
||||
|
||||
#define BULK_DESCRIPTOR_TYPE 0x21
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|||
/* USER CODE END 1 */
|
||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
else
|
||||
#else
|
||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
|
||||
|
@ -195,13 +195,10 @@ static void PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
|
|||
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
{
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
/* Invoke hook function to allow the application to prepare entry into low power
|
||||
* mode.
|
||||
*/
|
||||
UsbEnterLowPowerModeHook();
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
|
||||
/* Inform USB library that core enters in suspend Mode. */
|
||||
USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData);
|
||||
/* Enter in STOP mode. */
|
||||
|
@ -230,12 +227,10 @@ void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
|
|||
|
||||
/* USER CODE END 3 */
|
||||
USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData);
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
/* Invoke hook function to allow the application to process exit from low power
|
||||
* mode.
|
||||
*/
|
||||
UsbLeaveLowPowerModeHook();
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -315,7 +310,6 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|||
hpcd_USB_FS.Instance = USB;
|
||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
||||
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
|
||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
||||
|
@ -608,17 +602,13 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
|
|||
/* USER CODE BEGIN 6 */
|
||||
if (state == 1)
|
||||
{
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
/* Configure Low connection state. */
|
||||
UsbConnectHook(BLT_TRUE);
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
/* Configure High connection state. */
|
||||
UsbConnectHook(BLT_FALSE);
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
}
|
||||
/* USER CODE END 6 */
|
||||
}
|
||||
|
@ -653,5 +643,4 @@ USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status)
|
|||
return usb_status;
|
||||
}
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <string.h>
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "usbd_def.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
|
@ -100,6 +99,12 @@
|
|||
#define USBD_DEBUG_LEVEL 0U
|
||||
/*---------- -----------*/
|
||||
#define USBD_SELF_POWERED 1U
|
||||
/*---------- -----------*/
|
||||
/* Enable/disable the loading of the WinUSB GUID through MS OS 2.0 descriptors. This
|
||||
* makes it possible to automatically install WinUSB devices without having to provide
|
||||
* a device specific INF file.
|
||||
*/
|
||||
#define USBD_WINUSB_ENABLED 1U
|
||||
|
||||
/****************************************/
|
||||
/* #define for FS and HS identification */
|
||||
|
@ -114,6 +119,13 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* Reading out the MS OS 2.0 descriptors, requires support for BOS descriptors. This
|
||||
* is currently enabled in the ST USB stack by enabled the USBD_LPM_ENABLED feature.
|
||||
*/
|
||||
#define USBD_LPM_ENABLED 1U
|
||||
#endif
|
||||
|
||||
/* Memory management macros */
|
||||
|
||||
/** Alias for memory allocation. */
|
||||
|
|
|
@ -51,9 +51,8 @@
|
|||
#include "usbd_core.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
#include "boot.h"
|
||||
#include "usbd_bulk.h"
|
||||
|
||||
#if (BOOT_COM_USB_ENABLE > 0)
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
/* USER CODE END INCLUDE */
|
||||
|
@ -98,9 +97,12 @@
|
|||
#define USBD_MANUFACTURER_STRING "OpenBLT User"
|
||||
#define USBD_PID_FS 0x60ac
|
||||
#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device"
|
||||
#define USBD_SERIALNUMBER_STRING_FS "00000000050C"
|
||||
#define USBD_CONFIGURATION_STRING_FS "Default"
|
||||
#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface"
|
||||
|
||||
#define USB_SIZ_BOS_DESC 0x21
|
||||
|
||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
||||
|
||||
/* USER CODE END PRIVATE_DEFINES */
|
||||
|
@ -125,7 +127,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
|
@ -151,6 +153,9 @@ uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length
|
|||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -170,6 +175,9 @@ USBD_DescriptorsTypeDef FS_Desc =
|
|||
, USBD_FS_SerialStrDescriptor
|
||||
, USBD_FS_ConfigStrDescriptor
|
||||
, USBD_FS_InterfaceStrDescriptor
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
, USBD_FS_USR_BOSDescriptor
|
||||
#endif /* (USBD_LPM_ENABLED == 1) */
|
||||
};
|
||||
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
|
@ -180,8 +188,13 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
{
|
||||
0x12, /*bLength */
|
||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||
0x10, /*bcdUSB */
|
||||
0x01,
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
0x01, /*bcdUSB changed to USB version 2.01 to enable BOS */
|
||||
/*descriptor for reading the MS OS 2.0 descriptors. */
|
||||
#else
|
||||
0x00, /*bcdUSB */
|
||||
#endif
|
||||
0x02,
|
||||
0x00, /*bDeviceClass*/
|
||||
0x00, /*bDeviceSubClass*/
|
||||
0x00, /*bDeviceProtocol*/
|
||||
|
@ -190,7 +203,7 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
HIBYTE(USBD_VID), /*idVendor*/
|
||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
||||
0x00, /*bcdDevice rel. 2.00*/
|
||||
0x00, /*bcdDevice rel. 1.00*/
|
||||
0x01,
|
||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||
|
@ -199,6 +212,37 @@ __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|||
};
|
||||
|
||||
/* USB_DeviceDescriptor */
|
||||
/** BOS descriptor. */
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif /* defined ( __ICCARM__ ) */
|
||||
__ALIGN_BEGIN uint8_t USBD_FS_BOSDesc[USB_SIZ_BOS_DESC] __ALIGN_END =
|
||||
{
|
||||
0x05, /* Descriptor size (5 bytes) */
|
||||
USB_DESC_TYPE_BOS, /* Descriptor type (BOS) */
|
||||
0x21, 0x00, /* Length of this + subordinate descriptors (33 bytes) */
|
||||
0x01, /* Number of subordinate descriptors */
|
||||
|
||||
/* Microsoft OS 2.0 Platform Capability Descriptor */
|
||||
0x1C, /* Descriptor size (28 bytes) */
|
||||
USB_DEVICE_CAPABITY_TYPE, /* Descriptor type (Device Capability) */
|
||||
0x05, /* Capability type (Platform) */
|
||||
0x00, /* Reserved */
|
||||
|
||||
/* MS OS 2.0 Platform Capability ID (D8DD60DF-4589-4CC7-9CD2-659D9E648A9F) */
|
||||
0xDF, 0x60, 0xDD, 0xD8,
|
||||
0x89, 0x45,
|
||||
0xC7, 0x4C,
|
||||
0x9C, 0xD2,
|
||||
0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
|
||||
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
USB_BULK_MS_VENDORCODE, /* Vendor-assigned bMS_VendorCode */
|
||||
0x00 /* Doesn’t support alternate enumeration */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -361,6 +405,21 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/**
|
||||
* @brief Return the BOS descriptor
|
||||
* @param speed : Current device speed
|
||||
* @param length : Pointer to data length variable
|
||||
* @retval Pointer to descriptor buffer
|
||||
*/
|
||||
uint8_t * USBD_FS_USR_BOSDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
||||
{
|
||||
UNUSED(speed);
|
||||
*length = sizeof(USBD_FS_BOSDesc);
|
||||
return (uint8_t*)USBD_FS_BOSDesc;
|
||||
}
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
|
@ -421,6 +480,5 @@ static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* (BOOT_COM_USB_ENABLE > 0) */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -192,6 +192,62 @@ __ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END
|
|||
} ;
|
||||
|
||||
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
/* USB Bulk device Microsoft OS 2.0 Descriptor Set. */
|
||||
#define USB_LEN_MSOS20_DESC (0x9E)
|
||||
|
||||
__ALIGN_BEGIN uint8_t USBD_Bulk_MSOS20Desc[USB_LEN_MSOS20_DESC] __ALIGN_END =
|
||||
{
|
||||
0x0A, 0x00, /* Descriptor size (10 bytes) */
|
||||
0x00, 0x00, /* MS OS 2.0 descriptor set header */
|
||||
0x00, 0x00, 0x03, 0x06, /* Windows version (8.1) (0x06030000) */
|
||||
0x9E, 0x00, /* Size, MS OS 2.0 descriptor set (158 bytes) */
|
||||
|
||||
/* Microsoft OS 2.0 compatible ID descriptor */
|
||||
0x14, 0x00, /* Descriptor size (20 bytes) */
|
||||
0x03, 0x00, /* MS OS 2.0 compatible ID descriptor */
|
||||
0x57, 0x49, 0x4E, 0x55, 0x53, 0x42, 0x00, 0x00, /* WINUSB string */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Sub-compatible ID */
|
||||
|
||||
/* Registry property descriptor */
|
||||
0x80, 0x00, /* Descriptor size (130 bytes) */
|
||||
0x04, 0x00, /* Registry Property descriptor */
|
||||
0x01, 0x00, /* Strings are null-terminated Unicode */
|
||||
0x28, 0x00, /* Size of Property Name (40 bytes) */
|
||||
|
||||
/* Property Name ("DeviceInterfaceGUID") */
|
||||
0x44, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00,
|
||||
0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00,
|
||||
0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x47, 0x00, 0x55, 0x00, 0x49, 0x00,
|
||||
0x44, 0x00, 0x00, 0x00,
|
||||
|
||||
0x4E, 0x00, /* Size of Property Data (78 bytes) */
|
||||
|
||||
/* Vendor-defined Property Data: "{807999C3-E4E0-40EA-8188-48E852B54F2B}\0" */
|
||||
0x7B, 0x00, 0x38, 0x00, /* {8 */
|
||||
0x30, 0x00, 0x37, 0x00, /* 07 */
|
||||
0x39, 0x00, 0x39, 0x00, /* 99 */
|
||||
0x39, 0x00, 0x43, 0x00, /* 9C */
|
||||
0x33, 0x00, 0x2D, 0x00, /* 3- */
|
||||
0x45, 0x00, 0x34, 0x00, /* E4 */
|
||||
0x45, 0x00, 0x30, 0x00, /* E0 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x30, 0x00, 0x45, 0x00, /* 0E */
|
||||
0x41, 0x00, 0x2D, 0x00, /* A- */
|
||||
0x38, 0x00, 0x31, 0x00, /* 81 */
|
||||
0x38, 0x00, 0x38, 0x00, /* 88 */
|
||||
0x2D, 0x00, 0x34, 0x00, /* -4 */
|
||||
0x38, 0x00, 0x45, 0x00, /* 8E */
|
||||
0x38, 0x00, 0x35, 0x00, /* 85 */
|
||||
0x32, 0x00, 0x42, 0x00, /* 2B */
|
||||
0x35, 0x00, 0x34, 0x00, /* 54 */
|
||||
0x46, 0x00, 0x32, 0x00, /* F2 */
|
||||
0x42, 0x00, 0x7D, 0x00, /* B} */
|
||||
0x00, 0x00 /* \0 */
|
||||
};
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -269,6 +325,25 @@ static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev,
|
|||
|
||||
switch (req->bmRequest & USB_REQ_TYPE_MASK)
|
||||
{
|
||||
#if (USBD_WINUSB_ENABLED == 1)
|
||||
case USB_REQ_TYPE_VENDOR:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
case USB_BULK_MS_VENDORCODE: /* bMS_VendorCode */
|
||||
if (req->wIndex == 7) /*This is defined by the MS spec (Table 6)*/
|
||||
{
|
||||
pbuf = USBD_Bulk_MSOS20Desc;
|
||||
len = USB_LEN_MSOS20_DESC;
|
||||
USBD_CtlSendData(pdev, pbuf, len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif /* (USBD_WINUSB_ENABLED == 1) */
|
||||
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch (req->bRequest)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue