Linux-libre 3.16.85-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8188eu / include / rtw_iol.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __RTW_IOL_H_
21 #define __RTW_IOL_H_
22
23 #include <osdep_service.h>
24 #include <drv_types.h>
25
26 #define IOREG_CMD_END_LEN       4
27
28 struct ioreg_cfg {
29         u8      length;
30         u8      cmd_id;
31         __le16  address;
32         __le32  data;
33         __le32  mask;
34 };
35
36 enum ioreg_cmd {
37         IOREG_CMD_LLT           = 0x01,
38         IOREG_CMD_REFUSE        = 0x02,
39         IOREG_CMD_EFUSE_PATH    = 0x03,
40         IOREG_CMD_WB_REG        = 0x04,
41         IOREG_CMD_WW_REG        = 0x05,
42         IOREG_CMD_WD_REG        = 0x06,
43         IOREG_CMD_W_RF          = 0x07,
44         IOREG_CMD_DELAY_US      = 0x10,
45         IOREG_CMD_DELAY_MS      = 0x11,
46         IOREG_CMD_END           = 0xFF,
47 };
48
49 struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter);
50 int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds,
51                         u32 cmd_len);
52 int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);
53 int rtw_IOL_exec_cmds_sync(struct adapter  *adapter,
54                            struct xmit_frame *xmit_frame, u32 max_wating_ms,
55                            u32 bndy_cnt);
56 bool rtw_IOL_applied(struct adapter  *adapter);
57 int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
58 int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
59 int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
60
61 void read_efuse_from_txpktbuf(struct adapter *adapter, int bcnhead,
62                               u8 *content, u16 *size);
63
64 int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr,
65                            u8 value, u8 mask);
66 int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr,
67                            u16 value, u16 mask);
68 int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr,
69                            u32 value, u32 mask);
70 int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path,
71                             u16 addr, u32 value, u32 mask);
72 #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value, mask)            \
73         _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) , (mask))
74 #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value, mask)            \
75         _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), (mask))
76 #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value, mask)            \
77         _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), (mask))
78 #define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value, mask)  \
79         _rtw_IOL_append_WRF_cmd((xmit_frame), (rf_path), (addr), (value), (mask))
80
81 u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
82 void  rtw_IOL_cmd_buf_dump(struct adapter  *Adapter, int buf_len, u8 *pbuf);
83
84 #endif /* __RTW_IOL_H_ */