[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/serial HdlcTranslateC.nc, 1.2, 1.3 ReceiveBytePacket.nc, 1.2, 1.3 SendBytePacket.nc, 1.2, 1.3 Serial.h, 1.2, 1.3 Serial802_5_4C.nc, 1.2, 1.3 SerialAMQueueP.nc, 1.2, 1.3 SerialAMReceiverC.nc, 1.2, 1.3 SerialAMSenderC.nc, 1.2, 1.3 SerialActiveMessageC.nc, 1.2, 1.3 SerialActiveMessageP.nc, 1.2, 1.3 SerialByteComm.nc, 1.2, 1.3 SerialDispatcherC.nc, 1.2, 1.3 SerialDispatcherP.nc, 1.2, 1.3 SerialFrameComm.nc, 1.2, 1.3 SerialP.nc, 1.2, 1.3 SerialPacketInfo802_15_4P.nc, 1.2, 1.3 SerialPacketInfoActiveMessageP.nc, 1.2, 1.3 SerialQueueP.nc, 1.2, 1.3

Phil Levis scipio at users.sourceforge.net
Tue Nov 7 11:32:22 PST 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/serial
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22851/tos/lib/serial

Modified Files:
	HdlcTranslateC.nc ReceiveBytePacket.nc SendBytePacket.nc 
	Serial.h Serial802_5_4C.nc SerialAMQueueP.nc 
	SerialAMReceiverC.nc SerialAMSenderC.nc 
	SerialActiveMessageC.nc SerialActiveMessageP.nc 
	SerialByteComm.nc SerialDispatcherC.nc SerialDispatcherP.nc 
	SerialFrameComm.nc SerialP.nc SerialPacketInfo802_15_4P.nc 
	SerialPacketInfoActiveMessageP.nc SerialQueueP.nc 
Log Message:
Merge over into the trunk.


Index: HdlcTranslateC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HdlcTranslateC.nc	12 Jul 2006 17:02:28 -0000	1.2
--- HdlcTranslateC.nc	7 Nov 2006 19:31:20 -0000	1.3
***************
*** 36,40 ****
    provides interface SerialFrameComm;
    uses {
!     interface SerialByteComm;
      interface Leds;
    }
--- 36,40 ----
    provides interface SerialFrameComm;
    uses {
!     interface UartStream;
      interface Leds;
    }
***************
*** 50,54 ****
    norace HdlcState state = {0,0};
    norace uint8_t txTemp;
! 
    
    // TODO: add reset for when SerialM goes no-sync.
--- 50,54 ----
    norace HdlcState state = {0,0};
    norace uint8_t txTemp;
!   norace uint8_t m_data;
    
    // TODO: add reset for when SerialM goes no-sync.
***************
*** 59,63 ****
      state.sendEscape = 0;
    }
!   async event void SerialByteComm.get(uint8_t data) {
      //debugCnt++;
      // 7E 41 0E 05 04 03 02 01 00 01 8F 7E
--- 59,63 ----
      state.sendEscape = 0;
    }
!   async event void UartStream.receivedByte(uint8_t data) {
      //debugCnt++;
      // 7E 41 0E 05 04 03 02 01 00 01 8F 7E
***************
*** 86,90 ****
    async command error_t SerialFrameComm.putDelimiter() {
      state.sendEscape = 0;
!     return call SerialByteComm.put(HDLC_FLAG_BYTE);
    }
    
--- 86,91 ----
    async command error_t SerialFrameComm.putDelimiter() {
      state.sendEscape = 0;
!     m_data = HDLC_FLAG_BYTE;
!     return call UartStream.send(&m_data, 1);
    }
    
***************
*** 93,107 ****
        state.sendEscape = 1;
        txTemp = data ^ 0x20;
!       return call SerialByteComm.put(HDLC_CTLESC_BYTE);
      }
      else {
!       return call SerialByteComm.put(data);
      }
    }
  
!   async event void SerialByteComm.putDone() {
      if (state.sendEscape) {
        state.sendEscape = 0;
!       call SerialByteComm.put(txTemp);
      }
      else {
--- 94,111 ----
        state.sendEscape = 1;
        txTemp = data ^ 0x20;
!       m_data = HDLC_CTLESC_BYTE;
      }
      else {
!       m_data = data;
      }
+     return call UartStream.send(&m_data, 1);
    }
  
!   async event void UartStream.sendDone( uint8_t* buf, uint16_t len, 
! 					error_t error ) {
      if (state.sendEscape) {
        state.sendEscape = 0;
!       m_data = txTemp;
!       call UartStream.send(&m_data, 1);
      }
      else {
***************
*** 109,111 ****
--- 113,117 ----
      }
    }
+ 
+   async event void UartStream.receiveDone( uint8_t* buf, uint16_t len, error_t error ) {}
  }



Index: Serial.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/Serial.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Serial.h	12 Jul 2006 17:02:28 -0000	1.2
--- Serial.h	7 Nov 2006 19:31:20 -0000	1.3
***************
*** 111,115 ****
  
  typedef nx_struct serial_header {
!   nx_am_addr_t addr;
    nx_uint8_t length;
    nx_am_group_t group;
--- 111,116 ----
  
  typedef nx_struct serial_header {
!   nx_am_addr_t dest;
!   nx_am_addr_t src;
    nx_uint8_t length;
    nx_am_group_t group;






Index: SerialActiveMessageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SerialActiveMessageP.nc	12 Jul 2006 17:02:29 -0000	1.2
--- SerialActiveMessageP.nc	7 Nov 2006 19:31:20 -0000	1.3
***************
*** 55,62 ****
  					  uint8_t len) {
      serial_header_t* header = getHeader(msg);
!     header->addr = dest;
      header->type = id;
      header->length = len;
!     header->group = TOS_AM_GROUP;
      return call SubSend.send(msg, len);
    }
--- 55,67 ----
  					  uint8_t len) {
      serial_header_t* header = getHeader(msg);
!     header->dest = dest;
!     // Do not set the source address or group, as doing so
!     // prevents transparent bridging. Need a better long-term
!     // solution for this.
!     //header->src = call AMPacket.address();
!     //header->group = TOS_AM_GROUP;
      header->type = id;
      header->length = len;
! 
      return call SubSend.send(msg, len);
    }
***************
*** 129,138 ****
    command am_addr_t AMPacket.destination(message_t* amsg) {
      serial_header_t* header = getHeader(amsg);
!     return header->addr;
    }
  
    command void AMPacket.setDestination(message_t* amsg, am_addr_t addr) {
      serial_header_t* header = getHeader(amsg);
!     header->addr = addr;
    }
    
--- 134,153 ----
    command am_addr_t AMPacket.destination(message_t* amsg) {
      serial_header_t* header = getHeader(amsg);
!     return header->dest;
!   }
! 
!   command am_addr_t AMPacket.source(message_t* amsg) {
!     serial_header_t* header = getHeader(amsg);
!     return header->src;
    }
  
    command void AMPacket.setDestination(message_t* amsg, am_addr_t addr) {
      serial_header_t* header = getHeader(amsg);
!     header->dest = addr;
!   }
! 
!   command void AMPacket.setSource(message_t* amsg, am_addr_t addr) {
!     serial_header_t* header = getHeader(amsg);
!     header->src = addr;
    }
    


Index: SerialDispatcherC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/SerialDispatcherC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SerialDispatcherC.nc	12 Jul 2006 17:02:29 -0000	1.2
--- SerialDispatcherC.nc	7 Nov 2006 19:31:20 -0000	1.3
***************
*** 1,5 ****
  //$Id$
  
! /* "Copyright (c) 2005 The Regents of the University of California.  
   * All rights reserved.
   *
--- 1,5 ----
  //$Id$
  
! /* "Copyright (c) 2005 The Regents of the University of California.
   * All rights reserved.
   *
***************
*** 8,17 ****
   * is hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  * 
   * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
   * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
   * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
--- 8,17 ----
   * is hereby granted, provided that the above copyright notice, the following
   * two paragraphs and the author appear in all copies of this software.
!  *
   * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
   * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
   * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  *
   * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
***************
*** 47,61 ****
  }
  implementation {
!   components SerialP, new SerialDispatcherP(), 
!     HdlcTranslateC, 
      PlatformSerialC;
!   
    Send = SerialDispatcherP;
    Receive = SerialDispatcherP;
    SerialPacketInfo = SerialDispatcherP.PacketInfo;
    SplitControl = SerialP;
!   
    Init = SerialP;
-   Init = PlatformSerialC;
    Leds = SerialP;
    Leds = SerialDispatcherP;
--- 47,60 ----
  }
  implementation {
!   components SerialP, new SerialDispatcherP(),
!     HdlcTranslateC,
      PlatformSerialC;
! 
    Send = SerialDispatcherP;
    Receive = SerialDispatcherP;
    SerialPacketInfo = SerialDispatcherP.PacketInfo;
    SplitControl = SerialP;
! 
    Init = SerialP;
    Leds = SerialP;
    Leds = SerialDispatcherP;
***************
*** 64,72 ****
    SerialDispatcherP.ReceiveBytePacket -> SerialP;
    SerialDispatcherP.SendBytePacket -> SerialP;
!   
    SerialP.SerialFrameComm -> HdlcTranslateC;
    SerialP.SerialControl -> PlatformSerialC;
!   
!   HdlcTranslateC.SerialByteComm -> PlatformSerialC;
!   
  }
--- 63,71 ----
    SerialDispatcherP.ReceiveBytePacket -> SerialP;
    SerialDispatcherP.SendBytePacket -> SerialP;
! 
    SerialP.SerialFrameComm -> HdlcTranslateC;
    SerialP.SerialControl -> PlatformSerialC;
! 
!   HdlcTranslateC.UartStream -> PlatformSerialC;
! 
  }



Index: SerialP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/SerialP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SerialP.nc	12 Jul 2006 17:02:29 -0000	1.2
--- SerialP.nc	7 Nov 2006 19:31:20 -0000	1.3
***************
*** 1,3 ****
- // $Id$
  /*									
   *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
--- 1,2 ----
***************
*** 35,39 ****
   *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
-  * Author: Phil Buonadonna
   * Revision: $Revision$
   * 
--- 34,37 ----
***************
*** 164,170 ****
    ack_queue_t ackQ;
  
-   /* stats */
-   radio_stats_t stats;
- 
    bool offPending = FALSE;
  
--- 162,165 ----
***************
*** 174,178 ****
    inline void rxInit();
    inline void ackInit();
-   inline void statsInit();
  
    inline bool ack_queue_is_full(); 
--- 169,172 ----
***************
*** 221,231 ****
    }
  
-   inline void statsInit(){
-     memset(&stats, 0, sizeof(stats));
-     stats.platform = 0; // TODO: set platform
-     stats.MTU = SERIAL_MTU;
-     stats.version = SERIAL_VERSION;
-   }
-   
    command error_t Init.init() {
  
--- 215,218 ----
***************
*** 233,237 ****
      rxInit();
      ackInit();
-     statsInit();
  
      return SUCCESS;
--- 220,223 ----
***************
*** 431,435 ****
      case RXSTATE_TOKEN:
        if (isDelimeter) {
-         stats.serial_short_packets++;
          goto nosync;
        }
--- 417,420 ----
***************
*** 451,460 ****
              }
              else {
-               stats.serial_crc_fail++;
                goto nosync;
              }
            }
            else {
-             stats.serial_short_packets++;
              goto nosync;
            }
--- 436,443 ----
***************
*** 472,476 ****
        /* no valid message.. */
        else {
-         stats.serial_proto_drops++;
          goto nosync;
         }
--- 455,458 ----
***************
*** 572,576 ****
      /* if done, call the send done */
      if (done || fail) {
-       if (fail) atomic stats.serial_tx_fail++;
        txSeqno++;
        if (txProto == SERIAL_PROTO_ACK){
--- 554,557 ----






More information about the Tinyos-2-commits mailing list