Commit | Line | Data |
---|---|---|
7ef5cc92 | 1 | /* |
96481b20 ID |
2 | Copyright (C) 2010 Willow Garage <http://www.willowgarage.com> |
3 | Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com> | |
7ef5cc92 BZ |
4 | Copyright (C) 2009 Bartlomiej Zolnierkiewicz |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the | |
18 | Free Software Foundation, Inc., | |
19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 | */ | |
21 | ||
22 | #ifndef RT2800LIB_H | |
23 | #define RT2800LIB_H | |
24 | ||
25 | struct rt2800_ops { | |
26 | void (*register_read)(struct rt2x00_dev *rt2x00dev, | |
27 | const unsigned int offset, u32 *value); | |
31a4cf1f GW |
28 | void (*register_read_lock)(struct rt2x00_dev *rt2x00dev, |
29 | const unsigned int offset, u32 *value); | |
7ef5cc92 BZ |
30 | void (*register_write)(struct rt2x00_dev *rt2x00dev, |
31 | const unsigned int offset, u32 value); | |
32 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, | |
33 | const unsigned int offset, u32 value); | |
34 | ||
35 | void (*register_multiread)(struct rt2x00_dev *rt2x00dev, | |
36 | const unsigned int offset, | |
37 | void *value, const u32 length); | |
38 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | |
39 | const unsigned int offset, | |
40 | const void *value, const u32 length); | |
41 | ||
42 | int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, | |
43 | const unsigned int offset, | |
44 | const struct rt2x00_field32 field, u32 *reg); | |
e3a896b9 | 45 | |
f31c9a8c ID |
46 | int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev, |
47 | const u8 *data, const size_t len); | |
e3a896b9 | 48 | int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev); |
0c5879bc | 49 | __le32 *(*drv_get_txwi)(struct queue_entry *entry); |
7ef5cc92 BZ |
50 | }; |
51 | ||
52 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | |
53 | const unsigned int offset, | |
54 | u32 *value) | |
55 | { | |
e796643e | 56 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
57 | |
58 | rt2800ops->register_read(rt2x00dev, offset, value); | |
59 | } | |
60 | ||
31a4cf1f GW |
61 | static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev, |
62 | const unsigned int offset, | |
63 | u32 *value) | |
64 | { | |
e796643e | 65 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
31a4cf1f GW |
66 | |
67 | rt2800ops->register_read_lock(rt2x00dev, offset, value); | |
68 | } | |
69 | ||
7ef5cc92 BZ |
70 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, |
71 | const unsigned int offset, | |
72 | u32 value) | |
73 | { | |
e796643e | 74 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
75 | |
76 | rt2800ops->register_write(rt2x00dev, offset, value); | |
77 | } | |
78 | ||
79 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | |
80 | const unsigned int offset, | |
81 | u32 value) | |
82 | { | |
e796643e | 83 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
84 | |
85 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | |
86 | } | |
87 | ||
88 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | |
89 | const unsigned int offset, | |
90 | void *value, const u32 length) | |
91 | { | |
e796643e | 92 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
93 | |
94 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | |
95 | } | |
96 | ||
97 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | |
98 | const unsigned int offset, | |
99 | const void *value, | |
100 | const u32 length) | |
101 | { | |
e796643e | 102 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
103 | |
104 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | |
105 | } | |
106 | ||
107 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | |
108 | const unsigned int offset, | |
109 | const struct rt2x00_field32 field, | |
110 | u32 *reg) | |
111 | { | |
e796643e | 112 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
7ef5cc92 BZ |
113 | |
114 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | |
115 | } | |
116 | ||
f31c9a8c ID |
117 | static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev, |
118 | const u8 *data, const size_t len) | |
119 | { | |
e796643e | 120 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
f31c9a8c ID |
121 | |
122 | return rt2800ops->drv_write_firmware(rt2x00dev, data, len); | |
123 | } | |
124 | ||
e3a896b9 GW |
125 | static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev) |
126 | { | |
e796643e | 127 | const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; |
e3a896b9 GW |
128 | |
129 | return rt2800ops->drv_init_registers(rt2x00dev); | |
130 | } | |
131 | ||
0c5879bc ID |
132 | static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry) |
133 | { | |
134 | const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv; | |
135 | ||
136 | return rt2800ops->drv_get_txwi(entry); | |
137 | } | |
138 | ||
89297425 BZ |
139 | void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, |
140 | const u8 command, const u8 token, | |
141 | const u8 arg0, const u8 arg1); | |
142 | ||
5ffddc49 | 143 | int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev); |
b9a07ae9 ID |
144 | int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev); |
145 | ||
f31c9a8c ID |
146 | int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, |
147 | const u8 *data, const size_t len); | |
148 | int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, | |
149 | const u8 *data, const size_t len); | |
150 | ||
0c5879bc ID |
151 | void rt2800_write_tx_data(struct queue_entry *entry, |
152 | struct txentry_desc *txdesc); | |
74861922 | 153 | void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc); |
59679b91 | 154 | |
31937c42 | 155 | void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi); |
96481b20 | 156 | |
f0194b2d | 157 | void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); |
69cf36a4 | 158 | void rt2800_clear_beacon(struct queue_entry *entry); |
f0194b2d | 159 | |
f4450616 BZ |
160 | extern const struct rt2x00debug rt2800_rt2x00debug; |
161 | ||
162 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); | |
f4450616 BZ |
163 | int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, |
164 | struct rt2x00lib_crypto *crypto, | |
165 | struct ieee80211_key_conf *key); | |
166 | int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, | |
167 | struct rt2x00lib_crypto *crypto, | |
168 | struct ieee80211_key_conf *key); | |
a2b1328a HS |
169 | int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif, |
170 | struct ieee80211_sta *sta); | |
171 | int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid); | |
f4450616 BZ |
172 | void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, |
173 | const unsigned int filter_flags); | |
174 | void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, | |
175 | struct rt2x00intf_conf *conf, const unsigned int flags); | |
02044643 HS |
176 | void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp, |
177 | u32 changed); | |
f4450616 BZ |
178 | void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant); |
179 | void rt2800_config(struct rt2x00_dev *rt2x00dev, | |
180 | struct rt2x00lib_conf *libconf, | |
181 | const unsigned int flags); | |
182 | void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); | |
183 | void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); | |
184 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | |
185 | const u32 count); | |
9e33a355 | 186 | void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); |
2e9c43dd | 187 | void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); |
f4450616 | 188 | |
b9a07ae9 ID |
189 | int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); |
190 | void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); | |
fcf51541 | 191 | |
30e84034 BZ |
192 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev); |
193 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev); | |
38bd7b8a BZ |
194 | int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev); |
195 | int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev); | |
4da2933f | 196 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev); |
38bd7b8a | 197 | |
e783619e HS |
198 | void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32, |
199 | u16 *iv16); | |
200 | int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value); | |
8a3a3c85 EP |
201 | int rt2800_conf_tx(struct ieee80211_hw *hw, |
202 | struct ieee80211_vif *vif, u16 queue_idx, | |
e783619e | 203 | const struct ieee80211_tx_queue_params *params); |
37a41b4a | 204 | u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
e783619e HS |
205 | int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
206 | enum ieee80211_ampdu_mlme_action action, | |
0b01f030 JB |
207 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, |
208 | u8 buf_size); | |
977206d7 HS |
209 | int rt2800_get_survey(struct ieee80211_hw *hw, int idx, |
210 | struct survey_info *survey); | |
f7b395e9 | 211 | void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev); |
2ce33995 | 212 | |
7ef5cc92 | 213 | #endif /* RT2800LIB_H */ |