Changeset 66babbd in mainline for uspace/lib
- Timestamp:
- 2010-03-25T09:55:09Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a087f2e
- Parents:
- d347b53
- Location:
- uspace/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/devman.c
rd347b53 r66babbd 39 39 #include <malloc.h> 40 40 #include <bool.h> 41 #include <adt/list.h> 41 42 42 43 static int devman_phone_driver = -1; … … 106 107 } 107 108 109 static int devman_send_match_id(int phone, match_id_t *match_id) \ 110 { 111 ipc_call_t answer; 112 async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer); 113 int retval = async_data_write_start(phone, match_id->id, str_size(match_id->id)); 114 return retval; 115 } 116 117 118 static int devman_send_match_ids(int phone, match_id_list_t *match_ids) 119 { 120 link_t *link = match_ids->ids.next; 121 match_id_t *match_id = NULL; 122 int ret = EOK; 123 124 while (link != &match_ids->ids) { 125 match_id = list_get_instance(link, match_id_t, link); 126 if (EOK != (ret = devman_send_match_id(phone, match_id))) 127 { 128 printf("Driver failed to send match id, error number = %d\n", ret); 129 return ret; 130 } 131 link = link->next; 132 } 133 return ret; 134 } 135 108 136 int devman_child_device_register( 109 137 const char *name, match_id_list_t *match_ids, device_handle_t parent_handle, device_handle_t *handle) … … 116 144 async_serialize_start(); 117 145 146 int match_count = list_count(&match_ids->ids); 118 147 ipc_call_t answer; 119 aid_t req = async_send_ 1(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, &answer);148 aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count, &answer); 120 149 121 150 ipcarg_t retval = async_data_write_start(phone, name, str_size(name)); … … 126 155 } 127 156 128 // TODO match ids157 devman_send_match_ids(phone, match_ids); 129 158 130 159 async_wait_for(req, &retval); … … 141 170 if (handle != NULL) 142 171 *handle = (int) IPC_GET_ARG1(answer); 172 173 return retval; 143 174 } 144 175 -
uspace/lib/libc/include/ipc/devman.h
rd347b53 r66babbd 51 51 /** Id of device model. 52 52 */ 53 c onst char *id;53 char *id; 54 54 /** Relevancy of device-to-driver match. 55 55 * The higher is the product of scores specified for the device by the bus driver and by the leaf driver, … … 121 121 typedef enum { 122 122 DEVMAN_DRIVER_REGISTER = IPC_FIRST_USER_METHOD, 123 DEVMAN_ADD_CHILD_DEVICE 123 DEVMAN_ADD_CHILD_DEVICE, 124 DEVMAN_ADD_MATCH_ID 124 125 125 126 } driver_to_devman_t; -
uspace/lib/libdrv/generic/driver.c
rd347b53 r66babbd 47 47 #include <string.h> 48 48 #include <ctype.h> 49 #include <errno.h> 49 50 50 51 #include <devman.h> … … 153 154 assert(NULL != child->name); 154 155 155 if (devman_child_device_register(child->name, &child->match_ids, parent->handle, &child->handle)) { 156 // TODO initialize child device 156 if (EOK == devman_child_device_register(child->name, &child->match_ids, parent->handle, &child->handle)) { 157 157 return true; 158 158 }
Note:
See TracChangeset
for help on using the changeset viewer.