[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

Philipp Huppertz phihup at users.sourceforge.net
Thu Oct 5 01:37:49 PDT 2006


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

Modified Files:
      Tag: tos-2-msp430-usart-configure-candidate
	SerialActiveMessageP.nc SerialDispatcherC.nc Serial.h 
	SerialP.nc 
Log Message:
- optimized usart configure using unions

Index: SerialActiveMessageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.10.2.1
diff -C2 -d -r1.1.2.10 -r1.1.2.10.2.1
*** SerialActiveMessageP.nc	25 May 2006 17:38:06 -0000	1.1.2.10
--- SerialActiveMessageP.nc	5 Oct 2006 08:37:46 -0000	1.1.2.10.2.1
***************
*** 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: Serial.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/Serial.h,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.12.2.1
diff -C2 -d -r1.1.2.12 -r1.1.2.12.2.1
*** Serial.h	15 May 2006 16:44:17 -0000	1.1.2.12
--- Serial.h	5 Oct 2006 08:37:46 -0000	1.1.2.12.2.1
***************
*** 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: SerialP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/serial/SerialP.nc,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.10.2.1
diff -C2 -d -r1.1.2.10 -r1.1.2.10.2.1
*** SerialP.nc	15 Jun 2006 06:03:50 -0000	1.1.2.10
--- SerialP.nc	5 Oct 2006 08:37:46 -0000	1.1.2.10.2.1
***************
*** 1,3 ****
- // $Id$
  /*									
   *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
--- 1,2 ----
***************
*** 671,676 ****
        case TXSTATE_INFO:
          atomic {
-           uint8_t nextByte;
- 
            txResult = call SerialFrameComm.putData(txBuf[txIndex].buf);
            txCRC = crcByte(txCRC,txBuf[txIndex].buf);
--- 670,673 ----
***************
*** 678,689 ****
            
            if (txIndex == TX_DATA_INDEX){
              nextByte = signal SendBytePacket.nextByte();
            }
!           if (txBuf[txIndex].state == BUFFER_COMPLETE || txByteCnt >= SERIAL_MTU){
              txState = TXSTATE_FCS1;
            }
-           else { /* never called on ack b/c ack is BUFFER_COMPLETE initially */
-             txBuf[txIndex].buf = nextByte;
-           }
          }
          break;
--- 675,690 ----
            
            if (txIndex == TX_DATA_INDEX){
+             uint8_t nextByte;
              nextByte = signal SendBytePacket.nextByte();
+             if (txBuf[txIndex].state == BUFFER_COMPLETE || txByteCnt >= SERIAL_MTU){
+               txState = TXSTATE_FCS1;
+             }
+             else { /* never called on ack b/c ack is BUFFER_COMPLETE initially */
+               txBuf[txIndex].buf = nextByte;
+             }
            }
!           else { // TX_ACK_INDEX
              txState = TXSTATE_FCS1;
            }
          }
          break;



More information about the Tinyos-2-commits mailing list