[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/byte_radio LinkLayerP.nc, 1.1.2.2, 1.1.2.3 MacReceive.nc, 1.1.2.1, 1.1.2.2 MacSend.nc, 1.1.2.1, 1.1.2.2 PacketSerializerP.nc, 1.1.2.6, 1.1.2.7 PhyReceive.nc, 1.1.2.1, 1.1.2.2 PhySend.nc, 1.1.2.1, 1.1.2.2

Philipp Huppertz phihup at users.sourceforge.net
Thu Jun 8 08:31:07 PDT 2006


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

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	LinkLayerP.nc MacReceive.nc MacSend.nc PacketSerializerP.nc 
	PhyReceive.nc PhySend.nc 
Log Message:
- fixed a bug in UartPhy and some more on PacketSerializer
- added some documentaion to interfaces
- BEWARE: radio strangely only works when compiled with "debug" option.

Index: LinkLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/LinkLayerP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** LinkLayerP.nc	7 Jun 2006 19:54:53 -0000	1.1.2.2
--- LinkLayerP.nc	8 Jun 2006 15:31:05 -0000	1.1.2.3
***************
*** 80,84 ****
    /* state vars */
    error_t splitStateError;    // state of SplitControl interfaces
!   bool recvBlock;             // blocks an incoming packet if the rxBuffer is in use
      
  // #define LLCM_DEBUG  
--- 80,84 ----
    /* state vars */
    error_t splitStateError;    // state of SplitControl interfaces
!   bool rxBusy;                // blocks an incoming packet if the rxBuffer is in use
      
  // #define LLCM_DEBUG  
***************
*** 101,105 ****
            seqNo = 0;
            splitStateError = EOFF;
!           recvBlock = FALSE;
          }
          return SUCCESS;
--- 101,105 ----
            seqNo = 0;
            splitStateError = EOFF;
!           rxBusy = FALSE;
          }
          return SUCCESS;
***************
*** 219,223 ****
        atomic {
          rxBufPtr = tmpMsgPtr;
!         recvBlock = FALSE;
        }
      }
--- 219,223 ----
        atomic {
          rxBufPtr = tmpMsgPtr;
!         rxBusy = FALSE;
        }
      }
***************
*** 226,233 ****
        message_t* msgPtr;
        atomic {
!         if (recvBlock) {
            msgPtr = msg;
          } else {
!           recvBlock = TRUE;
            msgPtr = rxBufPtr;
            rxBufPtr = msg;
--- 226,233 ----
        message_t* msgPtr;
        atomic {
!         if (rxBusy) {
            msgPtr = msg;
          } else {
!           rxBusy = TRUE;
            msgPtr = rxBufPtr;
            rxBufPtr = msg;

Index: MacReceive.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/MacReceive.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
*** MacReceive.nc	31 May 2006 13:53:02 -0000	1.1.2.1
--- MacReceive.nc	8 Jun 2006 15:31:05 -0000	1.1.2.2
***************
*** 32,36 ****
   *   
   * The interface provides two events in async context which indicate that
!  * a packet is detected or was received.
   *
   * @author Philipp Huppertz
--- 32,36 ----
   *   
   * The interface provides two events in async context which indicate that
!  * a packet is detected or was received. Is provided by the MAC layer.
   *
   * @author Philipp Huppertz
***************
*** 43,48 ****
  interface MacReceive {
  
!   /**
!    FIXME: Fill in description here
     */
    async event message_t* receiveDone(message_t* msg);
--- 43,62 ----
  interface MacReceive {
  
!    /**
!    * Receive a packet buffer, returning a buffer for the signaling
!    * component to use for the next reception. The return value
!    * can be the same as <tt>msg</tt>, as long as the handling
!    * component copies out the data it needs.
!    *
!    * <b>Note</b> that misuse of this interface is one of the most
!    * common bugs in TinyOS code. For example, if a component both calls a
!    * send on the passed message and returns it, then it is possible
!    * the buffer will be reused before the send occurs, overwriting
!    * the component's data. This would cause the mote to possibly
!    * instead send a packet it most recently received.
!    *
!    * @param  msg      the receied packet
!    * @return          a packet buffer for the stack to use for the next
!    *                  received packet.
     */
    async event message_t* receiveDone(message_t* msg);

Index: MacSend.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/MacSend.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
*** MacSend.nc	31 May 2006 13:53:02 -0000	1.1.2.1
--- MacSend.nc	8 Jun 2006 15:31:05 -0000	1.1.2.2
***************
*** 32,36 ****
    * The basic address-free message sending interface in asnyc context. 
    *
!   * This interface provides similar functionality as the Send interface. 
    *
    * @author Philipp Huppertz
--- 32,37 ----
    * The basic address-free message sending interface in asnyc context. 
    *
!   * This interface provides similar functionality as the Send interface
!   * but is provided by the MAC layer. 
    *
    * @author Philipp Huppertz
***************
*** 67,72 ****
    
    /**
!    FIXME: comments here
!    */
    async command error_t cancel(message_t* msg);
  
--- 68,82 ----
    
    /**
!   * Cancel a requested transmission. Returns SUCCESS if the 
!   * transmission was cancelled properly (not sent in its
!   * entirety). Note that the component may not know
!   * if the send was successfully cancelled, if the radio is
!   * handling much of the logic; in this case, a component
!   * should be conservative and return an appropriate error code.
!   *
!   * @param   msg    the packet whose transmission should be cancelled
!   * @return         SUCCESS if the packet was successfully cancelled, FAIL
!   *                 otherwise
!   */
    async command error_t cancel(message_t* msg);
  

Index: PacketSerializerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/PacketSerializerP.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** PacketSerializerP.nc	7 Jun 2006 19:54:53 -0000	1.1.2.6
--- PacketSerializerP.nc	8 Jun 2006 15:31:05 -0000	1.1.2.7
***************
*** 121,125 ****
        ++byteCnt;
        call RadioByteComm.txByte((uint8_t)(crc >> 8));
!     } else { // (byteCnt > (header->length + sizeof(message_header_t)+1))
          call PhyPacketTx.sendFooter();  
      }
--- 121,125 ----
        ++byteCnt;
        call RadioByteComm.txByte((uint8_t)(crc >> 8));
!     } else { /* (byteCnt > (header->length + sizeof(message_header_t)+1)) */
          call PhyPacketTx.sendFooter();  
      }
***************
*** 149,153 ****
      message_radio_footer_t* footer = getFooter((message_t*)rxBufPtr);
      // we care about wrong crc in this layer
!     if (footer->crc == 0) error = FAIL;
      rxBufPtr = signal PhyReceive.receiveDone((message_t*)rxBufPtr, ((message_t*)rxBufPtr)->data, header->length, error);
    }
--- 149,153 ----
      message_radio_footer_t* footer = getFooter((message_t*)rxBufPtr);
      // we care about wrong crc in this layer
!     if (footer->crc != 1) error = FAIL;
      rxBufPtr = signal PhyReceive.receiveDone((message_t*)rxBufPtr, ((message_t*)rxBufPtr)->data, header->length, error);
    }

Index: PhyReceive.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/PhyReceive.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
*** PhyReceive.nc	31 May 2006 13:53:03 -0000	1.1.2.1
--- PhyReceive.nc	8 Jun 2006 15:31:05 -0000	1.1.2.2
***************
*** 32,36 ****
   *   
   * The interface provides two events in async context which indicate that
!  * a packet is detected or was received.
   *
   * @author Philipp Huppertz
--- 32,36 ----
   *   
   * The interface provides two events in async context which indicate that
!  * a packet is detected or was received. It is provided by the Phy layer.
   *
   * @author Philipp Huppertz
***************
*** 42,53 ****
  
  interface PhyReceive {
! 
!   /**
!    FIXME: Fill in description here
     */
    async event message_t* receiveDone(message_t* msg, void* payload, uint8_t len, error_t error);
  
    /**
!    FIXME: Fill in description here
    */
    async event void receiveDetected();
--- 42,72 ----
  
  interface PhyReceive {
!    /**
!    * Receive a packet buffer, returning a buffer for the signaling
!    * component to use for the next reception. The return value
!    * can be the same as <tt>msg</tt>, as long as the handling
!    * component copies out the data it needs. The <tt>msg</tt> may
!    * be invalid when <tt>error</tt> is not SUCCESS !
!    *
!    * <b>Note</b> that misuse of this interface is one of the most
!    * common bugs in TinyOS code. For example, if a component both calls a
!    * send on the passed message and returns it, then it is possible
!    * the buffer will be reused before the send occurs, overwriting
!    * the component's data. This would cause the mote to possibly
!    * instead send a packet it most recently received.
!    *
!    * @param  msg      the receied packet
!    * @param  payload  a pointer to the packet's payload
!    * @param  len      the length of the data region pointed to by payload
!    * @param  error    FAIL if the packet was corrupted (e.g. wrong crc)
!    * @return          a packet buffer for the stack to use for the next
!    *                  received packet.
     */
    async event message_t* receiveDone(message_t* msg, void* payload, uint8_t len, error_t error);
  
    /**
!   * Indicates that a packet has been detected. This means that the packet's physical header
!   * (preamble bytes + sync byte + SFD byte) was received.
!   *
    */
    async event void receiveDetected();

Index: PhySend.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/byte_radio/Attic/PhySend.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
*** PhySend.nc	31 May 2006 13:53:03 -0000	1.1.2.1
--- PhySend.nc	8 Jun 2006 15:31:05 -0000	1.1.2.2
***************
*** 32,36 ****
    * The basic address-free message sending interface in asnyc context. 
    *
!   * This interface provides similar functionality as the Send interface. 
    *
    * @author Philipp Huppertz
--- 32,37 ----
    * The basic address-free message sending interface in asnyc context. 
    *
!   * This interface provides similar functionality as the Send interface
!   * but is provided by the Phy Layer.
    *
    * @author Philipp Huppertz



More information about the Tinyos-2-commits mailing list