X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fnet%2FDeluge%2Fextra%2FNetProgM.nc;h=fc054cff8fc0f13e00d657a1ca6da95241129eff;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=7567ad1ad809ead008d6e76de7d3f186708f90f5;hpb=62b84950912c1c033c401fb0b2a1efaceec78280;p=tinyos-2.x.git diff --git a/tos/lib/net/Deluge/extra/NetProgM.nc b/tos/lib/net/Deluge/extra/NetProgM.nc index 7567ad1a..fc054cff 100644 --- a/tos/lib/net/Deluge/extra/NetProgM.nc +++ b/tos/lib/net/Deluge/extra/NetProgM.nc @@ -40,7 +40,9 @@ module NetProgM { interface InternalFlash as IFlash; interface Crc; interface Leds; +#if !defined(PLATFORM_TINYNODE) interface CC2420Config; +#endif async command void setAmAddress(am_addr_t a); interface ReprogramGuard; } @@ -53,16 +55,17 @@ implementation { command error_t Init.init() { BootArgs bootArgs; - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); // Update the local node ID if (bootArgs.address != 0xFFFF) { TOS_NODE_ID = bootArgs.address; call setAmAddress(bootArgs.address); } +#if !defined(PLATFORM_TINYNODE) call CC2420Config.setShortAddr(bootArgs.address); call CC2420Config.sync(); - +#endif return SUCCESS; } @@ -71,11 +74,11 @@ implementation { BootArgs bootArgs; atomic { - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); if (bootArgs.address != TOS_NODE_ID) { bootArgs.address = TOS_NODE_ID; - call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.write(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); } netprog_reboot(); } @@ -99,19 +102,21 @@ implementation { } atomic { - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); bootArgs.imageAddr = reprogramImgAddr; bootArgs.gestureCount = 0xff; bootArgs.noReprogram = FALSE; bootArgs.address = TOS_NODE_ID; - call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.write(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); // reboot netprog_reboot(); } } +#if !defined(PLATFORM_TINYNODE) event void CC2420Config.syncDone(error_t error) {} +#endif }