From b1356e969d15def8e2e896aa5ccc45db2fa333e9 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 9 Dec 2021 00:06:09 +0100 Subject: [PATCH] include: usb: add iterable section in ram for usb_cfg_data Add iterable section in ram for struct usb_cfg_data and new makro USBD_DEFINE_CFG_DATA which should be used to define usb_cfg_date structures. Deprecate makro USBD_CFG_DATA_DEFINE. Signed-off-by: Johann Fischer --- doc/releases/release-notes-3.0.rst | 5 +++++ include/linker/common-ram.ld | 1 + include/usb/usb_device.h | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/releases/release-notes-3.0.rst b/doc/releases/release-notes-3.0.rst index ceabe484e65..f26c215c437 100644 --- a/doc/releases/release-notes-3.0.rst +++ b/doc/releases/release-notes-3.0.rst @@ -75,6 +75,11 @@ Removed APIs in this release: is changed so that it more closely mimics the real UART controller, option is no longer necessary. +Deprecated in this release: + +* :c:macro:`USBD_CFG_DATA_DEFINE` is deprecated in favor of utilizing + :c:macro:`USBD_DEFINE_CFG_DATA` + Stable API changes in this release ================================== diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index 089db54aea9..684fd412792 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -129,6 +129,7 @@ KEEP(*(SORT_BY_NAME(".usb.data*"))) __usb_data_end = .; } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + ITERABLE_SECTION_RAM(usb_cfg_data, 4) #endif /* CONFIG_USB_DEVICE_STACK */ #if defined(CONFIG_USB_DEVICE_BOS) diff --git a/include/usb/usb_device.h b/include/usb/usb_device.h index 2ee06fc3393..210654f4afc 100644 --- a/include/usb/usb_device.h +++ b/include/usb/usb_device.h @@ -67,8 +67,11 @@ extern "C" { * This macro should be used to place the struct usb_cfg_data * inside usb data section in the RAM. */ -#define USBD_CFG_DATA_DEFINE(p, name) \ - static __in_section(usb, data_##p, name) __used __aligned(4) +#define USBD_DEFINE_CFG_DATA(name) \ + static STRUCT_SECTION_ITERABLE(usb_cfg_data, name) + +#define USBD_CFG_DATA_DEFINE(p, name) __DEPRECATED_MACRO \ + static __in_section(_usb_cfg_data, static, p##_name) __used __aligned(4) /************************************************************************* * USB configuration