Skip to content

Commit 4c846af

Browse files
committed
rename OHCI_RHPORTS to TUP_OHCI_RHPORTS
1 parent 4e2afdf commit 4c846af

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/common/tusb_mcu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#elif TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC40XX)
5656
#define TUP_DCD_ENDPOINT_MAX 16
5757
#define TUP_USBIP_OHCI
58-
#define OHCI_RHPORTS 2
58+
#define TUP_OHCI_RHPORTS 2
5959

6060
#elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX)
6161
// TODO USB0 has 6, USB1 has 4

src/portable/ohci/ohci.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
#if CFG_TUH_ENABLED && defined(TUP_USBIP_OHCI)
3030

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.
3333
#endif
3434

3535
//--------------------------------------------------------------------+
@@ -393,21 +393,20 @@ static void ed_list_remove_by_addr(ohci_ed_t * p_head, uint8_t dev_addr)
393393

394394
if (ed->dev_addr == dev_addr)
395395
{
396-
//Prevent Host Controller from processing this ED while we remove it
396+
// Prevent Host Controller from processing this ED while we remove it
397397
ed->skip = 1;
398398

399-
// unlink ed
399+
// unlink ed, will also move up p_prev
400400
p_prev->next = ed->next;
401401

402402
// point the removed ED's next pointer to list head to make sure HC can always safely move away from this ED
403403
ed->next = (uint32_t) _phys_addr(p_head);
404404
ed->used = 0;
405405
ed->skip = 0;
406-
continue;
406+
}else
407+
{
408+
p_prev = (ohci_ed_t*) _virt_addr((void *)p_prev->next);
407409
}
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);
411410
}
412411
}
413412

@@ -665,7 +664,7 @@ void hcd_int_handler(uint8_t hostid)
665664
//------------- RootHub status -------------//
666665
if ( int_status & OHCI_INT_RHPORT_STATUS_CHANGE_MASK )
667666
{
668-
for (int i = 0; i < OHCI_RHPORTS; i++)
667+
for (int i = 0; i < TUP_OHCI_RHPORTS; i++)
669668
{
670669
uint32_t const rhport_status = OHCI_REG->rhport_status[i] & RHPORT_ALL_CHANGE_MASK;
671670
if ( rhport_status & RHPORT_CONNECT_STATUS_CHANGE_MASK )

src/portable/ohci/ohci.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ typedef volatile struct
267267
};
268268

269269
union {
270-
uint32_t rhport_status[OHCI_RHPORTS];
270+
uint32_t rhport_status[TUP_OHCI_RHPORTS];
271271
struct {
272272
uint32_t current_connect_status : 1;
273273
uint32_t port_enable_status : 1;
@@ -284,11 +284,11 @@ typedef volatile struct
284284
uint32_t port_over_current_indicator_change : 1;
285285
uint32_t port_reset_status_change : 1;
286286
uint32_t TU_RESERVED : 11;
287-
}rhport_status_bit[OHCI_RHPORTS];
287+
}rhport_status_bit[TUP_OHCI_RHPORTS];
288288
};
289289
}ohci_registers_t;
290290

291-
TU_VERIFY_STATIC( sizeof(ohci_registers_t) == (0x54 + (4 * OHCI_RHPORTS)), "size is not correct");
291+
TU_VERIFY_STATIC( sizeof(ohci_registers_t) == (0x54 + (4 * TUP_OHCI_RHPORTS)), "size is not correct");
292292

293293
#ifdef __cplusplus
294294
}

0 commit comments

Comments
 (0)