Changeset 8b1e15ac in mainline for uspace/lib/drv/include/driver.h
- Timestamp:
- 2011-02-11T22:26:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68414f4a
- Parents:
- 1b367b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/include/driver.h
r1b367b4 r8b1e15ac 52 52 typedef struct device device_t; 53 53 54 struct function; 55 typedef struct function function_t; 56 54 57 /* 55 58 * Device class … … 62 65 * device. 63 66 */ 64 int (*open)( device_t *);67 int (*open)(function_t *); 65 68 66 69 /** … … 68 71 * the device. 69 72 */ 70 void (*close)( device_t *);73 void (*close)(function_t *); 71 74 72 75 /** The table of standard interfaces implemented by the device. */ … … 100 103 int parent_phone; 101 104 102 /** Parent device if handled by this driver, NULL otherwise */103 device_t *parent;104 105 /** Device name */ 105 106 const char *name; 106 /** List of device ids for device-to-driver matching */ 107 match_id_list_t match_ids; 107 108 108 /** Driver-specific data associated with this device */ 109 109 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 */ 116 struct 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 */ 111 132 device_ops_t *ops; 112 133 113 /** Link in the list of devices handled by the driver */134 /** Link in the list of functions handled by the driver */ 114 135 link_t link; 115 136 }; … … 142 163 extern device_t *create_device(void); 143 164 extern 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 *, 165 extern function_t *create_function(void); 166 extern void delete_function(function_t *); 167 extern void *function_get_ops(function_t *, dev_inferface_idx_t); 168 169 extern int register_function(function_t *, device_t *); 170 extern int register_function_wrapper(device_t *, const char *, const char *, 148 171 int); 149 172 … … 184 207 extern int unregister_interrupt_handler(device_t *, int); 185 208 186 extern remote_handler_t * device_get_default_handler(device_t *);187 extern int add_ device_to_class(device_t *, const char *);209 extern remote_handler_t *function_get_default_handler(function_t *); 210 extern int add_function_to_class(function_t *fun, const char *class_name); 188 211 189 212 #endif
Note:
See TracChangeset
for help on using the changeset viewer.