Changeset 83a2f43 in mainline for uspace/lib/drv/include
- Timestamp:
- 2011-02-15T19:43:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af6b5157
- Parents:
- 34588a80
- Location:
- uspace/lib/drv/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/include/dev_iface.h
r34588a80 r83a2f43 43 43 */ 44 44 45 struct function;45 struct ddf_fun; 46 46 47 47 /* … … 49 49 * devices driver. 50 50 */ 51 typedef void remote_iface_func_t(struct function *, void *, ipc_callid_t,51 typedef void remote_iface_func_t(struct ddf_fun *, void *, ipc_callid_t, 52 52 ipc_call_t *); 53 53 typedef remote_iface_func_t *remote_iface_func_ptr_t; 54 typedef void remote_handler_t(struct function *, ipc_callid_t, ipc_call_t *);54 typedef void remote_handler_t(struct ddf_fun *, ipc_callid_t, ipc_call_t *); 55 55 56 56 typedef struct { -
uspace/lib/drv/include/driver.h
r34588a80 r83a2f43 49 49 #include "dev_iface.h" 50 50 51 struct device; 52 typedef struct device device_t; 53 54 struct function; 55 typedef struct function function_t; 51 typedef struct ddf_dev ddf_dev_t; 52 typedef struct ddf_fun ddf_fun_t; 56 53 57 54 /* … … 60 57 61 58 /** Devices operations */ 62 typedef struct d evice_ops {59 typedef struct ddf_dev_ops { 63 60 /** 64 61 * Optional callback function called when a client is connecting to the 65 62 * device. 66 63 */ 67 int (*open)( function_t *);64 int (*open)(ddf_fun_t *); 68 65 69 66 /** … … 71 68 * the device. 72 69 */ 73 void (*close)( function_t *);70 void (*close)(ddf_fun_t *); 74 71 75 72 /** The table of standard interfaces implemented by the device. */ … … 82 79 */ 83 80 remote_handler_t *default_handler; 84 } device_ops_t; 85 81 } ddf_dev_ops_t; 86 82 87 83 /* … … 90 86 91 87 /** Device structure */ 92 struct d evice{88 struct ddf_dev { 93 89 /** 94 90 * Globally unique device identifier (assigned to the device by the … … 114 110 115 111 /** Function structure */ 116 struct function {112 struct ddf_fun { 117 113 /** True if bound to the device manager */ 118 114 bool bound; … … 121 117 122 118 /** Device which this function belogs to */ 123 d evice_t *dev;119 ddf_dev_t *dev; 124 120 125 121 /** Function type */ … … 132 128 void *driver_data; 133 129 /** Implementation of operations provided by this function */ 134 d evice_ops_t *ops;130 ddf_dev_ops_t *ops; 135 131 136 132 /** Link in the list of functions handled by the driver */ … … 145 141 typedef struct driver_ops { 146 142 /** Callback method for passing a new device to the device driver */ 147 int (*add_device)(d evice_t *dev);143 int (*add_device)(ddf_dev_t *dev); 148 144 /* TODO: add other generic driver operations */ 149 145 } driver_ops_t; … … 157 153 } driver_t; 158 154 159 int d river_main(driver_t *);160 161 extern function_t *ddf_fun_create(device_t *, fun_type_t, const char *);162 extern void ddf_fun_destroy( function_t *);163 extern int ddf_fun_bind( function_t *);164 extern int ddf_fun_add_match_id( function_t *, const char *, int);165 166 extern void *function_get_ops( function_t *, dev_inferface_idx_t);155 int ddf_driver_main(driver_t *); 156 157 extern ddf_fun_t *ddf_fun_create(ddf_dev_t *, fun_type_t, const char *); 158 extern void ddf_fun_destroy(ddf_fun_t *); 159 extern int ddf_fun_bind(ddf_fun_t *); 160 extern int ddf_fun_add_match_id(ddf_fun_t *, const char *, int); 161 162 extern void *function_get_ops(ddf_fun_t *, dev_inferface_idx_t); 167 163 168 164 /* … … 170 166 */ 171 167 172 typedef void interrupt_handler_t(d evice_t *, ipc_callid_t, ipc_call_t *);168 typedef void interrupt_handler_t(ddf_dev_t *, ipc_callid_t, ipc_call_t *); 173 169 174 170 typedef struct interrupt_context { 175 171 int id; 176 d evice_t *dev;172 ddf_dev_t *dev; 177 173 int irq; 178 174 interrupt_handler_t *handler; … … 196 192 interrupt_context_list_t *, int); 197 193 extern interrupt_context_t *find_interrupt_context( 198 interrupt_context_list_t *, d evice_t *, int);199 200 extern int register_interrupt_handler(d evice_t *, int, interrupt_handler_t *,194 interrupt_context_list_t *, ddf_dev_t *, int); 195 196 extern int register_interrupt_handler(ddf_dev_t *, int, interrupt_handler_t *, 201 197 irq_code_t *); 202 extern int unregister_interrupt_handler(d evice_t *, int);203 204 extern remote_handler_t *function_get_default_handler( function_t *);205 extern int add_function_to_class(function_t *fun, const char *class_name);198 extern int unregister_interrupt_handler(ddf_dev_t *, int); 199 200 extern remote_handler_t *function_get_default_handler(ddf_fun_t *); 201 extern int ddf_fun_add_to_class(ddf_fun_t *fun, const char *class_name); 206 202 207 203 #endif -
uspace/lib/drv/include/ops/char_dev.h
r34588a80 r83a2f43 39 39 40 40 typedef struct { 41 int (*read)( function_t *, char *, size_t);42 int (*write)( function_t *, char *, size_t);41 int (*read)(ddf_fun_t *, char *, size_t); 42 int (*write)(ddf_fun_t *, char *, size_t); 43 43 } char_dev_ops_t; 44 44 -
uspace/lib/drv/include/ops/hw_res.h
r34588a80 r83a2f43 42 42 43 43 typedef struct { 44 hw_resource_list_t *(*get_resource_list)( function_t *);45 bool (*enable_interrupt)( function_t *);44 hw_resource_list_t *(*get_resource_list)(ddf_fun_t *); 45 bool (*enable_interrupt)(ddf_fun_t *); 46 46 } hw_res_ops_t; 47 47
Note:
See TracChangeset
for help on using the changeset viewer.