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

Changeset 0535ee4 in mainline


Ignore:
Timestamp:
2011-01-28T17:36:40Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial
Children:
01656f2
Parents:
3fb3099c
Message:

Added debug_checker fibril (checks memory structures)

Fixed: Cleaning fibril checks all queues

Location:
uspace/drv/uhci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/uhci.c

    r3fb3099c r0535ee4  
    1111static int uhci_init_transfer_lists(transfer_list_t list[]);
    1212static int uhci_clean_finished(void *arg);
     13static int uhci_debug_checker(void *arg);
    1314
    1415int uhci_init(device_t *device, void *regs)
     
    7980        instance->cleaner = fibril_create(uhci_clean_finished, instance);
    8081        fibril_add_ready(instance->cleaner);
     82
     83        instance->debug_checker = fibril_create(uhci_debug_checker, instance);
     84        fibril_add_ready(instance->debug_checker);
    8185
    8286        uhci_print_verbose("Starting UHCI HC.\n");
     
    184188                uhci_print_verbose("Running cleaning fibril on: %p.\n", instance);
    185189                /* iterate all transfer queues */
    186                 int i = 1;
     190                int i = 0;
    187191                for (; i < TRANSFER_QUEUES; ++i) {
    188192                        /* Remove inactive transfers from the top of the queue
    189193                         * TODO: should I reach queue head or is this enough? */
    190                         uhci_print_verbose("Running cleaning fibril on queue: %p.\n",
    191                                 &instance->transfers[i]);
     194                        volatile transfer_descriptor_t * it =
     195                                instance->transfers[i].first;
     196                        uhci_print_verbose("Running cleaning fibril on queue: %p (%s).\n",
     197                                &instance->transfers[i], it ? "SOMETHING" : "EMPTY");
    192198                        while (instance->transfers[i].first &&
    193199                         !(instance->transfers[i].first->status & TD_STATUS_ERROR_ACTIVE)) {
    194200                                transfer_descriptor_t *transfer = instance->transfers[i].first;
    195                                 uhci_print_verbose("Cleaning fibril found inactive transport.");
     201                                uhci_print_info("Inactive transfer calling callback.\n");
    196202                                instance->transfers[i].first = transfer->next_va;
    197203                                transfer_descriptor_dispose(transfer);
     
    200206                                instance->transfers[i].last = instance->transfers[i].first;
    201207                }
    202                 async_usleep(1000000);
    203         }
    204         return EOK;
    205 }
     208                async_usleep(UHCI_CLEANER_TIMEOUT);
     209        }
     210        return EOK;
     211}
     212/*---------------------------------------------------------------------------*/
     213int uhci_debug_checker(void *arg)
     214{
     215        return 0;
     216        uhci_t *instance = (uhci_t*)arg;
     217        assert(instance);
     218        while (1) {
     219                uint16_t reg;
     220                reg = pio_read_16(&instance->registers->usbcmd);
     221                uhci_print_verbose("Command register: %X\n", reg);
     222                reg = pio_read_16(&instance->registers->usbsts);
     223                uhci_print_verbose("Status register: %X\n", reg);
     224                uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd);
     225                uhci_print_verbose("Framelist address: %p vs. %p.\n",
     226                        frame_list, addr_to_phys(instance->frame_list));
     227                int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff;
     228                uhci_print_verbose("Framelist item: %d \n", frnum );
     229
     230                queue_head_t* qh = instance->transfers[USB_TRANSFER_INTERRUPT].queue_head;
     231                uhci_print_verbose("Interrupt QH: %p vs. %p.\n",
     232                        instance->frame_list[frnum], addr_to_phys(qh));
     233
     234                uhci_print_verbose("Control QH: %p vs. %p.\n", qh->next_queue,
     235                        addr_to_phys(instance->transfers[USB_TRANSFER_CONTROL].queue_head));
     236                qh = instance->transfers[USB_TRANSFER_CONTROL].queue_head;
     237
     238                uhci_print_verbose("Bulk QH: %p vs. %p.\n", qh->next_queue,
     239                        addr_to_phys(instance->transfers[USB_TRANSFER_BULK].queue_head));
     240
     241                async_usleep(UHCI_DEBUGER_TIMEOUT);
     242        }
     243        return 0;
     244}
  • uspace/drv/uhci/uhci.h

    r3fb3099c r0535ee4  
    6464#define TRANSFER_QUEUES 4
    6565#define UHCI_FRAME_LIST_COUNT 1024
     66#define UHCI_CLEANER_TIMEOUT 5000000
     67#define UHCI_DEBUGER_TIMEOUT 3000000
    6668
    6769typedef struct uhci {
     
    7476        transfer_list_t transfers[TRANSFER_QUEUES];
    7577        fid_t cleaner;
     78        fid_t debug_checker;
    7679} uhci_t;
    7780
Note: See TracChangeset for help on using the changeset viewer.