* arch/ceva/src/common/ceva_internal.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_CEVA_SRC_COMMON_UP_INTERNAL_H
#define __ARCH_CEVA_SRC_COMMON_UP_INTERNAL_H
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/arch.h>
# include <sys/types.h>
# include <stdint.h>
#endif
* Pre-processor Definitions
****************************************************************************/
* and no other console device is specified, then a serial console is
* assumed.
*/
#if !defined(CONFIG_DEV_CONSOLE) || CONFIG_NFILE_DESCRIPTORS == 0
# undef USE_SERIALDRIVER
# undef USE_EARLYSERIALINIT
# undef CONFIG_DEV_LOWCONSOLE
# undef CONFIG_RAMLOG_CONSOLE
#else
# if defined(CONFIG_RAMLOG_CONSOLE)
# undef USE_SERIALDRIVER
# undef USE_EARLYSERIALINIT
# undef CONFIG_DEV_LOWCONSOLE
# elif defined(CONFIG_DEV_LOWCONSOLE)
# undef USE_SERIALDRIVER
# undef USE_EARLYSERIALINIT
# else
# define USE_SERIALDRIVER 1
# define USE_EARLYSERIALINIT 1
# endif
#endif
* still be needed. Let's assume that if the upper half serial driver is
* built, then the lower half will also be needed. There is no need for
* the early serial initialization in this case.
*/
#if !defined(USE_SERIALDRIVER) && defined(CONFIG_STANDARD_SERIAL)
# define USE_SERIALDRIVER 1
#endif
#define _START_TEXT _stext
#define _END_TEXT _etext
#define _START_BSS _sbss
#define _END_BSS _ebss
#define _DATA_INIT _eronly
#define _START_DATA _sdata
#define _END_DATA _edata
#define _START_HEAP (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
#define _END_HEAP _eheap
#define _END_MEM ((char *)~0)
* logic.
*/
#define STACK_COLOR 0xdeadbeef
#define HEAP_COLOR 'h'
#define getreg8(a) (*(volatile uint8_t *)(a))
#define putreg8(v,a) (*(volatile uint8_t *)(a) = (v))
#define getreg16(a) (*(volatile uint16_t *)(a))
#define putreg16(v,a) (*(volatile uint16_t *)(a) = (v))
#define getreg32(a) (*(volatile uint32_t *)(a))
#define putreg32(v,a) (*(volatile uint32_t *)(a) = (v))
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
* This is the first address in DRAM after the loaded
* program+bss+idle stack. The end of the heap is
* CONFIG_RAM_END
*/
EXTERN void *g_idle_basestack;
EXTERN void *g_idle_topstack;
EXTERN uint8_t g_intstackalloc[];
EXTERN uint8_t g_intstackbase[];
EXTERN const uint8_t _stext[];
EXTERN const uint8_t _stext2[];
EXTERN const uint8_t _stext3[];
EXTERN const uint8_t _stext4[];
EXTERN const uint8_t _etext[];
EXTERN const uint8_t _etext2[];
EXTERN const uint8_t _etext3[];
EXTERN const uint8_t _etext4[];
EXTERN const uint8_t _eronly[];
EXTERN const uint8_t _eronly2[];
EXTERN const uint8_t _eronly3[];
EXTERN const uint8_t _eronly4[];
EXTERN uint8_t _sdata[];
EXTERN uint8_t _sdata2[];
EXTERN uint8_t _sdata3[];
EXTERN uint8_t _sdata4[];
EXTERN uint8_t _edata[];
EXTERN uint8_t _edata2[];
EXTERN uint8_t _edata3[];
EXTERN uint8_t _edata4[];
EXTERN uint8_t _sbss[];
EXTERN uint8_t _sbss2[];
EXTERN uint8_t _sbss3[];
EXTERN uint8_t _sbss4[];
EXTERN uint8_t _ebss[];
EXTERN uint8_t _ebss2[];
EXTERN uint8_t _ebss3[];
EXTERN uint8_t _ebss4[];
EXTERN uint8_t _eheap[];
EXTERN uint8_t _eheap2[];
EXTERN uint8_t _eheap3[];
EXTERN uint8_t _eheap4[];
#endif
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits);
void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits);
void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
void ceva_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
void ceva_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
void ceva_sigdeliver(void);
void ceva_earlyinitialize(void);
void ceva_lateinitialize(void);
void ceva_finalinitialize(void);
#ifdef CONFIG_PM
void ceva_pminitialize(void);
#else
# define ceva_pminitialize()
#endif
void ceva_reset(void);
void ceva_cpu_doze(void);
void ceva_cpu_idle(void);
void ceva_cpu_standby(void);
void ceva_cpu_sleep(void);
void ceva_cpu_normal(void);
uint32_t *ceva_doirq(int irq, uint32_t *regs);
int ceva_svcall(int irq, void *context, void *arg);
int ceva_hardfault(int irq, void *context, void *arg);
void ceva_svcall_handler(void);
#ifdef USE_SERIALDRIVER
void ceva_serialinit(void);
#else
# define ceva_serialinit()
#endif
#ifdef USE_EARLYSERIALINIT
void ceva_earlyserialinit(void);
#else
# define ceva_earlyserialinit()
#endif
#ifdef CONFIG_ARCH_DMA
void ceva_dma_initialize(void);
#endif
#if CONFIG_MM_REGIONS > 1
void ceva_addregion(void);
#else
# define ceva_addregion()
#endif
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
void ceva_netinitialize(void);
#else
# define ceva_netinitialize()
#endif
#ifdef CONFIG_USBDEV
void ceva_usbinitialize(void);
void ceva_usbuninitialize(void);
#else
# define ceva_usbinitialize()
# define ceva_usbuninitialize()
#endif
#ifdef CONFIG_HEAP_COLORATION
# define ceva_heap_color(start, size) memset(start, HEAP_COLOR, size)
#else
# define ceva_heap_color(start, size)
#endif
#ifdef CONFIG_STACK_COLORATION
size_t ceva_stack_check(uintptr_t alloc, size_t size);
void ceva_stack_color(void *stackbase, size_t nbytes);
#endif
#if defined(CONFIG_STACK_COLORATION) && \
defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
void ceva_color_intstack(void);
#else
# define ceva_color_intstack()
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif