Changeset fe1776c2 in mainline for uspace/drv


Ignore:
Timestamp:
2011-02-11T12:41:11Z (15 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d81ef61c
Parents:
78d1525 (diff), 5d4193c (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 from usb/development

Location:
uspace/drv
Files:
24 added
12 edited
6 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/ns8250/ns8250.c

    r78d1525 rfe1776c2  
    256256       
    257257        if (dev->parent_phone > 0) {
    258                 ipc_hangup(dev->parent_phone);
     258                async_hangup(dev->parent_phone);
    259259                dev->parent_phone = 0;
    260260        }
     
    888888                ns8250_get_props(dev, &baud_rate, &parity, &word_length,
    889889                    &stop_bits);
    890                 ipc_answer_4(callid, EOK, baud_rate, parity, word_length,
     890                async_answer_4(callid, EOK, baud_rate, parity, word_length,
    891891                    stop_bits);
    892892                break;
     
    899899                ret = ns8250_set_props(dev, baud_rate, parity, word_length,
    900900                    stop_bits);
    901                 ipc_answer_0(callid, ret);
     901                async_answer_0(callid, ret);
    902902                break;
    903903               
    904904        default:
    905                 ipc_answer_0(callid, ENOTSUP);
     905                async_answer_0(callid, ENOTSUP);
    906906        }
    907907}
  • uspace/drv/pciintel/pci.c

    r78d1525 rfe1776c2  
    478478                    "the device.\n");
    479479                delete_pci_bus_data(bus_data);
    480                 ipc_hangup(dev->parent_phone);
     480                async_hangup(dev->parent_phone);
    481481                return rc;
    482482        }       
     
    496496                printf(NAME ": failed to enable configuration ports.\n");
    497497                delete_pci_bus_data(bus_data);
    498                 ipc_hangup(dev->parent_phone);
     498                async_hangup(dev->parent_phone);
    499499                hw_res_clean_resource_list(&hw_resources);
    500500                return EADDRNOTAVAIL;
  • uspace/drv/rootvirt/devices.def

    r78d1525 rfe1776c2  
    2222},
    2323#endif
     24#ifdef CONFIG_RUN_VIRTUAL_USB_HC
    2425/* Virtual USB host controller. */
    2526{
     
    2728        .match_id = "usb&hc=vhc"
    2829},
     30#endif
  • uspace/drv/test2/test2.c

    r78d1525 rfe1776c2  
    103103        if (dev->parent == NULL) {
    104104                fid_t postpone = fibril_create(postponed_birth, dev);
     105                if (postpone == 0) {
     106                        printf(NAME ": fibril_create() error\n");
     107                        return ENOMEM;
     108                }
    105109                fibril_add_ready(postpone);
    106110        } else {
  • uspace/drv/uhci-hcd/main.c

    r78d1525 rfe1776c2  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky
     2 * Copyright (c) 2011 Vojtech Horky, Jan Vesely
    33 * All rights reserved.
    44 *
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 #include <usb/hcdhubd.h>
     28/** @addtogroup usb
     29 * @{
     30 */
     31/** @file
     32 * @brief UHCI driver
     33 */
     34#include <driver.h>
    2935#include <usb_iface.h>
     36
     37#include <errno.h>
     38
    3039#include <usb/debug.h>
    31 #include <errno.h>
    32 #include <str_error.h>
    33 #include <driver.h>
     40
     41#include "iface.h"
     42#include "pci.h"
     43#include "root_hub.h"
    3444#include "uhci.h"
     45
     46#define NAME "uhci-hcd"
    3547
    3648static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
     
    5466static int uhci_add_device(device_t *device)
    5567{
    56         usb_dprintf(NAME, 1, "uhci_add_device() called\n");
     68        assert(device);
     69
     70        usb_log_info("uhci_add_device() called\n");
    5771        device->ops = &uhci_ops;
    5872
     
    6579
    6680        if (rc != EOK) {
    67                 fprintf(stderr,
    68                     NAME ": failed to get I/O registers addresses: %s.\n",
    69                     str_error(rc));
     81                usb_log_error("Failed(%d) to get I/O registers addresses for device:.\n",
     82                    rc, device->handle);
    7083                return rc;
    7184        }
    7285
    73         usb_dprintf(NAME, 2, "I/O regs at 0x%X (size %zu), IRQ %d.\n",
     86        usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
    7487            io_reg_base, io_reg_size, irq);
    7588
    76         /*
    77          * We need to announce the presence of our root hub.
    78          */
    79         usb_dprintf(NAME, 2, "adding root hub\n");
    80         usb_hcd_add_root_hub(device);
     89        uhci_t *uhci_hc = malloc(sizeof(uhci_t));
     90        if (!uhci_hc) {
     91                usb_log_error("Failed to allocaete memory for uhci hcd driver.\n");
     92                return ENOMEM;
     93        }
     94
     95        int ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);
     96        if (ret != EOK) {
     97                usb_log_error("Failed to init uhci-hcd.\n");
     98                return ret;
     99        }
     100        device_t *rh;
     101        ret = setup_root_hub(&rh, device);
     102
     103        if (ret != EOK) {
     104                usb_log_error("Failed to setup uhci root hub.\n");
     105                /* TODO: destroy uhci here */
     106                return ret;
     107        }
     108
     109        ret = child_device_register(rh, device);
     110        if (ret != EOK) {
     111                usb_log_error("Failed to register root hub.\n");
     112                /* TODO: destroy uhci here */
     113                return ret;
     114        }
     115
     116        device->driver_data = uhci_hc;
    81117
    82118        return EOK;
     
    98134         */
    99135        sleep(5);
    100         usb_dprintf_enable(NAME, 5);
     136        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    101137
    102138        return driver_main(&uhci_driver);
    103139}
     140/**
     141 * @}
     142 */
  • uspace/drv/uhci-hcd/pci.c

    r78d1525 rfe1776c2  
    3434 * PCI related functions needed by the UHCI driver.
    3535 */
    36 #include "uhci.h"
    3736#include <errno.h>
    3837#include <assert.h>
    3938#include <devman.h>
    4039#include <device/hw_res.h>
     40
     41#include "pci.h"
    4142
    4243/** Get address of registers and IRQ for given device.
     
    116117        rc = EOK;
    117118leave:
    118         ipc_hangup(parent_phone);
     119        async_hangup(parent_phone);
    119120
    120121        return rc;
     
    125126 */
    126127
     128/**
     129 * @}
     130 */
  • uspace/drv/uhci-hcd/pci.h

    r78d1525 rfe1776c2  
    3333 * @brief UHCI driver
    3434 */
    35 #ifndef DRV_UHCI_UHCI_H
    36 #define DRV_UHCI_UHCI_H
     35#ifndef DRV_UHCI_PCI_H
     36#define DRV_UHCI_PCI_H
    3737
    38 #include <usbhc_iface.h>
    39 
    40 #define NAME "uhci"
    41 
    42 usbhc_iface_t uhci_iface;
     38#include <driver.h>
    4339
    4440int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *);
     
    4844 * @}
    4945 */
     46
  • uspace/drv/uhci-rhd/Makefile

    r78d1525 rfe1776c2  
    11#
    2 # Copyright (c) 2010 Vojtech Horky
     2# Copyright (c) 2010 Jan Vesely
    33# All rights reserved.
    44#
     
    2929USPACE_PREFIX = ../..
    3030LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a
    31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include
    32 BINARY = uhci
     31EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include -I.
     32BINARY = uhci-rhd
    3333
    3434SOURCES = \
    3535        main.c \
    36         pci.c \
    37         transfers.c
     36        port.c \
     37        port_status.c \
     38        root_hub.c
    3839
    3940include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/usbhid/main.c

    r78d1525 rfe1776c2  
    5656#include "layout.h"
    5757
    58 #define BUFFER_SIZE 32
     58#define BUFFER_SIZE 8
    5959#define NAME "usbhid"
    6060
     
    8383
    8484                if (console_callback_phone != -1) {
    85                         ipc_answer_0(icallid, ELIMIT);
     85                        async_answer_0(icallid, ELIMIT);
    8686                        return;
    8787                }
    8888
    8989                console_callback_phone = callback;
    90                 ipc_answer_0(icallid, EOK);
     90                async_answer_0(icallid, EOK);
    9191                return;
    9292        }
    9393
    94         ipc_answer_0(icallid, EINVAL);
     94        async_answer_0(icallid, EINVAL);
    9595}
    9696
     
    262262}
    263263
     264# if 0
    264265/*
    265266 * Kbd functions
     
    297298        return EOK;
    298299}
    299 
    300300static int usbkbd_process_descriptors(usb_hid_dev_kbd_t *kbd_dev)
    301301{
     
    363363        return EOK;
    364364}
    365 
     365#endif
    366366static usb_hid_dev_kbd_t *usbkbd_init_device(device_t *dev)
    367367{
     
    404404         */
    405405
     406
    406407        // TODO: get descriptors, parse descriptors and save endpoints
    407         usbkbd_process_descriptors(kbd_dev);
     408        //usbkbd_process_descriptors(kbd_dev);
     409        usb_drv_req_set_configuration(
     410          kbd_dev->device->parent_phone, kbd_dev->address, 1);
    408411
    409412
     
    467470
    468471        while (true) {
    469                 async_usleep(1000 * 1000 * 2);
     472                async_usleep(1000 * 10);
    470473
    471474                sess_rc = usb_endpoint_pipe_start_session(&kbd_dev->poll_pipe);
  • uspace/drv/usbhub/main.c

    r78d1525 rfe1776c2  
    6565int main(int argc, char *argv[])
    6666{
    67         usb_dprintf_enable(NAME, USB_LOG_LEVEL_INFO);
     67        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    6868       
    6969        fibril_mutex_initialize(&usb_hub_list_lock);
  • uspace/drv/usbhub/usbhub.c

    r78d1525 rfe1776c2  
    199199        //ports powered, hub seems to be enabled
    200200
    201         ipc_hangup(hc);
     201        async_hangup(hc);
    202202
    203203        //add the hub to list
     
    502502                free(change_bitmap);
    503503
    504                 ipc_hangup(hc);
     504                async_hangup(hc);
    505505                fibril_mutex_lock(&usb_hub_list_lock);
    506506        }
  • uspace/drv/usbhub/usbhub_private.h

    r78d1525 rfe1776c2  
    6565//************
    6666#define dprintf(level, format, ...) \
    67         usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
     67        usb_log_printf((level), format "\n", ##__VA_ARGS__)
    6868
    6969
  • uspace/drv/vhc/conndev.c

    r78d1525 rfe1776c2  
    9090                    = virtdev_add_device(callback, (sysarg_t)fibril_get_id());
    9191                if (!dev) {
    92                         ipc_answer_0(icallid, EEXISTS);
    93                         ipc_hangup(callback);
     92                        async_answer_0(icallid, EEXISTS);
     93                        async_hangup(callback);
    9494                        return;
    9595                }
    96                 ipc_answer_0(icallid, EOK);
     96                async_answer_0(icallid, EOK);
    9797
    9898                char devname[DEVICE_NAME_MAXLENGTH + 1];
     
    105105        }
    106106
    107         ipc_answer_0(icallid, EINVAL);
     107        async_answer_0(icallid, EINVAL);
    108108}
    109109
  • uspace/drv/vhc/devices.c

    r78d1525 rfe1776c2  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <adt/list.h>
    3837#include <bool.h>
  • uspace/drv/vhc/hc.c

    r78d1525 rfe1776c2  
    3434 */
    3535
    36 #include <ipc/ipc.h>
    3736#include <adt/list.h>
    3837#include <bool.h>
  • uspace/drv/vhc/hcd.c

    r78d1525 rfe1776c2  
    3535
    3636#include <devmap.h>
    37 #include <ipc/ipc.h>
    3837#include <async.h>
    3938#include <unistd.h>
Note: See TracChangeset for help on using the changeset viewer.