Changeset cb59f787 in mainline
- Timestamp:
- 2010-11-21T09:22:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3f8c1f7
- Parents:
- 32eceb4f
- Location:
- uspace/lib
- Files:
-
- 5 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/dev_iface.h
r32eceb4f rcb59f787 38 38 HW_RES_DEV_IFACE = 0, 39 39 CHAR_DEV_IFACE, 40 USB_DEV_IFACE, 40 41 /** Interface provided by USB host controller. */ 42 USBHC_DEV_IFACE, 43 41 44 // TODO add more interfaces 42 45 DEV_IFACE_MAX -
uspace/lib/drv/Makefile
r32eceb4f rcb59f787 36 36 generic/dev_iface.c \ 37 37 generic/remote_res.c \ 38 generic/remote_usb .c \38 generic/remote_usbhc.c \ 39 39 generic/remote_char.c 40 40 -
uspace/lib/drv/generic/dev_iface.c
r32eceb4f rcb59f787 39 39 #include "remote_res.h" 40 40 #include "remote_char.h" 41 #include "remote_usb .h"41 #include "remote_usbhc.h" 42 42 43 43 static iface_dipatch_table_t remote_ifaces = { … … 45 45 &remote_res_iface, 46 46 &remote_char_iface, 47 &remote_usb _iface47 &remote_usbhc_iface 48 48 } 49 49 }; -
uspace/lib/drv/generic/remote_usbhc.c
r32eceb4f rcb59f787 37 37 #include <errno.h> 38 38 39 #include "usb _iface.h"39 #include "usbhc_iface.h" 40 40 #include "driver.h" 41 41 42 42 #define USB_MAX_PAYLOAD_SIZE 1020 43 43 44 static void remote_usb _get_buffer(device_t *, void *, ipc_callid_t, ipc_call_t *);45 static void remote_usb _interrupt_out(device_t *, void *, ipc_callid_t, ipc_call_t *);46 static void remote_usb _interrupt_in(device_t *, void *, ipc_callid_t, ipc_call_t *);44 static void remote_usbhc_get_buffer(device_t *, void *, ipc_callid_t, ipc_call_t *); 45 static void remote_usbhc_interrupt_out(device_t *, void *, ipc_callid_t, ipc_call_t *); 46 static void remote_usbhc_interrupt_in(device_t *, void *, ipc_callid_t, ipc_call_t *); 47 47 //static void remote_usb(device_t *, void *, ipc_callid_t, ipc_call_t *); 48 48 49 49 /** Remote USB interface operations. */ 50 static remote_iface_func_ptr_t remote_usb _iface_ops [] = {51 &remote_usb _get_buffer,52 &remote_usb _interrupt_out,53 &remote_usb _interrupt_in50 static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = { 51 &remote_usbhc_get_buffer, 52 &remote_usbhc_interrupt_out, 53 &remote_usbhc_interrupt_in 54 54 }; 55 55 56 56 /** Remote USB interface structure. 57 57 */ 58 remote_iface_t remote_usb _iface = {59 .method_count = sizeof(remote_usb _iface_ops) /60 sizeof(remote_usb _iface_ops[0]),61 .methods = remote_usb _iface_ops58 remote_iface_t remote_usbhc_iface = { 59 .method_count = sizeof(remote_usbhc_iface_ops) / 60 sizeof(remote_usbhc_iface_ops[0]), 61 .methods = remote_usbhc_iface_ops 62 62 }; 63 63 … … 69 69 70 70 71 void remote_usb _get_buffer(device_t *device, void *iface,71 void remote_usbhc_get_buffer(device_t *device, void *iface, 72 72 ipc_callid_t callid, ipc_call_t *call) 73 73 { … … 125 125 } 126 126 127 void remote_usb _interrupt_out(device_t *device, void *iface,127 void remote_usbhc_interrupt_out(device_t *device, void *iface, 128 128 ipc_callid_t callid, ipc_call_t *call) 129 129 { 130 usb _iface_t *usb_iface = (usb_iface_t *) iface;130 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 131 131 132 132 size_t expected_len = IPC_GET_ARG3(*call); … … 168 168 } 169 169 170 void remote_usb _interrupt_in(device_t *device, void *iface,170 void remote_usbhc_interrupt_in(device_t *device, void *iface, 171 171 ipc_callid_t callid, ipc_call_t *call) 172 172 { 173 usb _iface_t *usb_iface = (usb_iface_t *) iface;173 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 174 174 175 175 size_t len = IPC_GET_ARG3(*call); -
uspace/lib/drv/include/remote_usbhc.h
r32eceb4f rcb59f787 33 33 */ 34 34 35 #ifndef LIBDRV_REMOTE_USB _H_36 #define LIBDRV_REMOTE_USB _H_35 #ifndef LIBDRV_REMOTE_USBHC_H_ 36 #define LIBDRV_REMOTE_USBHC_H_ 37 37 38 remote_iface_t remote_usb _iface;38 remote_iface_t remote_usbhc_iface; 39 39 40 40 #endif -
uspace/lib/drv/include/usbhc_iface.h
r32eceb4f rcb59f787 34 34 */ 35 35 36 #ifndef LIBDRV_USB _IFACE_H_37 #define LIBDRV_USB _IFACE_H_36 #ifndef LIBDRV_USBHC_IFACE_H_ 37 #define LIBDRV_USBHC_IFACE_H_ 38 38 39 39 #include "driver.h" … … 46 46 * 47 47 * Methods for sending data to device (OUT transactions) 48 * - e.g. IPC_M_USB _INTERRUPT_OUT -48 * - e.g. IPC_M_USBHC_INTERRUPT_OUT - 49 49 * always use the same semantics: 50 50 * - first, IPC call with given method is made … … 59 59 * 60 60 * Methods for retrieving data from device (IN transactions) 61 * - e.g. IPC_M_USB _INTERRUPT_IN -61 * - e.g. IPC_M_USBHC_INTERRUPT_IN - 62 62 * also use the same semantics: 63 63 * - first, IPC call with given method is made … … 76 76 * The mentioned data retrieval can be done any time after receiving EOK 77 77 * answer to IN method. 78 * This retrieval is done using the IPC_M_USB _GET_BUFFER where78 * This retrieval is done using the IPC_M_USBHC_GET_BUFFER where 79 79 * the first argument is buffer hash from call answer. 80 80 * This call must be immediately followed by data read-in and after the 81 * data are transferred, the initial call (IPC_M_USB _GET_BUFFER)81 * data are transferred, the initial call (IPC_M_USBHC_GET_BUFFER) 82 82 * is answered. Each buffer can be retrieved only once. 83 83 * … … 97 97 * as it is handled by the remote part itself. 98 98 */ 99 IPC_M_USB _GET_BUFFER,99 IPC_M_USBHC_GET_BUFFER, 100 100 101 101 … … 103 103 * See explanation at usb_iface_funcs_t (OUT transaction). 104 104 */ 105 IPC_M_USB _INTERRUPT_OUT,105 IPC_M_USBHC_INTERRUPT_OUT, 106 106 107 107 /** Get interrupt data from device. 108 108 * See explanation at usb_iface_funcs_t (IN transaction). 109 109 */ 110 IPC_M_USB _INTERRUPT_IN,110 IPC_M_USBHC_INTERRUPT_IN, 111 111 112 112 … … 114 114 * See explanation at usb_iface_funcs_t (OUT transaction). 115 115 */ 116 IPC_M_USB _CONTROL_WRITE_SETUP,116 IPC_M_USBHC_CONTROL_WRITE_SETUP, 117 117 118 118 /** Send control-transfer data to device. 119 119 * See explanation at usb_iface_funcs_t (OUT transaction). 120 120 */ 121 IPC_M_USB _CONTROL_WRITE_DATA,121 IPC_M_USBHC_CONTROL_WRITE_DATA, 122 122 123 123 /** Terminate WRITE control transfer. 124 124 * See explanation at usb_iface_funcs_t (NO-DATA transaction). 125 125 */ 126 IPC_M_USB _CONTROL_WRITE_STATUS,126 IPC_M_USBHC_CONTROL_WRITE_STATUS, 127 127 128 128 … … 131 131 * See explanation at usb_iface_funcs_t (OUT transaction). 132 132 */ 133 IPC_M_USB _CONTROL_READ_SETUP,133 IPC_M_USBHC_CONTROL_READ_SETUP, 134 134 135 135 /** Get control-transfer data from device. 136 136 * See explanation at usb_iface_funcs_t (IN transaction). 137 137 */ 138 IPC_M_USB _CONTROL_READ_DATA,138 IPC_M_USBHC_CONTROL_READ_DATA, 139 139 140 140 /** Terminate READ control transfer. 141 141 * See explanation at usb_iface_funcs_t (NO-DATA transaction). 142 142 */ 143 IPC_M_USB _CONTROL_READ_STATUS,143 IPC_M_USBHC_CONTROL_READ_STATUS, 144 144 145 145 146 146 /* IPC_M_USB_ */ 147 } usb _iface_funcs_t;147 } usbhc_iface_funcs_t; 148 148 149 149 /** Callback for outgoing transfer. */ 150 typedef void (*usb _iface_transfer_out_callback_t)(device_t *,150 typedef void (*usbhc_iface_transfer_out_callback_t)(device_t *, 151 151 usb_transaction_outcome_t, void *); 152 152 153 153 /** Callback for incoming transfer. */ 154 typedef void (*usb _iface_transfer_in_callback_t)(device_t *,154 typedef void (*usbhc_iface_transfer_in_callback_t)(device_t *, 155 155 usb_transaction_outcome_t, size_t, void *); 156 156 … … 159 159 int (*interrupt_out)(device_t *, usb_target_t, 160 160 void *, size_t, 161 usb _iface_transfer_out_callback_t, void *);161 usbhc_iface_transfer_out_callback_t, void *); 162 162 int (*interrupt_in)(device_t *, usb_target_t, 163 163 void *, size_t, 164 usb _iface_transfer_in_callback_t, void *);165 } usb _iface_t;164 usbhc_iface_transfer_in_callback_t, void *); 165 } usbhc_iface_t; 166 166 167 167 -
uspace/lib/usb/src/hcdhubd.c
r32eceb4f rcb59f787 34 34 */ 35 35 #include <usb/hcdhubd.h> 36 #include <usb _iface.h>36 #include <usbhc_iface.h> 37 37 #include <driver.h> 38 38 #include <bool.h> … … 45 45 static usb_hc_driver_t *hc_driver = NULL; 46 46 47 static usb _iface_t usb_interface = {47 static usbhc_iface_t usb_interface = { 48 48 .interrupt_out = NULL, 49 49 .interrupt_in = NULL … … 51 51 52 52 static device_ops_t usb_device_ops = { 53 .interfaces[USB _DEV_IFACE] = &usb_interface53 .interfaces[USBHC_DEV_IFACE] = &usb_interface 54 54 }; 55 55 -
uspace/lib/usb/src/usbdrv.c
r32eceb4f rcb59f787 34 34 */ 35 35 #include <usb/usbdrv.h> 36 #include <usb _iface.h>36 #include <usbhc_iface.h> 37 37 #include <errno.h> 38 38 … … 121 121 122 122 transfer->request = async_send_4(phone, 123 DEV_IFACE_ID(USB _DEV_IFACE),123 DEV_IFACE_ID(USBHC_DEV_IFACE), 124 124 method, 125 125 target.address, target.endpoint, … … 184 184 185 185 transfer->request = async_send_4(phone, 186 DEV_IFACE_ID(USB _DEV_IFACE),186 DEV_IFACE_ID(USBHC_DEV_IFACE), 187 187 method, 188 188 target.address, target.endpoint, … … 214 214 215 215 req = async_send_2(phone, 216 DEV_IFACE_ID(USB _DEV_IFACE),217 IPC_M_USB _GET_BUFFER,216 DEV_IFACE_ID(USBHC_DEV_IFACE), 217 IPC_M_USBHC_GET_BUFFER, 218 218 hash, 219 219 &answer_data); … … 305 305 { 306 306 return async_send_buffer(phone, 307 IPC_M_USB _INTERRUPT_OUT,307 IPC_M_USBHC_INTERRUPT_OUT, 308 308 target, 309 309 buffer, size, … … 317 317 { 318 318 return async_recv_buffer(phone, 319 IPC_M_USB _INTERRUPT_IN,319 IPC_M_USBHC_INTERRUPT_IN, 320 320 target, 321 321 buffer, size, actual_size,
Note:
See TracChangeset
for help on using the changeset viewer.