00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035 #include <async.h>
00036 #include <errno.h>
00037
00038 #include "usb_iface.h"
00039 #include "ddf/driver.h"
00040
00041
00042 static void remote_usb_get_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
00043 static void remote_usb_get_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
00044 static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
00045
00046
00048 static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
00049 remote_usb_get_address,
00050 remote_usb_get_interface,
00051 remote_usb_get_hc_handle
00052 };
00053
00056 remote_iface_t remote_usb_iface = {
00057 .method_count = sizeof(remote_usb_iface_ops) /
00058 sizeof(remote_usb_iface_ops[0]),
00059 .methods = remote_usb_iface_ops
00060 };
00061
00062
00063 void remote_usb_get_address(ddf_fun_t *fun, void *iface,
00064 ipc_callid_t callid, ipc_call_t *call)
00065 {
00066 usb_iface_t *usb_iface = (usb_iface_t *) iface;
00067
00068 if (usb_iface->get_address == NULL) {
00069 async_answer_0(callid, ENOTSUP);
00070 return;
00071 }
00072
00073 devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
00074
00075 usb_address_t address;
00076 int rc = usb_iface->get_address(fun, handle, &address);
00077 if (rc != EOK) {
00078 async_answer_0(callid, rc);
00079 } else {
00080 async_answer_1(callid, EOK, address);
00081 }
00082 }
00083
00084 void remote_usb_get_interface(ddf_fun_t *fun, void *iface,
00085 ipc_callid_t callid, ipc_call_t *call)
00086 {
00087 usb_iface_t *usb_iface = (usb_iface_t *) iface;
00088
00089 if (usb_iface->get_interface == NULL) {
00090 async_answer_0(callid, ENOTSUP);
00091 return;
00092 }
00093
00094 devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
00095
00096 int iface_no;
00097 int rc = usb_iface->get_interface(fun, handle, &iface_no);
00098 if (rc != EOK) {
00099 async_answer_0(callid, rc);
00100 } else {
00101 async_answer_1(callid, EOK, iface_no);
00102 }
00103 }
00104
00105 void remote_usb_get_hc_handle(ddf_fun_t *fun, void *iface,
00106 ipc_callid_t callid, ipc_call_t *call)
00107 {
00108 usb_iface_t *usb_iface = (usb_iface_t *) iface;
00109
00110 if (usb_iface->get_hc_handle == NULL) {
00111 async_answer_0(callid, ENOTSUP);
00112 return;
00113 }
00114
00115 devman_handle_t handle;
00116 int rc = usb_iface->get_hc_handle(fun, &handle);
00117 if (rc != EOK) {
00118 async_answer_0(callid, rc);
00119 }
00120
00121 async_answer_1(callid, EOK, (sysarg_t) handle);
00122 }
00123
00124
00125