From: batt Date: Fri, 10 Apr 2009 17:52:12 +0000 (+0000) Subject: Rename CLOCK_FREQ macro to CPU_FREQ: now clock frequency has to be set in the makefile. X-Git-Tag: 2.1.0~194 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=8dabf14299bc6b3b9fc0b4dfdeba91af82aba46c;p=bertos.git Rename CLOCK_FREQ macro to CPU_FREQ: now clock frequency has to be set in the makefile. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2488 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/drv/adc_at91.h b/bertos/cpu/arm/drv/adc_at91.h index fb0ec1d6..6c77de0f 100644 --- a/bertos/cpu/arm/drv/adc_at91.h +++ b/bertos/cpu/arm/drv/adc_at91.h @@ -41,7 +41,7 @@ #ifndef DRV_ADC_AT91_H #define DRV_ADC_AT91_H -#include "hw/hw_cpu.h" +#include #include "cfg/cfg_adc.h" @@ -57,7 +57,7 @@ * Macro for computing correct value to write into ADC * register. */ -#define ADC_COMPUTED_PRESCALER ((CLOCK_FREQ/(2 * CONFIG_ADC_CLOCK)) - 1) +#define ADC_COMPUTED_PRESCALER ((CPU_FREQ/(2 * CONFIG_ADC_CLOCK)) - 1) #define ADC_COMPUTED_STARTUPTIME (((CONFIG_ADC_STARTUP_TIME * CONFIG_ADC_CLOCK)/ 8000000UL) - 1) #define ADC_COMPUTED_SHTIME (((CONFIG_ADC_SHTIME * CONFIG_ADC_CLOCK)/1000000000UL) - 1) diff --git a/bertos/cpu/arm/drv/kdebug_at91.c b/bertos/cpu/arm/drv/kdebug_at91.c index b6ec8b19..5f1b6023 100644 --- a/bertos/cpu/arm/drv/kdebug_at91.c +++ b/bertos/cpu/arm/drv/kdebug_at91.c @@ -37,7 +37,7 @@ */ #include "kdebug_at91.h" -#include "hw/hw_cpu.h" /* for CLOCK_FREQ */ +#include /* for CPU_FREQ */ #include "hw/hw_ser.h" /* Required for bus macros overrides */ #include "cfg/cfg_debug.h" @@ -72,7 +72,7 @@ INLINE void kdbg_hw_init(void) /* Reset DBGU */ DBGU_CR = BV(US_RSTRX) | BV(US_RSTTX) | BV(US_RXDIS) | BV(US_TXDIS); /* Set baudrate */ - DBGU_BRGR = DIV_ROUND(CLOCK_FREQ, 16 * CONFIG_KDEBUG_BAUDRATE); + DBGU_BRGR = DIV_ROUND(CPU_FREQ, 16 * CONFIG_KDEBUG_BAUDRATE); /* Set DBGU mode to 8 data bits, no parity and 1 stop bit. */ DBGU_MR = US_CHMODE_NORMAL | US_CHRL_8 | US_PAR_NO | US_NBSTOP_1; /* Enable DBGU transmitter. */ diff --git a/bertos/cpu/arm/drv/pwm_at91.c b/bertos/cpu/arm/drv/pwm_at91.c index e0706812..39627382 100644 --- a/bertos/cpu/arm/drv/pwm_at91.c +++ b/bertos/cpu/arm/drv/pwm_at91.c @@ -39,7 +39,7 @@ #include "pwm_at91.h" #include "hw/pwm_map.h" -#include "hw/hw_cpu.h" +#include #include "cfg/cfg_pwm.h" // Define logging setting (for cfg/log.h module). @@ -120,7 +120,7 @@ void pwm_hw_setFrequency(PwmDev dev, uint32_t freq) for(int i = 0; i <= PWM_HW_MAX_PRESCALER_STEP; i++) { - period = CLOCK_FREQ / (BV(i) * freq); + period = CPU_FREQ / (BV(i) * freq); // LOG_INFO("period[%ld], prescale[%d]\n", period, i); if ((period < PWM_HW_MAX_PERIOD) && (period != 0)) { diff --git a/bertos/cpu/arm/drv/ser_at91.c b/bertos/cpu/arm/drv/ser_at91.c index c3c897cd..fcbcafbd 100644 --- a/bertos/cpu/arm/drv/ser_at91.c +++ b/bertos/cpu/arm/drv/ser_at91.c @@ -39,7 +39,7 @@ */ #include "hw/hw_ser.h" /* Required for bus macros overrides */ -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_ser.h" #include @@ -326,7 +326,7 @@ static void uart0_enabletxirq(struct SerialHardware *_hw) static void uart0_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - US0_BRGR = CLOCK_FREQ / (16 * rate); + US0_BRGR = CPU_FREQ / (16 * rate); //DB(kprintf("uart0_setbaudrate(rate=%lu): period=%d\n", rate, period);) } @@ -421,7 +421,7 @@ static void uart1_enabletxirq(struct SerialHardware *_hw) static void uart1_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - US1_BRGR = CLOCK_FREQ / (16 * rate); + US1_BRGR = CPU_FREQ / (16 * rate); //DB(kprintf("uart0_setbaudrate(rate=%lu): period=%d\n", rate, period);) } @@ -534,8 +534,8 @@ static void spi0_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned { SPI0_CSR0 &= ~SPI_SCBR; - ASSERT((uint8_t)DIV_ROUND(CLOCK_FREQ, rate)); - SPI0_CSR0 |= DIV_ROUND(CLOCK_FREQ, rate) << SPI_SCBR_SHIFT; + ASSERT((uint8_t)DIV_ROUND(CPU_FREQ, rate)); + SPI0_CSR0 |= DIV_ROUND(CPU_FREQ, rate) << SPI_SCBR_SHIFT; } #if CPU_ARM_AT91SAM7X128 || CPU_ARM_AT91SAM7X256 @@ -618,8 +618,8 @@ static void spi1_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned { SPI1_CSR0 &= ~SPI_SCBR; - ASSERT((uint8_t)DIV_ROUND(CLOCK_FREQ, rate)); - SPI1_CSR0 |= DIV_ROUND(CLOCK_FREQ, rate) << SPI_SCBR_SHIFT; + ASSERT((uint8_t)DIV_ROUND(CPU_FREQ, rate)); + SPI1_CSR0 |= DIV_ROUND(CPU_FREQ, rate) << SPI_SCBR_SHIFT; } #endif diff --git a/bertos/cpu/arm/drv/timer_at91.h b/bertos/cpu/arm/drv/timer_at91.h index aed15392..eca205c5 100644 --- a/bertos/cpu/arm/drv/timer_at91.h +++ b/bertos/cpu/arm/drv/timer_at91.h @@ -40,7 +40,7 @@ #ifndef DRV_AT91_TIMER_H #define DRV_AT91_TIMER_H -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_timer.h" /* CONFIG_TIMER */ #include /* uint8_t */ @@ -65,10 +65,10 @@ #define DEFINE_TIMER_ISR void timer_handler(void) #define TIMER_TICKS_PER_SEC 1000 - #define TIMER_HW_CNT (CLOCK_FREQ / (16 * TIMER_TICKS_PER_SEC) - 1) + #define TIMER_HW_CNT (CPU_FREQ / (16 * TIMER_TICKS_PER_SEC) - 1) /** Frequency of the hardware high-precision timer. */ - #define TIMER_HW_HPTICKS_PER_SEC (CLOCK_FREQ / 16) + #define TIMER_HW_HPTICKS_PER_SEC (CPU_FREQ / 16) /// Type of time expressed in ticks of the hardware high-precision timer typedef uint32_t hptime_t; diff --git a/bertos/cpu/arm/drv/twi_at91.c b/bertos/cpu/arm/drv/twi_at91.c index 44957c45..cb2097ea 100644 --- a/bertos/cpu/arm/drv/twi_at91.c +++ b/bertos/cpu/arm/drv/twi_at91.c @@ -254,7 +254,7 @@ void twi_init(void) * Only CLDIV is computed since CLDIV = CHDIV (50% duty cycle) */ uint16_t cldiv, ckdiv = 0; - while ((cldiv = ((CLOCK_FREQ / (2 * CONFIG_I2C_FREQ)) - 3) / (1 << ckdiv)) > 255) + while ((cldiv = ((CPU_FREQ / (2 * CONFIG_I2C_FREQ)) - 3) / (1 << ckdiv)) > 255) ckdiv++; /* Atmel errata states that ckdiv *must* be less than 5 for unknown reason */ diff --git a/bertos/cpu/arm/hw/crtat91sam7_rom.S b/bertos/cpu/arm/hw/crtat91sam7_rom.S index 0857795b..5addc38a 100644 --- a/bertos/cpu/arm/hw/crtat91sam7_rom.S +++ b/bertos/cpu/arm/hw/crtat91sam7_rom.S @@ -70,12 +70,11 @@ * */ -#include "hw/hw_cpu.h" #include #include "cfg/cfg_arch.h" -#if CLOCK_FREQ != 48023000L +#if CPU_FREQ != 48023000L /* Avoid errors on nightly test */ #if !defined(ARCH_NIGHTTEST) || !(ARCH & ARCH_NIGHTTEST) #error Clock registers set for 48MHz operation, revise following code if you want a different clock. diff --git a/bertos/cpu/avr/drv/i2c_avr.c b/bertos/cpu/avr/drv/i2c_avr.c index 2681bb75..74252403 100644 --- a/bertos/cpu/avr/drv/i2c_avr.c +++ b/bertos/cpu/avr/drv/i2c_avr.c @@ -38,7 +38,7 @@ * \author Bernie Innocenti */ -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_i2c.h" @@ -237,7 +237,7 @@ void i2c_builtin_init(void) /* * Set speed: - * F = CLOCK_FREQ / (16 + 2*TWBR * 4^TWPS) + * F = CPU_FREQ / (16 + 2*TWBR * 4^TWPS) */ #ifndef CONFIG_I2C_FREQ #warning Using default value of 300000L for CONFIG_I2C_FREQ @@ -245,7 +245,7 @@ void i2c_builtin_init(void) #endif #define TWI_PRESC 1 /* 4 ^ TWPS */ - TWBR = (CLOCK_FREQ / (2 * CONFIG_I2C_FREQ * TWI_PRESC)) - (8 / TWI_PRESC); + TWBR = (CPU_FREQ / (2 * CONFIG_I2C_FREQ * TWI_PRESC)) - (8 / TWI_PRESC); TWSR = 0; TWCR = BV(TWEN); ); diff --git a/bertos/cpu/avr/drv/kdebug_avr.c b/bertos/cpu/avr/drv/kdebug_avr.c index d8e14637..0d2c7306 100644 --- a/bertos/cpu/avr/drv/kdebug_avr.c +++ b/bertos/cpu/avr/drv/kdebug_avr.c @@ -39,7 +39,7 @@ * \author Francesco Sacchi */ -#include "hw/hw_cpu.h" /* for CLOCK_FREQ */ +#include /* for CPU_FREQ */ #include "hw/hw_ser.h" /* Required for bus macros overrides */ #include "cfg/cfg_debug.h" @@ -171,7 +171,7 @@ #define KDBG_RESTORE_IRQ(old) do { IRQ_RESTORE((old)); } while(0) typedef cpu_flags_t kdbg_irqsave_t; - #define KDBG_DELAY (((CLOCK_FREQ + CONFIG_KDEBUG_BAUDRATE / 2) / CONFIG_KDEBUG_BAUDRATE) + 7) / 14 + #define KDBG_DELAY (((CPU_FREQ + CONFIG_KDEBUG_BAUDRATE / 2) / CONFIG_KDEBUG_BAUDRATE) + 7) / 14 static void _kdebug_bitbang_delay(void) { @@ -230,7 +230,7 @@ INLINE void kdbg_hw_init(void) SER_BITBANG_INIT; #else /* CONFIG_KDEBUG_PORT != 666 */ /* Compute the baud rate */ - uint16_t period = DIV_ROUND(CLOCK_FREQ / 16UL, CONFIG_KDEBUG_BAUDRATE) - 1; + uint16_t period = DIV_ROUND(CPU_FREQ / 16UL, CONFIG_KDEBUG_BAUDRATE) - 1; #if (CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281) #if CONFIG_KDEBUG_PORT == 0 diff --git a/bertos/cpu/avr/drv/pwm_avr.c b/bertos/cpu/avr/drv/pwm_avr.c index 16e420bd..1d76a1a3 100644 --- a/bertos/cpu/avr/drv/pwm_avr.c +++ b/bertos/cpu/avr/drv/pwm_avr.c @@ -40,7 +40,7 @@ #include "pwm_avr.h" -#include "hw/hw_cpu.h" +#include #warning TODO:This is an exmple of implementation of PWM low level channel for AVR, implemnt it! diff --git a/bertos/cpu/avr/drv/ser_avr.c b/bertos/cpu/avr/drv/ser_avr.c index 06644482..d3cc743d 100644 --- a/bertos/cpu/avr/drv/ser_avr.c +++ b/bertos/cpu/avr/drv/ser_avr.c @@ -40,7 +40,7 @@ */ #include "hw/hw_ser.h" /* Required for bus macros overrides */ -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_ser.h" @@ -377,7 +377,7 @@ static void uart0_enabletxirq(struct SerialHardware *_hw) static void uart0_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - uint16_t period = DIV_ROUND(CLOCK_FREQ / 16UL, rate) - 1; + uint16_t period = DIV_ROUND(CPU_FREQ / 16UL, rate) - 1; #if !CPU_AVR_ATMEGA103 UBRR0H = (period) >> 8; @@ -430,7 +430,7 @@ static void uart1_enabletxirq(struct SerialHardware *_hw) static void uart1_setbaudrate(UNUSED_ARG(struct SerialHardware *, _hw), unsigned long rate) { /* Compute baud-rate period */ - uint16_t period = DIV_ROUND(CLOCK_FREQ / 16UL, rate) - 1; + uint16_t period = DIV_ROUND(CPU_FREQ / 16UL, rate) - 1; UBRR1H = (period) >> 8; UBRR1L = (period); diff --git a/bertos/cpu/avr/drv/ser_simple_avr.c b/bertos/cpu/avr/drv/ser_simple_avr.c index 8cd92712..66a00222 100644 --- a/bertos/cpu/avr/drv/ser_simple_avr.c +++ b/bertos/cpu/avr/drv/ser_simple_avr.c @@ -45,7 +45,7 @@ #include #include #include /* BV() */ -#include "hw/hw_cpu.h" +#include #include @@ -111,7 +111,7 @@ void _ser_settimeouts(void) void _ser_setbaudrate(unsigned long rate) { /* Compute baud-rate period */ - uint16_t period = DIV_ROUND(CLOCK_FREQ / 16UL, rate) - 1; + uint16_t period = DIV_ROUND(CPU_FREQ / 16UL, rate) - 1; UBRR0H = (period) >> 8; UBRR0L = (period); diff --git a/bertos/cpu/avr/drv/timer_avr.h b/bertos/cpu/avr/drv/timer_avr.h index 1eccd0ef..96d05082 100644 --- a/bertos/cpu/avr/drv/timer_avr.h +++ b/bertos/cpu/avr/drv/timer_avr.h @@ -43,7 +43,7 @@ #ifndef DRV_TIMER_AVR_H #define DRV_TIMER_AVR_H -#include "hw/hw_cpu.h" /* CLOCK_FREQ */ +#include /* CPU_FREQ */ #include "cfg/cfg_timer.h" /* CONFIG_TIMER */ #include /* uint8_t */ @@ -129,13 +129,13 @@ /** Frequency of the hardware high precision timer. */ -#define TIMER_HW_HPTICKS_PER_SEC DIV_ROUND(CLOCK_FREQ, TIMER_PRESCALER) +#define TIMER_HW_HPTICKS_PER_SEC DIV_ROUND(CPU_FREQ, TIMER_PRESCALER) /** * System timer: additional division after the prescaler * 12288000 / 64 / 192 (0..191) = 1 ms */ -#define OCR_DIVISOR (DIV_ROUND(DIV_ROUND(CLOCK_FREQ, TIMER_PRESCALER), TIMER_TICKS_PER_SEC) - 1) +#define OCR_DIVISOR (DIV_ROUND(DIV_ROUND(CPU_FREQ, TIMER_PRESCALER), TIMER_TICKS_PER_SEC) - 1) /** Not needed, IRQ timer flag cleared automatically */ #define timer_hw_irq() do {} while (0) diff --git a/bertos/cpu/avr/drv/timer_simple_avr.c b/bertos/cpu/avr/drv/timer_simple_avr.c index c9c208c2..95caf428 100644 --- a/bertos/cpu/avr/drv/timer_simple_avr.c +++ b/bertos/cpu/avr/drv/timer_simple_avr.c @@ -40,19 +40,18 @@ #warning FIXME:This module is obsolete, yuo must refactor it. #if 0 -#include "hw/hw_cpu.h" +#include #include "timer_simple_avr.h" #include #include #include /* BV() */ -#include /* CLOCK_FREQ */ #include #define MS_PER_SEC 1000UL #define TIMER_PRESCALER 64UL -#define TIMER_DELAY_1MS (255 - CLOCK_FREQ / TIMER_PRESCALER / MS_PER_SEC) +#define TIMER_DELAY_1MS (255 - CPU_FREQ / TIMER_PRESCALER / MS_PER_SEC) /** * Wait \a time ms using timer 0. diff --git a/bertos/cpu/i196/drv/kdebug_i196.c b/bertos/cpu/i196/drv/kdebug_i196.c index 9f9d272c..69f09284 100644 --- a/bertos/cpu/i196/drv/kdebug_i196.c +++ b/bertos/cpu/i196/drv/kdebug_i196.c @@ -43,7 +43,7 @@ #include #include /* for BV() */ #include -#include /* for CLOCK_FREQ */ +#include /* for CPU_FREQ */ #include /* Required for bus macros overrides */ diff --git a/bertos/cpu/i196/drv/ser_i196.c b/bertos/cpu/i196/drv/ser_i196.c index 78353453..149be7f6 100644 --- a/bertos/cpu/i196/drv/ser_i196.c +++ b/bertos/cpu/i196/drv/ser_i196.c @@ -111,7 +111,7 @@ INTERRUPT(0x32) void RI_interrupt(void) static void ser_setbaudrate(unsigned long rate) { // Calcola il periodo per la generazione del baud rate richiesto - uint16_t baud = (uint16_t)(((CLOCK_FREQ / 16) / rate) - 1) | 0x8000; + uint16_t baud = (uint16_t)(((CPU_FREQ / 16) / rate) - 1) | 0x8000; BAUD_RATE = (uint8_t)baud; BAUD_RATE = (uint8_t)(baud >> 8); } diff --git a/bertos/hw/hw_cpu.h b/bertos/hw/hw_cpu.h deleted file mode 100644 index af009e8b..00000000 --- a/bertos/hw/hw_cpu.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * - * - * \brief Hardware-specific definitions - * - * \version $Id$ - * - * \author Bernie Innocenti - */ - -#ifndef HW_CPU_H -#define HW_CPU_H - -#warning TODO:This is an example implementation, you must implement it! - -/// CPU Clock frequency -#define CLOCK_FREQ (12288000UL/* Implement me! */) - - -/* Timer IRQ strobe */ -//#if CONFIG_TIMER_STROBE -// #define TIMER_STROBE_ON /* Implement me! */ -// #define TIMER_STROBE_OFF /* Implement me! */ -// #define TIMER_STROBE_INIT /* Implement me! */ -//#endif /* CONFIG_TIMER_STROBE */ - -#endif /* HW_CPU_H */ diff --git a/bertos/hw/hw_cpufreq.h b/bertos/hw/hw_cpufreq.h new file mode 100644 index 00000000..5cb01f4d --- /dev/null +++ b/bertos/hw/hw_cpufreq.h @@ -0,0 +1,64 @@ +/** + * \file + * + * + * \brief Hardware-specific definitions + * + * \version $Id$ + * + * \author Francesco Sacchi + */ + +#ifndef HW_CPUFREQ_H +#define HW_CPUFREQ_H + +#ifndef CPU_FREQ + #warning CPU_FREQ is not defined, you should upgrade to the new clock frequency defining method. + + /* + * This is DEPRECATED file, it will be removed in the next major release. + * We have set up a new cpu frequency definition method. + * The new macro CPU_FREQ should be defined as a compiler flag in the + * makefile instead of the old CLOCK_FREQ macro. With new projects you should only + * use the CPU_FREQ macro. + * + * With gcc you should add something like this: + * + * -D'CPU_FREQ=(12288000UL)' + * + * For backward compatibility the old method is still supported. + */ + #include "hw/hw_cpu.h" + + #define CPU_FREQ (CLOCK_FREQ) +#endif /* CPU_FREQ */ + +#endif /* HW_CPUFREQ_H */ diff --git a/bertos/hw/hw_stepper.h b/bertos/hw/hw_stepper.h index 23d1252f..13141124 100644 --- a/bertos/hw/hw_stepper.h +++ b/bertos/hw/hw_stepper.h @@ -41,7 +41,7 @@ #ifndef HW_STEPPER_H #define HW_STEPPER_H -#include "hw/hw_cpu.h" +#include #include @@ -67,7 +67,7 @@ do { \ /** * Stepper timer clock frequency. */ -#define STEPPER_CLOCK ((CLOCK_FREQ) >> STEPPER_PRESCALER_LOG2) +#define STEPPER_CLOCK ((CPU_FREQ) >> STEPPER_PRESCALER_LOG2) /** * us delay to reset a stepper motor. diff --git a/examples/at91sam7s/at91sam7s.mk b/examples/at91sam7s/at91sam7s.mk index 86c3180a..1c3660e0 100644 --- a/examples/at91sam7s/at91sam7s.mk +++ b/examples/at91sam7s/at91sam7s.mk @@ -38,7 +38,7 @@ at91sam7s_CPPASRC = \ at91sam7s_PREFIX = arm-none-eabi- at91sam7s_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -at91sam7s_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_AT91SAM7S256__ -g3 -gdwarf-2 -fverbose-asm -Iexamples/at91sam7s/hw -Iexamples/at91sam7s -Ibertos/cpu/arm +at91sam7s_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_AT91SAM7S256__ -D'CPU_FREQ=(48023000UL)' -g3 -gdwarf-2 -fverbose-asm -Iexamples/at91sam7s/hw -Iexamples/at91sam7s -Ibertos/cpu/arm at91sam7s_LDFLAGS = -nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_ram.ld -Wl,--no-warn-mismatch at91sam7s_CPU = arm7tdmi diff --git a/examples/at91sam7s/hw/hw_cpu.h b/examples/at91sam7s/hw/hw_cpu.h deleted file mode 100644 index 69652610..00000000 --- a/examples/at91sam7s/hw/hw_cpu.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * \file - * - * - * \brief Hardware-specific definitions - * - * \version $Id$ - * - * \author Bernie Innocenti - */ - -/*#* - *#* $Log$ - *#* Revision 1.1 2006/05/18 00:41:47 bernie - *#* New triface devlib application. - *#* - *#*/ - -#ifndef AT91SAM7SEK_HW_H -#define AT91SAM7SEK_HW_H - -/// CPU Clock frequency (48.023 MHz) -#define CLOCK_FREQ (48023000UL) - - -/* Timer IRQ strobe */ -//#if CONFIG_TIMER_STROBE -// #define TIMER_STROBE_ON ATOMIC(PORTD |= BV(PD0)) -// #define TIMER_STROBE_OFF ATOMIC(PORTD &= ~BV(PD0)) -// #define TIMER_STROBE_INIT ATOMIC(PORTD &= ~BV(PD0); DDRD |= BV(PD0)) -//#endif /* CONFIG_TIMER_STROBE */ - -#endif /* AT91SAM7SEK_HW_H */ diff --git a/examples/lm3s1968/hw/hw_cpu.h b/examples/lm3s1968/hw/hw_cpu.h deleted file mode 100644 index 52e3d4b8..00000000 --- a/examples/lm3s1968/hw/hw_cpu.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * - * - * \brief Hardware-specific definitions - * - * \version $Id$ - * - * \author Bernie Innocenti - */ - -#ifndef HW_CPU_H -#define HW_CPU_H - -#warning TODO:This is an example implementation, you must implement it! - -/// CPU Clock frequency -#define CLOCK_FREQ (48023000L/* Implement me! */) - - -/* Timer IRQ strobe */ -//#if CONFIG_TIMER_STROBE -// #define TIMER_STROBE_ON /* Implement me! */ -// #define TIMER_STROBE_OFF /* Implement me! */ -// #define TIMER_STROBE_INIT /* Implement me! */ -//#endif /* CONFIG_TIMER_STROBE */ - -#endif /* HW_CPU_H */ diff --git a/examples/lm3s1968/lm3s1968.mk b/examples/lm3s1968/lm3s1968.mk index 10025e2c..3efdf315 100644 --- a/examples/lm3s1968/lm3s1968.mk +++ b/examples/lm3s1968/lm3s1968.mk @@ -24,7 +24,7 @@ lm3s1968_CSRC = \ lm3s1968_PREFIX = arm-none-eabi- lm3s1968_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug -mthumb -lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 +lm3s1968_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_LM3S1968__ -D'CPU_FREQ=(48023000L)' -g3 -gdwarf-2 -fverbose-asm -mthumb -Iexamples/lm3s1968 -Ibertos/cpu/cortex-m3 lm3s1968_LDFLAGS = -nostartfiles -T examples/lm3s1968/standalone.ld -Wl,--no-warn-mismatch lm3s1968_CPU = cortex-m3 diff --git a/examples/triface/boot/hw/hw_cpu.h b/examples/triface/boot/hw/hw_cpu.h deleted file mode 100644 index 840c82c3..00000000 --- a/examples/triface/boot/hw/hw_cpu.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * Rights Reserved. - * - * \brief Hardware-specific definitions - * - * \version $Id$ - * - * \author Bernie Innocenti - */ - -#ifndef TRIFACE_HW_H -#define TRIFACE_HW_H - -/// CPU Clock frequency (14.7456 MHz) -#define CLOCK_FREQ (14745600UL) - - -/* Timer IRQ strobe */ -//#if CONFIG_TIMER_STROBE -// #define TIMER_STROBE_ON ATOMIC(PORTD |= BV(PD0)) -// #define TIMER_STROBE_OFF ATOMIC(PORTD &= ~BV(PD0)) -// #define TIMER_STROBE_INIT ATOMIC(PORTD &= ~BV(PD0); DDRD |= BV(PD0)) -//#endif /* CONFIG_TIMER_STROBE */ - -#endif /* TRIFACE_HW_H */ - diff --git a/examples/triface/hw/hw_cpu.h b/examples/triface/hw/hw_cpu.h deleted file mode 100644 index 840c82c3..00000000 --- a/examples/triface/hw/hw_cpu.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * \file - * Rights Reserved. - * - * \brief Hardware-specific definitions - * - * \version $Id$ - * - * \author Bernie Innocenti - */ - -#ifndef TRIFACE_HW_H -#define TRIFACE_HW_H - -/// CPU Clock frequency (14.7456 MHz) -#define CLOCK_FREQ (14745600UL) - - -/* Timer IRQ strobe */ -//#if CONFIG_TIMER_STROBE -// #define TIMER_STROBE_ON ATOMIC(PORTD |= BV(PD0)) -// #define TIMER_STROBE_OFF ATOMIC(PORTD &= ~BV(PD0)) -// #define TIMER_STROBE_INIT ATOMIC(PORTD &= ~BV(PD0); DDRD |= BV(PD0)) -//#endif /* CONFIG_TIMER_STROBE */ - -#endif /* TRIFACE_HW_H */ - diff --git a/examples/triface/triface.mk b/examples/triface/triface.mk index 1ee8f4c8..7f394724 100644 --- a/examples/triface/triface.mk +++ b/examples/triface/triface.mk @@ -55,7 +55,7 @@ triface_CSRC = \ triface_PCSRC += bertos/mware/formatwr.c -triface_CFLAGS = -O2 -D'ARCH=(ARCH_TRIFACE)' -fno-strict-aliasing -Iexamples/triface -Ibertos/cpu/avr +triface_CFLAGS = -O2 -D'ARCH=(ARCH_TRIFACE)' -D'CPU_FREQ=(14745600UL)' -fno-strict-aliasing -Iexamples/triface -Ibertos/cpu/avr triface_LDFLAGS = -Wl @@ -78,7 +78,7 @@ boot_CSRC = \ bertos/kern/kfile.c \ # boot_PREFIX = avr- -boot_CPPFLAGS = -D'ARCH=(ARCH_TRIFACE|ARCH_BOOT)' -Iexamples/triface/boot -Ibertos/cpu/avr +boot_CPPFLAGS = -D'ARCH=(ARCH_TRIFACE|ARCH_BOOT)' -D'CPU_FREQ=(14745600UL)' -Iexamples/triface/boot -Ibertos/cpu/avr boot_CFLAGS = -Os -mcall-prologues boot_LDFLAGS = -Wl,--relax -Wl,--section-start=.text=$(BOOT_ADDR_START) diff --git a/wizard/mktemplates/template.mk b/wizard/mktemplates/template.mk index 51688df4..b778e673 100644 --- a/wizard/mktemplates/template.mk +++ b/wizard/mktemplates/template.mk @@ -84,7 +84,7 @@ $pname_ASRC = $($pname_WIZARD_ASRC) $($pname_USER_ASRC) $pname_CFLAGS = $cflags $pname_LDFLAGS = $ldflags $pname_CPPFLAGS = $cppflags -$pname_CPPAFLAGS = $cppaflags +$pname_CPPAFLAGS = -D'CPU_FREQ=($cpuclockfreq)' $cppaflags $pname_CXXFLAGS = $cxxflags $pname_ASFLAGS = $asflags $pname_ARFLAGS = $arflags