ath5k.h (92fd4d4d67b945c0766416284d4ab236b31542c4) | ath5k.h (eef39befaae2a1559efe197d795c376a317af2af) |
---|---|
1/* 2 * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org> 3 * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * --- 11 unchanged lines hidden (view full) --- 20 21/* TODO: Clean up channel debuging -doesn't work anyway- and start 22 * working on reg. control code using all available eeprom information 23 * -rev. engineering needed- */ 24#define CHAN_DEBUG 0 25 26#include <linux/io.h> 27#include <linux/types.h> | 1/* 2 * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org> 3 * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * --- 11 unchanged lines hidden (view full) --- 20 21/* TODO: Clean up channel debuging -doesn't work anyway- and start 22 * working on reg. control code using all available eeprom information 23 * -rev. engineering needed- */ 24#define CHAN_DEBUG 0 25 26#include <linux/io.h> 27#include <linux/types.h> |
28#include <linux/average.h> |
|
28#include <net/mac80211.h> 29 30/* RX/TX descriptor hw structs 31 * TODO: Driver part should only see sw structs */ 32#include "desc.h" 33 34/* EEPROM structs/offsets 35 * TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities) --- 1061 unchanged lines hidden (view full) --- 1097 bool r_enabled; 1098 int r_last_alert; 1099 struct ieee80211_channel r_last_channel; 1100 } ah_radar; 1101 1102 struct ath5k_nfcal_hist ah_nfcal_hist; 1103 1104 /* average beacon RSSI in our BSS (used by ANI) */ | 29#include <net/mac80211.h> 30 31/* RX/TX descriptor hw structs 32 * TODO: Driver part should only see sw structs */ 33#include "desc.h" 34 35/* EEPROM structs/offsets 36 * TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities) --- 1061 unchanged lines hidden (view full) --- 1098 bool r_enabled; 1099 int r_last_alert; 1100 struct ieee80211_channel r_last_channel; 1101 } ah_radar; 1102 1103 struct ath5k_nfcal_hist ah_nfcal_hist; 1104 1105 /* average beacon RSSI in our BSS (used by ANI) */ |
1105 struct ath5k_avg_val ah_beacon_rssi_avg; | 1106 struct ewma ah_beacon_rssi_avg; |
1106 1107 /* noise floor from last periodic calibration */ 1108 s32 ah_noise_floor; 1109 1110 /* Calibration timestamp */ 1111 unsigned long ah_cal_next_full; 1112 unsigned long ah_cal_next_ani; 1113 unsigned long ah_cal_next_nf; --- 196 unchanged lines hidden (view full) --- 1310 for (i = 0; i < bits; i++) { 1311 bit = (val >> i) & 1; 1312 retval = (retval << 1) | bit; 1313 } 1314 1315 return retval; 1316} 1317 | 1107 1108 /* noise floor from last periodic calibration */ 1109 s32 ah_noise_floor; 1110 1111 /* Calibration timestamp */ 1112 unsigned long ah_cal_next_full; 1113 unsigned long ah_cal_next_ani; 1114 unsigned long ah_cal_next_nf; --- 196 unchanged lines hidden (view full) --- 1311 for (i = 0; i < bits; i++) { 1312 bit = (val >> i) & 1; 1313 retval = (retval << 1) | bit; 1314 } 1315 1316 return retval; 1317} 1318 |
1318#define AVG_SAMPLES 8 1319#define AVG_FACTOR 1000 1320 1321/** 1322 * ath5k_moving_average - Exponentially weighted moving average 1323 * @avg: average structure 1324 * @val: current value 1325 * 1326 * This implementation make use of a struct ath5k_avg_val to prevent rounding 1327 * errors. 1328 */ 1329static inline struct ath5k_avg_val 1330ath5k_moving_average(const struct ath5k_avg_val avg, const int val) 1331{ 1332 struct ath5k_avg_val new; 1333 new.avg_weight = avg.avg_weight ? 1334 (((avg.avg_weight * ((AVG_SAMPLES) - 1)) + 1335 (val * (AVG_FACTOR))) / (AVG_SAMPLES)) : 1336 (val * (AVG_FACTOR)); 1337 new.avg = new.avg_weight / (AVG_FACTOR); 1338 return new; 1339} 1340 | |
1341#endif | 1319#endif |