Removed busy-wait while receiving radio data (just stay awake)
This commit is contained in:
parent
cd2fbcdbd8
commit
837f71e8dd
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: radio-arch.c,v 1.3 2006/10/05 07:46:53 fros4943 Exp $
|
||||
* $Id: radio-arch.c,v 1.4 2006/10/05 12:09:40 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#include "dev/radio-arch.h"
|
||||
@ -68,9 +68,9 @@ doInterfaceActionsBeforeTick(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// Busy-wait while receiving (in main file)
|
||||
// Don't fall asleep while receiving (in main file)
|
||||
if (simReceiving) {
|
||||
busyWaitNext = 1;
|
||||
simDontFallAsleep = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: simEnvChange.c,v 1.2 2006/10/02 15:05:49 fros4943 Exp $
|
||||
* $Id: simEnvChange.c,v 1.3 2006/10/05 12:09:53 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -37,7 +37,7 @@
|
||||
// All registered interfaces
|
||||
extern const struct simInterface *simInterfaces[];
|
||||
|
||||
char busyWaitNext = 0;
|
||||
char simDontFallAsleep = 0;
|
||||
|
||||
int simProcessRunValue;
|
||||
int simEtimerPending;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: simEnvChange.h,v 1.2 2006/10/02 15:05:49 fros4943 Exp $
|
||||
* $Id: simEnvChange.h,v 1.3 2006/10/05 12:09:53 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#ifndef __SIMENVCHANGE_H__
|
||||
@ -43,8 +43,8 @@ extern int simProcessRunValue;
|
||||
extern int simEtimerPending;
|
||||
extern int simNextExpirationTime;
|
||||
|
||||
// Variable that if set to != 0, immediately yields before then next process_run() call
|
||||
extern char busyWaitNext;
|
||||
// Variable that when set to != 0, stops the mote from falling asleep next tick
|
||||
extern char simDontFallAsleep;
|
||||
|
||||
// Definition for registering an interface
|
||||
#define SIM_INTERFACE(name, doActionsBeforeTick, doActionsAfterTick) \
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: code_main_template,v 1.6 2006/10/05 07:48:15 fros4943 Exp $
|
||||
* $Id: code_main_template,v 1.7 2006/10/05 12:10:12 fros4943 Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -116,14 +116,14 @@ start_process_run_loop(void *data)
|
||||
/* Always pretend we have processes left while inside process_run() */
|
||||
simProcessRunValue = 1;
|
||||
|
||||
// Busy-wait while receiving
|
||||
while (busyWaitNext > 0) {
|
||||
busyWaitNext--;
|
||||
cooja_mt_yield();
|
||||
}
|
||||
|
||||
simProcessRunValue = process_run();
|
||||
|
||||
// Check if we must stay awake
|
||||
if (simDontFallAsleep) {
|
||||
simDontFallAsleep=0;
|
||||
simProcessRunValue = 1;
|
||||
}
|
||||
|
||||
/* Yield thread when one process_run has completed */
|
||||
cooja_mt_yield();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user