xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_fw_cmd.h (revision 42249ef2)
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  * $FreeBSD$
19  */
20 
21 #ifndef R88E_FW_CMD_H
22 #define R88E_FW_CMD_H
23 
24 /*
25  * Host to firmware commands.
26  */
27 struct r88e_fw_cmd {
28 	uint8_t id;
29 #define R88E_CMD_RSVD_PAGE		0x00
30 #define R88E_CMD_MSR_RPT		0x01
31 #define R88E_CMD_SET_PWRMODE		0x20
32 
33 	uint8_t msg[7];
34 } __packed __attribute__((aligned(4)));
35 
36 /* Structure for R88E_CMD_RSVD_PAGE. */
37 struct r88e_fw_cmd_rsvdpage {
38 	uint8_t		probe_resp;
39 	uint8_t		ps_poll;
40 	uint8_t		null_data;
41 	uint8_t		null_data_qos;
42 	uint8_t		null_data_qos_bt;
43 } __packed;
44 
45 /* Structure for R88E_CMD_MSR_RPT. */
46 struct r88e_fw_cmd_msrrpt {
47 	uint8_t		msrb0;
48 #define R88E_MSRRPT_B0_DISASSOC		0x00
49 #define R88E_MSRRPT_B0_ASSOC		0x01
50 
51 	uint8_t		macid;
52 } __packed;
53 
54 /* Structure for R88E_CMD_SET_PWRMODE. */
55 struct r88e_fw_cmd_pwrmode {
56 	uint8_t		mode;
57 #define R88E_PWRMODE_CAM		0
58 #define R88E_PWRMODE_LEG		1
59 #define R88E_PWRMODE_UAPSD		2
60 
61 	uint8_t		pwrb1;
62 #define R88E_PWRMODE_B1_RLBM_M		0x0f
63 #define R88E_PWRMODE_B1_RLBM_S		0
64 #define R88E_PWRMODE_B1_MODE_MIN	0
65 #define R88E_PWRMODE_B1_MODE_MAX	1
66 #define R88E_PWRMODE_B1_MODE_DTIM	2
67 
68 #define R88E_PWRMODE_B1_SMART_PS_M	0xf0
69 #define R88E_PWRMODE_B1_SMART_PS_S	4
70 #define R88E_PWRMODE_B1_LEG_PSPOLL0	0
71 #define R88E_PWRMODE_B1_LEG_PSPOLL1	1
72 #define R88E_PWRMODE_B1_LEG_NULLDATA	2
73 #define R88E_PWRMODE_B1_WMM_PSPOLL	0
74 #define R88E_PWRMODE_B1_WMM_NULLDATA	1
75 
76 	uint8_t		bcn_pass;
77 	uint8_t		queue_uapsd;
78 	uint8_t		pwr_state;
79 #define R88E_PWRMODE_STATE_RFOFF	0x00
80 #define R88E_PWRMODE_STATE_RFON		0x04
81 #define R88E_PWRMODE_STATE_ALLON	0x0c
82 } __packed;
83 
84 #endif	/* R88E_FW_CMD_H */
85