From efbdba7e2814415234ef47bd10ff888559ea90af Mon Sep 17 00:00:00 2001 From: batt Date: Tue, 23 Oct 2007 14:48:48 +0000 Subject: [PATCH] Split cpu/cpu.h in 3 files: irq, types and attr. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@930 38d2e660-2303-0410-9eaa-f027e97ec537 --- cfg/debug.h | 2 +- cpu/arm/drv/kdebug_at91.c | 22 ++- cpu/arm/drv/sysirq_at91.c | 3 +- cpu/arm/drv/timer_at91.c | 3 +- cpu/{cpu.h => attr.h} | 289 +---------------------------------- cpu/avr/drv/flash_avr.c | 2 +- cpu/avr/drv/kdebug_avr.c | 3 +- cpu/avr/drv/lcd_32122a_avr.c | 22 +-- cpu/avr/drv/timer_avr.c | 27 +--- cpu/avr/drv/twi_avr.c | 31 +--- cpu/i196/drv/kdebug_i196.c | 1 - cpu/irq.h | 242 +++++++++++++++++++++++++++++ cpu/types.h | 183 ++++++++++++++++++++++ drv/buzzerled.h | 30 +--- drv/eeprom.c | 29 +--- drv/kdebug.c | 4 +- drv/mcp41.c | 1 - drv/phase.c | 58 +------ drv/tc520.c | 1 - drv/timer.c | 6 +- drv/timer.h | 3 +- drv/wdt.h | 41 +---- gfx/bitmap.c | 2 +- gfx/gfx.h | 2 +- gfx/line.c | 17 --- gfx/text.h | 60 +------- hw/hw_lcd.h | 12 +- hw/hw_mcp41.h | 2 +- kern/monitor.h | 25 +-- kern/proc.c | 101 +----------- kern/proc.h | 32 +--- kern/proc_p.h | 66 +------- mware/byteorder.h | 36 +---- mware/fifobuf.h | 64 +------- mware/formatwr.h | 38 +---- mware/observer.c | 2 +- mware/pgm.h | 3 +- 37 files changed, 489 insertions(+), 976 deletions(-) rename cpu/{cpu.h => attr.h} (56%) create mode 100644 cpu/irq.h create mode 100644 cpu/types.h diff --git a/cfg/debug.h b/cfg/debug.h index 99c277cd..91fefb72 100644 --- a/cfg/debug.h +++ b/cfg/debug.h @@ -195,7 +195,7 @@ #else /* !OS_HOSTED */ #include /* CONFIG_KDEBUG_ASSERT_NO_TEXT */ - #include /* CPU_HARVARD */ + #include /* CPU_HARVARD */ /* These are implemented in drv/kdebug.c */ void kdbg_init(void); diff --git a/cpu/arm/drv/kdebug_at91.c b/cpu/arm/drv/kdebug_at91.c index 35261399..7de1c6d9 100644 --- a/cpu/arm/drv/kdebug_at91.c +++ b/cpu/arm/drv/kdebug_at91.c @@ -37,7 +37,6 @@ */ #include "kdebug_at91.h" -#include #include /* for BV() */ #include #include /* for CLOCK_FREQ */ @@ -77,24 +76,23 @@ INLINE void kdbg_hw_init(void) 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 diff --git a/cpu/arm/drv/sysirq_at91.c b/cpu/arm/drv/sysirq_at91.c index 4beaf361..33e6b0cd 100644 --- a/cpu/arm/drv/sysirq_at91.c +++ b/cpu/arm/drv/sysirq_at91.c @@ -54,7 +54,8 @@ #include "sysirq_at91.h" #include -#include +#include +#include #include #include diff --git a/cpu/arm/drv/timer_at91.c b/cpu/arm/drv/timer_at91.c index efe37d5a..e27e8a63 100644 --- a/cpu/arm/drv/timer_at91.c +++ b/cpu/arm/drv/timer_at91.c @@ -43,7 +43,8 @@ #include // BV() #include -#include +#include +#include /** HW dependent timer initialization */ diff --git a/cpu/cpu.h b/cpu/attr.h similarity index 56% rename from cpu/cpu.h rename to cpu/attr.h index 1e68ac2c..678eac68 100644 --- a/cpu/cpu.h +++ b/cpu/attr.h @@ -31,15 +31,15 @@ * * --> * - * \brief CPU-specific definitions + * \brief CPU-specific attributes. * * \author Giovanni Bajo * \author Bernardo Innocenti * \author Stefano Fedrigo * \author Francesco Sacchi */ -#ifndef CPU_CPU_H -#define CPU_CPU_H +#ifndef CPU_ATTR_H +#define CPU_ATTR_H #include "detect.h" #include /* for uintXX_t */ @@ -64,11 +64,6 @@ #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 @@ -81,17 +76,6 @@ #define NOP asm volatile ("nop") - /* Get IRQ_* definitions from the hosting environment. */ - #include - #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 @@ -100,7 +84,6 @@ #define CPU_HARVARD 0 #if CPU_X86_64 - typedef uint64_t cpustack_t; #define CPU_REG_BITS 64 #ifdef __WIN64__ @@ -108,15 +91,11 @@ #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 @@ -127,95 +106,10 @@ #define CPU_HARVARD 0 #ifdef __IAR_SYSTEMS_ICC__ - - #include - - #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 @@ -235,15 +129,6 @@ #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 @@ -256,32 +141,6 @@ #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 @@ -301,37 +160,6 @@ #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 @@ -354,20 +182,6 @@ #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 @@ -447,101 +261,6 @@ 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 * @@ -563,4 +282,4 @@ STATIC_ASSERT(sizeof(uint64_t) * CPU_BITS_PER_CHAR == 64); #endif /* !ARCH_EMUL */ #endif /* !CPU_IDLE */ -#endif /* CPU_CPU_H */ +#endif /* CPU_ATTR_H */ diff --git a/cpu/avr/drv/flash_avr.c b/cpu/avr/drv/flash_avr.c index a42136c3..aa46b4d2 100644 --- a/cpu/avr/drv/flash_avr.c +++ b/cpu/avr/drv/flash_avr.c @@ -51,7 +51,7 @@ #include // MIN() #include #include -#include +#include #include diff --git a/cpu/avr/drv/kdebug_avr.c b/cpu/avr/drv/kdebug_avr.c index 0a392645..d3a77615 100644 --- a/cpu/avr/drv/kdebug_avr.c +++ b/cpu/avr/drv/kdebug_avr.c @@ -39,7 +39,8 @@ * \author Francesco Sacchi */ -#include +#include +#include #include /* for BV() */ #include #include /* for CLOCK_FREQ */ diff --git a/cpu/avr/drv/lcd_32122a_avr.c b/cpu/avr/drv/lcd_32122a_avr.c index 3ae23055..9c5c36ab 100644 --- a/cpu/avr/drv/lcd_32122a_avr.c +++ b/cpu/avr/drv/lcd_32122a_avr.c @@ -39,30 +39,12 @@ * \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 #include -#include +#include +#include #include #include /* BV() */ #include diff --git a/cpu/avr/drv/timer_avr.c b/cpu/avr/drv/timer_avr.c index 736026d4..4fd82f53 100644 --- a/cpu/avr/drv/timer_avr.c +++ b/cpu/avr/drv/timer_avr.c @@ -38,34 +38,11 @@ * \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 #include // BV() -#include +#include +#include #include #include diff --git a/cpu/avr/drv/twi_avr.c b/cpu/avr/drv/twi_avr.c index 0d03950f..bd4fcfd7 100644 --- a/cpu/avr/drv/twi_avr.c +++ b/cpu/avr/drv/twi_avr.c @@ -38,38 +38,11 @@ * \author Bernardo Innocenti */ -/*#* - *#* $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 -#include +#include +#include #include // BV() #include /* CLOCK_FREQ */ #include diff --git a/cpu/i196/drv/kdebug_i196.c b/cpu/i196/drv/kdebug_i196.c index 07af94cf..2f72e519 100644 --- a/cpu/i196/drv/kdebug_i196.c +++ b/cpu/i196/drv/kdebug_i196.c @@ -41,7 +41,6 @@ #error Revise me! #include -#include #include /* for BV() */ #include #include /* for CLOCK_FREQ */ diff --git a/cpu/irq.h b/cpu/irq.h new file mode 100644 index 00000000..428ba2d7 --- /dev/null +++ b/cpu/irq.h @@ -0,0 +1,242 @@ +/** + * \file + * + * + * \brief CPU-specific IRQ definitions. + * + * \author Giovanni Bajo + * \author Bernardo Innocenti + * \author Stefano Fedrigo + * \author Francesco Sacchi + */ +#ifndef CPU_IRQ_H +#define CPU_IRQ_H + +#include "detect.h" +#include "types.h" + +#include /* 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 + #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 + + #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 */ diff --git a/cpu/types.h b/cpu/types.h new file mode 100644 index 00000000..985dbe6b --- /dev/null +++ b/cpu/types.h @@ -0,0 +1,183 @@ +/** + * \file + * + * + * \brief CPU-specific type definitions. + * + * \author Giovanni Bajo + * \author Bernardo Innocenti + * \author Stefano Fedrigo + * \author Francesco Sacchi + */ +#ifndef CPU_TYPES_H +#define CPU_TYPES_H + +#include "detect.h" +#include "attr.h" +#include /* 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 + #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 */ diff --git a/drv/buzzerled.h b/drv/buzzerled.h index 4ef919e3..14fab030 100644 --- a/drv/buzzerled.h +++ b/drv/buzzerled.h @@ -38,38 +38,10 @@ * \author Giovanni Bajo */ -/*#* - *#* $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 +#include /** 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 diff --git a/drv/eeprom.c b/drv/eeprom.c index bc0bda0b..4e7f615f 100644 --- a/drv/eeprom.c +++ b/drv/eeprom.c @@ -39,39 +39,12 @@ * \author Bernardo Innocenti */ -/*#* - *#* $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 #include // CONFIG_EEPROM_VERIFY #include // MIN() -#include +#include #include CPU_HEADER(twi) #include #include // cpu_to_be16() diff --git a/drv/kdebug.c b/drv/kdebug.c index 129576f4..739400a4 100644 --- a/drv/kdebug.c +++ b/drv/kdebug.c @@ -40,7 +40,9 @@ #include -#include +#include +#include +#include #include /* for BV() */ #include #include /* for CLOCK_FREQ */ diff --git a/drv/mcp41.c b/drv/mcp41.c index b279724d..12c566f5 100644 --- a/drv/mcp41.c +++ b/drv/mcp41.c @@ -40,7 +40,6 @@ #include #include -#include #include #include diff --git a/drv/phase.c b/drv/phase.c index a79be807..04c895d7 100644 --- a/drv/phase.c +++ b/drv/phase.c @@ -37,66 +37,12 @@ * \author Francesco Sacchi */ -/*#* - *#* $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 #include -#include +#include +#include #include diff --git a/drv/tc520.c b/drv/tc520.c index 55e84f28..3b61ad55 100644 --- a/drv/tc520.c +++ b/drv/tc520.c @@ -44,7 +44,6 @@ #include #include -#include #include #include diff --git a/drv/timer.c b/drv/timer.c index 9148d930..a7135267 100644 --- a/drv/timer.c +++ b/drv/timer.c @@ -38,7 +38,11 @@ */ #include "timer.h" -#include + +#include +#include +#include + #include #include #include diff --git a/drv/timer.h b/drv/timer.h index d5bb7743..bcf10200 100644 --- a/drv/timer.h +++ b/drv/timer.h @@ -42,7 +42,8 @@ #define DRV_TIMER_H #include -#include +#include +#include /* * Include platform-specific binding header if we're hosted. diff --git a/drv/wdt.h b/drv/wdt.h index f13935ff..1db10538 100644 --- a/drv/wdt.h +++ b/drv/wdt.h @@ -37,45 +37,6 @@ * \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 @@ -89,7 +50,7 @@ #endif #if CONFIG_WATCHDOG - #include + #include #include #if OS_QT diff --git a/gfx/bitmap.c b/gfx/bitmap.c index ebc648f4..d4c447e6 100644 --- a/gfx/bitmap.c +++ b/gfx/bitmap.c @@ -41,7 +41,7 @@ #include "gfx_p.h" #include /* ASSERT() */ -#include /* CPU_HARVARD */ +#include /* CPU_HARVARD */ #include /* MIN() */ #include /* CONFIG_GFX_CLIPPING */ diff --git a/gfx/gfx.h b/gfx/gfx.h index 5687986f..a852c54d 100644 --- a/gfx/gfx.h +++ b/gfx/gfx.h @@ -16,7 +16,7 @@ #define GFX_GFX_H #include -#include /* CPU_HARVARD */ +#include /* CPU_HARVARD */ #include /* CONFIG_GFX_* */ diff --git a/gfx/line.c b/gfx/line.c index c5a6046f..f3909b15 100644 --- a/gfx/line.c +++ b/gfx/line.c @@ -39,27 +39,10 @@ * \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 /* ASSERT() */ -#include /* CPU_HARVARD */ #include /* SWAP() */ #include /* CONFIG_GFX_CLIPPING */ diff --git a/gfx/text.h b/gfx/text.h index 87bacfae..59f65ea0 100644 --- a/gfx/text.h +++ b/gfx/text.h @@ -38,70 +38,12 @@ * \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 #include /* BV() */ -#include /* CPU_HARVARD */ +#include /* CPU_HARVARD */ #include /* coord_t */ #include diff --git a/hw/hw_lcd.h b/hw/hw_lcd.h index f4d30d15..b7cf5f89 100644 --- a/hw/hw_lcd.h +++ b/hw/hw_lcd.h @@ -39,20 +39,16 @@ * \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 //#include -#include +#include +#include +#include + #include /* BV() */ #include diff --git a/hw/hw_mcp41.h b/hw/hw_mcp41.h index 5af88780..8dd6297e 100644 --- a/hw/hw_mcp41.h +++ b/hw/hw_mcp41.h @@ -42,7 +42,7 @@ #include #include -#include +#include #include extern const uint16_t mcp41_ports[MCP41_CNT]; diff --git a/kern/monitor.h b/kern/monitor.h index bbed637c..95bbb6db 100644 --- a/kern/monitor.h +++ b/kern/monitor.h @@ -37,33 +37,10 @@ * \author Giovanni Bajo */ -/*#* - *#* $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 +#include #include #if CONFIG_KERN_MONITOR diff --git a/kern/proc.c b/kern/proc.c index 23a2c3ef..fc3bfe81 100644 --- a/kern/proc.c +++ b/kern/proc.c @@ -40,109 +40,14 @@ * \author Stefano Fedrigo */ -/*#* - *#* $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 -#include +#include +#include +#include #include #include /* ARCH_EMUL */ #include /* ABS() */ diff --git a/kern/proc.h b/kern/proc.h index bfaea224..7c2a624b 100644 --- a/kern/proc.h +++ b/kern/proc.h @@ -38,42 +38,12 @@ * \author Bernardo Innocenti */ -/*#* - *#* $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 -#include +#include #include /* Fwd decl */ diff --git a/kern/proc_p.h b/kern/proc_p.h index 62665722..8fbb0ed0 100644 --- a/kern/proc_p.h +++ b/kern/proc_p.h @@ -38,75 +38,11 @@ * \author Bernardo Innocenti */ -/*#* - *#* $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 -#include /* for cpu_stack_t */ +#include /* for cpu_stack_t */ #include #include #include diff --git a/mware/byteorder.h b/mware/byteorder.h index b0351ba0..e2a297ae 100644 --- a/mware/byteorder.h +++ b/mware/byteorder.h @@ -38,45 +38,11 @@ * \author Stefano Fedrigo */ -/*#* - *#* $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 -#include +#include /** * Swap upper and lower bytes in a 16-bit value. diff --git a/mware/fifobuf.h b/mware/fifobuf.h index 96161a69..c6b203c5 100644 --- a/mware/fifobuf.h +++ b/mware/fifobuf.h @@ -66,71 +66,11 @@ * \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 +#include +#include #include typedef struct FIFOBuffer diff --git a/mware/formatwr.h b/mware/formatwr.h index 4ac7db6d..80aa009b 100644 --- a/mware/formatwr.h +++ b/mware/formatwr.h @@ -35,48 +35,12 @@ * \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 /* va_list */ #include -#include /* CPU_HARVARD */ +#include /* CPU_HARVARD */ /** * \name _formatted_write() configuration diff --git a/mware/observer.c b/mware/observer.c index 406d191b..a3acf98c 100644 --- a/mware/observer.c +++ b/mware/observer.c @@ -37,7 +37,7 @@ */ #include "observer.h" -#include // IRQ_DISABLE/IRQ_ENABLE +#include // IRQ_DISABLE/IRQ_ENABLE void observer_SetEvent(Observer *observer, void (*event)(int event_id, void *param)) diff --git a/mware/pgm.h b/mware/pgm.h index 399f97c8..eebe87fe 100644 --- a/mware/pgm.h +++ b/mware/pgm.h @@ -49,7 +49,8 @@ #include /* For intXX_t */ #include -#include /* For CPU_HARVARD */ +#include /* For CPU_HARVARD */ +#include /* For SIZEOF_INT */ #if CPU_AVR -- 2.25.1