Squashed 'third_party/pico-sdk/' content from commit 2062372d2
Change-Id: Ic20f199d3ed0ea8d3a6a1bbf513f875ec7500cc6
git-subtree-dir: third_party/pico-sdk
git-subtree-split: 2062372d203b372849d573f252cf7c6dc2800c0a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/src/rp2_common/tinyusb/CMakeLists.txt b/src/rp2_common/tinyusb/CMakeLists.txt
new file mode 100644
index 0000000..80a6e78
--- /dev/null
+++ b/src/rp2_common/tinyusb/CMakeLists.txt
@@ -0,0 +1,49 @@
+if (DEFINED ENV{PICO_TINYUSB_PATH} AND (NOT PICO_TINYUSB_PATH))
+ set(PICO_TINYUSB_PATH $ENV{PICO_TINYUSB_PATH})
+ message("Using PICO_TINYUSB_PATH from environment ('${PICO_TINYUSB_PATH}')")
+endif ()
+
+set(TINYUSB_TEST_PATH "src/portable/raspberrypi/rp2040")
+if (NOT PICO_TINYUSB_PATH)
+ set(PICO_TINYUSB_PATH ${PROJECT_SOURCE_DIR}/lib/tinyusb)
+ if (NOT EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
+ message(WARNING "TinyUSB submodule has not been initialized; USB support will be unavailable
+hint: try 'git submodule update --init' from your SDK directory (${PICO_SDK_PATH}).")
+ endif()
+elseif (NOT EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
+ message(WARNING "PICO_TINYUSB_PATH specified but content not present.")
+endif()
+
+if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
+ message("TinyUSB available at ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH}; enabling build support for USB.")
+
+ pico_register_common_scope_var(PICO_TINYUSB_PATH)
+
+ set(BOARD pico_sdk)
+ set(FAMILY rp2040)
+ include(${PICO_TINYUSB_PATH}/hw/bsp/family_support.cmake)
+
+ add_library(tinyusb_common INTERFACE)
+ target_link_libraries(tinyusb_common INTERFACE tinyusb_common_base)
+
+ add_library(tinyusb_device_unmarked INTERFACE)
+ target_link_libraries(tinyusb_device_unmarked INTERFACE tinyusb_device_base)
+ target_compile_definitions(tinyusb_device_unmarked INTERFACE
+ # off by default note TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX defaults from PICO_RP2040_USB_DEVICE_ENUMERATION_FIX
+# TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1
+ )
+
+ # unmarked version used by stdio USB
+ target_link_libraries(tinyusb_device_unmarked INTERFACE tinyusb_common pico_fix_rp2040_usb_device_enumeration tinyusb_device_base)
+
+ pico_add_impl_library(tinyusb_device)
+ target_link_libraries(tinyusb_device INTERFACE tinyusb_device_unmarked)
+
+ pico_add_impl_library(tinyusb_host)
+ target_link_libraries(tinyusb_host INTERFACE tinyusb_host_base tinyusb_common)
+
+ pico_add_impl_library(tinyusb_board)
+ target_link_libraries(tinyusb_board INTERFACE tinyusb_bsp)
+
+ pico_promote_common_scope_vars()
+endif()
diff --git a/src/rp2_common/tinyusb/doc.h b/src/rp2_common/tinyusb/doc.h
new file mode 100644
index 0000000..6c361e0
--- /dev/null
+++ b/src/rp2_common/tinyusb/doc.h
@@ -0,0 +1,7 @@
+/**
+ * \defgroup tinyusb_device tinyusb_device
+ * \brief <a href="https://github.com/hathach/tinyusb">TinyUSB</a> Device-mode support for the RP2040
+ *
+ * \defgroup tinyusb_host tinyusb_host
+ * \brief <a href="https://github.com/hathach/tinyusb">TinyUSB</a> Host-mode support for the RP2040
+ */