[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/eyesIFX/byte_radio manchester.h, NONE, 1.1 code4b6b.h, 1.2, 1.3 UartManchPhyP.nc, 1.6, 1.7 Uart4b6bPhyP.nc, 1.5, 1.6 Uart4b6bPhyC.nc, 1.3, 1.4

akoepke andreaskoepke at users.sourceforge.net
Wed Mar 5 03:14:03 PST 2008


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

Modified Files:
	code4b6b.h UartManchPhyP.nc Uart4b6bPhyP.nc Uart4b6bPhyC.nc 
Added Files:
	manchester.h 
Log Message:
baudrates revisited


--- NEW FILE: manchester.h ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, 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 ---------------------------------------------------------
 * provide functions to encode/decode a manchester stream
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/03/05 11:14:00 $
 * @author Andreas Koepke <koepke at tkn.tu-berlin.de>
 * ========================================================================
 */

enum {
    ILLEGAL_CODE = 0xff,
    ENCODED_32KHZ_BYTE_TIME = 2*TDA5250_32KHZ_BYTE_TIME
};

const uint8_t nibbleToManchesterByte[] = {
    0x55,
    0x56,
    0x59,
    0x5a,
    0x65,
    0x66,
    0x69,
    0x6a,
    0x95,
    0x96,
    0x99,
    0x9a,
    0xa5,
    0xa6,
    0xa9,
    0xaa
};

const uint8_t manchesterByteToNibble[] = {
    0x0,
    0x1,
    0xff,
    0xff,
    0x2,
    0x3,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0x4,
    0x5,
    0xff,
    0xff,
    0x6,
    0x7,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0x8,
    0x9,
    0xff,
    0xff,
    0xa,
    0xb,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xff,
    0xc,
    0xd,
    0xff,
    0xff,
    0xe,
    0xf
};

uint8_t manchesterEncodeNibble(uint8_t nib) 
{
    return nibbleToManchesterByte[nib];
}

uint8_t manchesterDecodeByte(uint8_t b) 
{
    uint8_t dec;
    
    if(b < 0x55) {
        dec = 0xff;
    }
    else if(b > 0xaa) {
        dec = 0xff;
    }
    else {
        dec = manchesterByteToNibble[b - 0x55];
    }
    return dec;
}

Index: code4b6b.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/code4b6b.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** code4b6b.h	6 Nov 2006 11:57:18 -0000	1.2
--- code4b6b.h	5 Mar 2008 11:14:00 -0000	1.3
***************
*** 39,43 ****
  
  enum {
!     ILLEGAL_CODE = 0xff
  };
  
--- 39,44 ----
  
  enum {
!     ILLEGAL_CODE = 0xff,
!     ENCODED_32KHZ_BYTE_TIME = 3*TDA5250_32KHZ_BYTE_TIME/2
  };
  

Index: UartManchPhyP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/UartManchPhyP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** UartManchPhyP.nc	5 Apr 2007 06:38:45 -0000	1.6
--- UartManchPhyP.nc	5 Mar 2008 11:14:00 -0000	1.7
***************
*** 76,80 ****
  
  #define PREAMBLE_LENGTH   2
! #define BYTE_TIME         21
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF
--- 76,80 ----
  
  #define PREAMBLE_LENGTH   2
! #define BYTE_TIME         TDA5250_32KHZ_BYTE_TIME
  #define PREAMBLE_BYTE     0x55
  #define SYNC_BYTE         0xFF

Index: Uart4b6bPhyP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/Uart4b6bPhyP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Uart4b6bPhyP.nc	5 Apr 2007 06:38:45 -0000	1.5
--- Uart4b6bPhyP.nc	5 Mar 2008 11:14:00 -0000	1.6
***************
*** 48,55 ****
--- 48,66 ----
          interface RadioByteComm;
          interface Alarm<T32khz, uint16_t> as RxByteTimer;
+ #ifdef UART_DEBUG
+         interface SerialDebug;
+ #endif
      }
  }
  implementation
  {
+ #ifdef UART_DEBUG
+     void sdDebug(uint16_t p) {
+         call SerialDebug.putPlace(p);
+     }
+ #else
+     void sdDebug(uint16_t p) {};
+ #endif
+ 
      /* Module Definitions  */
      typedef enum {
***************
*** 73,77 ****
      enum {
          PREAMBLE_LENGTH=2,
!         BYTE_TIME=21,
          PREAMBLE_BYTE=0x55,
          SYNC_BYTE=0xFF,
--- 84,88 ----
      enum {
          PREAMBLE_LENGTH=2,
!         BYTE_TIME=ENCODED_32KHZ_BYTE_TIME+3,
          PREAMBLE_BYTE=0x55,
          SYNC_BYTE=0xFF,
***************
*** 97,100 ****
--- 108,114 ----
              byteTime = BYTE_TIME;
          }
+ #ifdef UART_DEBUG
+         call SerialDebug.putShortDesc("U4b6bP");
+ #endif
          return SUCCESS;
      }
***************
*** 124,129 ****
          if(phyState >= STATE_DATA_HIGH) {
              signal PhyPacketRx.recvFooterDone(FAIL);
          }
!         phyState = STATE_PREAMBLE; 
      }
  
--- 138,144 ----
          if(phyState >= STATE_DATA_HIGH) {
              signal PhyPacketRx.recvFooterDone(FAIL);
+             sdDebug(10);
          }
!         phyState = STATE_PREAMBLE;
      }
  
***************
*** 183,186 ****
--- 198,202 ----
          call RxByteTimer.stop();
          signal PhyPacketRx.recvFooterDone(SUCCESS);
+         sdDebug(20);
      }
  

Index: Uart4b6bPhyC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/eyesIFX/byte_radio/Uart4b6bPhyC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Uart4b6bPhyC.nc	5 Apr 2007 06:38:45 -0000	1.3
--- Uart4b6bPhyC.nc	5 Mar 2008 11:14:00 -0000	1.4
***************
*** 65,67 ****
--- 65,73 ----
      
      Uart4b6bPhyP.RxByteTimer -> RxByteTimer;
+     
+ #ifdef UART_DEBUG
+     components new SerialDebugC() as SD;
+     Uart4b6bPhyP.SerialDebug -> SD;
+ #endif
+ 
  }



More information about the Tinyos-2-commits mailing list