#else /* !OS_HOSTED */
#include <appconfig.h> /* CONFIG_KDEBUG_ASSERT_NO_TEXT */
- #include <cpu/cpu.h> /* CPU_HARVARD */
+ #include <cpu/attr.h> /* CPU_HARVARD */
/* These are implemented in drv/kdebug.c */
void kdbg_init(void);
*/
#include "kdebug_at91.h"
-#include <cpu/cpu.h>
#include <cfg/macros.h> /* for BV() */
#include <appconfig.h>
#include <hw_cpu.h> /* for CLOCK_FREQ */
DBGU_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_PAR_NO | US_NBSTOP_1;
/* Enable DBGU transmitter. */
DBGU_CR = BV(US_TXEN);
- /* Disable PIO on DGBU tx pin. */
- #if CPU_ARM_AT91SAM7S256
- PIOA_PDR = BV(10);
- PIOA_ASR = BV(10);
- #else
+ #if !CPU_ARM_AT91SAM7S256
#warning Check Debug Unit AT91 pins on datasheet!
#endif
+ /* Disable PIO on DGBU tx pin. */
+ PIOA_PDR = BV(10);
+ PIOA_ASR = BV(10);
#if 0 /* Disable Rx for now */
/* Enable DBGU receiver. */
DBGU_CR = BV(US_RXEN);
- /* Disable PIO on DGBU rx pin. */
- #if CPU_ARM_AT91SAM7S256
- PIOA_PDR = BV(9);
- PIOA_ASR = BV(9);
- #else
- #warning Check Debug pins on datasheet!
+ #if !CPU_ARM_AT91SAM7S256
+ #warning Check Debug Unit AT91 pins on datasheet!
#endif
+ /* Disable PIO on DGBU rx pin. */
+ PIOA_PDR = BV(9);
+ PIOA_ASR = BV(9);
+
#endif
#else
#error CONFIG_KDEBUG_PORT should be KDEBUG_PORT_DBGU
#include "sysirq_at91.h"
#include <io/arm.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
#include <cfg/module.h>
#include <cfg/macros.h>
#include <cfg/macros.h> // BV()
#include <cfg/module.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
/** HW dependent timer initialization */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2004 Giovanni Bajo
+ *
+ * -->
+ *
+ * \brief CPU-specific attributes.
+ *
+ * \author Giovanni Bajo <rasky@develer.com>
+ * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Stefano Fedrigo <aleph@develer.com>
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+#ifndef CPU_ATTR_H
+#define CPU_ATTR_H
+
+#include "detect.h"
+#include <cfg/compiler.h> /* for uintXX_t */
+#include <cfg/arch_config.h> /* ARCH_EMUL */
+
+
+/**
+ * \name Macros for determining CPU endianness.
+ * \{
+ */
+#define CPU_BIG_ENDIAN 0x1234
+#define CPU_LITTLE_ENDIAN 0x3412 /* Look twice, pal. This is not a bug. */
+/*\}*/
+
+/** Macro to include cpu-specific versions of the headers. */
+#define CPU_HEADER(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).h)
+
+/** Macro to include cpu-specific versions of implementation files. */
+#define CPU_CSOURCE(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).c)
+
+
+#if CPU_I196
+
+ #define NOP nop_instruction()
+
+ #define CPU_REG_BITS 16
+ #define CPU_REGS_CNT 16
+ #define CPU_STACK_GROWS_UPWARD 0
+ #define CPU_SP_ON_EMPTY_SLOT 0
+ #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
+ #define CPU_HARVARD 0
+
+#elif CPU_X86
+
+ #define NOP asm volatile ("nop")
+
+ #define CPU_REGS_CNT 7
+ #define CPU_SAVED_REGS_CNT 7
+ #define CPU_STACK_GROWS_UPWARD 0
+ #define CPU_SP_ON_EMPTY_SLOT 0
+ #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
+ #define CPU_HARVARD 0
+
+ #if CPU_X86_64
+ #define CPU_REG_BITS 64
+
+ #ifdef __WIN64__
+ /* WIN64 is an IL32-P64 weirdo. */
+ #define SIZEOF_LONG 4
+ #endif
+ #else
+ #define CPU_REG_BITS 32
+ #endif
+
+#elif CPU_ARM
+
+ /* Register counts include SREG too */
+ #define CPU_REG_BITS 32
+ #define CPU_REGS_CNT 16
+ #define CPU_SAVED_REGS_CNT 9
+ #define CPU_STACK_GROWS_UPWARD 0
+ #define CPU_SP_ON_EMPTY_SLOT 0
+ #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
+ #define CPU_HARVARD 0
+
+ #ifdef __IAR_SYSTEMS_ICC__
+ #define NOP __no_operation()
+ #else /* !__IAR_SYSTEMS_ICC__ */
+ #define NOP asm volatile ("mov r0,r0" ::)
+
+ /**
+ * Initialization value for registers in stack frame.
+ * The register index is not directly corrispondent to CPU
+ * register numbers, but is related to how are pushed to
+ * stack (\see asm_switch_context).
+ * Index (CPU_SAVED_REGS_CNT - 1) is the CPSR register,
+ * the initial value is set to:
+ * - All flags (N, Z, C, V) set to 0.
+ * - IRQ and FIQ enabled.
+ * - ARM state.
+ * - CPU in Supervisor Mode (SVC).
+ */
+ #define CPU_REG_INIT_VALUE(reg) (reg == (CPU_SAVED_REGS_CNT - 1) ? 0x13 : 0)
+
+ #endif /* !__IAR_SYSTEMS_ICC_ */
+
+#elif CPU_PPC
+ #define NOP asm volatile ("nop" ::)
+
+ /* Register counts include SREG too */
+ #define CPU_REG_BITS (CPU_PPC32 ? 32 : 64)
+ #define CPU_REGS_CNT FIXME
+ #define CPU_SAVED_REGS_CNT FIXME
+ #define CPU_STACK_GROWS_UPWARD 0 //FIXME
+ #define CPU_SP_ON_EMPTY_SLOT 0 //FIXME
+ #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
+ #define CPU_HARVARD 0
+
+#elif CPU_DSP56K
+
+ #define NOP asm(nop)
+
+ #define CPU_REG_BITS 16
+ #define CPU_REGS_CNT FIXME
+ #define CPU_SAVED_REGS_CNT 8
+ #define CPU_STACK_GROWS_UPWARD 1
+ #define CPU_SP_ON_EMPTY_SLOT 0
+ #define CPU_BYTE_ORDER CPU_BIG_ENDIAN
+ #define CPU_HARVARD 1
+
+ /* Memory is word-addessed in the DSP56K */
+ #define CPU_BITS_PER_CHAR 16
+ #define SIZEOF_SHORT 1
+ #define SIZEOF_INT 1
+ #define SIZEOF_LONG 2
+ #define SIZEOF_PTR 1
+
+#elif CPU_AVR
+
+ #define NOP asm volatile ("nop" ::)
+
+ /* Register counts include SREG too */
+ #define CPU_REG_BITS 8
+ #define CPU_REGS_CNT 33
+ #define CPU_SAVED_REGS_CNT 19
+ #define CPU_STACK_GROWS_UPWARD 0
+ #define CPU_SP_ON_EMPTY_SLOT 1
+ #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
+ #define CPU_HARVARD 1
+
+ /**
+ * Initialization value for registers in stack frame.
+ * The register index is not directly corrispondent to CPU
+ * register numbers. Index 0 is the SREG register: the initial
+ * value is all 0 but the interrupt bit (bit 7).
+ */
+ #define CPU_REG_INIT_VALUE(reg) (reg == 0 ? 0x80 : 0)
+
+#else
+ #error No CPU_... defined.
+#endif
+
+/// Default for macro not defined in the right arch section
+#ifndef CPU_REG_INIT_VALUE
+ #define CPU_REG_INIT_VALUE(reg) 0
+#endif
+
+
+#ifndef CPU_STACK_GROWS_UPWARD
+ #error CPU_STACK_GROWS_UPWARD should have been defined to either 0 or 1
+#endif
+
+#ifndef CPU_SP_ON_EMPTY_SLOT
+ #error CPU_SP_ON_EMPTY_SLOT should have been defined to either 0 or 1
+#endif
+
+/*
+ * Support stack handling peculiarities of a few CPUs.
+ *
+ * Most processors let their stack grow downward and
+ * keep SP pointing at the last pushed value.
+ */
+#if !CPU_STACK_GROWS_UPWARD
+ #if !CPU_SP_ON_EMPTY_SLOT
+ /* Most microprocessors (x86, m68k...) */
+ #define CPU_PUSH_WORD(sp, data) \
+ do { *--(sp) = (data); } while (0)
+ #define CPU_POP_WORD(sp) \
+ (*(sp)++)
+ #else
+ /* AVR insanity */
+ #define CPU_PUSH_WORD(sp, data) \
+ do { *(sp)-- = (data); } while (0)
+ #define CPU_POP_WORD(sp) \
+ (*++(sp))
+ #endif
+
+#else /* CPU_STACK_GROWS_UPWARD */
+
+ #if !CPU_SP_ON_EMPTY_SLOT
+ /* DSP56K and other weirdos */
+ #define CPU_PUSH_WORD(sp, data) \
+ do { *++(sp) = (cpustack_t)(data); } while (0)
+ #define CPU_POP_WORD(sp) \
+ (*(sp)--)
+ #else
+ #error I bet you cannot find a CPU like this
+ #endif
+#endif
+
+
+#if CPU_DSP56K
+ /*
+ * DSP56k pushes both PC and SR to the stack in the JSR instruction, but
+ * RTS discards SR while returning (it does not restore it). So we push
+ * 0 to fake the same context.
+ */
+ #define CPU_PUSH_CALL_CONTEXT(sp, func) \
+ do { \
+ CPU_PUSH_WORD((sp), (func)); \
+ CPU_PUSH_WORD((sp), 0x100); \
+ } while (0);
+
+#elif CPU_AVR
+ /*
+ * In AVR, the addresses are pushed into the stack as little-endian, while
+ * memory accesses are big-endian (actually, it's a 8-bit CPU, so there is
+ * no natural endianess).
+ */
+ #define CPU_PUSH_CALL_CONTEXT(sp, func) \
+ do { \
+ uint16_t funcaddr = (uint16_t)(func); \
+ CPU_PUSH_WORD((sp), funcaddr); \
+ CPU_PUSH_WORD((sp), funcaddr>>8); \
+ } while (0)
+
+#else
+ #define CPU_PUSH_CALL_CONTEXT(sp, func) \
+ CPU_PUSH_WORD((sp), (cpustack_t)(func))
+#endif
+
+/**
+ * \def CPU_IDLE
+ *
+ * \brief Invoked by the scheduler to stop the CPU when idle.
+ *
+ * This hook can be redefined to put the CPU in low-power mode, or to
+ * profile system load with an external strobe, or to save CPU cycles
+ * in hosted environments such as emulators.
+ */
+#ifndef CPU_IDLE
+ #if defined(ARCH_EMUL) && (ARCH & ARCH_EMUL)
+ /* This emulator hook should yield the CPU to the host. */
+ EXTERN_C_BEGIN
+ void emul_idle(void);
+ EXTERN_C_END
+ #define CPU_IDLE emul_idle()
+ #else /* !ARCH_EMUL */
+ #define CPU_IDLE do { /* nothing */ } while (0)
+ #endif /* !ARCH_EMUL */
+#endif /* !CPU_IDLE */
+
+#endif /* CPU_ATTR_H */
#include <cfg/macros.h> // MIN()
#include <cfg/compiler.h>
#include <cfg/debug.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
#include <drv/wdt.h>
* \author Francesco Sacchi <batt@develer.com>
*/
-#include <cpu/cpu.h>
+#include <cpu/types.h>
+#include <cpu/attr.h>
#include <cfg/macros.h> /* for BV() */
#include <appconfig.h>
#include <hw_cpu.h> /* for CLOCK_FREQ */
* \brief Displaytech 32122A LCD driver
*/
-/*#*
- *#* $Log$
- *#* Revision 1.5 2006/07/19 12:56:25 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.4 2006/04/27 05:40:11 bernie
- *#* Naming convention fixes; Partial merge from project_grl.
- *#*
- *#* Revision 1.3 2006/02/10 12:35:31 bernie
- *#* Enforce CONFIG_* definitions.
- *#*
- *#* Revision 1.2 2006/01/23 23:11:27 bernie
- *#* Use RASTER_SIZE() to compute... err... the raster size.
- *#*
- *#* Revision 1.1 2006/01/16 03:50:57 bernie
- *#* Import into DevLib.
- *#*
- *#*/
-
#include "lcd_32122a_avr.h"
#include <gfx/gfx.h>
#include <drv/timer.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
#include <hw.h>
#include <cfg/macros.h> /* BV() */
#include <cfg/debug.h>
* \brief Low-level timer module for AVR (implementation).
*/
-/*#*
- *#* $Log$
- *#* Revision 1.6 2007/06/07 14:35:12 batt
- *#* Merge from project_ks.
- *#*
- *#* Revision 1.5 2007/03/21 11:03:56 batt
- *#* Add missing support for ATMega1281.
- *#*
- *#* Revision 1.4 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.3 2006/06/12 21:37:02 marco
- *#* implemented some commands (ver and sleep)
- *#*
- *#* Revision 1.2 2006/05/18 00:37:58 bernie
- *#* Don't include unneeded header hw.h.
- *#*
- *#* Revision 1.1 2005/07/19 07:28:36 bernie
- *#* Refactor to decouple timer ticks from milliseconds.
- *#*
- *#* Revision 1.1 2005/05/24 09:17:58 batt
- *#* Move drivers to top-level.
- *#*
- *#*/
#include <drv/timer_avr.h>
#include <cfg/macros.h> // BV()
-#include <cpu/cpu.h>
+#include <cpu/types.h>
+#include <cpu/irq.h>
#include <avr/interrupt.h>
#include <avr/io.h>
* \author Bernardo Innocenti <bernie@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.8 2007/06/07 14:35:12 batt
- *#* Merge from project_ks.
- *#*
- *#* Revision 1.7 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.6 2006/03/20 17:49:50 bernie
- *#* Make the TWI driver more generic to work with devices other than EEPROMS.
- *#*
- *#* Revision 1.5 2005/11/27 23:33:40 bernie
- *#* Use appconfig.h instead of cfg/config.h.
- *#*
- *#* Revision 1.4 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.3 2005/03/01 23:26:00 bernie
- *#* Header fix.
- *#*
- *#* Revision 1.2 2005/01/25 08:36:56 bernie
- *#* CONFIG_TWI_FREQ: New config param.
- *#*
- *#* Revision 1.1 2005/01/06 16:09:40 aleph
- *#* Split twi/eeprom functions from eeprom module in separate twi module
- *#*
- *#*/
-
#include "twi.h"
#include <cfg/debug.h>
-#include <cpu/cpu.h>
+#include <cpu/detect.h>
+#include <cpu/irq.h>
#include <cfg/macros.h> // BV()
#include <hw_cpu.h> /* CLOCK_FREQ */
#include <appconfig.h>
+++ /dev/null
-/**
- * \file
- * <!--
- * This file is part of BeRTOS.
- *
- * Bertos is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * As a special exception, you may use this file as part of a free software
- * library without restriction. Specifically, if other files instantiate
- * templates or use macros or inline functions from this file, or you compile
- * this file and link it with other files to produce an executable, this
- * file does not by itself cause the resulting executable to be covered by
- * the GNU General Public License. This exception does not however
- * invalidate any other reasons why the executable file might be covered by
- * the GNU General Public License.
- *
- * Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
- * Copyright 2004 Giovanni Bajo
- *
- * -->
- *
- * \brief CPU-specific definitions
- *
- * \author Giovanni Bajo <rasky@develer.com>
- * \author Bernardo Innocenti <bernie@develer.com>
- * \author Stefano Fedrigo <aleph@develer.com>
- * \author Francesco Sacchi <batt@develer.com>
- */
-#ifndef CPU_CPU_H
-#define CPU_CPU_H
-
-#include "detect.h"
-#include <cfg/compiler.h> /* for uintXX_t */
-#include <cfg/arch_config.h> /* ARCH_EMUL */
-
-
-/**
- * \name Macros for determining CPU endianness.
- * \{
- */
-#define CPU_BIG_ENDIAN 0x1234
-#define CPU_LITTLE_ENDIAN 0x3412 /* Look twice, pal. This is not a bug. */
-/*\}*/
-
-/** Macro to include cpu-specific versions of the headers. */
-#define CPU_HEADER(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).h)
-
-/** Macro to include cpu-specific versions of implementation files. */
-#define CPU_CSOURCE(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).c)
-
-
-#if CPU_I196
-
- #define NOP nop_instruction()
- #define IRQ_DISABLE disable_interrupt()
- #define IRQ_ENABLE enable_interrupt()
-
- typedef uint16_t cpuflags_t; // FIXME
- typedef unsigned int cpustack_t;
-
- #define CPU_REG_BITS 16
- #define CPU_REGS_CNT 16
- #define CPU_STACK_GROWS_UPWARD 0
- #define CPU_SP_ON_EMPTY_SLOT 0
- #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
- #define CPU_HARVARD 0
-
-#elif CPU_X86
-
- #define NOP asm volatile ("nop")
-
- /* Get IRQ_* definitions from the hosting environment. */
- #include <cfg/os.h>
- #if OS_EMBEDDED
- #define IRQ_DISABLE FIXME
- #define IRQ_ENABLE FIXME
- #define IRQ_SAVE_DISABLE(x) FIXME
- #define IRQ_RESTORE(x) FIXME
- typedef uint32_t cpuflags_t; // FIXME
- #endif /* OS_EMBEDDED */
-
-
- #define CPU_REGS_CNT 7
- #define CPU_SAVED_REGS_CNT 7
- #define CPU_STACK_GROWS_UPWARD 0
- #define CPU_SP_ON_EMPTY_SLOT 0
- #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
- #define CPU_HARVARD 0
-
- #if CPU_X86_64
- typedef uint64_t cpustack_t;
- #define CPU_REG_BITS 64
-
- #ifdef __WIN64__
- /* WIN64 is an IL32-P64 weirdo. */
- #define SIZEOF_LONG 4
- #endif
- #else
- typedef uint32_t cpustack_t;
- #define CPU_REG_BITS 32
- #endif
-
-#elif CPU_ARM
-
- typedef uint32_t cpuflags_t;
- typedef uint32_t cpustack_t;
-
- /* Register counts include SREG too */
- #define CPU_REG_BITS 32
- #define CPU_REGS_CNT 16
- #define CPU_SAVED_REGS_CNT 9
- #define CPU_STACK_GROWS_UPWARD 0
- #define CPU_SP_ON_EMPTY_SLOT 0
- #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
- #define CPU_HARVARD 0
-
- #ifdef __IAR_SYSTEMS_ICC__
-
- #include <inarm.h>
-
- #if __CPU_MODE__ == 1 /* Thumb */
- /* Use stubs */
- extern cpuflags_t get_CPSR(void);
- extern void set_CPSR(cpuflags_t flags);
- #else
- #define get_CPSR __get_CPSR
- #define set_CPSR __set_CPSR
- #endif
-
- #define NOP __no_operation()
- #define IRQ_DISABLE __disable_interrupt()
- #define IRQ_ENABLE __enable_interrupt()
-
- #define IRQ_SAVE_DISABLE(x) \
- do { \
- (x) = get_CPSR(); \
- __disable_interrupt(); \
- } while (0)
-
- #define IRQ_RESTORE(x) \
- do { \
- set_CPSR(x); \
- } while (0)
-
- #define IRQ_ENABLED() \
- ((bool)(get_CPSR() & 0xb0))
-
- #define BREAKPOINT /* asm("bkpt 0") DOES NOT WORK */
-
- #else /* !__IAR_SYSTEMS_ICC__ */
- #define NOP asm volatile ("mov r0,r0" ::)
-
- #define IRQ_DISABLE \
- do { \
- asm volatile ( \
- "mrs r0, cpsr\n\t" \
- "orr r0, r0, #0xc0\n\t" \
- "msr cpsr_c, r0" \
- ::: "r0" \
- ); \
- } while (0)
-
- #define IRQ_ENABLE \
- do { \
- asm volatile ( \
- "mrs r0, cpsr\n\t" \
- "bic r0, r0, #0xc0\n\t" \
- "msr cpsr_c, r0" \
- ::: "r0" \
- ); \
- } while (0)
-
- #define IRQ_SAVE_DISABLE(x) \
- do { \
- asm volatile ( \
- "mrs %0, cpsr\n\t" \
- "orr r0, %0, #0xc0\n\t" \
- "msr cpsr_c, r0" \
- : "=r" (x) \
- : /* no inputs */ \
- : "r0" \
- ); \
- } while (0)
-
- #define IRQ_RESTORE(x) \
- do { \
- asm volatile ( \
- "msr cpsr_c, %0" \
- : /* no outputs */ \
- : "r" (x) \
- ); \
- } while (0)
-
- #define CPU_READ_FLAGS() \
- ({ \
- cpuflags_t sreg; \
- asm volatile ( \
- "mrs %0, cpsr\n\t" \
- : "=r" (sreg) \
- : /* no inputs */ \
- ); \
- sreg; \
- })
-
- #define IRQ_ENABLED() ((CPU_READ_FLAGS() & 0xc0) != 0xc0)
-
- /**
- * Initialization value for registers in stack frame.
- * The register index is not directly corrispondent to CPU
- * register numbers, but is related to how are pushed to
- * stack (\see asm_switch_context).
- * Index (CPU_SAVED_REGS_CNT - 1) is the CPSR register,
- * the initial value is set to:
- * - All flags (N, Z, C, V) set to 0.
- * - IRQ and FIQ enabled.
- * - ARM state.
- * - CPU in Supervisor Mode (SVC).
- */
- #define CPU_REG_INIT_VALUE(reg) (reg == (CPU_SAVED_REGS_CNT - 1) ? 0x13 : 0)
-
- #endif /* !__IAR_SYSTEMS_ICC_ */
-
-#elif CPU_PPC
- #define NOP asm volatile ("nop" ::)
-
- #define IRQ_DISABLE FIXME
- #define IRQ_ENABLE FIXME
- #define IRQ_SAVE_DISABLE(x) FIXME
- #define IRQ_RESTORE(x) FIXME
- #define IRQ_ENABLED() FIXME
-
- typedef uint32_t cpuflags_t; // FIXME
- typedef uint32_t cpustack_t; // FIXME
-
- /* Register counts include SREG too */
- #define CPU_REG_BITS (CPU_PPC32 ? 32 : 64)
- #define CPU_REGS_CNT FIXME
- #define CPU_SAVED_REGS_CNT FIXME
- #define CPU_STACK_GROWS_UPWARD 0 //FIXME
- #define CPU_SP_ON_EMPTY_SLOT 0 //FIXME
- #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
- #define CPU_HARVARD 0
-
-#elif CPU_DSP56K
-
- #define NOP asm(nop)
- #define BREAKPOINT asm(debug)
- #define IRQ_DISABLE do { asm(bfset #0x0200,SR); asm(nop); } while (0)
- #define IRQ_ENABLE do { asm(bfclr #0x0200,SR); asm(nop); } while (0)
-
- #define IRQ_SAVE_DISABLE(x) \
- do { (void)x; asm(move SR,x); asm(bfset #0x0200,SR); } while (0)
- #define IRQ_RESTORE(x) \
- do { (void)x; asm(move x,SR); } while (0)
-
- static inline bool irq_running(void)
- {
- extern void *user_sp;
- return !!user_sp;
- }
- #define IRQ_RUNNING() irq_running()
-
- static inline bool irq_enabled(void)
- {
- uint16_t x;
- asm(move SR,x);
- return !(x & 0x0200);
- }
- #define IRQ_ENABLED() irq_enabled()
-
- typedef uint16_t cpuflags_t;
- typedef unsigned int cpustack_t;
-
- #define CPU_REG_BITS 16
- #define CPU_REGS_CNT FIXME
- #define CPU_SAVED_REGS_CNT 8
- #define CPU_STACK_GROWS_UPWARD 1
- #define CPU_SP_ON_EMPTY_SLOT 0
- #define CPU_BYTE_ORDER CPU_BIG_ENDIAN
- #define CPU_HARVARD 1
-
- /* Memory is word-addessed in the DSP56K */
- #define CPU_BITS_PER_CHAR 16
- #define SIZEOF_SHORT 1
- #define SIZEOF_INT 1
- #define SIZEOF_LONG 2
- #define SIZEOF_PTR 1
-
-#elif CPU_AVR
-
- #define NOP asm volatile ("nop" ::)
- #define IRQ_DISABLE asm volatile ("cli" ::)
- #define IRQ_ENABLE asm volatile ("sei" ::)
-
- #define IRQ_SAVE_DISABLE(x) \
- do { \
- __asm__ __volatile__( \
- "in %0,__SREG__\n\t" \
- "cli" \
- : "=r" (x) : /* no inputs */ : "cc" \
- ); \
- } while (0)
-
- #define IRQ_RESTORE(x) \
- do { \
- __asm__ __volatile__( \
- "out __SREG__,%0" : /* no outputs */ : "r" (x) : "cc" \
- ); \
- } while (0)
-
- #define IRQ_ENABLED() \
- ({ \
- uint8_t sreg; \
- __asm__ __volatile__( \
- "in %0,__SREG__\n\t" \
- : "=r" (sreg) /* no inputs & no clobbers */ \
- ); \
- (bool)(sreg & 0x80); \
- })
-
- typedef uint8_t cpuflags_t;
- typedef uint8_t cpustack_t;
-
- /* Register counts include SREG too */
- #define CPU_REG_BITS 8
- #define CPU_REGS_CNT 33
- #define CPU_SAVED_REGS_CNT 19
- #define CPU_STACK_GROWS_UPWARD 0
- #define CPU_SP_ON_EMPTY_SLOT 1
- #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
- #define CPU_HARVARD 1
-
- /**
- * Initialization value for registers in stack frame.
- * The register index is not directly corrispondent to CPU
- * register numbers. Index 0 is the SREG register: the initial
- * value is all 0 but the interrupt bit (bit 7).
- */
- #define CPU_REG_INIT_VALUE(reg) (reg == 0 ? 0x80 : 0)
-
-#else
- #error No CPU_... defined.
-#endif
-
-/**
- * Execute \a CODE atomically with respect to interrupts.
- *
- * \see IRQ_SAVE_DISABLE IRQ_RESTORE
- */
-#define ATOMIC(CODE) \
- do { \
- cpuflags_t __flags; \
- IRQ_SAVE_DISABLE(__flags); \
- CODE; \
- IRQ_RESTORE(__flags); \
- } while (0)
-
-
-/// Default for macro not defined in the right arch section
-#ifndef CPU_REG_INIT_VALUE
- #define CPU_REG_INIT_VALUE(reg) 0
-#endif
-
-
-#ifndef CPU_STACK_GROWS_UPWARD
- #error CPU_STACK_GROWS_UPWARD should have been defined to either 0 or 1
-#endif
-
-#ifndef CPU_SP_ON_EMPTY_SLOT
- #error CPU_SP_ON_EMPTY_SLOT should have been defined to either 0 or 1
-#endif
-
-/*
- * Support stack handling peculiarities of a few CPUs.
- *
- * Most processors let their stack grow downward and
- * keep SP pointing at the last pushed value.
- */
-#if !CPU_STACK_GROWS_UPWARD
- #if !CPU_SP_ON_EMPTY_SLOT
- /* Most microprocessors (x86, m68k...) */
- #define CPU_PUSH_WORD(sp, data) \
- do { *--(sp) = (data); } while (0)
- #define CPU_POP_WORD(sp) \
- (*(sp)++)
- #else
- /* AVR insanity */
- #define CPU_PUSH_WORD(sp, data) \
- do { *(sp)-- = (data); } while (0)
- #define CPU_POP_WORD(sp) \
- (*++(sp))
- #endif
-
-#else /* CPU_STACK_GROWS_UPWARD */
-
- #if !CPU_SP_ON_EMPTY_SLOT
- /* DSP56K and other weirdos */
- #define CPU_PUSH_WORD(sp, data) \
- do { *++(sp) = (cpustack_t)(data); } while (0)
- #define CPU_POP_WORD(sp) \
- (*(sp)--)
- #else
- #error I bet you cannot find a CPU like this
- #endif
-#endif
-
-
-#if CPU_DSP56K
- /*
- * DSP56k pushes both PC and SR to the stack in the JSR instruction, but
- * RTS discards SR while returning (it does not restore it). So we push
- * 0 to fake the same context.
- */
- #define CPU_PUSH_CALL_CONTEXT(sp, func) \
- do { \
- CPU_PUSH_WORD((sp), (func)); \
- CPU_PUSH_WORD((sp), 0x100); \
- } while (0);
-
-#elif CPU_AVR
- /*
- * In AVR, the addresses are pushed into the stack as little-endian, while
- * memory accesses are big-endian (actually, it's a 8-bit CPU, so there is
- * no natural endianess).
- */
- #define CPU_PUSH_CALL_CONTEXT(sp, func) \
- do { \
- uint16_t funcaddr = (uint16_t)(func); \
- CPU_PUSH_WORD((sp), funcaddr); \
- CPU_PUSH_WORD((sp), funcaddr>>8); \
- } while (0)
-
-#else
- #define CPU_PUSH_CALL_CONTEXT(sp, func) \
- CPU_PUSH_WORD((sp), (cpustack_t)(func))
-#endif
-
-
-/**
- * \name Default type sizes.
- *
- * These defaults are reasonable for most 16/32bit machines.
- * Some of these macros may be overridden by CPU-specific code above.
- *
- * ANSI C requires that the following equations be true:
- * \code
- * sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
- * sizeof(float) <= sizeof(double)
- * CPU_BITS_PER_CHAR >= 8
- * CPU_BITS_PER_SHORT >= 8
- * CPU_BITS_PER_INT >= 16
- * CPU_BITS_PER_LONG >= 32
- * \endcode
- * \{
- */
-#ifndef SIZEOF_CHAR
-#define SIZEOF_CHAR 1
-#endif
-
-#ifndef SIZEOF_SHORT
-#define SIZEOF_SHORT 2
-#endif
-
-#ifndef SIZEOF_INT
-#if CPU_REG_BITS < 32
- #define SIZEOF_INT 2
-#else
- #define SIZEOF_INT 4
-#endif
-#endif /* !SIZEOF_INT */
-
-#ifndef SIZEOF_LONG
-#if CPU_REG_BITS > 32
- #define SIZEOF_LONG 8
-#else
- #define SIZEOF_LONG 4
-#endif
-#endif
-
-#ifndef SIZEOF_PTR
-#if CPU_REG_BITS < 32
- #define SIZEOF_PTR 2
-#elif CPU_REG_BITS == 32
- #define SIZEOF_PTR 4
-#else /* CPU_REG_BITS > 32 */
- #define SIZEOF_PTR 8
-#endif
-#endif
-
-#ifndef CPU_BITS_PER_CHAR
-#define CPU_BITS_PER_CHAR (SIZEOF_CHAR * 8)
-#endif
-
-#ifndef CPU_BITS_PER_SHORT
-#define CPU_BITS_PER_SHORT (SIZEOF_SHORT * CPU_BITS_PER_CHAR)
-#endif
-
-#ifndef CPU_BITS_PER_INT
-#define CPU_BITS_PER_INT (SIZEOF_INT * CPU_BITS_PER_CHAR)
-#endif
-
-#ifndef CPU_BITS_PER_LONG
-#define CPU_BITS_PER_LONG (SIZEOF_LONG * CPU_BITS_PER_CHAR)
-#endif
-
-#ifndef CPU_BITS_PER_PTR
-#define CPU_BITS_PER_PTR (SIZEOF_PTR * CPU_BITS_PER_CHAR)
-#endif
-
-#ifndef BREAKPOINT
-#define BREAKPOINT /* nop */
-#endif
-
-/*\}*/
-
-/* Sanity checks for the above definitions */
-STATIC_ASSERT(sizeof(char) == SIZEOF_CHAR);
-STATIC_ASSERT(sizeof(short) == SIZEOF_SHORT);
-STATIC_ASSERT(sizeof(long) == SIZEOF_LONG);
-STATIC_ASSERT(sizeof(int) == SIZEOF_INT);
-STATIC_ASSERT(sizeof(void *) == SIZEOF_PTR);
-STATIC_ASSERT(sizeof(int8_t) * CPU_BITS_PER_CHAR == 8);
-STATIC_ASSERT(sizeof(uint8_t) * CPU_BITS_PER_CHAR == 8);
-STATIC_ASSERT(sizeof(int16_t) * CPU_BITS_PER_CHAR == 16);
-STATIC_ASSERT(sizeof(uint16_t) * CPU_BITS_PER_CHAR == 16);
-STATIC_ASSERT(sizeof(int32_t) * CPU_BITS_PER_CHAR == 32);
-STATIC_ASSERT(sizeof(uint32_t) * CPU_BITS_PER_CHAR == 32);
-#ifdef __HAS_INT64_T__
-STATIC_ASSERT(sizeof(int64_t) * CPU_BITS_PER_CHAR == 64);
-STATIC_ASSERT(sizeof(uint64_t) * CPU_BITS_PER_CHAR == 64);
-#endif
-
-/**
- * \def CPU_IDLE
- *
- * \brief Invoked by the scheduler to stop the CPU when idle.
- *
- * This hook can be redefined to put the CPU in low-power mode, or to
- * profile system load with an external strobe, or to save CPU cycles
- * in hosted environments such as emulators.
- */
-#ifndef CPU_IDLE
- #if defined(ARCH_EMUL) && (ARCH & ARCH_EMUL)
- /* This emulator hook should yield the CPU to the host. */
- EXTERN_C_BEGIN
- void emul_idle(void);
- EXTERN_C_END
- #define CPU_IDLE emul_idle()
- #else /* !ARCH_EMUL */
- #define CPU_IDLE do { /* nothing */ } while (0)
- #endif /* !ARCH_EMUL */
-#endif /* !CPU_IDLE */
-
-#endif /* CPU_CPU_H */
#error Revise me!
#include <cfg/debug.h>
-#include <cpu/cpu.h>
#include <cfg/macros.h> /* for BV() */
#include <appconfig.h>
#include <hw_cpu.h> /* for CLOCK_FREQ */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2004 Giovanni Bajo
+ *
+ * -->
+ *
+ * \brief CPU-specific IRQ definitions.
+ *
+ * \author Giovanni Bajo <rasky@develer.com>
+ * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Stefano Fedrigo <aleph@develer.com>
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+#ifndef CPU_IRQ_H
+#define CPU_IRQ_H
+
+#include "detect.h"
+#include "types.h"
+
+#include <cfg/compiler.h> /* for uintXX_t */
+
+#if CPU_I196
+ #define IRQ_DISABLE disable_interrupt()
+ #define IRQ_ENABLE enable_interrupt()
+#elif CPU_X86
+
+ /* Get IRQ_* definitions from the hosting environment. */
+ #include <cfg/os.h>
+ #if OS_EMBEDDED
+ #define IRQ_DISABLE FIXME
+ #define IRQ_ENABLE FIXME
+ #define IRQ_SAVE_DISABLE(x) FIXME
+ #define IRQ_RESTORE(x) FIXME
+ #endif /* OS_EMBEDDED */
+
+#elif CPU_ARM
+
+
+ #ifdef __IAR_SYSTEMS_ICC__
+
+ #include <inarm.h>
+
+ #if __CPU_MODE__ == 1 /* Thumb */
+ /* Use stubs */
+ extern cpuflags_t get_CPSR(void);
+ extern void set_CPSR(cpuflags_t flags);
+ #else
+ #define get_CPSR __get_CPSR
+ #define set_CPSR __set_CPSR
+ #endif
+
+ #define IRQ_DISABLE __disable_interrupt()
+ #define IRQ_ENABLE __enable_interrupt()
+
+ #define IRQ_SAVE_DISABLE(x) \
+ do { \
+ (x) = get_CPSR(); \
+ __disable_interrupt(); \
+ } while (0)
+
+ #define IRQ_RESTORE(x) \
+ do { \
+ set_CPSR(x); \
+ } while (0)
+
+ #define IRQ_ENABLED() \
+ ((bool)(get_CPSR() & 0xb0))
+
+ #define BREAKPOINT /* asm("bkpt 0") DOES NOT WORK */
+
+ #else /* !__IAR_SYSTEMS_ICC__ */
+
+ #define IRQ_DISABLE \
+ do { \
+ asm volatile ( \
+ "mrs r0, cpsr\n\t" \
+ "orr r0, r0, #0xc0\n\t" \
+ "msr cpsr_c, r0" \
+ ::: "r0" \
+ ); \
+ } while (0)
+
+ #define IRQ_ENABLE \
+ do { \
+ asm volatile ( \
+ "mrs r0, cpsr\n\t" \
+ "bic r0, r0, #0xc0\n\t" \
+ "msr cpsr_c, r0" \
+ ::: "r0" \
+ ); \
+ } while (0)
+
+ #define IRQ_SAVE_DISABLE(x) \
+ do { \
+ asm volatile ( \
+ "mrs %0, cpsr\n\t" \
+ "orr r0, %0, #0xc0\n\t" \
+ "msr cpsr_c, r0" \
+ : "=r" (x) \
+ : /* no inputs */ \
+ : "r0" \
+ ); \
+ } while (0)
+
+ #define IRQ_RESTORE(x) \
+ do { \
+ asm volatile ( \
+ "msr cpsr_c, %0" \
+ : /* no outputs */ \
+ : "r" (x) \
+ ); \
+ } while (0)
+
+ #define CPU_READ_FLAGS() \
+ ({ \
+ cpuflags_t sreg; \
+ asm volatile ( \
+ "mrs %0, cpsr\n\t" \
+ : "=r" (sreg) \
+ : /* no inputs */ \
+ ); \
+ sreg; \
+ })
+
+ #define IRQ_ENABLED() ((CPU_READ_FLAGS() & 0xc0) != 0xc0)
+
+ #endif /* !__IAR_SYSTEMS_ICC_ */
+
+#elif CPU_PPC
+ #define IRQ_DISABLE FIXME
+ #define IRQ_ENABLE FIXME
+ #define IRQ_SAVE_DISABLE(x) FIXME
+ #define IRQ_RESTORE(x) FIXME
+ #define IRQ_ENABLED() FIXME
+
+#elif CPU_DSP56K
+
+ #define BREAKPOINT asm(debug)
+ #define IRQ_DISABLE do { asm(bfset #0x0200,SR); asm(nop); } while (0)
+ #define IRQ_ENABLE do { asm(bfclr #0x0200,SR); asm(nop); } while (0)
+
+ #define IRQ_SAVE_DISABLE(x) \
+ do { (void)x; asm(move SR,x); asm(bfset #0x0200,SR); } while (0)
+ #define IRQ_RESTORE(x) \
+ do { (void)x; asm(move x,SR); } while (0)
+
+ static inline bool irq_running(void)
+ {
+ extern void *user_sp;
+ return !!user_sp;
+ }
+ #define IRQ_RUNNING() irq_running()
+
+ static inline bool irq_enabled(void)
+ {
+ uint16_t x;
+ asm(move SR,x);
+ return !(x & 0x0200);
+ }
+ #define IRQ_ENABLED() irq_enabled()
+
+#elif CPU_AVR
+
+ #define IRQ_DISABLE asm volatile ("cli" ::)
+ #define IRQ_ENABLE asm volatile ("sei" ::)
+
+ #define IRQ_SAVE_DISABLE(x) \
+ do { \
+ __asm__ __volatile__( \
+ "in %0,__SREG__\n\t" \
+ "cli" \
+ : "=r" (x) : /* no inputs */ : "cc" \
+ ); \
+ } while (0)
+
+ #define IRQ_RESTORE(x) \
+ do { \
+ __asm__ __volatile__( \
+ "out __SREG__,%0" : /* no outputs */ : "r" (x) : "cc" \
+ ); \
+ } while (0)
+
+ #define IRQ_ENABLED() \
+ ({ \
+ uint8_t sreg; \
+ __asm__ __volatile__( \
+ "in %0,__SREG__\n\t" \
+ : "=r" (sreg) /* no inputs & no clobbers */ \
+ ); \
+ (bool)(sreg & 0x80); \
+ })
+#else
+ #error No CPU_... defined.
+#endif
+
+/**
+ * Execute \a CODE atomically with respect to interrupts.
+ *
+ * \see IRQ_SAVE_DISABLE IRQ_RESTORE
+ */
+#define ATOMIC(CODE) \
+ do { \
+ cpuflags_t __flags; \
+ IRQ_SAVE_DISABLE(__flags); \
+ CODE; \
+ IRQ_RESTORE(__flags); \
+ } while (0)
+
+
+#ifndef BREAKPOINT
+#define BREAKPOINT /* nop */
+#endif
+
+
+#endif /* CPU_IRQ_H */
--- /dev/null
+/**
+ * \file
+ * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
+ * Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2004 Giovanni Bajo
+ *
+ * -->
+ *
+ * \brief CPU-specific type definitions.
+ *
+ * \author Giovanni Bajo <rasky@develer.com>
+ * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Stefano Fedrigo <aleph@develer.com>
+ * \author Francesco Sacchi <batt@develer.com>
+ */
+#ifndef CPU_TYPES_H
+#define CPU_TYPES_H
+
+#include "detect.h"
+#include "attr.h"
+#include <cfg/compiler.h> /* for uintXX_t */
+
+#if CPU_I196
+
+ typedef uint16_t cpuflags_t; // FIXME
+ typedef unsigned int cpustack_t;
+
+#elif CPU_X86
+
+ /* Get IRQ_* definitions from the hosting environment. */
+ #include <cfg/os.h>
+ #if OS_EMBEDDED
+ typedef uint32_t cpuflags_t; // FIXME
+ #endif /* OS_EMBEDDED */
+
+ #if CPU_X86_64
+ typedef uint64_t cpustack_t;
+ #else
+ typedef uint32_t cpustack_t;
+ #endif
+
+#elif CPU_ARM
+
+ typedef uint32_t cpuflags_t;
+ typedef uint32_t cpustack_t;
+
+#elif CPU_PPC
+
+ typedef uint32_t cpuflags_t; // FIXME
+ typedef uint32_t cpustack_t; // FIXME
+
+#elif CPU_DSP56K
+
+ typedef uint16_t cpuflags_t;
+ typedef unsigned int cpustack_t;
+
+#elif CPU_AVR
+
+ typedef uint8_t cpuflags_t;
+ typedef uint8_t cpustack_t;
+
+#else
+ #error No CPU_... defined.
+#endif
+
+/**
+ * \name Default type sizes.
+ *
+ * These defaults are reasonable for most 16/32bit machines.
+ * Some of these macros may be overridden by CPU-specific code above.
+ *
+ * ANSI C requires that the following equations be true:
+ * \code
+ * sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
+ * sizeof(float) <= sizeof(double)
+ * CPU_BITS_PER_CHAR >= 8
+ * CPU_BITS_PER_SHORT >= 8
+ * CPU_BITS_PER_INT >= 16
+ * CPU_BITS_PER_LONG >= 32
+ * \endcode
+ * \{
+ */
+#ifndef SIZEOF_CHAR
+#define SIZEOF_CHAR 1
+#endif
+
+#ifndef SIZEOF_SHORT
+#define SIZEOF_SHORT 2
+#endif
+
+#ifndef SIZEOF_INT
+#if CPU_REG_BITS < 32
+ #define SIZEOF_INT 2
+#else
+ #define SIZEOF_INT 4
+#endif
+#endif /* !SIZEOF_INT */
+
+#ifndef SIZEOF_LONG
+#if CPU_REG_BITS > 32
+ #define SIZEOF_LONG 8
+#else
+ #define SIZEOF_LONG 4
+#endif
+#endif
+
+#ifndef SIZEOF_PTR
+#if CPU_REG_BITS < 32
+ #define SIZEOF_PTR 2
+#elif CPU_REG_BITS == 32
+ #define SIZEOF_PTR 4
+#else /* CPU_REG_BITS > 32 */
+ #define SIZEOF_PTR 8
+#endif
+#endif
+
+#ifndef CPU_BITS_PER_CHAR
+#define CPU_BITS_PER_CHAR (SIZEOF_CHAR * 8)
+#endif
+
+#ifndef CPU_BITS_PER_SHORT
+#define CPU_BITS_PER_SHORT (SIZEOF_SHORT * CPU_BITS_PER_CHAR)
+#endif
+
+#ifndef CPU_BITS_PER_INT
+#define CPU_BITS_PER_INT (SIZEOF_INT * CPU_BITS_PER_CHAR)
+#endif
+
+#ifndef CPU_BITS_PER_LONG
+#define CPU_BITS_PER_LONG (SIZEOF_LONG * CPU_BITS_PER_CHAR)
+#endif
+
+#ifndef CPU_BITS_PER_PTR
+#define CPU_BITS_PER_PTR (SIZEOF_PTR * CPU_BITS_PER_CHAR)
+#endif
+
+
+/*\}*/
+
+/* Sanity checks for the above definitions */
+STATIC_ASSERT(sizeof(char) == SIZEOF_CHAR);
+STATIC_ASSERT(sizeof(short) == SIZEOF_SHORT);
+STATIC_ASSERT(sizeof(long) == SIZEOF_LONG);
+STATIC_ASSERT(sizeof(int) == SIZEOF_INT);
+STATIC_ASSERT(sizeof(void *) == SIZEOF_PTR);
+STATIC_ASSERT(sizeof(int8_t) * CPU_BITS_PER_CHAR == 8);
+STATIC_ASSERT(sizeof(uint8_t) * CPU_BITS_PER_CHAR == 8);
+STATIC_ASSERT(sizeof(int16_t) * CPU_BITS_PER_CHAR == 16);
+STATIC_ASSERT(sizeof(uint16_t) * CPU_BITS_PER_CHAR == 16);
+STATIC_ASSERT(sizeof(int32_t) * CPU_BITS_PER_CHAR == 32);
+STATIC_ASSERT(sizeof(uint32_t) * CPU_BITS_PER_CHAR == 32);
+#ifdef __HAS_INT64_T__
+STATIC_ASSERT(sizeof(int64_t) * CPU_BITS_PER_CHAR == 64);
+STATIC_ASSERT(sizeof(uint64_t) * CPU_BITS_PER_CHAR == 64);
+#endif
+
+
+#endif /* CPU_TYPES_H */
* \author Giovanni Bajo <rasky@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.8 2006/07/19 12:56:25 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.7 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.6 2005/04/11 19:10:27 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.5 2004/08/25 14:12:08 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.4 2004/07/30 14:15:53 rasky
- *#* Nuovo supporto unificato per detect della CPU
- *#*
- *#* Revision 1.3 2004/07/14 14:04:29 rasky
- *#* Merge da SC: spostata bld_set inline perché si ottimizza parecchio tramite propagazione di costanti
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#* Revision 1.1 2004/05/23 18:36:05 bernie
- *#* Import buzzerled driver.
- *#*
- *#*/
-
#ifndef DRV_BUZZERLED_H
#define DRV_BUZZERLED_H
-#include <cpu/cpu.h>
+#include <cpu/attr.h>
/** Include hw.h. We expect hw.h to define enum BLD_DEVICE, which must contain
* an enumarator for each device, plus a special symbol NUM_BLDS containing the
* \author Bernardo Innocenti <bernie@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.20 2006/07/19 12:56:25 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.19 2006/03/20 17:49:50 bernie
- *#* Make the TWI driver more generic to work with devices other than EEPROMS.
- *#*
- *#* Revision 1.18 2005/11/27 23:33:40 bernie
- *#* Use appconfig.h instead of cfg/config.h.
- *#*
- *#* Revision 1.17 2005/04/11 19:10:27 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.16 2005/03/01 23:25:09 bernie
- *#* Prune CVS log.
- *#*
- *#* Revision 1.11 2004/10/26 08:35:31 bernie
- *#* Reset watchdog for long operations.
- *#*
- *#* Revision 1.10 2004/09/20 03:31:22 bernie
- *#* Sanitize for C++.
- *#*
- *#* Revision 1.9 2004/09/14 21:03:46 bernie
- *#* Use debug.h instead of kdebug.h.
- *#*/
-
#include "eeprom.h"
#include <cfg/debug.h>
#include <appconfig.h> // CONFIG_EEPROM_VERIFY
#include <cfg/macros.h> // MIN()
-#include <cpu/cpu.h>
+#include <cpu/attr.h>
#include CPU_HEADER(twi)
#include <drv/wdt.h>
#include <mware/byteorder.h> // cpu_to_be16()
#include <cfg/debug.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/attr.h>
+#include <cpu/types.h>
#include <cfg/macros.h> /* for BV() */
#include <appconfig.h>
#include <hw_cpu.h> /* for CLOCK_FREQ */
#include <drv/timer.h>
#include <cfg/macros.h>
-#include <cpu/cpu.h>
#include <cfg/compiler.h>
#include <hw_mcp41.h>
* \author Francesco Sacchi <batt@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.2 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.1 2005/11/04 18:06:44 bernie
- *#* Import into DevLib.
- *#*
- *#* Revision 1.1 2005/05/24 09:17:58 batt
- *#* Move drivers to top-level.
- *#*
- *#* Revision 1.14 2005/05/20 12:21:05 batt
- *#* Reformat.
- *#*
- *#* Revision 1.13 2005/05/09 16:34:14 batt
- *#* Change some function names to accomplish coding standard; Add debug phase_initialized; Change duty_t and power_t to uint16_t.
- *#*
- *#* Revision 1.12 2005/05/04 17:22:30 batt
- *#* Workaround a Doxygen parsing problem.
- *#*
- *#* Revision 1.11 2005/05/02 09:05:03 batt
- *#* Rename duty_t and power_t in triac_duty_t and triac_power_t
- *#*
- *#* Revision 1.10 2005/05/02 08:48:55 batt
- *#* Disable interrupt only when necessary.
- *#*
- *#* Revision 1.9 2005/04/29 11:52:51 batt
- *#* Remove debug printf; Add a comment.
- *#*
- *#* Revision 1.8 2005/04/29 10:22:56 batt
- *#* Avoid retriggering TRIAC on low duty-cycle.
- *#*
- *#* Revision 1.7 2005/04/29 09:54:36 batt
- *#* Convert to new timer.
- *#*
- *#* Revision 1.6 2005/04/28 17:11:53 batt
- *#* Expand abbreviation.
- *#*
- *#* Revision 1.5 2005/04/28 15:10:11 batt
- *#* Use timer API to add and set events.
- *#*
- *#* Revision 1.4 2005/04/28 12:04:46 batt
- *#* Add some comments.
- *#*
- *#* Revision 1.3 2005/04/28 10:35:45 batt
- *#* Complete phase_setpower.
- *#*
- *#* Revision 1.2 2005/04/27 19:22:49 batt
- *#* Add duty_t, power_t, MAX_DUTY and MAX_POWER
- *#*
- *#* Revision 1.1 2005/04/27 17:13:56 batt
- *#* Add triac phase control driver.
- *#*
- *#*/
-
#include <drv/timer.h>
#include <cfg/macros.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
#include <cfg/compiler.h>
#include <hw_tc520.h>
#include <cfg/macros.h>
-#include <cpu/cpu.h>
#include <cfg/compiler.h>
#include <drv/ser.h>
*/
#include "timer.h"
-#include <cpu/cpu.h>
+
+#include <cpu/attr.h>
+#include <cpu/types.h>
+#include <cpu/irq.h>
+
#include <cfg/os.h>
#include <cfg/debug.h>
#include <cfg/module.h>
#define DRV_TIMER_H
#include <cfg/os.h>
-#include <cpu/cpu.h>
+#include <cpu/attr.h>
+#include <cpu/irq.h>
/*
* Include platform-specific binding header if we're hosted.
* \brief Watchdog interface
*/
-/*#*
- *#* $Log$
- *#* Revision 1.12 2007/06/07 14:35:12 batt
- *#* Merge from project_ks.
- *#*
- *#* Revision 1.11 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.10 2006/05/18 00:38:42 bernie
- *#* Work around missing ARCH_FREERTOS symbol.
- *#*
- *#* Revision 1.9 2006/03/22 09:49:09 bernie
- *#* Add FreeRTOS support.
- *#*
- *#* Revision 1.8 2006/02/20 02:02:29 bernie
- *#* Port to Qt 4.1.
- *#*
- *#* Revision 1.7 2005/11/27 03:58:40 bernie
- *#* Add POSIX timer emulator.
- *#*
- *#* Revision 1.6 2005/11/27 03:03:08 bernie
- *#* Add Qt support hack.
- *#*
- *#* Revision 1.5 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.4 2005/04/12 01:37:17 bernie
- *#* Prevent warning when watchdog is disabled.
- *#*
- *#* Revision 1.3 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.2 2004/11/16 21:02:07 bernie
- *#* Make driver optional; mark AVR specific parts as such.
- *#*
- *#* Revision 1.1 2004/10/26 08:34:47 bernie
- *#* New DevLib module.
- *#*
- *#*/
#ifndef DRV_WDT_H
#define DRV_WDT_H
#endif
#if CONFIG_WATCHDOG
- #include <cpu/cpu.h>
+ #include <cpu/detect.h>
#include <cfg/os.h>
#if OS_QT
#include "gfx_p.h"
#include <cfg/debug.h> /* ASSERT() */
-#include <cpu/cpu.h> /* CPU_HARVARD */
+#include <cpu/attr.h> /* CPU_HARVARD */
#include <cfg/macros.h> /* MIN() */
#include <appconfig.h> /* CONFIG_GFX_CLIPPING */
#define GFX_GFX_H
#include <cfg/compiler.h>
-#include <cpu/cpu.h> /* CPU_HARVARD */
+#include <cpu/attr.h> /* CPU_HARVARD */
#include <appconfig.h> /* CONFIG_GFX_* */
* \brief Line drawing graphics routines
*/
-/*#*
- *#* $Log$
- *#* Revision 1.4 2006/08/01 12:22:00 bernie
- *#* gfx_findRegion(): Only define when CONFIG_GFX_CLIPPING is enabled.
- *#*
- *#* Revision 1.3 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.2 2006/02/10 12:26:58 bernie
- *#* Check CONFIG_* constraints.
- *#*
- *#* Revision 1.1 2006/01/24 02:17:49 bernie
- *#* Split out gfx.c into bitmap.c and line.c.
- *#*
- *#*/
-
#include "gfx.h"
#include "gfx_p.h"
#include <cfg/debug.h> /* ASSERT() */
-#include <cpu/cpu.h> /* CPU_HARVARD */
#include <cfg/macros.h> /* SWAP() */
#include <appconfig.h> /* CONFIG_GFX_CLIPPING */
* \version $Id$
*/
-/*#*
- *#* $Log$
- *#* Revision 1.8 2006/09/13 13:58:55 bernie
- *#* text_moveTo(): Swap parameters.
- *#*
- *#* Revision 1.7 2006/07/19 12:56:26 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.6 2006/04/27 05:39:24 bernie
- *#* Enhance text rendering to arbitrary x,y coords.
- *#*
- *#* Revision 1.5 2006/04/11 00:08:24 bernie
- *#* text_offset(): New function, but I'm not quite confident with the design.
- *#*
- *#* Revision 1.4 2006/03/07 22:18:04 bernie
- *#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute.
- *#*
- *#* Revision 1.3 2006/02/10 12:26:19 bernie
- *#* Add STYLEF_TALL (unimplemented).
- *#*
- *#* Revision 1.2 2005/11/04 18:17:45 bernie
- *#* Fix header guards and includes for new location of gfx module.
- *#*
- *#* Revision 1.1 2005/11/04 18:11:35 bernie
- *#* Move graphics stuff from mware/ to gfx/.
- *#*
- *#* Revision 1.11 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.10 2005/03/01 23:26:46 bernie
- *#* Use new CPU-neutral program-memory API.
- *#*
- *#* Revision 1.9 2004/12/31 16:44:29 bernie
- *#* Sanitize for non-Harvard processors.
- *#*
- *#* Revision 1.8 2004/10/03 20:43:37 bernie
- *#* Import changes from project_ks.
- *#*
- *#* Revision 1.7 2004/09/20 03:28:49 bernie
- *#* Fix header; Conditionalize AVR-specific code.
- *#*
- *#* Revision 1.6 2004/09/14 20:57:30 bernie
- *#* Reformat.
- *#*
- *#* Revision 1.5 2004/09/06 21:51:26 bernie
- *#* Extend interface to allow any algorithmic style.
- *#*
- *#* Revision 1.4 2004/08/25 14:12:09 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.3 2004/08/05 18:46:44 bernie
- *#* Documentation improvements.
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#*/
-
#ifndef GFX_TEXT_H
#define GFX_TEXT_H
#include <cfg/compiler.h>
#include <cfg/macros.h> /* BV() */
-#include <cpu/cpu.h> /* CPU_HARVARD */
+#include <cpu/attr.h> /* CPU_HARVARD */
#include <gfx/gfx.h> /* coord_t */
#include <stdarg.h>
* \brief LCD low-level hardware macros
*/
-/*#*
- *#* $Log$
- *#* Revision 1.1 2006/09/20 17:39:24 marco
- *#* Low level lcd for avr.
- *#*
- *#*/
-
#ifndef HW_LCD_H
#define HW_LCD_H
#include <appconfig.h>
//#include <hw.h>
-#include <cpu/cpu.h>
+#include <cpu/attr.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
+
#include <cfg/macros.h> /* BV() */
#include <cfg/debug.h>
#include <mcp41_map.h>
#include <cfg/compiler.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
#include <avr/io.h>
extern const uint16_t mcp41_ports[MCP41_CNT];
* \author Giovanni Bajo <rasky@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.5 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.4 2006/02/24 01:17:05 bernie
- *#* Update for new emulator.
- *#*
- *#* Revision 1.3 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.2 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.1 2004/10/03 20:39:03 bernie
- *#* Import in DevLib.
- *#*
- *#* Revision 1.1 2004/09/30 23:19:30 rasky
- *#* Estratto il monitor degli stack da proc.c in due file a parte: monitor.c/h
- *#* Rinominata monitor_debug_stacks in monitor_report
- *#*
- *#*/
-
#ifndef KERN_MONITOR_H
#define KERN_MONITOR_H
-#include <cpu/cpu.h>
+#include <cpu/types.h>
#include <config_kern.h>
#if CONFIG_KERN_MONITOR
* \author Stefano Fedrigo <aleph@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.32 2006/09/20 14:19:23 marco
- *#* Restored test.
- *#*
- *#* Revision 1.31 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.30 2006/03/27 04:49:23 bernie
- *#* CPU_IDLE(): Fix for new emulator.
- *#*
- *#* Revision 1.29 2006/02/24 01:17:05 bernie
- *#* Update for new emulator.
- *#*
- *#* Revision 1.28 2006/02/21 16:06:55 bernie
- *#* Cleanup/update process scheduling.
- *#*
- *#* Revision 1.27 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.26 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.25 2005/03/15 00:20:54 bernie
- *#* proc_schedule(): New sanity check.
- *#*
- *#* Revision 1.24 2005/01/08 09:20:54 bernie
- *#* Remove unused variable.
- *#*
- *#* Revision 1.23 2004/12/13 12:07:06 bernie
- *#* DISABLE_IRQSAVE/ENABLE_IRQRESTORE: Convert to IRQ_SAVE_DISABLE/IRQ_RESTORE.
- *#*
- *#* Revision 1.22 2004/12/13 11:51:08 bernie
- *#* DISABLE_INTS/ENABLE_INTS: Convert to IRQ_DISABLE/IRQ_ENABLE.
- *#*
- *#* Revision 1.21 2004/11/28 23:20:25 bernie
- *#* Remove obsolete INITLIST macro.
- *#*
- *#* Revision 1.20 2004/11/16 22:37:14 bernie
- *#* Replace IPTR with iptr_t.
- *#*
- *#* Revision 1.19 2004/10/19 11:47:39 bernie
- *#* Kill warnings when !CONFIG_PROC_MONITOR.
- *#*
- *#* Revision 1.18 2004/10/19 08:54:43 bernie
- *#* Initialize forbid_cnt; Formatting/comments fixes.
- *#*
- *#* Revision 1.17 2004/10/19 08:47:13 bernie
- *#* proc_rename(), proc_forbid(), proc_permit(): New functions.
- *#*
- *#* Revision 1.16 2004/10/03 20:39:28 bernie
- *#* Import changes from sc/firmware.
- *#*
- *#* Revision 1.15 2004/09/20 03:29:39 bernie
- *#* C++ fixes.
- *#*
- *#* Revision 1.14 2004/09/14 21:06:44 bernie
- *#* Use debug.h instead of kdebug.h.
- *#*
- *#* Revision 1.13 2004/08/29 21:58:53 bernie
- *#* Include macros.h explicityl.
- *#*
- *#* Revision 1.11 2004/08/24 16:09:08 bernie
- *#* Add missing header.
- *#*
- *#* Revision 1.10 2004/08/24 16:07:01 bernie
- *#* Use kputs()/kputchar() when possible.
- *#*
- *#* Revision 1.9 2004/08/24 14:26:57 bernie
- *#* monitor_debug_stacks(): Conditionally compile on CONFIG_KERN_MONITOR.
- *#*
- *#* Revision 1.8 2004/08/14 19:37:57 rasky
- *#* Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc.
- *#*
- *#* Revision 1.7 2004/08/02 20:20:29 aleph
- *#* Merge from project_ks
- *#*
- *#* Revision 1.6 2004/07/30 14:24:16 rasky
- *#* Task switching con salvataggio perfetto stato di interrupt (SR)
- *#* Kernel monitor per dump informazioni su stack dei processi
- *#*
- *#* Revision 1.5 2004/07/14 14:18:09 rasky
- *#* Merge da SC: Rimosso timer dentro il task, che è uno spreco di memoria per troppi task
- *#*
- *#* Revision 1.4 2004/07/13 19:21:28 aleph
- *#* Avoid warning for unused arg when compiled without some CONFIG_KERN_xx options
- *#*
- *#* Revision 1.3 2004/06/06 18:37:57 bernie
- *#* Rename event macros to look like regular functions.
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#* Revision 1.1 2004/05/23 17:27:00 bernie
- *#* Import kern/ subdirectory.
- *#*
- *#*/
#include "proc_p.h"
#include "proc.h"
//#include "hw.h"
#include <mware/event.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
+#include <cpu/types.h>
+#include <cpu/attr.h>
#include <cfg/debug.h>
#include <cfg/arch_config.h> /* ARCH_EMUL */
#include <cfg/macros.h> /* ABS() */
* \author Bernardo Innocenti <bernie@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.12 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.11 2006/02/21 16:06:55 bernie
- *#* Cleanup/update process scheduling.
- *#*
- *#* Revision 1.10 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.9 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.8 2004/11/16 22:37:14 bernie
- *#* Replace IPTR with iptr_t.
- *#*
- *#* Revision 1.7 2004/10/19 08:54:55 bernie
- *#* Define forbid_cnt.
- *#*
- *#* Revision 1.6 2004/10/03 20:44:18 bernie
- *#* Remove stale declarations (moved to monitor.h).
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#* Revision 1.1 2004/05/23 17:27:00 bernie
- *#* Import kern/ subdirectory.
- *#*
- *#*/
#ifndef KERN_PROC_H
#define KERN_PROC_H
#include <cfg/compiler.h>
-#include <cpu/cpu.h>
+#include <cpu/irq.h>
#include <config_kern.h>
/* Fwd decl */
* \author Bernardo Innocenti <bernie@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.16 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.15 2005/11/27 23:36:19 bernie
- *#* Use appconfig.h instead of cfg/config.h.
- *#*
- *#* Revision 1.14 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.13 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.12 2004/12/08 08:57:35 bernie
- *#* Rename sigset_t to sigmask_t.
- *#*
- *#* Revision 1.11 2004/11/16 22:37:14 bernie
- *#* Replace IPTR with iptr_t.
- *#*
- *#* Revision 1.10 2004/10/19 11:47:07 bernie
- *#* Add missing #endif.
- *#*
- *#* Revision 1.9 2004/10/19 08:55:31 bernie
- *#* Define forbid_cnt.
- *#*
- *#* Revision 1.8 2004/10/03 20:39:28 bernie
- *#* Import changes from sc/firmware.
- *#*
- *#* Revision 1.7 2004/08/25 14:12:09 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.6 2004/08/24 16:05:15 bernie
- *#* Add missing headers; Reformat.
- *#*
- *#* Revision 1.5 2004/08/14 19:37:57 rasky
- *#* Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc.
- *#*
- *#* Revision 1.4 2004/07/30 14:24:16 rasky
- *#* Task switching con salvataggio perfetto stato di interrupt (SR)
- *#* Kernel monitor per dump informazioni su stack dei processi
- *#*
- *#* Revision 1.3 2004/07/14 14:18:09 rasky
- *#* Merge da SC: Rimosso timer dentro il task, che è uno spreco di memoria per troppi task
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#* Revision 1.1 2004/05/23 17:27:00 bernie
- *#* Import kern/ subdirectory.
- *#*
- *#* Revision 1.3 2004/05/14 12:52:13 rasky
- *#* Importato supporto kernel per AVR da Stefano
- *#*
- *#* Revision 1.2 2004/04/28 16:13:49 rasky
- *#* proc_schedule() is now semi-private (used only within the kernel)
- *#*
- *#* Revision 1.1 2004/04/26 18:02:40 rasky
- *#* Importato microkernel
- *#*
- *#* Revision 1.1 2004/04/04 17:40:26 aleph
- *#* Add multithreading kernel
- *#*
- *#*/
#ifndef KERN_PROC_P_H
#define KERN_PROC_P_H
#include <cfg/compiler.h>
-#include <cpu/cpu.h> /* for cpu_stack_t */
+#include <cpu/types.h> /* for cpu_stack_t */
#include <mware/list.h>
#include <config_kern.h>
#include <appconfig.h>
* \author Stefano Fedrigo <aleph@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.10 2006/06/10 05:37:03 bernie
- *#* Convert to new Doxygen comments.
- *#*
- *#* Revision 1.9 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.8 2005/06/14 06:16:03 bernie
- *#* Add all missing functions.
- *#*
- *#* Revision 1.7 2005/04/12 04:08:49 bernie
- *#* host_to_net(16|32)(), net_to_host(16|32)(): New functions.
- *#*
- *#* Revision 1.6 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.5 2004/08/25 14:12:09 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.4 2004/07/22 01:08:43 bernie
- *#* swab32(): Fix a very serious bug.
- *#*
- *#* Revision 1.3 2004/07/20 23:47:12 bernie
- *#* Finally remove redundant protos.
- *#*
- *#* Revision 1.2 2004/07/20 17:09:11 bernie
- *#* swab16(), swab32(), cpu_to_be32(), cpu_to_le32(): New functions.
- *#*
- *#* Revision 1.1 2004/07/20 16:26:15 bernie
- *#* Import byte-order macros into DevLib.
- *#*
- *#*/
-
#ifndef MWARE_BYTEORDER_H
#define MWARE_BYTEORDER_H
#include <cfg/compiler.h>
-#include <cpu/cpu.h>
+#include <cpu/attr.h>
/**
* Swap upper and lower bytes in a 16-bit value.
* \code head == begin && tail == end \endcode
*/
-/*#*
- *#* $Log$
- *#* Revision 1.22 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.21 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.20 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.19 2004/12/08 08:30:12 bernie
- *#* Add missing header.
- *#*
- *#* Revision 1.18 2004/11/16 21:55:12 bernie
- *#* Workaround for a known fifobuf bug.
- *#*
- *#* Revision 1.17 2004/09/14 20:57:00 bernie
- *#* Use debug.h instead of kdebug.h.
- *#*
- *#* Revision 1.16 2004/09/06 21:39:08 bernie
- *#* Simplify code using ATOMIC().
- *#*
- *#* Revision 1.15 2004/08/29 22:05:16 bernie
- *#* Rename BITS_PER_PTR to CPU_BITS_PER_PTR.
- *#*
- *#* Revision 1.14 2004/08/25 14:12:09 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.13 2004/08/24 13:16:11 bernie
- *#* Add type-size definitions for preprocessor.
- *#*
- *#* Revision 1.12 2004/08/02 20:20:29 aleph
- *#* Merge from project_ks
- *#*
- *#* Revision 1.11 2004/07/30 14:15:53 rasky
- *#* Nuovo supporto unificato per detect della CPU
- *#*
- *#* Revision 1.10 2004/07/29 22:57:09 bernie
- *#* Doxygen fix.
- *#*
- *#* Revision 1.9 2004/07/20 23:54:27 bernie
- *#* fifo_flush_locked(): New function;
- *#* Revamp documentation.
- *#*
- *#* Revision 1.8 2004/07/20 23:47:39 bernie
- *#* Finally remove redundant protos.
- *#*
- *#* Revision 1.7 2004/07/20 23:46:29 bernie
- *#* Finally remove redundant protos.
- *#*
- *#* Revision 1.6 2004/06/06 17:18:04 bernie
- *#* Remove redundant declaration of fifo_isempty_locked().
- *#*
- *#* Revision 1.5 2004/06/06 16:50:35 bernie
- *#* Import fixes for race conditions from project_ks.
- *#*
- *#* Revision 1.4 2004/06/06 16:11:17 bernie
- *#* Protect MetroWerks specific pragmas with #ifdef's
- *#*/
-
#ifndef MWARE_FIFO_H
#define MWARE_FIFO_H
-#include <cpu/cpu.h>
+#include <cpu/types.h>
+#include <cpu/irq.h>
#include <cfg/debug.h>
typedef struct FIFOBuffer
* \brief Basic "printf", "sprintf" and "fprintf" formatter.
*/
-/*#*
- *#* $Log$
- *#* Revision 1.11 2006/07/19 12:56:27 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.10 2005/11/04 16:20:02 bernie
- *#* Fix reference to README.devlib in header.
- *#*
- *#* Revision 1.9 2005/07/19 07:25:46 bernie
- *#* Use appconfig.h instead of cfg/config.h.
- *#*
- *#* Revision 1.8 2005/04/11 19:10:28 bernie
- *#* Include top-level headers from cfg/ subdir.
- *#*
- *#* Revision 1.7 2005/02/16 20:28:03 bernie
- *#* Add %S formatter.
- *#*
- *#* Revision 1.6 2005/01/08 08:50:06 bernie
- *#* Make more portable.
- *#*
- *#* Revision 1.5 2004/08/25 14:12:09 rasky
- *#* Aggiornato il comment block dei log RCS
- *#*
- *#* Revision 1.4 2004/08/04 15:53:47 rasky
- *#* Nuove opzioni di configurazione per formatted_write e ridotto maggiormente l'utilizzo dellos tack
- *#*
- *#* Revision 1.3 2004/07/29 22:57:09 bernie
- *#* Add values for new-style CONFIG_PRINTF option.
- *#*
- *#* Revision 1.2 2004/06/03 11:27:09 bernie
- *#* Add dual-license information.
- *#*
- *#* Revision 1.1 2004/05/23 15:43:16 bernie
- *#* Import mware modules.
- *#*
- *#*/
#ifndef MWARE_FORMATWR_H
#define MWARE_FORMATWR_H
#include <stdarg.h> /* va_list */
#include <appconfig.h>
-#include <cpu/cpu.h> /* CPU_HARVARD */
+#include <cpu/attr.h> /* CPU_HARVARD */
/**
* \name _formatted_write() configuration
*/
#include "observer.h"
-#include <cpu/cpu.h> // IRQ_DISABLE/IRQ_ENABLE
+#include <cpu/irq.h> // IRQ_DISABLE/IRQ_ENABLE
void observer_SetEvent(Observer *observer, void (*event)(int event_id, void *param))
#include <cfg/compiler.h> /* For intXX_t */
#include <cpu/detect.h>
-#include <cpu/cpu.h> /* For CPU_HARVARD */
+#include <cpu/attr.h> /* For CPU_HARVARD */
+#include <cpu/types.h> /* For SIZEOF_INT */
#if CPU_AVR