sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.c
static void
ar5416UpdateNFHistBuff(struct ar5212NfCalHist *h, int16_t *nfarray)
{
	int i;

	for (i = 0; i < AR5416_NUM_NF_READINGS; i ++) {
		h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];

		if (++h[i].currIndex >= AR512_NF_CAL_HIST_MAX)
			h[i].currIndex = 0;
		if (h[i].invalidNFcount > 0) {
			if (nfarray[i] < AR5416_CCA_MIN_BAD_VALUE ||
			    nfarray[i] > AR5416_CCA_MAX_HIGH_VALUE) {
				h[i].invalidNFcount = AR512_NF_CAL_HIST_MAX;
			} else {
				h[i].invalidNFcount--;
				h[i].privNF = nfarray[i];
			}
		} else {
			h[i].privNF = ar5212GetNfHistMid(h[i].nfCalBuffer);
		}
	}
}
/*
 * Update the noise floor buffer as a ring buffer
 */
Update the noise floor buffer as a ring buffer
Update the noise floor buffer as a ring buffer
static void
ar5416UpdateNFHistBuff(struct ar5212NfCalHist *h, int16_t *nfarray)
{
	int i;
	for (i = 0; i < AR5416_NUM_NF_READINGS; i ++) {
		h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];
		if (++h[i].currIndex >= AR512_NF_CAL_HIST_MAX)
			h[i].currIndex = 0;
		if (h[i].invalidNFcount > 0) {
			if (nfarray[i] < AR5416_CCA_MIN_BAD_VALUE ||
			    nfarray[i] > AR5416_CCA_MAX_HIGH_VALUE) {
				h[i].invalidNFcount = AR512_NF_CAL_HIST_MAX;
			} else {
				h[i].invalidNFcount--;
				h[i].privNF = nfarray[i];
			}
		} else {
			h[i].privNF = ar5212GetNfHistMid(h[i].nfCalBuffer);
		}
	}
}
static void ar5416UpdateNFHistBuff ( struct ar5212NfCalHist * h , int16_t * nfarray ) { int i ; for ( i = 0 ; i < AR5416_NUM_NF_READINGS ; i ++ ) { h [ i ] . nfCalBuffer [ h [ i ] . currIndex ] = nfarray [ i ] ; if ( ++ h [ i ] . currIndex >= AR512_NF_CAL_HIST_MAX ) h [ i ] . currIndex = 0 ; if ( h [ i ] . invalidNFcount > 0 ) { if ( nfarray [ i ] < AR5416_CCA_MIN_BAD_VALUE || nfarray [ i ] > AR5416_CCA_MAX_HIGH_VALUE ) { h [ i ] . invalidNFcount = AR512_NF_CAL_HIST_MAX ; } else { h [ i ] . invalidNFcount -- ; h [ i ] . privNF = nfarray [ i ] ; } } else { h [ i ] . privNF = ar5212GetNfHistMid ( h [ i ] . nfCalBuffer ) ; } } }
Update the noise floor buffer as a ring buffer
Update the noise floor buffer as a ring buffer