1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:52:44 +01:00

cpu/atmega{1281,2560}: Relocate default timer config

This commit is contained in:
Marian Buschsieweke 2020-05-27 20:10:07 +02:00
parent 044a3f9a4c
commit dfa6863275
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
5 changed files with 114 additions and 44 deletions

View File

@ -48,50 +48,6 @@ extern "C" {
#endif /* CLOCK_CORECLOCK */
/** @} */
/**
* @name Timer configuration
*
* @details Only the 16 bit timers are used by xtimer
*
* ATmega1281
* ==========
* The ATmega1281 has 6 timers. Timer0 and Timer2 are 8 Bit Timers,
* Timer0 has special uses too and therefore we'll avoid using it.
*
* The timer driver only supports the four 16-bit timers (Timer1, Timer3,
* Timer4, Timer5), so those are the only ones we can use here.
*
* ATmega2560
* ==========
* The timer driver only supports the four 16-bit timers (Timer1, Timer3,
* Timer4, Timer5), so those are the only ones we can use here.
*
* @{
*/
#ifndef TIMER_NUMOF
#if defined(CPU_ATMEGA2560) || defined(CPU_ATMEGA1281)
#define TIMER_NUMOF (2U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER1
#define TIMER_0_MASK &TIMSK1
#define TIMER_0_FLAG &TIFR1
#define TIMER_0_ISRA TIMER1_COMPA_vect
#define TIMER_0_ISRB TIMER1_COMPB_vect
#define TIMER_0_ISRC TIMER1_COMPC_vect
#define TIMER_1 MEGA_TIMER4
#define TIMER_1_MASK &TIMSK4
#define TIMER_1_FLAG &TIFR4
#define TIMER_1_ISRA TIMER4_COMPA_vect
#define TIMER_1_ISRB TIMER4_COMPB_vect
#define TIMER_1_ISRC TIMER4_COMPC_vect
#else
#define TIMER_NUMOF (0U)
#endif
#endif /* TIMER_NUMOF */
/** @} */
/**
* @name UART configuration
*

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2015 HAW Hamburg
* 2016 Freie Universität Berlin
* 2016 INRIA
*
* 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_atmega1281
* @{
*
* @file
* @brief Default timer configuration
*
* @author René Herthel <rene-herthel@outlook.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef DEFAULT_TIMER_CONFIG_H
#define DEFAULT_TIMER_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TIMER_NUMOF
#define TIMER_NUMOF (2U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER1
#define TIMER_0_MASK &TIMSK1
#define TIMER_0_FLAG &TIFR1
#define TIMER_0_ISRA TIMER1_COMPA_vect
#define TIMER_0_ISRB TIMER1_COMPB_vect
#define TIMER_0_ISRC TIMER1_COMPC_vect
#define TIMER_1 MEGA_TIMER4
#define TIMER_1_MASK &TIMSK4
#define TIMER_1_FLAG &TIFR4
#define TIMER_1_ISRA TIMER4_COMPA_vect
#define TIMER_1_ISRB TIMER4_COMPB_vect
#define TIMER_1_ISRC TIMER4_COMPC_vect
#endif /* TIMER_NUMOF */
#ifdef __cplusplus
}
#endif
#endif /* DEFAULT_TIMER_CONFIG_H */
/** @} */

View File

@ -75,5 +75,8 @@ enum {
}
#endif
#include "periph_conf.h"
#include "default_timer_config.h"
#endif /* PERIPH_CPU_H */
/** @} */

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2015 HAW Hamburg
* 2016 Freie Universität Berlin
* 2016 INRIA
*
* 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 Default timer configuration
*
* @author René Herthel <rene-herthel@outlook.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef DEFAULT_TIMER_CONFIG_H
#define DEFAULT_TIMER_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TIMER_NUMOF
#define TIMER_NUMOF (2U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER1
#define TIMER_0_MASK &TIMSK1
#define TIMER_0_FLAG &TIFR1
#define TIMER_0_ISRA TIMER1_COMPA_vect
#define TIMER_0_ISRB TIMER1_COMPB_vect
#define TIMER_0_ISRC TIMER1_COMPC_vect
#define TIMER_1 MEGA_TIMER4
#define TIMER_1_MASK &TIMSK4
#define TIMER_1_FLAG &TIFR4
#define TIMER_1_ISRA TIMER4_COMPA_vect
#define TIMER_1_ISRB TIMER4_COMPB_vect
#define TIMER_1_ISRC TIMER4_COMPC_vect
#endif /* TIMER_NUMOF */
#ifdef __cplusplus
}
#endif
#endif /* DEFAULT_TIMER_CONFIG_H */
/** @} */

View File

@ -77,5 +77,8 @@ enum {
}
#endif
#include "periph_conf.h"
#include "default_timer_config.h"
#endif /* PERIPH_CPU_H */
/** @} */