Changeset 4b4c797 in mainline
- Timestamp:
- 2010-11-20T14:07:05Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b22bd4
- Parents:
- 0e126be7
- Files:
-
- 4 deleted
- 21 edited
- 13 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r0e126be7 r4b4c797 142 142 $(USPACE_PATH)/app/ping/ping \ 143 143 $(USPACE_PATH)/app/stats/stats \ 144 $(USPACE_PATH)/app/usb/usb \145 144 $(USPACE_PATH)/app/virtusbkbd/vuk \ 146 145 $(USPACE_PATH)/app/tasks/tasks \ -
uspace/Makefile
r0e126be7 r4b4c797 50 50 app/trace \ 51 51 app/top \ 52 app/usb \53 52 app/virtusbkbd \ 54 53 app/netstart \ -
uspace/app/virtusbkbd/Makefile
r0e126be7 r4b4c797 33 33 34 34 LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a 35 EXTRA_CFLAGS = -I$(LIB _PREFIX)35 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIB_PREFIX) 36 36 37 37 SOURCES = \ -
uspace/app/virtusbkbd/kbdconfig.c
r0e126be7 r4b4c797 36 36 #include "kbdconfig.h" 37 37 #include "keys.h" 38 #include <usb/ hcd.h>39 #include <usb/ hid.h>40 #include <usb/ hidut.h>41 #include <usb/classes .h>38 #include <usb/usb.h> 39 #include <usb/classes/hid.h> 40 #include <usb/classes/hidut.h> 41 #include <usb/classes/classes.h> 42 42 43 43 /** Standard device descriptor. */ -
uspace/app/virtusbkbd/keys.h
r0e126be7 r4b4c797 49 49 /** USB key code. */ 50 50 typedef enum { 51 #include <usb/ hidutkbd.h>51 #include <usb/classes/hidutkbd.h> 52 52 } key_code_t; 53 53 -
uspace/app/virtusbkbd/virtusbkbd.c
r0e126be7 r4b4c797 45 45 #include <async.h> 46 46 47 #include <usb/ hcd.h>47 #include <usb/usb.h> 48 48 #include <usb/descriptor.h> 49 #include <usb/ hid.h>49 #include <usb/classes/hid.h> 50 50 #include <usbvirt/device.h> 51 51 #include <usbvirt/hub.h> -
uspace/drv/uhci/Makefile
r0e126be7 r4b4c797 29 29 USPACE_PREFIX = ../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIB _PREFIX)31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include 32 32 BINARY = uhci 33 33 -
uspace/drv/usbkbd/Makefile
r0e126be7 r4b4c797 29 29 USPACE_PREFIX = ../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIB _PREFIX)31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include 32 32 BINARY = usbkbd 33 33 -
uspace/drv/vhc/Makefile
r0e126be7 r4b4c797 34 34 EXTRA_CFLAGS += \ 35 35 -I$(LIB_PREFIX) \ 36 -I$(LIBUSB_PREFIX)/include \ 36 37 -I$(LIBDRV_PREFIX)/include 37 38 BINARY = vhc -
uspace/drv/vhc/conn.h
r0e126be7 r4b4c797 36 36 #define VHCD_CONN_H_ 37 37 38 #include <usb/ hcd.h>38 #include <usb/usb.h> 39 39 #include <usb/hcdhubd.h> 40 40 #include "vhcd.h" -
uspace/drv/vhc/connhost.c
r0e126be7 r4b4c797 35 35 #include <assert.h> 36 36 #include <errno.h> 37 #include <usb/ hcd.h>37 #include <usb/usb.h> 38 38 39 39 #include "vhcd.h" 40 40 #include "conn.h" 41 41 #include "hc.h" 42 43 typedef struct {44 ipc_callid_t caller;45 void *buffer;46 size_t size;47 } async_transaction_t;48 49 static void async_out_callback(void * buffer, size_t len,50 usb_transaction_outcome_t outcome, void * arg)51 {52 async_transaction_t * trans = (async_transaction_t *)arg;53 54 dprintf(2, "async_out_callback(buffer, %u, %d, %p) -> %x",55 len, outcome, arg, trans->caller);56 57 // FIXME - answer according to outcome58 ipc_answer_1(trans->caller, EOK, 0);59 60 free(trans);61 if (buffer) {62 free(buffer);63 }64 dprintf(4, "async_out_callback answered");65 }66 67 static void async_to_device(ipc_callid_t iid, ipc_call_t icall, bool setup_transaction)68 {69 size_t expected_len = IPC_GET_ARG3(icall);70 usb_target_t target = {71 .address = IPC_GET_ARG1(icall),72 .endpoint = IPC_GET_ARG2(icall)73 };74 75 dprintf(1, "async_to_device: dev=%d:%d, size=%d, iid=%x",76 target.address, target.endpoint, expected_len, iid);77 78 size_t len = 0;79 void * buffer = NULL;80 if (expected_len > 0) {81 int rc = async_data_write_accept(&buffer, false,82 1, USB_MAX_PAYLOAD_SIZE,83 0, &len);84 85 if (rc != EOK) {86 ipc_answer_0(iid, rc);87 return;88 }89 }90 91 async_transaction_t * trans = malloc(sizeof(async_transaction_t));92 trans->caller = iid;93 trans->buffer = NULL;94 trans->size = 0;95 96 hc_add_transaction_to_device(setup_transaction, target,97 buffer, len,98 async_out_callback, trans);99 100 dprintf(2, "async transaction to device scheduled (%p)", trans);101 }102 103 static void async_in_callback(void * buffer, size_t len,104 usb_transaction_outcome_t outcome, void * arg)105 {106 async_transaction_t * trans = (async_transaction_t *)arg;107 108 dprintf(2, "async_in_callback(buffer, %u, %d, %p) -> %x",109 len, outcome, arg, trans->caller);110 111 trans->buffer = buffer;112 trans->size = len;113 114 ipc_callid_t caller = trans->caller;115 116 if (buffer == NULL) {117 free(trans);118 trans = NULL;119 }120 121 122 // FIXME - answer according to outcome123 ipc_answer_1(caller, EOK, (ipcarg_t)trans);124 dprintf(4, "async_in_callback answered (%#x)", (ipcarg_t)trans);125 }126 127 static void async_from_device(ipc_callid_t iid, ipc_call_t icall)128 {129 usb_target_t target = {130 .address = IPC_GET_ARG1(icall),131 .endpoint = IPC_GET_ARG2(icall)132 };133 size_t len = IPC_GET_ARG3(icall);134 135 dprintf(1, "async_from_device: dev=%d:%d, size=%d, iid=%x",136 target.address, target.endpoint, len, iid);137 138 void * buffer = NULL;139 if (len > 0) {140 buffer = malloc(len);141 }142 143 async_transaction_t * trans = malloc(sizeof(async_transaction_t));144 trans->caller = iid;145 trans->buffer = NULL;146 trans->size = 0;147 148 hc_add_transaction_from_device(target,149 buffer, len,150 async_in_callback, trans);151 152 dprintf(2, "async transfer from device scheduled (%p)", trans);153 }154 155 static void async_get_buffer(ipc_callid_t iid, ipc_call_t icall)156 {157 ipcarg_t buffer_hash = IPC_GET_ARG1(icall);158 async_transaction_t * trans = (async_transaction_t *)buffer_hash;159 if (trans == NULL) {160 ipc_answer_0(iid, ENOENT);161 return;162 }163 if (trans->buffer == NULL) {164 ipc_answer_0(iid, EINVAL);165 free(trans);166 return;167 }168 169 ipc_callid_t callid;170 size_t accepted_size;171 if (!async_data_read_receive(&callid, &accepted_size)) {172 ipc_answer_0(iid, EINVAL);173 return;174 }175 176 if (accepted_size > trans->size) {177 accepted_size = trans->size;178 }179 async_data_read_finalize(callid, trans->buffer, accepted_size);180 181 ipc_answer_1(iid, EOK, accepted_size);182 183 free(trans->buffer);184 free(trans);185 }186 187 188 /** Connection handler for communcation with host.189 * By host is typically meant top-level USB driver.190 *191 * This function also takes care of proper phone hung-up.192 *193 * @param phone_hash Incoming phone hash.194 */195 void connection_handler_host(ipcarg_t phone_hash)196 {197 dprintf(0, "host connected through phone %#x", phone_hash);198 199 200 while (true) {201 ipc_callid_t callid;202 ipc_call_t call;203 204 callid = async_get_call(&call);205 206 dprintf(6, "host on %#x calls [%x: %u (%u, %u, %u, %u, %u)]",207 phone_hash,208 callid,209 IPC_GET_METHOD(call),210 IPC_GET_ARG1(call), IPC_GET_ARG2(call), IPC_GET_ARG3(call),211 IPC_GET_ARG4(call), IPC_GET_ARG5(call));212 213 switch (IPC_GET_METHOD(call)) {214 215 /* standard IPC methods */216 217 case IPC_M_PHONE_HUNGUP:218 ipc_answer_0(callid, EOK);219 dprintf(0, "phone%#x: host hung-up",220 phone_hash);221 return;222 223 case IPC_M_CONNECT_TO_ME:224 ipc_answer_0(callid, ELIMIT);225 break;226 227 228 /* USB methods */229 230 case IPC_M_USB_HCD_TRANSACTION_SIZE:231 ipc_answer_1(callid, EOK, USB_MAX_PAYLOAD_SIZE);232 break;233 234 case IPC_M_USB_HCD_GET_BUFFER_ASYNC:235 async_get_buffer(callid, call);236 break;237 238 case IPC_M_USB_HCD_INTERRUPT_OUT_ASYNC:239 case IPC_M_USB_HCD_CONTROL_WRITE_DATA_ASYNC:240 case IPC_M_USB_HCD_CONTROL_READ_STATUS_ASYNC:241 async_to_device(callid, call, false);242 break;243 244 case IPC_M_USB_HCD_CONTROL_WRITE_SETUP_ASYNC:245 case IPC_M_USB_HCD_CONTROL_READ_SETUP_ASYNC:246 async_to_device(callid, call, true);247 break;248 249 case IPC_M_USB_HCD_INTERRUPT_IN_ASYNC:250 case IPC_M_USB_HCD_CONTROL_WRITE_STATUS_ASYNC:251 case IPC_M_USB_HCD_CONTROL_READ_DATA_ASYNC:252 async_from_device(callid, call);253 break;254 255 256 /* end of known methods */257 258 default:259 dprintf_inval_call(2, call, phone_hash);260 ipc_answer_0(callid, EINVAL);261 break;262 }263 }264 }265 42 266 43 static int enqueue_transfer_out(usb_hc_device_t *hc, -
uspace/drv/vhc/devices.h
r0e126be7 r4b4c797 37 37 38 38 #include <adt/list.h> 39 #include <usb/ hcd.h>39 #include <usb/usb.h> 40 40 41 41 #include "hc.h" -
uspace/drv/vhc/hc.h
r0e126be7 r4b4c797 36 36 #define VHCD_HC_H_ 37 37 38 #include <usb/ hcd.h>38 #include <usb/usb.h> 39 39 #include <usbvirt/hub.h> 40 40 -
uspace/drv/vhc/hcd.c
r0e126be7 r4b4c797 45 45 #include <driver.h> 46 46 47 #include <usb/ hcd.h>47 #include <usb/usb.h> 48 48 #include "vhcd.h" 49 49 #include "hc.h" -
uspace/drv/vhc/hub.c
r0e126be7 r4b4c797 33 33 * @brief Virtual USB hub. 34 34 */ 35 #include <usb/classes .h>35 #include <usb/classes/classes.h> 36 36 #include <usbvirt/hub.h> 37 37 #include <usbvirt/device.h> -
uspace/drv/vhc/hubops.c
r0e126be7 r4b4c797 33 33 * @brief Virtual USB hub operations. 34 34 */ 35 #include <usb/classes .h>36 #include <usb/ hub.h>35 #include <usb/classes/classes.h> 36 #include <usb/classes/hub.h> 37 37 #include <usbvirt/hub.h> 38 38 #include <usbvirt/device.h> -
uspace/lib/drv/Makefile
r0e126be7 r4b4c797 29 29 30 30 USPACE_PREFIX = ../.. 31 EXTRA_CFLAGS = -Iinclude -I$(LIB _PREFIX)31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include 32 32 LIBRARY = libdrv 33 33 -
uspace/lib/usb/Makefile
r0e126be7 r4b4c797 30 30 LIBRARY = libusb 31 31 LIBS = $(LIBDRV_PREFIX)/libdrv.a 32 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I $(LIB_PREFIX)32 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -Iinclude 33 33 34 34 SOURCES = \ 35 hcd.c \ 36 hcdhubd.c \ 37 usb.c \ 38 usbdrv.c 35 src/hcdhubd.c \ 36 src/usb.c \ 37 src/usbdrv.c 39 38 40 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/usb/include/usb/devreq.h
r0e126be7 r4b4c797 75 75 uint16_t value; 76 76 }; 77 /** Auxil ary parameter to the request.77 /** Auxiliary parameter to the request. 78 78 * Typically, it is offset to something. 79 79 */ -
uspace/lib/usb/include/usb/hcdhubd.h
r0e126be7 r4b4c797 38 38 #include <adt/list.h> 39 39 #include <driver.h> 40 #include "usb.h" 41 #include "hcd.h" 40 #include <usb/usb.h> 42 41 43 42 /** Endpoint properties. */ -
uspace/lib/usb/include/usb/usb.h
r0e126be7 r4b4c797 98 98 typedef ipcarg_t usb_handle_t; 99 99 100 /** USB packet identifier. */ 101 typedef enum { 102 #define _MAKE_PID_NIBBLE(tag, type) \ 103 ((uint8_t)(((tag) << 2) | (type))) 104 #define _MAKE_PID(tag, type) \ 105 ( \ 106 _MAKE_PID_NIBBLE(tag, type) \ 107 | ((~_MAKE_PID_NIBBLE(tag, type)) << 4) \ 108 ) 109 USB_PID_OUT = _MAKE_PID(0, 1), 110 USB_PID_IN = _MAKE_PID(2, 1), 111 USB_PID_SOF = _MAKE_PID(1, 1), 112 USB_PID_SETUP = _MAKE_PID(3, 1), 113 114 USB_PID_DATA0 = _MAKE_PID(0 ,3), 115 USB_PID_DATA1 = _MAKE_PID(2 ,3), 116 117 USB_PID_ACK = _MAKE_PID(0 ,2), 118 USB_PID_NAK = _MAKE_PID(2 ,2), 119 USB_PID_STALL = _MAKE_PID(3 ,2), 120 121 USB_PID_PRE = _MAKE_PID(3 ,0), 122 /* USB_PID_ = _MAKE_PID( ,), */ 123 #undef _MAKE_PID 124 #undef _MAKE_PID_NIBBLE 125 } usb_packet_id; 126 100 127 #endif 101 128 /** -
uspace/lib/usb/src/hcdhubd.c
r0e126be7 r4b4c797 33 33 * @brief HC driver and hub driver (implementation). 34 34 */ 35 #include "hcdhubd.h"35 #include <usb/hcdhubd.h> 36 36 #include <usb_iface.h> 37 37 #include <driver.h> -
uspace/lib/usb/src/usb.c
r0e126be7 r4b4c797 33 33 * @brief Base USB types. 34 34 */ 35 #include "usb.h"35 #include <usb/usb.h> 36 36 #include <errno.h> 37 37 -
uspace/lib/usb/src/usbdrv.c
r0e126be7 r4b4c797 33 33 * @brief USB driver (implementation). 34 34 */ 35 #include "usbdrv.h"35 #include <usb/usbdrv.h> 36 36 #include <usb_iface.h> 37 37 #include <errno.h> -
uspace/lib/usbvirt/Makefile
r0e126be7 r4b4c797 31 31 32 32 LIBS = $(LIBUSB_PREFIX)/libusb.a 33 EXTRA_CFLAGS = -I$(LIB _PREFIX)33 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include 34 34 35 35 SOURCES = \ -
uspace/lib/usbvirt/callback.c
r0e126be7 r4b4c797 45 45 46 46 #define NAMESPACE "usb" 47 #define USB_MAX_PAYLOAD_SIZE 1020 47 48 48 49 /** Wrapper for SETUP transaction over telephone. */ -
uspace/lib/usbvirt/device.h
r0e126be7 r4b4c797 36 36 #define LIBUSBVIRT_DEVICE_H_ 37 37 38 #include <usb/ hcd.h>38 #include <usb/usb.h> 39 39 #include <usb/descriptor.h> 40 40 #include <usb/devreq.h>
Note:
See TracChangeset
for help on using the changeset viewer.