Changeset 8b1e15ac in mainline for uspace/lib/drv/include/driver.h


Ignore:
Timestamp:
2011-02-11T22:26:36Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68414f4a
Parents:
1b367b4
Message:

Finish splitting device node: devman client in C library, drv library. Update device drivers accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/driver.h

    r1b367b4 r8b1e15ac  
    5252typedef struct device device_t;
    5353
     54struct function;
     55typedef struct function function_t;
     56
    5457/*
    5558 * Device class
     
    6265         * device.
    6366         */
    64         int (*open)(device_t *);
     67        int (*open)(function_t *);
    6568       
    6669        /**
     
    6871         * the device.
    6972         */
    70         void (*close)(device_t *);
     73        void (*close)(function_t *);
    7174       
    7275        /** The table of standard interfaces implemented by the device. */
     
    100103        int parent_phone;
    101104       
    102         /** Parent device if handled by this driver, NULL otherwise */
    103         device_t *parent;
    104105        /** Device name */
    105106        const char *name;
    106         /** List of device ids for device-to-driver matching */
    107         match_id_list_t match_ids;
     107       
    108108        /** Driver-specific data associated with this device */
    109109        void *driver_data;
    110         /** The implementation of operations provided by this device */
     110       
     111        /** Link in the list of devices handled by the driver */
     112        link_t link;
     113};
     114
     115/** Function structure */
     116struct function {
     117        /** Function indentifier (asigned by device manager) */
     118        devman_handle_t handle;
     119       
     120        /** Device which this function belogs to */
     121        device_t *dev;
     122       
     123        /** Function type */
     124        fun_type_t ftype;
     125        /** Function name */
     126        const char *name;
     127        /** List of device ids for driver matching */
     128        match_id_list_t match_ids;
     129        /** Driver-specific data associated with this function */
     130        void *driver_data;
     131        /** Implementation of operations provided by this function */
    111132        device_ops_t *ops;
    112133       
    113         /** Link in the list of devices handled by the driver */
     134        /** Link in the list of functions handled by the driver */
    114135        link_t link;
    115136};
     
    142163extern device_t *create_device(void);
    143164extern void delete_device(device_t *);
    144 extern void *device_get_ops(device_t *, dev_inferface_idx_t);
    145 
    146 extern int child_device_register(device_t *, device_t *);
    147 extern int child_device_register_wrapper(device_t *, const char *, const char *,
     165extern function_t *create_function(void);
     166extern void delete_function(function_t *);
     167extern void *function_get_ops(function_t *, dev_inferface_idx_t);
     168
     169extern int register_function(function_t *, device_t *);
     170extern int register_function_wrapper(device_t *, const char *, const char *,
    148171    int);
    149172
     
    184207extern int unregister_interrupt_handler(device_t *, int);
    185208
    186 extern remote_handler_t *device_get_default_handler(device_t *);
    187 extern int add_device_to_class(device_t *, const char *);
     209extern remote_handler_t *function_get_default_handler(function_t *);
     210extern int add_function_to_class(function_t *fun, const char *class_name);
    188211
    189212#endif
Note: See TracChangeset for help on using the changeset viewer.