aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/AVR/gpt_lld.c
diff options
context:
space:
mode:
authorutzig <utzig@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-07-08 22:26:33 +0000
committerutzig <utzig@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-07-08 22:26:33 +0000
commit9970f28cb9a705c7b502c4cf95f2dffb39b7164f (patch)
tree43e1f997e74ac193a5505513d384c58a98622689 /os/hal/platforms/AVR/gpt_lld.c
parentfc67bfe7e4d8c541bc9426d67d06a1bbc7f8bced (diff)
downloadChibiOS-9970f28cb9a705c7b502c4cf95f2dffb39b7164f.tar.gz
ChibiOS-9970f28cb9a705c7b502c4cf95f2dffb39b7164f.tar.bz2
ChibiOS-9970f28cb9a705c7b502c4cf95f2dffb39b7164f.zip
[AVR] use better defines for timer based drivers
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5943 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/AVR/gpt_lld.c')
-rw-r--r--os/hal/platforms/AVR/gpt_lld.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/os/hal/platforms/AVR/gpt_lld.c b/os/hal/platforms/AVR/gpt_lld.c
index 829bb69d2..4f3b535b6 100644
--- a/os/hal/platforms/AVR/gpt_lld.c
+++ b/os/hal/platforms/AVR/gpt_lld.c
@@ -52,19 +52,19 @@ typedef struct {
} timer_registers_t;
const timer_registers_t regs_table[] = {
-#if AVR_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM1 || defined(__DOXYGEN__)
{ &TCCR1A, &TCCR1B, &OCR1AH, &OCR1AL, &TCNT1H, &TCNT1L, &TIFR1, &TIMSK1 },
#endif
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
{ &TCCR2A, &TCCR2B, &OCR2A, &OCR2A, &TCNT2, &TCNT2, &TIFR2, &TIMSK2 },
#endif
-#if AVR_GPT_USE_GPT3 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM3 || defined(__DOXYGEN__)
{ &TCCR3A, &TCCR3B, &OCR3AH, &OCR3AL, &TCNT3H, &TCNT3L, &TIFR3, &TIMSK3 },
#endif
-#if AVR_GPT_USE_GPT4 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM4 || defined(__DOXYGEN__)
{ &TCCR4A, &TCCR4B, &OCR4AH, &OCR4AL, &TCNT4H, &TCNT4L, &TIFR4, &TIMSK4 },
#endif
-#if AVR_GPT_USE_GPT5 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM5 || defined(__DOXYGEN__)
{ &TCCR5A, &TCCR5B, &OCR5AH, &OCR5AL, &TCNT5H, &TCNT5L, &TIFR5, &TIMSK5 },
#endif
};
@@ -73,19 +73,19 @@ const timer_registers_t regs_table[] = {
/* Driver exported variables. */
/*===========================================================================*/
-#if AVR_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM1 || defined(__DOXYGEN__)
GPTDriver GPTD1;
#endif
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
GPTDriver GPTD2;
#endif
-#if AVR_GPT_USE_GPT3 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM3 || defined(__DOXYGEN__)
GPTDriver GPTD3;
#endif
-#if AVR_GPT_USE_GPT4 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM4 || defined(__DOXYGEN__)
GPTDriver GPTD4;
#endif
-#if AVR_GPT_USE_GPT5 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM5 || defined(__DOXYGEN__)
GPTDriver GPTD5;
#endif
@@ -134,23 +134,23 @@ static void gpt_lld_dummy_callback(GPTDriver *gptp)
static uint8_t getTimerIndex(GPTDriver *gptp)
{
uint8_t index = 0;
-#if AVR_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM1 || defined(__DOXYGEN__)
if (gptp == &GPTD1) return index;
else index++;
#endif
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
if (gptp == &GPTD2) return index;
else index++;
#endif
-#if AVR_GPT_USE_GPT3 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM3 || defined(__DOXYGEN__)
if (gptp == &GPTD3) return index;
else index++;
#endif
-#if AVR_GPT_USE_GPT4 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM4 || defined(__DOXYGEN__)
if (gptp == &GPTD4) return index;
else index++;
#endif
-#if AVR_GPT_USE_GPT5 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM5 || defined(__DOXYGEN__)
if (gptp == &GPTD5) return index;
else index++;
#endif
@@ -160,7 +160,7 @@ static uint8_t getTimerIndex(GPTDriver *gptp)
/* Driver interrupt handlers. */
/*===========================================================================*/
-#if AVR_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM1 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(TIMER1_COMPA_vect)
{
CH_IRQ_PROLOGUE();
@@ -169,7 +169,7 @@ CH_IRQ_HANDLER(TIMER1_COMPA_vect)
}
#endif
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(TIMER2_COMPA_vect)
{
CH_IRQ_PROLOGUE();
@@ -178,7 +178,7 @@ CH_IRQ_HANDLER(TIMER2_COMPA_vect)
}
#endif
-#if AVR_GPT_USE_GPT3 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM3 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(TIMER3_COMPA_vect)
{
CH_IRQ_PROLOGUE();
@@ -187,7 +187,7 @@ CH_IRQ_HANDLER(TIMER3_COMPA_vect)
}
#endif
-#if AVR_GPT_USE_GPT4 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM4 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(TIMER4_COMPA_vect)
{
CH_IRQ_PROLOGUE();
@@ -196,7 +196,7 @@ CH_IRQ_HANDLER(TIMER4_COMPA_vect)
}
#endif
-#if AVR_GPT_USE_GPT5 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM5 || defined(__DOXYGEN__)
CH_IRQ_HANDLER(TIMER5_COMPA_vect)
{
CH_IRQ_PROLOGUE();
@@ -216,19 +216,19 @@ CH_IRQ_HANDLER(TIMER5_COMPA_vect)
*/
void gpt_lld_init(void)
{
-#if AVR_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM1 || defined(__DOXYGEN__)
gptObjectInit(&GPTD1);
#endif
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
gptObjectInit(&GPTD2);
#endif
-#if AVR_GPT_USE_GPT3 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM3 || defined(__DOXYGEN__)
gptObjectInit(&GPTD3);
#endif
-#if AVR_GPT_USE_GPT4 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM4 || defined(__DOXYGEN__)
gptObjectInit(&GPTD4);
#endif
-#if AVR_GPT_USE_GPT5 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM5 || defined(__DOXYGEN__)
gptObjectInit(&GPTD5);
#endif
}
@@ -250,7 +250,7 @@ void gpt_lld_start(GPTDriver *gptp)
/* Configuration.*/
-#if AVR_GPT_USE_GPT2 || defined(__DOXYGEN__)
+#if AVR_GPT_USE_TIM2 || defined(__DOXYGEN__)
if (gptp == &GPTD2) {
psc = prescaler(gptp->config->frequency, ratio_extended, PRESCALER_SIZE_EXTENDED);
gptp->clock_source = clock_source_extended[psc] & 0x07;