arch/xtensa/src/common: Refactor the mm_ macros into a separate file.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2020-10-12 15:39:21 +01:00 committed by Alan Carvalho de Assis
parent c91db9eb40
commit 2fa5d65355
3 changed files with 51 additions and 28 deletions

View File

@ -54,6 +54,7 @@
#include <arch/board/board.h>
#include "xtensa.h"
#include "xtensa_mm.h"
/****************************************************************************
* Pre-processor Macros
@ -73,18 +74,6 @@
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
# define UMM_MALLOC(s) up_imm_malloc(s)
# define UMM_MEMALIGN(a,s) up_imm_memalign(a,s)
# define UMM_FREE(p) up_imm_free(p)
# define UMM_HEAPMEMEBER(p) up_imm_heapmember(p)
#else
# define UMM_MALLOC(s) kumm_malloc(s)
# define UMM_MEMALIGN(a,s) kumm_memalign(a,s)
# define UMM_FREE(p) kumm_free(p)
# define UMM_HEAPMEMEBER(p) umm_heapmember(p)
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -0,0 +1,49 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_mm.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_XTENSA_SRC_COMMON_XTENSA_MM_H
#define __ARCH_XTENSA_SRC_COMMON_XTENSA_MM_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
/****************************************************************************
* Pre-processor Macros
****************************************************************************/
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
# define UMM_MALLOC(s) up_imm_malloc(s)
# define UMM_MEMALIGN(a,s) up_imm_memalign(a,s)
# define UMM_FREE(p) up_imm_free(p)
# define UMM_HEAPMEMEBER(p) up_imm_heapmember(p)
#else
# define UMM_MALLOC(s) kumm_malloc(s)
# define UMM_MEMALIGN(a,s) kumm_memalign(a,s)
# define UMM_FREE(p) kumm_free(p)
# define UMM_HEAPMEMEBER(p) umm_heapmember(p)
#endif
#endif /* __ARCH_XTENSA_SRC_COMMON_XTENSA_MM_H */

View File

@ -46,22 +46,7 @@
#include <nuttx/kmalloc.h>
#include "xtensa.h"
/****************************************************************************
* Pre-processor Macros
****************************************************************************/
#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM
# define UMM_MALLOC(s) up_imm_malloc(s)
# define UMM_MEMALIGN(a,s) up_imm_memalign(a,s)
# define UMM_FREE(p) up_imm_free(p)
# define UMM_HEAPMEMEBER(p) up_imm_heapmember(p)
#else
# define UMM_MALLOC(s) kumm_malloc(s)
# define UMM_MEMALIGN(a,s) kumm_memalign(a,s)
# define UMM_FREE(p) kumm_free(p)
# define UMM_HEAPMEMEBER(p) umm_heapmember(p)
#endif
#include "xtensa_mm.h"
/****************************************************************************
* Public Functions