]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Working hardware acks
authorrincon <rincon>
Mon, 16 Jun 2008 15:33:32 +0000 (15:33 +0000)
committerrincon <rincon>
Mon, 16 Jun 2008 15:33:32 +0000 (15:33 +0000)
tos/chips/cc2420/control/CC2420ControlP.nc
tos/chips/cc2420/interfaces/CC2420Config.nc

index 7d44f731d551661581dc0f344e54f346185cecd6..760eafa8d2ecd3ae8f39ac68264b52c833be0eb1 100644 (file)
@@ -94,12 +94,18 @@ implementation {
   
   bool m_sync_busy;
   
+  /** TRUE if acknowledgments are enabled */
   bool autoAckEnabled;
   
+  /** TRUE if acknowledgments are generated in hardware only */
   bool hwAutoAckDefault;
   
+  /** TRUE if software or hardware address recognition is enabled */
   bool addressRecognition;
   
+  /** TRUE if address recognition should also be performed in hardware */
+  bool hwAddressRecognition;
+  
   norace cc2420_control_state_t m_state = S_VREG_STOPPED;
   
   /***************** Prototypes ****************/
@@ -122,24 +128,34 @@ implementation {
     m_tx_power = CC2420_DEF_RFPOWER;
     m_channel = CC2420_DEF_CHANNEL;
     
+    
+#if defined(CC2420_NO_ADDRESS_RECOGNITION)
+    addressRecognition = FALSE;
+#else
+    addressRecognition = TRUE;
+#endif
+    
+#if defined(CC2420_HW_ADDRESS_RECOGNITION)
+    hwAddressRecognition = TRUE;
+#else
+    hwAddressRecognition = FALSE;
+#endif
+    
+    
 #if defined(CC2420_NO_ACKNOWLEDGEMENTS)
     autoAckEnabled = FALSE;
 #else
     autoAckEnabled = TRUE;
 #endif
-
+    
 #if defined(CC2420_HW_ACKNOWLEDGEMENTS)
     hwAutoAckDefault = TRUE;
+    hwAddressRecognition = TRUE;
 #else
     hwAutoAckDefault = FALSE;
 #endif
-
-#if defined(CC2420_NO_ADDRESS_RECOGNITION)
-    addressRecognition = FALSE;
-#else
-    addressRecognition = TRUE;
-#endif
-
+    
+    
     return SUCCESS;
   }
 
@@ -298,10 +314,16 @@ implementation {
   }
 
   /**
-   * @param on TRUE to turn address recognition on, FALSE to turn it off
+   * @param enableAddressRecognition TRUE to turn address recognition on
+   * @param useHwAddressRecognition TRUE to perform address recognition first
+   *     in hardware. This doesn't affect software address recognition. The
+   *     driver must sync with the chip after changing this value.
    */
-  command void CC2420Config.setAddressRecognition(bool on) {
-    atomic addressRecognition = on;
+  command void CC2420Config.setAddressRecognition(bool enableAddressRecognition, bool useHwAddressRecognition) {
+    atomic {
+      addressRecognition = enableAddressRecognition;
+      hwAddressRecognition = useHwAddressRecognition;
+    }
   }
   
   /**
@@ -311,6 +333,13 @@ implementation {
     atomic return addressRecognition;
   }
   
+  /**
+   * @return TRUE if address recognition is performed first in hardware.
+   */
+  async command bool CC2420Config.isHwAddressRecognitionDefault() {
+    atomic return hwAddressRecognition;
+  }
+  
   
   /**
    * Sync must be called for acknowledgement changes to take effect
@@ -444,7 +473,7 @@ implementation {
   void writeMdmctrl0() {
     atomic {
       call MDMCTRL0.write( ( 1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE ) |
-          ( 0 << CC2420_MDMCTRL0_ADR_DECODE ) |
+          ( (addressRecognition && hwAddressRecognition) << CC2420_MDMCTRL0_ADR_DECODE ) |
           ( 2 << CC2420_MDMCTRL0_CCA_HYST ) |
           ( 3 << CC2420_MDMCTRL0_CCA_MOD ) |
           ( 1 << CC2420_MDMCTRL0_AUTOCRC ) |
index 972f37a09fc55243e7af285295ea04720e1dd549..14b12d2d1b475e1da44c1e5b44e323c75b7068aa 100644 (file)
@@ -72,15 +72,24 @@ interface CC2420Config {
 
   
   /**
-   * @param on TRUE to turn address recognition on, FALSE to turn it off
+   * @param enableAddressRecognition TRUE to turn address recognition on
+   * @param useHwAddressRecognition TRUE to perform address recognition first
+   *     in hardware. This doesn't affect software address recognition. The
+   *     driver must sync with the chip after changing this value.
    */
-  command void setAddressRecognition(bool on);
+  command void setAddressRecognition(bool enableAddressRecognition, bool useHwAddressRecognition);
+  
   
   /**
    * @return TRUE if address recognition is enabled
    */
   async command bool isAddressRecognitionEnabled();
   
+  /**
+   * @return TRUE if address recognition is performed first in hardware.
+   */
+  async command bool isHwAddressRecognitionDefault();
+  
   /**
    * Sync must be called for acknowledgement changes to take effect
    * @param enableAutoAck TRUE to enable auto acknowledgements
@@ -100,4 +109,6 @@ interface CC2420Config {
    */
   async command bool isAutoAckEnabled();
   
+
+  
 }