Refactor to not automatically include adc cpu modules; supply a backward compatible...
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 21 Apr 2009 14:11:20 +0000 (14:11 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 21 Apr 2009 14:11:20 +0000 (14:11 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2607 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/cpu/arm/drv/adc_at91.c
bertos/cpu/arm/drv/adc_at91.h
bertos/cpu/avr/drv/adc_avr.c
bertos/cpu/avr/drv/adc_avr.h
bertos/drv/adc.c
bertos/drv/timer.c
examples/at91sam7s/at91sam7s.mk
examples/triface/triface.mk

index 46ba341370ceb03e1bd4f2e9acbb4b406ee5d4ae..bb6a8d11ffd1409fe86d557a86d31e6d233714f1 100644 (file)
  * 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();
index f1125980623afe10d47fe8dedacbf7514c8e2d43..07ef6a40927cd99e98d302d9f9ccb5036d006635 100644 (file)
@@ -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 */
index 2ba5982fe1da47c477c54474e2999ded7e0b43e4..20aa2a192de4144c4c1634516d9f7f2ebf8a9da1 100644 (file)
@@ -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,
index ddd2ce729f6f371857f1d180358ebd7fa5f61fec..fc076f194c5c01877a2badea63e11eaa3b52b81c 100644 (file)
 #ifndef DRV_ADC_AVR_H
 #define DRV_ADC_AVR_H
 
+#include <cfg/compiler.h>
+
 #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 */
index f8a06045fae45b34d010cdcf48ba9aff869a04dd..fd2cff1c3fbe3649cdab7db93faf99c8a853ecf3 100644 (file)
 
 #include <drv/adc.h>
 
-#include CPU_CSOURCE(adc)
+#ifndef WIZ_AUTOGEN
+       #warning Deprecated: now you should include adc_<cpu> directly in the makefile. Remove this line and the following once done.
+       #include CPU_CSOURCE(adc)
+#else
+       #include CPU_HEADER(adc)
+#endif
 
 #include <cfg/debug.h>     // ASSERT()
 #include <cfg/macros.h>    // MIN()
index 694b37eea2b34c0b451b9317c25f9f878ce0a850..d832059086a563134303e16f87146f5cd1691bba 100644 (file)
 #if OS_HOSTED
        //#include OS_CSOURCE(timer)
        #include <emul/timer_posix.c>
+#else
+       #ifndef WIZ_AUTOGEN
+               #warning Deprecated: now you should include timer_<cpu> directly in the makefile. Remove this line and the following once done.
+               #include CPU_CSOURCE(timer)
+       #endif
 #endif
 
 /*
index c7f40745743e2ac9ecdb5c2c9f663fe570f6e894..d4585d2795469a66c80cdb691ca0e0c7727b1f3a 100644 (file)
@@ -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
index 5ebcef4ec451884d6fd37fc8526fdda57461975c..e9861a064c324e0fcfcd16af88d59ef0eb65b671 100644 (file)
@@ -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)