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 * $FreeBSD$
28 */
29
30#ifndef	__IF_BWN_PHY_PPR_H__
31#define	__IF_BWN_PHY_PPR_H__
32
33#define	BWN_PPR_CCK_RATES_NUM		4
34#define	BWN_PPR_OFDM_RATES_NUM		8
35#define	BWN_PPR_MCS_RATES_NUM		8
36
37#define	BWN_PPR_RATES_NUM	(BWN_PPR_CCK_RATES_NUM +	\
38				 BWN_PPR_OFDM_RATES_NUM * 2 +	\
39				 BWN_PPR_MCS_RATES_NUM * 4)
40
41struct bwn_ppr_rates {
42	uint8_t cck[BWN_PPR_CCK_RATES_NUM];
43	uint8_t ofdm[BWN_PPR_OFDM_RATES_NUM];
44	uint8_t ofdm_20_cdd[BWN_PPR_OFDM_RATES_NUM];
45	uint8_t mcs_20[BWN_PPR_MCS_RATES_NUM]; /* single stream rates */
46	uint8_t mcs_20_cdd[BWN_PPR_MCS_RATES_NUM];
47	uint8_t mcs_20_stbc[BWN_PPR_MCS_RATES_NUM];
48	uint8_t mcs_20_sdm[BWN_PPR_MCS_RATES_NUM];
49};
50
51struct bwn_ppr {
52	/* All powers are in 1/4 dBm (Q5.2) */
53	union {
54		uint8_t __all_rates[BWN_PPR_RATES_NUM];
55		struct bwn_ppr_rates rates;
56	};
57};
58
59extern	void bwn_ppr_clear(struct bwn_mac *mac, struct bwn_ppr *ppr);
60extern	void bwn_ppr_add(struct bwn_mac *mac, struct bwn_ppr *ppr, int diff);
61extern	void bwn_ppr_apply_max(struct bwn_mac *mac, struct bwn_ppr *ppr,
62	    uint8_t max);
63extern	void bwn_ppr_apply_min(struct bwn_mac *mac, struct bwn_ppr *ppr,
64	    uint8_t min);
65extern	uint8_t bwn_ppr_get_max(struct bwn_mac *mac, struct bwn_ppr *ppr);
66extern	bool bwn_ppr_load_max_from_sprom(struct bwn_mac *mac,
67	    struct bwn_ppr *ppr, bwn_phy_band_t band);
68
69#endif
70