summaryrefslogtreecommitdiff
path: root/examples/device/cdc_msc
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-02-12 18:05:20 +0100
committerReinhard Panhuber <[email protected]>2021-02-12 18:05:20 +0100
commitcdf600048f717f187243b8118eac43b793c3feec (patch)
tree00d88a8e39560c2e1a35f6c9feb97062733d9d8b /examples/device/cdc_msc
parent185414721ff549058a199ade40966015e6260996 (diff)
parent09868434cd9f53394350cce682333ada97f796c3 (diff)
Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
Diffstat (limited to 'examples/device/cdc_msc')
-rw-r--r--examples/device/cdc_msc/CMakeLists.txt47
-rw-r--r--examples/device/cdc_msc/src/tusb_config.h2
-rw-r--r--examples/device/cdc_msc/src/usb_descriptors.c12
3 files changed, 61 insertions, 0 deletions
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt
new file mode 100644
index 000000000..9e0d1f790
--- /dev/null
+++ b/examples/device/cdc_msc/CMakeLists.txt
@@ -0,0 +1,47 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+set(PROJECT ${BOARD}-${PROJECT})
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "esp32s2")
+ cmake_minimum_required(VERSION 3.5)
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+ project(${PROJECT})
+
+elseif(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/cdc_msc/src/tusb_config.h b/examples/device/cdc_msc/src/tusb_config.h
index 1370e61c5..e0099785b 100644
--- a/examples/device/cdc_msc/src/tusb_config.h
+++ b/examples/device/cdc_msc/src/tusb_config.h
@@ -65,7 +65,9 @@
#endif
// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/cdc_msc/src/usb_descriptors.c b/examples/device/cdc_msc/src/usb_descriptors.c
index e13b8189b..fa4342165 100644
--- a/examples/device/cdc_msc/src/usb_descriptors.c
+++ b/examples/device/cdc_msc/src/usb_descriptors.c
@@ -104,6 +104,18 @@ enum
#define EPNUM_MSC_OUT 0x04
#define EPNUM_MSC_IN 0x85
+#elif CFG_TUSB_MCU == OPT_MCU_CXD56
+ // CXD56 doesn't support a same endpoint number with different direction IN and OUT
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ // CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
+ // 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
+ #define EPNUM_CDC_NOTIF 0x83
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x81
+
+ #define EPNUM_MSC_OUT 0x05
+ #define EPNUM_MSC_IN 0x84
+
#else
#define EPNUM_CDC_NOTIF 0x81
#define EPNUM_CDC_OUT 0x02