xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_fw_cmd.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*-
2  * Copyright (c) 2015 Kevin Lo <kevlo@FreeBSD.org>
3  * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $
18  */
19 
20 #ifndef R88E_FW_CMD_H
21 #define R88E_FW_CMD_H
22 
23 /*
24  * Host to firmware commands.
25  */
26 struct r88e_fw_cmd {
27 	uint8_t id;
28 #define R88E_CMD_RSVD_PAGE		0x00
29 #define R88E_CMD_MSR_RPT		0x01
30 #define R88E_CMD_SET_PWRMODE		0x20
31 
32 	uint8_t msg[7];
33 } __packed __attribute__((aligned(4)));
34 
35 /* Structure for R88E_CMD_RSVD_PAGE. */
36 struct r88e_fw_cmd_rsvdpage {
37 	uint8_t		probe_resp;
38 	uint8_t		ps_poll;
39 	uint8_t		null_data;
40 	uint8_t		null_data_qos;
41 	uint8_t		null_data_qos_bt;
42 } __packed;
43 
44 /* Structure for R88E_CMD_MSR_RPT. */
45 struct r88e_fw_cmd_msrrpt {
46 	uint8_t		msrb0;
47 #define R88E_MSRRPT_B0_DISASSOC		0x00
48 #define R88E_MSRRPT_B0_ASSOC		0x01
49 
50 	uint8_t		macid;
51 } __packed;
52 
53 /* Structure for R88E_CMD_SET_PWRMODE. */
54 struct r88e_fw_cmd_pwrmode {
55 	uint8_t		mode;
56 #define R88E_PWRMODE_CAM		0
57 #define R88E_PWRMODE_LEG		1
58 #define R88E_PWRMODE_UAPSD		2
59 
60 	uint8_t		pwrb1;
61 #define R88E_PWRMODE_B1_RLBM_M		0x0f
62 #define R88E_PWRMODE_B1_RLBM_S		0
63 #define R88E_PWRMODE_B1_MODE_MIN	0
64 #define R88E_PWRMODE_B1_MODE_MAX	1
65 #define R88E_PWRMODE_B1_MODE_DTIM	2
66 
67 #define R88E_PWRMODE_B1_SMART_PS_M	0xf0
68 #define R88E_PWRMODE_B1_SMART_PS_S	4
69 #define R88E_PWRMODE_B1_LEG_PSPOLL0	0
70 #define R88E_PWRMODE_B1_LEG_PSPOLL1	1
71 #define R88E_PWRMODE_B1_LEG_NULLDATA	2
72 #define R88E_PWRMODE_B1_WMM_PSPOLL	0
73 #define R88E_PWRMODE_B1_WMM_NULLDATA	1
74 
75 	uint8_t		bcn_pass;
76 	uint8_t		queue_uapsd;
77 	uint8_t		pwr_state;
78 #define R88E_PWRMODE_STATE_RFOFF	0x00
79 #define R88E_PWRMODE_STATE_RFON		0x04
80 #define R88E_PWRMODE_STATE_ALLON	0x0c
81 } __packed;
82 
83 #endif	/* R88E_FW_CMD_H */
84