Changeset 0535ee4 in mainline for uspace/drv/uhci/uhci.c
- Timestamp:
- 2011-01-28T17:36:40Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 01656f2
- Parents:
- 3fb3099c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/uhci.c
r3fb3099c r0535ee4 11 11 static int uhci_init_transfer_lists(transfer_list_t list[]); 12 12 static int uhci_clean_finished(void *arg); 13 static int uhci_debug_checker(void *arg); 13 14 14 15 int uhci_init(device_t *device, void *regs) … … 79 80 instance->cleaner = fibril_create(uhci_clean_finished, instance); 80 81 fibril_add_ready(instance->cleaner); 82 83 instance->debug_checker = fibril_create(uhci_debug_checker, instance); 84 fibril_add_ready(instance->debug_checker); 81 85 82 86 uhci_print_verbose("Starting UHCI HC.\n"); … … 184 188 uhci_print_verbose("Running cleaning fibril on: %p.\n", instance); 185 189 /* iterate all transfer queues */ 186 int i = 1;190 int i = 0; 187 191 for (; i < TRANSFER_QUEUES; ++i) { 188 192 /* Remove inactive transfers from the top of the queue 189 193 * 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"); 192 198 while (instance->transfers[i].first && 193 199 !(instance->transfers[i].first->status & TD_STATUS_ERROR_ACTIVE)) { 194 200 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"); 196 202 instance->transfers[i].first = transfer->next_va; 197 203 transfer_descriptor_dispose(transfer); … … 200 206 instance->transfers[i].last = instance->transfers[i].first; 201 207 } 202 async_usleep(1000000); 203 } 204 return EOK; 205 } 208 async_usleep(UHCI_CLEANER_TIMEOUT); 209 } 210 return EOK; 211 } 212 /*---------------------------------------------------------------------------*/ 213 int 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 }
Note:
See TracChangeset
for help on using the changeset viewer.