From 45be9d7759bba2349545a3599b9ffedde78a5149 Mon Sep 17 00:00:00 2001 From: jzlv Date: Tue, 22 Mar 2022 11:16:09 +0800 Subject: [PATCH] [feat][common] add no cache ram section macros --- common/list/drv_list.h | 18 +++++++++--------- common/misc/compiler/common.h | 32 +++++++++++++++++--------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/common/list/drv_list.h b/common/list/drv_list.h index 91c8d270..5c2beadb 100644 --- a/common/list/drv_list.h +++ b/common/list/drv_list.h @@ -156,6 +156,15 @@ static inline unsigned int dlist_len(const dlist_t *l) #define DLIST_DEFINE(list) \ dlist_t list = { &(list), &(list) } +/** + * @brief get the struct for this entry + * @param node the entry point + * @param type the type of structure + * @param member the name of list in structure + */ +#define dlist_entry(node, type, member) \ + container_of(node, type, member) + /** * dlist_first_entry - get the first element from a list * @ptr: the list head to take the element from. @@ -177,15 +186,6 @@ static inline unsigned int dlist_len(const dlist_t *l) #define dlist_first_entry_or_null(ptr, type, member) \ (dlist_isempty(ptr) ? NULL : dlist_first_entry(ptr, type, member)) -/** - * @brief get the struct for this entry - * @param node the entry point - * @param type the type of structure - * @param member the name of list in structure - */ -#define dlist_entry(node, type, member) \ - container_of(node, type, member) - /** * dlist_for_each - iterate over a list * @pos: the dlist_t * to use as a loop cursor. diff --git a/common/misc/compiler/common.h b/common/misc/compiler/common.h index 29489e3c..542aafa5 100644 --- a/common/misc/compiler/common.h +++ b/common/misc/compiler/common.h @@ -42,21 +42,23 @@ /* Std driver attribute macro*/ #ifndef BFLB_USE_CUSTOM_LD_SECTIONS //#define ATTR_UNI_SYMBOL -#define ATTR_STRINGIFY(x) #x -#define ATTR_TOSTRING(x) ATTR_STRINGIFY(x) -#define ATTR_UNI_SYMBOL __FILE__ ATTR_TOSTRING(__LINE__) -#define ATTR_CLOCK_SECTION __attribute__((section(".sclock_rlt_code." ATTR_UNI_SYMBOL))) -#define ATTR_CLOCK_CONST_SECTION __attribute__((section(".sclock_rlt_const." ATTR_UNI_SYMBOL))) -#define ATTR_TCM_SECTION __attribute__((section(".tcm_code." ATTR_UNI_SYMBOL))) -#define ATTR_TCM_CONST_SECTION __attribute__((section(".tcm_const." ATTR_UNI_SYMBOL))) -#define ATTR_DTCM_SECTION __attribute__((section(".tcm_data"))) -#define ATTR_HSRAM_SECTION __attribute__((section(".hsram_code"))) -#define ATTR_DMA_RAM_SECTION __attribute__((section(".system_ram"))) -#define ATTR_HBN_RAM_SECTION __attribute__((section(".hbn_ram_code"))) -#define ATTR_HBN_RAM_CONST_SECTION __attribute__((section(".hbn_ram_data"))) -#define ATTR_EALIGN(x) __attribute__((aligned(x))) -#define ATTR_FALLTHROUGH() __attribute__((fallthrough)) -#define ATTR_USED __attribute__((__used__)) +#define ATTR_STRINGIFY(x) #x +#define ATTR_TOSTRING(x) ATTR_STRINGIFY(x) +#define ATTR_UNI_SYMBOL __FILE__ ATTR_TOSTRING(__LINE__) +#define ATTR_CLOCK_SECTION __attribute__((section(".sclock_rlt_code." ATTR_UNI_SYMBOL))) +#define ATTR_CLOCK_CONST_SECTION __attribute__((section(".sclock_rlt_const." ATTR_UNI_SYMBOL))) +#define ATTR_TCM_SECTION __attribute__((section(".tcm_code." ATTR_UNI_SYMBOL))) +#define ATTR_TCM_CONST_SECTION __attribute__((section(".tcm_const." ATTR_UNI_SYMBOL))) +#define ATTR_DTCM_SECTION __attribute__((section(".tcm_data"))) +#define ATTR_HSRAM_SECTION __attribute__((section(".hsram_code"))) +#define ATTR_DMA_RAM_SECTION __attribute__((section(".system_ram"))) +#define ATTR_NOCACHE_RAM_SECTION __attribute__((section(".nocache_ram"))) +#define ATTR_NOCACHE_NOINIT_RAM_SECTION __attribute__((section(".nocache_noinit_ram"))) +#define ATTR_HBN_RAM_SECTION __attribute__((section(".hbn_ram_code"))) +#define ATTR_HBN_RAM_CONST_SECTION __attribute__((section(".hbn_ram_data"))) +#define ATTR_EALIGN(x) __attribute__((aligned(x))) +#define ATTR_FALLTHROUGH() __attribute__((fallthrough)) +#define ATTR_USED __attribute__((__used__)) #else #include "bl_ld_sections.h" #endif /* BFLB_USE_CUSTOM_LD_SECTIONS */