sdbbs
sdbbs

Reputation: 5394

What does RHPort mean in tinyusb?

Looking through tinyusb, am a bit confused on the meaning of RHPort - cannot find much on Internet, grepping through source gives me results like:

tinyusb/docs/info/changelog.rst:- Add rhport to hcd_init()
tinyusb/docs/info/changelog.rst:  - Support multiple usb ports with rhport=1 is high
...
tinyusb/examples/device/cdc_dual_ports/src/tusb_config.h:// RHPort max operational speed can defined by board.mk
...
tinyusb/examples/device/cdc_dual_ports/src/tusb_config.h:// Device mode with rhport and speed defined by board.mk
...
tinyusb/examples/device/cdc_msc/src/tusb_config.h:// RHPort number used for device can be defined by board.mk, default to port 0
...

... and trying to think of what could "RH" possibly stand for as an acronym, the only thing that pops in my head is "Right Honourable" :)

So, what is the meaning of RHPort in (tiny)USB?

Upvotes: 1

Views: 950

Answers (1)

sdbbs
sdbbs

Reputation: 5394

Ok, I think I found at least some sort of an explanation ...

Anyways, https://docs.tinyusb.org/en/latest/reference/getting_started.html says:

Port Selection

If a board has several ports, one port is chosen by default in the individual board.mk file. Use option PORT=x To choose another port. For example to select the HS port of a STM32F746Disco board, use:

$ make BOARD=stm32f746disco PORT=1 all

A bit tricky to find where that PORT is used, then - but for the above example, it is most likely in https://github.com/hathach/tinyusb/blob/master/hw/bsp/stm32f7/family.mk :

...
CFLAGS += \
...
  -DBOARD_TUD_RHPORT=$(PORT)
...

... which then gets used in e.g. https://github.com/hathach/tinyusb/blob/master/examples/device/dfu_runtime/src/main.c :

...
  // init device stack on configured roothub port
  tud_init(BOARD_TUD_RHPORT);
...

... which reveals, that "RH" in "RHPort" most likely stands for "Root Hub".

So, my guess is, that for boards that have multiple physical USB port connectors, the RHPort determines which of those ports is tinyusb targeting?

Upvotes: 1

Related Questions