2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* arch/xtensa/include/arch.h
|
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* 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
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* 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.
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-05 23:00:04 +02:00
|
|
|
/* This file should never be included directly but, rather, only indirectly
|
2016-10-12 21:11:05 +02:00
|
|
|
* through nuttx/arch.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARCH_XTENSA_INCLUDE_ARCH_H
|
|
|
|
#define __ARCH_XTENSA_INCLUDE_ARCH_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2021-05-14 04:03:23 +02:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stddef.h>
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
2016-10-12 21:11:05 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Inline functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-07-08 20:39:29 +02:00
|
|
|
/****************************************************************************
|
2021-06-09 10:26:18 +02:00
|
|
|
* Name: up_getsp
|
2020-07-08 20:39:29 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2021-09-15 08:55:27 +02:00
|
|
|
static inline uint32_t up_getsp(void) inline_function;
|
2021-06-09 10:26:18 +02:00
|
|
|
static inline uint32_t up_getsp(void)
|
2020-07-08 20:39:29 +02:00
|
|
|
{
|
|
|
|
register uint32_t sp;
|
|
|
|
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"mov %0, sp\n"
|
|
|
|
: "=r" (sp)
|
|
|
|
);
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP
|
2020-09-17 17:11:58 +02:00
|
|
|
struct mallinfo; /* Forward reference, see malloc.h */
|
|
|
|
|
2021-02-08 03:18:23 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void xtensa_imm_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_malloc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Allocate memory from the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
void *xtensa_imm_malloc(size_t size);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_calloc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Calculates the size of the allocation and
|
|
|
|
* allocate memory the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
void *xtensa_imm_calloc(size_t n, size_t elem_size);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_realloc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Reallocate memory from the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
void *xtensa_imm_realloc(void *ptr, size_t size);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_zalloc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Allocate and zero memory from the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
void *xtensa_imm_zalloc(size_t size);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_free
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Free memory from the internal heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-09-21 21:31:29 +02:00
|
|
|
void xtensa_imm_free(void *mem);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_memalign
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* memalign requests more than enough space from malloc, finds a region
|
|
|
|
* within that chunk that meets the alignment request and then frees any
|
|
|
|
* leading or trailing space.
|
|
|
|
*
|
2021-02-08 10:16:04 +01:00
|
|
|
* The alignment argument must be a power of two (not checked). 8-byte
|
2021-02-08 03:18:23 +01:00
|
|
|
* alignment is guaranteed by normal malloc calls.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-08 10:16:04 +01:00
|
|
|
void *xtensa_imm_memalign(size_t alignment, size_t size);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_heapmember
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Check if an address lies in the internal heap.
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* mem - The address to check
|
|
|
|
*
|
|
|
|
* Return Value:
|
2021-02-08 10:16:04 +01:00
|
|
|
* true if the address is a member of the internal heap. false if not
|
2021-02-08 03:18:23 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-09-21 21:31:29 +02:00
|
|
|
bool xtensa_imm_heapmember(void *mem);
|
2021-02-08 03:18:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_imm_mallinfo
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* mallinfo returns a copy of updated current heap information for the
|
|
|
|
* user heap.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-09-21 21:31:29 +02:00
|
|
|
int xtensa_imm_mallinfo(struct mallinfo *info);
|
2020-09-17 15:22:30 +02:00
|
|
|
#endif
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ARCH_XTENSA_INCLUDE_ARCH_H */
|