Changeset 7013b14 in mainline


Ignore:
Timestamp:
2011-04-13T14:19:12Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6522dd
Parents:
9a6fde4
Message:

Batch processing implemented to use static EDs.

Location:
uspace/drv/ohci
Files:
5 edited

Legend:

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

    r9a6fde4 r7013b14  
    169169}
    170170/*----------------------------------------------------------------------------*/
     171void batch_commit(usb_transfer_batch_t *instance)
     172{
     173        assert(instance);
     174        ohci_transfer_batch_t *data = instance->private_data;
     175        assert(data);
     176        ed_set_end_td(data->ed, data->tds[data->td_count]);
     177}
     178/*----------------------------------------------------------------------------*/
    171179void batch_control_write(usb_transfer_batch_t *instance)
    172180{
  • uspace/drv/ohci/batch.h

    r9a6fde4 r7013b14  
    5252bool batch_is_complete(usb_transfer_batch_t *instance);
    5353
     54void batch_commit(usb_transfer_batch_t *instance);
     55
    5456void batch_control_write(usb_transfer_batch_t *instance);
    5557
  • uspace/drv/ohci/endpoint_list.c

    r9a6fde4 r7013b14  
    191191        assert(hcd_ep);
    192192        assert(hcd_ep->ed);
    193         assert(fibril_mutex_is_locked(&instance->guard));
     193
     194        fibril_mutex_lock(&instance->guard);
    194195
    195196        usb_log_debug2(
     
    218219        /* Remove from the endpoint list */
    219220        list_remove(&hcd_ep->link);
     221        fibril_mutex_unlock(&instance->guard);
    220222}
    221223/**
  • uspace/drv/ohci/hc.c

    r9a6fde4 r7013b14  
    109109            ret, str_error(ret));
    110110
    111         instance->ddf_instance = fun;
    112111        usb_device_keeper_init(&instance->manager);
    113112        ret = usb_endpoint_manager_init(&instance->ep_manager,
     
    130129                fibril_add_ready(instance->interrupt_emulator);
    131130        }
     131
     132        list_initialize(&instance->pending_batches);
    132133#undef CHECK_RET_RETURN
    133134        return EOK;
     
    262263                return rh_request(&instance->rh, batch);
    263264        }
    264 #if 0
     265
    265266        fibril_mutex_lock(&instance->guard);
     267        list_append(&batch->link, &instance->pending_batches);
     268        batch_commit(batch);
    266269        switch (batch->ep->transfer_type) {
    267270        case USB_TRANSFER_CONTROL:
    268                 instance->registers->control &= ~C_CLE;
    269                 transfer_list_add_batch(
    270                     instance->transfers[batch->ep->transfer_type], batch);
    271271                instance->registers->command_status |= CS_CLF;
    272                 usb_log_debug2("Set CS control transfer filled: %x.\n",
    273                         instance->registers->command_status);
    274                 instance->registers->control_current = 0;
    275                 instance->registers->control |= C_CLE;
    276272                break;
    277273        case USB_TRANSFER_BULK:
    278                 instance->registers->control &= ~C_BLE;
    279                 transfer_list_add_batch(
    280                     instance->transfers[batch->ep->transfer_type], batch);
    281274                instance->registers->command_status |= CS_BLF;
    282                 usb_log_debug2("Set bulk transfer filled: %x.\n",
    283                         instance->registers->command_status);
    284                 instance->registers->control |= C_BLE;
    285                 break;
    286         case USB_TRANSFER_INTERRUPT:
    287         case USB_TRANSFER_ISOCHRONOUS:
    288                 instance->registers->control &= (~C_PLE & ~C_IE);
    289                 transfer_list_add_batch(
    290                     instance->transfers[batch->ep->transfer_type], batch);
    291                 instance->registers->control |= C_PLE | C_IE;
    292                 usb_log_debug2("Added periodic transfer: %x.\n",
    293                     instance->registers->periodic_current);
    294275                break;
    295276        default:
    296277                break;
    297278        }
     279
    298280        fibril_mutex_unlock(&instance->guard);
    299 #endif
    300281        return EOK;
    301282}
     
    317298                usb_log_debug2("Periodic current: %p.\n",
    318299                    instance->registers->periodic_current);
    319 #if 0
    320                 LIST_INITIALIZE(done);
    321                 transfer_list_remove_finished(
    322                     &instance->transfers_interrupt, &done);
    323                 transfer_list_remove_finished(
    324                     &instance->transfers_isochronous, &done);
    325                 transfer_list_remove_finished(
    326                     &instance->transfers_control, &done);
    327                 transfer_list_remove_finished(
    328                     &instance->transfers_bulk, &done);
    329 
    330                 while (!list_empty(&done)) {
    331                         link_t *item = done.next;
    332                         list_remove(item);
     300
     301                link_t *current = instance->pending_batches.next;
     302                while (current != &instance->pending_batches) {
     303                        link_t *next = current->next;
    333304                        usb_transfer_batch_t *batch =
    334                             list_get_instance(item, usb_transfer_batch_t, link);
    335                         usb_transfer_batch_finish(batch);
     305                            usb_transfer_batch_from_link(current);
     306
     307                        if (batch_is_complete(batch)) {
     308                                usb_transfer_batch_finish(batch);
     309                        }
     310                        current = next;
    336311                }
    337312                fibril_mutex_unlock(&instance->guard);
    338 #endif
    339313        }
    340314}
  • uspace/drv/ohci/hc.h

    r9a6fde4 r7013b14  
    5353typedef struct hc {
    5454        ohci_regs_t *registers;
     55        hcca_t *hcca;
     56
    5557        usb_address_t rh_address;
    5658        rh_t rh;
    5759
    58         hcca_t *hcca;
     60        endpoint_list_t lists[4];
     61        link_t pending_batches;
    5962
    60         endpoint_list_t lists[4];
    61 
    62         ddf_fun_t *ddf_instance;
    6363        usb_device_keeper_t manager;
    6464        usb_endpoint_manager_t ep_manager;
     
    8080int hc_add_endpoint(hc_t *instance, usb_address_t address, usb_endpoint_t ep,
    8181    usb_speed_t speed, usb_transfer_type_t type, usb_direction_t direction,
    82                 size_t max_packet_size, size_t size, unsigned interval);
     82    size_t max_packet_size, size_t size, unsigned interval);
    8383
    8484int hc_remove_endpoint(hc_t *instance, usb_address_t address,
Note: See TracChangeset for help on using the changeset viewer.