Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
net
wireless
ath
hw.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 Atheros Communications Inc.
3
*
4
* Permission to use, copy, modify, and/or distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
7
*
8
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
*/
16
17
#include <linux/export.h>
18
#include <asm/unaligned.h>
19
20
#include "
ath.h
"
21
#include "
reg.h
"
22
23
#define REG_READ (common->ops->read)
24
#define REG_WRITE (common->ops->write)
25
118
void
ath_hw_setbssidmask
(
struct
ath_common
*
common
)
119
{
120
void
*
ah
= common->
ah
;
121
122
REG_WRITE
(ah,
get_unaligned_le32
(common->
bssidmask
),
AR_BSSMSKL
);
123
REG_WRITE
(ah, get_unaligned_le16(common->
bssidmask
+ 4),
AR_BSSMSKU
);
124
}
125
EXPORT_SYMBOL
(
ath_hw_setbssidmask
);
126
127
136
void
ath_hw_cycle_counters_update
(
struct
ath_common
*
common
)
137
{
138
u32
cycles,
busy
,
rx
,
tx
;
139
void
*
ah
= common->
ah
;
140
141
/* freeze */
142
REG_WRITE
(ah,
AR_MIBC_FMC
,
AR_MIBC
);
143
144
/* read */
145
cycles =
REG_READ
(ah,
AR_CCCNT
);
146
busy =
REG_READ
(ah,
AR_RCCNT
);
147
rx =
REG_READ
(ah,
AR_RFCNT
);
148
tx =
REG_READ
(ah,
AR_TFCNT
);
149
150
/* clear */
151
REG_WRITE
(ah, 0,
AR_CCCNT
);
152
REG_WRITE
(ah, 0,
AR_RFCNT
);
153
REG_WRITE
(ah, 0,
AR_RCCNT
);
154
REG_WRITE
(ah, 0,
AR_TFCNT
);
155
156
/* unfreeze */
157
REG_WRITE
(ah, 0,
AR_MIBC
);
158
159
/* update all cycle counters here */
160
common->
cc_ani
.cycles += cycles;
161
common->
cc_ani
.rx_busy +=
busy
;
162
common->
cc_ani
.rx_frame +=
rx
;
163
common->
cc_ani
.tx_frame +=
tx
;
164
165
common->
cc_survey
.cycles += cycles;
166
common->
cc_survey
.rx_busy +=
busy
;
167
common->
cc_survey
.rx_frame +=
rx
;
168
common->
cc_survey
.tx_frame +=
tx
;
169
}
170
EXPORT_SYMBOL
(
ath_hw_cycle_counters_update
);
171
172
int32_t
ath_hw_get_listen_time
(
struct
ath_common
*
common
)
173
{
174
struct
ath_cycle_counters
*
cc
= &common->
cc_ani
;
175
int32_t
listen_time;
176
177
listen_time = (cc->
cycles
- cc->
rx_frame
- cc->
tx_frame
) /
178
(common->
clockrate
* 1000);
179
180
memset
(cc, 0,
sizeof
(*cc));
181
182
return
listen_time;
183
}
184
EXPORT_SYMBOL
(
ath_hw_get_listen_time
);
Generated on Thu Jan 10 2013 14:09:15 for Linux Kernel by
1.8.2