arch/risc-v/esp32c3: Use the same naming for the RTC heap as ESP32 for

consistency.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-06-22 11:51:54 +01:00 committed by Masayuki Ishikawa
parent bdbc9ef04f
commit 60da4317b9
6 changed files with 65 additions and 65 deletions

View File

@ -169,7 +169,7 @@ CHIP_CSRCS += esp32c3_rtc_lowerhalf.c
endif endif
ifeq ($(CONFIG_ESP32C3_RTC_HEAP),y) ifeq ($(CONFIG_ESP32C3_RTC_HEAP),y)
CHIP_CSRCS += esp32c3_rtc_heap.c CHIP_CSRCS += esp32c3_rtcheap.c
endif endif
ifeq ($(CONFIG_ESP32C3_WIRELESS),y) ifeq ($(CONFIG_ESP32C3_WIRELESS),y)

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -29,27 +29,27 @@
#include <nuttx/mm/mm.h> #include <nuttx/mm/mm.h>
#include <malloc.h> #include <malloc.h>
#include "esp32c3_rtc_heap.h" #include "esp32c3_rtcheap.h"
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
static struct mm_heap_s g_rtc_heap; static struct mm_heap_s g_rtcheap;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: esp32c3_rtc_heap_initialize * Name: esp32c3_rtcheap_initialize
* *
* Description: * Description:
* Initialize the RTC heap. * Initialize the RTC heap.
* *
****************************************************************************/ ****************************************************************************/
void esp32c3_rtc_heap_initialize(void) void esp32c3_rtcheap_initialize(void)
{ {
void *start; void *start;
size_t size; size_t size;
@ -58,38 +58,38 @@ void esp32c3_rtc_heap_initialize(void)
* esp32c3.template.ld.) Check boards/risc-v/esp32c3. * esp32c3.template.ld.) Check boards/risc-v/esp32c3.
*/ */
extern uint8_t *_srtc_heap; extern uint8_t *_srtcheap;
extern uint8_t *_ertc_heap; extern uint8_t *_ertcheap;
start = (FAR void *)&_srtc_heap; start = (FAR void *)&_srtcheap;
size = (size_t)((uintptr_t)&_ertc_heap - (uintptr_t)&_srtc_heap); size = (size_t)((uintptr_t)&_ertcheap - (uintptr_t)&_srtcheap);
mm_initialize(&g_rtc_heap, start, size); mm_initialize(&g_rtcheap, start, size);
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO) #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
static struct procfs_meminfo_entry_s g_rtc_procfs; 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.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); procfs_register_meminfo(&g_rtc_procfs);
#endif #endif
} }
/**************************************************************************** /****************************************************************************
* Name: esp32c3_rtc_heap_malloc * Name: esp32c3_rtcheap_malloc
* *
* Description: * Description:
* Allocate memory from the RTC heap. * 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: * Description:
* Calculates the size of the allocation and allocate memory from * 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: * Description:
* Reallocate memory from the RTC heap. * 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: * Description:
* Allocate and zero memory from the RTC heap. * 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: * Description:
* Free memory from the RTC heap. * 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: * Description:
* memalign requests more than enough space from malloc, finds a region * 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: * Description:
* Check if an address lies in the RTC heap. * 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: * Description:
* mallinfo returns a copy of updated current heap information for the * 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);
} }

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -18,8 +18,8 @@
* *
****************************************************************************/ ****************************************************************************/
#ifndef __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H #ifndef __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H
#define __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H #define __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
@ -36,27 +36,27 @@ extern "C"
struct mallinfo; /* Forward reference, see malloc.h */ struct mallinfo; /* Forward reference, see malloc.h */
/**************************************************************************** /****************************************************************************
* Name: esp32c3_rtc_heap_initialize * Name: esp32c3_rtcheap_initialize
* *
* Description: * Description:
* Initialize the RTC heap. * 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: * Description:
* Allocate memory from the RTC heap. * 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: * Description:
* Calculates the size of the allocation and allocate memory from * 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: * Description:
* Reallocate memory from the RTC heap. * 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: * Description:
* Allocate and zero memory from the RTC heap. * 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: * Description:
* Free memory from the RTC heap. * 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: * Description:
* memalign requests more than enough space from malloc, finds a region * 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: * Description:
* Check if an address lies in the RTC heap. * 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: * Description:
* mallinfo returns a copy of updated current heap information for the * 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 #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTC_HEAP_H */ #endif /* __ARCH_RISCV_SRC_ESP32C3_ESP32C3_RTCHEAP_H */

View File

@ -36,7 +36,7 @@
#include "hardware/esp32c3_soc.h" #include "hardware/esp32c3_soc.h"
#ifdef CONFIG_ESP32C3_RTC_HEAP #ifdef CONFIG_ESP32C3_RTC_HEAP
#include "esp32c3_rtc_heap.h" #include "esp32c3_rtcheap.h"
#endif #endif
/**************************************************************************** /****************************************************************************
@ -58,7 +58,7 @@ void up_textheap_init()
#ifdef CONFIG_ESP32C3_RTC_HEAP #ifdef CONFIG_ESP32C3_RTC_HEAP
/* Initialize the RTC heap */ /* Initialize the RTC heap */
esp32c3_rtc_heap_initialize(); esp32c3_rtcheap_initialize();
#endif #endif
} }
@ -79,7 +79,7 @@ FAR void *up_textheap_memalign(size_t align, size_t size)
*/ */
#ifdef CONFIG_ESP32C3_RTC_HEAP #ifdef CONFIG_ESP32C3_RTC_HEAP
ret = esp32c3_rtc_heap_memalign(align, size); ret = esp32c3_rtcheap_memalign(align, size);
#endif #endif
if (ret == NULL) if (ret == NULL)
@ -113,7 +113,7 @@ void up_textheap_free(FAR void *p)
#ifdef CONFIG_ESP32C3_RTC_HEAP #ifdef CONFIG_ESP32C3_RTC_HEAP
if (esp32c3_ptr_rtc(p)) if (esp32c3_ptr_rtc(p))
{ {
esp32c3_rtc_heap_free(p); esp32c3_rtcheap_free(p);
} }
else else
#endif #endif

View File

@ -250,7 +250,7 @@ SECTIONS
/* Whatever is left from the RTC memory is used as a special heap. */ /* Whatever is left from the RTC memory is used as a special heap. */
_srtc_heap = ABSOLUTE(.); _srtcheap = ABSOLUTE(.);
} >rtc_seg } >rtc_seg
} }

View File

@ -91,4 +91,4 @@ MEMORY
/* Mark the end of the RTC heap (top of the RTC region) */ /* Mark the end of the RTC heap (top of the RTC region) */
_ertc_heap = 0x50001fff; _ertcheap = 0x50001fff;