cc26xx: implement support for CC2650_FAST_RADIO_STARTUP

This commit is contained in:
Atis Elsts 2016-04-25 19:23:59 +03:00
parent 97c1cfc3b4
commit 25c5f0b744

View File

@ -1216,11 +1216,13 @@ on(void)
return RF_CORE_CMD_OK; return RF_CORE_CMD_OK;
} }
#if !CC2650_FAST_RADIO_STARTUP
/* /*
* Request the HF XOSC as the source for the HF clock. Needed before we can * Request the HF XOSC as the source for the HF clock. Needed before we can
* use the FS. This will only request, it will _not_ perform the switch. * use the FS. This will only request, it will _not_ perform the switch.
*/ */
oscillators_request_hf_xosc(); oscillators_request_hf_xosc();
#endif
if(rf_is_on()) { if(rf_is_on()) {
PRINTF("on: We were on. PD=%u, RX=0x%04x \n", rf_core_is_accessible(), PRINTF("on: We were on. PD=%u, RX=0x%04x \n", rf_core_is_accessible(),
@ -1228,22 +1230,23 @@ on(void)
return RF_CORE_CMD_OK; return RF_CORE_CMD_OK;
} }
init_rx_buffers();
/*
* Trigger a switch to the XOSC, so that we can subsequently use the RF FS
* This will block until the XOSC is actually ready, but give how we
* requested it early on, this won't be too long a wait.
* This should be done before starting the RAT.
*/
oscillators_switch_to_hf_xosc();
if(rf_core_boot() != RF_CORE_CMD_OK) { if(rf_core_boot() != RF_CORE_CMD_OK) {
PRINTF("on: rf_core_boot() failed\n"); PRINTF("on: rf_core_boot() failed\n");
return RF_CORE_CMD_ERROR; return RF_CORE_CMD_ERROR;
} }
init_rx_buffers();
rf_core_setup_interrupts(poll_mode); rf_core_setup_interrupts(poll_mode);
/*
* Trigger a switch to the XOSC, so that we can subsequently use the RF FS
* This will block until the XOSC is actually ready, but give how we
* requested it early on, this won't be too long a wait/
*/
oscillators_switch_to_hf_xosc();
if(rf_radio_setup() != RF_CORE_CMD_OK) { if(rf_radio_setup() != RF_CORE_CMD_OK) {
PRINTF("on: radio_setup() failed\n"); PRINTF("on: radio_setup() failed\n");
return RF_CORE_CMD_ERROR; return RF_CORE_CMD_ERROR;
@ -1272,8 +1275,12 @@ off(void)
ENERGEST_OFF(ENERGEST_TYPE_LISTEN); ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
/* Switch HF clock source to the RCOSC to preserve power */ #if !CC2650_FAST_RADIO_STARTUP
/* Switch HF clock source to the RCOSC to preserve power.
* This must be done after stopping RAT.
*/
oscillators_switch_to_hf_rc(); oscillators_switch_to_hf_rc();
#endif
/* We pulled the plug, so we need to restore the status manually */ /* We pulled the plug, so we need to restore the status manually */
((rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf)->status = RF_CORE_RADIO_OP_STATUS_IDLE; ((rfc_CMD_IEEE_RX_t *)cmd_ieee_rx_buf)->status = RF_CORE_RADIO_OP_STATUS_IDLE;