Changeset bee37cf in mainline for uspace/drv/bus/usb


Ignore:
Timestamp:
2011-07-05T21:21:36Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
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.
Message:

Merge mainline changes.

Location:
uspace/drv/bus/usb
Files:
133 added
3 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci.h

    r3714e79 rbee37cf  
    11/*
    2  * Copyright (c) 2009 Jiri Svoboda
     2 * Copyright (c) 2011 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup mouse
    30  * @brief
     29/** @addtogroup drvusbehci
    3130 * @{
    3231 */
    3332/** @file
     33 * Common EHCI definitions.
    3434 */
     35#ifndef DRV_EHCI_EHCI_H
     36#define DRV_EHCI_EHCI_H
    3537
    36 #ifndef LIBC_IPC_MOUSE_H_
    37 #define LIBC_IPC_MOUSE_H_
     38#include <usbhc_iface.h>
    3839
    39 #include <ipc/common.h>
     40#define NAME "ehci"
    4041
    41 typedef enum {
    42         MEVENT_BUTTON = IPC_FIRST_USER_METHOD,
    43         MEVENT_MOVE
    44 } mouse_notif_t;
     42extern usbhc_iface_t ehci_hc_iface;
    4543
    4644#endif
    47 
    4845/**
    4946 * @}
    5047 */
     48
  • uspace/drv/bus/usb/uhci/uhci.h

    r3714e79 rbee37cf  
    11/*
    2  * Copyright (c) 2009 Jiri Svoboda
     2 * Copyright (c) 2011 Jan Vesely
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup mouse
    30  * @brief
     29/** @addtogroup drvusbuhci
    3130 * @{
    3231 */
    3332/** @file
     33 * @brief UHCI driver main structure for both host controller and root-hub.
    3434 */
     35#ifndef DRV_UHCI_UHCI_H
     36#define DRV_UHCI_UHCI_H
     37#include <ddf/driver.h>
    3538
    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 
     39int device_setup_uhci(ddf_dev_t *device);
    4340#endif
    44 
    4541/**
    4642 * @}
  • uspace/drv/bus/usb/usbhub/main.c

    r3714e79 rbee37cf  
    11/*
    2  * Copyright (c) 2010 Jiri Svoboda
     2 * Copyright (c) 2010 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup mouse
     29/** @addtogroup drvusbhub
    3030 * @{
    31  */
    32 /** @file
    33  * @brief
    3431 */
    3532
    36 #include <ipc/adb.h>
     33#include <ddf/driver.h>
     34#include <errno.h>
    3735#include <async.h>
    38 #include <vfs/vfs.h>
    39 #include <fcntl.h>
    40 #include <errno.h>
     36#include <stdio.h>
    4137
    42 #include "adb_mouse.h"
    43 #include "adb_dev.h"
     38#include <usb/dev/driver.h>
     39#include <usb/classes/classes.h>
    4440
    45 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall);
     41#include "usbhub.h"
     42#include "usbhub_private.h"
    4643
    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 */
     48static 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};
    4856
    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 */
     62static 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 */
     69static 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 */
     77static usb_driver_t usb_hub_driver = {
     78        .name = NAME,
     79        .ops = &usb_hub_driver_ops,
     80        .endpoints = usb_hub_endpoints
     81};
     82
     83
     84int main(int argc, char *argv[])
    5085{
    51         const char *input = "/dev/adb/mouse";
    52         int input_fd;
     86        printf(NAME ": HelenOS USB hub driver.\n");
    5387
    54         printf(NAME ": open %s\n", input);
     88        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    5589
    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);
    9991}
    10092
     
    10294 * @}
    10395 */
     96
Note: See TracChangeset for help on using the changeset viewer.