mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-28 05:37:15 +00:00
adding usbd_enum_buffer to usbd
remove string descriptor USB RAM requirement
This commit is contained in:
parent
7ee4b550c2
commit
e28170db2f
@ -408,28 +408,24 @@ app_descriptor_configuration_t desc_configuration =
|
||||
#define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header
|
||||
#define ENDIAN_BE16_FROM( high, low) ENDIAN_BE16(high << 8 | low)
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM
|
||||
uint16_t desc_string_language[] =
|
||||
{
|
||||
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(1), TUSB_DESC_TYPE_STRING ),
|
||||
0x0409
|
||||
};
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM
|
||||
uint16_t desc_string_manufacturer[] =
|
||||
{
|
||||
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(11), TUSB_DESC_TYPE_STRING),
|
||||
't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' // len = 11
|
||||
};
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM
|
||||
uint16_t desc_string_product[] =
|
||||
{
|
||||
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(14), TUSB_DESC_TYPE_STRING),
|
||||
't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'D', 'e', 'v', 'i', 'c', 'e' // len = 14
|
||||
};
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM
|
||||
uint16_t desc_string_serial[] =
|
||||
{
|
||||
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(4), TUSB_DESC_TYPE_STRING),
|
||||
|
@ -554,8 +554,11 @@
|
||||
<storageModule moduleId="com.crt.config">
|
||||
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
||||
<TargetConfig>
|
||||
<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="1"/>
|
||||
<infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name>
|
||||
<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="60100"/>
|
||||
<infoList vendor="NXP">
|
||||
<info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp">
|
||||
<chip>
|
||||
<name>LPC4357</name>
|
||||
<family>LPC43xx</family>
|
||||
<vendor>NXP (formerly Philips)</vendor>
|
||||
<reset board="None" core="Real" sys="Real"/>
|
||||
@ -630,7 +633,8 @@
|
||||
<peripheralInstance derived_from="SPI" determined="infoFile" id="SPI" location="0x40100000"/>
|
||||
<peripheralInstance derived_from="SGPIO" determined="infoFile" id="SGPIO" location="0x40101000"/>
|
||||
</chip>
|
||||
<processor><name gcc_name="cortex-m4">Cortex-M4</name>
|
||||
<processor>
|
||||
<name gcc_name="cortex-m4">Cortex-M4</name>
|
||||
<family>Cortex-M</family>
|
||||
</processor>
|
||||
<link href="nxp_lpc43xx_peripheral.xme" show="embed" type="simple"/>
|
||||
|
@ -52,6 +52,7 @@
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
|
||||
TUSB_CFG_ATTR_USBRAM uint8_t usbd_enum_buffer[TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE];
|
||||
|
||||
static usbd_class_driver_t const usbd_class_drivers[] =
|
||||
{
|
||||
@ -346,9 +347,12 @@ static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const
|
||||
}
|
||||
else if ( TUSB_DESC_TYPE_STRING == desc_type )
|
||||
{
|
||||
if ( !(desc_index < TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT && tusbd_descriptor_pointers.p_string_arr[desc_index] != NULL) ) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
|
||||
if ( !(desc_index < TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT) ) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
|
||||
uint8_t const * const p_desc_string = tusbd_descriptor_pointers.p_string_arr[desc_index];
|
||||
ASSERT( p_desc_string != NULL && p_desc_string[0] <= TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE, TUSB_ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
(*pp_buffer) = tusbd_descriptor_pointers.p_string_arr[desc_index];
|
||||
memcpy(usbd_enum_buffer, p_desc_string, p_desc_string[0]); // first byte of descriptor is its size
|
||||
(*pp_buffer) = usbd_enum_buffer;
|
||||
(*p_length) = **pp_buffer;
|
||||
}else
|
||||
{
|
||||
|
@ -163,11 +163,15 @@
|
||||
//--------------------------------------------------------------------+
|
||||
#if MODE_DEVICE_SUPPORTED
|
||||
|
||||
#define DEVICE_CLASS_HID ( TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
#define DEVICE_CLASS_HID ( TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
|
||||
#if TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE > 64
|
||||
#if TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE > 64
|
||||
#error Control Endpoint Max Package Size cannot larger than 64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE
|
||||
#define TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
#endif // MODE_DEVICE_SUPPORTED
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user