From 83e6995af1bf3ecded805c4433e1d7b900ac7256 Mon Sep 17 00:00:00 2001 From: maralvira Date: Sun, 7 Nov 2010 14:25:07 +0000 Subject: [PATCH] Add TMR_ADDR helper --- cpu/mc1322x/lib/include/tmr.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpu/mc1322x/lib/include/tmr.h b/cpu/mc1322x/lib/include/tmr.h index 49ceac607..1e4ebf5da 100644 --- a/cpu/mc1322x/lib/include/tmr.h +++ b/cpu/mc1322x/lib/include/tmr.h @@ -30,7 +30,7 @@ * This file is part of libmc1322x: see http://mc1322x.devl.org * for details. * - * $Id: tmr.h,v 1.8 2010/11/07 14:24:36 maralvira Exp $ + * $Id: tmr.h,v 1.9 2010/11/07 14:25:07 maralvira Exp $ */ #ifndef 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)