Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2 * This file is part of wlcore
  3 *
  4 * Copyright (C) 2011 Texas Instruments Inc.
  5 *
  6 * This program is free software; you can redistribute it and/or
  7 * modify it under the terms of the GNU General Public License
  8 * version 2 as published by the Free Software Foundation.
  9 *
 10 * This program is distributed in the hope that it will be useful, but
 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13 * General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program; if not, write to the Free Software
 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 18 * 02110-1301 USA
 19 *
 20 */
 21
 22#ifndef __WLCORE_HW_OPS_H__
 23#define __WLCORE_HW_OPS_H__
 24
 25#include "wlcore.h"
 26#include "rx.h"
 27
 28static inline u32
 29wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
 30{
 31	if (!wl->ops->calc_tx_blocks)
 32		BUG_ON(1);
 33
 34	return wl->ops->calc_tx_blocks(wl, len, spare_blks);
 35}
 36
 37static inline void
 38wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
 39			     u32 blks, u32 spare_blks)
 40{
 41	if (!wl->ops->set_tx_desc_blocks)
 42		BUG_ON(1);
 43
 44	return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks);
 45}
 46
 47static inline void
 48wlcore_hw_set_tx_desc_data_len(struct wl1271 *wl,
 49			       struct wl1271_tx_hw_descr *desc,
 50			       struct sk_buff *skb)
 51{
 52	if (!wl->ops->set_tx_desc_data_len)
 53		BUG_ON(1);
 54
 55	wl->ops->set_tx_desc_data_len(wl, desc, skb);
 56}
 57
 58static inline enum wl_rx_buf_align
 59wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc)
 60{
 61
 62	if (!wl->ops->get_rx_buf_align)
 63		BUG_ON(1);
 64
 65	return wl->ops->get_rx_buf_align(wl, rx_desc);
 66}
 67
 68static inline int
 69wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len)
 70{
 71	if (wl->ops->prepare_read)
 72		return wl->ops->prepare_read(wl, rx_desc, len);
 73
 74	return 0;
 75}
 76
 77static inline u32
 78wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len)
 79{
 80	if (!wl->ops->get_rx_packet_len)
 81		BUG_ON(1);
 82
 83	return wl->ops->get_rx_packet_len(wl, rx_data, data_len);
 84}
 85
 86static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl)
 87{
 88	if (wl->ops->tx_delayed_compl)
 89		return wl->ops->tx_delayed_compl(wl);
 90
 91	return 0;
 92}
 93
 94static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl)
 95{
 96	if (wl->ops->tx_immediate_compl)
 97		wl->ops->tx_immediate_compl(wl);
 98}
 99
100static inline int
101wlcore_hw_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif)
102{
103	if (wl->ops->init_vif)
104		return wl->ops->init_vif(wl, wlvif);
105
106	return 0;
107}
108
109static inline void
110wlcore_hw_convert_fw_status(struct wl1271 *wl, void *raw_fw_status,
111			    struct wl_fw_status *fw_status)
112{
113	BUG_ON(!wl->ops->convert_fw_status);
114
115	wl->ops->convert_fw_status(wl, raw_fw_status, fw_status);
116}
117
118static inline u32
119wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif)
120{
121	if (!wl->ops->sta_get_ap_rate_mask)
122		BUG_ON(1);
123
124	return wl->ops->sta_get_ap_rate_mask(wl, wlvif);
125}
126
127static inline int wlcore_identify_fw(struct wl1271 *wl)
128{
129	if (wl->ops->identify_fw)
130		return wl->ops->identify_fw(wl);
131
132	return 0;
133}
134
135static inline void
136wlcore_hw_set_tx_desc_csum(struct wl1271 *wl,
137			   struct wl1271_tx_hw_descr *desc,
138			   struct sk_buff *skb)
139{
140	if (!wl->ops->set_tx_desc_csum)
141		BUG_ON(1);
142
143	wl->ops->set_tx_desc_csum(wl, desc, skb);
144}
145
146static inline void
147wlcore_hw_set_rx_csum(struct wl1271 *wl,
148		      struct wl1271_rx_descriptor *desc,
149		      struct sk_buff *skb)
150{
151	if (wl->ops->set_rx_csum)
152		wl->ops->set_rx_csum(wl, desc, skb);
153}
154
155static inline u32
156wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
157				     struct wl12xx_vif *wlvif)
158{
159	if (wl->ops->ap_get_mimo_wide_rate_mask)
160		return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif);
161
162	return 0;
163}
164
165static inline int
166wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir)
167{
168	if (wl->ops->debugfs_init)
169		return wl->ops->debugfs_init(wl, rootdir);
170
171	return 0;
172}
173
174static inline int
175wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
176{
177	if (wl->ops->handle_static_data)
178		return wl->ops->handle_static_data(wl, static_data);
179
180	return 0;
181}
182
183static inline int
184wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem)
185{
186	if (!wl->ops->get_spare_blocks)
187		BUG_ON(1);
188
189	return wl->ops->get_spare_blocks(wl, is_gem);
190}
191
192static inline int
193wlcore_hw_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
194		  struct ieee80211_vif *vif,
195		  struct ieee80211_sta *sta,
196		  struct ieee80211_key_conf *key_conf)
197{
198	if (!wl->ops->set_key)
199		BUG_ON(1);
200
201	return wl->ops->set_key(wl, cmd, vif, sta, key_conf);
202}
203
204static inline u32
205wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len)
206{
207	if (wl->ops->pre_pkt_send)
208		return wl->ops->pre_pkt_send(wl, buf_offset, last_len);
209
210	return buf_offset;
211}
212
213static inline void
214wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
215{
216	if (wl->ops->sta_rc_update)
217		wl->ops->sta_rc_update(wl, wlvif);
218}
219
220static inline int
221wlcore_hw_interrupt_notify(struct wl1271 *wl, bool action)
222{
223	if (wl->ops->interrupt_notify)
224		return wl->ops->interrupt_notify(wl, action);
225	return 0;
226}
227
228static inline int
229wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
230{
231	if (wl->ops->rx_ba_filter)
232		return wl->ops->rx_ba_filter(wl, action);
233	return 0;
234}
235
236static inline int
237wlcore_hw_ap_sleep(struct wl1271 *wl)
238{
239	if (wl->ops->ap_sleep)
240		return wl->ops->ap_sleep(wl);
241
242	return 0;
243}
244
245static inline int
246wlcore_hw_set_peer_cap(struct wl1271 *wl,
247		       struct ieee80211_sta_ht_cap *ht_cap,
248		       bool allow_ht_operation,
249		       u32 rate_set, u8 hlid)
250{
251	if (wl->ops->set_peer_cap)
252		return wl->ops->set_peer_cap(wl, ht_cap, allow_ht_operation,
253					     rate_set, hlid);
254
255	return 0;
256}
257
258static inline u32
259wlcore_hw_convert_hwaddr(struct wl1271 *wl, u32 hwaddr)
260{
261	if (!wl->ops->convert_hwaddr)
262		BUG_ON(1);
263
264	return wl->ops->convert_hwaddr(wl, hwaddr);
265}
266
267static inline bool
268wlcore_hw_lnk_high_prio(struct wl1271 *wl, u8 hlid,
269			struct wl1271_link *lnk)
270{
271	if (!wl->ops->lnk_high_prio)
272		BUG_ON(1);
273
274	return wl->ops->lnk_high_prio(wl, hlid, lnk);
275}
276
277static inline bool
278wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
279		       struct wl1271_link *lnk)
280{
281	if (!wl->ops->lnk_low_prio)
282		BUG_ON(1);
283
284	return wl->ops->lnk_low_prio(wl, hlid, lnk);
285}
286
287static inline int
288wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
289{
290	if (!wl->ops->smart_config_start)
291		return -EINVAL;
292
293	return wl->ops->smart_config_start(wl, group_bitmap);
294}
295
296static inline int
297wlcore_smart_config_stop(struct wl1271 *wl)
298{
299	if (!wl->ops->smart_config_stop)
300		return -EINVAL;
301
302	return wl->ops->smart_config_stop(wl);
303}
304
305static inline int
306wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
307				  u8 key_len, u8 *key)
308{
309	if (!wl->ops->smart_config_set_group_key)
310		return -EINVAL;
311
312	return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
313}
314
315static inline int
316wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
317{
318	if (!wl->ops->set_cac)
319		return -EINVAL;
320
321	return wl->ops->set_cac(wl, wlvif, start);
322}
323
324static inline int
325wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
326{
327	if (!wl->ops->dfs_master_restart)
328		return -EINVAL;
329
330	return wl->ops->dfs_master_restart(wl, wlvif);
331}
332#endif
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * This file is part of wlcore
  4 *
  5 * Copyright (C) 2011 Texas Instruments Inc.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  6 */
  7
  8#ifndef __WLCORE_HW_OPS_H__
  9#define __WLCORE_HW_OPS_H__
 10
 11#include "wlcore.h"
 12#include "rx.h"
 13
 14static inline u32
 15wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
 16{
 17	if (!wl->ops->calc_tx_blocks)
 18		BUG_ON(1);
 19
 20	return wl->ops->calc_tx_blocks(wl, len, spare_blks);
 21}
 22
 23static inline void
 24wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
 25			     u32 blks, u32 spare_blks)
 26{
 27	if (!wl->ops->set_tx_desc_blocks)
 28		BUG_ON(1);
 29
 30	return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks);
 31}
 32
 33static inline void
 34wlcore_hw_set_tx_desc_data_len(struct wl1271 *wl,
 35			       struct wl1271_tx_hw_descr *desc,
 36			       struct sk_buff *skb)
 37{
 38	if (!wl->ops->set_tx_desc_data_len)
 39		BUG_ON(1);
 40
 41	wl->ops->set_tx_desc_data_len(wl, desc, skb);
 42}
 43
 44static inline enum wl_rx_buf_align
 45wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc)
 46{
 47
 48	if (!wl->ops->get_rx_buf_align)
 49		BUG_ON(1);
 50
 51	return wl->ops->get_rx_buf_align(wl, rx_desc);
 52}
 53
 54static inline int
 55wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len)
 56{
 57	if (wl->ops->prepare_read)
 58		return wl->ops->prepare_read(wl, rx_desc, len);
 59
 60	return 0;
 61}
 62
 63static inline u32
 64wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len)
 65{
 66	if (!wl->ops->get_rx_packet_len)
 67		BUG_ON(1);
 68
 69	return wl->ops->get_rx_packet_len(wl, rx_data, data_len);
 70}
 71
 72static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl)
 73{
 74	if (wl->ops->tx_delayed_compl)
 75		return wl->ops->tx_delayed_compl(wl);
 76
 77	return 0;
 78}
 79
 80static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl)
 81{
 82	if (wl->ops->tx_immediate_compl)
 83		wl->ops->tx_immediate_compl(wl);
 84}
 85
 86static inline int
 87wlcore_hw_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 88{
 89	if (wl->ops->init_vif)
 90		return wl->ops->init_vif(wl, wlvif);
 91
 92	return 0;
 93}
 94
 95static inline void
 96wlcore_hw_convert_fw_status(struct wl1271 *wl, void *raw_fw_status,
 97			    struct wl_fw_status *fw_status)
 98{
 99	BUG_ON(!wl->ops->convert_fw_status);
100
101	wl->ops->convert_fw_status(wl, raw_fw_status, fw_status);
102}
103
104static inline u32
105wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif)
106{
107	if (!wl->ops->sta_get_ap_rate_mask)
108		BUG_ON(1);
109
110	return wl->ops->sta_get_ap_rate_mask(wl, wlvif);
111}
112
113static inline int wlcore_identify_fw(struct wl1271 *wl)
114{
115	if (wl->ops->identify_fw)
116		return wl->ops->identify_fw(wl);
117
118	return 0;
119}
120
121static inline void
122wlcore_hw_set_tx_desc_csum(struct wl1271 *wl,
123			   struct wl1271_tx_hw_descr *desc,
124			   struct sk_buff *skb)
125{
126	if (!wl->ops->set_tx_desc_csum)
127		BUG_ON(1);
128
129	wl->ops->set_tx_desc_csum(wl, desc, skb);
130}
131
132static inline void
133wlcore_hw_set_rx_csum(struct wl1271 *wl,
134		      struct wl1271_rx_descriptor *desc,
135		      struct sk_buff *skb)
136{
137	if (wl->ops->set_rx_csum)
138		wl->ops->set_rx_csum(wl, desc, skb);
139}
140
141static inline u32
142wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
143				     struct wl12xx_vif *wlvif)
144{
145	if (wl->ops->ap_get_mimo_wide_rate_mask)
146		return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif);
147
148	return 0;
149}
150
151static inline int
152wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir)
153{
154	if (wl->ops->debugfs_init)
155		return wl->ops->debugfs_init(wl, rootdir);
156
157	return 0;
158}
159
160static inline int
161wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
162{
163	if (wl->ops->handle_static_data)
164		return wl->ops->handle_static_data(wl, static_data);
165
166	return 0;
167}
168
169static inline int
170wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem)
171{
172	if (!wl->ops->get_spare_blocks)
173		BUG_ON(1);
174
175	return wl->ops->get_spare_blocks(wl, is_gem);
176}
177
178static inline int
179wlcore_hw_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
180		  struct ieee80211_vif *vif,
181		  struct ieee80211_sta *sta,
182		  struct ieee80211_key_conf *key_conf)
183{
184	if (!wl->ops->set_key)
185		BUG_ON(1);
186
187	return wl->ops->set_key(wl, cmd, vif, sta, key_conf);
188}
189
190static inline u32
191wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len)
192{
193	if (wl->ops->pre_pkt_send)
194		return wl->ops->pre_pkt_send(wl, buf_offset, last_len);
195
196	return buf_offset;
197}
198
199static inline void
200wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
201{
202	if (wl->ops->sta_rc_update)
203		wl->ops->sta_rc_update(wl, wlvif);
204}
205
206static inline int
207wlcore_hw_interrupt_notify(struct wl1271 *wl, bool action)
208{
209	if (wl->ops->interrupt_notify)
210		return wl->ops->interrupt_notify(wl, action);
211	return 0;
212}
213
214static inline int
215wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
216{
217	if (wl->ops->rx_ba_filter)
218		return wl->ops->rx_ba_filter(wl, action);
219	return 0;
220}
221
222static inline int
223wlcore_hw_ap_sleep(struct wl1271 *wl)
224{
225	if (wl->ops->ap_sleep)
226		return wl->ops->ap_sleep(wl);
227
228	return 0;
229}
230
231static inline int
232wlcore_hw_set_peer_cap(struct wl1271 *wl,
233		       struct ieee80211_sta_ht_cap *ht_cap,
234		       bool allow_ht_operation,
235		       u32 rate_set, u8 hlid)
236{
237	if (wl->ops->set_peer_cap)
238		return wl->ops->set_peer_cap(wl, ht_cap, allow_ht_operation,
239					     rate_set, hlid);
240
241	return 0;
242}
243
244static inline u32
245wlcore_hw_convert_hwaddr(struct wl1271 *wl, u32 hwaddr)
246{
247	if (!wl->ops->convert_hwaddr)
248		BUG_ON(1);
249
250	return wl->ops->convert_hwaddr(wl, hwaddr);
251}
252
253static inline bool
254wlcore_hw_lnk_high_prio(struct wl1271 *wl, u8 hlid,
255			struct wl1271_link *lnk)
256{
257	if (!wl->ops->lnk_high_prio)
258		BUG_ON(1);
259
260	return wl->ops->lnk_high_prio(wl, hlid, lnk);
261}
262
263static inline bool
264wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
265		       struct wl1271_link *lnk)
266{
267	if (!wl->ops->lnk_low_prio)
268		BUG_ON(1);
269
270	return wl->ops->lnk_low_prio(wl, hlid, lnk);
271}
272
273static inline int
274wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
275{
276	if (!wl->ops->smart_config_start)
277		return -EINVAL;
278
279	return wl->ops->smart_config_start(wl, group_bitmap);
280}
281
282static inline int
283wlcore_smart_config_stop(struct wl1271 *wl)
284{
285	if (!wl->ops->smart_config_stop)
286		return -EINVAL;
287
288	return wl->ops->smart_config_stop(wl);
289}
290
291static inline int
292wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
293				  u8 key_len, u8 *key)
294{
295	if (!wl->ops->smart_config_set_group_key)
296		return -EINVAL;
297
298	return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
299}
300
301static inline int
302wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
303{
304	if (!wl->ops->set_cac)
305		return -EINVAL;
306
307	return wl->ops->set_cac(wl, wlvif, start);
308}
309
310static inline int
311wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
312{
313	if (!wl->ops->dfs_master_restart)
314		return -EINVAL;
315
316	return wl->ops->dfs_master_restart(wl, wlvif);
317}
318#endif