From c359e98bf18bf81b7f58f48cb9f16283b166742d Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 16 Jul 2016 17:10:21 +0100 Subject: [PATCH] Change mac_timer_init() to static We also move the function to a different location so we won't have to provide the prototype separately --- cpu/cc2538/dev/cc2538-rf.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/cpu/cc2538/dev/cc2538-rf.c b/cpu/cc2538/dev/cc2538-rf.c index 17cbf7a1d..b5b04da8c 100644 --- a/cpu/cc2538/dev/cc2538-rf.c +++ b/cpu/cc2538/dev/cc2538-rf.c @@ -135,8 +135,6 @@ static uint8_t volatile poll_mode = 0; static uint8_t send_on_cca = 1; static int8_t rssi; static uint8_t crc_corr; - -void mac_timer_init(void); /*---------------------------------------------------------------------------*/ static uint8_t rf_flags; static uint8_t rf_channel = CC2538_RF_CHANNEL; @@ -348,6 +346,20 @@ set_frame_filtering(uint8_t enable) } /*---------------------------------------------------------------------------*/ static void +mac_timer_init(void) +{ + CLOCK_STABLE(); + REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; + REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_RUN; + while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); + REG(RFCORE_SFR_MTCTRL) &= ~RFCORE_SFR_MTCTRL_RUN; + while(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE); + REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; + REG(RFCORE_SFR_MTCTRL) |= (RFCORE_SFR_MTCTRL_RUN); + while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); +} +/*---------------------------------------------------------------------------*/ +static void set_poll_mode(uint8_t enable) { poll_mode = enable; @@ -1155,17 +1167,4 @@ cc2538_rf_set_promiscous_mode(char p) set_frame_filtering(p); } /*---------------------------------------------------------------------------*/ -void mac_timer_init(void) -{ - CLOCK_STABLE(); - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_RUN; - while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); - REG(RFCORE_SFR_MTCTRL) &= ~RFCORE_SFR_MTCTRL_RUN; - while(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE); - REG(RFCORE_SFR_MTCTRL) |= RFCORE_SFR_MTCTRL_SYNC; - REG(RFCORE_SFR_MTCTRL) |= (RFCORE_SFR_MTCTRL_RUN); - while(!(REG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE)); -} -/*---------------------------------------------------------------------------*/ /** @} */