Exemplo n.º 1
0
int Ar9287_SpurChansSet(int *value, int ix, int iy, int iz, int num, int iBand)
{
    int i, val=0, iv=0;
    ar9287_eeprom_t *peep9287;  
    peep9287 = (ar9287_eeprom_t *)Ar9287EepromStructGet();   // prints the Current EEPROM structure

    for (i=ix; i<AR9287_EEPROM_MODAL_SPURS; i++) 
    {
        if (iv>=num)
        break;

		if (FBIN2FREQ(value[iv],1) > 2300 && FBIN2FREQ(value[iv],1) < 2500)
        	peep9287->modalHeader.spurChans[i].spurChan=(u_int16_t)value[iv++];
    }
    return 0;
}
Exemplo n.º 2
0
//
// returns 0 on success, negative error code on problem
//
int Ar9300NoiseFloorPowerSet(int frequency, int ichain, int nfpower)
{
	int fx;
	int it;
    ar9300_eeprom_t *eep;
    u_int8_t *pCalPier;
    OSP_CAL_DATA_PER_FREQ_OP_LOOP *pCalPierStruct;
    int is2GHz;
	int ipier,npier;

	eep=Ar9300EepromStructGet();
	if(eep==0)
	{
		return -1;
	}
	//
	// check chain value
	//
	if(ichain<0 || ichain>=OSPREY_MAX_CHAINS)
	{
		return -2;
	}
   //
	// figure out which band we're using
	//
    is2GHz=(frequency<4000);
    if(is2GHz)
    {
        npier=OSPREY_NUM_2G_CAL_PIERS;
        pCalPier = eep->calFreqPier2G;
        pCalPierStruct = eep->calPierData2G[ichain];
    }
    else
    {
        npier=OSPREY_NUM_5G_CAL_PIERS;
        pCalPier = eep->calFreqPier5G;
        pCalPierStruct = eep->calPierData5G[ichain];
    }
    //
	// look for correct frequency pier
	//
	for(ipier=0; ipier<npier; ipier++)
	{
		fx = FBIN2FREQ(pCalPier[ipier], is2GHz);
		if(fx==frequency)
		{
			pCalPierStruct[ipier].rxNoisefloorPower=nfpower;
			return 0;
		}
	}

    return -3;
}
Exemplo n.º 3
0
/* Spur mitigation for OFDM */
static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah,
					 struct ath9k_channel *chan)
{
	int synth_freq;
	int range = 10;
	int freq_offset = 0;
	int mode;
	u8* spurChansPtr;
	unsigned int i;
	struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;

	if (IS_CHAN_5GHZ(chan)) {
		spurChansPtr = &(eep->modalHeader5G.spurChans[0]);
		mode = 0;
	}
	else {
		spurChansPtr = &(eep->modalHeader2G.spurChans[0]);
		mode = 1;
	}

	if (spurChansPtr[0] == 0)
		return; /* No spur in the mode */

	if (IS_CHAN_HT40(chan)) {
		range = 19;
		if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL,
				   AR_PHY_GC_DYN2040_PRI_CH) == 0x0)
			synth_freq = chan->channel - 10;
		else
			synth_freq = chan->channel + 10;
	} else {
		range = 10;
		synth_freq = chan->channel;
	}

	ar9003_hw_spur_ofdm_clear(ah);

	for (i = 0; spurChansPtr[i] && i < 5; i++) {
		freq_offset = FBIN2FREQ(spurChansPtr[i], mode) - synth_freq;
		if (abs(freq_offset) < range) {
			ar9003_hw_spur_ofdm_work(ah, chan, freq_offset);
			break;
		}
	}
}