xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_rx_desc.h (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1 /*-
2  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
3  * Copyright (c) 2015-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_RX_DESC_H
21 #define R88E_RX_DESC_H
22 
23 #include <dev/rtwn/rtl8192c/r92c_rx_desc.h>
24 
25 /* Rx MAC descriptor defines (chip-specific). */
26 /* Rx dword 3 */
27 #define R88E_RXDW3_RPT_M	0x0000c000
28 #define R88E_RXDW3_RPT_S	14
29 #define R88E_RXDW3_RPT_RX	0
30 #define R88E_RXDW3_RPT_TX1	1
31 #define R88E_RXDW3_RPT_TX2	2
32 #define R88E_RXDW3_RPT_HIS	3
33 
34 /* Rx PHY descriptor. */
35 struct r88e_rx_phystat {
36 	uint8_t		path_agc[2];
37 	uint8_t		chan;
38 	uint8_t		reserved1;
39 	uint8_t		sig_qual;
40 	uint8_t		agc_rpt;
41 	uint8_t		rpt_b;
42 	uint8_t		reserved2;
43 	uint8_t		noise_power;
44 	uint8_t		path_cfotail[2];
45 	uint8_t		pcts_mask[2];
46 	uint8_t		stream_rxevm[2];
47 	uint8_t		path_rxsnr[2];
48 	uint8_t		noise_power_db_lsb;
49 	uint8_t		reserved3[3];
50 	uint8_t		stream_csi[2];
51 	uint8_t		stream_target_csi[2];
52 	uint8_t		sig_evm;
53 } __packed;
54 
55 /* Tx report (type 1). */
56 struct r88e_tx_rpt_ccx {
57 	uint8_t		rptb0;
58 #define R88E_RPTB6_PKT_NUM_M	0x0e
59 #define R88E_RPTB6_PKT_NUM_S	1
60 #define R88E_RPTB0_INT_CCX	0x80
61 
62 	uint8_t		rptb1;
63 #define R88E_RPTB1_MACID_M	0x3f
64 #define R88E_RPTB1_MACID_S	0
65 #define R88E_RPTB1_PKT_OK	0x40
66 #define R88E_RPTB1_BMC		0x80
67 
68 	uint8_t		rptb2;
69 #define R88E_RPTB2_RETRY_CNT_M	0x3f
70 #define R88E_RPTB2_RETRY_CNT_S	0
71 #define R88E_RPTB2_LIFE_EXPIRE	0x40
72 #define R88E_RPTB2_RETRY_OVER	0x80
73 
74 	uint8_t		queue_time_low;
75 	uint8_t		queue_time_high;
76 	uint8_t		final_rate;
77 	uint8_t		rptb6;
78 #define R88E_RPTB6_QSEL_M	0xf0
79 #define R88E_RPTB6_QSEL_S	4
80 
81 	uint8_t		rptb7;
82 } __packed;
83 
84 /* Interrupt message format. */
85 /* XXX recheck */
86 struct r88e_intr_msg {
87 	uint8_t		c2h_id;
88 	uint8_t		c2h_seq;
89 	uint8_t		c2h_evt;
90 	uint8_t		reserved1[13];
91 	uint8_t		cpwm1;
92 	uint8_t		reserved2[3];
93 	uint8_t		cpwm2;
94 	uint8_t		reserved3[27];
95 	uint32_t	hisr;
96 	uint32_t	hisr_ex;
97 };
98 
99 #endif	/* R88E_RX_DESC_H */
100