xref: /freebsd/sys/dev/rtwn/rtl8188e/r88e_rom_image.h (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
1 /*-
2  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@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 R88E_ROM_IMAGE_H
20 #define R88E_ROM_IMAGE_H
21 
22 #include <dev/rtwn/rtl8188e/r88e_rom_defs.h>
23 
24 /*
25  * RTL8188EU ROM image.
26  */
27 struct r88e_rom {
28 	uint8_t		reserved1[16];
29 	uint8_t		cck_tx_pwr[R88E_GROUP_2G];
30 	uint8_t		ht40_tx_pwr[R88E_GROUP_2G - 1];
31 	uint8_t		tx_pwr_diff;
32 	uint8_t		reserved2[156];
33 	uint8_t		channel_plan;
34 	uint8_t		crystalcap;
35 #define R88E_ROM_CRYSTALCAP_DEF		0x20
36 
37 	uint8_t		thermal_meter;
38 	uint8_t		reserved3[6];
39 	uint8_t		rf_board_opt;
40 	uint8_t		rf_feature_opt;
41 	uint8_t		rf_bt_opt;
42 	uint8_t		version;
43 	uint8_t		customer_id;
44 	uint8_t		reserved4[3];
45 	uint8_t		rf_ant_opt;
46 	uint8_t		reserved5[6];
47 
48 	union {
49 		struct {
50 			uint16_t	vid;
51 			uint16_t	pid;
52 			uint8_t		usb_opt;
53 			uint8_t		reserved6[2];
54 			uint8_t		macaddr[IEEE80211_ADDR_LEN];
55 		} __packed usb;
56 
57 		struct {
58 			uint8_t		macaddr[IEEE80211_ADDR_LEN];
59 			uint16_t	vid;
60 			uint16_t	pid;
61 			uint8_t		reserved6[3];
62 		} __packed pci;
63 	} __packed diff_d0;
64 
65 	uint8_t		reserved7[2];
66 	uint8_t		string[33];	/* "realtek 802.11n NIC" */
67 	uint8_t		reserved8[256];
68 } __packed;
69 
70 _Static_assert(sizeof(struct r88e_rom) == R88E_EFUSE_MAP_LEN,
71     "R88E_EFUSE_MAP_LEN must be equal to sizeof(struct r88e_rom)!");
72 
73 #endif	/* R88E_ROM_IMAGE_H */
74