
2 changed files with 0 additions and 112 deletions
@ -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_cc2538 |
||||
* @{ |
||||
* |
||||
* @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 <hauke.petersen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/hwtimer_arch.h" |
||||
#include "board.h" |
||||
#include "periph/timer.h" |
||||
#include "hwtimer_cpu.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, HWTIMER_SPEED / 1000000, &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)); |
||||
} |
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Loci Controls Inc. |
||||
* |
||||
* 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_cc2538 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief CPU specific hwtimer configuration options |
||||
* |
||||
* @author Ian Martin <ian@locicontrols.com> |
||||
*/ |
||||
|
||||
#ifndef __HWTIMER_CPU_H |
||||
#define __HWTIMER_CPU_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/**
|
||||
* @name Hardware timer configuration |
||||
* @{ |
||||
*/ |
||||
#define HWTIMER_MAXTIMERS 2 /**< Number of hwtimers */ |
||||
#define HWTIMER_SPEED 1000000 /**< The hardware timer runs at 1MHz */ |
||||
#define HWTIMER_MAXTICKS 0xFFFFFFFF /**< 32-bit timer */ |
||||
/** @} */ |
||||
|
||||
#ifdef __cplusplus |
||||
} /* end extern "C" */ |
||||
#endif |
||||
|
||||
#endif /* __HWTIMER_CPU_H */ |
||||
/** @} */ |
Loading…
Reference in new issue