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