Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 90dd59d in mainline


Ignore:
Timestamp:
2011-08-25T13:04:59Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
23b0fe8
Parents:
4f0e510
Message:

ohci: implement schedule function, finish batch initialization

Location:
uspace/drv/bus/usb/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/batch.c

    r4f0e510 r90dd59d  
    4343#include "hw_struct/endpoint_descriptor.h"
    4444#include "hw_struct/transfer_descriptor.h"
     45/*
     46static void batch_control_write(usb_transfer_batch_t *instance);
     47static void batch_control_read(usb_transfer_batch_t *instance);
     48
     49static void batch_interrupt_in(usb_transfer_batch_t *instance);
     50static void batch_interrupt_out(usb_transfer_batch_t *instance);
     51
     52static void batch_bulk_in(usb_transfer_batch_t *instance);
     53static void batch_bulk_out(usb_transfer_batch_t *instance);
     54*/
     55static void batch_setup_control(usb_transfer_batch_t *batch)
     56{
     57        // TODO Find a better way to do this
     58        if (batch->setup_buffer[0] & (1 << 7))
     59                batch_control_read(batch);
     60        else
     61                batch_control_write(batch);
     62}
     63
     64void (*batch_setup[4][3])(usb_transfer_batch_t*) =
     65{
     66        { NULL, NULL, batch_setup_control },
     67        { NULL, NULL, NULL },
     68        { batch_bulk_in, batch_bulk_out, NULL },
     69        { batch_interrupt_in, batch_interrupt_out, NULL },
     70};
     71
    4572
    4673/** OHCI specific data required for USB transfer */
     
    140167                batch->data_buffer = data->device_buffer + batch->setup_size;
    141168        }
     169
     170        assert(batch_setup[batch->ep->transfer_type][batch->ep->direction]);
     171        batch_setup[batch->ep->transfer_type][batch->ep->direction](batch);
    142172
    143173        return EOK;
  • uspace/drv/bus/usb/ohci/hc.c

    r4f0e510 r90dd59d  
    163163}
    164164/*----------------------------------------------------------------------------*/
     165static int schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     166{
     167        assert(hcd);
     168        return hc_schedule(hcd->private_data, batch);
     169}
     170/*----------------------------------------------------------------------------*/
    165171/** Initialize OHCI hc driver structure
    166172 *
     
    195201
    196202        ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11);
    197         instance->generic.schedule = NULL;
     203        instance->generic.private_data = instance;
     204        instance->generic.schedule = schedule;
    198205        instance->generic.batch_init_hook = batch_init_ohci;
    199206        instance->generic.ep_add_hook = NULL;
Note: See TracChangeset for help on using the changeset viewer.