source: mainline/uspace/drv/bus/usb/ehci/hc.c@ 2833bb4

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2833bb4 was 8ad2b0a, checked in by Ondřej Hlavatý <aearsis@…>, 8 years ago

ehci: implement transfer abort on endpoint unregister

  • Property mode set to 100644
File size: 15.4 KB
RevLine 
[6297465]1/*
2 * Copyright (c) 2011 Jan Vesely
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup drvusbehcihc
30 * @{
31 */
32/** @file
33 * @brief EHCI Host controller driver routines
34 */
35
36#include <assert.h>
37#include <async.h>
38#include <errno.h>
39#include <macros.h>
40#include <mem.h>
41#include <stdlib.h>
[8d2dd7f2]42#include <stdint.h>
[6297465]43#include <str_error.h>
44
45#include <usb/debug.h>
46#include <usb/usb.h>
47
[e9c5bd9]48#include "ehci_batch.h"
[6297465]49
50#include "hc.h"
51
52#define EHCI_USED_INTERRUPTS \
[bfff7fd]53 (USB_INTR_IRQ_FLAG | USB_INTR_ERR_IRQ_FLAG | USB_INTR_PORT_CHANGE_FLAG | \
54 USB_INTR_ASYNC_ADVANCE_FLAG | USB_INTR_HOST_ERR_FLAG)
[6297465]55
56static const irq_pio_range_t ehci_pio_ranges[] = {
57 {
58 .base = 0,
59 .size = sizeof(ehci_regs_t)
60 }
61};
62
63static const irq_cmd_t ehci_irq_commands[] = {
64 {
65 .cmd = CMD_PIO_READ_32,
66 .dstarg = 1,
67 .addr = NULL
68 },
69 {
70 .cmd = CMD_AND,
71 .srcarg = 1,
72 .dstarg = 2,
73 .value = 0
74 },
75 {
76 .cmd = CMD_PREDICATE,
77 .srcarg = 2,
78 .value = 2
79 },
80 {
81 .cmd = CMD_PIO_WRITE_A_32,
82 .srcarg = 1,
83 .addr = NULL
84 },
85 {
86 .cmd = CMD_ACCEPT
87 }
88};
89
90static int hc_init_memory(hc_t *instance);
91
92/** Generate IRQ code.
93 * @param[out] ranges PIO ranges buffer.
[ba4a03a5]94 * @param[in] hw_res Device's resources.
[6297465]95 *
96 * @return Error code.
97 */
[32fb6bce]98int hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
[6297465]99{
100 assert(code);
[ba4a03a5]101 assert(hw_res);
[32fb6bce]102 hc_t *instance = hcd_to_hc(hcd);
[e4d7363]103
[ba4a03a5]104 if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
105 return EINVAL;
106
107 addr_range_t regs = hw_res->mem_ranges.ranges[0];
108
109 if (RNGSZ(regs) < sizeof(ehci_regs_t))
[6297465]110 return EOVERFLOW;
111
112 code->ranges = malloc(sizeof(ehci_pio_ranges));
113 if (code->ranges == NULL)
114 return ENOMEM;
115
116 code->cmds = malloc(sizeof(ehci_irq_commands));
117 if (code->cmds == NULL) {
118 free(code->ranges);
119 return ENOMEM;
120 }
121
122 code->rangecount = ARRAY_SIZE(ehci_pio_ranges);
123 code->cmdcount = ARRAY_SIZE(ehci_irq_commands);
124
125 memcpy(code->ranges, ehci_pio_ranges, sizeof(ehci_pio_ranges));
[ba4a03a5]126 code->ranges[0].base = RNGABS(regs);
[6297465]127
128 memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
[dca8fe5]129
[d09d108]130 ehci_regs_t *registers =
131 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(instance->caps->caplength));
132 code->cmds[0].addr = (void *) &registers->usbsts;
133 code->cmds[3].addr = (void *) &registers->usbsts;
[6297465]134 EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS);
135
[a1732929]136 usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.",
[ba4a03a5]137 RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
138
139 return hw_res->irqs.irqs[0];
[6297465]140}
141
142/** Initialize EHCI hc driver structure
143 *
144 * @param[in] instance Memory place for the structure.
145 * @param[in] regs Device's I/O registers range.
146 * @param[in] interrupts True if w interrupts should be used
147 * @return Error code
148 */
[32fb6bce]149int hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
[6297465]150{
[32fb6bce]151 hc_t *instance = hcd_to_hc(hcd);
[7813516]152 assert(hw_res);
153 if (hw_res->mem_ranges.count != 1 ||
154 hw_res->mem_ranges.ranges[0].size <
155 (sizeof(ehci_caps_regs_t) + sizeof(ehci_regs_t)))
156 return EINVAL;
[6297465]157
[7813516]158 int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
159 (void **)&instance->caps);
[6297465]160 if (ret != EOK) {
[05b51e37]161 usb_log_error("HC(%p): Failed to gain access to device "
[a1732929]162 "registers: %s.", instance, str_error(ret));
[6297465]163 return ret;
164 }
[e4d7363]165
[05b51e37]166 usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.",
167 instance, hw_res->mem_ranges.ranges[0].address.absolute,
[7813516]168 hw_res->mem_ranges.ranges[0].size);
[6297465]169 instance->registers =
170 (void*)instance->caps + EHCI_RD8(instance->caps->caplength);
[05b51e37]171 usb_log_info("HC(%p): Device control registers at %" PRIx64, instance,
[d97f91f]172 hw_res->mem_ranges.ranges[0].address.absolute
173 + EHCI_RD8(instance->caps->caplength));
[6297465]174
[8ad2b0a]175 list_initialize(&instance->pending_endpoints);
[6297465]176 fibril_mutex_initialize(&instance->guard);
[763dbcb]177 fibril_condvar_initialize(&instance->async_doorbell);
[6297465]178
179 ret = hc_init_memory(instance);
180 if (ret != EOK) {
[05b51e37]181 usb_log_error("HC(%p): Failed to create EHCI memory structures:"
182 " %s.", instance, str_error(ret));
[6297465]183 return ret;
184 }
185
[05b51e37]186 usb_log_info("HC(%p): Initializing RH(%p).", instance, &instance->rh);
[6297465]187 ehci_rh_init(
188 &instance->rh, instance->caps, instance->registers, "ehci rh");
189
[32fb6bce]190 ehci_bus_init(&instance->bus, instance);
191 hc_device_setup(hcd, (bus_t *) &instance->bus);
[6297465]192 return EOK;
193}
194
[7813516]195/** Safely dispose host controller internal structures
196 *
197 * @param[in] instance Host controller structure to use.
198 */
[35c37fc]199int hc_gone(hc_device_t *hcd)
[7813516]200{
[35c37fc]201 hc_t *hc = hcd_to_hc(hcd);
202 endpoint_list_fini(&hc->async_list);
203 endpoint_list_fini(&hc->int_list);
204 dma_buffer_free(&hc->dma_buffer);
[32fb6bce]205 return EOK;
[7813516]206};
207
[6297465]208void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
209{
[5f5321ee]210 assert(instance);
211 assert(ep);
212 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
[a1732929]213 usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)", instance,
[a5b3de6]214 ep->device->address, ep->endpoint,
[92900e2]215 usb_str_transfer_type_short(ep->transfer_type),
216 usb_str_direction(ep->direction));
[5f5321ee]217 switch (ep->transfer_type)
218 {
219 case USB_TRANSFER_CONTROL:
220 case USB_TRANSFER_BULK:
221 endpoint_list_append_ep(&instance->async_list, ehci_ep);
222 break;
223 case USB_TRANSFER_INTERRUPT:
224 endpoint_list_append_ep(&instance->int_list, ehci_ep);
225 break;
226 case USB_TRANSFER_ISOCHRONOUS:
227 /* NOT SUPPORTED */
228 break;
229 }
[6297465]230}
231
232void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
233{
[763dbcb]234 assert(instance);
235 assert(ep);
236 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
[a1732929]237 usb_log_debug("HC(%p) dequeue EP(?:%d:%s:%s)", instance,
[306a36d]238 ep->endpoint,
[92900e2]239 usb_str_transfer_type_short(ep->transfer_type),
240 usb_str_direction(ep->direction));
[763dbcb]241 switch (ep->transfer_type)
242 {
243 case USB_TRANSFER_INTERRUPT:
[ce735cc2]244 endpoint_list_remove_ep(&instance->int_list, ehci_ep);
[763dbcb]245 /* Fall through */
246 case USB_TRANSFER_ISOCHRONOUS:
247 /* NOT SUPPORTED */
248 return;
249 case USB_TRANSFER_CONTROL:
250 case USB_TRANSFER_BULK:
251 endpoint_list_remove_ep(&instance->async_list, ehci_ep);
252 break;
253 }
254 fibril_mutex_lock(&instance->guard);
[05b51e37]255 usb_log_debug("HC(%p): Waiting for doorbell", instance);
[1803b7d]256 EHCI_SET(instance->registers->usbcmd, USB_CMD_IRQ_ASYNC_DOORBELL);
[763dbcb]257 fibril_condvar_wait(&instance->async_doorbell, &instance->guard);
[05b51e37]258 usb_log_debug2("HC(%p): Got doorbell", instance);
[763dbcb]259 fibril_mutex_unlock(&instance->guard);
[6297465]260}
261
[32fb6bce]262int ehci_hc_status(bus_t *bus_base, uint32_t *status)
[c9e954c]263{
[32fb6bce]264 assert(bus_base);
[c9e954c]265 assert(status);
[32fb6bce]266
267 ehci_bus_t *bus = (ehci_bus_t *) bus_base;
268 hc_t *hc = bus->hc;
269 assert(hc);
270
[c9e954c]271 *status = 0;
[32fb6bce]272 if (hc->registers) {
273 *status = EHCI_RD(hc->registers->usbsts);
274 EHCI_WR(hc->registers->usbsts, *status);
[c9e954c]275 }
[32fb6bce]276 usb_log_debug2("HC(%p): Read status: %x", hc, *status);
[c9e954c]277 return EOK;
278}
279
[6297465]280/** Add USB transfer to the schedule.
281 *
[c9e954c]282 * @param[in] hcd HCD driver structure.
[6297465]283 * @param[in] batch Batch representing the transfer.
284 * @return Error code.
285 */
[32fb6bce]286int ehci_hc_schedule(usb_transfer_batch_t *batch)
[6297465]287{
[32fb6bce]288 assert(batch);
289
290 ehci_bus_t *bus = (ehci_bus_t *) endpoint_get_bus(batch->ep);
291 hc_t *hc = bus->hc;
292 assert(hc);
[6297465]293
294 /* Check for root hub communication */
[32fb6bce]295 if (batch->target.address == ehci_rh_get_address(&hc->rh)) {
[05b51e37]296 usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)",
[32fb6bce]297 hc, batch, &hc->rh);
298 return ehci_rh_schedule(&hc->rh, batch);
[6297465]299 }
[5fd9c30]300
[8ad2b0a]301 endpoint_t * const ep = batch->ep;
302 ehci_endpoint_t * const ehci_ep = ehci_endpoint_get(ep);
303
304 /* creating local reference */
305 endpoint_add_ref(ep);
[5fd9c30]306
[8ad2b0a]307 fibril_mutex_lock(&ep->guard);
308 endpoint_activate_locked(ep, batch);
309
310 ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch);
[5fd9c30]311 const int err = ehci_transfer_batch_prepare(ehci_batch);
[8ad2b0a]312 if (err) {
313 endpoint_deactivate_locked(ep);
314 fibril_mutex_unlock(&ep->guard);
315 /* dropping local reference */
316 endpoint_del_ref(ep);
[5fd9c30]317 return err;
[8ad2b0a]318 }
[e9c5bd9]319
[32fb6bce]320 usb_log_debug("HC(%p): Committing BATCH(%p)", hc, batch);
[e9c5bd9]321 ehci_transfer_batch_commit(ehci_batch);
[8ad2b0a]322 fibril_mutex_unlock(&ep->guard);
323
324 /* Enqueue endpoint to the checked list */
325 fibril_mutex_lock(&hc->guard);
326 usb_log_debug2("HC(%p): Appending BATCH(%p)", hc, batch);
[e9c5bd9]327
[8ad2b0a]328 /* local reference -> pending list reference */
329 list_append(&ehci_ep->pending_link, &hc->pending_endpoints);
[32fb6bce]330 fibril_mutex_unlock(&hc->guard);
[8ad2b0a]331
[e9c5bd9]332 return EOK;
[6297465]333}
334
335/** Interrupt handling routine
336 *
[c9e954c]337 * @param[in] hcd HCD driver structure.
[6297465]338 * @param[in] status Value of the status register at the time of interrupt.
339 */
[32fb6bce]340void ehci_hc_interrupt(bus_t *bus_base, uint32_t status)
[6297465]341{
[32fb6bce]342 assert(bus_base);
343
344 ehci_bus_t *bus = (ehci_bus_t *) bus_base;
345 hc_t *hc = bus->hc;
346 assert(hc);
[07645906]347
[32fb6bce]348 usb_log_debug2("HC(%p): Interrupt: %"PRIx32, hc, status);
[6297465]349 if (status & USB_STS_PORT_CHANGE_FLAG) {
[32fb6bce]350 ehci_rh_interrupt(&hc->rh);
[6297465]351 }
[07645906]352
[580b330]353 if (status & USB_STS_IRQ_ASYNC_ADVANCE_FLAG) {
[32fb6bce]354 fibril_mutex_lock(&hc->guard);
355 usb_log_debug2("HC(%p): Signaling doorbell", hc);
356 fibril_condvar_broadcast(&hc->async_doorbell);
357 fibril_mutex_unlock(&hc->guard);
[763dbcb]358 }
[07645906]359
[e9c5bd9]360 if (status & (USB_STS_IRQ_FLAG | USB_STS_ERR_IRQ_FLAG)) {
[8ad2b0a]361
362 LIST_INITIALIZE(completed);
363
[32fb6bce]364 fibril_mutex_lock(&hc->guard);
[e9c5bd9]365
[8ad2b0a]366 usb_log_debug2("HC(%p): Scanning %lu pending endpoints", hc,
367 list_count(&hc->pending_endpoints));
368 list_foreach_safe(hc->pending_endpoints, current, next) {
369 ehci_endpoint_t *ep
370 = list_get_instance(current, ehci_endpoint_t, pending_link);
371
372 fibril_mutex_lock(&ep->base.guard);
373 ehci_transfer_batch_t *batch
374 = ehci_transfer_batch_get(ep->base.active_batch);
375 assert(batch);
[e9c5bd9]376
[5fd9c30]377 if (ehci_transfer_batch_check_completed(batch)) {
[8ad2b0a]378 endpoint_deactivate_locked(&ep->base);
[e9c5bd9]379 list_remove(current);
[8ad2b0a]380 endpoint_del_ref(&ep->base);
[5fd9c30]381 usb_transfer_batch_finish(&batch->base);
[e9c5bd9]382 }
[8ad2b0a]383 fibril_mutex_unlock(&ep->base.guard);
[e9c5bd9]384 }
[32fb6bce]385 fibril_mutex_unlock(&hc->guard);
[8ad2b0a]386
387
[e9c5bd9]388 }
389
[07645906]390 if (status & USB_STS_HOST_ERROR_FLAG) {
[32fb6bce]391 usb_log_fatal("HCD(%p): HOST SYSTEM ERROR!", hc);
[07645906]392 //TODO do something here
393 }
[6297465]394}
395
396/** EHCI hw initialization routine.
397 *
398 * @param[in] instance EHCI hc driver structure.
399 */
[32fb6bce]400int hc_start(hc_device_t *hcd)
[6297465]401{
[32fb6bce]402 hc_t *instance = hcd_to_hc(hcd);
[e4d7363]403 usb_log_debug("HC(%p): Starting HW.", instance);
404
[3eb0c85]405 /* Turn off the HC if it's running, Reseting a running device is
[478e243]406 * undefined */
407 if (!(EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG)) {
408 /* disable all interrupts */
409 EHCI_WR(instance->registers->usbintr, 0);
410 /* ack all interrupts */
411 EHCI_WR(instance->registers->usbsts, 0x3f);
412 /* Stop HC hw */
413 EHCI_WR(instance->registers->usbcmd, 0);
414 /* Wait until hc is halted */
415 while ((EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG) == 0) {
416 async_usleep(1);
417 }
[05b51e37]418 usb_log_info("HC(%p): EHCI turned off.", instance);
[478e243]419 } else {
[05b51e37]420 usb_log_info("HC(%p): EHCI was not running.", instance);
[478e243]421 }
422
423 /* Hw initialization sequence, see page 53 (pdf 63) */
424 EHCI_SET(instance->registers->usbcmd, USB_CMD_HC_RESET_FLAG);
[05b51e37]425 usb_log_info("HC(%p): Waiting for HW reset.", instance);
[478e243]426 while (EHCI_RD(instance->registers->usbcmd) & USB_CMD_HC_RESET_FLAG) {
427 async_usleep(1);
428 }
[05b51e37]429 usb_log_debug("HC(%p): HW reset OK.", instance);
430
[763dbcb]431 /* Use the lowest 4G segment */
[478e243]432 EHCI_WR(instance->registers->ctrldssegment, 0);
[3eb0c85]433
434 /* Enable periodic list */
[35c37fc]435 assert(instance->periodic_list);
[50362c6]436 uintptr_t phys_base =
[35c37fc]437 addr_to_phys((void*)instance->periodic_list);
[478e243]438 assert((phys_base & USB_PERIODIC_LIST_BASE_MASK) == phys_base);
439 EHCI_WR(instance->registers->periodiclistbase, phys_base);
[44b9b44]440 EHCI_SET(instance->registers->usbcmd, USB_CMD_PERIODIC_SCHEDULE_FLAG);
[05b51e37]441 usb_log_debug("HC(%p): Enabled periodic list.", instance);
[478e243]442
[763dbcb]443
[0a751aa]444 /* Enable Async schedule */
[50362c6]445 phys_base = addr_to_phys((void*)instance->async_list.list_head);
446 assert((phys_base & USB_ASYNCLIST_MASK) == phys_base);
447 EHCI_WR(instance->registers->asynclistaddr, phys_base);
[0a751aa]448 EHCI_SET(instance->registers->usbcmd, USB_CMD_ASYNC_SCHEDULE_FLAG);
[05b51e37]449 usb_log_debug("HC(%p): Enabled async list.", instance);
[44b9b44]450
[3eb0c85]451 /* Start hc and get all ports */
[44b9b44]452 EHCI_SET(instance->registers->usbcmd, USB_CMD_RUN_FLAG);
453 EHCI_SET(instance->registers->configflag, USB_CONFIG_FLAG_FLAG);
[05b51e37]454 usb_log_debug("HC(%p): HW started.", instance);
455
[a1732929]456 usb_log_debug2("HC(%p): Registers: "
457 "\tUSBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)"
458 "\tUSBSTS(%p): %x(0x00001000 = HC halted)"
459 "\tUSBINT(%p): %x(0x0 = no interrupts)."
460 "\tCONFIG(%p): %x(0x0 = ports controlled by companion hc).",
[05b51e37]461 instance,
[615abda]462 &instance->registers->usbcmd, EHCI_RD(instance->registers->usbcmd),
463 &instance->registers->usbsts, EHCI_RD(instance->registers->usbsts),
464 &instance->registers->usbintr, EHCI_RD(instance->registers->usbintr),
465 &instance->registers->configflag, EHCI_RD(instance->registers->configflag));
[495547d]466 /* Clear and Enable interrupts */
467 EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts));
468 EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS);
[e4d7363]469
470 return EOK;
[6297465]471}
472
473/** Initialize memory structures used by the EHCI hcd.
474 *
475 * @param[in] instance EHCI hc driver structure.
476 * @return Error code.
477 */
478int hc_init_memory(hc_t *instance)
479{
[478e243]480 assert(instance);
[05b51e37]481 usb_log_debug2("HC(%p): Initializing Async list(%p).", instance,
482 &instance->async_list);
[5f5321ee]483 int ret = endpoint_list_init(&instance->async_list, "ASYNC");
484 if (ret != EOK) {
[05b51e37]485 usb_log_error("HC(%p): Failed to setup ASYNC list: %s",
486 instance, str_error(ret));
[5f5321ee]487 return ret;
488 }
[50362c6]489 /* Specs say "Software must set queue head horizontal pointer T-bits to
490 * a zero for queue heads in the asynchronous schedule" (4.4.0).
491 * So we must maintain circular buffer (all horizontal pointers
492 * have to be valid */
493 endpoint_list_chain(&instance->async_list, &instance->async_list);
[5f5321ee]494
[05b51e37]495 usb_log_debug2("HC(%p): Initializing Interrupt list (%p).", instance,
496 &instance->int_list);
[5f5321ee]497 ret = endpoint_list_init(&instance->int_list, "INT");
498 if (ret != EOK) {
[05b51e37]499 usb_log_error("HC(%p): Failed to setup INT list: %s",
500 instance, str_error(ret));
[5f5321ee]501 endpoint_list_fini(&instance->async_list);
502 return ret;
503 }
[478e243]504
505 /* Take 1024 periodic list heads, we ignore low mem options */
[35c37fc]506 if (dma_buffer_alloc(&instance->dma_buffer, PAGE_SIZE)) {
[05b51e37]507 usb_log_error("HC(%p): Failed to get ISO schedule page.",
508 instance);
[5f5321ee]509 endpoint_list_fini(&instance->async_list);
510 endpoint_list_fini(&instance->int_list);
[478e243]511 return ENOMEM;
[5f5321ee]512 }
[35c37fc]513 instance->periodic_list = instance->dma_buffer.virt;
[05b51e37]514
515 usb_log_debug2("HC(%p): Initializing Periodic list.", instance);
[35c37fc]516 for (unsigned i = 0; i < PAGE_SIZE/sizeof(link_pointer_t); ++i)
[478e243]517 {
518 /* Disable everything for now */
[35c37fc]519 instance->periodic_list[i] =
[50362c6]520 LINK_POINTER_QH(addr_to_phys(instance->int_list.list_head));
[478e243]521 }
[6297465]522 return EOK;
523}
524
525/**
526 * @}
527 */
Note: See TracBrowser for help on using the repository browser.