summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-10-30 12:24:07 +0700
committerhathach <[email protected]>2019-10-30 12:24:07 +0700
commit16665672a45c4f85cb2e1a47873825f2b48fcf1a (patch)
treee3542b6fd0da123b0b98ddd555c09552bc67ede0
parent880ac1e39823f7e17416b882ff57b0899f2e85da (diff)
initally adding test_usbd.c
-rw-r--r--src/device/dcd.h2
-rw-r--r--test/project.yml5
-rw-r--r--test/test/support/tusb_config.h11
-rw-r--r--test/test/test_usbd.c68
4 files changed, 77 insertions, 9 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 444b4a6f9..9fa98c669 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -124,7 +124,7 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr);
//--------------------------------------------------------------------+
// Called by DCD to notify device stack
-void dcd_event_handler(dcd_event_t const * event, bool in_isr);
+extern void dcd_event_handler(dcd_event_t const * event, bool in_isr);
// helper to send bus signal event
static inline void dcd_event_bus_signal (uint8_t rhport, dcd_eventid_t eid, bool in_isr);
diff --git a/test/project.yml b/test/project.yml
index 403aa0119..cf29c3b04 100644
--- a/test/project.yml
+++ b/test/project.yml
@@ -9,6 +9,7 @@
:use_exceptions: TRUE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
+ :use_deep_dependencies: TRUE
:build_root: _build
# :release_build: TRUE
:test_file_prefix: test_
@@ -41,10 +42,10 @@
:commmon: &common_defines []
:test:
- *common_defines
- - TEST
+ - _TEST_
:test_preprocess:
- *common_defines
- - TEST
+ - _TEST_
:cmock:
:mock_prefix: mock_
diff --git a/test/test/support/tusb_config.h b/test/test/support/tusb_config.h
index b82a09a23..bfe5bf9e9 100644
--- a/test/test/support/tusb_config.h
+++ b/test/test/support/tusb_config.h
@@ -73,12 +73,11 @@
#define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------//
-#define CFG_TUD_CDC 1
-#define CFG_TUD_MSC 1
-#define CFG_TUD_HID 1
-
-#define CFG_TUD_MIDI 1
-#define CFG_TUD_VENDOR 1
+#define CFG_TUD_CDC 0
+#define CFG_TUD_MSC 0
+#define CFG_TUD_HID 0
+#define CFG_TUD_MIDI 0
+#define CFG_TUD_VENDOR 0
//------------- CDC -------------//
diff --git a/test/test/test_usbd.c b/test/test/test_usbd.c
new file mode 100644
index 000000000..8c29ee853
--- /dev/null
+++ b/test/test/test_usbd.c
@@ -0,0 +1,68 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 hathach for Adafruit Industries
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#include "unity.h"
+
+// Files to test
+#include "tusb_fifo.h"
+#include "tusb.h"
+#include "usbd.h"
+TEST_FILE("usbd_control.c")
+
+// Mock File
+#include "mock_dcd.h"
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM DECLARATION
+//--------------------------------------------------------------------+
+
+uint8_t const * tud_descriptor_device_cb(void)
+{
+ return NULL;
+}
+
+uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
+{
+ return NULL;
+}
+
+uint16_t const* tud_descriptor_string_cb(uint8_t index)
+{
+ return NULL;
+}
+
+//------------- IMPLEMENTATION -------------//
+void setUp(void)
+{
+
+}
+
+void tearDown(void)
+{
+}
+
+void test_ok(void)
+{
+
+}