Changeset bee37cf in mainline for uspace/drv/bus/usb
- Timestamp:
- 2011-07-05T21:21:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e2aa83, eb66f236
- Parents:
- 3714e79 (diff), f7a55f9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/drv/bus/usb
- Files:
-
- 133 added
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci.h
r3714e79 rbee37cf 1 1 /* 2 * Copyright (c) 20 09 Jiri Svoboda2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup drvusbehci 31 30 * @{ 32 31 */ 33 32 /** @file 33 * Common EHCI definitions. 34 34 */ 35 #ifndef DRV_EHCI_EHCI_H 36 #define DRV_EHCI_EHCI_H 35 37 36 #ifndef LIBC_IPC_MOUSE_H_ 37 #define LIBC_IPC_MOUSE_H_ 38 #include <usbhc_iface.h> 38 39 39 # include <ipc/common.h>40 #define NAME "ehci" 40 41 41 typedef enum { 42 MEVENT_BUTTON = IPC_FIRST_USER_METHOD, 43 MEVENT_MOVE 44 } mouse_notif_t; 42 extern usbhc_iface_t ehci_hc_iface; 45 43 46 44 #endif 47 48 45 /** 49 46 * @} 50 47 */ 48 -
uspace/drv/bus/usb/uhci/uhci.h
r3714e79 rbee37cf 1 1 /* 2 * Copyright (c) 20 09 Jiri Svoboda2 * Copyright (c) 2011 Jan Vesely 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup drvusbuhci 31 30 * @{ 32 31 */ 33 32 /** @file 33 * @brief UHCI driver main structure for both host controller and root-hub. 34 34 */ 35 #ifndef DRV_UHCI_UHCI_H 36 #define DRV_UHCI_UHCI_H 37 #include <ddf/driver.h> 35 38 36 #ifndef CHAR_MOUSE_H_ 37 #define CHAR_MOUSE_H_ 38 39 extern void mouse_handle_byte(int); 40 extern void mouse_ev_btn(int button, int press); 41 extern void mouse_ev_move(int dx, int dy); 42 39 int device_setup_uhci(ddf_dev_t *device); 43 40 #endif 44 45 41 /** 46 42 * @} -
uspace/drv/bus/usb/usbhub/main.c
r3714e79 rbee37cf 1 1 /* 2 * Copyright (c) 2010 Jiri Svoboda2 * Copyright (c) 2010 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse29 /** @addtogroup drvusbhub 30 30 * @{ 31 */32 /** @file33 * @brief34 31 */ 35 32 36 #include <ipc/adb.h> 33 #include <ddf/driver.h> 34 #include <errno.h> 37 35 #include <async.h> 38 #include <vfs/vfs.h> 39 #include <fcntl.h> 40 #include <errno.h> 36 #include <stdio.h> 41 37 42 #include "adb_mouse.h"43 #include "adb_dev.h"38 #include <usb/dev/driver.h> 39 #include <usb/classes/classes.h> 44 40 45 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall); 41 #include "usbhub.h" 42 #include "usbhub_private.h" 46 43 47 static int dev_phone; 44 /** Hub status-change endpoint description. 45 * 46 * For more information see section 11.15.1 of USB 1.1 specification. 47 */ 48 static usb_endpoint_description_t hub_status_change_endpoint_description = { 49 .transfer_type = USB_TRANSFER_INTERRUPT, 50 .direction = USB_DIRECTION_IN, 51 .interface_class = USB_CLASS_HUB, 52 .interface_subclass = 0, 53 .interface_protocol = 0, 54 .flags = 0 55 }; 48 56 49 int adb_dev_init(void) 57 /** 58 * usb hub driver operations 59 * 60 * The most important one is add_device, which is set to usb_hub_add_device. 61 */ 62 static usb_driver_ops_t usb_hub_driver_ops = { 63 .add_device = usb_hub_add_device 64 }; 65 66 /** 67 * hub endpoints, excluding control endpoint 68 */ 69 static usb_endpoint_description_t *usb_hub_endpoints[] = { 70 &hub_status_change_endpoint_description, 71 NULL 72 }; 73 74 /** 75 * static usb hub driver information 76 */ 77 static usb_driver_t usb_hub_driver = { 78 .name = NAME, 79 .ops = &usb_hub_driver_ops, 80 .endpoints = usb_hub_endpoints 81 }; 82 83 84 int main(int argc, char *argv[]) 50 85 { 51 const char *input = "/dev/adb/mouse"; 52 int input_fd; 86 printf(NAME ": HelenOS USB hub driver.\n"); 53 87 54 printf(NAME ": open %s\n", input);88 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 55 89 56 input_fd = open(input, O_RDONLY); 57 if (input_fd < 0) { 58 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 59 return false; 60 } 61 62 dev_phone = fd_phone(input_fd); 63 if (dev_phone < 0) { 64 printf(NAME ": Failed to connect to device\n"); 65 return false; 66 } 67 68 /* NB: The callback connection is slotted for removal */ 69 if (async_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) { 70 printf(NAME ": Failed to create callback from device\n"); 71 return false; 72 } 73 74 return 0; 75 } 76 77 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall) 78 { 79 /* Ignore parameters, the connection is already opened */ 80 while (true) { 81 82 ipc_call_t call; 83 ipc_callid_t callid = async_get_call(&call); 84 85 int retval; 86 87 switch (IPC_GET_IMETHOD(call)) { 88 case IPC_M_PHONE_HUNGUP: 89 /* TODO: Handle hangup */ 90 return; 91 case IPC_FIRST_USER_METHOD: 92 mouse_handle_data(IPC_GET_ARG1(call)); 93 break; 94 default: 95 retval = ENOENT; 96 } 97 async_answer_0(callid, retval); 98 } 90 return usb_driver_main(&usb_hub_driver); 99 91 } 100 92 … … 102 94 * @} 103 95 */ 96
Note:
See TracChangeset
for help on using the changeset viewer.