Changeset 5159ae9 in mainline for uspace/lib/drv/include/driver.h
- Timestamp:
- 2010-05-29T08:37:38Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce89036b
- Parents:
- 692c40cb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/include/driver.h
r692c40cb r5159ae9 80 80 // device class 81 81 82 /** Devices belonging to the same class should implement the same set of interfaces.*/ 83 typedef struct device_class { 84 /** Unique identification of the class. */ 85 int id; 82 /** Devices operations. */ 83 typedef struct device_ops { 86 84 /** Optional callback function called when a client is connecting to the device. */ 87 85 int (*open)(device_t *dev); … … 93 91 * by any of the standard interfaces, the default handler is used.*/ 94 92 remote_handler_t *default_handler; 95 } device_ class_t;93 } device_ops_t; 96 94 97 95 … … 112 110 /** The device driver's data associated with this device.*/ 113 111 void *driver_data; 114 /** Device class consist of class id and table of interfaces supported by thedevice.*/115 device_ class_t *class;112 /** The implementation of operations provided by this device.*/ 113 device_ops_t *ops; 116 114 /** Pointer to the previous and next device in the list of devices handled by the driver */ 117 115 link_t link; … … 168 166 { 169 167 assert(is_valid_iface_idx(idx)); 170 if (NULL == dev-> class) {168 if (NULL == dev->ops) { 171 169 return NULL; 172 170 } 173 return dev-> class->interfaces[idx];171 return dev->ops->interfaces[idx]; 174 172 } 175 173 … … 280 278 static inline remote_handler_t * device_get_default_handler(device_t *dev) 281 279 { 282 if (NULL == dev-> class) {280 if (NULL == dev->ops) { 283 281 return NULL; 284 282 } 285 283 286 return dev-> class->default_handler;284 return dev->ops->default_handler; 287 285 } 288 286
Note:
See TracChangeset
for help on using the changeset viewer.