Changeset 63b4f90 in mainline


Ignore:
Timestamp:
2010-11-19T18:36:29Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
91db50ac
Parents:
3f0a7971
Message:

First step to make virtual HC aware of DDF

Also, devman is automatically started on vt7.

Files:
2 added
1 deleted
6 edited
14 moved

Legend:

Unmodified
Added
Removed
  • .bzrignore

    r3f0a7971 r63b4f90  
    9595./uspace/dist/drv/uhci/
    9696./uspace/dist/drv/usbkbd/
     97./uspace/dist/drv/vhc/
    9798./uspace/dist/srv/arp
    9899./uspace/dist/srv/ata_bd
     
    130131./uspace/drv/uhci/uhci
    131132./uspace/drv/usbkbd/usbkbd
     133./uspace/drv/vhc/vhc
    132134./uspace/srv/bd/ata_bd/ata_bd
    133135./uspace/srv/bd/file_bd/file_bd
     
    149151./uspace/srv/hid/s3c24xx_ts/s3c24ts
    150152./uspace/srv/hw/bus/pci/pci
    151 ./uspace/srv/hw/bus/usb/hcd/virtual/vhcd
    152153./uspace/srv/hw/char/i8042/i8042
    153154./uspace/srv/hw/char/s3c24xx_uart/s3c24ser
  • boot/Makefile.common

    r3f0a7971 r63b4f90  
    110110       
    111111RD_DRVS = \
    112         root
     112        root \
     113        vhc
    113114
    114115RD_DRV_CFG =
  • uspace/Makefile

    r3f0a7971 r63b4f90  
    8181        srv/hw/char/s3c24xx_uart \
    8282        srv/hw/netif/dp8390 \
    83         srv/hw/bus/usb/hcd/virtual \
    8483        srv/net/cfg \
    8584        srv/net/netif/lo \
     
    9089        srv/net/tl/tcp \
    9190        srv/net/net \
    92         drv/root
     91        drv/root \
     92        drv/vhc
    9393
    9494## Networking
  • uspace/app/init/init.c

    r3f0a7971 r63b4f90  
    312312        getterm("term/vc5", "/app/bdsh", false);
    313313        getterm("term/vc6", "/app/klog", false);
     314        getterm("term/vc7", "/srv/devman", false);
    314315       
    315316        return 0;
  • uspace/drv/root/root.c

    r3f0a7971 r63b4f90  
    119119}
    120120
     121/** Create virtual USB host controller device.
     122 * Note that the virtual HC is actually device and driver in one
     123 * task.
     124 *
     125 * @param parent Parent device.
     126 * @return Error code.
     127 */
     128static int add_virtual_usb_host_controller(device_t *parent)
     129{
     130        printf(NAME ": adding virtual host contoller.\n");
     131
     132        int rc;
     133        device_t *vhc = NULL;
     134        match_id_t *match_id = NULL;
     135
     136        vhc = create_device();
     137        if (vhc == NULL) {
     138                rc = ENOMEM;
     139                goto failure;
     140        }
     141
     142        vhc->name = "vhc";
     143        printf(NAME ": the new device's name is %s.\n", vhc->name);
     144
     145        /* Initialize match id list. */
     146        match_id = create_match_id();
     147        if (match_id == NULL) {
     148                rc = ENOMEM;
     149                goto failure;
     150        }
     151
     152        match_id->id = "usb&hc=vhc";
     153        match_id->score = 100;
     154        add_match_id(&vhc->match_ids, match_id);
     155
     156        /* Register child device. */
     157        rc = child_device_register(vhc, parent);
     158        if (rc != EOK)
     159                goto failure;
     160
     161        return EOK;
     162
     163failure:
     164        if (match_id != NULL)
     165                match_id->id = NULL;
     166
     167        if (vhc != NULL) {
     168                vhc->name = NULL;
     169                delete_device(vhc);
     170        }
     171
     172        return rc;
     173}
     174
    121175/** Get the root device.
    122176 *
     
    133187                printf(NAME ": failed to add child device for platform.\n");
    134188       
     189        /* Register virtual USB host controller. */
     190        int rc = add_virtual_usb_host_controller(dev);
     191        if (EOK != rc) {
     192                printf(NAME ": failed to add child device - virtual USB HC.\n");
     193        }
     194
    135195        return res;
    136196}
  • uspace/drv/uhci/uhci.ma

    r3f0a7971 r63b4f90  
    1 10 pci/ven=8086&dev=7020
     10 pci/ven=8086&dev=7020
    2210 usb&hc=uhci
    3310 usb&hc=uhci&hub
  • uspace/drv/vhc/Makefile

    r3f0a7971 r63b4f90  
    2727#
    2828
    29 USPACE_PREFIX = ../../../../../..
    30 LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a
    31 EXTRA_CFLAGS = -I$(LIB_PREFIX)
    32 BINARY = vhcd
     29USPACE_PREFIX = ../..
     30LIBS = \
     31        $(LIBUSB_PREFIX)/libusb.a \
     32        $(LIBUSBVIRT_PREFIX)/libusbvirt.a \
     33        $(LIBDRV_PREFIX)/libdrv.a
     34EXTRA_CFLAGS += \
     35        -I$(LIB_PREFIX) \
     36        -I$(LIBDRV_PREFIX)/include
     37BINARY = vhc
    3338
    3439SOURCES = \
  • uspace/drv/vhc/conn.h

    r3f0a7971 r63b4f90  
    3737
    3838#include <usb/hcd.h>
     39#include <usb/hcdhubd.h>
    3940#include "vhcd.h"
    4041#include "devices.h"
     
    4243void connection_handler_host(ipcarg_t);
    4344void connection_handler_device(ipcarg_t, virtdev_connection_t *);
     45usb_hcd_transfer_ops_t vhc_transfer_ops;
    4446
    4547#endif
  • uspace/drv/vhc/connhost.c

    r3f0a7971 r63b4f90  
    264264}
    265265
     266static int enqueue_transfer_out(usb_hc_device_t *hc,
     267    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     268    void *buffer, size_t size,
     269    usb_hcd_transfer_callback_out_t callback, void *arg)
     270{
     271        printf(NAME ": transfer OUT [%d.%d (%s); %u]\n",
     272            dev->address, endpoint->endpoint,
     273            usb_str_transfer_type(endpoint->transfer_type),
     274            size);
     275        return ENOTSUP;
     276}
     277
     278static int enqueue_transfer_setup(usb_hc_device_t *hc,
     279    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     280    void *buffer, size_t size,
     281    usb_hcd_transfer_callback_out_t callback, void *arg)
     282{
     283        printf(NAME ": transfer SETUP [%d.%d (%s); %u]\n",
     284            dev->address, endpoint->endpoint,
     285            usb_str_transfer_type(endpoint->transfer_type),
     286            size);
     287        return ENOTSUP;
     288}
     289
     290static int enqueue_transfer_in(usb_hc_device_t *hc,
     291    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     292    void *buffer, size_t size,
     293    usb_hcd_transfer_callback_in_t callback, void *arg)
     294{
     295        printf(NAME ": transfer IN [%d.%d (%s); %u]\n",
     296            dev->address, endpoint->endpoint,
     297            usb_str_transfer_type(endpoint->transfer_type),
     298            size);
     299        return ENOTSUP;
     300}
     301
     302
     303usb_hcd_transfer_ops_t vhc_transfer_ops = {
     304        .transfer_out = enqueue_transfer_out,
     305        .transfer_in = enqueue_transfer_in,
     306        .transfer_setup = enqueue_transfer_setup
     307};
     308
    266309/**
    267310 * @}
  • uspace/drv/vhc/devices.c

    r3f0a7971 r63b4f90  
    5353                pos = pos->next)
    5454
    55 LIST_INITIALIZE(devices);
     55static LIST_INITIALIZE(devices);
    5656
    5757/** Create virtual device.
  • uspace/drv/vhc/vhcd.h

    r3f0a7971 r63b4f90  
    3636#define VHCD_VHCD_H_
    3737
    38 #define NAME "hcd-virt"
     38#define NAME "vhc"
    3939#define NAME_DEV "hcd-virt-dev"
    4040#define NAMESPACE "usb"
Note: See TracChangeset for help on using the changeset viewer.