arch/xtensa: Fix the naming of the internal heap functions. They should

be prefixed by xtensa_ instead of up_.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2020-10-13 16:50:52 +01:00 committed by Alan Carvalho de Assis
parent 34ad33c8b2
commit 9b98f20969
10 changed files with 42 additions and 44 deletions

View File

@ -94,28 +94,28 @@ config XTENSA_CP_INITSET
is provided by CONFIG_XTENSA_CP_INITSET. Each bit corresponds to one is provided by CONFIG_XTENSA_CP_INITSET. Each bit corresponds to one
coprocessor with the same bit layout as for the CPENABLE register. coprocessor with the same bit layout as for the CPENABLE register.
config XTENSA_USE_SEPERATE_IMEM config XTENSA_USE_SEPARATE_IMEM
bool "Use a seperate heap for internal memory" bool "Use a separate heap for internal memory"
default n default n
help help
This is a seperate internal heap that's used by drivers when certain operations This is a separate internal heap that's used by drivers when certain operations
are not possible with the provided buffer(s). are not possible with the provided buffer(s).
Mainly, when the provided buffer comes from external RAM and a DMA or flash Mainly, when the provided buffer comes from external RAM and a DMA or flash
operation is going to be performed. operation is going to be performed.
This seperate heap will be part of the internal DRAM. It starts right after .data This separate heap will be part of the internal DRAM. It starts right after .data
and ends at the configurable size given by the OPTION XTENSA_IMEM_REGION_SIZE. and ends at the configurable size given by the OPTION XTENSA_IMEM_REGION_SIZE.
config XTENSA_IMEM_REGION_SIZE config XTENSA_IMEM_REGION_SIZE
hex "DRAM region size for internal use" hex "DRAM region size for internal use"
depends on XTENSA_USE_SEPERATE_IMEM depends on XTENSA_USE_SEPARATE_IMEM
range 0x2000 0x28000 range 0x2000 0x28000
default 0x28000 default 0x28000
config XTENSA_IMEM_PROCFS config XTENSA_IMEM_PROCFS
bool "Internal memory PROCFS support" bool "Internal memory PROCFS support"
default n default n
depends on XTENSA_USE_SEPERATE_IMEM && !DISABLE_MOUNTPOINT && FS_PROCFS && FS_PROCFS_REGISTER depends on XTENSA_USE_SEPARATE_IMEM && !DISABLE_MOUNTPOINT && FS_PROCFS && FS_PROCFS_REGISTER
source arch/xtensa/src/lx6/Kconfig source arch/xtensa/src/lx6/Kconfig
if ARCH_CHIP_ESP32 if ARCH_CHIP_ESP32

View File

@ -91,16 +91,15 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPARATE_IMEM
struct mallinfo; /* Forward reference, see malloc.h */ struct mallinfo; /* Forward reference, see malloc.h */
void up_imm_initialize(void); void xtensa_imm_initialize(void);
FAR void *up_imm_malloc(size_t size); FAR void *xtensa_imm_malloc(size_t size);
void up_imm_free(FAR void *mem); void xtensa_imm_free(FAR void *mem);
FAR void *up_imm_memalign(size_t alignment, size_t size); FAR void *xtensa_imm_memalign(size_t alignment, size_t size);
bool up_imm_heapmember(FAR void *mem); bool xtensa_imm_heapmember(FAR void *mem);
int up_imm_mallinfo(FAR struct mallinfo *info); int xtensa_imm_mallinfo(FAR struct mallinfo *info);
#endif #endif
#undef EXTERN #undef EXTERN

View File

@ -111,7 +111,7 @@ void up_initialize(void)
/* Initialize the internal heap */ /* Initialize the internal heap */
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
up_imm_initialize(); xtensa_imm_initialize();
#endif #endif
#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_ARCH_DMA

View File

@ -35,10 +35,10 @@
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
# define UMM_MALLOC(s) up_imm_malloc(s) # define UMM_MALLOC(s) xtensa_imm_malloc(s)
# define UMM_MEMALIGN(a,s) up_imm_memalign(a,s) # define UMM_MEMALIGN(a,s) xtensa_imm_memalign(a,s)
# define UMM_FREE(p) up_imm_free(p) # define UMM_FREE(p) xtensa_imm_free(p)
# define UMM_HEAPMEMEBER(p) up_imm_heapmember(p) # define UMM_HEAPMEMEBER(p) xtensa_imm_heapmember(p)
#else #else
# define UMM_MALLOC(s) kumm_malloc(s) # define UMM_MALLOC(s) kumm_malloc(s)
# define UMM_MEMALIGN(a,s) kumm_memalign(a,s) # define UMM_MEMALIGN(a,s) kumm_memalign(a,s)

View File

@ -75,7 +75,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
board_autoled_on(LED_HEAPALLOCATE); board_autoled_on(LED_HEAPALLOCATE);
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPARATE_IMEM
*heap_start = (FAR void *)&_sheap + CONFIG_XTENSA_IMEM_REGION_SIZE; *heap_start = (FAR void *)&_sheap + CONFIG_XTENSA_IMEM_REGION_SIZE;
*heap_size = (size_t)((uintptr_t)&_eheap - (uintptr_t)*heap_start); *heap_size = (size_t)((uintptr_t)&_eheap - (uintptr_t)*heap_start);
#else #else

View File

@ -30,7 +30,7 @@
#include "xtensa.h" #include "xtensa.h"
#if CONFIG_XTENSA_USE_SEPERATE_IMEM #if CONFIG_XTENSA_USE_SEPARATE_IMEM
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -43,14 +43,14 @@ struct mm_heap_s g_iheap;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_imm_initialize * Name: xtensa_imm_initialize
* *
* Description: * Description:
* Initialize the internal heap. * Initialize the internal heap.
* *
****************************************************************************/ ****************************************************************************/
void up_imm_initialize(void) void xtensa_imm_initialize(void)
{ {
void *start; void *start;
size_t size; size_t size;
@ -61,33 +61,33 @@ void up_imm_initialize(void)
} }
/**************************************************************************** /****************************************************************************
* Name: up_imm_malloc * Name: xtensa_imm_malloc
* *
* Description: * Description:
* Allocate memory from the internal heap. * Allocate memory from the internal heap.
* *
****************************************************************************/ ****************************************************************************/
FAR void *up_imm_malloc(size_t size) FAR void *xtensa_imm_malloc(size_t size)
{ {
return mm_malloc(&g_iheap, size); return mm_malloc(&g_iheap, size);
} }
/**************************************************************************** /****************************************************************************
* Name: up_imm_free * Name: xtensa_imm_free
* *
* Description: * Description:
* Free memory from the internal heap. * Free memory from the internal heap.
* *
****************************************************************************/ ****************************************************************************/
void up_imm_free(FAR void *mem) void xtensa_imm_free(FAR void *mem)
{ {
mm_free(&g_iheap, mem); mm_free(&g_iheap, mem);
} }
/**************************************************************************** /****************************************************************************
* Name: up_imm_memalign * Name: xtensa_imm_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
@ -99,13 +99,13 @@ void up_imm_free(FAR void *mem)
* *
****************************************************************************/ ****************************************************************************/
FAR void *up_imm_memalign(size_t alignment, size_t size) FAR void *xtensa_imm_memalign(size_t alignment, size_t size)
{ {
return mm_memalign(&g_iheap, alignment, size); return mm_memalign(&g_iheap, alignment, size);
} }
/**************************************************************************** /****************************************************************************
* Name: up_imm_heapmember * Name: xtensa_imm_heapmember
* *
* Description: * Description:
* Check if an address lies in the internal heap. * Check if an address lies in the internal heap.
@ -118,13 +118,13 @@ FAR void *up_imm_memalign(size_t alignment, size_t size)
* *
****************************************************************************/ ****************************************************************************/
bool up_imm_heapmember(FAR void *mem) bool xtensa_imm_heapmember(FAR void *mem)
{ {
return mm_heapmember(&g_iheap, mem); return mm_heapmember(&g_iheap, mem);
} }
/**************************************************************************** /****************************************************************************
* Name: up_imm_mallinfo * Name: xtensa_imm_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
@ -132,9 +132,9 @@ bool up_imm_heapmember(FAR void *mem)
* *
****************************************************************************/ ****************************************************************************/
int up_imm_mallinfo(FAR struct mallinfo *info) int xtensa_imm_mallinfo(FAR struct mallinfo *info)
{ {
return mm_mallinfo(&g_iheap, info); return mm_mallinfo(&g_iheap, info);
} }
#endif /* CONFIG_XTENSA_USE_SEPERATE_IMEM */ #endif /* CONFIG_XTENSA_USE_SEPARATE_IMEM */

View File

@ -205,7 +205,7 @@ static ssize_t imm_read(FAR struct file *filep, FAR char *buffer,
priv = (FAR struct imm_file_s *)filep->f_priv; priv = (FAR struct imm_file_s *)filep->f_priv;
DEBUGASSERT(priv); DEBUGASSERT(priv);
up_imm_mallinfo(&mem); xtensa_imm_mallinfo(&mem);
remaining = buflen; remaining = buflen;
totalsize = 0; totalsize = 0;

View File

@ -880,7 +880,7 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(txbuffer)) if (esp32_ptr_extram(txbuffer))
{ {
alloctp = up_imm_malloc(bytes); alloctp = xtensa_imm_malloc(bytes);
DEBUGASSERT(alloctp != NULL); DEBUGASSERT(alloctp != NULL);
memcpy(alloctp, txbuffer, bytes); memcpy(alloctp, txbuffer, bytes);
tp = alloctp; tp = alloctp;
@ -894,7 +894,7 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(rxbuffer)) if (esp32_ptr_extram(rxbuffer))
{ {
allocrp = up_imm_malloc(bytes); allocrp = xtensa_imm_malloc(bytes);
DEBUGASSERT(allocrp != NULL); DEBUGASSERT(allocrp != NULL);
rp = allocrp; rp = allocrp;
} }
@ -967,14 +967,14 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
if (esp32_ptr_extram(rxbuffer)) if (esp32_ptr_extram(rxbuffer))
{ {
memcpy(rxbuffer, allocrp, bytes); memcpy(rxbuffer, allocrp, bytes);
up_imm_free(allocrp); xtensa_imm_free(allocrp);
} }
#endif #endif
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(txbuffer)) if (esp32_ptr_extram(txbuffer))
{ {
up_imm_free(alloctp); xtensa_imm_free(alloctp);
} }
#endif #endif
} }

View File

@ -1054,7 +1054,7 @@ static ssize_t esp32_read(FAR struct mtd_dev_s *dev, off_t offset,
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(buffer)) if (esp32_ptr_extram(buffer))
{ {
tmpbuff = up_imm_malloc(nbytes); tmpbuff = xtensa_imm_malloc(nbytes);
if (tmpbuff == NULL) if (tmpbuff == NULL)
{ {
return (ssize_t)-ENOMEM; return (ssize_t)-ENOMEM;
@ -1089,7 +1089,7 @@ error_with_buffer:
if (esp32_ptr_extram(buffer)) if (esp32_ptr_extram(buffer))
{ {
memcpy(buffer, tmpbuff, (ret == OK) ? nbytes : 0); memcpy(buffer, tmpbuff, (ret == OK) ? nbytes : 0);
up_imm_free(tmpbuff); xtensa_imm_free(tmpbuff);
} }
#endif #endif
@ -1173,7 +1173,7 @@ static ssize_t esp32_write(FAR struct mtd_dev_s *dev, off_t offset,
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(buffer)) if (esp32_ptr_extram(buffer))
{ {
tmpbuff = up_imm_malloc(nbytes); tmpbuff = xtensa_imm_malloc(nbytes);
if (tmpbuff == NULL) if (tmpbuff == NULL)
{ {
return (ssize_t)-ENOMEM; return (ssize_t)-ENOMEM;
@ -1213,7 +1213,7 @@ error_with_buffer:
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM #ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
if (esp32_ptr_extram(buffer)) if (esp32_ptr_extram(buffer))
{ {
up_imm_free(tmpbuff); xtensa_imm_free(tmpbuff);
} }
#endif #endif

View File

@ -48,4 +48,3 @@ CONFIG_START_YEAR=2011
CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_XTENSA_USE_SEPERATE_IMEM=y