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