added support for avoiding sleeping in LPM3 when DCO needs to be running - needed for uart DMA

This commit is contained in:
joxe 2011-01-05 12:04:23 +00:00
parent 565fda47aa
commit 2e1c856741

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: contiki-sky-main.c,v 1.85 2010/12/16 22:52:12 adamdunkels Exp $
* @(#)$Id: contiki-sky-main.c,v 1.86 2011/01/05 12:04:23 joxe Exp $
*/
#include <signal.h>
@ -72,12 +72,12 @@
#endif /* UIP_ROUTER_MODULE */
extern const struct uip_router UIP_ROUTER_MODULE;
#endif /* UIP_CONF_ROUTER */
#if DCOSYNCH_CONF_ENABLED
static struct timer mgt_timer;
#endif
extern int msp430_dco_required;
#ifndef WITH_UIP
#define WITH_UIP 0
@ -443,13 +443,17 @@ main(int argc, char **argv)
were awake. */
energest_type_set(ENERGEST_TYPE_IRQ, irq_energest);
watchdog_stop();
_BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This
statement will block
until the CPU is
woken up by an
interrupt that sets
the wake up flag. */
/* check if the DCO needs to be on - if so - only LPM 1 */
if (msp430_dco_required) {
_BIS_SR(GIE | CPUOFF); /* LPM1 sleep for DMA to work!. */
} else {
_BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This
statement will block
until the CPU is
woken up by an
interrupt that sets
the wake up flag. */
}
/* We get the current processing time for interrupts that was
done during the LPM and store it for next time around. */
dint();