📄 ah_internal.h.svn-base
字号:
uint32_t tqi_readyTime; uint32_t tqi_physCompBuf; uint32_t tqi_intFlags; /* flags for internal use */} HAL_TX_QUEUE_INFO;extern HAL_BOOL ath_hal_setTxQProps(struct ath_hal *ah, HAL_TX_QUEUE_INFO *qi, const HAL_TXQ_INFO *qInfo);extern HAL_BOOL ath_hal_getTxQProps(struct ath_hal *ah, HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi);typedef enum { HAL_ANI_PRESENT, /* is ANI support present */ HAL_ANI_NOISE_IMMUNITY_LEVEL, /* set level */ HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION, /* enable/disable */ HAL_ANI_CCK_WEAK_SIGNAL_THR, /* enable/disable */ HAL_ANI_FIRSTEP_LEVEL, /* set level */ HAL_ANI_SPUR_IMMUNITY_LEVEL, /* set level */ HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */ HAL_ANI_PHYERR_RESET, /* reset phy error stats */} HAL_ANI_CMD;#define HAL_SPUR_VAL_MASK 0x3FFF#define HAL_SPUR_CHAN_WIDTH 87#define HAL_BIN_WIDTH_BASE_100HZ 3125#define HAL_BIN_WIDTH_TURBO_100HZ 6250#define HAL_MAX_BINS_ALLOWED 28/* * A = 5GHZ|OFDM * T = 5GHZ|OFDM|TURBO * * IS_CHAN_A(T) will return TRUE. This is probably * not the default behavior we want. We should migrate to a better mask -- * perhaps CHANNEL_ALL. * * For now, IS_CHAN_G() masks itself with CHANNEL_108G. * */#define IS_CHAN_A(_c) (((_c)->channelFlags & CHANNEL_A) == CHANNEL_A)#define IS_CHAN_B(_c) (((_c)->channelFlags & CHANNEL_B) == CHANNEL_B)#define IS_CHAN_G(_c) (((_c)->channelFlags & (CHANNEL_108G|CHANNEL_G)) == CHANNEL_G)#define IS_CHAN_108G(_c)(((_c)->channelFlags & CHANNEL_108G) == CHANNEL_108G)#define IS_CHAN_T(_c) (((_c)->channelFlags & CHANNEL_T) == CHANNEL_T)#define IS_CHAN_PUREG(_c) \ (((_c)->channelFlags & CHANNEL_PUREG) == CHANNEL_PUREG)#define IS_CHAN_TURBO(_c) (((_c)->channelFlags & CHANNEL_TURBO) != 0)#define IS_CHAN_CCK(_c) (((_c)->channelFlags & CHANNEL_CCK) != 0)#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)#define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)#define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)#define CHANNEL_HT40 (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS)#define CHANNEL_HT (CHANNEL_HT20 | CHANNEL_HT40)#define IS_CHAN_HT(_c) (((_c)->channelFlags & CHANNEL_HT) != 0)#define IS_CHAN_HT20(_c) (((_c)->channelFlags & CHANNEL_HT) == CHANNEL_HT20)#define IS_CHAN_HT40(_c) (((_c)->channelFlags & CHANNEL_HT40) != 0)/* * Deduce if the host cpu has big- or litt-endian byte order. */static __inline__ intisBigEndian(void){ union { int32_t i; char c[4]; } u; u.i = 1; return (u.c[0] == 0);}/* unalligned little endian access */ #define LE_READ_2(p) \ ((uint16_t) \ ((((const uint8_t *)(p))[0] ) | (((const uint8_t *)(p))[1]<< 8)))#define LE_READ_4(p) \ ((uint32_t) \ ((((const uint8_t *)(p))[0] ) | (((const uint8_t *)(p))[1]<< 8) |\ (((const uint8_t *)(p))[2]<<16) | (((const uint8_t *)(p))[3]<<24)))/* * Register manipulation macros that expect bit field defines * to follow the convention that an _S suffix is appended for * a shift count, while the field mask has no suffix. */#define SM(_v, _f) (((_v) << _f##_S) & (_f))#define MS(_v, _f) (((_v) & (_f)) >> _f##_S)#define OS_REG_RMW_FIELD(_a, _r, _f, _v) \ OS_REG_WRITE(_a, _r, \ (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f)))#define OS_REG_SET_BIT(_a, _r, _f) \ OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) | (_f))#define OS_REG_CLR_BIT(_a, _r, _f) \ OS_REG_WRITE(_a, _r, OS_REG_READ(_a, _r) &~ (_f))/* * Regulatory domain support. *//* * Return the max allowed antenna gain based on the current * regulatory domain. */extern u_int ath_hal_getantennareduction(struct ath_hal *, HAL_CHANNEL *, u_int twiceGain);/* * Return the test group for the specific channel based on * the current regulator domain. */extern u_int ath_hal_getctl(struct ath_hal *, HAL_CHANNEL *);/* * Return whether or not a noise floor check is required * based on the current regulatory domain for the specified * channel. */extern u_int ath_hal_getnfcheckrequired(struct ath_hal *, HAL_CHANNEL *);/* * Map a public channel definition to the corresponding * internal data structure. This implicitly specifies * whether or not the specified channel is ok to use * based on the current regulatory domain constraints. */extern HAL_CHANNEL_INTERNAL *ath_hal_checkchannel(struct ath_hal *, const HAL_CHANNEL *);/* system-configurable parameters */extern int ath_hal_dma_beacon_response_time; /* in TU's */extern int ath_hal_sw_beacon_response_time; /* in TU's */extern int ath_hal_additional_swba_backoff; /* in TU's *//* wait for the register contents to have the specified value */extern HAL_BOOL ath_hal_wait(struct ath_hal *, u_int reg, uint32_t mask, uint32_t val);/* return the first n bits in val reversed */extern uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n);/* printf interfaces */extern void ath_hal_printf(struct ath_hal *, const char*, ...) __printflike(2,3);extern void ath_hal_vprintf(struct ath_hal *, const char*, __va_list) __printflike(2, 0);extern const char* ath_hal_ether_sprintf(const uint8_t *mac);/* allocate and free memory */extern void *ath_hal_malloc(size_t);extern void ath_hal_free(void *);/* common debugging interfaces */#ifdef AH_DEBUG#include "ah_debug.h"extern int ath_hal_debug;extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) __printflike(3,4);#else#define HALDEBUG(_ah, __m, _fmt, ...)#endif /* AH_DEBUG *//* * Register logging definitions shared with ardecode. */#include "ah_decode.h"/* * Common assertion interface. Note: it is a bad idea to generate * an assertion failure for any recoverable event. Instead catch * the violation and, if possible, fix it up or recover from it; either * with an error return value or a diagnostic messages. System software * does not panic unless the situation is hopeless. */#ifdef AH_ASSERTextern void ath_hal_assert_failed(const char* filename, int lineno, const char* msg);#define HALASSERT(_x) do { \ if (!(_x)) { \ ath_hal_assert_failed(__FILE__, __LINE__, #_x); \ } \} while (0)#else#define HALASSERT(_x)#endif /* AH_ASSERT *//* * Convert between microseconds and core system clocks. */extern u_int ath_hal_mac_clks(struct ath_hal *ah, u_int usecs);extern u_int ath_hal_mac_usec(struct ath_hal *ah, u_int clks);/* * Generic get/set capability support. Each chip overrides * this routine to support chip-specific capabilities. */extern HAL_STATUS ath_hal_getcapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t *result);extern HAL_BOOL ath_hal_setcapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t setting, HAL_STATUS *status);/* * Diagnostic interface. This is an open-ended interface that * is opaque to applications. Diagnostic programs use this to * retrieve internal data structures, etc. There is no guarantee * that calling conventions for calls other than HAL_DIAG_REVS * are stable between HAL releases; a diagnostic application must * use the HAL revision information to deal with ABI/API differences. * * NB: do not renumber these, certain codes are publicly used. */enum { HAL_DIAG_REVS = 0, /* MAC/PHY/Radio revs */ HAL_DIAG_EEPROM = 1, /* EEPROM contents */ HAL_DIAG_EEPROM_EXP_11A = 2, /* EEPROM 5112 power exp for 11a */ HAL_DIAG_EEPROM_EXP_11B = 3, /* EEPROM 5112 power exp for 11b */ HAL_DIAG_EEPROM_EXP_11G = 4, /* EEPROM 5112 power exp for 11g */ HAL_DIAG_ANI_CURRENT = 5, /* ANI current channel state */ HAL_DIAG_ANI_OFDM = 6, /* ANI OFDM timing error stats */ HAL_DIAG_ANI_CCK = 7, /* ANI CCK timing error stats */ HAL_DIAG_ANI_STATS = 8, /* ANI statistics */ HAL_DIAG_RFGAIN = 9, /* RfGain GAIN_VALUES */ HAL_DIAG_RFGAIN_CURSTEP = 10, /* RfGain GAIN_OPTIMIZATION_STEP */ HAL_DIAG_PCDAC = 11, /* PCDAC table */ HAL_DIAG_TXRATES = 12, /* Transmit rate table */ HAL_DIAG_REGS = 13, /* Registers */ HAL_DIAG_ANI_CMD = 14, /* ANI issue command (XXX do not change!) */ HAL_DIAG_SETKEY = 15, /* Set keycache backdoor */ HAL_DIAG_RESETKEY = 16, /* Reset keycache backdoor */ HAL_DIAG_EEREAD = 17, /* Read EEPROM word */ HAL_DIAG_EEWRITE = 18, /* Write EEPROM word */ /* 19 was HAL_DIAG_TXCONT, 20-23 were for radar */ HAL_DIAG_REGREAD = 24, /* Reg reads */ HAL_DIAG_REGWRITE = 25, /* Reg writes */ HAL_DIAG_GET_REGBASE = 26, /* Get register base */ HAL_DIAG_RDWRITE = 27, /* Write regulatory domain */ HAL_DIAG_RDREAD = 28, /* Get regulatory domain */ HAL_DIAG_FATALERR = 29, /* Read cached interrupt state */ HAL_DIAG_11NCOMPAT = 30, /* 11n compatibility tweaks */ HAL_DIAG_ANI_PARAMS = 31, /* ANI noise immunity parameters */ HAL_DIAG_CHECK_HANGS = 32, /* check h/w hangs */};enum { HAL_BB_HANG_DFS = 0x0001, HAL_BB_HANG_RIFS = 0x0002, HAL_BB_HANG_RX_CLEAR = 0x0004, HAL_BB_HANG_UNKNOWN = 0x0080, HAL_MAC_HANG_SIG1 = 0x0100, HAL_MAC_HANG_SIG2 = 0x0200, HAL_MAC_HANG_UNKNOWN = 0x8000, HAL_BB_HANGS = HAL_BB_HANG_DFS | HAL_BB_HANG_RIFS | HAL_BB_HANG_RX_CLEAR | HAL_BB_HANG_UNKNOWN, HAL_MAC_HANGS = HAL_MAC_HANG_SIG1 | HAL_MAC_HANG_SIG2 | HAL_MAC_HANG_UNKNOWN,};/* * Device revision information. */typedef struct { uint16_t ah_devid; /* PCI device ID */ uint16_t ah_subvendorid; /* PCI subvendor ID */ uint32_t ah_macVersion; /* MAC version id */ uint16_t ah_macRev; /* MAC revision */ uint16_t ah_phyRev; /* PHY revision */ uint16_t ah_analog5GhzRev; /* 2GHz radio revision */ uint16_t ah_analog2GhzRev; /* 5GHz radio revision */} HAL_REVS;/* * Argument payload for HAL_DIAG_SETKEY. */typedef struct { HAL_KEYVAL dk_keyval; uint16_t dk_keyix; /* key index */ uint8_t dk_mac[IEEE80211_ADDR_LEN]; int dk_xor; /* XOR key data */} HAL_DIAG_KEYVAL;/* * Argument payload for HAL_DIAG_EEWRITE. */typedef struct { uint16_t ee_off; /* eeprom offset */ uint16_t ee_data; /* write data */} HAL_DIAG_EEVAL;typedef struct { u_int offset; /* reg offset */ uint32_t val; /* reg value */} HAL_DIAG_REGVAL;/* * 11n compatibility tweaks. */#define HAL_DIAG_11N_SERVICES 0x00000003#define HAL_DIAG_11N_SERVICES_S 0#define HAL_DIAG_11N_TXSTOMP 0x0000000c#define HAL_DIAG_11N_TXSTOMP_S 2typedef struct { int maxNoiseImmunityLevel; /* [0..4] */ int totalSizeDesired[5]; int coarseHigh[5]; int coarseLow[5]; int firpwr[5]; int maxSpurImmunityLevel; /* [0..7] */ int cycPwrThr1[8]; int maxFirstepLevel; /* [0..2] */ int firstep[3]; uint32_t ofdmTrigHigh; uint32_t ofdmTrigLow; int32_t cckTrigHigh; int32_t cckTrigLow; int32_t rssiThrLow; int32_t rssiThrHigh; int period; /* update listen period */} HAL_ANI_PARAMS;extern HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize);/* * Setup a h/w rate table for use. */extern void ath_hal_setupratetable(struct ath_hal *ah, HAL_RATE_TABLE *rt);/* * Common routine for implementing getChanNoise api. */extern int16_t ath_hal_getChanNoise(struct ath_hal *ah, HAL_CHANNEL *chan);/* * Initialization support. */typedef struct { const uint32_t *data; int rows, cols;} HAL_INI_ARRAY;#define HAL_INI_INIT(_ia, _data, _cols) do { \ (_ia)->data = (const uint32_t *)(_data); \ (_ia)->rows = sizeof(_data) / sizeof((_data)[0]); \ (_ia)->cols = (_cols); \} while (0)#define HAL_INI_VAL(_ia, _r, _c) \ ((_ia)->data[((_r)*(_ia)->cols) + (_c)])/* * OS_DELAY() does a PIO READ on the PCI bus which allows * other cards' DMA reads to complete in the middle of our reset. */#define DMA_YIELD(x) do { \ if ((++(x) % 64) == 0) \ OS_DELAY(1); \} while (0)#define HAL_INI_WRITE_ARRAY(ah, regArray, col, regWr) do { \ int r; \ for (r = 0; r < N(regArray); r++) { \ OS_REG_WRITE(ah, (regArray)[r][0], (regArray)[r][col]); \ DMA_YIELD(regWr); \ } \} while (0)#define HAL_INI_WRITE_BANK(ah, regArray, bankData, regWr) do { \ int r; \ for (r = 0; r < N(regArray); r++) { \ OS_REG_WRITE(ah, (regArray)[r][0], (bankData)[r]); \ DMA_YIELD(regWr); \ } \} while (0)extern int ath_hal_ini_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia, int col, int regWr);extern void ath_hal_ini_bank_setup(uint32_t data[], const HAL_INI_ARRAY *ia, int col);extern int ath_hal_ini_bank_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia, const uint32_t data[], int regWr);#define WLAN_CTRL_FRAME_SIZE (2+2+6+4) /* ACK+FCS */#endif /* _ATH_AH_INTERAL_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -