Changeset 11658b64 in mainline for uspace/drv/vhc/hc.c


Ignore:
Timestamp:
2010-12-16T11:54:53Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
557c7d0, 5863a95, 82122f3, a8b7dfd, f2962621
Parents:
a9b6bec (diff), 70e5ad5 (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:

Merged vojtechhorky/ - libusbvirt clean-up

File:
1 edited

Legend:

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

    ra9b6bec r11658b64  
    6868static link_t transaction_list;
    6969
    70 #define TRANSACTION_FORMAT "T[%d:%d %s (%d)]"
     70#define TRANSACTION_FORMAT "T[%d.%d %s/%s (%d)]"
    7171#define TRANSACTION_PRINTF(t) \
    7272        (t).target.address, (t).target.endpoint, \
     73        usb_str_transfer_type((t).transfer_type), \
    7374        usbvirt_str_transaction_type((t).type), \
    7475        (int)(t).len
     
    7677#define transaction_get_instance(lnk) \
    7778        list_get_instance(lnk, transaction_t, link)
     79
     80#define HUB_STATUS_MAX_LEN (HUB_PORT_COUNT + 64)
    7881
    7982static inline unsigned int pseudo_random(unsigned int *seed)
     
    99102/** Host controller manager main function.
    100103 */
    101 void hc_manager(void)
     104static int hc_manager_fibril(void *arg)
    102105{
    103106        list_initialize(&transaction_list);
     
    114117                }
    115118               
    116                 char ports[HUB_PORT_COUNT + 2];
    117                 hub_get_port_statuses(ports, HUB_PORT_COUNT + 1);
    118                 dprintf(4, "virtual hub: addr=%d ports=%s",
    119                     virthub_dev.address, ports);
     119                char ports[HUB_STATUS_MAX_LEN + 1];
     120                virthub_get_status(&virtual_hub_device, ports, HUB_STATUS_MAX_LEN);
    120121               
    121122                link_t *first_transaction_link = transaction_list.next;
     
    125126               
    126127
    127                 dprintf(0, "about to process " TRANSACTION_FORMAT " (vhub:%s)",
     128                dprintf(0, "about to process " TRANSACTION_FORMAT " [%s]",
    128129                    TRANSACTION_PRINTF(*transaction), ports);
    129130
     
    138139                free(transaction);
    139140        }
     141
     142        assert(false && "unreachable");
     143        return EOK;
     144}
     145
     146void hc_manager(void)
     147{
     148        fid_t fid = fibril_create(hc_manager_fibril, NULL);
     149        if (fid == 0) {
     150                printf(NAME ": failed to start HC manager fibril\n");
     151                return;
     152        }
     153        fibril_add_ready(fid);
    140154}
    141155
     
    143157 */
    144158static transaction_t *transaction_create(usbvirt_transaction_type_t type,
    145     usb_target_t target,
     159    usb_target_t target, usb_transfer_type_t transfer_type,
    146160    void * buffer, size_t len,
    147161    hc_transaction_done_callback_t callback, void * arg)
     
    151165        list_initialize(&transaction->link);
    152166        transaction->type = type;
     167        transaction->transfer_type = transfer_type;
    153168        transaction->target = target;
    154169        transaction->buffer = buffer;
     
    166181 */
    167182void hc_add_transaction_to_device(bool setup, usb_target_t target,
     183    usb_transfer_type_t transfer_type,
    168184    void * buffer, size_t len,
    169185    hc_transaction_done_callback_t callback, void * arg)
    170186{
    171187        transaction_t *transaction = transaction_create(
    172             setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, target,
     188            setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT,
     189            target, transfer_type,
    173190            buffer, len, callback, arg);
    174191        list_append(&transaction->link, &transaction_list);
     
    178195 */
    179196void hc_add_transaction_from_device(usb_target_t target,
     197    usb_transfer_type_t transfer_type,
    180198    void * buffer, size_t len,
    181199    hc_transaction_done_callback_t callback, void * arg)
    182200{
    183201        transaction_t *transaction = transaction_create(USBVIRT_TRANSACTION_IN,
    184             target, buffer, len, callback, arg);
     202            target, transfer_type,
     203            buffer, len, callback, arg);
    185204        list_append(&transaction->link, &transaction_list);
    186205}
Note: See TracChangeset for help on using the changeset viewer.