diff --git a/cpu/atmega2560/Makefile.include b/cpu/atmega2560/Makefile.include index 0adb583171..360d0c6b08 100644 --- a/cpu/atmega2560/Makefile.include +++ b/cpu/atmega2560/Makefile.include @@ -1,9 +1,12 @@ - # this CPU implementation is using the new core/CPU interface export CFLAGS += -DCOREIF_NG=1 # tell the build system that the CPU depends on the atmega common files -export USEMODULE += atmega_common +USEMODULE += atmega_common +# use hwtimer compatibility module +USEMODULE += hwtimer_compat +# export the peripheral drivers to be linked into the final binary +export USEMODULE += periph # define path to atmega common module, which is needed for this CPU export ATMEGA_COMMON = $(RIOTCPU)/atmega_common/ @@ -18,8 +21,6 @@ export INCLUDES += -I$(RIOTCPU)/$(CPU)/include # Without this the interrupt vectors will not be linked correctly! export UNDEF += $(BINDIR)cpu/startup.o -# export the peripheral drivers to be linked into the final binary -export USEMODULE += periph # CPU depends on the atmega common module, so include it include $(ATMEGA_COMMON)Makefile.include diff --git a/cpu/atmega2560/hwtimer_arch.c b/cpu/atmega2560/hwtimer_arch.c deleted file mode 100644 index a6bab720a9..0000000000 --- a/cpu/atmega2560/hwtimer_arch.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_atmega2560 - * @{ - * - * @file - * @brief Implementation of the kernels hwtimer interface - * - * The hardware timer implementation uses the ATmega2560 build-in system timer as back-end. - * - * @author Hauke Petersen - * @author Hinnerk van Bruinehsen - * - * @} - */ - -#include "arch/hwtimer_arch.h" -#include "board.h" -#include "periph/timer.h" -#include "thread.h" - - -void irq_handler(int channel); -void (*timeout_handler)(int); - - -void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) -{ - timeout_handler = handler; - timer_init(HW_TIMER, 1, &irq_handler); -} - -void hwtimer_arch_enable_interrupt(void) -{ - timer_irq_enable(HW_TIMER); -} - -void hwtimer_arch_disable_interrupt(void) -{ - timer_irq_disable(HW_TIMER); -} - -void hwtimer_arch_set(unsigned long offset, short timer) -{ - timer_set(HW_TIMER, timer, offset); -} - -void hwtimer_arch_set_absolute(unsigned long value, short timer) -{ - timer_set_absolute(HW_TIMER, timer, value); -} - -void hwtimer_arch_unset(short timer) -{ - timer_clear(HW_TIMER, timer); -} - -unsigned long hwtimer_arch_now(void) -{ - return timer_read(HW_TIMER); -} - -void irq_handler(int channel) -{ - timeout_handler((short)(channel)); -} diff --git a/cpu/lpc1768/Makefile.include b/cpu/lpc1768/Makefile.include index f16ada89b8..99de28dcc7 100644 --- a/cpu/lpc1768/Makefile.include +++ b/cpu/lpc1768/Makefile.include @@ -1,3 +1,6 @@ export CPU_ARCH = cortex-m3 +# use hwtimer compatibility module +USEMODULE += hwtimer_compat + include $(RIOTCPU)/Makefile.include.cortexm_common diff --git a/cpu/lpc1768/hwtimer_arch.c b/cpu/lpc1768/hwtimer_arch.c deleted file mode 100644 index 1587efef1d..0000000000 --- a/cpu/lpc1768/hwtimer_arch.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser General - * Public License v2.1. See the file LICENSE in the top level directory for more - * details. - */ - -/** - * @ingroup cpu_lpc1768 - * @{ - * - * @file - * @brief Implementation of the kernel's hwtimer interface - * - * The hardware timer implementation uses the Cortex build-in system timer as back-end. - * - * @author Hauke Petersen - * - * @} - */ - -#include "arch/hwtimer_arch.h" -#include "periph/timer.h" -#include "board.h" -#include "thread.h" - -void irq_handler(int channel); -void (*timeout_handler)(int); - -void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) -{ - timeout_handler = handler; - timer_init(HW_TIMER, 1, &irq_handler); -} - -void hwtimer_arch_enable_interrupt(void) -{ - timer_irq_enable(HW_TIMER); -} - -void hwtimer_arch_disable_interrupt(void) -{ - timer_irq_disable(HW_TIMER); -} - -void hwtimer_arch_set(unsigned long offset, short timer) -{ - timer_set(HW_TIMER, timer, offset); -} - -void hwtimer_arch_set_absolute(unsigned long value, short timer) -{ - timer_set_absolute(HW_TIMER, timer, value); -} - -void hwtimer_arch_unset(short timer) -{ - timer_clear(HW_TIMER, timer); -} - -unsigned long hwtimer_arch_now(void) -{ - return timer_read(HW_TIMER); -} - -void irq_handler(int channel) -{ - timeout_handler((short)(channel)); -} diff --git a/cpu/nrf51/Makefile.include b/cpu/nrf51/Makefile.include index 04c2fd5dd4..da01dcdf4f 100644 --- a/cpu/nrf51/Makefile.include +++ b/cpu/nrf51/Makefile.include @@ -1,3 +1,6 @@ export CPU_ARCH = cortex-m0 +# use hwtimer compatibility module +USEMODULE += hwtimer_compat + include $(RIOTCPU)/Makefile.include.cortexm_common diff --git a/cpu/nrf51/hwtimer_arch.c b/cpu/nrf51/hwtimer_arch.c deleted file mode 100644 index 2e47719dc8..0000000000 --- a/cpu/nrf51/hwtimer_arch.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser General - * Public License v2.1. See the file LICENSE in the top level directory for more - * details. - */ - -/** - * @ingroup cpu_nrf51822 - * @{ - * - * @file - * @brief Implementation of the kernels hwtimer interface - * - * The hardware timer implementation uses a direct mapping to the low-level UART driver. - * - * @author Hauke Petersen - * - * @} - */ - -#include "arch/hwtimer_arch.h" -#include "board.h" -#include "periph/timer.h" -#include "thread.h" - - -void irq_handler(int channel); -void (*timeout_handler)(int); - - -void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) -{ - (void) fcpu; - timeout_handler = handler; - timer_init(HW_TIMER, 1, &irq_handler); -} - -void hwtimer_arch_enable_interrupt(void) -{ - timer_irq_enable(HW_TIMER); -} - -void hwtimer_arch_disable_interrupt(void) -{ - timer_irq_disable(HW_TIMER); -} - -void hwtimer_arch_set(unsigned long offset, short timer) -{ - timer_set(HW_TIMER, timer, offset); -} - -void hwtimer_arch_set_absolute(unsigned long value, short timer) -{ - timer_set_absolute(HW_TIMER, timer, value); -} - -void hwtimer_arch_unset(short timer) -{ - timer_clear(HW_TIMER, timer); -} - -unsigned long hwtimer_arch_now(void) -{ - return timer_read(HW_TIMER); -} - -void irq_handler(int channel) -{ - timeout_handler((short)(channel)); -} diff --git a/cpu/sam3/Makefile.include b/cpu/sam3/Makefile.include index f16ada89b8..99de28dcc7 100644 --- a/cpu/sam3/Makefile.include +++ b/cpu/sam3/Makefile.include @@ -1,3 +1,6 @@ export CPU_ARCH = cortex-m3 +# use hwtimer compatibility module +USEMODULE += hwtimer_compat + include $(RIOTCPU)/Makefile.include.cortexm_common diff --git a/cpu/sam3/hwtimer_arch.c b/cpu/sam3/hwtimer_arch.c deleted file mode 100644 index bcf558aa10..0000000000 --- a/cpu/sam3/hwtimer_arch.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_sam3 - * @{ - * - * @file - * @brief Implementation of the kernels hwtimer interface - * - * The hardware timer implementation uses the Cortex build-in system timer as back-end. - * - * @author Hauke Petersen - * - * @} - */ - -#include "arch/hwtimer_arch.h" -#include "board.h" -#include "periph/timer.h" -#include "thread.h" - - -void irq_handler(int channel); -void (*timeout_handler)(int); - - -void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) -{ - timeout_handler = handler; - timer_init(HW_TIMER, 1, &irq_handler); -} - -void hwtimer_arch_enable_interrupt(void) -{ - timer_irq_enable(HW_TIMER); -} - -void hwtimer_arch_disable_interrupt(void) -{ - timer_irq_disable(HW_TIMER); -} - -void hwtimer_arch_set(unsigned long offset, short timer) -{ - timer_set(HW_TIMER, timer, offset); -} - -void hwtimer_arch_set_absolute(unsigned long value, short timer) -{ - timer_set_absolute(HW_TIMER, timer, value); -} - -void hwtimer_arch_unset(short timer) -{ - timer_clear(HW_TIMER, timer); -} - -unsigned long hwtimer_arch_now(void) -{ - return timer_read(HW_TIMER); -} - -void irq_handler(int channel) -{ - timeout_handler((short)(channel)); -}