summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2020-03-11 12:50:41 +0700
committerGitHub <[email protected]>2020-03-11 12:50:41 +0700
commita0eb8a26517040850a0e4185aef398183b04ddc7 (patch)
tree106767d1dccbb015966c98e8792b9da9d1021af9 /examples
parent41d9ab5056c63dc0ecf4b60d55a5f653b561a0c5 (diff)
parent5fa1e6e242f08d340a46b9a8c885b8495dbe2c76 (diff)
Merge pull request #297 from hathach/develop
Added cdc_msc_freertos example to ci build
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc/src/tusb_config.h1
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_CXD560
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI0
-rw-r--r--examples/device/cdc_msc_freertos/Makefile27
-rw-r--r--examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject)0
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s (renamed from examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s)0
-rw-r--r--examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h233
-rw-r--r--examples/device/cdc_msc_freertos/src/freertos_hook.c (renamed from examples/device/cdc_msc_hid_freertos/src/freertos_hook.c)0
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c (renamed from examples/device/cdc_msc_hid_freertos/src/main.c)119
-rw-r--r--examples/device/cdc_msc_freertos/src/msc_disk.c (renamed from examples/device/cdc_msc_hid_freertos/src/msc_disk.c)12
-rw-r--r--examples/device/cdc_msc_freertos/src/tusb_config.h (renamed from examples/device/cdc_msc_hid_freertos/src/tusb_config.h)2
-rw-r--r--examples/device/cdc_msc_freertos/src/usb_descriptors.c (renamed from examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c)87
-rw-r--r--examples/device/cdc_msc_freertos/src/usb_descriptors.h (renamed from examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h)0
-rw-r--r--examples/device/cdc_msc_hid_freertos/Makefile26
44 files changed, 309 insertions, 198 deletions
diff --git a/examples/device/cdc_msc/src/tusb_config.h b/examples/device/cdc_msc/src/tusb_config.h
index d881cb638..733fd2d0a 100644
--- a/examples/device/cdc_msc/src/tusb_config.h
+++ b/examples/device/cdc_msc/src/tusb_config.h
@@ -68,6 +68,7 @@
//--------------------------------------------------------------------
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
+
#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE 64
#endif
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_CXD56 b/examples/device/cdc_msc_freertos/.skip.MCU_CXD56
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_CXD56
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI b/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
new file mode 100644
index 000000000..3570daa41
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -0,0 +1,27 @@
+include ../../../tools/top.mk
+include ../../make.mk
+
+FREERTOS_SRC = lib/FreeRTOS/FreeRTOS/Source
+
+INC += \
+ src \
+ $(TOP)/hw \
+ $(TOP)/$(FREERTOS_SRC)/include \
+ $(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
+
+# Example source
+EXAMPLE_SOURCE += $(wildcard src/*.c)
+SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
+
+# FreeRTOS source, all files in port folder
+SRC_C += \
+ $(FREERTOS_SRC)/list.c \
+ $(FREERTOS_SRC)/queue.c \
+ $(FREERTOS_SRC)/tasks.c \
+ $(FREERTOS_SRC)/timers.c \
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
+
+# FreeRTOS (lto + Os) linker issue
+LDFLAGS += -Wl,--undefined=vTaskSwitchContext
+
+include ../../rules.mk
diff --git a/examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject b/examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject
index acd8e98c2..acd8e98c2 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/cdc_msc_hid_freertos.emProject
+++ b/examples/device/cdc_msc_freertos/ses/cdc_msc_hid_freertos.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
index 5d3ba479e..5d3ba479e 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/FreeRTOSConfig.h
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s
index f039ad934..f039ad934 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js
index 7f945a3d2..7f945a3d2 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1700_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1700_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
index d9c07aea3..d9c07aea3 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC1769_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
index fd38966b8..fd38966b8 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
index c5fae1310..c5fae1310 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/LPC176x5x_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
index 4dc111f2e..4dc111f2e 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/lpc175x_6x/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml
index 951d23710..951d23710 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
index cc4056c0d..cc4056c0d 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF52840_xxAA_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nRF_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nRF_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml
index 39f861f95..39f861f95 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf52840_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf52840_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
index f01b26d23..f01b26d23 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/nrf5x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s
index 71820cb51..71820cb51 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
index 2143d3055..2143d3055 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
index 2e0fa0619..2e0fa0619 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
index 5cecbd23b..5cecbd23b 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/ATSAMD21G18A_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s
index c4b48d351..c4b48d351 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/SAMD21_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/samd21/SAMD21_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd21/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
index 18291fbfd..18291fbfd 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/samd21.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd21/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/samd21/thumb_crt0.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
index 49d9a9cbd..49d9a9cbd 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_MemoryMap.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
index 83fe837fa..83fe837fa 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Registers.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
index 6369de863..6369de863 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/ATSAMD51J19A_Vectors.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s
index 03bf54def..03bf54def 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Startup.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Startup.s
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js
index 20560af43..20560af43 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/SAMD51_Target.js
+++ b/examples/device/cdc_msc_freertos/ses/samd51/SAMD51_Target.js
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml b/examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml
index 79bedc537..79bedc537 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/flash_placement.xml
+++ b/examples/device/cdc_msc_freertos/ses/samd51/flash_placement.xml
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
index c18aad2eb..c18aad2eb 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/samd51.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
diff --git a/examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s b/examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s
index 17f88e0ca..17f88e0ca 100644
--- a/examples/device/cdc_msc_hid_freertos/ses/samd51/thumb_crt0.s
+++ b/examples/device/cdc_msc_freertos/ses/samd51/thumb_crt0.s
diff --git a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
new file mode 100644
index 000000000..0945baf1f
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
@@ -0,0 +1,233 @@
+/*
+ * FreeRTOS Kernel V10.0.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software. If you wish to use our Amazon
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * See http://www.freertos.org/a00110.html.
+ *----------------------------------------------------------*/
+
+// for OPT_MCU_
+#include "tusb_option.h"
+
+#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
+ CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
+ CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
+ CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
+ #include "chip.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
+ CFG_TUSB_MCU == OPT_MCU_LPC55XX
+ #include "fsl_device_registers.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
+ #include "nrf.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMD21 || CFG_TUSB_MCU == OPT_MCU_SAMD51
+ #include "sam.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMG
+ #undef LITTLE_ENDIAN // hack to suppress "LITTLE_ENDIAN" redefined
+ #include "sam.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
+ #include "stm32f0xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
+ #include "stm32f1xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
+ #include "stm32f2xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
+ #include "stm32f3xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
+ #include "stm32f4xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
+ #include "stm32f7xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
+ #include "stm32h7xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
+ #include "stm32l0xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
+ #include "stm32l1xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
+ #include "stm32l4xx.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
+ #include "fsl_device_registers.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_NUC120
+ #include "NUC100Series.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_NUC121 || CFG_TUSB_MCU == OPT_MCU_NUC126
+ #include "NuMicro.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_NUC505
+ #include "NUC505Series.h"
+
+#else
+ #error "FreeRTOSConfig.h need to include low level mcu header for configuration"
+#endif
+
+extern uint32_t SystemCoreClock;
+
+
+/* Cortex M23/M33 port configuration. */
+#define configENABLE_MPU 0
+#define configENABLE_FPU 1
+#define configENABLE_TRUSTZONE 0
+#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
+
+#define configUSE_PREEMPTION 1
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
+#define configCPU_CLOCK_HZ SystemCoreClock
+#define configTICK_RATE_HZ ( 1000 )
+#define configMAX_PRIORITIES ( 5 )
+#define configMINIMAL_STACK_SIZE ( 128 )
+#define configTOTAL_HEAP_SIZE ( 0*1024 ) // dynamic is not used
+#define configMAX_TASK_NAME_LEN 16
+#define configUSE_16_BIT_TICKS 0
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 2
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TIME_SLICING 0
+#define configUSE_NEWLIB_REENTRANT 0
+#define configENABLE_BACKWARD_COMPATIBILITY 1
+
+#define configSUPPORT_STATIC_ALLOCATION 1
+#define configSUPPORT_DYNAMIC_ALLOCATION 0
+
+/* Hook function related definitions. */
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
+#define configCHECK_FOR_STACK_OVERFLOW 2
+
+/* Run time and task stats gathering related definitions. */
+#define configGENERATE_RUN_TIME_STATS 0
+#define configUSE_TRACE_FACILITY 1 // legacy trace
+#define configUSE_STATS_FORMATTING_FUNCTIONS 0
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES 2
+
+/* Software timer related definitions. */
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
+#define configTIMER_QUEUE_LENGTH 32
+#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
+
+/* Optional functions - most linkers will remove unused functions anyway. */
+#define INCLUDE_vTaskPrioritySet 0
+#define INCLUDE_uxTaskPriorityGet 0
+#define INCLUDE_vTaskDelete 0
+#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
+#define INCLUDE_xResumeFromISR 0
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 0
+#define INCLUDE_xTaskGetCurrentTaskHandle 0
+#define INCLUDE_uxTaskGetStackHighWaterMark 0
+#define INCLUDE_xTaskGetIdleTaskHandle 0
+#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
+#define INCLUDE_pcTaskGetTaskName 0
+#define INCLUDE_eTaskGetState 0
+#define INCLUDE_xEventGroupSetBitFromISR 0
+#define INCLUDE_xTimerPendFunctionCall 0
+
+/* Define to trap errors during development. */
+// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7
+#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
+ #define configASSERT(_exp) \
+ do {\
+ if ( !(_exp) ) { \
+ volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
+ if ( (*ARM_CM_DHCSR) & 1UL ) { /* Only halt mcu if debugger is attached */ \
+ taskDISABLE_INTERRUPTS(); \
+ __asm("BKPT #0\n"); \
+ }\
+ }\
+ } while(0)
+#else
+ #define configASSERT( x )
+#endif
+
+/* FreeRTOS hooks to NVIC vectors */
+#define xPortPendSVHandler PendSV_Handler
+#define xPortSysTickHandler SysTick_Handler
+#define vPortSVCHandler SVC_Handler
+
+//--------------------------------------------------------------------+
+// Interrupt nesting behavior configuration.
+//--------------------------------------------------------------------+
+/* Cortex-M specific definitions. __NVIC_PRIO_BITS is defined in core_cmx.h */
+#ifdef __NVIC_PRIO_BITS
+ #define configPRIO_BITS __NVIC_PRIO_BITS
+#else
+ #error "This port requires __NVIC_PRIO_BITS to be defined"
+#endif
+
+/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
+
+/* The highest interrupt priority that can be used by any interrupt service
+routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
+PRIORITY THAN THIS! (higher priorities are lower numeric values. */
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
+
+/* Interrupt priorities used by the kernel port layer itself. These are generic
+to all Cortex-M ports, and do not rely on any particular library functions. */
+#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
+See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+#endif /* __FREERTOS_CONFIG__H */
diff --git a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c b/examples/device/cdc_msc_freertos/src/freertos_hook.c
index 474e808a9..474e808a9 100644
--- a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c
+++ b/examples/device/cdc_msc_freertos/src/freertos_hook.c
diff --git a/examples/device/cdc_msc_hid_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index cb707675d..704d0803b 100644
--- a/examples/device/cdc_msc_hid_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -36,8 +36,6 @@
#include "bsp/board.h"
#include "tusb.h"
-#include "usb_descriptors.h"
-
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+
@@ -53,12 +51,24 @@ enum {
BLINK_SUSPENDED = 2500,
};
+// static timer
+StaticTimer_t static_blink;
TimerHandle_t blink_tm;
+// static task for usbd
+#define USBD_STACK_SIZE 150
+StackType_t stack_usbd[USBD_STACK_SIZE];
+StaticTask_t static_task_usbd;
+
+// static task for cdc
+#define CDC_STACK_SZIE 128
+StackType_t stack_cdc[CDC_STACK_SZIE];
+StaticTask_t static_task_cdc;
+
+
void led_blinky_cb(TimerHandle_t xTimer);
void usb_device_task(void* param);
void cdc_task(void* params);
-void hid_task(void* params);
/*------------- MAIN -------------*/
int main(void)
@@ -66,21 +76,17 @@ int main(void)
board_init();
// soft timer for blinky
- blink_tm = xTimerCreate(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb);
+ blink_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &static_blink);
xTimerStart(blink_tm, 0);
tusb_init();
// Create a task for tinyusb device stack
- xTaskCreate( usb_device_task, "usbd", 150, NULL, configMAX_PRIORITIES-1, NULL);
+ (void) xTaskCreateStatic( usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES-1, stack_usbd, &static_task_usbd);
// Create task
#if CFG_TUD_CDC
- xTaskCreate( cdc_task, "cdc", 128, NULL, configMAX_PRIORITIES-2, NULL);
-#endif
-
-#if CFG_TUD_HID
- xTaskCreate( hid_task, "hid", 128, NULL, configMAX_PRIORITIES-2, NULL);
+ (void) xTaskCreateStatic( cdc_task, "cdc", CDC_STACK_SZIE, NULL, configMAX_PRIORITIES-2, stack_cdc, &static_task_cdc);
#endif
vTaskStartScheduler();
@@ -134,6 +140,7 @@ void tud_resume_cb(void)
xTimerChangePeriod(blink_tm, pdMS_TO_TICKS(BLINK_MOUNTED), 0);
}
+
//--------------------------------------------------------------------+
// USB CDC
//--------------------------------------------------------------------+
@@ -189,97 +196,7 @@ void tud_cdc_rx_cb(uint8_t itf)
(void) itf;
}
-#endif
-
-//--------------------------------------------------------------------+
-// USB HID
-//--------------------------------------------------------------------+
-#if CFG_TUD_HID
-
-void hid_task(void* params)
-{
- (void) params;
-
- while (1)
- {
- // Poll every 10ms
- vTaskDelay(pdMS_TO_TICKS(10));
-
- uint32_t const btn = board_button_read();
-
- // Remote wakeup
- if ( tud_suspended() && btn )
- {
- // Wake up host if we are in suspend mode
- // and REMOTE_WAKEUP feature is enabled by host
- tud_remote_wakeup();
- }
-
- /*------------- Mouse -------------*/
- if ( tud_hid_ready() )
- {
- if ( btn )
- {
- int8_t const delta = 5;
-
- // no button, right + down, no scroll pan
- tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta, delta, 0, 0);
-
- // delay a bit before attempt to send keyboard report
- vTaskDelay(pdMS_TO_TICKS(2));
- }
- }
-
- /*------------- Keyboard -------------*/
- if ( tud_hid_ready() )
- {
- // use to avoid send multiple consecutive zero report for keyboard
- static bool has_key = false;
-
- if ( btn )
- {
- uint8_t keycode[6] = { 0 };
- keycode[0] = HID_KEY_A;
-
- tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, keycode);
-
- has_key = true;
- }else
- {
- // send empty key report if previously has key pressed
- if (has_key) tud_hid_keyboard_report(REPORT_ID_KEYBOARD, 0, NULL);
- has_key = false;
- }
- }
- }
-}
-
-// Invoked when received GET_REPORT control request
-// Application must fill buffer report's content and return its length.
-// Return zero will cause the stack to STALL request
-uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
-{
- // TODO not Implemented
- (void) report_id;
- (void) report_type;
- (void) buffer;
- (void) reqlen;
-
- return 0;
-}
-
-// Invoked when received SET_REPORT control request or
-// received data on OUT endpoint ( Report ID = 0, Type = 0 )
-void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
-{
- // TODO not Implemented
- (void) report_id;
- (void) report_type;
- (void) buffer;
- (void) bufsize;
-}
-
-#endif
+#endif // CFG_TUD_CDC
//--------------------------------------------------------------------+
// BLINKING TASK
diff --git a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c b/examples/device/cdc_msc_freertos/src/msc_disk.c
index b4986fbb7..5aa7befc9 100644
--- a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_freertos/src/msc_disk.c
@@ -220,18 +220,6 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
resplen = 0;
break;
- case SCSI_CMD_START_STOP_UNIT:
- // Host try to eject/safe remove/poweroff us. We could safely disconnect with disk storage, or go into lower power
- /* scsi_start_stop_unit_t const * start_stop = (scsi_start_stop_unit_t const *) scsi_cmd;
- // Start bit = 0 : low power mode, if load_eject = 1 : unmount disk storage as well
- // Start bit = 1 : Ready mode, if load_eject = 1 : mount disk storage
- start_stop->start;
- start_stop->load_eject;
- */
- resplen = 0;
- break;
-
-
default:
// Set Sense = Invalid Command Operation
tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
diff --git a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h b/examples/device/cdc_msc_freertos/src/tusb_config.h
index 39738333c..525019aaa 100644
--- a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h
+++ b/examples/device/cdc_msc_freertos/src/tusb_config.h
@@ -76,7 +76,7 @@
//------------- CLASS -------------//
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
-#define CFG_TUD_HID 1
+#define CFG_TUD_HID 0
#define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0
diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
index 84939e2d7..127008227 100644
--- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c
+++ b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
@@ -24,7 +24,6 @@
*/
#include "tusb.h"
-#include "usb_descriptors.h"
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
@@ -45,17 +44,11 @@ tusb_desc_device_t const desc_device =
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
- #if CFG_TUD_CDC
// Use Interface Association Descriptor (IAD) for CDC
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
- #else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- #endif
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
@@ -78,83 +71,62 @@ uint8_t const * tud_descriptor_device_cb(void)
}
//--------------------------------------------------------------------+
-// HID Report Descriptor
-//--------------------------------------------------------------------+
-#if CFG_TUD_HID
-
-uint8_t const desc_hid_report[] =
-{
- TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD), ),
- TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE), )
-};
-
-// Invoked when received GET HID REPORT DESCRIPTOR
-// Application return pointer to descriptor
-// Descriptor contents must exist long enough for transfer to complete
-uint8_t const * tud_hid_descriptor_report_cb(void)
-{
- return desc_hid_report;
-}
-
-#endif
-
-//--------------------------------------------------------------------+
// Configuration Descriptor
//--------------------------------------------------------------------+
enum
{
-#if CFG_TUD_CDC
ITF_NUM_CDC = 0,
ITF_NUM_CDC_DATA,
-#endif
-
-#if CFG_TUD_MSC
ITF_NUM_MSC,
-#endif
-
-#if CFG_TUD_HID
- ITF_NUM_HID,
-#endif
-
ITF_NUM_TOTAL
};
-#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC*TUD_CDC_DESC_LEN + CFG_TUD_MSC*TUD_MSC_DESC_LEN + CFG_TUD_HID*TUD_HID_DESC_LEN)
+#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN)
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
- // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
- // Note: since CDC EP ( 1 & 2), HID (4) are spot-on, thus we only need to force
- // endpoint number for MSC to 5
- #define EPNUM_MSC 0x05
+ // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In, 5 Bulk etc ...
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x05
+ #define EPNUM_MSC_IN 0x85
+
+#elif CFG_TUSB_MCU == OPT_MCU_SAMG
+ // SAMG doesn't support a same endpoint number with different direction IN and OUT
+ // e.g EP1 OUT & EP1 IN cannot exist together
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x83
+
+ #define EPNUM_MSC_OUT 0x04
+ #define EPNUM_MSC_IN 0x85
+
#else
- #define EPNUM_MSC 0x03
+ #define EPNUM_CDC_NOTIF 0x81
+ #define EPNUM_CDC_OUT 0x02
+ #define EPNUM_CDC_IN 0x82
+
+ #define EPNUM_MSC_OUT 0x03
+ #define EPNUM_MSC_IN 0x83
+
#endif
uint8_t const desc_configuration[] =
{
- // interface count, string index, total length, attribute, power in mA
+ // Interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
-#if CFG_TUD_CDC
// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
- TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, 0x81, 8, 0x02, 0x82, 64),
-#endif
+ TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF, 8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64),
-#if CFG_TUD_MSC
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512
-#endif
-
-#if CFG_TUD_HID
- // Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval
- TUD_HID_DESCRIPTOR(ITF_NUM_HID, 6, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x84, 16, 10)
-#endif
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
};
-
// Invoked when received GET CONFIGURATION DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
@@ -177,7 +149,6 @@ char const* string_desc_arr [] =
"123456", // 3: Serials, should use chip ID
"TinyUSB CDC", // 4: CDC Interface
"TinyUSB MSC", // 5: MSC Interface
- "TinyUSB HID" // 6: HID
};
static uint16_t _desc_str[32];
diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h b/examples/device/cdc_msc_freertos/src/usb_descriptors.h
index 6992d3349..6992d3349 100644
--- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.h
+++ b/examples/device/cdc_msc_freertos/src/usb_descriptors.h
diff --git a/examples/device/cdc_msc_hid_freertos/Makefile b/examples/device/cdc_msc_hid_freertos/Makefile
deleted file mode 100644
index 7401f355a..000000000
--- a/examples/device/cdc_msc_hid_freertos/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-include ../../../tools/top.mk
-include ../../make.mk
-
-INC += \
- src \
- $(TOP)/hw \
- $(TOP)/lib/FreeRTOS/Source/include \
- $(TOP)/lib/FreeRTOS/Source/portable/GCC/$(FREERTOS_PORT)
-
-# Example source
-EXAMPLE_SOURCE += $(wildcard src/*.c)
-SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-
-# FreeRTOS source
-SRC_C += \
- lib/FreeRTOS/Source/list.c \
- lib/FreeRTOS/Source/queue.c \
- lib/FreeRTOS/Source/tasks.c \
- lib/FreeRTOS/Source/timers.c \
- lib/FreeRTOS/Source/portable/MemMang/heap_4.c \
- lib/FreeRTOS/Source/portable/GCC/$(FREERTOS_PORT)/port.c \
-
-# FreeRTOS (lto + Os) linker issue
-LDFLAGS += -Wl,--undefined=vTaskSwitchContext
-
-include ../../rules.mk