Commit Graph

14 Commits

Author SHA1 Message Date
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
dyoung 8cd106d3d2 Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h.  Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t.  XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 19:24:37 +00:00
dyoung f66403a698 Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them.  Improve the macros' names.  Simplify their
implementation.

A brief description of each macro is below.

        BIT(n): Return a bitmask with bit m set, where the least
                significant bit is bit 0.

        BITS(m, n): Return a bitmask with bits m through n, inclusive,
                    set.  It does not matter whether m>n or m<=n.
                    The least significant bit is bit 0.

        A "bitfield" is a span of consecutive bits defined by a
        bitmask, where 1s select the bits in the bitfield.  SHIFTIN,
        SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
        from device registers.

        SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
                          defined by `mask', and return them.  No
                          side-effects.

        SHIFTOUT(v, mask): Extract and return the bitfield selected
                           by `mask' from `v', right-shifting the
                           bits so that the rightmost selected bit
                           is at bit 0.  No side-effects.

        SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
                             the rightmost non-zero bit is at bit
                             0.  This is useful for finding the
                             greatest unsigned value that a bitfield
                             can hold.  No side-effects.  Note that
                             SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
 * Register definitions taken from the RFMD RF3000 manual.
 */
#define RF3000_GAINCTL          0x11            /* TX variable gain control */
#define         RF3000_GAINCTL_TXVGC_MASK       BITS(7, 2)
#define         RF3000_GAINCTL_SCRAMBLER        BIT(1)

/*
 * Shift the transmit power into the transmit-power field of the
 * gain-control register and write it to the baseband processor.
 */
atw_rf3000_write(sc, RF3000_GAINCTL,
    SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
 * Register definitions taken from the ADMtek ADM8211 manual.
 *
 */
#define ATW_RXSTAT_OWN          BIT(31)         /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1          BIT(17)         /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0          BIT(16)         /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK    BITS(15,12)     /* RX data rate */
#define ATW_RXSTAT_FL_MASK      BITS(11,0)      /* RX frame length, last
                                                 * descriptor only
                                                 */

/* Extract the frame length from the Rx descriptor's
 * status field.
 */
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
2006-03-08 00:24:06 +00:00
dyoung 92e2a6beb6 Add support for the GCT Semiconductor GRF5101 transceiver/synthesizer.
From OpenBSD.

GCT will not provide any documentation, so there are many magic
numbers in this code.
2005-12-29 22:27:17 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
dyoung 9063402978 Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD.  Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]).  Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
2005-06-22 06:14:51 +00:00
dyoung 37420795ec Cosmetic: change u_int{8,16,32,64}_t to C99-style uint{8,16,32,64}_t,
which is preferred.
2005-01-02 04:23:03 +00:00
dyoung e336b06e3b Remove useless debug sysctls.
For AP scanning, change the channel dwell time from 1 second to
1/5 second.
2004-12-27 06:12:28 +00:00
dyoung d2b4873c41 Change rtw_debug from a debug level to a debug mask. Add a lot of
debug flags.

From Linux: handle an RTL8180 bug.  Sometimes the NIC skips from
the middle of the ring to the 0th rx descriptor.  Now the driver
resynchronizes.

Handle a receive descriptor underrun or Rx FIFO overflow condition
in the way that the Linux driver does.  This kind of seems like
overkill, but whatever.

Protect rtw_ioctl with splnet().

Do not load a tx descriptor with a buffer shorter than 4 bytes.

Handle a transmit timeout less disruptively.
2004-12-25 06:58:37 +00:00
dyoung aecae5f227 Realtek sample sources are not consistent about the "Digital PHY"
bit in the SROM.  It seems as if it is set to 1 when the PHY is
*analog*, not *digital*.  Fix my sources.

In rtw_intr_rx, use units of 500kb/s instead of 100kb/s for rate,
to be consistent with net80211's expectations.  Polish up some
debugging ugly messages.  Dump raw 802.11 packets if IFF_DEBUG|IFF_LINK2
and RTW_DEBUG is defined.

Polish power-state (on/sleep/off) handling.  Especially improve
support for RFMD (totally untested) and Maxim.  For Philips, take
the Digital PHY property into account.

Call the net80211 watchdog function from rtw_watchdog, so that we
scan again if auth/assoc fails.

Be a little more cautious about writing register[RTW_TPPOLL], since
other drivers are....  Don't frob the high/low-priority queues
right now, since I don't use them.

Add rtw_join_bss which programs the card with the BSSID and other
properties of a BSS.  Use it on state transitions.  Factor out
rtw_set_nettype.

Make rtw_recv_beacon call ieee80211_recv_mgmt instead of dropping
beacons on the floor!  TBD IBSS merges.

Change some rtw_debug=2 printfs to rtw_debug=3 (RTW_DPRINTF3)
printfs so the console doesn't get spammed so badly at rtw_debug=2.
Change some debugging printfs to RTW_DPRINTFs.  E.g., print the
"RF programming method" only if debugging is enabled.
2004-12-20 23:05:41 +00:00
dyoung 87f615f34e At last, I have rtw w/ Philips RF receiving packets.
I added some sysctls to aid debugging:

  * hw.rtw.debug -- enable debugging

  * hw.rtw.flush_rfio -- Linux voodoo: possibly makes the MAC
    "flush" bits down the serial bus to the RF

  * hw.rtw.host_rfio: force the host to bang bits to the RF, instead
    of the MAC banging bits

  * hw.rtw.rfio_delay: after telling the MAC to bang bits to the
    RF front-end, delay rfio_delay microseconds.

  * hw.rtw.rfprog_fallback: there is this notion of the "RF
    programming method."  I believe the choice influences the
    polarity/timing of the serial bus used to program the RF
    front-end.  I know the correct choice for Intersil/RFMD/Philips
    front-ends, only.  For all other front-ends, I "fallback" to
    rfprog_fallback.

Make rtw_txdac_enable take an rtw_softc argument.  I will probably
revert this change.

Add some Linux voodoo to rtw_continuous_tx_enable.  I will probably
revert this change.

Important: add rtw_set_rfprog, which sets the correct RF programming
method.  This change and the following change are probably responsible
for making the Philips RF work.

Important: RTW_CONFIG1 is an 8-bit register, treat it that way!

Important: RTW_BRSR is 16-bit, RTW_CRCOUNT, RTW_PHYDELAY, and
RTW_MSR are 8-bit: treat them that way!

Vastly simplify rtw_resume_ticks.

Note to self: set the LED state to match the power state.

Hedge against the possibility that RTW_MSR is protected as
RTW_CONFIG[0123] are, meanwhile reworking that section of rtw_init
a little.

Add sc_anaparm, which isn't used, yet....
2004-12-13 00:48:02 +00:00
dyoung 3e9bdb9662 Add work-in-progress driver rtw(4) for Realtek RTL8180 MAC/baseband.
Add register definitions for Maxim MAX2820 and Philips SA2400 radio
front-ends.
2004-09-26 02:29:15 +00:00