Home | History | Annotate | Download | only in pci
History log of /src/sys/arch/i386/pci/geodereg.h
RevisionDateAuthorComments
 1.9  19-Oct-2009  rmind Drop 3rd and 4th clauses from David Young's license.
Reviewed and approved by dyoung@ (copyright holder).
 1.8  31-Aug-2006  dyoung branches: 1.8.60; 1.8.74;
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.
 1.7  07-Jun-2006  kardel branches: 1.7.4;
convert to timecounters (from branch simonb-timecounters)
 1.6  08-Mar-2006  dyoung branches: 1.6.4; 1.6.6;
Change macro names to avoid collisions:

BIT -> __BIT
BITS -> __BITS
 1.5  08-Mar-2006  dyoung 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);
 1.4  26-Dec-2005  perry branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10;
u_intN_t -> uintN_t
 1.3  11-Dec-2005  christos merge ktrace-lwp.
 1.2  22-Sep-2005  dyoung branches: 1.2.6;
Cosmetic: s/writing writing/writing/ in comments.
 1.1  22-Sep-2005  dyoung Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.2.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1  22-Sep-2005  skrll file geodereg.h was added on branch ktrace-lwp on 2005-11-10 13:56:53 +0000
 1.4.10.1  19-Apr-2006  elad sync with head - hopefully this will work
 1.4.8.3  03-Sep-2006  yamt sync with head.
 1.4.8.2  26-Jun-2006  yamt sync with head.
 1.4.8.1  13-Mar-2006  yamt sync with head.
 1.4.6.3  22-Apr-2006  simonb Catch up with BIT->__BIT changes.
 1.4.6.2  22-Apr-2006  simonb Sync with head.
 1.4.6.1  28-Feb-2006  kardel Move watchdog timer support code out of geode.c in to its
own file, leaving geode.c to just set up GDB mappings.
Add support for CGB high resolution counter as a time counter.
 1.4.4.1  09-Sep-2006  rpaulo sync with head
 1.6.6.2  20-May-2006  tron Pull up following revision(s) (requested by riz in ticket #1331):
sys/arch/i386/conf/GENERIC: revision 1.701
sys/arch/i386/pci/geodereg.h: revision 1.1
sys/arch/i386/conf/files.i386: revision 1.270
sys/arch/i386/pci/geode.c: revision 1.1
Add a driver for the watchdog timer on the AMD Geode SC1100.
 1.6.6.1  08-Mar-2006  tron file geodereg.h was added on branch netbsd-3 on 2006-05-20 12:25:40 +0000
 1.6.4.1  19-Jun-2006  chap Sync with head.
 1.7.4.3  30-Dec-2006  yamt sync with head.
 1.7.4.2  21-Jun-2006  yamt sync with head.
 1.7.4.1  07-Jun-2006  yamt file geodereg.h was added on branch yamt-lazymbuf on 2006-06-21 14:52:30 +0000
 1.8.74.1  01-Nov-2009  jym Sync with HEAD.
 1.8.60.1  11-Mar-2010  yamt sync with head

RSS XML Feed