Changeset 25a7e11d in mainline for uspace/lib/libdrv
- Timestamp:
- 2010-04-30T14:13:41Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f658458
- Parents:
- dafe675
- Location:
- uspace/lib/libdrv
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libdrv/Makefile
rdafe675 r25a7e11d 37 37 generic/driver.c \ 38 38 generic/dev_iface.c \ 39 generic/remote_res.h 39 generic/remote_res.c \ 40 generic/remote_char.c 40 41 41 42 include ../Makefile.common -
uspace/lib/libdrv/generic/dev_iface.c
rdafe675 r25a7e11d 38 38 #include "dev_iface.h" 39 39 #include "remote_res.h" 40 #include "remote_char.h" 40 41 41 42 static iface_dipatch_table_t remote_ifaces = { 42 43 .ifaces = { 43 &remote_res_iface 44 &remote_res_iface, 45 &remote_char_iface 44 46 } 45 47 }; -
uspace/lib/libdrv/generic/driver.c
rdafe675 r25a7e11d 224 224 // TODO - if the client is not a driver, check whether it is allowed to use the device 225 225 226 // TODO open the device (introduce some callbacks for opening and closing devices registered by the driver) 227 228 ipc_answer_0(iid, EOK); 226 int ret = EOK; 227 // open the device 228 if (NULL != dev->class && NULL != dev->class->open) { 229 ret = (*dev->class->open)(dev); 230 } 231 232 ipc_answer_0(iid, ret); 229 233 230 234 while (1) { … … 236 240 237 241 switch (method) { 238 case IPC_M_PHONE_HUNGUP: 239 240 // TODO close the device 241 242 case IPC_M_PHONE_HUNGUP: 243 // close the device 244 if (NULL != dev->class && NULL != dev->class->close) { 245 (*dev->class->close)(dev); 246 } 242 247 ipc_answer_0(callid, EOK); 243 248 return; -
uspace/lib/libdrv/include/driver.h
rdafe675 r25a7e11d 41 41 #include <ipc/dev_iface.h> 42 42 #include <device/hw_res.h> 43 #include <device/char.h> 43 44 #include <assert.h> 44 45 #include <ddi.h> … … 81 82 /** Unique identification of the class. */ 82 83 int id; 84 /** Optional callback function called when a client is connecting to the device. */ 85 int (*open)(device_t *dev); 86 /** Optional callback function called when a client is disconnecting from the device. */ 87 void (*close)(device_t *dev); 83 88 /** The table of interfaces implemented by the device. */ 84 89 void *interfaces[DEV_IFACE_COUNT];
Note:
See TracChangeset
for help on using the changeset viewer.