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);
keyboard). Somebody with a US keyboard should check if these are applicable
in that case too.
Fix mapping of the ccedilla/rightbrace key on Spanish keyboards. Looks like
as if that key can be reported by two different keycodes.
sam@ and various open source repositories:
ath(4):
Ignore "phantom" beacon misses: should stabilize connections
to access points (no more ceaseless link-UP/DOWN indications).
Also, re-synchronize beacon timer using the TSF in the
first beacon received after joining a BSS---this should
also help suppress spurious beacon misses. I am hopeful
that this will help ath(4) lossage reported by perry@ and
smb@.
Add new configuration through sysctl.
Use a shorter calibration interval until IQ calibration
finishes.
Report antenna noise through radiotap.
Rudiments of Radar Detection / Dynamic Frequency Selection.
Update to HAL version 0.9.16.13.
Update open sources for changes to the HAL API.
Add HALs for additional architectures: add big-endian ELF
HALs for sparc64 and for PowerPC. Also add a Alpha HAL.
These new HALs are untested under NetBSD.
ath(4) + net80211:
Make the multicast transmit rate configurable by ioctl.
Miscellaneous bug fixes.
state: after the device attaches, do not ever remove power from
the cardslot. Without this patch, ath@cardbus does not work reliably
in WPA/WPA2 networks.
XXX A better solution is to restore the hardware state that gets
XXX scrambled by removing and re-applying power, but I haven't
XXX found out precisely what state is scrambled, yet.