Author: adrian
Date: Thu Aug 12 06:06:14 2010
New Revision: 211206
URL: http://svn.freebsd.org/changeset/base/211206

Log:
  Add a couple of functions to check NF calibration progress / completion.

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Thu Aug 12 05:59:55 2010        
(r211205)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Thu Aug 12 06:06:14 2010        
(r211206)
@@ -608,4 +608,8 @@ extern      void ar5212AniPoll(struct ath_hal
                             const struct ieee80211_channel *);
 extern void ar5212AniReset(struct ath_hal *, const struct ieee80211_channel *,
                HAL_OPMODE, int);
+
+extern HAL_BOOL ar5212IsNFCalInProgress(struct ath_hal *ah);
+extern HAL_BOOL ar5212WaitNFCalComplete(struct ath_hal *ah, int i);
+
 #endif /* _ATH_AR5212_H_ */

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c       Thu Aug 12 05:59:55 
2010        (r211205)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c       Thu Aug 12 06:06:14 
2010        (r211206)
@@ -1071,3 +1071,38 @@ ar5212GetDiagState(struct ath_hal *ah, i
        }
        return AH_FALSE;
 }
+
+/*
+ * Check whether there's an in-progress NF completion.
+ *
+ * Returns AH_TRUE if there's a in-progress NF calibration, AH_FALSE
+ * otherwise.
+ */
+HAL_BOOL
+ar5212IsNFCalInProgress(struct ath_hal *ah)
+{
+       if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF)
+               return AH_TRUE;
+       return AH_FALSE;
+}
+
+/*
+ * Wait for an in-progress NF calibration to complete.
+ *
+ * The completion function waits "i" times 10uS.
+ * It returns AH_TRUE if the NF calibration completed (or was never
+ * in progress); AH_FALSE if it was still in progress after "i" checks.
+ */
+HAL_BOOL
+ar5212WaitNFCalComplete(struct ath_hal *ah, int i)
+{
+       int j;
+       if (i <= 0)
+               i = 1;    /* it should run at least once */
+       for (j = 0; j < i; j++) {
+               if (! ar5212IsNFCalInProgress(ah))
+                       return AH_TRUE;
+               OS_DELAY(10);
+       }
+       return AH_FALSE;
+}
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to