Move the register access mode into struct rtw_regs. Change

rtw_set_access, rtw_set_access1 to match.

Add a subroutine for setting WEP keys.  WEP isn't quite finished,
because I have to add the WEP header to Tx packets.  Implement the
SIOCS80211NWKEY ioctl for setting WEP keys.

Program the LEDs based on operating state and packet activity.

 * On a Revision F RTL8180, blink LED1 at 1Hz to indicate
   scan/authenticate/associate states.  In the run state, turn LED1
   on.  In every state, blink LED1 at 5Hz to indicate non-beacon
   tx/rx activity.  I would like to use two LEDs, but in all my
   Rev. F instances, LED0 is not wired to an LED; instead, the
   first LED is wired to indicate that the card's power is on.

 * On a Revision D RTL8180, program the LEDs so that LED0 indicates
   Tx, and LED1 indicates Rx.  The Rx LED will blink annoyingly if
   there are beacons in the air, but at least the Tx LED is useful.

 * Store the hardware revision in the softc to support my futile
   attempt at programming LEDs for both Rev. D and Rev. F parts;
   I never did get Rev. D LEDs to work right.

 * Add a debug flag RTW_DEBUG_LED for the LED transitions.

Add RTW_TPPOLL_ALL, RTW_TPPOLL_SALL to start and stop, respectively,
all of the transmit rings.

In ad hoc mode, allocate a beacon and load it into the beacon ring.
Start the ring.  In one trial, the card re-transmitted the beacon
ring's contents several times before stopping.  More programming
and testing for ad hoc mode is necessary.  I'm not setting the
beacon flag in the transmit descriptor.

Revamp the transmit section to make better use of all the transmit
rings:  beacon queue, high-, low-, and medium-priority rings.  Put
beacon frames on the beacon ring.  All other management frames,
and data frames, go on the medium-priority ring.  Power-save data
frames go on the high-priority ring.  (Note that powersaving is
not implemented!)  This is a work in progress.

Send all 802.11 Management frames at 1Mbps.

After we put a packet on a transmit ring, tickle the right bit in
the TPPOLL to tell RTL8180.  Stop all rings on error and in rtw_stop.

Use the RF chip type, not the RTL8180 revision, to choose between
host- and MAC-controlled RF serial I/O.  Now the Netgear MA521
works.

Remove bogus definition of bit RTW_TPPOLL_FSWINT.
This commit is contained in:
dyoung 2005-01-16 11:50:43 +00:00
parent 500260511f
commit 55940f7c4e
3 changed files with 636 additions and 126 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtwreg.h,v 1.11 2005/01/14 10:13:55 dyoung Exp $ */
/* $NetBSD: rtwreg.h,v 1.12 2005/01/16 11:50:43 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -193,8 +193,9 @@
/* Convenient interrupt conjunctions. */
#define RTW_INTR_RX (RTW_INTR_RER|RTW_INTR_ROK)
#define RTW_INTR_TX (RTW_INTR_TLPDER|RTW_INTR_TLPDOK|RTW_INTR_THPDER|\
RTW_INTR_THPDOK|RTW_INTR_TNPDER|RTW_INTR_TNPDOK)
#define RTW_INTR_BEACON (RTW_INTR_TBDER|RTW_INTR_TBDOK|RTW_INTR_BCNINT)
RTW_INTR_THPDOK|RTW_INTR_TNPDER|RTW_INTR_TNPDOK|\
RTW_INTR_TBDER|RTW_INTR_TBDOK)
#define RTW_INTR_BEACON (RTW_INTR_BCNINT)
#define RTW_INTR_IOERROR (RTW_INTR_TXFOVW|RTW_INTR_RXFOVW|RTW_INTR_RDU)
#define RTW_TCR 0x40 /* Transmit Configuration Register, 32b */
@ -774,10 +775,13 @@
#define RTW_TPPOLL_SLPQ BIT(0) /* Host writes 1 to tell RTL8180 to
* stop low-priority DMA.
*/
#define RTW_TPPOLL_FSWINT BIT(0) /* Force software interrupt. From
* reference driver.
*/
/* Start all queues. */
#define RTW_TPPOLL_ALL (RTW_TPPOLL_BQ | RTW_TPPOLL_HPQ | \
RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ)
/* Stop all queues. */
#define RTW_TPPOLL_SALL (RTW_TPPOLL_SBQ | RTW_TPPOLL_SHPQ | \
RTW_TPPOLL_SNPQ | RTW_TPPOLL_SLPQ)
#define RTW_CWR 0xdc /* Contention Window Register, 16b, read-only */
/* Contention Window: indicates number of contention windows before Tx

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtwvar.h,v 1.18 2005/01/03 03:25:06 dyoung Exp $ */
/* $NetBSD: rtwvar.h,v 1.19 2005/01/16 11:50:43 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -58,7 +58,9 @@
#define RTW_DEBUG_PHYBITIO 0x040000
#define RTW_DEBUG_TIMEOUT 0x080000
#define RTW_DEBUG_BUGS 0x100000
#define RTW_DEBUG_MAX 0x1fffff
#define RTW_DEBUG_BEACON 0x200000
#define RTW_DEBUG_LED 0x400000
#define RTW_DEBUG_MAX 0x7fffff
extern int rtw_debug;
#define RTW_DPRINTF(__flags, __x) \
@ -101,9 +103,14 @@ enum rtw_rfchipid {
/* all PHY flags */
#define RTW_F_ALLPHY (RTW_F_DIGPHY|RTW_F_DFLANTB|RTW_F_ANTDIV)
enum rtw_access {RTW_ACCESS_NONE = 0,
RTW_ACCESS_CONFIG = 1,
RTW_ACCESS_ANAPARM = 2};
struct rtw_regs {
bus_space_tag_t r_bt;
bus_space_handle_t r_bh;
enum rtw_access r_access;
};
#define RTW_SR_GET(sr, ofs) \
@ -196,6 +203,7 @@ struct rtw_txsoft_blk {
u_int tsb_ndesc;
int tsb_tx_timer;
struct rtw_txsoft *tsb_desc;
uint8_t tsb_poll;
};
struct rtw_descs {
@ -368,9 +376,28 @@ struct rtw_sa2400 {
typedef void (*rtw_pwrstate_t)(struct rtw_regs *, enum rtw_pwrstate, int, int);
enum rtw_access {RTW_ACCESS_NONE = 0,
RTW_ACCESS_CONFIG = 1,
RTW_ACCESS_ANAPARM = 2};
union rtw_keys {
uint8_t rk_keys[4][16];
uint32_t rk_words[16];
};
#define RTW_LED_SLOW_TICKS MAX(1, hz/2)
#define RTW_LED_FAST_TICKS MAX(1, hz/10)
struct rtw_led_state {
#define RTW_LED0 0x1
#define RTW_LED1 0x2
uint8_t ls_slowblink:2;
uint8_t ls_actblink:2;
uint8_t ls_default:2;
uint8_t ls_state;
uint8_t ls_event;
#define RTW_LED_S_RX 0x1
#define RTW_LED_S_TX 0x2
#define RTW_LED_S_SLOW 0x4
struct callout ls_slow_ch;
struct callout ls_fast_ch;
};
struct rtw_softc {
struct device sc_dev;
@ -441,7 +468,11 @@ struct rtw_softc {
struct rtw_tx_radiotap_header tap;
uint8_t pad[64];
} sc_txtapu;
enum rtw_access sc_access;
union rtw_keys sc_keys;
int sc_txkey;
struct ifqueue sc_beaconq;
struct rtw_led_state sc_led_state;
int sc_hwverid;
};
#define sc_if sc_ic.ic_if
@ -454,7 +485,7 @@ void rtw_txdac_enable(struct rtw_softc *, int);
void rtw_anaparm_enable(struct rtw_regs *, int);
void rtw_config0123_enable(struct rtw_regs *, int);
void rtw_continuous_tx_enable(struct rtw_softc *, int);
void rtw_set_access(struct rtw_softc *, enum rtw_access);
void rtw_set_access(struct rtw_regs *, enum rtw_access);
void rtw_attach(struct rtw_softc *);
int rtw_detach(struct rtw_softc *);