source: ReferenceDesigns/w3_802.11/c/wlan_mac_low_framework/include/wlan_phy_util.h

Last change on this file was 6319, checked in by chunter, 5 years ago

1.8.0 release wlan-mac-se

File size: 2.5 KB
Line 
1/** @file wlan_phy_util.h
2 *  @brief Physical Layer Utility
3 *
4 *  This contains code for configuring low-level parameters in the PHY and hardware.
5 *
6 *  @copyright Copyright 2013-2019, Mango Communications. All rights reserved.
7 *          Distributed under the Mango Communications Reference Design License
8 *                See LICENSE.txt included in the design archive or
9 *                at http://mangocomm.com/802.11/license
10 *
11 *  This file is part of the Mango 802.11 Reference Design (https://mangocomm.com/802.11)
12 */
13
14/*************************** Constant Definitions ****************************/
15#ifndef WLAN_PHY_UTIL_H_
16#define WLAN_PHY_UTIL_H_
17
18#include "xil_types.h"
19
20//Forward declarations
21enum phy_samp_rate_t;
22
23// ****************************************************************************
24// RATE field values for SIGNAL/L-SIG in PHY preamble (IEEE 802.11-2012 18.3.4.2)
25//  DSSS 1M rate code is non-standard, used by our code to indicate DSSS Rx
26#define WLAN_PHY_RATE_DSSS_1M  0x1
27
28// ****************************************************************************
29// Data bytes per OFDM symbol
30//     NOTE:  Values from Table 17-3 of 2007 IEEE 802.11
31//
32#define N_DBPS_R6    24
33#define N_DBPS_R9    36
34#define N_DBPS_R12   48
35#define N_DBPS_R18   72
36#define N_DBPS_R24   96
37#define N_DBPS_R36  144
38#define N_DBPS_R48  192
39#define N_DBPS_R54  216
40
41/**************************** Macro Definitions ******************************/
42
43#define REG_CLEAR_BITS(addr, mask) Xil_Out32(addr, (Xil_In32(addr) & ~(mask)))
44#define REG_SET_BITS(addr, mask)   Xil_Out32(addr, (Xil_In32(addr) | (mask)))
45
46// Macros to calculate the SIGNAL / L-SIG field in the PHY preamble (IEEE 802.11-2012 18.3.4)
47#define WLAN_TX_SIGNAL_CALC(rate, length) (((rate) & 0xF) | (((length) & 0xFFF) << 5) | (WLAN_TX_SIGNAL_PARITY_CALC(rate,length)))
48#define WLAN_TX_SIGNAL_PARITY_CALC(rate, length) ((0x1 & (ones_in_chars[(rate)] + ones_in_chars[(length) & 0xFF] + ones_in_chars[(length) >> 8])) << 17)
49
50/*********************** Global Variable Definitions *************************/
51
52extern const u8    ones_in_chars[256];
53
54/*************************** Function Prototypes *****************************/
55
56// PHY commands
57void write_phy_preamble(u8 pkt_buf, u8 phy_mode, u8 mcs, u16 length);
58
59// Calculate transmit times
60u16 wlan_ofdm_calc_txtime(u16 length, u8 mcs, u8 phy_mode, enum phy_samp_rate_t phy_samp_rate);
61u16 wlan_ofdm_calc_num_payload_syms(u16 length, u8 mcs, u8 phy_mode);
62
63#endif /* WLAN_PHY_UTIL_H_ */
Note: See TracBrowser for help on using the repository browser.