Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / wlan / ar5416.h
1 #include <ar5416desc.h>
2
3 extern  HAL_STATUS ar5416GetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE,
4         a_uint32_t, a_uint32_t *);
5 extern  const HAL_RATE_TABLE *ar5416GetRateTable(struct ath_hal *, a_uint32_t mode);
6 extern  HAL_BOOL ar5416IsInterruptPending(struct ath_hal *ah);
7 extern  HAL_BOOL ar5416GetPendingInterrupts(struct ath_hal *ah, HAL_INT *);
8 extern  HAL_INT ar5416GetInterrupts(struct ath_hal *ah);
9 extern  HAL_INT ar5416SetInterrupts(struct ath_hal *ah, HAL_INT ints);
10 extern  a_uint32_t ar5416Get11nExtBusy(struct ath_hal *ah);
11 extern  HAL_HT_RXCLEAR ar5416Get11nRxClear(struct ath_hal *ah);
12 extern  void ar5416Set11nRxClear(struct ath_hal *ah, HAL_HT_RXCLEAR rxclear);
13 extern  a_uint32_t ar5416GetTsf32(struct ath_hal *ah);
14 extern  u_int64_t ar5416GetTsf64(struct ath_hal *ah);
15 extern  void ar5416ResetTsf(struct ath_hal *ah);
16 extern  void ar5416Detach(struct ath_hal *ah);
17
18 typedef enum Ar5416_Rates {
19     rate6mb,  rate9mb,  rate12mb, rate18mb,
20     rate24mb, rate36mb, rate48mb, rate54mb,
21     rate1l,   rate2l,   rate2s,   rate5_5l,
22     rate5_5s, rate11l,  rate11s,  rateXr,
23     rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3,
24     rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7,
25     rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3,
26     rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7,
27     rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm,
28     Ar5416RateSize
29 } AR5416_RATES;
30
31 #ifdef MAGPIE_MERLIN
32 #define AR_SREV_HOWL(ah) ((AH_PRIVATE(ah)->ah_macVersion) == AR_SREV_VERSION_HOWL)
33 #define IS_5416_HOWL AR_SREV_HOWL
34
35 #define AR5416_RATES_OFDM_OFFSET    0
36 #define AR5416_RATES_CCK_OFFSET     8
37 #define AR5416_RATES_HT20_OFFSET    16
38 #define AR5416_RATES_HT40_OFFSET    24
39
40 /* Delta from which to start power to pdadc table */
41
42 #define AR5416_PWR_TABLE_OFFSET  -5
43 #define AR5416_LEGACY_CHAINMASK         1
44 #define AR5416_1_CHAINMASK              1
45 #define AR5416_2LOHI_CHAINMASK          5       
46 #define AR5416_2LOMID_CHAINMASK         3       
47 #define AR5416_3_CHAINMASK              7
48
49 #define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
50
51 #else // For Owl
52
53 #endif // MAGPIE_MERLIN
54
55 #define AR5416_LEGACY_CHAINMASK         1
56
57 #define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
58
59 /*
60  * Various fifo fill before Tx start, in 64-byte units
61  * i.e. put the frame in the air while still DMAing
62  */
63 #define MIN_TX_FIFO_THRESHOLD   0x1
64 #define MAX_TX_FIFO_THRESHOLD   (( 4096 / 64) - 1)
65 #define INIT_TX_FIFO_THRESHOLD  MIN_TX_FIFO_THRESHOLD
66
67 struct ath_hal_5416
68 {
69         struct ath_hal_private  ah_priv;    /* base class */
70         a_uint16_t   ah_antennaSwitchSwap;       /* Controls mapping of OID request */
71         a_uint32_t   ah_maskReg;        /* copy of AR_IMR */
72            
73         a_uint32_t   ah_slottime;        /* user-specified slot time */
74         a_int16_t    ah_txPowerIndexOffset;
75            
76         a_uint32_t   ah_intrTxqs;
77         void         *ah_cal_mem;
78         a_uint16_t   ah_ratesArray[Ar5416RateSize];
79 #ifdef MAGPIE_MERLIN
80         /* HT CWM state */
81         HAL_HT_CWM   ah_htcwm;
82 #endif
83 };