xref: /freebsd/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
1 /*
2 
3   Broadcom B43 wireless driver
4   IEEE 802.11n PHY data tables
5 
6   Copyright (c) 2008 Michael Buesch <m@bues.ch>
7   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
8 
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18 
19   You should have received a copy of the GNU General Public License
20   along with this program; see the file COPYING.  If not, write to
21   the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
22   Boston, MA 02110-1301, USA.
23 
24 */
25 
26 /*
27  */
28 
29 #ifndef	__IF_BWN_PHY_PPR_H__
30 #define	__IF_BWN_PHY_PPR_H__
31 
32 #define	BWN_PPR_CCK_RATES_NUM		4
33 #define	BWN_PPR_OFDM_RATES_NUM		8
34 #define	BWN_PPR_MCS_RATES_NUM		8
35 
36 #define	BWN_PPR_RATES_NUM	(BWN_PPR_CCK_RATES_NUM +	\
37 				 BWN_PPR_OFDM_RATES_NUM * 2 +	\
38 				 BWN_PPR_MCS_RATES_NUM * 4)
39 
40 struct bwn_ppr_rates {
41 	uint8_t cck[BWN_PPR_CCK_RATES_NUM];
42 	uint8_t ofdm[BWN_PPR_OFDM_RATES_NUM];
43 	uint8_t ofdm_20_cdd[BWN_PPR_OFDM_RATES_NUM];
44 	uint8_t mcs_20[BWN_PPR_MCS_RATES_NUM]; /* single stream rates */
45 	uint8_t mcs_20_cdd[BWN_PPR_MCS_RATES_NUM];
46 	uint8_t mcs_20_stbc[BWN_PPR_MCS_RATES_NUM];
47 	uint8_t mcs_20_sdm[BWN_PPR_MCS_RATES_NUM];
48 };
49 
50 struct bwn_ppr {
51 	/* All powers are in 1/4 dBm (Q5.2) */
52 	union {
53 		uint8_t __all_rates[BWN_PPR_RATES_NUM];
54 		struct bwn_ppr_rates rates;
55 	};
56 };
57 
58 extern	void bwn_ppr_clear(struct bwn_mac *mac, struct bwn_ppr *ppr);
59 extern	void bwn_ppr_add(struct bwn_mac *mac, struct bwn_ppr *ppr, int diff);
60 extern	void bwn_ppr_apply_max(struct bwn_mac *mac, struct bwn_ppr *ppr,
61 	    uint8_t max);
62 extern	void bwn_ppr_apply_min(struct bwn_mac *mac, struct bwn_ppr *ppr,
63 	    uint8_t min);
64 extern	uint8_t bwn_ppr_get_max(struct bwn_mac *mac, struct bwn_ppr *ppr);
65 extern	bool bwn_ppr_load_max_from_sprom(struct bwn_mac *mac,
66 	    struct bwn_ppr *ppr, bwn_phy_band_t band);
67 
68 #endif
69