summaryrefslogtreecommitdiff
path: root/ucoo/base
diff options
context:
space:
mode:
authorNicolas Schodet2016-07-25 15:18:40 +0200
committerNicolas Schodet2019-10-09 23:05:44 +0200
commit4695b47da68a5b2f75270bea21e15b8f1b9fd6ff (patch)
tree6e5ef4d34ee69bcd6c6627f25a0ca3aa902d47e3 /ucoo/base
parentd7df91926bdb529e68eff9a215aef72072803b6e (diff)
Switch to CMSIS
Diffstat (limited to 'ucoo/base')
-rw-r--r--ucoo/base/fs/romfs/test/Makefile2
-rw-r--r--ucoo/base/proto/test/Makefile2
-rw-r--r--ucoo/base/test/Config10
-rw-r--r--ucoo/base/test/test.stm32.cc31
-rw-r--r--ucoo/base/test/test/Makefile2
5 files changed, 32 insertions, 15 deletions
diff --git a/ucoo/base/fs/romfs/test/Makefile b/ucoo/base/fs/romfs/test/Makefile
index c4ec6bc..3a99d3d 100644
--- a/ucoo/base/fs/romfs/test/Makefile
+++ b/ucoo/base/fs/romfs/test/Makefile
@@ -4,7 +4,7 @@ TARGETS = host stm32f4
PROGS = test_romfs
test_romfs_SOURCES = test_romfs.cc
-MODULES = ucoo/base/test ucoo/base/fs/romfs ucoo/hal/usb
+MODULES = ucoo/base/test ucoo/base/fs/romfs ucoo/hal/usb ucoo/hal/gpio
COMPILE_DEPS = $(OBJDIR)/test_fs.h
EXTRA_CLEAN = $(OBJDIR)/test_fs.h
diff --git a/ucoo/base/proto/test/Makefile b/ucoo/base/proto/test/Makefile
index 8c093f0..40469ac 100644
--- a/ucoo/base/proto/test/Makefile
+++ b/ucoo/base/proto/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = host stm32f4
PROGS = test_proto
test_proto_SOURCES = test_proto.cc
-MODULES = ucoo/base/proto ucoo/base/test ucoo/hal/usb
+MODULES = ucoo/base/proto ucoo/base/test ucoo/hal/usb ucoo/hal/gpio
include $(BASE)/build/top.mk
diff --git a/ucoo/base/test/Config b/ucoo/base/test/Config
index 703bbee..e7ec1b9 100644
--- a/ucoo/base/test/Config
+++ b/ucoo/base/test/Config
@@ -1,9 +1,13 @@
[ucoo/base/test]
+# Before test startup, wait for a key to be pressed.
wait = false
-test_stream_uart = -1
+# Use USB or UART as test stream?
+test_stream_use_usb = true
+test_stream_uart_instance = Uart::Instance::USART1
test_stream_uart_speed = 115200
-test_stream_vendor = "APBTeam"
-test_stream_product = "test"
+test_stream_usb_instance = UsbDriverDwcOtg::Instance::OTG_FS
+test_stream_usb_vendor = u"APBTeam"
+test_stream_usb_product = u"test"
[ucoo/base/test:stm32]
wait = true
diff --git a/ucoo/base/test/test.stm32.cc b/ucoo/base/test/test.stm32.cc
index cb47db3..3d7a9fa 100644
--- a/ucoo/base/test/test.stm32.cc
+++ b/ucoo/base/test/test.stm32.cc
@@ -24,8 +24,9 @@
#include "test.hh"
#include "config/ucoo/base/test.hh"
-#if CONFIG_UCOO_BASE_TEST_TEST_STREAM_UART == -1
+#if CONFIG_UCOO_BASE_TEST_TEST_STREAM_USE_USB
# include "ucoo/hal/usb/usb.hh"
+# include "ucoo/hal/usb/usb_cdc.hh"
#else
# include "ucoo/hal/uart/uart.hh"
#endif
@@ -37,15 +38,27 @@ namespace ucoo {
Stream &
test_stream (void)
{
-#if CONFIG_UCOO_BASE_TEST_TEST_STREAM_UART == -1
- static UsbStreamControl usc (CONFIG_UCOO_BASE_TEST_TEST_STREAM_VENDOR,
- CONFIG_UCOO_BASE_TEST_TEST_STREAM_PRODUCT);
- static UsbStream us (usc, 0);
- usc.enable ();
- return us;
-#else
- static Uart u (CONFIG_UCOO_BASE_TEST_TEST_STREAM_UART);
static bool enabled = false;
+#if CONFIG_UCOO_BASE_TEST_TEST_STREAM_USE_USB
+ static const auto string_descs_pack = usb_descs_pack (
+ usb_string_desc (USB_LANGUAGE_EN_US),
+ usb_string_desc (CONFIG_UCOO_BASE_TEST_TEST_STREAM_USB_VENDOR),
+ usb_string_desc (CONFIG_UCOO_BASE_TEST_TEST_STREAM_USB_PRODUCT));
+ static const auto string_descs = ucoo::usb_descs (string_descs_pack);
+ static UsbDriverDwcOtg driver (
+ CONFIG_UCOO_BASE_TEST_TEST_STREAM_USB_INSTANCE,
+ usb_cdc_default_device_desc (),
+ usb_cdc_default_configuration_desc (),
+ string_descs);
+ static UsbApplicationCdcAcm cdc (driver);
+ if (!enabled)
+ {
+ enabled = true;
+ driver.enable ();
+ }
+ return cdc;
+#else
+ static Uart u (CONFIG_UCOO_BASE_TEST_TEST_STREAM_UART_INSTANCE);
if (!enabled)
{
enabled = true;
diff --git a/ucoo/base/test/test/Makefile b/ucoo/base/test/test/Makefile
index 64e5021..b4293ec 100644
--- a/ucoo/base/test/test/Makefile
+++ b/ucoo/base/test/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = host stm32f4
PROGS = test_test
test_test_SOURCES = test_test.cc
-MODULES = ucoo/utils ucoo/base/test ucoo/hal/usb
+MODULES = ucoo/utils ucoo/base/test ucoo/hal/usb ucoo/hal/gpio
include $(BASE)/build/top.mk