From c7c79fc9b4cdb602e2f2d9f2124403eb2645890d Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Mon, 27 Sep 2010 19:32:10 -0400 Subject: [PATCH] Add TMR_ADDR helper --- lib/include/tmr.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/include/tmr.h b/lib/include/tmr.h index 5fb334f15..bb92fe50c 100644 --- a/lib/include/tmr.h +++ b/lib/include/tmr.h @@ -139,6 +139,9 @@ static volatile struct TMR_struct * const TMR1 = (void *) (TMR1_BASE); static volatile struct TMR_struct * const TMR2 = (void *) (TMR2_BASE); static volatile struct TMR_struct * const TMR3 = (void *) (TMR3_BASE); +/* Get timer pointer from timer number */ +#define TMR_ADDR(x) ((volatile struct TMR_struct *)(((uint32_t)(x) * TMR_OFFSET) + TMR_BASE)) + /* Get timer number from the timer pointer. */ #define TMR_NUM(x) (((uint32_t)(x) - TMR_BASE) / TMR_OFFSET)