From: batt Date: Tue, 21 Apr 2009 14:11:20 +0000 (+0000) Subject: Refactor to not automatically include adc cpu modules; supply a backward compatible... X-Git-Tag: 2.1.0~75 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=055132222c4380c116e15f66a9ab7e1f561d329e;hp=83e8cfaaf519136e906463151f91ea6bac409973;p=bertos.git Refactor to not automatically include adc cpu modules; supply a backward compatible fallback for this change for adc and timer modules. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2607 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/drv/adc_at91.c b/bertos/cpu/arm/drv/adc_at91.c index 46ba3413..bb6a8d11 100644 --- a/bertos/cpu/arm/drv/adc_at91.c +++ b/bertos/cpu/arm/drv/adc_at91.c @@ -114,7 +114,7 @@ * Select mux channel \a ch. * \todo only first 8 channels are selectable! */ -INLINE void adc_hw_select_ch(uint8_t ch) +void adc_hw_select_ch(uint8_t ch) { //Disable all channels ADC_CHDR = ADC_CH_MASK; @@ -128,7 +128,7 @@ INLINE void adc_hw_select_ch(uint8_t ch) * If a kernel is present, preempt until convertion is complete, otherwise * a busy wait on ADCS bit is done. */ -INLINE uint16_t adc_hw_read(void) +uint16_t adc_hw_read(void) { ASSERT(!(ADC_SR & ADC_EOC_MASK)); @@ -155,7 +155,7 @@ INLINE uint16_t adc_hw_read(void) /** * Init ADC hardware. */ -INLINE void adc_hw_init(void) +void adc_hw_init(void) { //Init ADC pins. ADC_INIT_PINS(); diff --git a/bertos/cpu/arm/drv/adc_at91.h b/bertos/cpu/arm/drv/adc_at91.h index f1125980..07ef6a40 100644 --- a/bertos/cpu/arm/drv/adc_at91.h +++ b/bertos/cpu/arm/drv/adc_at91.h @@ -90,5 +90,8 @@ do { \ } while (0) +void adc_hw_select_ch(uint8_t ch); +uint16_t adc_hw_read(void); +void adc_hw_init(void); #endif /* DRV_ADC_AT91_H */ diff --git a/bertos/cpu/avr/drv/adc_avr.c b/bertos/cpu/avr/drv/adc_avr.c index 2ba5982f..20aa2a19 100644 --- a/bertos/cpu/avr/drv/adc_avr.c +++ b/bertos/cpu/avr/drv/adc_avr.c @@ -97,7 +97,7 @@ * Select mux channel \a ch. * \todo only first 8 channels are selectable! */ -INLINE void adc_hw_select_ch(uint8_t ch) +void adc_hw_select_ch(uint8_t ch) { /* Set to 0 all mux registers */ ADMUX &= ~(BV(MUX4) | BV(MUX3) | BV(MUX2) | BV(MUX1) | BV(MUX0)); @@ -112,7 +112,7 @@ INLINE void adc_hw_select_ch(uint8_t ch) * If a kernel is present, preempt until convertion is complete, otherwise * a busy wait on ADCS bit is done. */ -INLINE uint16_t adc_hw_read(void) +uint16_t adc_hw_read(void) { // Ensure another convertion is not running. ASSERT(!(ADCSRA & BV(ADSC))); @@ -136,7 +136,7 @@ INLINE uint16_t adc_hw_read(void) /** * Init ADC hardware. */ -INLINE void adc_hw_init(void) +void adc_hw_init(void) { /* * Select channel 0 as default, diff --git a/bertos/cpu/avr/drv/adc_avr.h b/bertos/cpu/avr/drv/adc_avr.h index ddd2ce72..fc076f19 100644 --- a/bertos/cpu/avr/drv/adc_avr.h +++ b/bertos/cpu/avr/drv/adc_avr.h @@ -15,7 +15,13 @@ #ifndef DRV_ADC_AVR_H #define DRV_ADC_AVR_H +#include + #define ADC_MUX_MAXCH 7 #define ADC_BITS 10 +void adc_hw_select_ch(uint8_t ch); +uint16_t adc_hw_read(void); +void adc_hw_init(void); + #endif /* DRV_ADC_AVR_H */ diff --git a/bertos/drv/adc.c b/bertos/drv/adc.c index f8a06045..fd2cff1c 100644 --- a/bertos/drv/adc.c +++ b/bertos/drv/adc.c @@ -38,7 +38,12 @@ #include -#include CPU_CSOURCE(adc) +#ifndef WIZ_AUTOGEN + #warning Deprecated: now you should include adc_ directly in the makefile. Remove this line and the following once done. + #include CPU_CSOURCE(adc) +#else + #include CPU_HEADER(adc) +#endif #include // ASSERT() #include // MIN() diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index 694b37ee..d8320590 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -58,6 +58,11 @@ #if OS_HOSTED //#include OS_CSOURCE(timer) #include +#else + #ifndef WIZ_AUTOGEN + #warning Deprecated: now you should include timer_ directly in the makefile. Remove this line and the following once done. + #include CPU_CSOURCE(timer) + #endif #endif /* diff --git a/examples/at91sam7s/at91sam7s.mk b/examples/at91sam7s/at91sam7s.mk index c7f40745..d4585d27 100644 --- a/examples/at91sam7s/at91sam7s.mk +++ b/examples/at91sam7s/at91sam7s.mk @@ -41,7 +41,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__ -D'CPU_FREQ=(48023000UL)' -g3 -gdwarf-2 -fverbose-asm -Iexamples/at91sam7s -Ibertos/cpu/arm +at91sam7s_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_AT91SAM7S256__ -D'CPU_FREQ=(48023000UL)' -D'WIZ_AUTOGEN' -g3 -gdwarf-2 -fverbose-asm -Iexamples/at91sam7s -Ibertos/cpu/arm at91sam7s_LDFLAGS = -nostartfiles -T bertos/cpu/arm/scripts/at91sam7_256_rom.ld -Wl,--no-warn-mismatch at91sam7s_CPU = arm7tdmi diff --git a/examples/triface/triface.mk b/examples/triface/triface.mk index 5ebcef4e..e9861a06 100644 --- a/examples/triface/triface.mk +++ b/examples/triface/triface.mk @@ -56,7 +56,7 @@ triface_CSRC = \ triface_PCSRC += bertos/mware/formatwr.c -triface_CFLAGS = -O2 -D'ARCH=(ARCH_TRIFACE)' -D'CPU_FREQ=(14745600UL)' -fno-strict-aliasing -Iexamples/triface -Ibertos/cpu/avr +triface_CFLAGS = -O2 -D'ARCH=(ARCH_TRIFACE)' -D'CPU_FREQ=(14745600UL)' -D'WIZ_AUTOGEN' -fno-strict-aliasing -Iexamples/triface -Ibertos/cpu/avr triface_LDFLAGS = -Wl @@ -71,16 +71,18 @@ boot_CSRC = \ examples/triface/boot/main.c \ bertos/cpu/avr/drv/ser_avr.c \ bertos/cpu/avr/drv/flash_avr.c \ - bertos/cpu/avr/drv/timer_avr.c \ bertos/drv/timer.c \ + bertos/cpu/avr/drv/timer_avr.c \ bertos/drv/ser.c \ bertos/net/xmodem.c \ bertos/algo/crc.c \ bertos/mware/hex.c \ bertos/kern/kfile.c \ # + boot_PREFIX = avr- -boot_CPPFLAGS = -D'ARCH=(ARCH_TRIFACE|ARCH_BOOT)' -D'CPU_FREQ=(14745600UL)' -Iexamples/triface/boot -Ibertos/cpu/avr + +boot_CPPFLAGS = -D'ARCH=(ARCH_TRIFACE|ARCH_BOOT)' -D'CPU_FREQ=(14745600UL)' -D'WIZ_AUTOGEN' -Iexamples/triface/boot -Ibertos/cpu/avr boot_CFLAGS = -Os -mcall-prologues boot_LDFLAGS = -Wl,--relax -Wl,--section-start=.text=$(BOOT_ADDR_START)