Path: blob/main/sys/dev/ath/ath_hal/ar5210/ar5210_phy.c
39566 views
/*-1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2002-2008 Sam Leffler, Errno Consulting4* Copyright (c) 2002-2004 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 "ar5210/ar5210.h"2425/* shorthands to compact tables for readability */26#define OFDM IEEE80211_T_OFDM27#define TURBO IEEE80211_T_TURBO2829HAL_RATE_TABLE ar5210_11a_table = {308, /* number of rates */31{ 0 },32{33/* short ctrl */34/* valid rateCode Preamble dot11Rate Rate */35/* 6 Mb */ { AH_TRUE, OFDM, 6000, 0x0b, 0x00, (0x80|12), 0 },36/* 9 Mb */ { AH_TRUE, OFDM, 9000, 0x0f, 0x00, 18, 0 },37/* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, (0x80|24), 2 },38/* 18 Mb */ { AH_TRUE, OFDM, 18000, 0x0e, 0x00, 36, 2 },39/* 24 Mb */ { AH_TRUE, OFDM, 24000, 0x09, 0x00, (0x80|48), 4 },40/* 36 Mb */ { AH_TRUE, OFDM, 36000, 0x0d, 0x00, 72, 4 },41/* 48 Mb */ { AH_TRUE, OFDM, 48000, 0x08, 0x00, 96, 4 },42/* 54 Mb */ { AH_TRUE, OFDM, 54000, 0x0c, 0x00, 108, 4 }43},44};4546HAL_RATE_TABLE ar5210_turbo_table = {478, /* number of rates */48{ 0 },49{50/* short ctrl */51/* valid rateCode Preamble dot11Rate Rate */52/* 6 Mb */ { AH_TRUE, TURBO, 12000, 0x0b, 0x00, (0x80|12), 0 },53/* 9 Mb */ { AH_TRUE, TURBO, 18000, 0x0f, 0x00, 18, 0 },54/* 12 Mb */ { AH_TRUE, TURBO, 24000, 0x0a, 0x00, (0x80|24), 2 },55/* 18 Mb */ { AH_TRUE, TURBO, 36000, 0x0e, 0x00, 36, 2 },56/* 24 Mb */ { AH_TRUE, TURBO, 48000, 0x09, 0x00, (0x80|48), 4 },57/* 36 Mb */ { AH_TRUE, TURBO, 72000, 0x0d, 0x00, 72, 4 },58/* 48 Mb */ { AH_TRUE, TURBO, 96000, 0x08, 0x00, 96, 4 },59/* 54 Mb */ { AH_TRUE, TURBO, 108000, 0x0c, 0x00, 108, 4 }60},61};6263#undef OFDM64#undef TURBO6566const HAL_RATE_TABLE *67ar5210GetRateTable(struct ath_hal *ah, u_int mode)68{69HAL_RATE_TABLE *rt;70switch (mode) {71case HAL_MODE_11A:72rt = &ar5210_11a_table;73break;74case HAL_MODE_TURBO:75rt = &ar5210_turbo_table;76break;77default:78HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid mode 0x%x\n",79__func__, mode);80return AH_NULL;81}82ath_hal_setupratetable(ah, rt);83return rt;84}858687