usb: Add instance parameter to descriptors definitions

This allows to place instances of the class one after another in the
linker section.

Fixes #12908

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2019-01-31 17:23:32 +02:00 committed by Anas Nashif
commit bf9c6d72e8
11 changed files with 14 additions and 13 deletions

View file

@ -50,8 +50,8 @@ extern "C" {
*/
#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_CLASS_DESCR_DEFINE(p, instance) \
static __in_section(usb, descriptor_##p.1, instance) __used
#define USBD_MISC_DESCR_DEFINE(p) \
static __in_section(usb, descriptor_##p, 2) __used
#define USBD_USER_DESCR_DEFINE(p) \

View file

@ -57,7 +57,8 @@ struct usb_bluetooth_config {
struct usb_ep_descriptor if0_in_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_bluetooth_config bluetooth_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0)
struct usb_bluetooth_config bluetooth_cfg = {
/* Interface descriptor 0 */
.if0 = {
.bLength = sizeof(struct usb_if_descriptor),

View file

@ -99,7 +99,7 @@ struct usb_cdc_acm_config {
struct usb_ep_descriptor if1_out_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_cdc_acm_config cdc_acm_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_cdc_acm_config cdc_acm_cfg = {
#ifdef CONFIG_USB_COMPOSITE_DEVICE
.iad_cdc = {
.bLength = sizeof(struct usb_association_descriptor),

View file

@ -35,7 +35,7 @@ struct usb_hid_config {
#endif
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_hid_config hid_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_hid_config hid_cfg = {
/* Interface descriptor */
.if0 = {
.bLength = sizeof(struct usb_if_descriptor),

View file

@ -36,7 +36,7 @@ struct usb_loopback_config {
struct usb_ep_descriptor if0_in_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_loopback_config loopback_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_loopback_config loopback_cfg = {
/* Interface descriptor 0 */
.if0 = {
.bLength = sizeof(struct usb_if_descriptor),

View file

@ -68,7 +68,7 @@ struct usb_mass_config {
struct usb_ep_descriptor if0_out_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_mass_config mass_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_mass_config mass_cfg = {
/* Interface descriptor */
.if0 = {
.bLength = sizeof(struct usb_if_descriptor),

View file

@ -53,7 +53,7 @@ struct usb_cdc_ecm_config {
struct usb_ep_descriptor if1_1_out_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_cdc_ecm_config cdc_ecm_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_cdc_ecm_config cdc_ecm_cfg = {
#ifdef CONFIG_USB_COMPOSITE_DEVICE
.iad = {
.bLength = sizeof(struct usb_association_descriptor),

View file

@ -27,7 +27,7 @@ struct usb_cdc_eem_config {
struct usb_ep_descriptor if0_out_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_cdc_eem_config cdc_eem_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_cdc_eem_config cdc_eem_cfg = {
/* Interface descriptor 0 */
/* CDC Communication interface */
.if0 = {

View file

@ -69,7 +69,7 @@ struct usb_rndis_config {
struct usb_ep_descriptor if1_out_ep;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_rndis_config rndis_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_rndis_config rndis_cfg = {
#ifdef CONFIG_USB_COMPOSITE_DEVICE
.iad = {
.bLength = sizeof(struct usb_association_descriptor),

View file

@ -78,7 +78,7 @@ struct usb_dfu_config {
struct dfu_runtime_descriptor dfu_descr;
} __packed;
USBD_CLASS_DESCR_DEFINE(primary) struct usb_dfu_config dfu_cfg = {
USBD_CLASS_DESCR_DEFINE(primary, 0) struct usb_dfu_config dfu_cfg = {
/* Interface descriptor */
.if0 = {
.bLength = sizeof(struct usb_if_descriptor),

View file

@ -64,7 +64,7 @@ struct usb_loopback_config {
#define DEFINE_LOOPBACK_DESC(x) \
USBD_CLASS_DESCR_DEFINE(primary) \
USBD_CLASS_DESCR_DEFINE(primary, x) \
struct usb_loopback_config loopback_cfg_##x = { \
.if0 = INITIALIZER_IF, \
.if0_out_ep = INITIALIZER_IF_EP(LOOPBACK_OUT_EP_ADDR, \
@ -88,7 +88,7 @@ struct usb_loopback_config {
}
#define DEFINE_LOOPBACK_CFG_DATA(x) \
USBD_CFG_DATA_DEFINE(loopback) \
USBD_CFG_DATA_DEFINE(loopback_##x) \
struct usb_cfg_data loopback_config_##x = { \
.usb_device_description = NULL, \
.interface_config = NULL, \