[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250 HplTda5250DataC.nc, NONE, 1.1.4.2 HplTda5250DataControl.nc, NONE, 1.1.4.2 HplTda5250ConfigC.nc, 1.1.2.4, 1.1.2.4.4.1 HplTda5250Config.nc, 1.1.2.5, 1.1.2.5.4.1 HplTda5250ConfigP.nc, 1.1.2.4, 1.1.2.4.4.1 HplTda5250Data.nc, 1.1.2.3.10.1, 1.1.2.3.10.2 HplTda5250DataP.nc, 1.1.2.6.4.1, 1.1.2.6.4.2 Tda5250ActiveMessageP.nc, 1.1.2.3, 1.1.2.3.4.1 tda5250_message.h, 1.1.2.2, 1.1.2.2.10.1 Tda5250RadioC.nc, 1.1.2.5, 1.1.2.5.4.1 Tda5250RegCommP.nc, 1.1.2.6, 1.1.2.6.4.1

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


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

Modified Files:
      Tag: tos-2-msp430-usart-configure-candidate
	HplTda5250ConfigC.nc HplTda5250Config.nc HplTda5250ConfigP.nc 
	HplTda5250Data.nc HplTda5250DataP.nc Tda5250ActiveMessageP.nc 
	tda5250_message.h Tda5250RadioC.nc Tda5250RegCommP.nc 
Added Files:
      Tag: tos-2-msp430-usart-configure-candidate
	HplTda5250DataC.nc HplTda5250DataControl.nc 
Log Message:
- optimized usart configure using unions

--- NEW FILE: HplTda5250DataC.nc ---
/*
* Copyright (c) 2004, Technische Universitat 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 Universitat 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.4.2 $
* $Date: 2006/10/05 08:37:46 $
* ========================================================================
*/


/**
 * Controlling the TDA5250 at the HPL layer.
 * 
 * @author Kevin Klues (klues at tkn.tu-berlin.de)
 */
configuration HplTda5250DataC {
  provides {
    interface Init;
    interface HplTda5250Data;
		interface HplTda5250DataControl;
    interface ResourceRequested;
    interface Resource as Resource;
  }
}
implementation {

  components HplTda5250DataP,
      Tda5250RadioIOC,
			HplTda5250DataIOC;

  Init = HplTda5250DataP;
  Resource = HplTda5250DataP.Resource;
  ResourceRequested = HplTda5250DataP.ResourceRequested;
  HplTda5250Data = HplTda5250DataP;
	HplTda5250DataControl = HplTda5250DataIOC;

  HplTda5250DataP.DATA -> Tda5250RadioIOC.Tda5250RadioDATA;
	HplTda5250DataP.Uart -> HplTda5250DataIOC.SerialByteComm;
	HplTda5250DataP.UartResource -> HplTda5250DataIOC.Resource;
	HplTda5250DataP.UartResourceRequested -> HplTda5250DataIOC.ResourceRequested;

}

--- NEW FILE: HplTda5250DataControl.nc ---
 /**
 * Interface for controlling the data interface of the TDA5250 Radio.
 * This interface lets you switch between Tx and Rx.
 * In conjunction to this the HplTda5250Data interface 
 * is used for the actual receiving and sending of data.
 *
 * @see HplTda5250Data
 * @author Philipp Huppertz (huppertz at tkn.tu-berlin.de)
 */
interface HplTda5250DataControl {  

/**
   * Sets the radio to transmit. 
   * 
   * @return SUCCESS on success
   *         FAIL otherwise.
	*/
  async command error_t setToTx();


  /**
   * Sets the radio to receive.
   *
   * @return SUCCESS on success
   *         FAIL otherwise.
	*/
  async command error_t setToRx();
  
}

Index: HplTda5250ConfigC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/HplTda5250ConfigC.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.4.4.1
diff -C2 -d -r1.1.2.4 -r1.1.2.4.4.1
*** HplTda5250ConfigC.nc	31 May 2006 13:53:02 -0000	1.1.2.4
--- HplTda5250ConfigC.nc	5 Oct 2006 08:37:45 -0000	1.1.2.4.4.1
***************
*** 77,80 ****
--- 77,81 ----
    HplTda5250ConfigP.ADC -> Tda5250RegistersC.ADC;
  
+   HplTda5250ConfigP.ASKNFSK -> Tda5250RadioIOC.Tda5250RadioPASKNFSK;
    HplTda5250ConfigP.PWDDD -> Tda5250RadioIOC.Tda5250RadioPWDDD;
    HplTda5250ConfigP.TXRX -> Tda5250RadioIOC.Tda5250RadioTXRX;

Index: HplTda5250Config.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/HplTda5250Config.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.5.4.1
diff -C2 -d -r1.1.2.5 -r1.1.2.5.4.1
*** HplTda5250Config.nc	31 May 2006 13:53:02 -0000	1.1.2.5
--- HplTda5250Config.nc	5 Oct 2006 08:37:45 -0000	1.1.2.5.4.1
***************
*** 469,473 ****
     async command bool IsRSSIGreaterThanThreshold();
  
!   
     /**
     * Switches the radio to TxMode when in SLAVE_MODE
--- 469,481 ----
     async command bool IsRSSIGreaterThanThreshold();
  
!    /**
!    * Checks if the Tx Rx and Sleep radiomodes can be set via pin.
!    * This only concerns SetTxMode(), SetRxMode() and SetSleepMode().
!    *
!    * @return TRUE if radiomodes can be set via pin
!    *         FALSE otherwise.
!    */
!    async command bool IsTxRxPinControlled();
!    
     /**
     * Switches the radio to TxMode when in SLAVE_MODE

Index: HplTda5250ConfigP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/HplTda5250ConfigP.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.4.4.1
diff -C2 -d -r1.1.2.4 -r1.1.2.4.4.1
*** HplTda5250ConfigP.nc	31 May 2006 13:53:02 -0000	1.1.2.4
--- HplTda5250ConfigP.nc	5 Oct 2006 08:37:45 -0000	1.1.2.4.4.1
***************
*** 61,64 ****
--- 61,65 ----
      interface Tda5250ReadReg<TDA5250_REG_TYPE_ADC>          as ADC;
  
+     interface GeneralIO as ASKNFSK;
      interface GeneralIO as TXRX;
      interface GeneralIO as PWDDD;
***************
*** 177,186 ****
    async command void HplTda5250Config.UseFSK(tda5250_cap_vals_t pos_shift, tda5250_cap_vals_t neg_shift) {
      currentConfig = CONFIG_ASK_NFSK_FSK(currentConfig);
!     if(currentConfig | MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
      else {
!       // ***** For Platforms that have a connection to the FSK pin *******
!       //call FSK.set(); 
      }
      call FSK.set(((uint16_t)((((uint16_t)pos_shift) << 8) + neg_shift)));
--- 178,186 ----
    async command void HplTda5250Config.UseFSK(tda5250_cap_vals_t pos_shift, tda5250_cap_vals_t neg_shift) {
      currentConfig = CONFIG_ASK_NFSK_FSK(currentConfig);
!     if(currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
      else {
!       call ASKNFSK.clr(); 
      }
      call FSK.set(((uint16_t)((((uint16_t)pos_shift) << 8) + neg_shift)));
***************
*** 189,198 ****
    async command void HplTda5250Config.UseASK(tda5250_cap_vals_t value) {
      currentConfig = CONFIG_ASK_NFSK_ASK(currentConfig);
!     if((currentConfig | MASK_CONFIG_CONTROL_TXRX_REGISTER)) {
        call CONFIG.set(currentConfig);
      } 
      else {
!       // ***** For Platforms that have a connection to the FSK pin *******
!       //call FSK.set(); 
      }
      call FSK.set((((uint16_t)value) << 8));
--- 189,197 ----
    async command void HplTda5250Config.UseASK(tda5250_cap_vals_t value) {
      currentConfig = CONFIG_ASK_NFSK_ASK(currentConfig);
!     if(currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      } 
      else {
!       call ASKNFSK.set(); 
      }
      call FSK.set((((uint16_t)value) << 8));
***************
*** 466,470 ****
      currentConfig = CONFIG_RX_NTX_TX(currentConfig);
      currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig);
!     if (currentConfig | MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
--- 465,469 ----
      currentConfig = CONFIG_RX_NTX_TX(currentConfig);
      currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig);
!     if (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
***************
*** 474,483 ****
      }
    }
! 
    /* << tested >> */
    async command void HplTda5250Config.SetRxMode() {
      currentConfig = CONFIG_RX_NTX_RX(currentConfig);
      currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig);
!     if (currentConfig | MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
--- 473,482 ----
      }
    }
!  
    /* << tested >> */
    async command void HplTda5250Config.SetRxMode() {
      currentConfig = CONFIG_RX_NTX_RX(currentConfig);
      currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig);
!     if (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
***************
*** 491,495 ****
    async command void HplTda5250Config.SetSleepMode() {
      currentConfig = CONFIG_ALL_PD_POWER_DOWN(currentConfig);
!     if (currentConfig | MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
--- 490,494 ----
    async command void HplTda5250Config.SetSleepMode() {
      currentConfig = CONFIG_ALL_PD_POWER_DOWN(currentConfig);
!     if (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) {
        call CONFIG.set(currentConfig);
      }
***************
*** 499,502 ****
--- 498,505 ----
      }
    }
+   
+   async command bool HplTda5250Config.IsTxRxPinControlled() {
+     return (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER);
+   }
  
    /****************************************************************

Index: HplTda5250Data.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/HplTda5250Data.nc,v
retrieving revision 1.1.2.3.10.1
retrieving revision 1.1.2.3.10.2
diff -C2 -d -r1.1.2.3.10.1 -r1.1.2.3.10.2
*** HplTda5250Data.nc	14 Jul 2006 21:38:51 -0000	1.1.2.3.10.1
--- HplTda5250Data.nc	5 Oct 2006 08:37:46 -0000	1.1.2.3.10.2
***************
*** 34,38 ****
--- 34,42 ----
   /**
   * Interface for sending and receiving bytes of data over the TDA5250 Radio.
+  * This interface lets you receive and send bytes of data.
+  * In conjunction to this the HplTda5250DataControl interface is used to 
+  * switch between receiving and sending.
   *
+  * @see HplTda5250DataControl
   * @author Kevin Klues (klues at tkn.tu-berlin.de)
   */
***************
*** 41,44 ****
--- 45,51 ----
   /**
     * Transmit a byte of data over the radio.
+    * Before you call this command you must switch 
+    * the radio to Tx mode via the HplTda5250DataControl
+    * interface.
     * @param data The data byte to be transmitted.
     * @return SUCCESS Byte successfully transmitted.
***************
*** 65,88 ****
    /**
     * Signaled when a byte of data has been received from the radio.
     * @param data The data byte received.
     */
    async event void rxDone(uint8_t data);
- 
-   /**
-    * Sets the radio to transmit. 
-    * 
-    * @return SUCCESS on success
-    *         FAIL otherwise.
-    */
-   async command error_t setToTx();
- 
- 
-   /**
-    * Sets the radio to receive.
-    *
-    * @return SUCCESS on success
-    *         FAIL otherwise.
-   */
-   async command error_t setToRx();
  }
  
--- 72,81 ----
    /**
     * Signaled when a byte of data has been received from the radio.
+ 	 * Before you call this command you must switch 
+ 	 * the radio to Rx mode via the HplTda5250DataControl
+    * interface.
     * @param data The data byte received.
     */
    async event void rxDone(uint8_t data);
  }
  

Index: HplTda5250DataP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/HplTda5250DataP.nc,v
retrieving revision 1.1.2.6.4.1
retrieving revision 1.1.2.6.4.2
diff -C2 -d -r1.1.2.6.4.1 -r1.1.2.6.4.2
*** HplTda5250DataP.nc	13 Jul 2006 20:38:21 -0000	1.1.2.6.4.1
--- HplTda5250DataP.nc	5 Oct 2006 08:37:46 -0000	1.1.2.6.4.2
***************
*** 32,38 ****
   */
  
- #include <msp430usart.h>
- #include <tda5250BusResourceSettings.h>
- 
   /**
   * HplTda5250DataP module
--- 32,35 ----
***************
*** 46,60 ****
      interface Init;
      interface HplTda5250Data;
!     interface Msp430UartConfigure as UartResourceConfigure;
!     //interface ResourceRequested;
      interface Resource;
! 
    }
    uses {
      interface GeneralIO as DATA;
      interface SerialByteComm as Uart;
!     interface Msp430UartControl as UartControl;
!     //interface ResourceRequested;
      interface Resource as UartResource;
    }
  }
--- 43,56 ----
      interface Init;
      interface HplTda5250Data;
!     interface HplTda5250DataControl;
      interface Resource;
! 		interface ResourceRequested;
    }
    uses {
      interface GeneralIO as DATA;
      interface SerialByteComm as Uart;
!     interface HplTda5250DataControl as UartControl;
      interface Resource as UartResource;
+     interface ResourceRequested as UartResourceRequested;
    }
  }
***************
*** 88,93 ****
    }
  
!   async command void Resource.release() {
!     call UartResource.release();
    }
  
--- 84,89 ----
    }
  
!   async command error_t Resource.release() {
!     return call UartResource.release();
    }
  
***************
*** 100,124 ****
    }
    
! //   async event void ResourceRequested.requested() {
! //     signal Resource.requested(); 
! //   }
!   
!   
!   async command msp430_uart_config_t UartResourceConfigure.getConfig() {
!     return tda5250_uart_config;
    }
    
!   async command error_t HplTda5250Data.setToTx() {
!     if(call UartResource.isOwner() == FALSE)
!       return FAIL;
!     call UartControl.setModeTx();
!     return SUCCESS;
!   }
! 
!   async command error_t HplTda5250Data.setToRx() {
!    if(call UartResource.isOwner() == FALSE)
!      return FAIL;
!    call UartControl.setModeRx();
!    return SUCCESS;
    }
  
--- 96,105 ----
    }
    
!   async event void UartResourceRequested.requested() {
!     signal ResourceRequested.requested(); 
    }
    
!   async event void UartResourceRequested.immediateRequested() {
!     signal ResourceRequested.immediateRequested(); 
    }
  
***************
*** 140,143 ****
--- 121,137 ----
      signal HplTda5250Data.rxDone(data);
    }
+   
+   async command error_t HplTda5250DataControl.setToTx() {
+     if(call UartResource.isOwner() == FALSE)
+       return FAIL;
+     return call UartControl.setToTx();
+   }
+ 
+   async command error_t HplTda5250DataControl.setToRx() {
+     if(call UartResource.isOwner() == FALSE)
+       return FAIL;
+     return call UartControl.setToRx();
+   }
+ 	
  
    default event void Resource.granted() {}

Index: Tda5250ActiveMessageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/Tda5250ActiveMessageP.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.3.4.1
diff -C2 -d -r1.1.2.3 -r1.1.2.3.4.1
*** Tda5250ActiveMessageP.nc	31 May 2006 13:53:02 -0000	1.1.2.3
--- Tda5250ActiveMessageP.nc	5 Oct 2006 08:37:46 -0000	1.1.2.3.4.1
***************
*** 67,72 ****
      tda5250_header_t* header = getHeader(msg);
      header->type = id;
!     header->addr = addr;
!     header->group = TOS_AM_GROUP;
      return call SubSend.send(msg, len);
    }
--- 67,72 ----
      tda5250_header_t* header = getHeader(msg);
      header->type = id;
!     header->dest = addr;
!     header->src = call amAddress();
      return call SubSend.send(msg, len);
    }
***************
*** 121,132 ****
    command am_addr_t AMPacket.destination(message_t* amsg) {
      tda5250_header_t* header = getHeader(amsg);
!     return header->addr;
    }
  
    command void AMPacket.setDestination(message_t* amsg, am_addr_t addr) {
      tda5250_header_t* header = getHeader(amsg);
!     header->addr = addr;
    }
  
    command bool AMPacket.isForMe(message_t* amsg) {
      return (call AMPacket.destination(amsg) == call AMPacket.address() ||
--- 121,142 ----
    command am_addr_t AMPacket.destination(message_t* amsg) {
      tda5250_header_t* header = getHeader(amsg);
!     return header->dest;
    }
  
    command void AMPacket.setDestination(message_t* amsg, am_addr_t addr) {
      tda5250_header_t* header = getHeader(amsg);
!     header->dest = addr;
    }
  
+   command am_addr_t AMPacket.source(message_t* amsg) {
+     tda5250_header_t* header = getHeader(amsg);
+     return header->src;
+   }
+   
+   command void AMPacket.setSource(message_t* amsg, am_addr_t addr) {
+     tda5250_header_t* header = getHeader(amsg);
+     header->src = addr;
+   }
+   
    command bool AMPacket.isForMe(message_t* amsg) {
      return (call AMPacket.destination(amsg) == call AMPacket.address() ||

Index: tda5250_message.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/tda5250_message.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.2.10.1
diff -C2 -d -r1.1.2.2 -r1.1.2.2.10.1
*** tda5250_message.h	29 Jan 2006 02:34:56 -0000	1.1.2.2
--- tda5250_message.h	5 Oct 2006 08:37:46 -0000	1.1.2.2.10.1
***************
*** 3,12 ****
  
  #include "AM.h"
  
  typedef nx_struct tda5250_header_t {
!   nx_am_addr_t addr;
!   nx_uint8_t length;
!   nx_am_group_t group;
!   nx_am_id_t type;
  } tda5250_header_t;
  
--- 3,14 ----
  
  #include "AM.h"
+ #include "PacketAck.h"
  
  typedef nx_struct tda5250_header_t {
!   nx_uint8_t   length;
!   nx_am_addr_t src;
!   nx_am_addr_t dest;
!   nx_am_id_t   type;
!   nx_uint8_t   token;
  } tda5250_header_t;
  
***************
*** 18,22 ****
    nx_uint16_t strength;
    nx_uint8_t ack;
!   nx_uint16_t time;
    nx_uint8_t sendSecurityMode;
    nx_uint8_t receiveSecurityMode;
--- 20,25 ----
    nx_uint16_t strength;
    nx_uint8_t ack;
!   /* local time when message was generated */
!   nx_uint32_t time;
    nx_uint8_t sendSecurityMode;
    nx_uint8_t receiveSecurityMode;

Index: Tda5250RadioC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/Tda5250RadioC.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.5.4.1
diff -C2 -d -r1.1.2.5 -r1.1.2.5.4.1
*** Tda5250RadioC.nc	31 May 2006 16:32:43 -0000	1.1.2.5
--- Tda5250RadioC.nc	5 Oct 2006 08:37:46 -0000	1.1.2.5.4.1
***************
*** 45,48 ****
--- 45,49 ----
      interface SplitControl;
      interface Tda5250Control;
+     interface ResourceRequested;
      interface RadioByteComm;
    }
***************
*** 60,63 ****
--- 61,65 ----
             
    Tda5250Control = Tda5250RadioP;
+   ResourceRequested = Tda5250RadioP;
    RadioByteComm = Tda5250RadioP;
    SplitControl = Tda5250RadioP;
***************
*** 67,72 ****
    Tda5250RadioP.ConfigResource -> HplTda5250ConfigC;
    Tda5250RadioP.DataResource -> HplTda5250DataC;
! 
    Tda5250RadioP.HplTda5250Config -> HplTda5250ConfigC;
    Tda5250RadioP.HplTda5250Data -> HplTda5250DataC;
  }
--- 69,77 ----
    Tda5250RadioP.ConfigResource -> HplTda5250ConfigC;
    Tda5250RadioP.DataResource -> HplTda5250DataC;
!   Tda5250RadioP.DataResourceRequested -> HplTda5250DataC;
!   
    Tda5250RadioP.HplTda5250Config -> HplTda5250ConfigC;
    Tda5250RadioP.HplTda5250Data -> HplTda5250DataC;
+ 	Tda5250RadioP.HplTda5250DataControl -> HplTda5250DataC;
+ 
  }

Index: Tda5250RegCommP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/Tda5250RegCommP.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.6.4.1
diff -C2 -d -r1.1.2.6 -r1.1.2.6.4.1
*** Tda5250RegCommP.nc	31 May 2006 13:53:02 -0000	1.1.2.6
--- Tda5250RegCommP.nc	5 Oct 2006 08:37:46 -0000	1.1.2.6.4.1
***************
*** 74,79 ****
     }
  
!    async command void Resource.release() {
!      call SpiResource.release();
     }
  
--- 74,79 ----
     }
  
!    async command error_t Resource.release() {
!      return call SpiResource.release();
     }
  
***************
*** 83,115 ****
  
     async command error_t Tda5250RegComm.writeByte(uint8_t address, uint8_t data) {
!      uint8_t rxbyte;
!      // FIXME: nobody seems to care in HplTda5250Config if call is not successfull, so why should we care here....
! //     if(call SpiResource.isOwner() == FALSE) {
! //       return FAIL;
! //     }
!      call SpiByte.write(address,&rxbyte);
!      call SpiByte.write(data,&rxbyte);
       return SUCCESS;
     }
     async command error_t Tda5250RegComm.writeWord(uint8_t address, uint16_t data) {
!       uint8_t rxbyte;
!       // FIXME: nobody seems to care in HplTda5250Config if call is not successfull, so why should we care here....
!       // if(call SpiResource.isOwner() == FALSE)
!       //   return FAIL;
!       call SpiByte.write(address, &rxbyte);
!       call SpiByte.write(((uint8_t) (data >> 8)),&rxbyte);
!       call SpiByte.write(((uint8_t) data),&rxbyte);
        return SUCCESS;
     }
  
     async command uint8_t Tda5250RegComm.readByte(uint8_t address){
-       uint8_t rxbyte;
        if(call SpiResource.isOwner() == FALSE)
          return 0x00;
!       call SpiByte.write(address, &rxbyte);
  
        // FIXME: Put SIMO/SOMI in input
!       call SpiByte.write(0x00, &rxbyte);
!       return rxbyte;
     }
  
--- 83,110 ----
  
     async command error_t Tda5250RegComm.writeByte(uint8_t address, uint8_t data) {
!      if(call SpiResource.isOwner() == FALSE) {
!        return FAIL;
!      }
!      call SpiByte.write(address);
!      call SpiByte.write(data);
       return SUCCESS;
     }
+    
     async command error_t Tda5250RegComm.writeWord(uint8_t address, uint16_t data) {
!       if(call SpiResource.isOwner() == FALSE)
!         return FAIL;
!       call SpiByte.write(address);
!       call SpiByte.write(((uint8_t) (data >> 8)));
!       call SpiByte.write(((uint8_t) data));
        return SUCCESS;
     }
  
     async command uint8_t Tda5250RegComm.readByte(uint8_t address){
        if(call SpiResource.isOwner() == FALSE)
          return 0x00;
!       call SpiByte.write(address);
  
        // FIXME: Put SIMO/SOMI in input
!       return call SpiByte.write(0x00);
     }
  



More information about the Tinyos-2-commits mailing list