2006-01-24 05:59:58 +08:00
|
|
|
/*
|
|
|
|
|
|
|
|
Broadcom BCM43xx wireless driver
|
|
|
|
|
|
|
|
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
|
|
|
|
Stefano Brivio <st3@riseup.net>
|
|
|
|
Michael Buesch <mbuesch@freenet.de>
|
|
|
|
Danny van Dyk <kugelfang@gentoo.org>
|
|
|
|
Andreas Jaggi <andreas.jaggi@waterwave.ch>
|
|
|
|
|
|
|
|
Some parts of the code in this file are derived from the ipw2200
|
|
|
|
driver Copyright(c) 2003 - 2004 Intel Corporation.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BCM43xx_MAIN_H_
|
|
|
|
#define BCM43xx_MAIN_H_
|
|
|
|
|
|
|
|
#include "bcm43xx.h"
|
|
|
|
|
|
|
|
#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
|
|
|
|
#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
|
|
|
|
/* Magic helper macro to pad structures. Ignore those above. It's magic. */
|
|
|
|
#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
|
|
|
|
|
|
|
|
|
|
|
|
/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
|
|
|
|
static inline
|
2006-02-20 05:08:48 +08:00
|
|
|
u8 bcm43xx_freq_to_channel_a(int freq)
|
|
|
|
{
|
|
|
|
return ((freq - 5000) / 5);
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
u8 bcm43xx_freq_to_channel_bg(int freq)
|
2006-01-24 05:59:58 +08:00
|
|
|
{
|
|
|
|
u8 channel;
|
|
|
|
|
2006-02-20 05:08:48 +08:00
|
|
|
if (freq == 2484)
|
|
|
|
channel = 14;
|
|
|
|
else
|
|
|
|
channel = (freq - 2407) / 5;
|
2006-01-24 05:59:58 +08:00
|
|
|
|
|
|
|
return channel;
|
|
|
|
}
|
2006-02-20 05:08:48 +08:00
|
|
|
static inline
|
|
|
|
u8 bcm43xx_freq_to_channel(struct bcm43xx_private *bcm,
|
|
|
|
int freq)
|
|
|
|
{
|
2006-03-14 02:27:34 +08:00
|
|
|
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
2006-02-20 05:08:48 +08:00
|
|
|
return bcm43xx_freq_to_channel_a(freq);
|
|
|
|
return bcm43xx_freq_to_channel_bg(freq);
|
|
|
|
}
|
2006-01-24 05:59:58 +08:00
|
|
|
|
|
|
|
/* Lightweight function to convert a channel number to a frequency (in Mhz). */
|
|
|
|
static inline
|
2006-02-20 05:08:48 +08:00
|
|
|
int bcm43xx_channel_to_freq_a(u8 channel)
|
|
|
|
{
|
|
|
|
return (5000 + (5 * channel));
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
int bcm43xx_channel_to_freq_bg(u8 channel)
|
2006-01-24 05:59:58 +08:00
|
|
|
{
|
|
|
|
int freq;
|
|
|
|
|
2006-02-20 05:08:48 +08:00
|
|
|
if (channel == 14)
|
|
|
|
freq = 2484;
|
|
|
|
else
|
|
|
|
freq = 2407 + (5 * channel);
|
2006-01-24 05:59:58 +08:00
|
|
|
|
|
|
|
return freq;
|
|
|
|
}
|
2006-02-20 05:08:48 +08:00
|
|
|
static inline
|
|
|
|
int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm,
|
|
|
|
u8 channel)
|
|
|
|
{
|
2006-03-14 02:27:34 +08:00
|
|
|
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
2006-02-20 05:08:48 +08:00
|
|
|
return bcm43xx_channel_to_freq_a(channel);
|
|
|
|
return bcm43xx_channel_to_freq_bg(channel);
|
|
|
|
}
|
2006-01-24 05:59:58 +08:00
|
|
|
|
|
|
|
void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf);
|
|
|
|
void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf);
|
|
|
|
|
|
|
|
void bcm43xx_set_iwmode(struct bcm43xx_private *bcm,
|
|
|
|
int iw_mode);
|
|
|
|
|
|
|
|
u32 bcm43xx_shm_read32(struct bcm43xx_private *bcm,
|
|
|
|
u16 routing, u16 offset);
|
|
|
|
u16 bcm43xx_shm_read16(struct bcm43xx_private *bcm,
|
|
|
|
u16 routing, u16 offset);
|
|
|
|
void bcm43xx_shm_write32(struct bcm43xx_private *bcm,
|
|
|
|
u16 routing, u16 offset,
|
|
|
|
u32 value);
|
|
|
|
void bcm43xx_shm_write16(struct bcm43xx_private *bcm,
|
|
|
|
u16 routing, u16 offset,
|
|
|
|
u16 value);
|
|
|
|
|
|
|
|
void bcm43xx_dummy_transmission(struct bcm43xx_private *bcm);
|
|
|
|
|
|
|
|
int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *new_core);
|
|
|
|
|
2006-07-09 04:02:18 +08:00
|
|
|
int bcm43xx_select_wireless_core(struct bcm43xx_private *bcm,
|
|
|
|
int phytype);
|
|
|
|
|
2006-01-24 05:59:58 +08:00
|
|
|
void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy);
|
|
|
|
|
|
|
|
void bcm43xx_mac_suspend(struct bcm43xx_private *bcm);
|
|
|
|
void bcm43xx_mac_enable(struct bcm43xx_private *bcm);
|
|
|
|
|
2007-09-05 03:14:20 +08:00
|
|
|
void bcm43xx_cancel_work(struct bcm43xx_private *bcm);
|
2006-08-21 22:43:44 +08:00
|
|
|
void bcm43xx_periodic_tasks_setup(struct bcm43xx_private *bcm);
|
|
|
|
|
2006-01-24 05:59:58 +08:00
|
|
|
void bcm43xx_controller_restart(struct bcm43xx_private *bcm, const char *reason);
|
|
|
|
|
2006-02-19 21:09:20 +08:00
|
|
|
int bcm43xx_sprom_read(struct bcm43xx_private *bcm, u16 *sprom);
|
|
|
|
int bcm43xx_sprom_write(struct bcm43xx_private *bcm, const u16 *sprom);
|
|
|
|
|
2006-01-24 05:59:58 +08:00
|
|
|
#endif /* BCM43xx_MAIN_H_ */
|