sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.c
static void
ar5416SetupMeasurement(struct ath_hal *ah, HAL_CAL_LIST *currCal)
{
	/* Start calibration w/ 2^(INIT_IQCAL_LOG_COUNT_MAX+1) samples */
	OS_REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4,
	    AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX,
	    currCal->calData->calCountMax);

	/* Select calibration to run */
	switch (currCal->calData->calType) {
	case IQ_MISMATCH_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start IQ Mismatch calibration\n", __func__);
		break;
	case ADC_GAIN_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start ADC Gain calibration\n", __func__);
		break;
	case ADC_DC_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start ADC DC calibration\n", __func__);
		break;
	case ADC_DC_INIT_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_INIT);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start Init ADC DC calibration\n", __func__);
		break;
	}
	/* Kick-off cal */
	OS_REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4, AR_PHY_TIMING_CTRL4_DO_CAL);
}
/*
 * Setup HW to collect samples used for current cal
 */
Setup HW to collect samples used for current cal
Setup HW to collect samples used for current cal
static void
ar5416SetupMeasurement(struct ath_hal *ah, HAL_CAL_LIST *currCal)
{
	OS_REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4,
	    AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX,
	    currCal->calData->calCountMax);
	switch (currCal->calData->calType) {
	case IQ_MISMATCH_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start IQ Mismatch calibration\n", __func__);
		break;
	case ADC_GAIN_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start ADC Gain calibration\n", __func__);
		break;
	case ADC_DC_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start ADC DC calibration\n", __func__);
		break;
	case ADC_DC_INIT_CAL:
		OS_REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_INIT);
		HALDEBUG(ah, HAL_DEBUG_PERCAL,
		    "%s: start Init ADC DC calibration\n", __func__);
		break;
	}
	OS_REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4, AR_PHY_TIMING_CTRL4_DO_CAL);
}
static void ar5416SetupMeasurement ( struct ath_hal * ah , HAL_CAL_LIST * currCal ) { OS_REG_RMW_FIELD ( ah , AR_PHY_TIMING_CTRL4 , AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX , currCal -> calData -> calCountMax ) ; switch ( currCal -> calData -> calType ) { case IQ_MISMATCH_CAL : OS_REG_WRITE ( ah , AR_PHY_CALMODE , AR_PHY_CALMODE_IQ ) ; HALDEBUG ( ah , HAL_DEBUG_PERCAL , " \n " , __func__ ) ; break ; case ADC_GAIN_CAL : OS_REG_WRITE ( ah , AR_PHY_CALMODE , AR_PHY_CALMODE_ADC_GAIN ) ; HALDEBUG ( ah , HAL_DEBUG_PERCAL , " \n " , __func__ ) ; break ; case ADC_DC_CAL : OS_REG_WRITE ( ah , AR_PHY_CALMODE , AR_PHY_CALMODE_ADC_DC_PER ) ; HALDEBUG ( ah , HAL_DEBUG_PERCAL , " \n " , __func__ ) ; break ; case ADC_DC_INIT_CAL : OS_REG_WRITE ( ah , AR_PHY_CALMODE , AR_PHY_CALMODE_ADC_DC_INIT ) ; HALDEBUG ( ah , HAL_DEBUG_PERCAL , " \n " , __func__ ) ; break ; } OS_REG_SET_BIT ( ah , AR_PHY_TIMING_CTRL4 , AR_PHY_TIMING_CTRL4_DO_CAL ) ; }
Setup HW to collect samples used for current cal
Setup HW to collect samples used for current cal
/* Start calibration w/ 2^(INIT_IQCAL_LOG_COUNT_MAX+1) samples */ /* Select calibration to run */ /* Kick-off cal */