[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/SystemCore/Hello Hello.h, 1.7,
1.8 HelloC.nc, 1.19, 1.20 HelloM.nc, 1.24, 1.25
Gilman Tolle
gtolle at users.sourceforge.net
Mon Sep 6 14:51:27 PDT 2004
Update of /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/Hello
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27083/Hello
Modified Files:
Hello.h HelloC.nc HelloM.nc
Log Message:
XSM-Related Modifications
* Initial response only occurs after power-on or external reset, not
after network reprogramming
* Initial response now occurs before other components are initialized
* Drip can be put to sleep, preventing all upcalls except for the
wakeup message
* Bootloader will start the XSM grenade timer
* Bootloader has a check to ensure that the factory image has been completely
copied before executing it
* XSM Serial ID is now returned
* Lots of testing has been done on a single XSM node.
Index: Hello.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/Hello/Hello.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Hello.h 23 Aug 2004 23:19:49 -0000 1.7
--- Hello.h 6 Sep 2004 21:51:25 -0000 1.8
***************
*** 1,3 ****
! #if defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
#include <HardwareId.h>
#else
--- 1,3 ----
! #if defined(PLATFORM_MICA2) || defined(PLATFORM_XSM)
#include <HardwareId.h>
#else
***************
*** 34,35 ****
--- 34,64 ----
bool sticky:1;
} HelloCmdMsg;
+
+ enum {
+ HELLO_FIRST_BOOT = 0xffff,
+ };
+
+ #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_XSM)
+
+ #define IFLASH_HELLO_BOOTCOUNT_ADDR 0xFC0 // 2 bytes
+
+ #elif defined(PLATFORM_TELOS)
+
+ #define IFLASH_HELLO_BOOTCOUNT_ADDR 0x50 // 2 bytes
+
+ #endif
+
+ #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_XSM)
+
+ #include <avr/bootloader.h>
+ #include <avr/bl_flash.h>
+
+ #elif defined(PLATFORM_TELOS)
+
+ #include <msp/bootloader.h>
+ #include <msp/bl_flash.h>
+
+ #endif
+
+
+
Index: HelloC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/Hello/HelloC.nc,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** HelloC.nc 27 Aug 2004 21:37:25 -0000 1.19
--- HelloC.nc 6 Sep 2004 21:51:25 -0000 1.20
***************
*** 4,7 ****
--- 4,8 ----
configuration HelloC {
provides interface StdControl;
+ uses interface StdControl as SNMSControl;
}
***************
*** 11,19 ****
TimerC,
LedsC,
- MgmtQueryC,
MgmtAttrsC,
DripC,
AMNamingM,
RebootC,
RandomLFSR,
GenericComm as Comm;
--- 12,20 ----
TimerC,
LedsC,
MgmtAttrsC,
DripC,
AMNamingM,
RebootC,
+ InternalFlashC,
RandomLFSR,
GenericComm as Comm;
***************
*** 24,34 ****
#if defined(PLATFORM_MICA2)
! components SerialId;
#endif
#if defined(BOARD_MICASB)
! components Sounder;
#elif defined(BOARD_XSM)
! components SounderC;
#endif
--- 25,37 ----
#if defined(PLATFORM_MICA2)
! components SerialId;
! #elif defined(PLATFORM_XSM)
! components SerialIDC;
#endif
#if defined(BOARD_MICASB)
! components Sounder;
#elif defined(BOARD_XSM)
! components SounderC;
#endif
***************
*** 36,42 ****
StdControl = TimerC;
StdControl = Comm;
- StdControl = MgmtQueryC;
StdControl = MgmtAttrsC;
HelloM.Leds -> LedsC.Leds;
--- 39,46 ----
StdControl = TimerC;
StdControl = Comm;
StdControl = MgmtAttrsC;
+ SNMSControl = HelloM;
+
HelloM.Leds -> LedsC.Leds;
***************
*** 58,63 ****
HelloM.Naming -> AMNamingM;
- HelloM.RebootCheck -> RebootC;
-
#ifndef PLATFORM_PC
HelloM.setPowerMode -> PowerMgmtC;
--- 62,65 ----
***************
*** 67,72 ****
--- 69,78 ----
StdControl = SerialId;
HelloM.HardwareId -> SerialId;
+ #elif defined(PLATFORM_XSM)
+ HelloM.HardwareId -> SerialIDC;
#endif
+ HelloM.IFlash -> InternalFlashC;
+
HelloM.MA_Group -> MgmtAttrsC.MgmtAttr[unique("MgmtAttr")];
HelloM.MA_ProgramName -> MgmtAttrsC.MgmtAttr[unique("MgmtAttr")];
Index: HelloM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/Hello/HelloM.nc,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** HelloM.nc 1 Sep 2004 01:32:29 -0000 1.24
--- HelloM.nc 6 Sep 2004 21:51:25 -0000 1.25
***************
*** 5,9 ****
interface StdControl;
}
!
uses {
interface Leds;
--- 5,9 ----
interface StdControl;
}
!
uses {
interface Leds;
***************
*** 17,20 ****
--- 17,22 ----
#if defined(PLATFORM_MICA2)
interface HardwareId;
+ #elif defined(PLATFORM_XSM)
+ interface SerialID as HardwareId;
#endif
***************
*** 25,33 ****
interface Receive;
interface Drip;
-
interface Naming;
- interface RebootCheck;
-
#ifndef PLATFORM_PC
command result_t setPowerMode(uint8_t mode);
--- 27,32 ----
***************
*** 41,44 ****
--- 40,47 ----
interface Random;
+
+ interface StdControl as SNMSControl;
+
+ interface InternalFlash as IFlash;
}
}
***************
*** 56,62 ****
};
TOS_Msg msgBuf;
! uint8_t blinkCount = 9;
uint8_t reqId = 0;
--- 59,74 ----
};
+ enum {
+ BLINK_NONE = 0,
+ BLINK_HIBERNATE = 1,
+ BLINK_BOOTUP = 2,
+ BLINK_BOOTED = 3,
+ BOOTUP_BLINK_COUNT = 9,
+ };
+
TOS_Msg msgBuf;
! uint8_t blinkMode = BLINK_NONE;
! uint8_t blinkCount = 0;
uint8_t reqId = 0;
***************
*** 76,79 ****
--- 88,93 ----
call Leds.init();
+ call SNMSControl.init();
+
call Drip.init(); (void)unique("Drip");
***************
*** 88,107 ****
command result_t StdControl.start() {
! // Begin startup sequence
! #ifdef DELUGE_GOLDEN_IMAGE
! if (call RebootCheck.isFactoryBoot()) {
! /* do nothing...let the factory image clone itself */
return SUCCESS;
}
#endif
!
! call BlinkTimer.start(TIMER_ONE_SHOT, 256);
#if defined(BOARD_MICASB)
! call Sounder.start();
#elif defined(BOARD_XSM)
! call Sounder.Beep(2000);
#endif
return SUCCESS;
--- 102,158 ----
command result_t StdControl.start() {
!
! uint8_t resetHist;
! /* Hibernation Disabled - Power Switch Now Present (get)
! uint16_t bootCount;
!
! call IFlash.read((uint8_t*)IFLASH_HELLO_BOOTCOUNT_ADDR,
! &bootCount, sizeof(bootCount));
!
! if (bootCount == HELLO_FIRST_BOOT) {
! bootCount = 0;
! } else {
! bootCount++;
! }
! call IFlash.write((uint8_t*)IFLASH_HELLO_BOOTCOUNT_ADDR,
! &bootCount, sizeof(bootCount));
!
! #if defined(PLATFORM_XSM) || defined(HELLO_HIBERNATE_ALL_PLATFORMS)
! if (bootCount == 0) {
! // It's the first boot...enter hibernation
! blinkMode = BLINK_HIBERNATE;
! blinkCount = 2;
! call BlinkTimer.start(TIMER_ONE_SHOT, 256);
! hibernateMode();
return SUCCESS;
}
#endif
! */
!
! #ifndef PLATFORM_PC
! call IFlash.read((uint8_t*)BL_RESET_HISTORY, &resetHist,
! sizeof(uint8_t));
! #endif
!
! if ((resetHist & BL_RESET_LOG_ENTRY_MASK) != BL_NETPROG_RESET) {
!
! // Begin startup sequence
! blinkMode = BLINK_BOOTUP;
! blinkCount = BOOTUP_BLINK_COUNT;
! call BlinkTimer.start(TIMER_ONE_SHOT, 256);
#if defined(BOARD_MICASB)
! call Sounder.start();
#elif defined(BOARD_XSM)
! call Sounder.setInterval(2000);
! call Sounder.Beep(2000);
#endif
+
+ } else {
+ blinkMode = BLINK_BOOTUP;
+ blinkCount = 1;
+ call BlinkTimer.start(TIMER_ONE_SHOT, 256);
+ }
return SUCCESS;
***************
*** 113,149 ****
event result_t BlinkTimer.fired() {
-
- startHelloMsg();
! if (blinkCount > 1) {
! blinkCount--;
! call BlinkTimer.start(TIMER_ONE_SHOT, 256);
!
! } else if (blinkCount == 1) {
!
! blinkCount = 0;
!
! call Leds.redOff();
!
#if defined(BOARD_MICASB)
! call Sounder.stop();
#elif defined(BOARD_XSM)
! call Sounder.Off();
#endif
! #if defined(DELUGE_GOLDEN_IMAGE)
! #if defined(PLATFORM_XSM) || defined(HELLO_HIBERNATE_ALL_PLATFORMS)
! if (call RebootCheck.isInitialBoot()) {
! /* this is the first real boot...enter hibernation */
! hibernateMode();
! } else
! #endif
! #endif
! {
! /* this is a subsequent boot...enter sleep */
#ifndef HELLO_NO_SLEEP
sleepMode();
#endif
}
}
--- 164,214 ----
event result_t BlinkTimer.fired() {
! switch (blinkMode) {
! /*
! case BLINK_HIBERNATE:
! switch (blinkCount) {
! case 2:
! call Leds.set(5);
! break;
! case 1:
! call Leds.set(2);
! break;
! case 0:
! call Leds.set(0);
! hibernateMode();
! }
! break;
! */
! case BLINK_BOOTUP:
! if (blinkCount > 1) {
! startHelloMsg();
!
! blinkCount--;
! call BlinkTimer.start(TIMER_ONE_SHOT, 256);
!
! } else if (blinkCount == 1) {
!
! blinkCount = 0;
! blinkMode = BLINK_BOOTED;
! call Leds.redOff();
!
#if defined(BOARD_MICASB)
! call Sounder.stop();
#elif defined(BOARD_XSM)
! call Sounder.Off();
#endif
! call SNMSControl.start();
!
#ifndef HELLO_NO_SLEEP
sleepMode();
#endif
}
+ break;
+
+ case BLINK_BOOTED:
+ startHelloMsg();
+ break;
}
***************
*** 156,160 ****
msgBufBusy = TRUE;
! #if defined(PLATFORM_MICA2)
if (!call HardwareId.read((char*)&(helloMsg->hardwareId))) {
sendHelloMsg();
--- 221,225 ----
msgBufBusy = TRUE;
! #if defined(PLATFORM_MICA2) || defined(PLATFORM_XSM)
if (!call HardwareId.read((char*)&(helloMsg->hardwareId))) {
sendHelloMsg();
***************
*** 198,206 ****
msgBufBusy = FALSE;
! if (blinkCount > 0) {
// Still in startup sequence
call Leds.redToggle();
!
! } else if (blinkCount == 0) {
if (sticky) {
--- 263,271 ----
msgBufBusy = FALSE;
! if (blinkMode == BLINK_BOOTUP) {
// Still in startup sequence
call Leds.redToggle();
!
! } else if (blinkMode == BLINK_BOOTED) {
if (sticky) {
***************
*** 343,348 ****
--- 408,421 ----
}
+ #if defined(PLATFORM_MICA2) || defined(PLATFORM_XSM)
+
#if defined(PLATFORM_MICA2)
event result_t HardwareId.readDone(uint8_t *buf, result_t ok) {
+
+ #elif defined(PLATFORM_XSM)
+ event result_t HardwareId.readDone() {
+
+ #endif
+
if (msgBufBusy == TRUE)
sendHelloMsg();
More information about the Tinyos-beta-commits
mailing list