cc2538: usb: Use the new LPM peripheral registration

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
This commit is contained in:
Benoît Thébaudeau 2013-11-15 17:14:45 +01:00
parent d35732505b
commit 0692ee251d
4 changed files with 23 additions and 15 deletions

View file

@ -41,7 +41,6 @@
#include "dev/sys-ctrl.h"
#include "dev/scb.h"
#include "dev/rfcore-xreg.h"
#include "dev/usb-regs.h"
#include "rtimer-arch.h"
#include "lpm.h"
#include "reg.h"
@ -103,7 +102,7 @@ static uint8_t max_pm;
#ifdef LPM_CONF_PERIPH_PERMIT_PM1_FUNCS_MAX
#define LPM_PERIPH_PERMIT_PM1_FUNCS_MAX LPM_CONF_PERIPH_PERMIT_PM1_FUNCS_MAX
#else
#define LPM_PERIPH_PERMIT_PM1_FUNCS_MAX 0
#define LPM_PERIPH_PERMIT_PM1_FUNCS_MAX 1
#endif
lpm_periph_permit_pm1_func_t
@ -217,15 +216,12 @@ lpm_enter()
rtimer_clock_t duration;
/*
* If either the RF, the USB or the registered peripherals are on, dropping to
* PM1/2 would equal pulling the rug (32MHz XOSC) from under their feet. Thus,
* we only drop to PM0. PM0 is also used if max_pm==0.
*
* Note: USB Suspend/Resume/Remote Wake-Up are not supported. Once the PLL is
* on, it stays on.
* If either the RF or the registered peripherals are on, dropping to PM1/2
* would equal pulling the rug (32MHz XOSC) from under their feet. Thus, we
* only drop to PM0. PM0 is also used if max_pm==0.
*/
if((REG(RFCORE_XREG_FSMSTAT0) & RFCORE_XREG_FSMSTAT0_FSM_FFCTRL_STATE) != 0
|| REG(USB_CTRL) != 0 || !periph_permit_pm1() || max_pm == 0) {
|| !periph_permit_pm1() || max_pm == 0) {
enter_pm0();
/* We reach here when the interrupt context that woke us up has returned */
@ -233,8 +229,7 @@ lpm_enter()
}
/*
* Registered peripherals were off. USB PLL was off. Radio was off: Some Duty
* Cycling in place.
* Registered peripherals were off. Radio was off: Some Duty Cycling in place.
* rtimers run on the Sleep Timer. Thus, if we have a scheduled rtimer
* task, a Sleep Timer interrupt will fire and will wake us up.
* Choose the most suitable PM based on anticipated deep sleep duration
@ -251,7 +246,7 @@ lpm_enter()
}
/* If we reach here, we -may- (but may as well not) be dropping to PM1+. We
* know the registered peripherals, USB and RF are off so we can switch to the
* know the registered peripherals and RF are off so we can switch to the
* 16MHz RCOSC. */
select_16_mhz_rcosc();