Annotation of funnyos/sys/device.h, Revision 1.7
1.1 init 1: /*
1.7 ! nbrk 2: * $Id: device.h,v 1.6 2007/11/01 13:05:25 init Exp $
1.1 init 3: */
4: #ifndef _SYS_DEVICE_H
5: #define _SYS_DEVICE_H
6: #include <sys/types.h>
7:
1.7 ! nbrk 8: #define DVNAMELEN 9
1.1 init 9:
10: struct device {
11: // char dv_name[DVNAMELEN]; /* device name up to 7 chars */
12: char *dv_name;
13: uint8_t dv_minor; /* instance number starting from 0 */
14: int dv_active; /* is this device active? */
15:
16: void *dv_devdata; /* device data in driver */
17: void *dv_aux; /* varios data exposed by device */
18:
19: struct device *dv_parent; /* parent device; set in attach time */
20: };
21:
22:
23: struct driver {
24: uint32_t dr_ddsize; /* size of xxx_dd (devdata) */
25: int (*dr_attach)(struct device *self, uint32_t loc, uint8_t flags); /* attach subroutine */
26: int (*dr_detach)(struct device *self); /* detach subroutine */
1.4 init 27: void (*dr_interrupt)(struct device *self); /* intr handler */
1.1 init 28: };
29:
30:
31: struct driverinfo {
32: /*
33: * Associate actual driver with device name.
34: */
1.5 init 35: char *di_dname; /* device name */
36: struct driver *di_driverp; /* pointer to driver */
37: int8_t di_ninstances; /* number of already created devices; for dv_minor */
1.1 init 38: };
39:
40:
41: struct attachinfo {
42: /*
43: * Attach hint. Describes where to attach particular device.
1.5 init 44: * "child" at "parent" 0 loc 0x16000000 intrno 4 flags 0x00
1.1 init 45: */
1.5 init 46: char *ai_cname; /* child device name */
47: char *ai_pname; /* parent device name */
48: uint8_t ai_pminor; /* parent minor */
49: uint32_t ai_locator; /* location on parent (0 - default) */
1.6 init 50: uint8_t ai_intrno; /* interrupt line (XXX on IRQ Controller) */
1.5 init 51: uint8_t ai_flags; /* flags passed to dr_attach() */
1.1 init 52: };
53:
54:
55: #endif /* _SYS_DEVICE_H */
56:
CVSweb