READ_BUS_D8
Reads a byte (8 bits) from a device register.
READ_BUS_D16
Reads a word (16 bits) from a device register.
READ_BUS_D32
Reads a longword (32 bits) from a device register.
READ_BUS_D64
Reads a quadword (64 bits) from a device register.
WRITE_BUS_D8
Writes a byte (8 bits) to a device register.
WRITE_BUS_D16
Writes a word (16 bits) to a device register.
WRITE_BUS_D32
Writes a longword (32 bits) to a device register.
WRITE_BUS_D64
Writes a quadword (64 bits) to a device register.
The following code shows how the
if_el
driver uses the
READ_BUS_D16
,
READ_BUS_D32
,
WRITE_BUS_D16
, and
WRITE_BUS_D32
kernel routines to
construct driver-specific macros to perform read and write operations on the
3Com 3C5x9 device:
#define READ_CCR(sc)
READ_BUS_D16((sc)->reg4); mb();
1
#define WRITE_CCR(sc, val)
WRITE_BUS_D16((sc)->reg4, (val)); mb();
#define READ_ACR(sc)
READ_BUS_D16((sc)->reg6); mb();
#define WRITE_ACR(sc, val)
WRITE_BUS_D16((sc)->reg6, (val)); mb();
#define WRITE_RCR(sc, val)
WRITE_BUS_D16((sc)->reg8, (val)); mb();
#define WRITE_ECR(sc, val)
WRITE_BUS_D16((sc)->regA, (val)); mb();
#define READ_EDR(sc)
READ_BUS_D16((sc)->regC); mb();
#define WRITE_CMD(sc, val)
WRITE_BUS_D16((sc)->regE, (val)); \
mb(); el_wait((sc))
#define READ_STS(sc)
READ_BUS_D16((sc)->regE); mb();
#define WRITE_DATA(sc, val)
WRITE_BUS_D32((sc)->data, (val)); mb();
#define READ_DATA(sc)
READ_BUS_D32((sc)->data); mb();
#define READ_ND(sc)
READ_BUS_D16((sc)->reg6); mb();
#define WRITE_ND(sc, val)
WRITE_BUS_D16((sc)->reg6, (val)); mb();
#define READ_MD(sc)
READ_BUS_D16((sc)->regA); mb();
#define WRITE_MD(sc, val)
WRITE_BUS_D16((sc)->regA, (val)); mb();
#define READ_TXF(sc)
READ_BUS_D16((sc)->regC); mb();
#define READ_RXF(sc)
READ_BUS_D16((sc)->regA); mb();
#define WRITE_AD1(sc, val)
WRITE_BUS_D16((sc)->reg0, (val)); mb();
#define WRITE_AD2(sc, val)
WRITE_BUS_D16((sc)->reg2, (val)); mb();
#define WRITE_AD3(sc, val)
WRITE_BUS_D16((sc)->reg4, (val)); mb();
#define READ_TXS(sc)
READ_BUS_D16((sc)->regA); mb();
#define WRITE_TXS(sc, val)
WRITE_BUS_D16((sc)->regA, (val)); mb();
#define READ_RXS(sc)
READ_BUS_D16((sc)->reg8); mb();
#define READ_FDP(sc)
READ_BUS_D16((sc)->reg4); mb();
1
Constructs driver-specific macros to read from and write to the 3Com
3C5x9 device’s CSRs.
The first argument to these macros specifies an I/O handle that
references a device register or memory that is located in bus address
space (either I/O space or memory space). You can perform standard
C mathematical operations (addition and subtraction only) on the I/O
handle. The
READ_CCR
,
WRITE_CCR
, and the other macros construct
the first argument by referencing the I/O handle that is defined in the
el_softc
data structure.
1–8 Network Device Driver Environment