1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2/* Copyright(c) 2007 - 2011 Realtek Corporation. */ 3 4#ifndef __HAL_COMMON_H__ 5#define __HAL_COMMON_H__ 6 7/* */ 8/* Rate Definition */ 9/* */ 10/* CCK */ 11#define RATR_1M 0x00000001 12#define RATR_2M 0x00000002 13#define RATR_55M 0x00000004 14#define RATR_11M 0x00000008 15/* OFDM */ 16#define RATR_6M 0x00000010 17#define RATR_9M 0x00000020 18#define RATR_12M 0x00000040 19#define RATR_18M 0x00000080 20#define RATR_24M 0x00000100 21#define RATR_36M 0x00000200 22#define RATR_48M 0x00000400 23#define RATR_54M 0x00000800 24/* MCS 1 Spatial Stream */ 25#define RATR_MCS0 0x00001000 26#define RATR_MCS1 0x00002000 27#define RATR_MCS2 0x00004000 28#define RATR_MCS3 0x00008000 29#define RATR_MCS4 0x00010000 30#define RATR_MCS5 0x00020000 31#define RATR_MCS6 0x00040000 32#define RATR_MCS7 0x00080000 33/* MCS 2 Spatial Stream */ 34#define RATR_MCS8 0x00100000 35#define RATR_MCS9 0x00200000 36#define RATR_MCS10 0x00400000 37#define RATR_MCS11 0x00800000 38#define RATR_MCS12 0x01000000 39#define RATR_MCS13 0x02000000 40#define RATR_MCS14 0x04000000 41#define RATR_MCS15 0x08000000 42 43/* CCK */ 44#define RATE_1M BIT(0) 45#define RATE_2M BIT(1) 46#define RATE_5_5M BIT(2) 47#define RATE_11M BIT(3) 48/* OFDM */ 49#define RATE_6M BIT(4) 50#define RATE_9M BIT(5) 51#define RATE_12M BIT(6) 52#define RATE_18M BIT(7) 53#define RATE_24M BIT(8) 54#define RATE_36M BIT(9) 55#define RATE_48M BIT(10) 56#define RATE_54M BIT(11) 57/* MCS 1 Spatial Stream */ 58#define RATE_MCS0 BIT(12) 59#define RATE_MCS1 BIT(13) 60#define RATE_MCS2 BIT(14) 61#define RATE_MCS3 BIT(15) 62#define RATE_MCS4 BIT(16) 63#define RATE_MCS5 BIT(17) 64#define RATE_MCS6 BIT(18) 65#define RATE_MCS7 BIT(19) 66/* MCS 2 Spatial Stream */ 67#define RATE_MCS8 BIT(20) 68#define RATE_MCS9 BIT(21) 69#define RATE_MCS10 BIT(22) 70#define RATE_MCS11 BIT(23) 71#define RATE_MCS12 BIT(24) 72#define RATE_MCS13 BIT(25) 73#define RATE_MCS14 BIT(26) 74#define RATE_MCS15 BIT(27) 75 76/* ALL CCK Rate */ 77#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) 78#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | RATR_18M | \ 79 RATR_24M | RATR_36M | RATR_48M | RATR_54M) 80#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | \ 81 RATR_MCS3 | RATR_MCS4 | RATR_MCS5|RATR_MCS6 | \ 82 RATR_MCS7) 83#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ 84 RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ 85 RATR_MCS14 | RATR_MCS15) 86 87/*------------------------------ Tx Desc definition Macro --------------------*/ 88/* pragma mark -- Tx Desc related definition. -- */ 89/* Rate */ 90/* CCK Rates, TxHT = 0 */ 91#define DESC_RATE1M 0x00 92#define DESC_RATE2M 0x01 93#define DESC_RATE5_5M 0x02 94#define DESC_RATE11M 0x03 95 96/* OFDM Rates, TxHT = 0 */ 97#define DESC_RATE6M 0x04 98#define DESC_RATE9M 0x05 99#define DESC_RATE12M 0x06 100#define DESC_RATE18M 0x07 101#define DESC_RATE24M 0x08 102#define DESC_RATE36M 0x09 103#define DESC_RATE48M 0x0a 104#define DESC_RATE54M 0x0b 105 106/* MCS Rates, TxHT = 1 */ 107#define DESC_RATEMCS0 0x0c 108#define DESC_RATEMCS1 0x0d 109#define DESC_RATEMCS2 0x0e 110#define DESC_RATEMCS3 0x0f 111#define DESC_RATEMCS4 0x10 112#define DESC_RATEMCS5 0x11 113#define DESC_RATEMCS6 0x12 114#define DESC_RATEMCS7 0x13 115#define DESC_RATEMCS8 0x14 116#define DESC_RATEMCS9 0x15 117#define DESC_RATEMCS10 0x16 118#define DESC_RATEMCS11 0x17 119#define DESC_RATEMCS12 0x18 120#define DESC_RATEMCS13 0x19 121#define DESC_RATEMCS14 0x1a 122#define DESC_RATEMCS15 0x1b 123#define DESC_RATEMCS15_SG 0x1c 124#define DESC_RATEMCS32 0x20 125 126/* 1 Byte long (in unit of TU) */ 127#define REG_P2P_CTWIN 0x0572 128#define REG_NOA_DESC_SEL 0x05CF 129#define REG_NOA_DESC_DURATION 0x05E0 130#define REG_NOA_DESC_INTERVAL 0x05E4 131#define REG_NOA_DESC_START 0x05E8 132#define REG_NOA_DESC_COUNT 0x05EC 133 134#include "HalVerDef.h" 135void dump_chip_info(struct HAL_VERSION ChipVersion); 136 137/* return the final channel plan decision */ 138u8 hal_com_get_channel_plan(struct adapter *padapter, 139 u8 hw_channel_plan, 140 u8 sw_channel_plan, 141 u8 def_channel_plan, 142 bool AutoLoadFail 143); 144 145u8 MRateToHwRate(u8 rate); 146 147void HalSetBrateCfg(struct adapter *Adapter, u8 *mBratesOS, u16 *pBrateCfg); 148 149bool Hal_MappingOutPipe(struct adapter *pAdapter, u8 NumOutPipe); 150 151void hal_init_macaddr(struct adapter *adapter); 152 153void c2h_evt_clear(struct adapter *adapter); 154s32 c2h_evt_read(struct adapter *adapter, u8 *buf); 155 156#endif /* __HAL_COMMON_H__ */ 157