From 60da4317b971dae6f570f4bcd0d31c37437a24fc Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Tue, 22 Jun 2021 11:51:54 +0100 Subject: [PATCH] arch/risc-v/esp32c3: Use the same naming for the RTC heap as ESP32 for consistency. Signed-off-by: Abdelatif Guettouche --- arch/risc-v/src/esp32c3/Make.defs | 2 +- .../{esp32c3_rtc_heap.c => esp32c3_rtcheap.c} | 72 +++++++++---------- .../{esp32c3_rtc_heap.h => esp32c3_rtcheap.h} | 44 ++++++------ arch/risc-v/src/esp32c3/esp32c3_textheap.c | 8 +-- .../esp32c3/esp32c3-devkit/scripts/esp32c3.ld | 2 +- .../scripts/esp32c3.template.ld | 2 +- 6 files changed, 65 insertions(+), 65 deletions(-) rename arch/risc-v/src/esp32c3/{esp32c3_rtc_heap.c => esp32c3_rtcheap.c} (75%) rename arch/risc-v/src/esp32c3/{esp32c3_rtc_heap.h => esp32c3_rtcheap.h} (79%) diff --git a/arch/risc-v/src/esp32c3/Make.defs b/arch/risc-v/src/esp32c3/Make.defs index 3de23757f9..aea0f6cd6f 100644 --- a/arch/risc-v/src/esp32c3/Make.defs +++ b/arch/risc-v/src/esp32c3/Make.defs @@ -169,7 +169,7 @@ CHIP_CSRCS += esp32c3_rtc_lowerhalf.c endif ifeq ($(CONFIG_ESP32C3_RTC_HEAP),y) -CHIP_CSRCS += esp32c3_rtc_heap.c +CHIP_CSRCS += esp32c3_rtcheap.c endif ifeq ($(CONFIG_ESP32C3_WIRELESS),y) diff --git a/arch/risc-v/src/esp32c3/esp32c3_rtc_heap.c b/arch/risc-v/src/esp32c3/esp32c3_rtcheap.c similarity index 75% rename from arch/risc-v/src/esp32c3/esp32c3_rtc_heap.c rename to arch/risc-v/src/esp32c3/esp32c3_rtcheap.c index 351b7a216a..ffcbbcb5ed 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_rtc_heap.c +++ b/arch/risc-v/src/esp32c3/esp32c3_rtcheap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/risc-v/src/esp32c3/esp32c3_rtc_heap.c + * arch/risc-v/src/esp32c3/esp32c3_rtcheap.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,27 +29,27 @@ #include #include -#include "esp32c3_rtc_heap.h" +#include "esp32c3_rtcheap.h" /**************************************************************************** * Private Data ****************************************************************************/ -static struct mm_heap_s g_rtc_heap; +static struct mm_heap_s g_rtcheap; /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: esp32c3_rtc_heap_initialize + * Name: esp32c3_rtcheap_initialize * * Description: * Initialize the RTC heap. * ****************************************************************************/ -void esp32c3_rtc_heap_initialize(void) +void esp32c3_rtcheap_initialize(void) { void *start; size_t size; @@ -58,38 +58,38 @@ void esp32c3_rtc_heap_initialize(void) * esp32c3.template.ld.) Check boards/risc-v/esp32c3. */ - extern uint8_t *_srtc_heap; - extern uint8_t *_ertc_heap; + extern uint8_t *_srtcheap; + extern uint8_t *_ertcheap; - start = (FAR void *)&_srtc_heap; - size = (size_t)((uintptr_t)&_ertc_heap - (uintptr_t)&_srtc_heap); - mm_initialize(&g_rtc_heap, start, size); + start = (FAR void *)&_srtcheap; + size = (size_t)((uintptr_t)&_ertcheap - (uintptr_t)&_srtcheap); + mm_initialize(&g_rtcheap, start, size); #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO) static struct procfs_meminfo_entry_s g_rtc_procfs; - g_rtc_procfs.name = "rtc_heap"; + g_rtc_procfs.name = "rtcheap"; g_rtc_procfs.mallinfo = (void *)mm_mallinfo; - g_rtc_procfs.user_data = &g_rtc_heap; + g_rtc_procfs.user_data = &g_rtcheap; procfs_register_meminfo(&g_rtc_procfs); #endif } /**************************************************************************** - * Name: esp32c3_rtc_heap_malloc + * Name: esp32c3_rtcheap_malloc * * Description: * Allocate memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_malloc(size_t size) +void *esp32c3_rtcheap_malloc(size_t size) { - return mm_malloc(&g_rtc_heap, size); + return mm_malloc(&g_rtcheap, size); } /**************************************************************************** - * Name: esp32c3_rtc_heap_calloc + * Name: esp32c3_rtcheap_calloc * * Description: * Calculates the size of the allocation and allocate memory from @@ -97,52 +97,52 @@ void *esp32c3_rtc_heap_malloc(size_t size) * ****************************************************************************/ -void *esp32c3_rtc_heap_calloc(size_t n, size_t elem_size) +void *esp32c3_rtcheap_calloc(size_t n, size_t elem_size) { - return mm_calloc(&g_rtc_heap, n, elem_size); + return mm_calloc(&g_rtcheap, n, elem_size); } /**************************************************************************** - * Name: esp32c3_rtc_heap_realloc + * Name: esp32c3_rtcheap_realloc * * Description: * Reallocate memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_realloc(void *ptr, size_t size) +void *esp32c3_rtcheap_realloc(void *ptr, size_t size) { - return mm_realloc(&g_rtc_heap, ptr, size); + return mm_realloc(&g_rtcheap, ptr, size); } /**************************************************************************** - * Name: esp32c3_rtc_heap_zalloc + * Name: esp32c3_rtcheap_zalloc * * Description: * Allocate and zero memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_zalloc(size_t size) +void *esp32c3_rtcheap_zalloc(size_t size) { - return mm_zalloc(&g_rtc_heap, size); + return mm_zalloc(&g_rtcheap, size); } /**************************************************************************** - * Name: esp32c3_rtc_heap_free + * Name: esp32c3_rtcheap_free * * Description: * Free memory from the RTC heap. * ****************************************************************************/ -void esp32c3_rtc_heap_free(FAR void *mem) +void esp32c3_rtcheap_free(FAR void *mem) { - mm_free(&g_rtc_heap, mem); + mm_free(&g_rtcheap, mem); } /**************************************************************************** - * Name: esp32c3_rtc_heap_memalign + * Name: esp32c3_rtcheap_memalign * * Description: * memalign requests more than enough space from malloc, finds a region @@ -154,13 +154,13 @@ void esp32c3_rtc_heap_free(FAR void *mem) * ****************************************************************************/ -void *esp32c3_rtc_heap_memalign(size_t alignment, size_t size) +void *esp32c3_rtcheap_memalign(size_t alignment, size_t size) { - return mm_memalign(&g_rtc_heap, alignment, size); + return mm_memalign(&g_rtcheap, alignment, size); } /**************************************************************************** - * Name: esp32c3_rtc_heap_heapmember + * Name: esp32c3_rtcheap_heapmember * * Description: * Check if an address lies in the RTC heap. @@ -173,13 +173,13 @@ void *esp32c3_rtc_heap_memalign(size_t alignment, size_t size) * ****************************************************************************/ -bool esp32c3_rtc_heap_heapmember(FAR void *mem) +bool esp32c3_rtcheap_heapmember(FAR void *mem) { - return mm_heapmember(&g_rtc_heap, mem); + return mm_heapmember(&g_rtcheap, mem); } /**************************************************************************** - * Name: esp32c3_rtc_heap_mallinfo + * Name: esp32c3_rtcheap_mallinfo * * Description: * mallinfo returns a copy of updated current heap information for the @@ -187,7 +187,7 @@ bool esp32c3_rtc_heap_heapmember(FAR void *mem) * ****************************************************************************/ -int esp32c3_rtc_heap_mallinfo(FAR struct mallinfo *info) +int esp32c3_rtcheap_mallinfo(FAR struct mallinfo *info) { - return mm_mallinfo(&g_rtc_heap, info); + return mm_mallinfo(&g_rtcheap, info); } diff --git a/arch/risc-v/src/esp32c3/esp32c3_rtc_heap.h b/arch/risc-v/src/esp32c3/esp32c3_rtcheap.h similarity index 79% rename from arch/risc-v/src/esp32c3/esp32c3_rtc_heap.h rename to arch/risc-v/src/esp32c3/esp32c3_rtcheap.h index 31558cb01c..b0d4b34f5b 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_rtc_heap.h +++ b/arch/risc-v/src/esp32c3/esp32c3_rtcheap.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/risc-v/src/esp32c3/esp32c3_rtc_heap.h + * arch/risc-v/src/esp32c3/esp32c3_rtcheap.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H -#define __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H +#ifndef __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H +#define __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H /**************************************************************************** * Public Function Prototypes @@ -36,27 +36,27 @@ extern "C" struct mallinfo; /* Forward reference, see malloc.h */ /**************************************************************************** - * Name: esp32c3_rtc_heap_initialize + * Name: esp32c3_rtcheap_initialize * * Description: * Initialize the RTC heap. * ****************************************************************************/ -void esp32c3_rtc_heap_initialize(void); +void esp32c3_rtcheap_initialize(void); /**************************************************************************** - * Name: esp32c3_rtc_heap_malloc + * Name: esp32c3_rtcheap_malloc * * Description: * Allocate memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_malloc(size_t size); +void *esp32c3_rtcheap_malloc(size_t size); /**************************************************************************** - * Name: esp32c3_rtc_heap_calloc + * Name: esp32c3_rtcheap_calloc * * Description: * Calculates the size of the allocation and allocate memory from @@ -64,40 +64,40 @@ void *esp32c3_rtc_heap_malloc(size_t size); * ****************************************************************************/ -void *esp32c3_rtc_heap_calloc(size_t n, size_t elem_size); +void *esp32c3_rtcheap_calloc(size_t n, size_t elem_size); /**************************************************************************** - * Name: esp32c3_rtc_heap_realloc + * Name: esp32c3_rtcheap_realloc * * Description: * Reallocate memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_realloc(void *ptr, size_t size); +void *esp32c3_rtcheap_realloc(void *ptr, size_t size); /**************************************************************************** - * Name: esp32c3_rtc_heap_zalloc + * Name: esp32c3_rtcheap_zalloc * * Description: * Allocate and zero memory from the RTC heap. * ****************************************************************************/ -void *esp32c3_rtc_heap_zalloc(size_t size); +void *esp32c3_rtcheap_zalloc(size_t size); /**************************************************************************** - * Name: esp32c3_rtc_heap_free + * Name: esp32c3_rtcheap_free * * Description: * Free memory from the RTC heap. * ****************************************************************************/ -void esp32c3_rtc_heap_free(FAR void *mem); +void esp32c3_rtcheap_free(FAR void *mem); /**************************************************************************** - * Name: esp32c3_rtc_heap_memalign + * Name: esp32c3_rtcheap_memalign * * Description: * memalign requests more than enough space from malloc, finds a region @@ -109,10 +109,10 @@ void esp32c3_rtc_heap_free(FAR void *mem); * ****************************************************************************/ -void *esp32c3_rtc_heap_memalign(size_t alignment, size_t size); +void *esp32c3_rtcheap_memalign(size_t alignment, size_t size); /**************************************************************************** - * Name: esp32c3_rtc_heap_heapmember + * Name: esp32c3_rtcheap_heapmember * * Description: * Check if an address lies in the RTC heap. @@ -125,10 +125,10 @@ void *esp32c3_rtc_heap_memalign(size_t alignment, size_t size); * ****************************************************************************/ -bool esp32c3_rtc_heap_heapmember(FAR void *mem); +bool esp32c3_rtcheap_heapmember(FAR void *mem); /**************************************************************************** - * Name: esp32c3_rtc_heap_mallinfo + * Name: esp32c3_rtcheap_mallinfo * * Description: * mallinfo returns a copy of updated current heap information for the @@ -136,11 +136,11 @@ bool esp32c3_rtc_heap_heapmember(FAR void *mem); * ****************************************************************************/ -int esp32c3_rtc_heap_mallinfo(FAR struct mallinfo *info); +int esp32c3_rtcheap_mallinfo(FAR struct mallinfo *info); #undef EXTERN #ifdef __cplusplus } #endif -#endif /* __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H */ +#endif /* __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H */ diff --git a/arch/risc-v/src/esp32c3/esp32c3_textheap.c b/arch/risc-v/src/esp32c3/esp32c3_textheap.c index 22858801e4..fbb94bc8cd 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_textheap.c +++ b/arch/risc-v/src/esp32c3/esp32c3_textheap.c @@ -36,7 +36,7 @@ #include "hardware/esp32c3_soc.h" #ifdef CONFIG_ESP32C3_RTC_HEAP -#include "esp32c3_rtc_heap.h" +#include "esp32c3_rtcheap.h" #endif /**************************************************************************** @@ -58,7 +58,7 @@ void up_textheap_init() #ifdef CONFIG_ESP32C3_RTC_HEAP /* Initialize the RTC heap */ - esp32c3_rtc_heap_initialize(); + esp32c3_rtcheap_initialize(); #endif } @@ -79,7 +79,7 @@ FAR void *up_textheap_memalign(size_t align, size_t size) */ #ifdef CONFIG_ESP32C3_RTC_HEAP - ret = esp32c3_rtc_heap_memalign(align, size); + ret = esp32c3_rtcheap_memalign(align, size); #endif if (ret == NULL) @@ -113,7 +113,7 @@ void up_textheap_free(FAR void *p) #ifdef CONFIG_ESP32C3_RTC_HEAP if (esp32c3_ptr_rtc(p)) { - esp32c3_rtc_heap_free(p); + esp32c3_rtcheap_free(p); } else #endif diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld index f6945fdd94..fddd0dd301 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld +++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.ld @@ -250,7 +250,7 @@ SECTIONS /* Whatever is left from the RTC memory is used as a special heap. */ - _srtc_heap = ABSOLUTE(.); + _srtcheap = ABSOLUTE(.); } >rtc_seg } diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld index 01dfc457cc..6bdae7e55e 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld +++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/esp32c3.template.ld @@ -91,4 +91,4 @@ MEMORY /* Mark the end of the RTC heap (top of the RTC region) */ -_ertc_heap = 0x50001fff; +_ertcheap = 0x50001fff;