GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / rtlwifi / halmac / rtl_halmac.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2016  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 #ifndef _RTL_HALMAC_H_
26 #define _RTL_HALMAC_H_
27
28 #include "halmac_api.h"
29
30 #define rtlpriv_to_halmac(priv)                                                \
31         ((struct halmac_adapter *)((priv)->halmac.internal))
32
33 /* for H2C cmd */
34 #define MAX_H2C_BOX_NUMS 4
35 #define MESSAGE_BOX_SIZE 4
36 #define EX_MESSAGE_BOX_SIZE 4
37
38 /* HALMAC API for Driver(HAL) */
39 int rtl_halmac_init_adapter(struct rtl_priv *rtlpriv);
40 int rtl_halmac_deinit_adapter(struct rtl_priv *rtlpriv);
41 int rtl_halmac_poweron(struct rtl_priv *rtlpriv);
42 int rtl_halmac_poweroff(struct rtl_priv *rtlpriv);
43 int rtl_halmac_init_hal(struct rtl_priv *rtlpriv);
44 int rtl_halmac_init_hal_fw(struct rtl_priv *rtlpriv, u8 *fw, u32 fwsize);
45 int rtl_halmac_init_hal_fw_file(struct rtl_priv *rtlpriv, u8 *fwpath);
46 int rtl_halmac_deinit_hal(struct rtl_priv *rtlpriv);
47 int rtl_halmac_self_verify(struct rtl_priv *rtlpriv);
48 int rtl_halmac_dlfw(struct rtl_priv *rtlpriv, u8 *fw, u32 fwsize);
49 int rtl_halmac_dlfw_from_file(struct rtl_priv *rtlpriv, u8 *fwpath);
50 int rtl_halmac_phy_power_switch(struct rtl_priv *rtlpriv, u8 enable);
51 int rtl_halmac_send_h2c(struct rtl_priv *rtlpriv, u8 *h2c);
52 int rtl_halmac_c2h_handle(struct rtl_priv *rtlpriv, u8 *c2h, u32 size);
53
54 int rtl_halmac_get_physical_efuse_size(struct rtl_priv *rtlpriv, u32 *size);
55 int rtl_halmac_read_physical_efuse_map(struct rtl_priv *rtlpriv, u8 *map,
56                                        u32 size);
57 int rtl_halmac_read_physical_efuse(struct rtl_priv *rtlpriv, u32 offset,
58                                    u32 cnt, u8 *data);
59 int rtl_halmac_write_physical_efuse(struct rtl_priv *rtlpriv, u32 offset,
60                                     u32 cnt, u8 *data);
61 int rtl_halmac_get_logical_efuse_size(struct rtl_priv *rtlpriv, u32 *size);
62 int rtl_halmac_read_logical_efuse_map(struct rtl_priv *rtlpriv, u8 *map,
63                                       u32 size);
64 int rtl_halmac_write_logical_efuse_map(struct rtl_priv *rtlpriv, u8 *map,
65                                        u32 size, u8 *maskmap, u32 masksize);
66 int rtl_halmac_read_logical_efuse(struct rtl_priv *rtlpriv, u32 offset, u32 cnt,
67                                   u8 *data);
68 int rtl_halmac_write_logical_efuse(struct rtl_priv *rtlpriv, u32 offset,
69                                    u32 cnt, u8 *data);
70
71 int rtl_halmac_config_rx_info(struct rtl_priv *rtlpriv, enum halmac_drv_info);
72 int rtl_halmac_set_mac_address(struct rtl_priv *rtlpriv, u8 hwport, u8 *addr);
73 int rtl_halmac_set_bssid(struct rtl_priv *d, u8 hwport, u8 *addr);
74
75 int rtl_halmac_set_bandwidth(struct rtl_priv *rtlpriv, u8 channel,
76                              u8 pri_ch_idx, u8 bw);
77 int rtl_halmac_rx_agg_switch(struct rtl_priv *rtlpriv, bool enable);
78 int rtl_halmac_get_hw_value(struct rtl_priv *d, enum halmac_hw_id hw_id,
79                             void *pvalue);
80 int rtl_halmac_dump_fifo(struct rtl_priv *rtlpriv,
81                          enum hal_fifo_sel halmac_fifo_sel);
82
83 int rtl_halmac_get_wow_reason(struct rtl_priv *rtlpriv, u8 *reason);
84 int rtl_halmac_get_drv_info_sz(struct rtl_priv *d, u8 *sz);
85
86 int rtl_halmac_get_rsvd_drv_pg_bndy(struct rtl_priv *dvobj, u16 *drv_pg);
87 int rtl_halmac_download_rsvd_page(struct rtl_priv *dvobj, u8 pg_offset,
88                                   u8 *pbuf, u32 size);
89
90 int rtl_halmac_chk_txdesc(struct rtl_priv *rtlpriv, u8 *txdesc, u32 size);
91
92 struct rtl_halmac_ops *rtl_halmac_get_ops_pointer(void);
93
94 #endif /* _RTL_HALMAC_H_ */