xref: /freebsd/sys/dev/rtwn/rtl8192e/r92e_rom_image.h (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
1 /*-
2  * Copyright (c) 2017 Kevin Lo <kevlo@FreeBSD.org>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  *
16  * $FreeBSD$
17  */
18 
19 #ifndef R92E_ROM_IMAGE_H
20 #define R92E_ROM_IMAGE_H
21 
22 #include <dev/rtwn/rtl8192e/r92e_rom_defs.h>
23 
24 #define	R92E_DEF_TX_PWR_2G		0x2d
25 #define	R92E_DEF_TX_PWR_HT20_DIFF	0x02
26 #define	R92E_DEF_TX_PWR_DIFF		0xfe
27 
28 struct r92e_tx_pwr_2g {
29 	uint8_t		cck[R92E_GROUP_2G];
30 	uint8_t		ht40[R92E_GROUP_2G - 1];
31 } __packed;
32 
33 struct r92e_tx_pwr_diff_2g {
34 	uint8_t		ht20_ofdm;
35 	struct {
36 		uint8_t	ht40_ht20;
37 		uint8_t	ofdm_cck;
38 	} __packed	diff123[R92E_MAX_TX_COUNT - 1];
39 } __packed;
40 
41 struct r92e_tx_pwr {
42 	struct r92e_tx_pwr_2g		pwr_2g;
43 	struct r92e_tx_pwr_diff_2g	pwr_diff_2g;
44 	uint8_t				reserved[24];
45 } __packed;
46 
47 /*
48  * RTL8192EU ROM image.
49  */
50 struct r92e_rom {
51 	uint8_t			reserved1[16];
52 	struct r92e_tx_pwr	tx_pwr[R92E_MAX_RF_PATH];
53 	uint8_t			channel_plan;
54 	uint8_t			crystalcap;
55 #define R92E_ROM_CRYSTALCAP_DEF		0x20
56 
57 	uint8_t			thermal_meter;
58 	uint8_t			iqk_lck;
59 	uint8_t			pa_type;
60 	uint8_t			lna_type_2g;
61 	uint8_t			reserved2;
62 	uint8_t			lna_type_5g;
63 	uint8_t			reserved3;
64 	uint8_t			rf_board_opt;
65 	uint8_t			rf_feature_opt;
66 	uint8_t			rf_bt_opt;
67 	uint8_t			version;
68 	uint8_t			customer_id;
69 	uint8_t			tx_bbswing_2g;
70 	uint8_t			tx_bbswing_5g;
71 	uint8_t			tx_pwr_calib_rate;
72 	uint8_t			rf_ant_opt;
73 	uint8_t			rfe_option;
74 	uint8_t			reserved4[5];
75 	uint16_t		vid;
76 	uint16_t		pid;
77 	uint8_t			reserved5[3];
78 	uint8_t			macaddr[IEEE80211_ADDR_LEN];
79 	uint8_t			reserved6[2];
80 	uint8_t			string[7];	/* "Realtek" */
81 	uint8_t			reserved7[282];
82 } __packed;
83 
84 _Static_assert(sizeof(struct r92e_rom) == R92E_EFUSE_MAP_LEN,
85     "R92E_EFUSE_MAP_LEN must be equal to sizeof(struct r92e_rom)!");
86 
87 #endif	/* R92E_ROM_IMAGE_H */
88