[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio RssiFixedThresholdCMP.nc, 1.1.2.1, 1.1.2.2 UartPhyP.nc, 1.1.2.1, 1.1.2.2

Philipp Huppertz phihup at users.sourceforge.net
Wed Jun 7 12:54:55 PDT 2006


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

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	RssiFixedThresholdCMP.nc UartPhyP.nc 
Log Message:
- should compile again...


Index: RssiFixedThresholdCMP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/Attic/RssiFixedThresholdCMP.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** RssiFixedThresholdCMP.nc	31 May 2006 13:53:03 -0000	1.1.2.1
--- RssiFixedThresholdCMP.nc	7 Jun 2006 19:54:53 -0000	1.1.2.2
***************
*** 58,62 ****
  implementation
  {    /* Measure internal voltage every 5s */
! #define VOLTAGE_SAMPLE_INTERVALL 50
  
      /* 
--- 58,62 ----
  implementation
  {    /* Measure internal voltage every 5s */
! #define VOLTAGE_SAMPLE_INTERVALL 5000
  
      /* 
***************
*** 169,174 ****
              state = VOID;
              gradient = 14; // gradient of TDA5250
!             call Led3.makeOutput(); 
!             call Led3.clr();
          }
          return SUCCESS;
--- 169,174 ----
              state = VOID;
              gradient = 14; // gradient of TDA5250
!             /* call Led3.makeOutput(); 
!                call Led3.clr(); */
          }
          return SUCCESS;
***************
*** 189,193 ****
          // if(call Rssi.read() != SUCCESS) post RssiReadTask();
          if(call Rssi.read() != SUCCESS) signalFailure();
!         call Led3.clr();
      }
  
--- 189,193 ----
          // if(call Rssi.read() != SUCCESS) post RssiReadTask();
          if(call Rssi.read() != SUCCESS) signalFailure();
!         // call Led3.clr();
      }
  
***************
*** 203,221 ****
       event void Rssi.readDone(error_t result, uint16_t data) {
          if(result == SUCCESS) {
!             call Led3.set();
              // call RssiAdcResource.release();
              rssi = data;
!             switch(state) {
!                 case CCA:
!                     ccaCheckValue();
!                     break;
!                 case SNR:
!                     post SnrReadyTask();    
!                     break;
!                 case CALIBRATE:
!                     post CalibrateNoiseFloorTask();    
!                     break;
!                 default:
!                     break;
              }
          } else {
--- 203,223 ----
       event void Rssi.readDone(error_t result, uint16_t data) {
          if(result == SUCCESS) {
!             // call Led3.set();
              // 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 {

Index: UartPhyP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/Attic/UartPhyP.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** UartPhyP.nc	31 May 2006 13:53:03 -0000	1.1.2.1
--- UartPhyP.nc	7 Jun 2006 19:54:53 -0000	1.1.2.2
***************
*** 1,39 ****
! /*
! * Copyright (c) 2004, Technische Universitaet Berlin
! * All rights reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! * - Redistributions of source code must retain the above copyright notice,
! *   this list of conditions and the following disclaimer.
! * - Redistributions in binary form must reproduce the above copyright
! *   notice, this list of conditions and the following disclaimer in the
! *   documentation and/or other materials provided with the distribution.
! * - Neither the name of the Technische Universitaet Berlin nor the names
! *   of its contributors may be used to endorse or promote products derived
! *   from this software without specific prior written permission.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
! * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
! * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
! * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
! * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
! * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
! * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
! * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! * - Description ---------------------------------------------------------
! *
! * - Revision -------------------------------------------------------------
! * $Revision$
! * $Date$
! * @author: Kevin Klues (klues at tkn.tu-berlin.de)
! * @author: Philipp Huppertz <huppertz at tkn.tu-berlin.de>
! * ========================================================================
! */
  
  /**
--- 1,39 ----
! /* -*- mode:c++; indent-tabs-mode: nil -*-
!  * Copyright (c) 2004, Technische Universitaet Berlin
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms, with or without
!  * modification, are permitted provided that the following conditions
!  * are met:
!  * - Redistributions of source code must retain the above copyright notice,
!  *   this list of conditions and the following disclaimer.
!  * - Redistributions in binary form must reproduce the above copyright
!  *   notice, this list of conditions and the following disclaimer in the
!  *   documentation and/or other materials provided with the distribution.
!  * - Neither the name of the Technische Universitaet Berlin nor the names
!  *   of its contributors may be used to endorse or promote products derived
!  *   from this software without specific prior written permission.
!  *
!  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
!  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
!  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
!  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
!  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
!  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
!  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
!  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
!  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
!  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
!  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
!  * - Description ---------------------------------------------------------
!  *
!  * - Revision -------------------------------------------------------------
!  * $Revision$
!  * $Date$
!  * @author: Kevin Klues (klues at tkn.tu-berlin.de)
!  * @author: Philipp Huppertz <huppertz at tkn.tu-berlin.de>
!  * ========================================================================
!  */
  
  /**
***************
*** 43,74 ****
   * @author Philipp Huppertz <huppertz at tkn.tu-berlin.de>
   */
  module UartPhyP {
! provides {
!   interface Init;
!   interface PhyPacketTx;
!   interface RadioByteComm as SerializerRadioByteComm;
!   interface PhyPacketRx;
!   interface UartPhyControl;
! }
! uses {
!   interface RadioByteComm;
!   interface Alarm<T32khz, uint16_t> as RxByteTimer;
! }
  }
  implementation
  {
!   /* Module Definitions  */
!   typedef enum {
!     STATE_PREAMBLE,
!     STATE_SYNC,
!     STATE_SFD,
!     STATE_HEADER_DONE,
!     STATE_DATA,
!     STATE_FOOTER_START,
!     STATE_FOOTER_DONE,
!     STATE_CANCEL_HEADER,
!     STATE_CANCEL_DATA,
!     STATE_CANCEL_FOOTER
!   } phyState_t;
    
  
--- 43,74 ----
   * @author Philipp Huppertz <huppertz at tkn.tu-berlin.de>
   */
+ #include "manchester.h"
+ 
  module UartPhyP {
!     provides {
!         interface Init;
!         interface PhyPacketTx;
!         interface RadioByteComm as SerializerRadioByteComm;
!         interface PhyPacketRx;
!         interface UartPhyControl;
!     }
!     uses {
!         interface RadioByteComm;
!         interface Alarm<T32khz, uint16_t> as RxByteTimer;
!     }
  }
  implementation
  {
!     /* Module Definitions  */
!     typedef enum {
!         STATE_PREAMBLE,
!         STATE_SYNC,
!         STATE_SFD,
!         STATE_HEADER_DONE,
!         STATE_DATA_HIGH,
!         STATE_DATA_LOW,
!         STATE_FOOTER_START,
!         STATE_FOOTER_DONE
!     } phyState_t;
    
  
***************
*** 77,81 ****
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF
! #define SFD_BYTE          0x33
  
      /** Module Global Variables  */
--- 77,81 ----
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF
! #define SFD_BYTE          0x05
  
      /** Module Global Variables  */
***************
*** 84,88 ****
      uint16_t numPreambles;  // Number of preambles to send before the packet
      uint8_t byteTime;       // max. time between two bytes
! 
      /* Local Function Declarations */
      void TransmitNextByte();
--- 84,89 ----
      uint16_t numPreambles;  // Number of preambles to send before the packet
      uint8_t byteTime;       // max. time between two bytes
!     uint8_t bufByte;
!     
      /* Local Function Declarations */
      void TransmitNextByte();
***************
*** 91,164 ****
      /* Radio Init */
      command error_t Init.init(){
!       atomic {
!         phyState = STATE_PREAMBLE;
!         numPreambles = PREAMBLE_LENGTH;
!         byteTime = BYTE_TIME;
!       }
!       return SUCCESS;
      }
      
      command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
!       atomic {
!         if (phyState == STATE_PREAMBLE) {
!           return FAIL;
!         } else {
!           numPreambles = numPreambleBytes;
          }
!       }
!       return SUCCESS;
      }
      
      command error_t UartPhyControl.setByteTimeout(uint8_t byteTimeout) {
!       if (call RxByteTimer.isRunning() == TRUE) {
!         return FAIL;
!       } else {
!         atomic byteTime = byteTimeout;
!         return SUCCESS;
!       }
      }
      
      async command bool UartPhyControl.isBusy() {
!       return call RxByteTimer.isRunning();
      }
      
!     async event void RxByteTimer.fired() {
!       // no bytes have been arrived, so...
!       atomic {
!         switch(phyState) {
!           case STATE_SYNC:
!           case STATE_SFD:
!             signal PhyPacketRx.recvHeaderDone(FAIL);
!             break;
!           case STATE_DATA:
!           case STATE_FOOTER_START:
!             signal PhyPacketRx.recvFooterDone(FAIL);
!             break;
!           default:
!             break;
          }
!         phyState = STATE_PREAMBLE; 
!       }
      }
  
      async command void PhyPacketTx.sendHeader() {
!       atomic {
!         phyState = STATE_PREAMBLE;
!         preambleCount = numPreambles;
!       }
!       TransmitNextByte();
      }
  
      async command void SerializerRadioByteComm.txByte(uint8_t data) {
!       call RadioByteComm.txByte(data);
      }
  
      async command bool SerializerRadioByteComm.isTxDone() {
!       return call RadioByteComm.isTxDone();
      }
  
      async command void PhyPacketTx.sendFooter() {
!       atomic phyState = STATE_FOOTER_START;
!       TransmitNextByte();
      }
  
--- 92,173 ----
      /* Radio Init */
      command error_t Init.init(){
!         atomic {
!             phyState = STATE_PREAMBLE;
!             numPreambles = PREAMBLE_LENGTH;
!             byteTime = BYTE_TIME;
!         }
!         return SUCCESS;
      }
      
      command error_t UartPhyControl.setNumPreambles(uint16_t numPreambleBytes) {
!         atomic {
!             if (phyState == STATE_PREAMBLE) {
!                 return FAIL;
!             } else {
!                 numPreambles = numPreambleBytes;
!             }
          }
!         return SUCCESS;
      }
      
      command error_t UartPhyControl.setByteTimeout(uint8_t byteTimeout) {
!         if (call RxByteTimer.isRunning() == TRUE) {
!             return FAIL;
!         } else {
!             atomic byteTime = byteTimeout;
!             return SUCCESS;
!         }
      }
      
      async command bool UartPhyControl.isBusy() {
!         return call RxByteTimer.isRunning();
      }
      
!     void resetState() {
!         atomic {
!             call RxByteTimer.stop();
!             switch(phyState) {
!                 case STATE_SYNC:
!                 case STATE_SFD:
!                     signal PhyPacketRx.recvHeaderDone(FAIL);
!                     break;
!                 case STATE_DATA_HIGH:
!                 case STATE_DATA_LOW:
!                 case STATE_FOOTER_START:
!                     signal PhyPacketRx.recvFooterDone(FAIL);
!                     break;
!                 default:
!                     break;
!             }
!             phyState = STATE_PREAMBLE; 
          }
!     }
!     
!     async event void RxByteTimer.fired() {
!         // no bytes have arrived, so...
!         resetState();
      }
  
      async command void PhyPacketTx.sendHeader() {
!         atomic {
!             phyState = STATE_PREAMBLE;
!             preambleCount = numPreambles;
!         }
!         TransmitNextByte();
      }
  
      async command void SerializerRadioByteComm.txByte(uint8_t data) {
!         bufByte = data;
!         call RadioByteComm.txByte(manchesterEncodeNibble((bufByte & 0xf0) >> 4));
!         phyState = STATE_DATA_LOW;
      }
  
      async command bool SerializerRadioByteComm.isTxDone() {
!         return call RadioByteComm.isTxDone();
      }
  
      async command void PhyPacketTx.sendFooter() {
!         atomic phyState = STATE_FOOTER_START;
!         TransmitNextByte();
      }
  
***************
*** 169,173 ****
          // atomic phyState = STATE_FOOTER_START;
          atomic {
!           phyState = STATE_PREAMBLE;
          }
          call RxByteTimer.stop();
--- 178,182 ----
          // atomic phyState = STATE_FOOTER_START;
          atomic {
!             phyState = STATE_PREAMBLE;
          }
          call RxByteTimer.stop();
***************
*** 178,279 ****
      /* Tx Done */
      async event void RadioByteComm.txByteReady(error_t error) {
!       if(error == SUCCESS) {
!         TransmitNextByte();
!       } else {
!         atomic {
!           signal SerializerRadioByteComm.txByteReady(error);
!           phyState = STATE_PREAMBLE;
          }
-       }
      }
  
      void TransmitNextByte() {
!       atomic {
!         switch(phyState) {
!           case STATE_PREAMBLE:
!             if(preambleCount > 0) {
!               preambleCount--;
!             } else {
!               phyState = STATE_SYNC;
              }
-             call RadioByteComm.txByte(PREAMBLE_BYTE);
-             break;
-           case STATE_SYNC:
-             phyState = STATE_SFD;
-             call RadioByteComm.txByte(SYNC_BYTE);
-             break;
-           case STATE_SFD:
-             phyState = STATE_HEADER_DONE;
-             call RadioByteComm.txByte(SFD_BYTE);
-             break;
-           case STATE_HEADER_DONE:
-             phyState = STATE_DATA;
-             signal PhyPacketTx.sendHeaderDone();
-             break;
-           case STATE_DATA:
-             signal SerializerRadioByteComm.txByteReady(SUCCESS);
-             break;
-           case STATE_FOOTER_START:
-             // maybe there will be a time.... we will need this.
-             // phyState = STATE_FOOTER_DONE;
-             // break;
-           case STATE_FOOTER_DONE:
-             phyState = STATE_PREAMBLE;
-             signal PhyPacketTx.sendFooterDone();
-             break;
-           default:
-             break;
          }
-       }
      }
  
      /* Rx Done */
      async event void RadioByteComm.rxByteReady(uint8_t data) {
!       call RxByteTimer.start(byteTime);
!       ReceiveNextByte(data);
      }
  
      /* Receive the next Byte from the USART */
      void ReceiveNextByte(uint8_t data) {
!       atomic {
!         switch(phyState) {
!           case STATE_SYNC:
!             if(data != PREAMBLE_BYTE) {
!               if (data == SFD_BYTE) {
!                 signal PhyPacketRx.recvHeaderDone(SUCCESS);
!                 phyState = STATE_DATA;
!               } else {
!                 phyState = STATE_SFD;
!               } 
!             }
!             break;
!           case STATE_SFD:
!             if (data == SFD_BYTE) {
!               signal PhyPacketRx.recvHeaderDone(SUCCESS);
!               phyState = STATE_DATA;
!             } else {
!               phyState = STATE_PREAMBLE; 
              }
-             break;
-           case STATE_PREAMBLE:
-             if(data == PREAMBLE_BYTE) {
-               phyState = STATE_SYNC;
-             } 
-             break;
-           case STATE_DATA:
-             signal SerializerRadioByteComm.rxByteReady(data);
-             break;
-           // maybe there will be a time.... we will need this. but for now there is no footer
-           //case STATE_FOOTER_START:
-           //phyState = STATE_FOOTER_DONE;
-           //break;
-           //case STATE_FOOTER_DONE:
-           //phyState = STATE_NULL;
-           //signal PhyPacketRx.recvFooterDone(TRUE);
-           //break;
-           default:
-             break;
          }
-       }
      }
  
--- 187,309 ----
      /* Tx Done */
      async event void RadioByteComm.txByteReady(error_t error) {
!         if(error == SUCCESS) {
!             TransmitNextByte();
!         } else {
!             atomic {
!                 signal SerializerRadioByteComm.txByteReady(error);
!                 phyState = STATE_PREAMBLE;
!             }
          }
      }
  
      void TransmitNextByte() {
!         atomic {
!             switch(phyState) {
!                 case STATE_PREAMBLE:
!                     if(preambleCount > 0) {
!                         preambleCount--;
!                     } else {
!                         phyState = STATE_SYNC;
!                     }
!                     call RadioByteComm.txByte(PREAMBLE_BYTE);
!                     break;
!                 case STATE_SYNC:
!                     phyState = STATE_SFD;
!                     call RadioByteComm.txByte(SYNC_BYTE);
!                     break;
!                 case STATE_SFD:
!                     phyState = STATE_HEADER_DONE;
!                     call RadioByteComm.txByte(SFD_BYTE);
!                     break;
!                 case STATE_HEADER_DONE:
!                     phyState = STATE_DATA_HIGH;
!                     signal PhyPacketTx.sendHeaderDone();
!                     break;
!                 case STATE_DATA_HIGH:
!                     signal SerializerRadioByteComm.txByteReady(SUCCESS);
!                     break;
!                 case STATE_DATA_LOW:
!                     call RadioByteComm.txByte(manchesterEncodeNibble(bufByte & 0x0f));
!                     phyState = STATE_DATA_HIGH;                    
!                     break;
!                 case STATE_FOOTER_START:
!                     // maybe there will be a time.... we will need this.
!                     // phyState = STATE_FOOTER_DONE;
!                     // break;
!                 case STATE_FOOTER_DONE:
!                     phyState = STATE_PREAMBLE;
!                     signal PhyPacketTx.sendFooterDone();
!                     break;
!                 default:
!                     break;
              }
          }
      }
  
      /* Rx Done */
      async event void RadioByteComm.rxByteReady(uint8_t data) {
!         call RxByteTimer.start(byteTime);
!         ReceiveNextByte(data);
      }
  
      /* Receive the next Byte from the USART */
      void ReceiveNextByte(uint8_t data) {
!         uint8_t decodedByte;
!         atomic {
!             switch(phyState) {
!                 case STATE_SYNC:
!                     if(data != PREAMBLE_BYTE) {
!                         if (data == SFD_BYTE) {
!                             signal PhyPacketRx.recvHeaderDone(SUCCESS);
!                             phyState = STATE_DATA_HIGH;
!                         } else {
!                             phyState = STATE_SFD;
!                         } 
!                     }
!                     break;
!                 case STATE_SFD:
!                     if (data == SFD_BYTE) {
!                         signal PhyPacketRx.recvHeaderDone(SUCCESS);
!                         phyState = STATE_DATA_HIGH;
!                     } else {
!                         phyState = STATE_PREAMBLE; 
!                     }
!                     break;
!                 case STATE_PREAMBLE:
!                     if(data == PREAMBLE_BYTE) {
!                         phyState = STATE_SYNC;
!                     } 
!                     break;
!                 case STATE_DATA_HIGH:
!                     decodedByte = manchesterDecodeByte(data);
!                     if(decodedByte != 0xff) {
!                         bufByte = decodedByte << 4;
!                         phyState = STATE_DATA_LOW;
!                     } else {
!                         resetState();
!                     }
!                     break;
!                 case STATE_DATA_LOW:
!                     decodedByte = manchesterDecodeByte(data);
!                     if(decodedByte != 0xff) {
!                         bufByte |= decodedByte;
!                         signal SerializerRadioByteComm.rxByteReady(bufByte);   
!                         phyState = STATE_DATA_HIGH;
!                     } else {
!                         resetState();
!                     }
!                     break;
!                     // maybe there will be a time.... we will need this. but for now there is no footer
!                     //case STATE_FOOTER_START:
!                     //phyState = STATE_FOOTER_DONE;
!                     //break;
!                     //case STATE_FOOTER_DONE:
!                     //phyState = STATE_NULL;
!                     //signal PhyPacketRx.recvFooterDone(TRUE);
!                     //break;
!                 default:
!                     break;
              }
          }
      }
  



More information about the Tinyos-2-commits mailing list