rtwvar.h revision 9aa73b6813b3fd35e78fcc44fd17535e765e504c
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. The name of David Young may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David
* Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
#ifndef _RTWVAR_H_
#define _RTWVAR_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/net80211.h>
#ifndef __func__
#define __func__ ""
#endif
#define RTW_DEBUG_TUNE 0x000001
#define RTW_DEBUG_PKTFILT 0x000002
#define RTW_DEBUG_XMIT 0x000004
#define RTW_DEBUG_DMA 0x000008
#define RTW_DEBUG_NODE 0x000010
#define RTW_DEBUG_PWR 0x000020
#define RTW_DEBUG_ATTACH 0x000040
#define RTW_DEBUG_REGDUMP 0x000080
#define RTW_DEBUG_ACCESS 0x000100
#define RTW_DEBUG_RESET 0x000200
#define RTW_DEBUG_INIT 0x000400
#define RTW_DEBUG_PKTDUMP 0x000800
#define RTW_DEBUG_RECV 0x001000
#define RTW_DEBUG_RECV_DESC 0x002000
#define RTW_DEBUG_IOSTATE 0x004000
#define RTW_DEBUG_INTR 0x008000
#define RTW_DEBUG_PHY 0x010000
#define RTW_DEBUG_PHYIO 0x020000
#define RTW_DEBUG_PHYBITIO 0x040000
#define RTW_DEBUG_TIMEOUT 0x080000
#define RTW_DEBUG_BUGS 0x100000
#define RTW_DEBUG_BEACON 0x200000
#define RTW_DEBUG_WIFICFG 0x400000
#define RTW_DEBUG_80211 0x800000
#define RTW_DEBUG_MAX 0xffffff
#ifdef DEBUG
#define RTW_DPRINTF \
#else /* DEBUG */
#define RTW_DPRINTF
#endif /* DEBUG */
enum rtw_locale {
RTW_LOCALE_USA = 0,
};
enum rtw_rfchipid {
RTW_RFCHIPID_RFMD = 2,
RTW_RFCHIPID_PHILIPS = 3,
RTW_RFCHIPID_MAXIM = 4,
RTW_RFCHIPID_GCT = 5
};
/*
* sc_flags
*/
/*
* all PHY flags
*/
enum rtw_access {RTW_ACCESS_NONE = 0,
RTW_ACCESS_CONFIG = 1,
RTW_ACCESS_ANAPARM = 2};
struct rtw_regs {
enum rtw_access r_access;
};
struct rtw_srom {
};
#define RTW_TXPRILO 0
#define RTW_TXPRIMD 1
#define RTW_TXPRIHI 2
/*
* Note well: the descriptor rings must begin on RTW_DESC_ALIGNMENT
* boundaries. I allocate them consecutively from one buffer, so
* just round up.
*/
#define RTW_NTXDESCLO RTW_TXQLENLO
#define RTW_NTXDESCMD RTW_TXQLENMD
#define RTW_NTXDESCHI RTW_TXQLENHI
#define RTW_NTXDESCBCN RTW_TXQLENBCN
#define RTW_RXQLEN 64
#define RTW_MINC(x, y) (x) = ((x + 1) % y)
typedef struct dma_area {
/* >= product of above */
} dma_area_t; /* 0x50 (80) bytes */
struct rtw_txbuf {
};
struct rtw_rxbuf {
};
struct rtw_txq {
struct rtw_txdesc *txdesc_h;
};
struct rtw_descs {
};
/*
* One Time Unit (TU) is 1Kus = 1024 microseconds.
*/
#define IEEE80211_DUR_TU 1024
/*
* IEEE 802.11b durations for DSSS PHY in microseconds
*/
#define IEEE80211_DUR_DS_LONG_PREAMBLE 144
#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48
#define IEEE80211_DUR_DS_FAST_PLCPHDR 24
#define IEEE80211_DUR_DS_SLOW_ACK 112
#define IEEE80211_DUR_DS_FAST_ACK 56
#define IEEE80211_DUR_DS_SLOW_CTS 112
#define IEEE80211_DUR_DS_FAST_CTS 56
#define IEEE80211_DUR_DS_SLOT 20
#define IEEE80211_DUR_DS_SIFS 10
#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \
#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \
/*
* 802.11 frame duration definitions.
*/
struct rtw_ieee80211_duration {
};
#ifdef RTW_RADIOTAP
/*
* Radio capture format for RTL8180.
*/
#define RTW_RX_RADIOTAP_PRESENT \
((1 << IEEE80211_RADIOTAP_TSFT) | \
(1 << IEEE80211_RADIOTAP_FLAGS) | \
(1 << IEEE80211_RADIOTAP_RATE) | \
(1 << IEEE80211_RADIOTAP_CHANNEL) | \
(1 << IEEE80211_RADIOTAP_LOCK_QUALITY) | \
(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
0)
struct rtw_rx_radiotap_header {
struct ieee80211_radiotap_header rr_ihdr;
} __attribute__((__packed__));
#define RTW_TX_RADIOTAP_PRESENT \
((1 << IEEE80211_RADIOTAP_FLAGS) | \
(1 << IEEE80211_RADIOTAP_RATE) | \
(1 << IEEE80211_RADIOTAP_CHANNEL) | \
0)
struct rtw_tx_radiotap_header {
struct ieee80211_radiotap_header rt_ihdr;
} __attribute__((__packed__));
#endif
struct rtw_hooks {
void *rh_shutdown; /* shutdown hook */
void *rh_power; /* power management hook */
};
typedef void (*rtw_continuous_tx_cb_t)(void *arg, int);
struct rtw_phy {
};
struct rtw_bbpset {
};
struct rtw_rf {
void (*rf_destroy)(struct rtw_rf *);
/*
* args: frequency, txpower, power state
*/
/*
* arg: power state
*/
/*
* arg: frequency
*/
/*
* arg: txpower
*/
void *rf_continuous_tx_arg;
struct rtw_bbpset rf_bbpset;
};
uint32_t);
struct rtw_rfbus {
};
struct rtw_max2820 {
};
struct rtw_sa2400 {
int sa_digphy; /* 1: digital PHY */
};
union rtw_keys {
};
struct rtw_led_state {
#define RTW_LED0 0x1
#define RTW_LED1 0x2
#define RTW_LED_S_RX 0x1
#define RTW_LED_S_TX 0x2
#define RTW_LED_S_SLOW 0x4
};
typedef struct rtw_softc {
enum ieee80211_phymode sc_curmode;
enum rtw_rfchipid sc_rfchipid;
enum rtw_locale sc_locale;
struct rtw_rxdesc *rxdesc_h;
enum rtw_pwrstate sc_pwrstate;
void (*sc_intr_ack)(struct rtw_regs *);
void (*sc_disable)(struct rtw_softc *);
#ifdef RTW_RADIOTAP
union {
struct rtw_rx_radiotap_header tap;
} sc_rxtapu;
union {
struct rtw_tx_radiotap_header tap;
} sc_txtapu;
#endif
int sc_txkey;
struct rtw_led_state sc_led_state;
int sc_hwverid;
int (*sc_newstate)(ieee80211com_t *,
enum ieee80211_state, int);
} rtw_softc_t;
#ifdef __cplusplus
}
#endif
#endif /* _RTWVAR_H_ */