8-1
8
▼ ▼ ▼ ▼
Sample Driver
The following sample driver documentation is intended as a guide for the software
developer writing a device driver for the Adaptec AIC-6915 Ethernet Network Controller.
It is designed to complement the driver source code in the DDK and to serve as a basic
checklist for driver development. Initialization of the controller, receive and transmit
queues, and interrupt handling are covered in this document. All register fields discussed
here must be initialized by the driver to provide basic functionality.
Although the examples contained in this section are based on the Windows NT
environment, the concepts may be ported to any operating system. These examples have
been simplified here for clarity and do not necessarily represent code which can be
compiled. Refer to the source code in the DDK for complete source code.
Code Conventions
The code examples shown in this documentation utilize several C macros to demonstrate
driver initialization of the AIC-6915. The actual implementation of these macros is
operating system-specific. These macros include the following:
■
AIC6915_READ_REG (AIC-6915 Register, & LocalVariable)
■
This macro reads from the register located at address AIC-6915R
EGISTER
, and
returns the value in L
OCAL
V
ARIABLE
. In the NT environment, this macro is defined
as a call to N
DIS
R
EAD
R
EGISTER
U
LONG
.
■
AIC6915_WRITE_REG (AIC-6915 Register, LocalVariable)
■
This macro writes the value L
OCAL
V
ARIABLE
to address AIC-6915R
EGISTER
. In the
NT environment, this macro is defined as a call to N
DIS
W
RITE
R
EGISTER
U
LONG
.
■
AIC6915_ALLOC_MEMORY (Status, & Address, Length)
■
This macro translates to an operating system-specific call to allocate memory for
buffer or completion descriptors. A block of memory of size L
ENGTH
is returned in
variable A
DDRESS
.
■
Adapter structure
This structure contains device-specific information that must be maintained globally. The
element R
EGISTER
B
ASE
V
A
points to the beginning of the AIC-6915 register address space,
and is a structure that contains all AIC-6915 registers.