[BACK]Return to device.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

Annotation of funnyos/sys/device.h, Revision 1.3

1.1       init        1: /*
1.3     ! init        2:  * $Id: device.h,v 1.2 2007/10/16 14:00:28 init Exp $
1.1       init        3:  */
                      4: #ifndef _SYS_DEVICE_H
                      5: #define _SYS_DEVICE_H
                      6: #include <sys/types.h>
                      7:
                      8: #define DVNAMELEN 8
                      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 */
                     27: //     void                    (*dr_interrupt)(struct device *self); /* intr handler */
                     28: };
                     29:
                     30:
                     31: struct driverinfo {
                     32:        /*
                     33:         * Associate actual driver with device name.
                     34:         */
1.2       init       35:        char                    *di_dname;              /* device name */
1.1       init       36:        struct driver   *di_driverp;                            /* pointer to driver */
                     37:        int8_t                  di_ninstances;                          /* number of already created devices; for dv_minor */
                     38: };
                     39:
                     40:
                     41: struct attachinfo {
                     42:        /*
                     43:         * Attach hint. Describes where to attach particular device.
                     44:         * "child" at "parent" 0 loc 0x16000000 flags 0x00
                     45:         */
1.2       init       46:        char                    *ai_cname;              /* child device name */
                     47:        char                    *ai_pname;              /* parent device name */
1.1       init       48:        uint8_t                 ai_pminor;                                      /* parent minor */
                     49:        uint32_t                ai_locator;                                     /* location on parent (0 - default) */
                     50: //     uint8_t                 ai_intrno;                                      /* interrupt line */
                     51:        uint8_t                 ai_flags;                                       /* flags passed to dr_attach() */
                     52: };
                     53:
                     54:
                     55: #endif /* _SYS_DEVICE_H */
                     56:

CVSweb