From fb6e6d9ea3ae763c8a3a60a0bb868732a7d5be0c Mon Sep 17 00:00:00 2001 From: thomas-ha Date: Tue, 22 Mar 2016 18:51:05 +0100 Subject: [PATCH] macros for MAC timer --- cpu/cc2538/dev/cc2538-rf.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpu/cc2538/dev/cc2538-rf.h b/cpu/cc2538/dev/cc2538-rf.h index 5edb478ba..287147a92 100644 --- a/cpu/cc2538/dev/cc2538-rf.h +++ b/cpu/cc2538/dev/cc2538-rf.h @@ -129,6 +129,15 @@ REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISFLUSHTX; \ REG(RFCORE_SFR_RFST) = CC2538_RF_CSP_OP_ISFLUSHTX; \ } while(0) +/*--------------------------------------------------------------------------- + * MAC timer + *---------------------------------------------------------------------------*/ +/* Timer conversion */ +#define RADIO_TO_RTIMER(X) ((X) * RTIMER_ARCH_SECOND / SYS_CTRL_32MHZ) + +#define CLOCK_STABLE() do { \ + while ( !(REG(SYS_CTRL_CLOCK_STA) & (SYS_CTRL_CLOCK_STA_XOSC_STB))); \ + } while(0) /*---------------------------------------------------------------------------*/ /** The NETSTACK data structure for the cc2538 RF driver */ extern const struct radio_driver cc2538_rf_driver;