Changeset d347b53 in mainline for uspace/srv/devman/main.c
- Timestamp:
- 2010-03-21T19:33:58Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 66babbd
- Parents:
- bda60d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rbda60d9 rd347b53 51 51 #include <ctype.h> 52 52 #include <ipc/devman.h> 53 #include <thread.h> 53 54 54 55 #include "devman.h" … … 96 97 return NULL; 97 98 } 98 printf(NAME ": registering the running instance of the %s driver.\n", driver->name);99 99 100 100 // Create connection to the driver … … 123 123 { 124 124 printf(NAME ": devman_add_child\n"); 125 126 // TODO 127 125 126 device_handle_t parent_handle = IPC_GET_ARG1(*call); 127 node_t *parent = find_dev_node(&device_tree, parent_handle); 128 129 if (NULL == parent) { 130 ipc_answer_0(callid, ENOENT); 131 return; 132 } 133 134 char *dev_name = NULL; 135 int rc = async_string_receive(&dev_name, DEVMAN_NAME_MAXLEN, NULL); 136 if (rc != EOK) { 137 ipc_answer_0(callid, rc); 138 return; 139 } 140 printf(NAME ": newly added child device's name is '%s'.\n", dev_name); 141 142 node_t *node = create_dev_node(); 143 if (!insert_dev_node(&device_tree, node, dev_name, parent)) { 144 delete_dev_node(node); 145 ipc_answer_0(callid, ENOMEM); 146 return; 147 } 148 149 // TODO match ids 150 151 // return device handle to parent's driver 152 ipc_answer_1(callid, EOK, node->handle); 153 154 // try to find suitable driver and assign it to the device 155 assign_driver(node, &drivers_list); 156 } 157 158 static int init_running_drv(void *drv) 159 { 160 driver_t *driver = (driver_t *)drv; 161 initialize_running_driver(driver); 162 printf(NAME ": the %s driver was successfully initialized. \n", driver->name); 163 return 0; 128 164 } 129 165 … … 137 173 138 174 driver_t *driver = devman_driver_register(); 139 if (driver == NULL) 140 return; 141 142 initialize_running_driver(driver); 175 if (NULL == driver) 176 return; 177 178 fid_t fid = fibril_create(init_running_drv, driver); 179 if (fid == 0) { 180 printf(NAME ": Error creating fibril for the initialization of the newly registered running driver.\n"); 181 exit(1); 182 } 183 fibril_add_ready(fid); 184 185 /*thread_id_t tid; 186 if (0 != thread_create(init_running_drv, driver, "init_running_drv", &tid)) { 187 printf(NAME ": failed to start the initialization of the newly registered running driver.\n"); 188 }*/ 143 189 144 190 ipc_callid_t callid;
Note:
See TracChangeset
for help on using the changeset viewer.