Changeset c16cf62 in mainline for uspace/srv/devman
- Timestamp:
- 2010-02-26T14:22:33Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67ba309
- Parents:
- 92413de
- Location:
- uspace/srv/devman
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r92413de rc16cf62 428 428 } 429 429 430 void set_driver_phone(driver_t *driver, ipcarg_t phone) 431 { 432 fibril_mutex_lock(&driver->driver_mutex); 433 assert(DRIVER_STARTING == driver->state); 434 driver->phone = phone; 435 fibril_mutex_unlock(&driver->driver_mutex); 436 } 437 438 /** 439 * Notify driver about the devices to which it was assigned. 440 * 441 * The driver's mutex must be locked. 442 * 443 * @param driver the driver to which the devices are passed. 444 */ 445 static void pass_devices_to_driver(driver_t *driver) 446 { 447 node_t *dev; 448 link_t *link; 449 450 link = driver->devices.next; 451 while (link != &driver->devices) { 452 dev = list_get_instance(link, node_t, driver_devices); 453 add_device(driver, dev); 454 link = link->next; 455 } 456 } 457 458 /** Finish the initialization of a driver after it has succesfully started and registered itself by the device manager. 459 * 460 * Pass devices formerly matched to the driver to the driver and remember the driver is running and fully functional now. 461 * 462 * @param driver the driver which registered itself as running by the device manager. 463 */ 464 void initialize_running_driver(driver_t *driver) 465 { 466 fibril_mutex_lock(&driver->driver_mutex); 467 468 // pass devices which have been already assigned to the driver to the driver 469 pass_devices_to_driver(driver); 470 471 // change driver's state to running 472 driver->state = DRIVER_RUNNING; 473 474 fibril_mutex_unlock(&driver->driver_mutex); 475 } 476 430 477 /** Pass a device to running driver. 431 478 * 432 479 * @param drv the driver's structure. 433 480 * @param node the device's node in the device tree. 434 * 435 * @return true on success, false otherwise. 436 */ 437 bool add_device(driver_t *drv, node_t *node) 481 */ 482 void add_device(driver_t *drv, node_t *node) 438 483 { 439 484 printf(NAME ": add_device\n"); … … 506 551 } 507 552 553 /** @} 554 */ -
uspace/srv/devman/devman.h
r92413de rc16cf62 191 191 void add_driver(driver_list_t *drivers_list, driver_t *drv); 192 192 void attach_driver(node_t *node, driver_t *drv); 193 booladd_device(driver_t *drv, node_t *node);193 void add_device(driver_t *drv, node_t *node); 194 194 bool start_driver(driver_t *drv); 195 195 196 196 driver_t * find_driver(driver_list_t *drv_list, const char *drv_name); 197 void set_driver_phone(driver_t *driver, ipcarg_t phone); 198 void initialize_running_driver(driver_t *driver); 197 199 198 200 … … 260 262 261 263 #endif 264 265 /** @} 266 */ -
uspace/srv/devman/main.c
r92413de rc16cf62 60 60 61 61 /** 62 *63 *64 * Driver's mutex must be locked.65 */66 static void pass_devices_to_driver(driver_t *driver)67 {68 69 70 71 72 }73 74 static void init_running_driver(driver_t *driver)75 {76 fibril_mutex_lock(&driver->driver_mutex);77 78 // pass devices which have been already assigned to the driver to the driver79 pass_devices_to_driver(driver);80 81 // change driver's state to running82 driver->state = DRIVER_RUNNING;83 84 fibril_mutex_unlock(&driver->driver_mutex);85 }86 87 /**88 62 * Register running driver. 89 63 */ … … 134 108 } 135 109 136 fibril_mutex_lock(&driver->driver_mutex); 137 assert(DRIVER_STARTING == driver->state); 138 driver->phone = IPC_GET_ARG5(call); 139 fibril_mutex_unlock(&driver->driver_mutex); 110 // remember driver's phone 111 set_driver_phone(driver, IPC_GET_ARG5(call)); 140 112 141 113 printf(NAME ": the %s driver was successfully registered as running.\n", driver->name); … … 160 132 return; 161 133 162 init _running_driver(driver);134 initialize_running_driver(driver); 163 135 164 136 ipc_callid_t callid; … … 251 223 return 0; 252 224 } 225 226 /** @} 227 */
Note:
See TracChangeset
for help on using the changeset viewer.