| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef __USBD_DESC__C__
- #define __USBD_DESC__C__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "usbd_conf.h"
- #include "usbd_def.h"
- /** Descriptor for the Usb device. */
- extern USBD_DescriptorsTypeDef USBD_COMMON_Desc;
- #if USBD_GETDESCRIPTORS_ALTMETHOD == 1
- extern const uint8_t * USBD_COMMON_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_GetCfgDesc (USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_GetMsOsStringDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_GetExtCompatIdOsFeatureDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- extern const uint8_t * USBD_COMMON_GetExtPropertiesOsFeatureDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
- // @USBD_GETDESCRIPTOR_DEFAULT_HANDLERS_SET
- // Allows to inherit the the handlers in the class-specific handlers set:
- // You should declare your own @USBD_DescriptorsTypeDef variable, and
- // the initialize the contents with your functions by filed names, but
- // insert this marco in the top:
- // const USBD_DescriptorsTypeDef CustomDescriptorHandlers = {
- // USBD_GETDESCRIPTOR_DEFAULT_HANDLERS_SET,
- // .GetDeviceDescriptor = MyCustomGetDeviceDescriptor
- // .GetInterfaceStrDescriptor = MyCustomGetInterfaceStrDescriptor,
- // };
- // In the example above only @GetDeviceDescriptor and @GetInterfaceStrDescriptor
- // are implemeted in the class and overrided in the structure, all others
- // handlers are initialized by the default handler-functions.
- //
- // INTERNATIONAL STANDARD ISO/IEC 9899, Programming languages — C, Second edition 1999-12-01
- // 6.7.8 Initialization, section 19:
- // The initialization shall occur in initializer list order, each initializer provided for a
- // particular subobject overriding any previously listed initializer for the same subobject; all
- // subobjects that are not initialized explicitly shall be initialized implicitly the same as
- // objects that have static storage duration.
- #define USBD_GETDESCRIPTOR_DEFAULT_HANDLERS_SET \
- .GetDeviceDescriptor = USBD_COMMON_DeviceDescriptor\
- , .GetLangIDStrDescriptor = USBD_COMMON_LangIDStrDescriptor\
- , .GetManufacturerStrDescriptor = USBD_COMMON_ManufacturerStrDescriptor\
- , .GetProductStrDescriptor = USBD_COMMON_ProductStrDescriptor\
- , .GetSerialStrDescriptor = USBD_COMMON_SerialStrDescriptor\
- , .GetConfigurationStrDescriptor = USBD_COMMON_ConfigStrDescriptor\
- , .GetInterfaceStrDescriptor = USBD_COMMON_InterfaceStrDescriptor\
- , .GetConfigDescriptor = USBD_COMMON_GetCfgDesc\
- , .GetMsOsStringDescriptor = USBD_COMMON_GetMsOsStringDescriptor\
- , .GetExtCompatIdOsFeatureDescriptor = USBD_COMMON_GetExtCompatIdOsFeatureDescriptor\
- USBD_GETUSERSTR_INITIALIZER
- #if USBD_SUPPORT_USER_STRING
- #define USBD_GETUSERSTR_INITIALIZER ,.GetUsrStrDescriptor = NULL
- #else
- #define USBD_GETUSERSTR_INITIALIZER
- #endif
- #endif // USBD_GETDESCRIPTORS_ALTMETHOD
- #ifdef __cplusplus
- }
- #endif
- #endif /* __USBD_DESC__C__ */
|