![](/images/new-backgrounds/1195471/19547151x1.webp)
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
#define READ_CCR(sc) #define WRITE_CCR(sc, val) #define READ_ACR(sc) #define WRITE_ACR(sc, val) #define WRITE_RCR(sc, val) #define WRITE_ECR(sc, val) #define READ_EDR(sc) #define WRITE_CMD(sc, val)
#define READ_STS(sc) #define WRITE_DATA(sc, val) #define READ_DATA(sc) #define READ_ND(sc)
#define WRITE_ND(sc, val) #define READ_MD(sc) #define WRITE_MD(sc, val) #define READ_TXF(sc) #define READ_RXF(sc) #define WRITE_AD1(sc, val) #define WRITE_AD2(sc, val) #define WRITE_AD3(sc, val) #define READ_TXS(sc) #define WRITE_TXS(sc, val) #define READ_RXS(sc) #define READ_FDP(sc)
mb(); el_wait((sc))
1
Constructs
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.