1 /*-
2 * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
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 R92C_FW_CMD_H
22 #define R92C_FW_CMD_H
23
24 /*
25 * Host to firmware commands.
26 */
27 struct r92c_fw_cmd {
28 uint8_t id;
29 #define R92C_CMD_SET_PWRMODE 1
30 #define R92C_CMD_JOINBSS_RPT 2
31 #define R92C_CMD_RSVD_PAGE 3
32 #define R92C_CMD_RSSI_SETTING 5
33 #define R92C_CMD_MACID_CONFIG 6
34
35 #define R92C_CMD_FLAG_EXT 0x80
36
37 uint8_t msg[5];
38 } __packed __attribute__((aligned(4)));
39
40 /* Structure for R92C_CMD_JOINBSS_RPT. */
41 struct r92c_fw_cmd_joinbss_rpt {
42 uint8_t mstatus;
43 #define R92C_MSTATUS_DISASSOC 0x00
44 #define R92C_MSTATUS_ASSOC 0x01
45 } __packed;
46
47 /* Structure for R92C_CMD_SET_PWRMODE. */
48 struct r92c_fw_cmd_pwrmode {
49 uint8_t mode;
50 #define R92C_PWRMODE_CAM 0
51 #define R92C_PWRMODE_MIN 1
52 #define R92C_PWRMODE_MAX 2
53 #define R92C_PWRMODE_DTIM 3
54 #define R92C_PWRMODE_UAPSD_WMM 5
55 #define R92C_PWRMODE_UAPSD 6
56 #define R92C_PWRMODE_IBSS 7
57
58 uint8_t smart_ps;
59 /* XXX undocumented */
60 #define R92C_PWRMODE_SMARTPS_NULLDATA 2
61
62 uint8_t bcn_pass; /* unit: beacon interval */
63 } __packed;
64
65 /* Structure for R92C_CMD_RSVD_PAGE. */
66 struct r92c_fw_cmd_rsvdpage {
67 uint8_t probe_resp;
68 uint8_t ps_poll;
69 uint8_t null_data;
70 } __packed;
71
72 /* Structure for R92C_CMD_RSSI_SETTING. */
73 struct r92c_fw_cmd_rssi {
74 uint8_t macid;
75 uint8_t reserved;
76 uint8_t pwdb;
77 } __packed;
78
79 /* Structure for R92C_CMD_MACID_CONFIG. */
80 struct r92c_fw_cmd_macid_cfg {
81 uint32_t mask;
82 uint8_t macid;
83 #define R92C_CMD_MACID_VALID 0x80
84 } __packed;
85
86 /*
87 * C2H event structure.
88 */
89 /* Bigger value is used to prevent buffer overrun. */
90 #define R92C_C2H_MSG_MAX_LEN 16
91
92 struct r92c_c2h_evt {
93 uint8_t evtb0;
94 #define R92C_C2H_EVTB0_ID_M 0x0f
95 #define R92C_C2H_EVTB0_ID_S 0
96 #define R92C_C2H_EVTB0_LEN_M 0xf0
97 #define R92C_C2H_EVTB0_LEN_S 4
98
99 uint8_t seq;
100
101 /* Followed by payload (see below). */
102 } __packed;
103
104 /*
105 * C2H event types.
106 */
107 #define R92C_C2H_EVT_DEBUG 0
108 #define R92C_C2H_EVT_TX_REPORT 3
109 #define R92C_C2H_EVT_EXT_RA_RPT 6
110
111 /* Structure for R92C_C2H_EVT_TX_REPORT event. */
112 struct r92c_c2h_tx_rpt {
113 uint8_t rptb0;
114 #define R92C_RPTB0_RETRY_CNT_M 0x3f
115 #define R92C_RPTB0_RETRY_CNT_S 0
116
117 uint8_t rptb1; /* XXX junk */
118 #define R92C_RPTB1_RTS_RETRY_CNT_M 0x3f
119 #define R92C_RPTB1_RTS_RETRY_CNT_S 0
120
121 uint8_t queue_time_low;
122 uint8_t queue_time_high;
123 uint8_t rptb4;
124 #define R92C_RPTB4_MISSED_PKT_NUM_M 0x1f
125 #define R92C_RPTB4_MISSED_PKT_NUM_S 0
126
127 uint8_t rptb5;
128 #define R92C_RPTB5_MACID_M 0x1f
129 #define R92C_RPTB5_MACID_S 0
130 #define R92C_RPTB5_DES1_FRAGSSN_M 0xe0
131 #define R92C_RPTB5_DES1_FRAGSSN_S 5
132
133 uint8_t rptb6;
134 #define R92C_RPTB6_RPT_PKT_NUM_M 0x1f
135 #define R92C_RPTB6_RPT_PKT_NUM_S 0
136 #define R92C_RPTB6_PKT_DROP 0x20
137 #define R92C_RPTB6_LIFE_EXPIRE 0x40
138 #define R92C_RPTB6_RETRY_OVER 0x80
139
140 uint8_t rptb7;
141 #define R92C_RPTB7_EDCA_M 0x0f
142 #define R92C_RPTB7_EDCA_S 0
143 #define R92C_RPTB7_BMC 0x20
144 #define R92C_RPTB7_PKT_OK 0x40
145 #define R92C_RPTB7_INT_CCX 0x80
146 } __packed;
147
148 #endif /* R92C_FW_CMD_H */
Cache object: f63a6fe11a4d0557b50aa8767b30fe53
|