iPXE
ath9k_common.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2011 Atheros Communications Inc.
3 *
4 * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
5 * Original from Linux kernel 3.0.1
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20FILE_SECBOOT ( FORBIDDEN );
21
22/*
23 * Module for common driver code between ath9k and ath9k_htc
24 */
25
26#include "common.h"
27
28/*
29 * Update internal channel flags.
30 */
32 struct net80211_channel *chan)
33{
34 ichan->channel = chan->center_freq;
35 ichan->chan = chan;
36
37 if (chan->band == NET80211_BAND_2GHZ) {
38 ichan->chanmode = CHANNEL_G;
40 } else {
41 ichan->chanmode = CHANNEL_A;
43 }
44}
45
46/*
47 * Get the internal channel reference.
48 */
50 struct ath_hw *ah)
51{
52 struct net80211_channel *curchan = dev->channels + dev->channel;
53 struct ath9k_channel *channel;
54 u8 chan_idx;
55
56 chan_idx = curchan->hw_value;
57 channel = &ah->channels[chan_idx];
59
60 return channel;
61}
62
63void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
64 u16 new_txpow, u16 *txpower)
65{
66 if (cur_txpow != new_txpow) {
67 ath9k_hw_set_txpowerlimit(ah, new_txpow, 0);
68 /* read back in case value is clamped */
70 }
71}
#define CHANNEL_5GHZ
Definition ath5k.h:635
#define CHANNEL_OFDM
Definition ath5k.h:633
#define CHANNEL_G
Definition ath5k.h:642
#define CHANNEL_A
Definition ath5k.h:640
#define CHANNEL_2GHZ
Definition ath5k.h:634
void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, struct net80211_channel *chan)
struct ath9k_channel * ath9k_cmn_get_curchannel(struct net80211_device *dev, struct ath_hw *ah)
void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, u16 new_txpow, u16 *txpower)
void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, int test)
Definition ath9k_hw.c:1939
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition net80211.h:45
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition hw.h:875
#define u8
Definition igbvf_osdep.h:40
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
uint8_t ah
Definition registers.h:1
u16 channel
Definition hw.h:350
u32 chanmode
Definition hw.h:352
struct net80211_channel * chan
Definition hw.h:348
u32 channelFlags
Definition hw.h:351
Definition hw.h:657
int16_t power_limit
Definition ath.h:145
An 802.11 RF channel.
Definition net80211.h:386
u16 hw_value
Hardware channel value.
Definition net80211.h:414
u16 center_freq
The center frequency for this channel.
Definition net80211.h:411
u8 band
The band with which this channel is associated.
Definition net80211.h:388
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812
#define u16
Definition vga.h:20