[Tinyos-commits] CVS: tinyos-1.x/tos/lib/CC2420Radio
CC2420RadioM.nc, 1.41, 1.42
Joe Polastre
jpolastre at users.sourceforge.net
Mon Aug 15 11:04:58 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/CC2420Radio
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26676
Modified Files:
CC2420RadioM.nc
Log Message:
added protection around the start task so that it can't be posted more than once
Index: CC2420RadioM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** CC2420RadioM.nc 15 Aug 2005 17:51:45 -0000 1.41
--- CC2420RadioM.nc 15 Aug 2005 18:04:55 -0000 1.42
***************
*** 76,79 ****
--- 76,80 ----
enum {
DISABLED_STATE = 0,
+ DISABLED_STATE_STARTTASK,
IDLE_STATE,
TX_STATE,
***************
*** 237,241 ****
task void startRadio() {
! call SplitControl.start();
}
--- 238,251 ----
task void startRadio() {
! result_t success = FAIL;
! atomic {
! if (stateRadio == DISABLED_STATE_STARTTASK) {
! stateRadio = DISABLED_STATE;
! success = SUCCESS;
! }
! }
!
! if (success == SUCCESS)
! call SplitControl.start();
}
***************
*** 249,253 ****
// SplitControl.startDone(). Ideally, Main would be changed to
// understand SplitControl and run each SplitControl serially.
! return post startRadio();
}
--- 259,275 ----
// SplitControl.startDone(). Ideally, Main would be changed to
// understand SplitControl and run each SplitControl serially.
! result_t success = FAIL;
!
! atomic {
! if (stateRadio == DISABLED_STATE) {
! // only allow the task to be posted once.
! if (post startRadio()) {
! success = SUCCESS;
! stateRadio = DISABLED_STATE_STARTTASK;
! }
! }
! }
!
! return success;
}
More information about the Tinyos-commits
mailing list