Changeset 084ff99 in mainline for uspace/lib
- Timestamp:
- 2010-03-14T09:14:50Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7707954
- Parents:
- 67ba309
- Location:
- uspace/lib
- Files:
-
- 1 added
- 2 edited
-
libc/include/ipc/driver.h (added)
-
libdrv/generic/driver.c (modified) (2 diffs)
-
libdrv/include/driver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libdrv/generic/driver.c
r67ba309 r084ff99 50 50 #include <devman.h> 51 51 #include <ipc/devman.h> 52 #include <ipc/driver.h> 52 53 53 54 #include "driver.h" 54 55 55 56 static driver_t *driver; 57 LIST_INITIALIZE(devices); 58 59 static device_t* driver_create_device() 60 { 61 device_t *dev = (device_t *)malloc(sizeof(device_t)); 62 if (NULL != dev) { 63 memset(dev, 0, sizeof(device_t)); 64 } 65 return dev; 66 } 67 68 static void driver_add_device(ipc_callid_t iid, ipc_call_t *icall) 69 { 70 printf("%s: driver_add_device\n", driver->name); 71 72 // result of the operation - device was added, device is not present etc. 73 ipcarg_t ret = 0; 74 ipcarg_t dev_handle = IPC_GET_ARG1(*icall); 75 76 printf("%s: adding device with handle = %x \n", driver->name, dev_handle); 77 78 device_t *dev = driver_create_device(); 79 dev->handle = dev_handle; 80 if (driver->driver_ops->add_device(dev)) { 81 list_append(&dev->link, &devices); 82 // TODO set return value 83 } 84 85 ipc_answer_1(iid, EOK, ret); 86 } 56 87 57 88 static void driver_connection_devman(ipc_callid_t iid, ipc_call_t *icall) 58 89 { 90 printf("%s: driver_connection_devman \n", driver->name); 91 59 92 /* Accept connection */ 60 93 ipc_answer_0(iid, EOK); … … 70 103 continue; 71 104 case DRIVER_ADD_DEVICE: 72 // TODO105 driver_add_device(callid, &call); 73 106 break; 74 107 default: -
uspace/lib/libdrv/include/driver.h
r67ba309 r084ff99 32 32 /** @file 33 33 */ 34 35 34 #ifndef LIBDRV_DRIVER_H_ 36 35 #define LIBDRV_DRIVER_H_ 37 36 38 typedef enum { 39 DRIVER_DEVMAN = 1, 40 DRIVER_CLIENT, 41 DRIVER_DRIVER 42 } driver_interface_t; 37 38 #include <adt/list.h> 39 40 43 41 44 42 typedef struct device { 45 int parent_handle;43 long handle; 46 44 ipcarg_t parent_phone; 45 47 46 // TODO add more items - parent bus type etc. 48 int handle; 47 48 link_t link; 49 49 } device_t; 50 50
Note:
See TracChangeset
for help on using the changeset viewer.
