[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio
RssiFixedThresholdCMC.nc, 1.1.2.2,
1.1.2.2.2.1 RssiFixedThresholdCMP.nc, 1.1.2.3,
1.1.2.3.2.1 UartPhyC.nc, 1.1.2.3, 1.1.2.3.2.1 UartPhyP.nc,
1.1.2.6, 1.1.2.6.2.1
Philipp Huppertz
phihup at users.sourceforge.net
Thu Oct 5 01:37:49 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/serial
SerialActiveMessageP.nc, 1.1.2.10,
1.1.2.10.2.1 SerialDispatcherC.nc, 1.1.2.9.10.1,
1.1.2.9.10.2 Serial.h, 1.1.2.12, 1.1.2.12.2.1 SerialP.nc,
1.1.2.10, 1.1.2.10.2.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250
HplTda5250DataC.nc, NONE, 1.1.4.2 HplTda5250DataControl.nc,
NONE, 1.1.4.2 HplTda5250ConfigC.nc, 1.1.2.4,
1.1.2.4.4.1 HplTda5250Config.nc, 1.1.2.5,
1.1.2.5.4.1 HplTda5250ConfigP.nc, 1.1.2.4,
1.1.2.4.4.1 HplTda5250Data.nc, 1.1.2.3.10.1,
1.1.2.3.10.2 HplTda5250DataP.nc, 1.1.2.6.4.1,
1.1.2.6.4.2 Tda5250ActiveMessageP.nc, 1.1.2.3,
1.1.2.3.4.1 tda5250_message.h, 1.1.2.2,
1.1.2.2.10.1 Tda5250RadioC.nc, 1.1.2.5,
1.1.2.5.4.1 Tda5250RegCommP.nc, 1.1.2.6, 1.1.2.6.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29037/tos/platforms/eyesIFX/byte_radio
Modified Files:
Tag: tos-2-msp430-usart-configure-candidate
RssiFixedThresholdCMC.nc RssiFixedThresholdCMP.nc UartPhyC.nc
UartPhyP.nc
Log Message:
- optimized usart configure using unions
Index: RssiFixedThresholdCMC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.2.2.1
diff -C2 -d -r1.1.2.2 -r1.1.2.2.2.1
*** RssiFixedThresholdCMC.nc 31 May 2006 16:32:43 -0000 1.1.2.2
--- RssiFixedThresholdCMC.nc 5 Oct 2006 08:37:46 -0000 1.1.2.2.2.1
***************
*** 33,36 ****
--- 33,37 ----
*
* @author: Kevin Klues (klues at tkn.tu-berlin.de)
+ * @author: Andreas Koepke (koepke at tkn.tu-berlin.de)
*/
configuration RssiFixedThresholdCMC
***************
*** 42,45 ****
--- 43,47 ----
interface ChannelMonitorData;
interface BatteryLevel;
+ interface Resource as RssiAdcResource;
}
}
***************
*** 47,53 ****
{
components RssiFixedThresholdCMP,
! new RssiSensorVccC() as Rssi,
new BatteryLevelSensorC() as Voltage,
- PlatformLedsC,
new TimerMilliC() as Timer,
MainC;
--- 49,55 ----
{
components RssiFixedThresholdCMP,
! // RssiSensorVccC as Rssi,
! new RssiSensorC() as Rssi,
new BatteryLevelSensorC() as Voltage,
new TimerMilliC() as Timer,
MainC;
***************
*** 55,62 ****
MainC.SoftwareInit -> RssiFixedThresholdCMP;
StdControl = RssiFixedThresholdCMP;
!
RssiFixedThresholdCMP.Rssi -> Rssi;
- // RssiFixedThresholdCMP.RssiAdcResource -> Rssi;
-
RssiFixedThresholdCMP.Voltage -> Voltage;
--- 57,63 ----
MainC.SoftwareInit -> RssiFixedThresholdCMP;
StdControl = RssiFixedThresholdCMP;
! RssiAdcResource = Rssi;
!
RssiFixedThresholdCMP.Rssi -> Rssi;
RssiFixedThresholdCMP.Voltage -> Voltage;
***************
*** 65,69 ****
--- 66,74 ----
ChannelMonitorData = RssiFixedThresholdCMP;
BatteryLevel = RssiFixedThresholdCMP;
+
+ /* components PlatformLedsC;
RssiFixedThresholdCMP.Led3 -> PlatformLedsC.Led3;
+ RssiFixedThresholdCMP.Led2 -> PlatformLedsC.Led2;
+ */
RssiFixedThresholdCMP.Timer -> Timer;
}
Index: RssiFixedThresholdCMP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.3.2.1
diff -C2 -d -r1.1.2.3 -r1.1.2.3.2.1
*** RssiFixedThresholdCMP.nc 8 Jun 2006 15:31:05 -0000 1.1.2.3
--- RssiFixedThresholdCMP.nc 5 Oct 2006 08:37:46 -0000 1.1.2.3.2.1
***************
*** 45,57 ****
interface ChannelMonitorData;
interface BatteryLevel;
-
}
! uses {
! // interface ReadNow<uint16_t> as Rssi;
! interface Read<uint16_t> as Rssi;
interface Read<uint16_t> as Voltage;
interface Timer<TMilli> as Timer;
// interface Resource as RssiAdcResource;
! interface GeneralIO as Led3;
}
}
--- 45,56 ----
interface ChannelMonitorData;
interface BatteryLevel;
}
! uses {
! interface ReadNow<uint16_t> as Rssi;
interface Read<uint16_t> as Voltage;
interface Timer<TMilli> as Timer;
// interface Resource as RssiAdcResource;
! // interface GeneralIO as Led3;
! // interface GeneralIO as Led2;
}
}
***************
*** 59,64 ****
{
//#define CM_DEBUG // debug...
! /* Measure internal voltage every 5s */
! #define VOLTAGE_SAMPLE_INTERVALL 5000
/*
--- 58,63 ----
{
//#define CM_DEBUG // debug...
! /* Measure internal voltage every 20s */
! #define VOLTAGE_SAMPLE_INTERVALL 20000
/*
***************
*** 86,91 ****
#define THREE_SIGMA 145
! // 93 mV measured against 3V Vcc
! #define INITIAL_BUSY_DELTA 127
// 3000/2 mV measured against 2.5V Ref
--- 85,90 ----
#define THREE_SIGMA 145
! // 92 mV measured against 3V Vcc
! #define INITIAL_BUSY_DELTA 120
// 3000/2 mV measured against 2.5V Ref
***************
*** 129,141 ****
/**************** Tasks *******************/
- task void RssiReadTask();
task void UpdateNoiseFloorTask();
! task void GetChannelStateTask();
task void SnrReadyTask();
task void CalibrateNoiseFloorTask();
! task void GetSnrTask();
task void CalibrateTask();
task void GetVoltageTask();
- error_t ccaCheckValue();
/***************** Helper function *************/
--- 128,138 ----
/**************** Tasks *******************/
task void UpdateNoiseFloorTask();
! // task void GetChannelStateTask();
task void SnrReadyTask();
task void CalibrateNoiseFloorTask();
! // task void GetSnrTask();
task void CalibrateTask();
task void GetVoltageTask();
/***************** Helper function *************/
***************
*** 153,161 ****
#endif
! int16_t computeSNR() {
uint32_t delta;
uint16_t snr;
- uint16_t r;
- atomic r = rssi;
if(r > noisefloor) {
delta = r - noisefloor;
--- 150,156 ----
#endif
! int16_t computeSNR(uint16_t r) {
uint32_t delta;
uint16_t snr;
if(r > noisefloor) {
delta = r - noisefloor;
***************
*** 194,234 ****
/**************** RSSI *******************/
- void rssiRead() {
- // if(call Rssi.read() != SUCCESS) post RssiReadTask();
- if(call Rssi.read() != SUCCESS) signalFailure();
- // call Led3.set();
- }
! task void RssiReadTask() {
! rssiRead();
}
!
! /*event void RssiAdcResource.granted() {
! rssiRead();
}
- */
! event void Rssi.readDone(error_t result, uint16_t data) {
! if(result == SUCCESS) {
! // call Led3.clr();
! // call RssiAdcResource.release();
! rssi = data;
! atomic {
! switch(state) {
! case CCA:
! ccaCheckValue();
! break;
! case SNR:
! post SnrReadyTask();
! break;
! case CALIBRATE:
! post CalibrateNoiseFloorTask();
! break;
! default:
! break;
}
! }
! } else {
! rssiRead();
}
}
--- 189,228 ----
/**************** RSSI *******************/
! inline void addSample(uint16_t data) {
! if(rssiindex < NSAMPLES) rssisamples[rssiindex++] = data;
! deadlockCounter = 0;
! if(rssiindex >= NSAMPLES) post UpdateNoiseFloorTask();
}
!
! error_t rssiRead() {
! error_t res = call Rssi.read();
! if(res != SUCCESS) signalFailure();
! return res;
}
! async event void Rssi.readDone(error_t result, uint16_t data) {
! switch(state) {
! case CCA:
! state = IDLE;
! if(data < noisefloor + busyDelta) {
! signal ChannelMonitor.channelIdle();
! addSample(data);
}
! else {
! signal ChannelMonitor.channelBusy();
! if(++deadlockCounter >= DEADLOCK) addSample(data);
! }
! break;
! case SNR:
! rssi = data;
! post SnrReadyTask();
! break;
! case CALIBRATE:
! rssi = data;
! post CalibrateNoiseFloorTask();
! break;
! default:
! break;
}
}
***************
*** 250,254 ****
uint16_t bD;
if(result == SUCCESS) {
! nbl = data;
atomic bD = busyDelta;
d = batteryLevel - nbl;
--- 244,248 ----
uint16_t bD;
if(result == SUCCESS) {
! nbl = (data + batteryLevel)>>1;
atomic bD = busyDelta;
d = batteryLevel - nbl;
***************
*** 269,281 ****
error_t res = FAIL;
atomic {
! if(state != VOID) {
! if (state == IDLE) {
! state = CCA;
! //res = call RssiAdcResource.request();
! res = SUCCESS;
! rssiRead();
! } else {
! res = post GetChannelStateTask();
! }
}
}
--- 263,272 ----
error_t res = FAIL;
atomic {
! if(state == IDLE) {
! res = rssiRead();
! if(res == SUCCESS) state = CCA;
! }
! else if(state == CCA) {
! res = SUCCESS;
}
}
***************
*** 291,297 ****
}
! task void GetChannelStateTask() {
atomic {
! if(state != IDLE) {
post GetChannelStateTask();
} else {
--- 282,288 ----
}
! /* task void GetChannelStateTask() {
atomic {
! if((state != IDLE) && (state != CCA)) {
post GetChannelStateTask();
} else {
***************
*** 302,340 ****
}
}
!
! void addSample() {
! if(rssiindex < NSAMPLES) rssisamples[rssiindex++] = rssi;
! deadlockCounter = 0;
! if(rssiindex >= NSAMPLES) post UpdateNoiseFloorTask();
! }
!
!
! void channelBusy () {
! atomic {
! if(++deadlockCounter >= DEADLOCK) addSample();
! state = IDLE;
! }
! signal ChannelMonitor.channelBusy();
! }
!
! void channelIdle() {
! atomic {
! addSample();
! state = IDLE;
! }
! signal ChannelMonitor.channelIdle();
! }
!
! error_t ccaCheckValue() {
! uint16_t data;
! atomic data = rssi;
! if(data < noisefloor + busyDelta) {
! channelIdle();
! } else {
! channelBusy();
! }
! return SUCCESS;
! }
!
task void UpdateNoiseFloorTask() {
shellsort(rssisamples,NSAMPLES);
--- 293,297 ----
}
}
! */
task void UpdateNoiseFloorTask() {
shellsort(rssisamples,NSAMPLES);
***************
*** 395,400 ****
readVoltage();
} else {
! rssiRead();
! // call RssiAdcResource.request();
}
}
--- 352,357 ----
readVoltage();
} else {
! rssiRead();
! // call RssiAdcResource.request();
}
}
***************
*** 419,452 ****
/** get SNR in dB **/
!
! async command error_t ChannelMonitorData.getSnr() {
! error_t res = SUCCESS;
! if(state != VOID) {
! post GetSnrTask();
! } else {
! res = FAIL;
}
! return res;
! }
!
! task void GetSnrTask() {
atomic {
! if(state != IDLE) {
! post GetSnrTask();
! } else {
! state = SNR;
! rssiRead();
! // if(call RssiAdcResource.request() != SUCCESS) signalFailure();
}
}
}
!
task void SnrReadyTask() {
int16_t snr;
! snr = computeSNR();
! atomic state = IDLE;
! signal ChannelMonitorData.getSnrDone(snr);
}
default async event void ChannelMonitorData.getSnrDone(int16_t snr) {
}
--- 376,431 ----
/** get SNR in dB **/
! /* task void GetSnrTask() {
! state_t s;
! atomic s = state;
! if(s == SNR) {
! if(call RssiAdcResource.immediateRequest() == SUCCESS) {
! rssiRead();
! } else {
! atomic if(state == SNR) state = IDLE;
! }
}
! }
! */
!
! async command error_t ChannelMonitorData.getSnr() {
! error_t res = FAIL;
atomic {
! if(state == IDLE) {
! res = rssiRead();
! if(res == SUCCESS) state = SNR;
! }
! else if(state == SNR) {
! res = SUCCESS;
}
}
+ return res;
}
!
task void SnrReadyTask() {
int16_t snr;
! state_t s;
! uint16_t r;
! atomic {
! r = rssi;
! s = state;
! if(state == SNR) state = IDLE;
! }
! if(s == SNR) {
! snr = computeSNR(r);
! signal ChannelMonitorData.getSnrDone(snr);
! }
}
+ async command uint16_t ChannelMonitorData.readSnr() {
+ uint16_t rval;
+ if(rssi > noisefloor) {
+ rval = (rssi-noisefloor)>>4;
+ } else {
+ rval = 3;
+ }
+ return rval;
+ }
+
default async event void ChannelMonitorData.getSnrDone(int16_t snr) {
}
***************
*** 459,462 ****
return (uint32_t)l*39>>5;
}
-
}
--- 438,440 ----
Index: UartPhyC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/UartPhyC.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.3.2.1
diff -C2 -d -r1.1.2.3 -r1.1.2.3.2.1
*** UartPhyC.nc 8 Jun 2006 15:31:05 -0000 1.1.2.3
--- UartPhyC.nc 5 Oct 2006 08:37:46 -0000 1.1.2.3.2.1
***************
*** 45,48 ****
--- 45,49 ----
{
provides{
+ interface Init;
interface PhyPacketTx;
interface RadioByteComm as SerializerRadioByteComm;
***************
*** 58,66 ****
components
new Alarm32khzC() as RxByteTimer,
! UartPhyP,
! // PlatformLedsC,
! MainC;
! MainC.SoftwareInit -> UartPhyP;
PhyPacketRx = UartPhyP;
SerializerRadioByteComm = UartPhyP;
--- 59,65 ----
components
new Alarm32khzC() as RxByteTimer,
! UartPhyP;
! Init = UartPhyP;
PhyPacketRx = UartPhyP;
SerializerRadioByteComm = UartPhyP;
***************
*** 70,74 ****
UartPhyP.RxByteTimer -> RxByteTimer;
- // PlatformLedsC.Led0 <- UartPhyP.Led0;
- // PlatformLedsC.Led1 <- UartPhyP.Led1;
}
--- 69,71 ----
Index: UartPhyP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/UartPhyP.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.6.2.1
diff -C2 -d -r1.1.2.6 -r1.1.2.6.2.1
*** UartPhyP.nc 14 Jun 2006 17:12:08 -0000 1.1.2.6
--- UartPhyP.nc 5 Oct 2006 08:37:46 -0000 1.1.2.6.2.1
***************
*** 37,48 ****
*/
/**
! * UartPhyP module
*
* @author Kevin Klues <klues at tkn.tu-berlin.de>
* @author Philipp Huppertz <huppertz at tkn.tu-berlin.de>
*/
- #include "manchester.h"
-
module UartPhyP {
provides {
--- 37,50 ----
*/
+ #include "manchester.h"
+
/**
! * Implementation of the physical layer for the eyesIFX byte radio.
! * Together with the PacketSerializerP this module turns byte streams
! * into packets.
*
* @author Kevin Klues <klues at tkn.tu-berlin.de>
* @author Philipp Huppertz <huppertz at tkn.tu-berlin.de>
*/
module UartPhyP {
provides {
***************
*** 63,66 ****
--- 65,69 ----
typedef enum {
STATE_PREAMBLE,
+ STATE_PREAMBLE_MANCHESTER,
STATE_SYNC,
STATE_SFD,
***************
*** 71,78 ****
STATE_FOOTER_DONE
} phyState_t;
-
#define PREAMBLE_LENGTH 4
! #define BYTE_TIME 35
#define PREAMBLE_BYTE 0x55
#define SYNC_BYTE 0xFF
--- 74,80 ----
STATE_FOOTER_DONE
} phyState_t;
#define PREAMBLE_LENGTH 4
! #define BYTE_TIME 18
#define PREAMBLE_BYTE 0x55
#define SYNC_BYTE 0xFF
***************
*** 100,110 ****
}
! command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
atomic {
! if (phyState == STATE_PREAMBLE) {
! return FAIL;
! } else {
! numPreambles = numPreambleBytes;
! }
}
return SUCCESS;
--- 102,108 ----
}
! async command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
atomic {
! numPreambles = numPreambleBytes;
}
return SUCCESS;
***************
*** 115,119 ****
return FAIL;
} else {
! atomic byteTime = byteTimeout;
return SUCCESS;
}
--- 113,117 ----
return FAIL;
} else {
! atomic byteTime = byteTimeout * 33;
return SUCCESS;
}
***************
*** 280,284 ****
if(data == PREAMBLE_BYTE) {
phyState = STATE_SYNC;
! }
break;
case STATE_DATA_HIGH:
--- 278,293 ----
if(data == PREAMBLE_BYTE) {
phyState = STATE_SYNC;
! }
! else if(manchesterDecodeByte(data) != 0xff) {
! phyState = STATE_PREAMBLE_MANCHESTER;
! }
! break;
! case STATE_PREAMBLE_MANCHESTER:
! if(data == PREAMBLE_BYTE) {
! phyState = STATE_SYNC;
! }
! else if(manchesterDecodeByte(data) == 0xff) {
! phyState = STATE_PREAMBLE;
! }
break;
case STATE_DATA_HIGH:
***************
*** 287,291 ****
bufByte = decodedByte << 4;
phyState = STATE_DATA_LOW;
! } else {
resetState();
}
--- 296,301 ----
bufByte = decodedByte << 4;
phyState = STATE_DATA_LOW;
! }
! else {
resetState();
}
***************
*** 295,301 ****
if(decodedByte != 0xff) {
bufByte |= decodedByte;
- signal SerializerRadioByteComm.rxByteReady(bufByte);
phyState = STATE_DATA_HIGH;
! } else {
resetState();
}
--- 305,312 ----
if(decodedByte != 0xff) {
bufByte |= decodedByte;
phyState = STATE_DATA_HIGH;
! signal SerializerRadioByteComm.rxByteReady(bufByte);
! }
! else {
resetState();
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/serial
SerialActiveMessageP.nc, 1.1.2.10,
1.1.2.10.2.1 SerialDispatcherC.nc, 1.1.2.9.10.1,
1.1.2.9.10.2 Serial.h, 1.1.2.12, 1.1.2.12.2.1 SerialP.nc,
1.1.2.10, 1.1.2.10.2.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250
HplTda5250DataC.nc, NONE, 1.1.4.2 HplTda5250DataControl.nc,
NONE, 1.1.4.2 HplTda5250ConfigC.nc, 1.1.2.4,
1.1.2.4.4.1 HplTda5250Config.nc, 1.1.2.5,
1.1.2.5.4.1 HplTda5250ConfigP.nc, 1.1.2.4,
1.1.2.4.4.1 HplTda5250Data.nc, 1.1.2.3.10.1,
1.1.2.3.10.2 HplTda5250DataP.nc, 1.1.2.6.4.1,
1.1.2.6.4.2 Tda5250ActiveMessageP.nc, 1.1.2.3,
1.1.2.3.4.1 tda5250_message.h, 1.1.2.2,
1.1.2.2.10.1 Tda5250RadioC.nc, 1.1.2.5,
1.1.2.5.4.1 Tda5250RegCommP.nc, 1.1.2.6, 1.1.2.6.4.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list