Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change tusb_init() to use init struct #2836

Merged
merged 6 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
#ceedling test:all

- name: Run pre-commit
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1

- name: Build Fuzzer
run: |
Expand Down
13 changes: 7 additions & 6 deletions .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ repos:
pass_filenames: false
types_or: [c, header]
language: system

# - id: build-fuzzer
# name: build-fuzzer
# files: ^(src/|test/fuzz/)
# language: system
# types_or: [c, header]
# entry: |
# bash -c 'export CC=clang
# export CXX=clang++
# fuzz_harness=$(ls -d test/fuzz/device/*/)
# for h in $fuzz_harness
# do
# make -C $h get-deps
# make -C $h all
# done'
6 changes: 5 additions & 1 deletion examples/device/audio_4_channel_mic/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/audio_4_channel_mic_freertos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ void usb_device_task(void* param)
// init device stack on configured roothub port
// This should be called after scheduler/kernel is started.
// Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/audio_test/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/audio_test_freertos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ void usb_device_task(void* param)
// init device stack on configured roothub port
// This should be called after scheduler/kernel is started.
// Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/audio_test_multi_rate/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/cdc_dual_ports/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ int main(void) {
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/cdc_msc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ int main(void) {
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/cdc_msc_freertos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ static void usb_device_task(void *param) {
// init device stack on configured roothub port
// This should be called after scheduler/kernel is started.
// Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/cdc_uac2/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

#if (CFG_TUSB_MCU == OPT_MCU_RP2040)
stdio_init_all();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/dfu/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/dfu_runtime/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/dynamic_configuration/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/hid_boot_interface/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/hid_composite/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/hid_composite_freertos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ void usb_device_task(void* param)
// init device stack on configured roothub port
// This should be called after scheduler/kernel is started.
// Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/hid_generic_inout/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/hid_multiple_interface/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/midi_test/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/msc_dual_lun/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ int main(void) {
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/net_lwip_webserver/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ int main(void) {
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/uac2_headset/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/uac2_speaker_fb/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
6 changes: 5 additions & 1 deletion examples/device/usbtmc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ int main(void)
board_init();

// init device stack on configured roothub port
tusb_init(BOARD_TUD_RHPORT, TUSB_ROLE_DEVICE);
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_AUTO
};
tusb_init(BOARD_TUD_RHPORT, &dev_init);

if (board_init_after_tusb) {
board_init_after_tusb();
Expand Down
Loading
Loading