Specifications

D
evice Driver Programming
9-12
The device Structure 9
The device_t structure is defined in adapter.h as follows:
typedef struct devices device_t;
struct devices {
char driver[15];/* driver name*/
dev_t dev_no;/* major/minor device number*/
long dev_type;/* type of device*/
device_t *next;/* next in linked list*/
};
Kernel Support Routines 9
The objective of this section is to give a synopsis of the kernel support routines for device
driver programming. Manual pages for all of the routines are provided in the on-line
Device Driver Reference. The routines highlighted here are those related to memory allo-
cation, memory access, virtual address management, data transfer, synchronization, pro-
cessor level adjustment, timing and timeout, interrupt vector allocation, and debugging.
Ioctl Macros 9
The ioctl routine of a device driver conforming to the DDI/DKI is called with six argu-
ments: the device number, the command indicating the operation to be performed, a
pointer to any arguments, the file mode set when the device was opened, a pointer to the
user credential structure, and a pointer to the return value for the calling process. The com-
mand word is of a special format. It is strongly recommended that you use the macros in
the file /usr/include/sys/ioccom.h to format these commands for you.