[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154/interfaces/private SlottedCsmaCa.nc, NONE, 1.1 SuperframeStructure.nc, NONE, 1.1 UnslottedCsmaCa.nc, NONE, 1.1 EnergyDetection.nc, 1.2, 1.3 FrameRx.nc, 1.1, 1.2 FrameTx.nc, 1.2, 1.3 FrameTxNow.nc, 1.2, 1.3 RadioOff.nc, 1.2, 1.3 RadioRx.nc, 1.2, 1.3 RadioTx.nc, 1.2, 1.3 Ieee802154Debug.nc, 1.1, NONE

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Wed Mar 4 10:32:18 PST 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17605/tos/lib/mac/tkn154/interfaces/private

Modified Files:
	EnergyDetection.nc FrameRx.nc FrameTx.nc FrameTxNow.nc 
	RadioOff.nc RadioRx.nc RadioTx.nc 
Added Files:
	SlottedCsmaCa.nc SuperframeStructure.nc UnslottedCsmaCa.nc 
Removed Files:
	Ieee802154Debug.nc 
Log Message:
- re-designed the radio driver interfaces, restructured/improved the CC2420 radio driver
- split the main MAC configuration (was TKN154P.nc) in two: one for beacon-enabled mode the other for nonbeacon-enabled mode (this decision has to be made at compile time now)
- added (serial) debugging functions (compile with "TKN154_DEBUG=1 make telosb" and use the java PrintfClient, see tinyos-2.x/apps/tests/TestPrintf/README.txt)
- improved readability, added comments 

--- NEW FILE: SlottedCsmaCa.nc ---
/* 
 * Copyright (c) 2008, 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.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2009/03/04 18:31:45 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
#include "TKN154_PHY.h"

interface SlottedCsmaCa 
{
  /** 
   * Transmits a frame using the slotted CSMA-CA algorithm as specified in IEEE
   * 802.15.4-2006 standard Sect. 7.5.1.4. This command will fail if the
   * current state of the radio is not RADIO_OFF. The initial CSMA-CA
   * parameters are passed as a parameter and may be modified by the callee.
   * The caller must not access <tt>csma</tt> until the <tt>transmitDone</tt>
   * event has been signalled.
   *
   * <tt>slot0Time</tt> defines the beginning of the first slot in the CAP.
   * Any transmission must commence on a backoff slot boundary relative to
   * <tt>slot0Time</tt>. The last possible time for transmission is defined by
   * <tt>slot0Time+dtMax</tt>. If the transmission cannot commence at or before
   * <tt>slot0Time+dtMax</tt> then an event <tt>transmitDone()</tt> with error
   * code ERETRY will be signalled and <tt>csma</tt> will reflect the current
   * state of the CSMA-CA algorithm. The caller can then resume the
   * transmission of this frame in the next CAP based on the
   * <tt>remainingBackoff</tt> passed in the <tt>transmitDone()</tt> event, by
   * setting <tt>resume</tt> to TRUE in the <tt>transmit()</tt> call.
   *
   * Iff the ACK_REQUESTED flag is set in the frame's header a successful
   * transmission will include an acknowledgement from the destination; then,
   * the callee will perform the necessary steps for receiving this
   * acknowledgement following the specification in IEEE 802.15.4-2006 Sect.
   * 7.5.6.4. 
   * 
   * @param frame The frame to transmit.
   *
   * @param csma Initial parameters for the slotted CSMA-CA algorithm. 
   *
   * @param slot0Time Reference time for the backoff slot boundaries  
   *
   * @param dtMax <tt>slot0Time+dtMax</tt> is the last time the frame may be 
   *              transmitted.
   *
   * @param resume TRUE means that the initial backoff is defined by the
   *               <tt>remainingBackoff</tt> parameter, FALSE means the 
   *               <tt>remainingBackoff</tt> is to be ignored.
   *
   * @param remainingBackoff initial backoff (ignored if <tt>resume</tt>
   * is FALSE.
   *
   * @return SUCCESS if the slotted CSMA-CA was triggered successfully;
   * EINVAL if <tt>frame</tt> or a pointer therein is invalid; FAIL otherwise.
   */
  async command error_t transmit(ieee154_txframe_t *frame, ieee154_csma_t *csma,
      const ieee154_timestamp_t *slot0Time, uint32_t dtMax, bool resume, uint16_t remainingBackoff);

  /**
   * Signalled in response to a call to <tt>transmit()</tt>. This event
   * completes the <tt>transmit</tt> operation. A transmission failed if either
   * the channel was never idle during any of the <tt>macMaxCsmaBackoffs+1</tt>
   * transmission attempts, if no acknowledgement was received although one was
   * requested or if the frame could not be transmitted before the specified
   * deadline (<tt>slot0Time+dtMax</tt>).
   *
   * @param frame The frame that was to be transmitted.  
   *
   * @param csma Parameters for the slotted CSMA-CA algorithm; this pointer is
   * identical to the one passed to the <tt>transmit</tt> command, the content,
   * however, may have changed.
   *
   * @param ackPendingFlag TRUE if an acknowledgement was received and the
   * "pending" flag is set in the header of the ACK frame, FALSE otherwise
   * (this is typically only relevant for indirect transmissions)
   * 
   * @param remainingBackoff Only valid if <tt>result = ERETRY</tt>, and
   * then it describes the remaining backoff time (in symbols) to be used
   * for the transmission of the frame in the following CAP.   
   *
   * @result result SUCCESS if the the frame was transmitted (and a matching
   * acknowledgement was received, if requested); FAIL if the CSMA-CA algorithm
   * failed because NB > macMaxCsmaBackoffs; ERETRY if the frame could not be 
   * transmitted because transmission would have started later than 
   * <tt>slot0Time+dtMax</tt>
   */
  async event void transmitDone(ieee154_txframe_t *frame, ieee154_csma_t *csma, 
      bool ackPendingFlag,  uint16_t remainingBackoff, error_t result);
}

--- NEW FILE: SuperframeStructure.nc ---
/* 
 * Copyright (c) 2008, 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.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2009/03/04 18:31:45 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

 /* A superframe is bounded by beacons and divided into 16 equally-sized slots,
  * which are part of CAP, CFP (GTS) or the inactive period. This interface
  * can be used to determine the various parameters of a superframe,
  * for example the begin of an inactive period would be calculated as
  * "sfStartTime + (numCapSlot + numGtsSlots) * sfSlotDuration"
  **/

interface SuperframeStructure 
{
  /**
   * Returns the absolute time (in symbols) when the superframe started, 
   * i.e. the timestamp of the beacon marking the first slot.
   * 
   * @returns  superframe start time 
   **/
  async command uint32_t sfStartTime(); 

  /**
   * Duration (in symbols) of a single superframe slot.
   * Zero means, the CAP is not valid (no valid beacon was received).
   * 
   * @returns  superframe slot duration
   **/
  async command uint16_t sfSlotDuration();

  /**
   * Number of CAP slots.
   * 
   * @returns  number of CAP slots
   **/
  async command uint8_t numCapSlots();

  /**
   * Number of CAP slots (following the last CAP slot).
   * 
   * @returns  number of CAP slots
   **/
  async command uint8_t numGtsSlots();

  /**
   * Duration of the battery life extension period (in symbols), 
   * Zero means battery life extension is not used (disabled).
   * 
   * @returns  duration of the battery life extension period, 
   * zero means battery life extension is disabled
   **/
  async command uint16_t battLifeExtDuration();     

  /**
   * Returns a pointer to the content of the GTS fields of the 
   * last received/transmitted beacon. 
   * 
   * @returns GTS fields 
   **/
  async command const uint8_t* gtsFields();

  /**
   * The last "guardTime" symbols of CAP/CFP should not be used,
   * i.e. transmission/reception should stop "guardTime" symbols
   * before the actual end of the CAP/CFP.
   * 
   * @returns guard time
   **/
  async command uint16_t guardTime();

  /**
   * Platform-specific representation of "sfStartTime" marking
   * the reception/tranmission time of a beacon.
   * 
   * @returns reception/tranmission time of the beacon
   **/
  async command const ieee154_timestamp_t* sfStartTimeRef();

  /**
   * Tells whether the frame pending bit is set in the header
   * of the beacon frame.
   * 
   * @returns TRUE is frame pending bit in beacon header is set, FALSE otherwise
   **/
  async command bool isBroadcastPending();  
}

--- NEW FILE: UnslottedCsmaCa.nc ---
/* 
 * Copyright (c) 2008, 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.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2009/03/04 18:31:45 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
#include "TKN154_platform.h"

interface UnslottedCsmaCa
{
  /** 
   * Transmits a frame using the unslotted CSMA-CA algorithm as specified in 
   * IEEE 802.15.4-2006 standard Sect. 7.5.1.4. This command will fail if the
   * current state of the radio is not RADIO_OFF. The initial CSMA-CA parameters
   * are passed as a parameter and may be modified by the callee. The caller
   * must not access <tt>csma</tt> until the <tt>transmitDone</tt> event
   * has been signalled. 
   *
   * Iff the ACK_REQUESTED flag is set in the frame's header a successful 
   * transmission will include an acknowledgement from the destination; 
   * then, the callee will perform the necessary steps for receiving this
   * acknowledgement following the specification in IEEE 802.15.4-2006 
   * Sect. 7.5.6.4. 
   * 
   * @param frame The frame to transmit.
   *
   * @param csma Parameters for the unslotted CSMA-CA algorithm. 
   *
   * @return SUCCESS if the unslotted CSMA-CA algorithm was triggered 
   * successfully; EINVAL if <tt>frame</tt> or a pointer therein is invalid; 
   * FAIL if the radio is not in state RADIO_OFF.
   */
  async command error_t transmit(ieee154_txframe_t *frame, ieee154_csma_t *csma);

  /**
   * Signalled in response to a call to <tt>transmit()</tt>. This event completes
   * the <tt>transmit</tt> operation. If the transmission succeeded then
   * the time of the transmission -- the point in time when the first bit of the
   * PPDU was transmitted -- will be stored in the metadata field of the frame. 
   * A transmission failed if either all CCA operation(s) failed (including
   * backoffs, i.e. NB > macMaxCsmaBackoffs) or if no acknowledgement was received
   * although one was requested.
   *
   * @param frame The frame that was to be transmitted.  
   *
   * @param csma Parameters for the unslotted CSMA-CA algorithm; this
   * pointer is identical to the one passed to the <tt>transmit</tt> command,
   * the content, however, may have changed.
   *
   * @param ackPendingFlag TRUE if an acknowledgement was received and the
   * "pending" flag is set in the header of the ACK frame, FALSE otherwise
   * (this is typically only relevant for indirect transmissions)
   *
   * @param result SUCCESS if the frame was transmitted (and a matching
   * acknowledgement was received, if requested); ENOACK if the frame was 
   * transmitted, but no matching acknowledgement was received, although one
   * was requested; FAIL if the CSMA-CA algorithm failed because 
   * NB > macMaxCsmaBackoffs.  
   */
  async event void transmitDone(ieee154_txframe_t *frame, ieee154_csma_t *csma, bool ackPendingFlag, error_t result);
}

Index: EnergyDetection.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/EnergyDetection.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EnergyDetection.nc	25 Nov 2008 09:35:09 -0000	1.2
--- EnergyDetection.nc	4 Mar 2009 18:31:42 -0000	1.3
***************
*** 50,59 ****
  
    /**
!    * Signalled in response to a call to <tt>start<\tt>;
     * returns the maximum energy measured on the channel over the
     * specified period of time.
     *
     * @param status SUCCESS if the measurement succeeded
!    * and only then <tt>EnergyLevel<\tt> is valid, FAIL 
     * otherwise
     * @param EnergyLevel The maximum energy on the channel
--- 50,59 ----
  
    /**
!    * Signalled in response to a call to <tt>start</tt>;
     * returns the maximum energy measured on the channel over the
     * specified period of time.
     *
     * @param status SUCCESS if the measurement succeeded
!    * and only then <tt>EnergyLevel</tt> is valid, FAIL 
     * otherwise
     * @param EnergyLevel The maximum energy on the channel

Index: FrameRx.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/FrameRx.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FrameRx.nc	16 Jun 2008 18:00:33 -0000	1.1
--- FrameRx.nc	4 Mar 2009 18:31:44 -0000	1.2
***************
*** 35,40 ****
  {
    /**
!    * Received a frame buffer, returning a buffer for the signaling
!    * component to use for the next reception.
     *
     * @param   frame     the received frame
--- 35,39 ----
  {
    /**
!    * Received a frame.
     *
     * @param   frame     the received frame

Index: FrameTx.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/FrameTx.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FrameTx.nc	25 Nov 2008 09:35:09 -0000	1.2
--- FrameTx.nc	4 Mar 2009 18:31:44 -0000	1.3
***************
*** 35,39 ****
  {
    /**
!    * Transmits a frame buffer.
     *
     * @param  txFrame    the frame to transmit
--- 35,39 ----
  {
    /**
!    * Transmits a frame.
     *
     * @param  txFrame    the frame to transmit
***************
*** 44,48 ****
  
    /**
!    * Signals the completion of the transmission of a frame buffer.
     *
     * @param  txFrame    the frame that was transmitted
--- 44,48 ----
  
    /**
!    * Signals the completion of the transmission of a frame.
     *
     * @param  txFrame    the frame that was transmitted

Index: FrameTxNow.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/FrameTxNow.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FrameTxNow.nc	25 Nov 2008 09:35:09 -0000	1.2
--- FrameTxNow.nc	4 Mar 2009 18:31:44 -0000	1.3
***************
*** 35,39 ****
  {
    /**
!    * Transmits a frame buffer.
     *
     * @param  txFrame    the frame to transmit
--- 35,39 ----
  {
    /**
!    * Transmits a frame.
     *
     * @param  txFrame    the frame to transmit
***************
*** 45,49 ****
  
    /**
!    * Signals the completion of the transmission of a frame buffer.
     *
     * @param  txFrame    the frame that was transmitted
--- 45,49 ----
  
    /**
!    * Signals the completion of the transmission of a frame.
     *
     * @param  txFrame    the frame that was transmitted

Index: RadioOff.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/RadioOff.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioOff.nc	25 Nov 2008 09:35:09 -0000	1.2
--- RadioOff.nc	4 Mar 2009 18:31:44 -0000	1.3
***************
*** 36,49 ****
  interface RadioOff
  {
- 
    /** 
     * Disables the transceiver and changes the radio state to RADIO_OFF. This
!    * command will succeed only if the current state of the radio is either
!    * TX_LOADED, RX_PREPARED or RECEIVING.
     *
     * @return SUCCESS if the command was accepted and the <tt>offDone()</tt>
!    * event will be signalled; EALREADY if radio is already switched off; FAIL
!    * if the current radio state is neither TX_LOADED, RX_PREPARED nor
!    * RECEIVING.
     */
    async command error_t off();
--- 36,47 ----
  interface RadioOff
  {
    /** 
     * Disables the transceiver and changes the radio state to RADIO_OFF. This
!    * command will succeed only if the current state of the radio is RECEIVING.
     *
     * @return SUCCESS if the command was accepted and the <tt>offDone()</tt>
!    * event will be signalled; EALREADY if the radio is already switched off,
!    * i.e. in state RADIO_OFF; FAIL if the radio was not switched of because 
!    * the current state is not RECEIVING.
     */
    async command error_t off();
***************
*** 57,60 ****
--- 55,59 ----
    /** 
     * Tells whether the radio is in state RADIO_OFF.
+    *
     * @return TRUE if the radio is in the state RADIO_OFF, FALSE otherwise 
     */

Index: RadioRx.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/RadioRx.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioRx.nc	25 Nov 2008 09:35:09 -0000	1.2
--- RadioRx.nc	4 Mar 2009 18:31:44 -0000	1.3
***************
*** 33,80 ****
   * ========================================================================
   */
  #include "TKN154_platform.h"
  interface RadioRx
  {
    /** 
!    * Prepares the radio for receive mode. This command will fail, if the radio
!    * is not in the state RADIO_OFF. The actual receive operation will be
!    * triggered through a call to <tt>receive()</tt>.  
!    *
!    * @return SUCCESS if the command was accepted and <tt>prepareDone()</tt>
!    * will be signalled; EALREADY if the radio is already in state RX_PREPARED,
!    * FAIL otherwise
!    **/ 
!   async command error_t prepare();
! 
!   /** 
!    * Signalled in response to a successful call to <tt>prepare()</tt>. This  
!    * event is completing the preparation of a receive operation, the radio is
!    * now in the state RX_PREPARED. The actual receive operation will be
!    * triggered through a call to <tt>receive()</tt>.
!    **/    
!   async event void prepareDone(); 
! 
!   /** 
!    * Tells whether the radio is in state RX_PREPARED.
!    * @return TRUE if the radio is in the state RX_PREPARED, FALSE otherwise 
!    */
!   async command bool isPrepared();
! 
!   /** 
!    * Switches the radio to receive mode at time <tt>t0 + dt</tt>.  If
!    * <tt>t0</tt> is NULL, then the callee interprets <tt>t0</tt> as now. 
     *
!    * @param t0 Reference time for receive operation (NULL means now)  
     *
     * @param dt A positive offset relative to <tt>t0</tt>.  
     *
!    * @return SUCCESS if the the command was accepted and the radio will be 
!    * switched to receive mode; FAIL, if the radio is not in the state 
!    * RX_PREPARED
     */
!   async command error_t receive(ieee154_reftime_t *t0, uint32_t dt); 
!   
    /**
!    * Tells whether the radio is in state RECEIVING.
     * @return TRUE if the radio is in the state RECEIVING, FALSE otherwise 
     */
--- 33,72 ----
   * ========================================================================
   */
+ 
  #include "TKN154_platform.h"
  interface RadioRx
  {
    /** 
!    * Switches the radio to receive mode at time <tt>t0 + dt</tt> or immediately
!    * if <tt>t0 + dt</tt> lies in the past. Analogous to the <tt>Timer</tt>
!    * interface <tt>t0</tt> is interpreted as a time in the past. Consequently,
!    * if <tt>dt = 0</tt> then the radio is always switched to receive mode
!    * immediately. This command will fail, if the radio is currently not in
!    * state RADIO_OFF. Once the radio is in receive mode an event
!    * <tt>enableRxDone</tt> will be signalled.
     *
!    * @param t0 Reference time for receive operation  
     *
     * @param dt A positive offset relative to <tt>t0</tt>.  
     *
!    * @return SUCCESS if the command was accepted and only then the
!    * <tt>enableRxDone()</tt> event will be signalled; FAIL, if the command was
!    * not accepted, because the radio is currently not in the state RADIO_OFF.
     */
!   async command error_t enableRx(uint32_t t0, uint32_t dt);
! 
!   /** 
!    * Signalled in response to a successful call to <tt>enableRx()</tt>. This
!    * event is completing the <tt>enableRx()</tt> operation, the radio is now in
!    * the state RECEIVING. It will stay in receive mode until it is switched off
!    * through the <tt>RadioOff</tt> interface. Received frames will be signalled
!    * through the <tt>received()</tt> event.
!    **/    
!   async event void enableRxDone(); 
! 
    /**
!    * Tells whether the radio is in state RECEIVING, i.e. in receive
!    * mode.
!    *
     * @return TRUE if the radio is in the state RECEIVING, FALSE otherwise 
     */
***************
*** 85,90 ****
     * IEEE 802.15.4-2006 Sec. 7.5.6.2 ("Reception and rejection").
     *
!    * @param timestamp The point in time when the first bit of the PPDU
!    * was received or NULL if timestamp is not available.
     *
     * @param frame The received frame  
--- 77,87 ----
     * IEEE 802.15.4-2006 Sec. 7.5.6.2 ("Reception and rejection").
     *
!    * @param timestamp The point in time when the first bit of the PPDU was
!    * received or NULL if a timestamp is not available. The timestamp's data
!    * type is platform-specific, you can use the
!    * <tt>IEEE154Frame.getTimestamp()</tt> command to get a platform-
!    * independent variant (uint32_t) of the timestamp. This pointer is only
!    * valid while the event is signalled and no reference must be kept to it
!    * afterwards.
     *
     * @param frame The received frame  
***************
*** 93,97 ****
     *                    incoming frame 
     */
!   event message_t* received(message_t *frame, ieee154_reftime_t *timestamp); 
  }
  
--- 90,94 ----
     *                    incoming frame 
     */
!   event message_t* received(message_t *frame, const ieee154_timestamp_t *timestamp); 
  }
  

Index: RadioTx.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private/RadioTx.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioTx.nc	25 Nov 2008 09:35:09 -0000	1.2
--- RadioTx.nc	4 Mar 2009 18:31:44 -0000	1.3
***************
*** 34,216 ****
   */
  #include "TKN154_MAC.h"
! #include "TKN154_PHY.h"
  
  interface RadioTx 
  {
- 
-   /** 
-    * Prepares the transmission of a frame. This command will fail, if the
-    * radio is neither in state RADIO_OFF nor in state TX_LOADED. The actual
-    * transmission will be triggered through a call to <tt>transmit()</tt>. Any
-    * frame that was previously prepared for transmission ("loaded") will be
-    * overwritten.  The <tt>loadDone()</tt> event signals the completion of the
-    * <tt>load()</tt> command.  
-    *
-    * The frame will be loaded (and the radio will stay in the state
-    * TX_LOADED) until either the transmission was successful, i.e.
-    * <tt>transmitDone()</tt> was signalled with a status IEEE154_SUCCESS, or
-    * the radio is switched off through the <tt>RadioOff</tt>
-    * interface. Until then the callee might have to reserve certain resources
-    * (e.g. the bus connected to the radio), so the caller should keep the time
-    * while a frame is loaded as short as possible.
-    *
-    * @param frame The frame to transmit.
-    * 
-    * @return SUCCESS if the command was accepted and <tt>loadDone()</tt> will 
-    * be signalled; FAIL otherwise
-    **/ 
-   async command error_t load(ieee154_txframe_t *frame); 
- 
    /** 
!    * Signalled in response to a successful call to <tt>load()</tt>. This  
!    * event is completing the preparation of a transmission, the radio is
!    * now in the state TX_LOADED. The actual transmission is triggered 
!    * through a call to <tt>transmit()</tt>.
!    **/  
!   async event void loadDone(); 
! 
!   /** 
!    * If the radio is in state TX_LOADED then this commands returns the
!    * the frame that was loaded last; it returns NULL otherwise.
     *
!    * @return last frame loaded if radio is in the state TX_LOADED, 
!    * NULL otherwise
!    **/  
!   async command ieee154_txframe_t* getLoadedFrame();
! 
!   /** 
!    * Transmits the frame whose transmission has previously been prepared
!    * through a call to <tt>load()</tt> at time <tt>t0+dt</tt> or immediately if
!    * <tt>t0</tt> is NULL. In the first case the caller has to guarantee (through
!    * platform-specific guard times and by calling <tt>transmit</tt> in an
!    * atomic block) that the callee can start the transmission on time.
!    * The frame is transmitted without carrier sense (without CCA).  
!    * The <tt>transmitDone()</tt> event will signal the result
!    * of the transmission.
     *
!    * @param t0 Reference time for transmission (NULL means now)  
!    * @param dt A positive offset relative to <tt>t0</tt>.  
     *
!    * @return SUCCESS if the transmission was triggered successfully and only
!    * then <tt>transmitDone()</tt> will be signalled; FAIL, if the transmission
!    * was not triggered because no frame was loaded.
!    */
!   async command error_t transmit(ieee154_reftime_t *t0, uint32_t dt);
! 
!   /**
!    * Signalled in response to a call to <tt>transmit()</tt> and completing the transmission. Depending on the
!    * <tt>error</tt> parameter the radio is now in the state RADIO_OFF
!    * (<tt>error == IEEE154_SUCCESS</tt>) or back in state TX_LOADED
!    * (<tt>error != IEEE154_SUCCESS</tt>). 
     *
!    * @param frame The frame that was transmitted.  
!    * @param txTime The time of transmission of the first symbol of the PPDU or NULL if the transmission failed.  
!    */
!   async event void transmitDone(ieee154_txframe_t *frame, ieee154_reftime_t *txTime);
! 
! 
!  /** 
!    * Transmits the frame whose transmission has previously been prepared
!    * through a call to <tt>load()</tt> using the unslotted CSMA-CA 
!    * algorithm as specified in the IEEE 802.15.4-2006 standard Sect. 7.5.1.4. The initial 
!    * CSMA-CA parameters are passed as a parameter, the algorithm should start immediately.
!    * The <tt>transmitUnslottedCsmaCaDone()</tt> event will signal the result
!    * of the transmission.
!    * A successful transmission may include an acknowledgement from the
!    * destination if the ACK_REQUESTED flag is set in the loaded frame's header; then,
!    * the callee also has to perform the necessary steps for receiving the
!    * acknowledgement (switching the radio to Rx mode immediately after
!    * transmission, etc., as specified in IEEE 802.15.4-2006 Sect. 7.5.6.4). 
     * 
!    * @param csmaParameters parameters for the unslotted CSMA-CA algorithm. 
!    *
!    * @return SUCCESS if the unslotted CSMA-CA was triggered successfully,
!    * FAIL otherwise.
     */
!   async command error_t transmitUnslottedCsmaCa(ieee154_csma_t *csmaParameters);
  
    /**
!    * Signalled in response to a call to <tt>transmitUnslottedCsmaCa()</tt>. 
!    * Depending on the
!    * <tt>error</tt> parameter the radio is now in the state RADIO_OFF
!    * (<tt>error == IEEE154_SUCCESS</tt>) or still in state TX_LOADED
!    * (<tt>error != IEEE154_SUCCESS</tt>). If the transmission succeeded then
!    * the time of the transmission -- the point in time when the first symbol of the
!    * PPDU was transmitted -- will be stored in the metadata field of the frame. 
     *
     * @param frame The frame that was transmitted.  
-    * @param csmaParameters csmaParameters parameters for the unslotted CSMA-CA algorithm
-    * @param ackPendingFlag TRUE if an acknowledgement was received and the
-    * "pending" flag is set in the header of the ACK frame, FALSE otherwise
-    * @param result SUCCESS if the the frame was transmitted (and a matching
-    * acknowledgement was received, if requested); FAIL if the CSMA-CA algorithm failed
-    * because NB > macMaxCsmaBackoffs.  
-    *
-    * unslotted CSMA-CA was triggered successfully,
-    * FAIL otherwiseThe time of transmission or NULL if the transmission failed.  
-    */
-   async event void transmitUnslottedCsmaCaDone(ieee154_txframe_t *frame,
-       bool ackPendingFlag, ieee154_csma_t *csmaParameters, error_t result);
- 
- 
-  /** 
-    * Transmits the frame whose transmission has previously been prepared
-    * through a call to <tt>load()</tt> using the slotted CSMA-CA 
-    * algorithm as specified in the IEEE 802.15.4-2006 standard Sect. 7.5.1.4. The initial 
-    * CSMA-CA parameters are passed as a parameter, the algorithm should start immediately,
-    * but the frame transmission should start no later than <tt>slot0Time+dtMax</tt>. The backoff slot boundaries
-    * are defined relative to <tt>slot0Time</tt>, if the <tt>resume</tt>
-    * then the initial backoff (in symbols) is passed as the <tt>initialBackoff</tt> parameter.
     *
!    * The <tt>transmitSlottedCsmaCaDone()</tt> event will signal the result
!    * of the transmission.
!    * A successful transmission may include an acknowledgement from the
!    * destination if the ACK_REQUESTED flag is set in the loaded frame's header; then,
!    * the callee also has to perform the necessary steps for receiving the
!    * acknowledgement (switching the radio to Rx mode immediately after
!    * transmission, etc., as specified in IEEE 802.15.4-2006 Sect. 7.5.6.4). 
!    * 
!    * @param slot0Time Reference time (last beacon)  
!    * @param dtMax <tt>slot0Time+dtMax</tt> is the last time the frame may be transmitted.
!    * @param resume TRUE means that the initial backoff is defined by the
!    * <tt>initialBackoff</tt> parameter, FALSE means the <tt>initialBackoff</tt>
!    * should be ignored.
!    * @param initialBackoff initial backoff.
!    * @param csmaParameters parameters for the slotted CSMA-CA algorithm. 
!    *
!    * @return SUCCESS if the slotted CSMA-CA was triggered successfully,
!    * FAIL otherwise.
!    */
!   async command error_t transmitSlottedCsmaCa(ieee154_reftime_t *slot0Time, uint32_t dtMax, 
!       bool resume, uint16_t initialBackoff, ieee154_csma_t *csmaParameters);
! 
!   /**
!    * Signalled in response to a call to <tt>transmitSlottedCsmaCa()</tt>. 
!    * Depending on the
!    * <tt>error</tt> parameter the radio is now in the state RADIO_OFF
!    * (<tt>error == IEEE154_SUCCESS</tt>) or still in state TX_LOADED
!    * (<tt>error != IEEE154_SUCCESS</tt>). If the transmission succeeded then
!    * the time of the transmission -- the point in time when the first symbol of the
!    * PPDU was transmitted -- will be stored in the metadata field of the frame.
!    * It will also passed (possibly with higher precision) through the
!    * <tt>txTime</tt> parameter.
!    *
!    * @param frame The frame that was transmitted.  
!    * @param txTime The time of transmission of the first symbol of the PPDU or NULL if the transmission failed.  
!    * @param ackPendingFlag TRUE if an acknowledgement was received and the
!    * "pending" flag is set in the header of the ACK frame, FALSE otherwise
!    * @param remainingBackoff only valid if <tt>error == ERETRY</tt>, i.e.
!    * when the frame could not be transmitted because transmission would have
!    * started later than <tt>slot0Time+dtMax</tt>; then it 
!    * specifies the remaining offset (in symbols) relative to <tt>slot0Time+dtMax</tt>,
!    * when the frame would have been transmitted
!    * @param csmaParameters csmaParameters parameters for the unslotted CSMA-CA algorithm
     *
!    * @result result SUCCESS if the the frame was transmitted (and a matching
!    * acknowledgement was received, if requested); FAIL if the CSMA-CA algorithm failed
!    * because NB > macMaxCsmaBackoffs; ERETRY if the frame could not be transmitted because transmission would have
!    * started later than <tt>slot0Time+dtMax</tt>
!    */
!   async event void transmitSlottedCsmaCaDone(ieee154_txframe_t *frame, ieee154_reftime_t *txTime, 
!       bool ackPendingFlag, uint16_t remainingBackoff, ieee154_csma_t *csmaParameters, error_t result);
  }
--- 34,94 ----
   */
  #include "TKN154_MAC.h"
! #include "TKN154_platform.h"
  
  interface RadioTx 
  {
    /** 
!    * Transmits a frame at time <tt>t0 + dt</tt> or immediately if <tt>t0 +
!    * dt</tt> lies in the past. The frame is transmitted in any case (without
!    * prior CCA). Analogous to the <tt>Timer</tt> interface <tt>t0</tt> is
!    * interpreted as a time in the past. If <tt>t0</tt> is NULL or if
!    * <tt>dt</tt> is zero then the frame is transmitted immediately. This
!    * command will fail, if the radio is currently not in state RADIO_OFF.
     *
!    * Iff the ACK_REQUESTED flag is set in the frame's header a successful
!    * transmission will include an acknowledgement from the destination; then,
!    * the callee will perform the necessary steps for receiving this
!    * acknowledgement following the specification in IEEE 802.15.4-2006 Sect.
!    * 7.5.6.4. 
     *
!    * @param frame The frame to transmit
     *
!    * @param t0 Reference time for transmission, NULL means frame will be 
!    * transmitted immediately
     *
!    * @param dt A positive offset relative to <tt>t0</tt>, ignored
!    * if <tt>t0</tt> is NULL
     * 
!    * @return SUCCESS if the transmission was triggered successfully and only
!    * then <tt>transmitDone()</tt> will be signalled; FAIL, if the command was
!    * not accepted, because the radio is currently not in the state RADIO_OFF;
!    * EINVAL if <tt>frame</tt> or a pointer therein is invalid, or the length
!    * of the frame is invalid
     */
!   async command error_t transmit(ieee154_txframe_t *frame, const ieee154_timestamp_t *t0, uint32_t dt);
  
    /**
!    * Signalled in response to a call to <tt>transmit()</tt> and completing 
!    * the transmission of a frame. The radio is now back in state RADIO_OFF. 
!    * The time of the transmission -- the point in time when the first bit of the
!    * PPDU was transmitted -- is given by <tt>timestamp</tt>. Since the
!    * frame was transmitted without CCA the transmission can only have
!    * failed if no acknowledgement was received although one was requested.
     *
     * @param frame The frame that was transmitted.  
     *
!    * @param timestamp The point in time when the first bit of the PPDU
!    * was received or NULL if a timestamp is not available. The 
!    * timestamp's data type is platform-specific, you can use the 
!    * <tt>IEEE154Frame.getTimestamp()</tt> command to get a platform-
!    * independent variant (uint32_t) of the timestamp. This pointer
!    * is only valid while the event is signalled and no reference must
!    * be kept to it afterwards.
     *
!    * @param result SUCCESS if the frame was transmitted (and a matching
!    * acknowledgement was received, if requested); ENOACK if the frame was 
!    * transmitted, but no matching acknowledgement was received although one
!    * was requested     
!    **/
!   async event void transmitDone(ieee154_txframe_t *frame, const ieee154_timestamp_t *timestamp, error_t result);
  }

--- Ieee802154Debug.nc DELETED ---



More information about the Tinyos-2-commits mailing list