sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.c
static HAL_BOOL
ar5416RunInitCals(struct ath_hal *ah, int init_cal_count)
{
	struct ath_hal_5416 *ahp = AH5416(ah);
	struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
	HAL_CHANNEL_INTERNAL ichan;	/* XXX bogus */
	HAL_CAL_LIST *curCal = ahp->ah_cal_curr;
	HAL_BOOL isCalDone;
	int i;

	if (curCal == AH_NULL)
		return AH_FALSE;

	ichan.calValid = 0;
	for (i = 0; i < init_cal_count; i++) {
		/* Reset this Cal */
		ar5416ResetMeasurement(ah, curCal);
		/* Poll for offset calibration complete */
		if (!ath_hal_wait(ah, AR_PHY_TIMING_CTRL4, AR_PHY_TIMING_CTRL4_DO_CAL, 0)) {
			HALDEBUG(ah, HAL_DEBUG_ANY,
			    "%s: Cal %d failed to finish in 100ms.\n",
			    __func__, curCal->calData->calType);
			/* Re-initialize list pointers for periodic cals */
			cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;
			return AH_FALSE;
		}
		/* Run this cal */
		ar5416DoCalibration(ah, &ichan, ahp->ah_rxchainmask,
		    curCal, &isCalDone);
		if (!isCalDone)
			HALDEBUG(ah, HAL_DEBUG_ANY,
			    "%s: init cal %d did not complete.\n",
			    __func__, curCal->calData->calType);
		if (curCal->calNext != AH_NULL)
			curCal = curCal->calNext;
	}

	/* Re-initialize list pointers for periodic cals */
	cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;
	return AH_TRUE;
}
/*
 * Run non-periodic calibrations.
 */
Run non-periodic calibrations.
Run non - periodic calibrations .
static HAL_BOOL
ar5416RunInitCals(struct ath_hal *ah, int init_cal_count)
{
	struct ath_hal_5416 *ahp = AH5416(ah);
	struct ar5416PerCal *cal = &AH5416(ah)->ah_cal;
	HAL_CHANNEL_INTERNAL ichan;	
	HAL_CAL_LIST *curCal = ahp->ah_cal_curr;
	HAL_BOOL isCalDone;
	int i;
	if (curCal == AH_NULL)
		return AH_FALSE;
	ichan.calValid = 0;
	for (i = 0; i < init_cal_count; i++) {
		ar5416ResetMeasurement(ah, curCal);
		if (!ath_hal_wait(ah, AR_PHY_TIMING_CTRL4, AR_PHY_TIMING_CTRL4_DO_CAL, 0)) {
			HALDEBUG(ah, HAL_DEBUG_ANY,
			    "%s: Cal %d failed to finish in 100ms.\n",
			    __func__, curCal->calData->calType);
			cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;
			return AH_FALSE;
		}
		ar5416DoCalibration(ah, &ichan, ahp->ah_rxchainmask,
		    curCal, &isCalDone);
		if (!isCalDone)
			HALDEBUG(ah, HAL_DEBUG_ANY,
			    "%s: init cal %d did not complete.\n",
			    __func__, curCal->calData->calType);
		if (curCal->calNext != AH_NULL)
			curCal = curCal->calNext;
	}
	cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL;
	return AH_TRUE;
}
static HAL_BOOL ar5416RunInitCals ( struct ath_hal * ah , int init_cal_count ) { struct ath_hal_5416 * ahp = AH5416 ( ah ) ; struct ar5416PerCal * cal = & AH5416 ( ah ) -> ah_cal ; HAL_CHANNEL_INTERNAL ichan ; HAL_CAL_LIST * curCal = ahp -> ah_cal_curr ; HAL_BOOL isCalDone ; int i ; if ( curCal == AH_NULL ) return AH_FALSE ; ichan . calValid = 0 ; for ( i = 0 ; i < init_cal_count ; i ++ ) { ar5416ResetMeasurement ( ah , curCal ) ; if ( ! ath_hal_wait ( ah , AR_PHY_TIMING_CTRL4 , AR_PHY_TIMING_CTRL4_DO_CAL , 0 ) ) { HALDEBUG ( ah , HAL_DEBUG_ANY , " \n " , __func__ , curCal -> calData -> calType ) ; cal -> cal_list = cal -> cal_last = cal -> cal_curr = AH_NULL ; return AH_FALSE ; } ar5416DoCalibration ( ah , & ichan , ahp -> ah_rxchainmask , curCal , & isCalDone ) ; if ( ! isCalDone ) HALDEBUG ( ah , HAL_DEBUG_ANY , " \n " , __func__ , curCal -> calData -> calType ) ; if ( curCal -> calNext != AH_NULL ) curCal = curCal -> calNext ; } cal -> cal_list = cal -> cal_last = cal -> cal_curr = AH_NULL ; return AH_TRUE ; }
Run non-periodic calibrations.
Run non - periodic calibrations .
/* XXX bogus */ /* Reset this Cal */ /* Poll for offset calibration complete */ /* Re-initialize list pointers for periodic cals */ /* Run this cal */ /* Re-initialize list pointers for periodic cals */