Changeset aa9ccf7 in mainline


Ignore:
Timestamp:
2011-04-11T13:15:25Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9f104af4
Parents:
fd153d3
Message:

More debug output and some fixes

Add mutex for scheduling and removing of batches
batch_data initialize the first TD not the second
disable and enable both isochronous and interrupt processing when scheduling periodic transfer.
undef the right macro in transfer_list initialization

Location:
uspace/drv/ohci
Files:
6 edited

Legend:

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

    rfd153d3 raa9ccf7  
    145145                    data->tds[i].status, data->tds[i].cbp, data->tds[i].next,
    146146                    data->tds[i].be);
    147                 if (!td_is_finished(&data->tds[i]))
     147                if (!td_is_finished(&data->tds[i])) {
    148148                        return false;
     149                }
    149150                instance->error = td_error(&data->tds[i]);
    150151                /* FIXME: calculate real transfered size */
     
    287288
    288289        /* data stage */
    289         size_t td_current = 1;
     290        size_t td_current = 0;
    290291        size_t remain_size = instance->buffer_size;
    291292        char *transfer_buffer = instance->transport_buffer;
  • uspace/drv/ohci/hc.c

    rfd153d3 raa9ccf7  
    113113            ret, str_error(ret));
    114114        hc_init_hw(instance);
     115        fibril_mutex_initialize(&instance->guard);
    115116
    116117        rh_init(&instance->rh, dev, instance->registers);
     
    135136        }
    136137
     138        fibril_mutex_lock(&instance->guard);
    137139        switch (batch->transfer_type) {
    138140        case USB_TRANSFER_CONTROL:
     
    157159        case USB_TRANSFER_INTERRUPT:
    158160        case USB_TRANSFER_ISOCHRONOUS:
    159                 instance->registers->control &= ~C_PLE;
     161                instance->registers->control &= (~C_PLE & ~C_IE);
    160162                transfer_list_add_batch(
    161163                    instance->transfers[batch->transfer_type], batch);
    162                 instance->registers->control |= C_PLE;
     164                instance->registers->control |= C_PLE | C_IE;
     165                usb_log_debug2("Added periodic transfer: %x.\n",
     166                    instance->registers->periodic_current);
    163167                break;
    164168        default:
    165169                break;
    166170        }
     171        fibril_mutex_unlock(&instance->guard);
    167172        return EOK;
    168173}
     
    178183        usb_log_debug("OHCI interrupt: %x.\n", status);
    179184
    180 
    181185        if (status & IS_WDH) {
     186                fibril_mutex_lock(&instance->guard);
     187                usb_log_debug2("HCCA: %p-%p(%p).\n", instance->hcca,
     188                    instance->registers->hcca, addr_to_phys(instance->hcca));
     189                usb_log_debug2("Periodic current: %p.\n",
     190                    instance->registers->periodic_current);
    182191                LIST_INITIALIZE(done);
    183192                transfer_list_remove_finished(
     
    197206                        usb_transfer_batch_finish(batch);
    198207                }
     208                fibril_mutex_unlock(&instance->guard);
    199209        }
    200210}
     
    208218                instance->registers->interrupt_status = status;
    209219                hc_interrupt(instance, status);
    210                 async_usleep(10000);
     220                async_usleep(50000);
    211221        }
    212222        return EOK;
     
    345355        SETUP_TRANSFER_LIST(transfers_control, "CONTROL");
    346356        SETUP_TRANSFER_LIST(transfers_bulk, "BULK");
    347 
     357#undef SETUP_TRANSFER_LIST
    348358        transfer_list_set_next(&instance->transfers_interrupt,
    349359            &instance->transfers_isochronous);
     
    360370
    361371        return EOK;
    362 #undef CHECK_RET_CLEAR_RETURN
    363372}
    364373/*----------------------------------------------------------------------------*/
  • uspace/drv/ohci/hc.h

    rfd153d3 raa9ccf7  
    6969        usb_endpoint_manager_t ep_manager;
    7070        fid_t interrupt_emulator;
     71        fibril_mutex_t guard;
    7172} hc_t;
    7273
  • uspace/drv/ohci/main.c

    rfd153d3 raa9ccf7  
    9292int main(int argc, char *argv[])
    9393{
    94         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     94        usb_log_enable(USB_LOG_LEVEL_DEBUG2, NAME);
    9595        sleep(5);
    9696        return ddf_driver_main(&ohci_driver);
  • uspace/drv/ohci/ohci_regs.h

    rfd153d3 raa9ccf7  
    100100#define HCCA_PTR_MASK 0xffffff00 /* HCCA is 256B aligned */
    101101
    102         /** Currently executed period endpoint */
    103         const volatile uint32_t period_current;
     102        /** Currently executed periodic endpoint */
     103        const volatile uint32_t periodic_current;
    104104
    105105        /** The first control endpoint */
  • uspace/drv/ohci/transfer_list.c

    rfd153d3 raa9ccf7  
    7979        assert(instance);
    8080        assert(next);
    81         /* Set both queue_head.next to point to the follower */
    8281        ed_append_ed(instance->list_head, next->list_head);
    8382}
     
    125124                batch, instance->name, first, batch_ed(first));
    126125        if (last_ed == instance->list_head) {
    127                 usb_log_debug2("%s head ED: %x:%x:%x:%x.\n", instance->name,
    128                         last_ed->status, last_ed->td_tail, last_ed->td_head,
    129                         last_ed->next);
     126                usb_log_debug2("%s head ED(%p-%p): %x:%x:%x:%x.\n",
     127                    instance->name, last_ed, instance->list_head_pa,
     128                    last_ed->status, last_ed->td_tail, last_ed->td_head,
     129                    last_ed->next);
    130130        }
    131131        fibril_mutex_unlock(&instance->guard);
Note: See TracChangeset for help on using the changeset viewer.