Changeset 6b6e3ed3 in mainline


Ignore:
Timestamp:
2011-04-08T15:46:32Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
344925c
Parents:
f98b8269
Message:

Initialize transfer queues

Location:
uspace/drv/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.c

    rf98b8269 r6b6e3ed3  
    4747static void hc_gain_control(hc_t *instance);
    4848static void hc_init_hw(hc_t *instance);
     49static int hc_init_transfer_lists(hc_t *instance);
    4950/*----------------------------------------------------------------------------*/
    5051int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun)
     
    211212        assert((instance->registers->command_status & CS_HCR) == 0);
    212213        /* hc is now in suspend state */
     214        /* init queues */
     215        hc_init_transfer_lists(instance);
    213216        /* TODO: init HCCA block */
    214         /* TODO: init queues */
    215217        /* TODO: enable queues */
    216218        /* TODO: enable interrupts */
     
    220222        usb_log_info("OHCI HC up and running.\n");
    221223}
     224/*----------------------------------------------------------------------------*/
     225int hc_init_transfer_lists(hc_t *instance)
     226{
     227        assert(instance);
     228#define CHECK_RET_CLEAR_RETURN(ret, message...) \
     229        if (ret != EOK) { \
     230                usb_log_error(message); \
     231                transfer_list_fini(&instance->transfers_isochronous); \
     232                transfer_list_fini(&instance->transfers_interrupt); \
     233                transfer_list_fini(&instance->transfers_control); \
     234                transfer_list_fini(&instance->transfers_bulk); \
     235                return ret; \
     236        } else (void) 0
     237
     238        int ret;
     239        ret = transfer_list_init(&instance->transfers_bulk, "BULK");
     240        CHECK_RET_CLEAR_RETURN(ret, "Failed to init BULK list.");
     241
     242        ret = transfer_list_init(&instance->transfers_control, "CONTROL");
     243        CHECK_RET_CLEAR_RETURN(ret, "Failed to init CONTROL list.");
     244
     245        ret = transfer_list_init(&instance->transfers_interrupt, "INTERRUPT");
     246        CHECK_RET_CLEAR_RETURN(ret, "Failed to init INTERRUPT list.");
     247
     248        transfer_list_set_next(&instance->transfers_interrupt,
     249                &instance->transfers_isochronous);
     250
     251        /* Assign pointers to be used during scheduling */
     252        instance->transfers[USB_TRANSFER_INTERRUPT] =
     253          &instance->transfers_interrupt;
     254        instance->transfers[USB_TRANSFER_ISOCHRONOUS] =
     255          &instance->transfers_interrupt;
     256        instance->transfers[USB_TRANSFER_CONTROL] =
     257          &instance->transfers_control;
     258        instance->transfers[USB_TRANSFER_BULK] =
     259          &instance->transfers_bulk;
     260
     261        return EOK;
     262#undef CHECK_RET_CLEAR_RETURN
     263}
    222264/**
    223265 * @}
  • uspace/drv/ohci/hc.h

    rf98b8269 r6b6e3ed3  
    4848#include "ohci_regs.h"
    4949#include "root_hub.h"
     50#include "transfer_list.h"
    5051#include "hw_struct/hcca.h"
    5152
     
    5455        usb_address_t rh_address;
    5556        rh_t rh;
     57
     58        transfer_list_t transfers_isochronous;
     59        transfer_list_t transfers_interrupt;
     60        transfer_list_t transfers_control;
     61        transfer_list_t transfers_bulk;
     62
     63        transfer_list_t *transfers[4];
     64
    5665        ddf_fun_t *ddf_instance;
    5766        usb_device_keeper_t manager;
Note: See TracChangeset for help on using the changeset viewer.