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
This commit is contained in:
George Oikonomou 2016-07-16 17:10:21 +01:00
parent 6ef9509dfb
commit c359e98bf1

View File

@ -135,8 +135,6 @@ static uint8_t volatile poll_mode = 0;
static uint8_t send_on_cca = 1; static uint8_t send_on_cca = 1;
static int8_t rssi; static int8_t rssi;
static uint8_t crc_corr; static uint8_t crc_corr;
void mac_timer_init(void);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static uint8_t rf_flags; static uint8_t rf_flags;
static uint8_t rf_channel = CC2538_RF_CHANNEL; static uint8_t rf_channel = CC2538_RF_CHANNEL;
@ -348,6 +346,20 @@ set_frame_filtering(uint8_t enable)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void 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) set_poll_mode(uint8_t enable)
{ {
poll_mode = enable; poll_mode = enable;
@ -1155,17 +1167,4 @@ cc2538_rf_set_promiscous_mode(char p)
set_frame_filtering(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));
}
/*---------------------------------------------------------------------------*/
/** @} */ /** @} */