Skip to content

Commit 171c4d5

Browse files
committed
Added host port configuration and link to tinyusb
1 parent 63de8e0 commit 171c4d5

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

cores/arduino/tinyusb/host

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../extras/tinyusb/src/host

cores/arduino/usb/USB.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,18 @@ void __USBStart() {
268268
return;
269269
}
270270

271-
/* Enable USB_BASE */
271+
/*
272+
* ENABLE USB
273+
*/
272274
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_PRC1_UNLOCK;
273275
R_MSTP->MSTPCRB &= ~(1U << 11U);
274276
R_MSTP->MSTPCRB &= ~(1U << 12U);
275277
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
276278

279+
/*
280+
* CONFIGURE USB INTERRUPTS
281+
*/
282+
277283
#ifdef CFG_TUSB_RHPORT0_MODE
278284
#if (CFG_TUSB_RHPORT0_MODE != 0)
279285
usb_irq_cfg.num_of_irqs_required = 4;
@@ -294,7 +300,15 @@ void __USBStart() {
294300

295301
__SetupUSBDescriptor();
296302

303+
/*
304+
* INIT Tiny USB
305+
*/
306+
307+
assert(BOARD_TUD_RHPORT != BOARD_TUH_RHPORT);
308+
/* init device port*/
297309
tud_init(BOARD_TUD_RHPORT);
310+
/* init host port */
311+
tuh_init(BOARD_TUH_RHPORT);
298312

299313
#if 0 //defined(AZURE_RTOS_THREADX)
300314
static TX_BYTE_POOL byte_pool_0;

variants/PORTENTA_H33/tusb_config.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@
1212
extern "C" {
1313
#endif
1414

15+
/*
16+
* USB PORT 0 CONFIGURATION: HOST, FULL SPEED
17+
*/
18+
19+
// RHPort number used for device can be defined by board.mk, default to port 0
20+
#ifndef BOARD_TUH_RHPORT
21+
#define BOARD_TUH_RHPORT 0
22+
#endif
23+
24+
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_FULL_SPEED)
25+
26+
#ifndef BOARD_TUH_MAX_SPEED
27+
#define BOARD_TUH_MAX_SPEED OPT_MODE_FULL_SPEED
28+
#endif
29+
30+
/*
31+
* USB PORT 1 CONFIGURATION: DEVICE, HIGH SPEED
32+
*/
33+
1534
// RHPort number used for device can be defined by board.mk, default to port 0
1635
#ifndef BOARD_TUD_RHPORT
1736
#define BOARD_TUD_RHPORT 1

0 commit comments

Comments
 (0)