include: usb: add descriptor and data section macros

This patch adds USB descriptor and data section macros.

Use USBD_DESCR_..._DEFINE macros to place the parts of USB device
descriptor in predetermined order in the USB descriptor
section. The parts of a device descriptor are also
sorted according to the macro argument. All parts of a
particular device descriptor must use the same argument.

Use USBD_CFG_DATA_DEFINE macro to place the data struct
of a class driver or function in the USB data section.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
Johann Fischer 2017-10-30 17:39:03 +01:00 committed by Carles Cufí
commit cf14a60f5a

View file

@ -43,6 +43,30 @@
extern "C" {
#endif
/*
* These macros should be used to place the USB descriptors
* in predetermined order in the RAM.
*/
#define USBD_DEVICE_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 0) __used
#define USBD_CLASS_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 1) __used
#define USBD_MISC_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 2) __used
#define USBD_USER_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 3) __used
#define USBD_STRING_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 4) __used
#define USBD_TERM_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 5) __used
/*
* This macro should be used to place the struct usb_cfg_data
* inside usb data section in the RAM.
*/
#define USBD_CFG_DATA_DEFINE(name) \
static __in_section(usb, data, name) __used
/*************************************************************************
* USB configuration
**************************************************************************/