X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Fcc1000%2FCC1000CsmaP.nc;h=698ab8cbd205f359ad79079c6cbb7da2718ffba4;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=bf9af8fb1c8ba855a5ebc1649e271f324a34509d;hpb=1a329382c4f4556fd52d85f4e3f4a67e54911682;p=tinyos-2.x.git diff --git a/tos/chips/cc1000/CC1000CsmaP.nc b/tos/chips/cc1000/CC1000CsmaP.nc index bf9af8fb..698ab8cb 100644 --- a/tos/chips/cc1000/CC1000CsmaP.nc +++ b/tos/chips/cc1000/CC1000CsmaP.nc @@ -1,6 +1,6 @@ // $Id$ -/* tab:4 +/* * "Copyright (c) 2000-2005 The Regents of the University of California. * All rights reserved. * @@ -50,7 +50,7 @@ * @author David Gay */ -module CC1000CsmaP { +module CC1000CsmaP @safe() { provides { interface Init; interface SplitControl; @@ -107,8 +107,8 @@ implementation task void setWakeupTask(); - cc1000_metadata_t *getMetadata(message_t *amsg) { - return (cc1000_metadata_t *)((uint8_t *)amsg->footer + sizeof(cc1000_footer_t)); + cc1000_metadata_t * ONE getMetadata(message_t * ONE amsg) { + return TCAST(cc1000_metadata_t * ONE, (uint8_t*)amsg + offsetof(message_t, footer) + sizeof(cc1000_footer_t)); } void enterIdleState() { @@ -160,7 +160,7 @@ implementation call ByteRadio.off(); } - void setPreambleLength(message_t *msg); + void setPreambleLength(message_t * ONE msg); /* Initialisation, startup and stopping */ /*--------------------------------------*/ @@ -355,7 +355,7 @@ implementation /* CSMA */ /*------*/ - event void ByteRadio.rts(message_t *msg) { + event void ByteRadio.rts(message_t * ONE msg) { atomic { f.txPending = TRUE; @@ -507,29 +507,21 @@ implementation return (1000 * CC1K_LPL_CHECK_TIME) / sleepInterval; } - command void LowPowerListening.setLocalSleepInterval(uint16_t s) { + command void LowPowerListening.setLocalWakeupInterval(uint16_t s) { sleepTime = validateSleepInterval(s); } - command uint16_t LowPowerListening.getLocalSleepInterval() { + command uint16_t LowPowerListening.getLocalWakeupInterval() { return sleepTime; } - command void LowPowerListening.setLocalDutyCycle(uint16_t d) { - return call LowPowerListening.setLocalSleepInterval(dutyToSleep(d)); - } - - command uint16_t LowPowerListening.getLocalDutyCycle() { - return sleepToDuty(call LowPowerListening.getLocalSleepInterval()); - } - - command void LowPowerListening.setRxSleepInterval(message_t *msg, uint16_t sleepIntervalMs) { + command void LowPowerListening.setRemoteWakeupInterval(message_t *msg, uint16_t sleepIntervalMs) { cc1000_metadata_t *meta = getMetadata(msg); meta->strength_or_preamble = -(int16_t)validateSleepInterval(sleepIntervalMs) - 1; } - command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg) { + command uint16_t LowPowerListening.getRemoteWakeupInterval(message_t *msg) { cc1000_metadata_t *meta = getMetadata(msg); if (meta->strength_or_preamble >= 0) @@ -538,23 +530,7 @@ implementation return -(meta->strength_or_preamble + 1); } - command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t d) { - return call LowPowerListening.setRxSleepInterval(msg, dutyToSleep(d)); - } - - command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg) { - return sleepToDuty(call LowPowerListening.getRxSleepInterval(msg)); - } - - command uint16_t LowPowerListening.dutyCycleToSleepInterval(uint16_t d) { - return dutyToSleep(d); - } - - command uint16_t LowPowerListening.sleepIntervalToDutyCycle(uint16_t s) { - return sleepToDuty(s); - } - - void setPreambleLength(message_t *msg) { + void setPreambleLength(message_t * ONE msg) { cc1000_metadata_t *meta = getMetadata(msg); uint16_t s; uint32_t plen;