From d89fc0772b0844703ae18912b8774df7c11d708c Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 3 Aug 2023 14:55:24 +0700 Subject: [PATCH] add makefile, add cdc_uac2 to cmake example list, update descriptor to build with nrf and samg/7x --- examples/device/CMakeLists.txt | 1 + examples/device/cdc_uac2/CMakeLists.txt | 16 +++--- examples/device/cdc_uac2/Makefile | 16 ++++++ examples/device/cdc_uac2/skip.txt | 52 ------------------- .../cdc_uac2/src/{tusb_cdc.c => cdc_app.c} | 0 .../cdc_uac2/src/{tusb_uac2.c => uac2_app.c} | 0 .../device/cdc_uac2/src/usb_descriptors.c | 12 +++++ 7 files changed, 37 insertions(+), 60 deletions(-) create mode 100644 examples/device/cdc_uac2/Makefile delete mode 100644 examples/device/cdc_uac2/skip.txt rename examples/device/cdc_uac2/src/{tusb_cdc.c => cdc_app.c} (100%) rename examples/device/cdc_uac2/src/{tusb_uac2.c => uac2_app.c} (100%) diff --git a/examples/device/CMakeLists.txt b/examples/device/CMakeLists.txt index 5b077a5e15..f590fff3fd 100644 --- a/examples/device/CMakeLists.txt +++ b/examples/device/CMakeLists.txt @@ -13,6 +13,7 @@ family_add_subdirectory(board_test) family_add_subdirectory(cdc_dual_ports) family_add_subdirectory(cdc_msc) family_add_subdirectory(cdc_msc_freertos) +family_add_subdirectory(cdc_uac2) family_add_subdirectory(dfu) family_add_subdirectory(dfu_runtime) family_add_subdirectory(dynamic_configuration) diff --git a/examples/device/cdc_uac2/CMakeLists.txt b/examples/device/cdc_uac2/CMakeLists.txt index efe8c74ba1..64e4374e97 100644 --- a/examples/device/cdc_uac2/CMakeLists.txt +++ b/examples/device/cdc_uac2/CMakeLists.txt @@ -19,20 +19,20 @@ add_executable(${PROJECT}) # Example source target_sources(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/tusb_cdc.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/tusb_uac2.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c - ) + ${CMAKE_CURRENT_SOURCE_DIR}/src/cdc_app.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/uac2_app.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c + ) # Example include target_include_directories(${PROJECT} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + ${CMAKE_CURRENT_SOURCE_DIR}/src + ) # Configure compilation flags and libraries for the example... see the corresponding function # in hw/bsp/FAMILY/family.cmake for details. -family_configure_device_example(${PROJECT}) +family_configure_device_example(${PROJECT} noos) # Uncomment me to enable UART based debugging # pico_enable_stdio_uart(${PROJECT} 1) diff --git a/examples/device/cdc_uac2/Makefile b/examples/device/cdc_uac2/Makefile new file mode 100644 index 0000000000..b7a8302ce4 --- /dev/null +++ b/examples/device/cdc_uac2/Makefile @@ -0,0 +1,16 @@ +include ../../make.mk + +INC += \ + src \ + $(TOP)/hw \ + +# Example source +EXAMPLE_SOURCE += \ + src/cdc_app.c \ + src/main.c \ + src/uac2_app.c \ + src/usb_descriptors.c \ + +SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) + +include ../../rules.mk diff --git a/examples/device/cdc_uac2/skip.txt b/examples/device/cdc_uac2/skip.txt deleted file mode 100644 index 8e70a5278e..0000000000 --- a/examples/device/cdc_uac2/skip.txt +++ /dev/null @@ -1,52 +0,0 @@ -board:curiosity_nano -board:frdm_kl25z -board:stm32l052dap52 -family:broadcom_32bit -family:broadcom_64bit -family:ch32v307 -family:fomu -family:gd32vf103 -family:kinetis_k32l -family:kinetis_kl -family:lpc11 -family:lpc13 -family:lpc15 -family:lpc17 -family:lpc51 -family:lpc54 -family:lpc55 -family:mm32 -family:msp430 -family:msp432e -family:msp432e4 -family:nrf -family:ra -family:rx -family:samd11 -family:samd21 -family:samd51 -family:same5x -family:saml2x -family:stm32f0 -family:stm32f1 -family:stm32f2 -family:stm32f3 -family:stm32f4 -family:stm32f7 -family:stm32g4 -family:stm32h7 -family:stm32l0 -family:stm32l4 -family:stm32u5 -family:stm32wb -family:tm4c123 -family:xmc4000 -mcu:LPC11UXX -mcu:LPC13XX -mcu:MKL25ZXX -mcu:MSP430x5xx -mcu:NUC121 -mcu:SAMD11 -mcu:SAME5X -mcu:SAMG -mcu:STM32L0 diff --git a/examples/device/cdc_uac2/src/tusb_cdc.c b/examples/device/cdc_uac2/src/cdc_app.c similarity index 100% rename from examples/device/cdc_uac2/src/tusb_cdc.c rename to examples/device/cdc_uac2/src/cdc_app.c diff --git a/examples/device/cdc_uac2/src/tusb_uac2.c b/examples/device/cdc_uac2/src/uac2_app.c similarity index 100% rename from examples/device/cdc_uac2/src/tusb_uac2.c rename to examples/device/cdc_uac2/src/uac2_app.c diff --git a/examples/device/cdc_uac2/src/usb_descriptors.c b/examples/device/cdc_uac2/src/usb_descriptors.c index 1b2766829f..58b7119788 100644 --- a/examples/device/cdc_uac2/src/usb_descriptors.c +++ b/examples/device/cdc_uac2/src/usb_descriptors.c @@ -92,18 +92,30 @@ uint8_t const * tud_descriptor_device_cb(void) #define EPNUM_AUDIO_IN 0x08 #define EPNUM_AUDIO_OUT 0x08 + #define EPNUM_CDC_NOTIF 0x81 + #define EPNUM_CDC_OUT 0x02 + #define EPNUM_CDC_IN 0x82 + #elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X // SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT // e.g EP1 OUT & EP1 IN cannot exist together #define EPNUM_AUDIO_IN 0x01 #define EPNUM_AUDIO_OUT 0x02 + #define EPNUM_CDC_NOTIF 0x83 + #define EPNUM_CDC_OUT 0x04 + #define EPNUM_CDC_IN 0x85 + #elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X // FT9XX doesn't support a same endpoint number with different direction IN and OUT // e.g EP1 OUT & EP1 IN cannot exist together #define EPNUM_AUDIO_IN 0x01 #define EPNUM_AUDIO_OUT 0x02 + #define EPNUM_CDC_NOTIF 0x83 + #define EPNUM_CDC_OUT 0x04 + #define EPNUM_CDC_IN 0x85 + #else #define EPNUM_AUDIO_IN 0x01 #define EPNUM_AUDIO_OUT 0x01