|
28 | 28 |
|
29 | 29 | #if CFG_TUH_ENABLED && defined(TUP_USBIP_OHCI) |
30 | 30 |
|
31 | | -#ifndef OHCI_RHPORTS |
32 | | -#error OHCI is enabled, but OHCI_RHPORTS is not defined. |
| 31 | +#ifndef TUP_OHCI_RHPORTS |
| 32 | +#error OHCI is enabled, but TUP_OHCI_RHPORTS is not defined. |
33 | 33 | #endif |
34 | 34 |
|
35 | 35 | //--------------------------------------------------------------------+ |
@@ -393,21 +393,20 @@ static void ed_list_remove_by_addr(ohci_ed_t * p_head, uint8_t dev_addr) |
393 | 393 |
|
394 | 394 | if (ed->dev_addr == dev_addr) |
395 | 395 | { |
396 | | - //Prevent Host Controller from processing this ED while we remove it |
| 396 | + // Prevent Host Controller from processing this ED while we remove it |
397 | 397 | ed->skip = 1; |
398 | 398 |
|
399 | | - // unlink ed |
| 399 | + // unlink ed, will also move up p_prev |
400 | 400 | p_prev->next = ed->next; |
401 | 401 |
|
402 | 402 | // point the removed ED's next pointer to list head to make sure HC can always safely move away from this ED |
403 | 403 | ed->next = (uint32_t) _phys_addr(p_head); |
404 | 404 | ed->used = 0; |
405 | 405 | ed->skip = 0; |
406 | | - continue; |
| 406 | + }else |
| 407 | + { |
| 408 | + p_prev = (ohci_ed_t*) _virt_addr((void *)p_prev->next); |
407 | 409 | } |
408 | | - |
409 | | - // check next valid since we could remove it |
410 | | - if (p_prev->next) p_prev = (ohci_ed_t*) _virt_addr((void *)p_prev->next); |
411 | 410 | } |
412 | 411 | } |
413 | 412 |
|
@@ -665,7 +664,7 @@ void hcd_int_handler(uint8_t hostid) |
665 | 664 | //------------- RootHub status -------------// |
666 | 665 | if ( int_status & OHCI_INT_RHPORT_STATUS_CHANGE_MASK ) |
667 | 666 | { |
668 | | - for (int i = 0; i < OHCI_RHPORTS; i++) |
| 667 | + for (int i = 0; i < TUP_OHCI_RHPORTS; i++) |
669 | 668 | { |
670 | 669 | uint32_t const rhport_status = OHCI_REG->rhport_status[i] & RHPORT_ALL_CHANGE_MASK; |
671 | 670 | if ( rhport_status & RHPORT_CONNECT_STATUS_CHANGE_MASK ) |
|
0 commit comments