[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio RssiFixedThresholdCMC.nc, 1.1.2.3, 1.1.2.4 RssiFixedThresholdCMP.nc, 1.1.2.4, 1.1.2.5 UartPhyC.nc, 1.1.2.4, 1.1.2.5 UartPhyP.nc, 1.1.2.7, 1.1.2.8

Philipp Huppertz phihup at users.sourceforge.net
Thu Aug 3 11:17:54 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26539/tos/platforms/eyesIFX/byte_radio

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	RssiFixedThresholdCMC.nc RssiFixedThresholdCMP.nc UartPhyC.nc 
	UartPhyP.nc 
Log Message:
- updated eyes platform to use usart configure
- a few bug fixes

Index: RssiFixedThresholdCMC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMC.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** RssiFixedThresholdCMC.nc	21 Jun 2006 14:45:11 -0000	1.1.2.3
--- RssiFixedThresholdCMC.nc	3 Aug 2006 18:17:52 -0000	1.1.2.4
***************
*** 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 BatteryLevelSensorC() as Voltage,
!         PlatformLedsC,
          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;
  
***************
*** 66,69 ****
--- 67,71 ----
      BatteryLevel = RssiFixedThresholdCMP;
      // 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.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** RssiFixedThresholdCMP.nc	21 Jun 2006 14:45:11 -0000	1.1.2.4
--- RssiFixedThresholdCMP.nc	3 Aug 2006 18:17:52 -0000	1.1.2.5
***************
*** 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;
      }
  }
***************
*** 130,140 ****
      /****************  Tasks  *******************/
      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 *************/
--- 129,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 *************/
***************
*** 193,222 ****
       
      /**************** RSSI *******************/
!     void rssiRead() {
!         if(call Rssi.read() != SUCCESS) signalFailure();
      }
      
!     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();
          }
      }
--- 191,230 ----
       
      /**************** 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;
          }
      }
***************
*** 255,266 ****
      /**************** ChannelMonitor *******************/  
      async command error_t ChannelMonitor.start() {
!         error_t res = SUCCESS;
          atomic {
!             if(state != VOID) {
!                 if(state == IDLE) {
!                     state = CCA;
!                     res = SUCCESS;
!                 }
!                 post GetChannelStateTask();
              }
          }
--- 263,271 ----
      /**************** ChannelMonitor *******************/  
      async command error_t ChannelMonitor.start() {
!         error_t res = FAIL;
          atomic {
!             if(state == IDLE) {
!                 res = rssiRead();
!                 if(res == SUCCESS) state = CCA;
              }
          }
***************
*** 276,280 ****
      }
      
!     task void GetChannelStateTask() {
          atomic {
              if((state != IDLE) && (state != CCA)) {
--- 281,285 ----
      }
      
! /*    task void GetChannelStateTask() {
          atomic {
              if((state != IDLE) && (state != CCA)) {
***************
*** 287,325 ****
          }
      }
!         
!     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);
--- 292,296 ----
          }
      }
! */    
      task void UpdateNoiseFloorTask() {
          shellsort(rssisamples,NSAMPLES);
***************
*** 380,385 ****
              readVoltage();
          } else {
!           rssiRead();
!           //  call RssiAdcResource.request();
          }
      }
--- 351,356 ----
              readVoltage();
          } else {
!             rssiRead();
!             // call RssiAdcResource.request();
          }
      }
***************
*** 404,430 ****
  
      /** 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;
--- 375,402 ----
  
      /** 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;
              }
          }
+         return res;
      }
! 
      task void SnrReadyTask() {
          int16_t snr;
***************
*** 444,447 ****
          return (uint32_t)l*39>>5;
      }
-     
  }
--- 416,418 ----

Index: UartPhyC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/UartPhyC.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** UartPhyC.nc	21 Jun 2006 14:45:11 -0000	1.1.2.4
--- UartPhyC.nc	3 Aug 2006 18:17:52 -0000	1.1.2.5
***************
*** 62,66 ****
          new Alarm32khzC() as RxByteTimer,
          UartPhyP,
- //         PlatformLedsC,
          MainC;
      
--- 62,65 ----
***************
*** 73,77 ****
      
      UartPhyP.RxByteTimer -> RxByteTimer;
- //     PlatformLedsC.Led0 <- UartPhyP.Led0;
- //     PlatformLedsC.Led1 <- UartPhyP.Led1;
  }
--- 72,74 ----

Index: UartPhyP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/UartPhyP.nc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** UartPhyP.nc	21 Jun 2006 14:45:11 -0000	1.1.2.7
--- UartPhyP.nc	3 Aug 2006 18:17:52 -0000	1.1.2.8
***************
*** 65,68 ****
--- 65,69 ----
      typedef enum {
          STATE_PREAMBLE,
+         STATE_PREAMBLE_MANCHESTER,
          STATE_SYNC,
          STATE_SFD,
***************
*** 74,82 ****
      } phyState_t;
  
- 
- 
- 
  #define PREAMBLE_LENGTH   4
! #define BYTE_TIME         22
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF
--- 75,80 ----
      } phyState_t;
  
  #define PREAMBLE_LENGTH   4
! #define BYTE_TIME         18
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF
***************
*** 104,108 ****
      }
      
!     command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
          atomic {
              numPreambles = numPreambleBytes;
--- 102,106 ----
      }
      
!     async command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
          atomic {
              numPreambles = numPreambleBytes;
***************
*** 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:



More information about the Tinyos-2-commits mailing list