Changes in / [54b141a:2cb6571] in mainline


Ignore:
Files:
1 added
8 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    r54b141a r2cb6571  
    9494./uspace/dist/drv/rootia32/
    9595./uspace/dist/drv/uhci/
    96 ./uspace/dist/drv/usbhub/
    9796./uspace/dist/drv/usbkbd/
    9897./uspace/dist/drv/vhc/
     
    131130./uspace/drv/rootia32/rootia32
    132131./uspace/drv/uhci/uhci
    133 ./uspace/drv/usbhub/usbhub
    134132./uspace/drv/usbkbd/usbkbd
    135133./uspace/drv/vhc/vhc
  • boot/arch/amd64/Makefile.inc

    r54b141a r2cb6571  
    4242        ns8250 \
    4343        uhci \
    44         usbhub \
    4544        usbkbd
    4645       
  • uspace/Makefile

    r54b141a r2cb6571  
    118118        DIRS += drv/ns8250
    119119        DIRS += drv/uhci
    120         DIRS += drv/usbhub
    121120        DIRS += drv/usbkbd
    122121endif
  • uspace/drv/uhci/Makefile

    r54b141a r2cb6571  
    3333
    3434SOURCES = \
    35         main.c \
    36         transfers.c
     35        main.c
    3736
    3837include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/uhci/main.c

    r54b141a r2cb6571  
    2828#include <usb/hcdhubd.h>
    2929#include <errno.h>
    30 #include "uhci.h"
    3130
    32 static device_ops_t uhci_ops = {
    33         .interfaces[USBHC_DEV_IFACE] = &uhci_iface,
     31static int enqueue_transfer_out(usb_hc_device_t *hc,
     32    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     33    void *buffer, size_t size,
     34    usb_hcd_transfer_callback_out_t callback, void *arg)
     35{
     36        printf("UHCI: transfer OUT [%d.%d (%s); %u]\n",
     37            dev->address, endpoint->endpoint,
     38            usb_str_transfer_type(endpoint->transfer_type),
     39            size);
     40        return ENOTSUP;
     41}
     42
     43static int enqueue_transfer_setup(usb_hc_device_t *hc,
     44    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     45    void *buffer, size_t size,
     46    usb_hcd_transfer_callback_out_t callback, void *arg)
     47{
     48        printf("UHCI: transfer SETUP [%d.%d (%s); %u]\n",
     49            dev->address, endpoint->endpoint,
     50            usb_str_transfer_type(endpoint->transfer_type),
     51            size);
     52        return ENOTSUP;
     53}
     54
     55static int enqueue_transfer_in(usb_hc_device_t *hc,
     56    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
     57    void *buffer, size_t size,
     58    usb_hcd_transfer_callback_in_t callback, void *arg)
     59{
     60        printf("UHCI: transfer IN [%d.%d (%s); %u]\n",
     61            dev->address, endpoint->endpoint,
     62            usb_str_transfer_type(endpoint->transfer_type),
     63            size);
     64        return ENOTSUP;
     65}
     66
     67static usb_hcd_transfer_ops_t uhci_transfer_ops = {
     68        .transfer_out = enqueue_transfer_out,
     69        .transfer_in = enqueue_transfer_in,
     70        .transfer_setup = enqueue_transfer_setup
    3471};
    3572
    36 static int uhci_add_device(device_t *device)
     73static int uhci_add_hc(usb_hc_device_t *device)
    3774{
    38         device->ops = &uhci_ops;
     75        device->transfer_ops = &uhci_transfer_ops;
    3976
    4077        /*
     
    4683}
    4784
    48 static driver_ops_t uhci_driver_ops = {
    49         .add_device = uhci_add_device,
    50 };
    51 
    52 static driver_t uhci_driver = {
    53         .name = NAME,
    54         .driver_ops = &uhci_driver_ops
     85usb_hc_driver_t uhci_driver = {
     86        .name = "uhci",
     87        .add_hc = uhci_add_hc
    5588};
    5689
     
    6093         * Do some global initializations.
    6194         */
    62         sleep(5);
    6395
    64         return driver_main(&uhci_driver);
     96        return usb_hcd_main(&uhci_driver);
    6597}
  • uspace/drv/uhci/uhci.ma

    r54b141a r2cb6571  
    1110 pci/ven=8086&dev=7020
    2 
     210 usb&hc=uhci
     310 usb&hc=uhci&hub
  • uspace/drv/vhc/Makefile

    r54b141a r2cb6571  
    3939
    4040SOURCES = \
    41         addrmgm.c \
    4241        conndev.c \
    4342        connhost.c \
  • uspace/drv/vhc/conn.h

    r54b141a r2cb6571  
    3838#include <usb/usb.h>
    3939#include <usb/hcdhubd.h>
    40 #include <usbhc_iface.h>
    4140#include "vhcd.h"
    4241#include "devices.h"
     
    4544
    4645usb_hcd_transfer_ops_t vhc_transfer_ops;
    47 usbhc_iface_t vhc_iface;
    48 
    49 void address_init(void);
    50 int reserve_default_address(device_t *);
    51 int release_default_address(device_t *);
    52 int request_address(device_t *, usb_address_t *);
    53 int release_address(device_t *, usb_address_t);
    54 
    5546
    5647void default_connection_handler(device_t *, ipc_callid_t, ipc_call_t *);
  • uspace/drv/vhc/connhost.c

    r54b141a r2cb6571  
    4343typedef struct {
    4444        usb_direction_t direction;
    45         usbhc_iface_transfer_out_callback_t out_callback;
    46         usbhc_iface_transfer_in_callback_t in_callback;
    47         device_t *dev;
     45        usb_hcd_transfer_callback_out_t out_callback;
     46        usb_hcd_transfer_callback_in_t in_callback;
     47        usb_hc_device_t *hc;
    4848        void *arg;
    4949} transfer_info_t;
     
    5656        switch (transfer->direction) {
    5757                case USB_DIRECTION_IN:
    58                         transfer->in_callback(transfer->dev,
     58                        transfer->in_callback(transfer->hc,
    5959                            size, outcome,
    6060                            transfer->arg);
    6161                        break;
    6262                case USB_DIRECTION_OUT:
    63                         transfer->out_callback(transfer->dev,
     63                        transfer->out_callback(transfer->hc,
    6464                            outcome,
    6565                            transfer->arg);
     
    7373}
    7474
    75 static transfer_info_t *create_transfer_info(device_t *dev,
     75static transfer_info_t *create_transfer_info(usb_hc_device_t *hc,
    7676    usb_direction_t direction, void *arg)
    7777{
     
    8282        transfer->out_callback = NULL;
    8383        transfer->arg = arg;
    84         transfer->dev = dev;
     84        transfer->hc = hc;
    8585
    8686        return transfer;
    8787}
    8888
    89 static int enqueue_transfer_out(device_t *dev,
    90     usb_target_t target, usb_transfer_type_t transfer_type,
     89static int enqueue_transfer_out(usb_hc_device_t *hc,
     90    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
    9191    void *buffer, size_t size,
    92     usbhc_iface_transfer_out_callback_t callback, void *arg)
     92    usb_hcd_transfer_callback_out_t callback, void *arg)
    9393{
    9494        printf(NAME ": transfer OUT [%d.%d (%s); %u]\n",
    95             target.address, target.endpoint,
    96             usb_str_transfer_type(transfer_type),
     95            dev->address, endpoint->endpoint,
     96            usb_str_transfer_type(endpoint->transfer_type),
    9797            size);
    9898
    9999        transfer_info_t *transfer
    100             = create_transfer_info(dev, USB_DIRECTION_OUT, arg);
     100            = create_transfer_info(hc, USB_DIRECTION_OUT, arg);
    101101        transfer->out_callback = callback;
     102
     103        usb_target_t target = {
     104                .address = dev->address,
     105                .endpoint = endpoint->endpoint
     106        };
    102107
    103108        hc_add_transaction_to_device(false, target, buffer, size,
     
    107112}
    108113
    109 static int enqueue_transfer_setup(device_t *dev,
    110     usb_target_t target, usb_transfer_type_t transfer_type,
     114static int enqueue_transfer_setup(usb_hc_device_t *hc,
     115    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
    111116    void *buffer, size_t size,
    112     usbhc_iface_transfer_out_callback_t callback, void *arg)
     117    usb_hcd_transfer_callback_out_t callback, void *arg)
    113118{
    114119        printf(NAME ": transfer SETUP [%d.%d (%s); %u]\n",
    115             target.address, target.endpoint,
    116             usb_str_transfer_type(transfer_type),
     120            dev->address, endpoint->endpoint,
     121            usb_str_transfer_type(endpoint->transfer_type),
    117122            size);
    118123
    119124        transfer_info_t *transfer
    120             = create_transfer_info(dev, USB_DIRECTION_OUT, arg);
     125            = create_transfer_info(hc, USB_DIRECTION_OUT, arg);
    121126        transfer->out_callback = callback;
     127
     128        usb_target_t target = {
     129                .address = dev->address,
     130                .endpoint = endpoint->endpoint
     131        };
    122132
    123133        hc_add_transaction_to_device(true, target, buffer, size,
     
    127137}
    128138
    129 static int enqueue_transfer_in(device_t *dev,
    130     usb_target_t target, usb_transfer_type_t transfer_type,
     139static int enqueue_transfer_in(usb_hc_device_t *hc,
     140    usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
    131141    void *buffer, size_t size,
    132     usbhc_iface_transfer_in_callback_t callback, void *arg)
     142    usb_hcd_transfer_callback_in_t callback, void *arg)
    133143{
    134144        printf(NAME ": transfer IN [%d.%d (%s); %u]\n",
    135             target.address, target.endpoint,
    136             usb_str_transfer_type(transfer_type),
     145            dev->address, endpoint->endpoint,
     146            usb_str_transfer_type(endpoint->transfer_type),
    137147            size);
    138148
    139149        transfer_info_t *transfer
    140             = create_transfer_info(dev, USB_DIRECTION_IN, arg);
     150            = create_transfer_info(hc, USB_DIRECTION_IN, arg);
    141151        transfer->in_callback = callback;
     152
     153        usb_target_t target = {
     154                .address = dev->address,
     155                .endpoint = endpoint->endpoint
     156        };
    142157
    143158        hc_add_transaction_from_device(target, buffer, size,
     
    148163
    149164
    150 static int get_address(device_t *dev, devman_handle_t handle,
    151     usb_address_t *address)
    152 {
    153         return ENOTSUP;
    154 }
    155 
    156 static int interrupt_out(device_t *dev, usb_target_t target,
    157     void *data, size_t size,
    158     usbhc_iface_transfer_out_callback_t callback, void *arg)
    159 {
    160         return enqueue_transfer_out(dev, target, USB_TRANSFER_INTERRUPT,
    161             data, size,
    162             callback, arg);
    163 }
    164 
    165 static int interrupt_in(device_t *dev, usb_target_t target,
    166     void *data, size_t size,
    167     usbhc_iface_transfer_in_callback_t callback, void *arg)
    168 {
    169         return enqueue_transfer_in(dev, target, USB_TRANSFER_INTERRUPT,
    170             data, size,
    171             callback, arg);
    172 }
    173 
    174 static int control_write_setup(device_t *dev, usb_target_t target,
    175     void *data, size_t size,
    176     usbhc_iface_transfer_out_callback_t callback, void *arg)
    177 {
    178         return enqueue_transfer_setup(dev, target, USB_TRANSFER_CONTROL,
    179             data, size,
    180             callback, arg);
    181 }
    182 
    183 static int control_write_data(device_t *dev, usb_target_t target,
    184     void *data, size_t size,
    185     usbhc_iface_transfer_out_callback_t callback, void *arg)
    186 {
    187         return enqueue_transfer_out(dev, target, USB_TRANSFER_CONTROL,
    188             data, size,
    189             callback, arg);
    190 }
    191 
    192 static int control_write_status(device_t *dev, usb_target_t target,
    193     usbhc_iface_transfer_in_callback_t callback, void *arg)
    194 {
    195         return enqueue_transfer_in(dev, target, USB_TRANSFER_CONTROL,
    196             NULL, 0,
    197             callback, arg);
    198 }
    199 
    200 static int control_read_setup(device_t *dev, usb_target_t target,
    201     void *data, size_t size,
    202     usbhc_iface_transfer_out_callback_t callback, void *arg)
    203 {
    204         return enqueue_transfer_setup(dev, target, USB_TRANSFER_CONTROL,
    205             data, size,
    206             callback, arg);
    207 }
    208 
    209 static int control_read_data(device_t *dev, usb_target_t target,
    210     void *data, size_t size,
    211     usbhc_iface_transfer_in_callback_t callback, void *arg)
    212 {
    213         return enqueue_transfer_in(dev, target, USB_TRANSFER_CONTROL,
    214             data, size,
    215             callback, arg);
    216 }
    217 
    218 static int control_read_status(device_t *dev, usb_target_t target,
    219     usbhc_iface_transfer_out_callback_t callback, void *arg)
    220 {
    221         return enqueue_transfer_out(dev, target, USB_TRANSFER_CONTROL,
    222             NULL, 0,
    223             callback, arg);
    224 }
    225 
    226 
    227 usbhc_iface_t vhc_iface = {
    228         .tell_address = get_address,
    229 
    230         .reserve_default_address = reserve_default_address,
    231         .release_default_address = release_default_address,
    232         .request_address = request_address,
    233         .release_address = release_address,
    234 
    235         .interrupt_out = interrupt_out,
    236         .interrupt_in = interrupt_in,
    237 
    238         .control_write_setup = control_write_setup,
    239         .control_write_data = control_write_data,
    240         .control_write_status = control_write_status,
    241 
    242         .control_read_setup = control_read_setup,
    243         .control_read_data = control_read_data,
    244         .control_read_status = control_read_status
     165usb_hcd_transfer_ops_t vhc_transfer_ops = {
     166        .transfer_out = enqueue_transfer_out,
     167        .transfer_in = enqueue_transfer_in,
     168        .transfer_setup = enqueue_transfer_setup
    245169};
    246170
  • uspace/drv/vhc/hcd.c

    r54b141a r2cb6571  
    5252#include "conn.h"
    5353
    54 static device_ops_t vhc_ops = {
    55         .interfaces[USBHC_DEV_IFACE] = &vhc_iface,
    56         .default_handler = default_connection_handler
    57 };
    5854
    5955static int vhc_count = 0;
    60 static int vhc_add_device(device_t *dev)
     56static int vhc_add_device(usb_hc_device_t *dev)
    6157{
    6258        /*
     
    6965        vhc_count++;
    7066
    71         dev->ops = &vhc_ops;
    72 
    73         /*
    74          * Initialize address management.
    75          */
    76         address_init();
     67        dev->transfer_ops = &vhc_transfer_ops;
     68        dev->generic->ops->default_handler = default_connection_handler;
    7769
    7870        /*
     
    8779}
    8880
    89 static driver_ops_t vhc_driver_ops = {
    90         .add_device = vhc_add_device,
    91 };
    92 
    93 static driver_t vhc_driver = {
     81static usb_hc_driver_t vhc_driver = {
    9482        .name = NAME,
    95         .driver_ops = &vhc_driver_ops
     83        .add_hc = &vhc_add_device
    9684};
    9785
     
    126114        sleep(4);
    127115
    128         return driver_main(&vhc_driver);
     116        return usb_hcd_main(&vhc_driver);
    129117}
    130118
  • uspace/drv/vhc/vhc.ma

    r54b141a r2cb6571  
    1110 usb&hc=vhc
    2 
     210 usb&hc=vhc&hub
  • uspace/lib/drv/generic/remote_usbhc.c

    r54b141a r2cb6571  
    5252static void remote_usbhc_control_read_data(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5353static void remote_usbhc_control_read_status(device_t *, void *, ipc_callid_t, ipc_call_t *);
    54 static void remote_usbhc_reserve_default_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    55 static void remote_usbhc_release_default_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    56 static void remote_usbhc_request_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    57 static void remote_usbhc_release_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5854//static void remote_usbhc(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5955
     
    6157static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = {
    6258        remote_usbhc_get_address,
    63 
    6459        remote_usbhc_get_buffer,
    65 
    66         remote_usbhc_reserve_default_address,
    67         remote_usbhc_release_default_address,
    68 
    69         remote_usbhc_request_address,
    70         remote_usbhc_release_address,
    71 
    7260        remote_usbhc_interrupt_out,
    7361        remote_usbhc_interrupt_in,
    74 
    7562        remote_usbhc_control_write_setup,
    7663        remote_usbhc_control_write_data,
    7764        remote_usbhc_control_write_status,
    78 
    7965        remote_usbhc_control_read_setup,
    8066        remote_usbhc_control_read_data,
     
    148134        free(trans->buffer);
    149135        free(trans);
    150 }
    151 
    152 void remote_usbhc_reserve_default_address(device_t *device, void *iface,
    153     ipc_callid_t callid, ipc_call_t *call)
    154 {
    155         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    156 
    157         if (!usb_iface->reserve_default_address) {
    158                 ipc_answer_0(callid, ENOTSUP);
    159                 return;
    160         }
    161 
    162         int rc = usb_iface->reserve_default_address(device);
    163 
    164         ipc_answer_0(callid, rc);
    165 }
    166 
    167 void remote_usbhc_release_default_address(device_t *device, void *iface,
    168     ipc_callid_t callid, ipc_call_t *call)
    169 {
    170         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    171 
    172         if (!usb_iface->release_default_address) {
    173                 ipc_answer_0(callid, ENOTSUP);
    174                 return;
    175         }
    176 
    177         int rc = usb_iface->release_default_address(device);
    178 
    179         ipc_answer_0(callid, rc);
    180 }
    181 
    182 void remote_usbhc_request_address(device_t *device, void *iface,
    183     ipc_callid_t callid, ipc_call_t *call)
    184 {
    185         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    186 
    187         if (!usb_iface->request_address) {
    188                 ipc_answer_0(callid, ENOTSUP);
    189                 return;
    190         }
    191 
    192         usb_address_t address;
    193         int rc = usb_iface->request_address(device, &address);
    194         if (rc != EOK) {
    195                 ipc_answer_0(callid, rc);
    196         } else {
    197                 ipc_answer_1(callid, EOK, (ipcarg_t) address);
    198         }
    199 }
    200 
    201 void remote_usbhc_release_address(device_t *device, void *iface,
    202     ipc_callid_t callid, ipc_call_t *call)
    203 {
    204         usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    205 
    206         if (!usb_iface->release_address) {
    207                 ipc_answer_0(callid, ENOTSUP);
    208                 return;
    209         }
    210 
    211         usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);
    212 
    213         int rc = usb_iface->release_address(device, address);
    214 
    215         ipc_answer_0(callid, rc);
    216136}
    217137
  • uspace/lib/drv/include/usbhc_iface.h

    r54b141a r2cb6571  
    111111
    112112
    113         /** Reserve usage of default address.
    114          * This call informs the host controller that the caller will be
    115          * using default USB address. It is duty of the HC driver to ensure
    116          * that only single entity will have it reserved.
    117          * The address is returned via IPC_M_USBHC_RELEASE_DEFAULT_ADDRESS.
    118          * The caller can start using the address after receiving EOK
    119          * answer.
    120          */
    121         IPC_M_USBHC_RESERVE_DEFAULT_ADDRESS,
    122 
    123         /** Release usage of default address.
    124          * @see IPC_M_USBHC_RESERVE_DEFAULT_ADDRESS
    125          */
    126         IPC_M_USBHC_RELEASE_DEFAULT_ADDRESS,
    127 
    128         /** Asks for address assignment by host controller.
    129          * Answer:
    130          * - ELIMIT - host controller run out of address
    131          * - EOK - address assigned
    132          * Answer arguments:
    133          * - assigned address
    134          *
    135          * The address must be released by via IPC_M_USBHC_RELEASE_ADDRESS.
    136          */
    137         IPC_M_USBHC_REQUEST_ADDRESS,
    138 
    139         /** Release address in use.
    140          * Arguments:
    141          * - address to be released
    142          * Answer:
    143          * - ENOENT - address not in use
    144          * - EPERM - trying to release default USB address
    145          */
    146         IPC_M_USBHC_RELEASE_ADDRESS,
    147 
    148 
    149113        /** Send interrupt data to device.
    150114         * See explanation at usb_iface_funcs_t (OUT transaction).
     
    219183typedef struct {
    220184        int (*tell_address)(device_t *, devman_handle_t, usb_address_t *);
    221 
    222         int (*reserve_default_address)(device_t *);
    223         int (*release_default_address)(device_t *);
    224         int (*request_address)(device_t *, usb_address_t *);
    225         int (*release_address)(device_t *, usb_address_t);
    226185
    227186        usbhc_iface_transfer_out_t interrupt_out;
  • uspace/lib/usb/Makefile

    r54b141a r2cb6571  
    3535        src/hcdhubd.c \
    3636        src/hcdrv.c \
     37        src/hubdrv.c \
    3738        src/localdrv.c \
    3839        src/remotedrv.c \
  • uspace/lib/usb/include/usb/hcdhubd.h

    r54b141a r2cb6571  
    166166
    167167int usb_hcd_main(usb_hc_driver_t *);
    168 int usb_hcd_add_root_hub(device_t *dev);
     168int usb_hcd_add_root_hub(usb_hc_device_t *dev);
    169169
    170170/**
  • uspace/lib/usb/include/usb/usbdrv.h

    r54b141a r2cb6571  
    4141int usb_drv_hc_connect(device_t *, unsigned int);
    4242
    43 int usb_drv_reserve_default_address(int);
    44 int usb_drv_release_default_address(int);
    45 usb_address_t usb_drv_request_address(int);
    46 int usb_drv_release_address(int, usb_address_t);
    47 
    4843usb_address_t usb_drv_get_my_address(int, device_t *);
    4944
  • uspace/lib/usb/src/hcdhubd.c

    r54b141a r2cb6571  
    5151 */
    5252static int add_device(device_t *dev) {
    53         return ENOTSUP;
     53        bool is_hc = str_cmp(dev->name, USB_HUB_DEVICE_NAME) != 0;
     54        printf("%s: add_device(name=\"%s\")\n", hc_driver->name, dev->name);
     55
     56        if (is_hc) {
     57                /*
     58                 * We are the HC itself.
     59                 */
     60                return usb_add_hc_device(dev);
     61        } else {
     62                /*
     63                 * We are some (maybe deeply nested) hub.
     64                 * Thus, assign our own operations and explore already
     65                 * connected devices.
     66                 */
     67                return usb_add_hub_device(dev);
     68        }
    5469}
    5570
     
    90105 * @return Error code.
    91106 */
    92 int usb_hcd_add_root_hub(device_t *dev)
    93 {
     107int usb_hcd_add_root_hub(usb_hc_device_t *dev) {
    94108        char *id;
    95         int rc = asprintf(&id, "usb&hub");
     109        int rc = asprintf(&id, "usb&hc=%s&hub", hc_driver->name);
    96110        if (rc <= 0) {
    97111                return rc;
    98112        }
    99113
    100         rc = usb_hc_add_child_device(dev, USB_HUB_DEVICE_NAME, id, true);
     114        rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id, true);
    101115        if (rc != EOK) {
    102116                free(id);
  • uspace/lib/usb/src/hcdhubd_private.h

    r54b141a r2cb6571  
    4646usb_address_t usb_get_address_by_handle(devman_handle_t);
    4747int usb_add_hc_device(device_t *);
     48int usb_add_hub_device(device_t *);
    4849
    4950/** lowest allowed usb address */
  • uspace/lib/usb/src/hcdrv.c

    r54b141a r2cb6571  
    4747LIST_INITIALIZE(hc_list);
    4848
    49 /* Fake driver to have the name item initialized. */
    50 static usb_hc_driver_t hc_driver_fake = {
    51         .name = "HCD",
    52 };
    53 
    5449/** Our HC driver. */
    55 usb_hc_driver_t *hc_driver = &hc_driver_fake;
     50usb_hc_driver_t *hc_driver = NULL;
    5651
    5752int usb_lowest_address = 1;
     
    9186int usb_add_hc_device(device_t *dev)
    9287{
    93         return ENOTSUP;
    9488        usb_hc_device_t *hc_dev = usb_hc_device_create(dev);
    9589
  • uspace/lib/usb/src/usbdrv.c

    r54b141a r2cb6571  
    100100}
    101101
    102 /** Tell HC to reserve default address.
    103  *
    104  * @param phone Open phone to host controller driver.
    105  * @return Error code.
    106  */
    107 int usb_drv_reserve_default_address(int phone)
    108 {
    109         return async_req_0_0(phone, IPC_M_USBHC_RESERVE_DEFAULT_ADDRESS);
    110 }
    111 
    112 /** Tell HC to release default address.
    113  *
    114  * @param phone Open phone to host controller driver.
    115  * @return Error code.
    116  */
    117 int usb_drv_release_default_address(int phone)
    118 {
    119         return async_req_0_0(phone, IPC_M_USBHC_RELEASE_DEFAULT_ADDRESS);
    120 }
    121 
    122 /** Ask HC for free address assignment.
    123  *
    124  * @param phone Open phone to host controller driver.
    125  * @return Assigned USB address or negative error code.
    126  */
    127 usb_address_t usb_drv_request_address(int phone)
    128 {
    129         ipcarg_t address;
    130         int rc = async_req_0_1(phone, IPC_M_USBHC_REQUEST_ADDRESS, &address);
    131         if (rc != EOK) {
    132                 return rc;
    133         } else {
    134                 return (usb_address_t) address;
    135         }
    136 }
    137 
    138 /** Inform HC about address release.
    139  *
    140  * @param phone Open phone to host controller driver.
    141  * @param address Address to be released.
    142  * @return Error code.
    143  */
    144 int usb_drv_release_address(int phone, usb_address_t address)
    145 {
    146         return async_req_1_0(phone, IPC_M_USBHC_RELEASE_ADDRESS, address);
    147 }
    148 
    149102/** Send data to HCD.
    150103 *
Note: See TracChangeset for help on using the changeset viewer.