Path: blob/main/sys/dev/ath/ath_hal/ar5211/ar5211_phy.c
39566 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2008 Sam Leffler, Errno Consulting4* Copyright (c) 2002-2006 Atheros Communications, Inc.5*6* Permission to use, copy, modify, and/or distribute this software for any7* purpose with or without fee is hereby granted, provided that the above8* copyright notice and this permission notice appear in all copies.9*10* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES11* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF12* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR13* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES14* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN15* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF16* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.17*/18#include "opt_ah.h"1920#include "ah.h"21#include "ah_internal.h"2223#include "ar5211/ar5211.h"2425/* shorthands to compact tables for readability */26#define OFDM IEEE80211_T_OFDM27#define CCK IEEE80211_T_CCK28#define TURBO IEEE80211_T_TURBO2930HAL_RATE_TABLE ar5211_11a_table = {318, /* number of rates */32{ 0 },33{34/* short ctrl */35/* valid rateCode Preamble dot11Rate Rate */36/* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 },37/* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 },38/* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 },39/* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 },40/* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 },41/* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 },42/* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 },43/* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 }44},45};4647HAL_RATE_TABLE ar5211_turbo_table = {488, /* number of rates */49{ 0 },50{51/* short ctrl */52/* valid rateCode Preamble dot11Rate Rate */53/* 6 Mb */ { AH_TRUE, TURBO, 12000, 0x0b, 0x00, (0x80|12), 0 },54/* 9 Mb */ { AH_TRUE, TURBO, 18000, 0x0f, 0x00, 18, 0 },55/* 12 Mb */ { AH_TRUE, TURBO, 24000, 0x0a, 0x00, (0x80|24), 2 },56/* 18 Mb */ { AH_TRUE, TURBO, 36000, 0x0e, 0x00, 36, 2 },57/* 24 Mb */ { AH_TRUE, TURBO, 48000, 0x09, 0x00, (0x80|48), 4 },58/* 36 Mb */ { AH_TRUE, TURBO, 72000, 0x0d, 0x00, 72, 4 },59/* 48 Mb */ { AH_TRUE, TURBO, 96000, 0x08, 0x00, 96, 4 },60/* 54 Mb */ { AH_TRUE, TURBO, 108000, 0x0c, 0x00, 108, 4 }61},62};6364HAL_RATE_TABLE ar5211_11b_table = {654, /* number of rates */66{ 0 },67{68/* short ctrl */69/* valid rateCode Preamble dot11Rate Rate */70/* 1 Mb */ { AH_TRUE, CCK, 1000, 0x0b, 0x00, (0x80| 2), 0 },71/* 2 Mb */ { AH_TRUE, CCK, 2000, 0x0a, 0x04, (0x80| 4), 1 },72/* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x09, 0x04, (0x80|11), 1 },73/* 11 Mb */ { AH_TRUE, CCK, 11000, 0x08, 0x04, (0x80|22), 1 }74},75};7677#undef OFDM78#undef CCK79#undef TURBO8081const HAL_RATE_TABLE *82ar5211GetRateTable(struct ath_hal *ah, u_int mode)83{84HAL_RATE_TABLE *rt;85switch (mode) {86case HAL_MODE_11A:87rt = &ar5211_11a_table;88break;89case HAL_MODE_11B:90rt = &ar5211_11b_table;91break;92case HAL_MODE_TURBO:93rt = &ar5211_turbo_table;94break;95default:96HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n",97__func__, mode);98return AH_NULL;99}100ath_hal_setupratetable(ah, rt);101return rt;102}103104105