From 4bc5b246ac7a6a92d523c5b63adc798ae2c9bf63 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 17 Feb 2022 01:42:09 +0800 Subject: [PATCH] arch/ceva: Remove B2C and C2B since TL420 doesn't support anymore, we can safely remove the special hack for it Signed-off-by: Xiang Xiao --- arch/ceva/src/common/up_checkstack.c | 2 +- arch/ceva/src/common/up_createstack.c | 14 +++++--------- arch/ceva/src/common/up_internal.h | 2 +- arch/ceva/src/common/up_start.c | 2 +- arch/ceva/src/common/up_usestack.c | 2 +- arch/ceva/src/common/up_vfork.c | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/ceva/src/common/up_checkstack.c b/arch/ceva/src/common/up_checkstack.c index f565ec136c..f7450b3da2 100644 --- a/arch/ceva/src/common/up_checkstack.c +++ b/arch/ceva/src/common/up_checkstack.c @@ -77,7 +77,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) { /* Skip over the TLS data structure at the bottom of the stack */ - DEBUGASSERT(alloc & (B2C(TLS_STACK_ALIGN) - 1) == 0); + DEBUGASSERT(alloc & (TLS_STACK_ALIGN - 1) == 0); start = alloc + sizeof(struct tls_info_s); } else diff --git a/arch/ceva/src/common/up_createstack.c b/arch/ceva/src/common/up_createstack.c index 2ffb7c4ebd..9b4626bc20 100644 --- a/arch/ceva/src/common/up_createstack.c +++ b/arch/ceva/src/common/up_createstack.c @@ -96,10 +96,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) { - /* Conver the stack size unit from byte to char */ - - stack_size = B2C(stack_size); - #ifdef CONFIG_TLS /* Add the size of the TLS information structure */ @@ -109,10 +105,10 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * TLS feature. */ - DEBUGASSERT(stack_size <= B2C(TLS_MAXSTACK)); - if (stack_size >= B2C(TLS_MAXSTACK)) + DEBUGASSERT(stack_size <= TLS_MAXSTACK); + if (stack_size >= TLS_MAXSTACK) { - stack_size = B2C(TLS_MAXSTACK); + stack_size = TLS_MAXSTACK; } #endif @@ -145,7 +141,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) { tcb->stack_alloc_ptr = mm_memalign( KMM_HEAP(CONFIG_ARCH_KERNEL_STACK_HEAP), - B2C(TLS_STACK_ALIGN), stack_size); + TLS_STACK_ALIGN, stack_size); } else #endif @@ -154,7 +150,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) tcb->stack_alloc_ptr = mm_memalign( UMM_HEAP(CONFIG_ARCH_STACK_HEAP), - B2C(TLS_STACK_ALIGN), stack_size); + TLS_STACK_ALIGN, stack_size); } #else /* CONFIG_TLS */ diff --git a/arch/ceva/src/common/up_internal.h b/arch/ceva/src/common/up_internal.h index 1c03809c7b..44de254fc4 100644 --- a/arch/ceva/src/common/up_internal.h +++ b/arch/ceva/src/common/up_internal.h @@ -80,7 +80,7 @@ #define _DATA_INIT ((const void *)&_eronly) #define _START_DATA ((void *)&_sdata) #define _END_DATA ((void *)&_edata) -#define _START_HEAP ((void *)&_ebss + B2C(CONFIG_IDLETHREAD_STACKSIZE)) +#define _START_HEAP ((void *)&_ebss + CONFIG_IDLETHREAD_STACKSIZE) #define _END_HEAP ((void *)&_eheap) #define _END_MEM ((void *)~0) diff --git a/arch/ceva/src/common/up_start.c b/arch/ceva/src/common/up_start.c index 5a673484b3..754f36c3ce 100644 --- a/arch/ceva/src/common/up_start.c +++ b/arch/ceva/src/common/up_start.c @@ -245,7 +245,7 @@ static void init_kernelspace(void) g_idle_topstack - g_idle_basestack); #ifdef CONFIG_STACK_COLORATION up_stack_color(g_idle_basestack, - g_idle_topstack - g_idle_basestack - B2C(256)); + g_idle_topstack - g_idle_basestack - 256); #endif } diff --git a/arch/ceva/src/common/up_usestack.c b/arch/ceva/src/common/up_usestack.c index 5bc8b119e7..47bfb915dd 100644 --- a/arch/ceva/src/common/up_usestack.c +++ b/arch/ceva/src/common/up_usestack.c @@ -81,7 +81,7 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size) #ifdef CONFIG_TLS /* Make certain that the user provided stack is properly aligned */ - DEBUGASSERT((uintptr_t)stack & (B2C(TLS_STACK_ALIGN) - 1) == 0); + DEBUGASSERT((uintptr_t)stack & (TLS_STACK_ALIGN - 1) == 0); #else DEBUGASSERT((uintptr_t)stack & STACK_ALIGN_MASK == 0); #endif diff --git a/arch/ceva/src/common/up_vfork.c b/arch/ceva/src/common/up_vfork.c index 6f3800f5ac..00fbb5dc6e 100644 --- a/arch/ceva/src/common/up_vfork.c +++ b/arch/ceva/src/common/up_vfork.c @@ -111,7 +111,7 @@ pid_t up_vfork(const uint32_t *regs) /* Allocate the stack for the TCB */ - ret = up_create_stack((FAR struct tcb_s *)child, C2B(stacksize + argsize), + ret = up_create_stack((FAR struct tcb_s *)child, stacksize + argsize, parent->flags & TCB_FLAG_TTYPE_MASK); if (ret != OK) {