/*
Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
<http://rt2x00.serialmonkey.com>
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; if not, write to the
Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
Module: rt2x00
Abstract: rt2x00 global information.
*/
#ifndef RT2X00_H
#define RT2X00_H
#include <linux/bitops.h>
#include <linux/interrupt.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
#include <linux/firmware.h>
#include <linux/leds.h>
#include <linux/mutex.h>
#include <linux/etherdevice.h>
#include <linux/input-polldev.h>
#include <linux/kfifo.h>
#include <linux/hrtimer.h>
#include <net/mac80211.h>
#include "rt2x00debug.h"
#include "rt2x00dump.h"
#include "rt2x00leds.h"
#include "rt2x00reg.h"
#include "rt2x00queue.h"
/*
* Module information.
*/
#define DRV_VERSION "2.3.0"
#define DRV_PROJECT "http://rt2x00.serialmonkey.com"
/* Debug definitions.
* Debug output has to be enabled during compile time.
*/
#ifdef CONFIG_RT2X00_DEBUG
#define DEBUG
#endif /* CONFIG_RT2X00_DEBUG */
/* Utility printing macros
* rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
*/
#define rt2x00_probe_err(fmt, ...) \
printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \
__func__, ##__VA_ARGS__)
#define rt2x00_err(dev, fmt, ...) \
wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \
__func__, ##__VA_ARGS__)
#define rt2x00_warn(dev, fmt, ...) \
wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \
__func__, ##__VA_ARGS__)
#define rt2x00_info(dev, fmt, ...) \
wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \
__func__, ##__VA_ARGS__)
/* Various debug levels */
#define rt2x00_dbg(dev, fmt, ...) \
wiphy_dbg((dev)->hw->wiphy, "%s: Debug - " fmt, \
__func__, ##__VA_ARGS__)
#define rt2x00_eeprom_dbg(dev, fmt, ...) \
wiphy_dbg((dev)->hw->wiphy, "%s: EEPROM recovery - " fmt, \
__func__, ##__VA_ARGS__)
/*
* Duration calculations
* The rate variable passed is: 100kbs.
* To convert from bytes to bits we multiply size with 8,
* then the size is multiplied with 10 to make the
* real rate -> rate argument correction.
*/
#define GET_DURATION(__size, __rate) (((__size) * 8 * 10) / (__rate))
#define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate))
/*
* Determine the number of L2 padding bytes required between the header and
* the payload.
*/
#define L2PAD_SIZE(__hdrlen) (-(__hdrlen) & 3)
/*
* Determine the alignment requirement,
* to make sure the 802.11 payload is padded to a 4-byte boundrary
* we must determine the address of the payload and calculate the
* amount of bytes needed to move the data.
*/
#define ALIGN_SIZE(__skb, __header) \
( ((unsigned long)((__skb)->data + (__header))) & 3 )
/*
* Constants for extra TX headroom for alignment purposes.
*/
#define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */
#define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */
/*
* Standard timing and size defines.
* These values should follow the ieee80211 specifications.
*/
#define ACK_SIZE 14
#define IEEE80211_HEADER 24
#define PLCP 48
#define BEACON 100
#define PREAMBLE 144
#define SHORT_PREAMBLE 72
#define SLOT_TIME 20
#define SHORT_SLOT_TIME 9
#define SIFS 10
#define PIFS ( SIFS + SLOT_TIME )
#define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME )
#define DIFS ( PIFS + SLOT_TIME )
#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME )