* arch/mips/src/common/mips_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_MIPS_SRC_COMMON_MIPS_INTERNAL_H
#define __ARCH_MIPS_SRC_COMMON_MIPS_INTERNAL_H
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <nuttx/arch.h>
# include <stdint.h>
# include <stdbool.h>
#endif
* Pre-processor Definitions
****************************************************************************/
* and no other console device is specified, then a serial console is
* assumed.
*/
#ifndef CONFIG_DEV_CONSOLE
# undef USE_SERIALDRIVER
# undef USE_EARLYSERIALINIT
#else
# if defined(CONFIG_CONSOLE_SYSLOG)
# 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
#ifndef CONFIG_ARCH_INTERRUPTSTACK
# define CONFIG_ARCH_INTERRUPTSTACK 0
#endif
#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))
* only a referenced is passed to get the state from the TCB.
*/
#define mips_savestate(regs) mips_copystate(regs, up_current_regs())
#define mips_restorestate(regs) up_set_current_regs(regs)
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
typedef void (*mips_vector_t)(void);
#endif
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
* first address in DRAM after the loaded program+bss+idle stack. The end
* of the heap is CONFIG_RAM_END
*/
extern uint32_t g_idle_topstack;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
extern uint8_t g_intstackalloc[];
extern uint8_t g_intstacktop[];
#endif
extern uint8_t _stext[];
extern uint8_t _etext[];
extern const uint8_t _data_loaddr[];
extern uint8_t _sdata[];
extern uint8_t _edata[];
extern uint8_t _sbss[];
extern uint8_t _ebss[];
#ifdef CONFIG_ARCH_RAMFUNCS
extern uint8_t _sramfunc[];
extern uint8_t _eramfunc[];
extern uint8_t _ramfunc_loadaddr[];
extern uint8_t _ramfunc_sizeof[];
extern uint8_t _bmxdkpba_address[];
extern uint8_t _bmxdudba_address[];
extern uint8_t _bmxdupba_address[];
#endif
#endif
* Inline Functions
****************************************************************************/
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
* with chip-specific functions of the same name if needed. See also
* functions prototyped in include/nuttx/arch.h.
*/
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 mips_copystate(uint32_t *dest, uint32_t *src);
void mips_lowputs(const char *str);
uint32_t *mips_doirq(int irq, uint32_t *regs);
int mips_swint0(int irq, void *context, void *arg);
void mips_sigdeliver(void);
bool mips_pending_irq(int irq);
void mips_clrpend_irq(int irq);
void mips_clrpend_sw0(void);
#ifdef CONFIG_ARCH_DMA
void weak_function mips_dma_initialize(void);
#endif
#if CONFIG_MM_REGIONS > 1
void mips_addregion(void);
#else
# define mips_addregion()
#endif
void mips_lowputc(char ch);
#ifdef USE_EARLYSERIALINIT
void mips_earlyserialinit(void);
#endif
#ifdef USE_SERIALDRIVER
void mips_serialinit(void);
#endif
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
void mips_netinitialize(void);
#else
# define mips_netinitialize()
#endif
#ifdef CONFIG_USBDEV
void mips_usbinitialize(void);
void mips_usbuninitialize(void);
#else
# define mips_usbinitialize()
# define mips_usbuninitialize()
#endif
#endif
#endif