From 1cb0762bd0bd50d31b3bc86ba2bfb14229729d2f Mon Sep 17 00:00:00 2001 From: maralvira Date: Mon, 13 Sep 2010 14:15:58 +0000 Subject: [PATCH] Don't post from an interrupt context --- this resulted in process corruption if a packet was received at the wrong time. The maca_thread now just PAUSEs and checks rx_head instead of waiting for a data event to be posted. --- cpu/mc1322x/contiki-maca.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cpu/mc1322x/contiki-maca.c b/cpu/mc1322x/contiki-maca.c index b702bcd22..4a3171946 100644 --- a/cpu/mc1322x/contiki-maca.c +++ b/cpu/mc1322x/contiki-maca.c @@ -30,7 +30,7 @@ * * This file is part of the Contiki OS. * - * $Id: contiki-maca.c,v 1.3 2010/07/28 18:48:51 maralvira Exp $ + * $Id: contiki-maca.c,v 1.4 2010/09/13 14:15:58 maralvira Exp $ */ #include @@ -237,8 +237,7 @@ PROCESS_THREAD(contiki_maca_process, ev, data) PROCESS_BEGIN(); while (1) { - PROCESS_WAIT_EVENT_UNTIL(ev == event_data_ready); -// PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); + PROCESS_PAUSE(); /* check if there is a request to turn the radio on or off */ if(contiki_maca_request_on == 1) { @@ -265,10 +264,6 @@ PROCESS_THREAD(contiki_maca_process, ev, data) PROCESS_END(); } -void maca_rx_callback(volatile packet_t *p __attribute((unused))) { - process_post(&contiki_maca_process, event_data_ready, NULL); -} - #if BLOCKING_TX void maca_tx_callback(volatile packet_t *p __attribute((unused))) { tx_complete = 1;