summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2020-04-29 15:27:25 +0700
committerGitHub <[email protected]>2020-04-29 15:27:25 +0700
commite9c71055acf35861ae9b13fe8e018ea16ea9246c (patch)
tree3231ce339b7172b2a2b21e29a4ddaafca86b35db
parentd4511186a2ce541ac0ddc46a04e5313e8bcbfb3b (diff)
parent449b337467d15a2000d2484fa73e63605881376a (diff)
Merge pull request #386 from hathach/follow-383
Follow 383
-rw-r--r--examples/device/board_test/sdkconfig.defaults2
-rw-r--r--examples/device/cdc_msc_freertos/sdkconfig.defaults1
-rw-r--r--examples/device/hid_composite_freertos/sdkconfig.defaults1
-rw-r--r--hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c4
-rw-r--r--src/device/usbd.c17
5 files changed, 18 insertions, 7 deletions
diff --git a/examples/device/board_test/sdkconfig.defaults b/examples/device/board_test/sdkconfig.defaults
index 34991d70c..cede66031 100644
--- a/examples/device/board_test/sdkconfig.defaults
+++ b/examples/device/board_test/sdkconfig.defaults
@@ -1,4 +1,4 @@
CONFIG_IDF_CMAKE=y
CONFIG_IDF_TARGET="esp32s2"
CONFIG_IDF_TARGET_ESP32S2=y
-
+CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
diff --git a/examples/device/cdc_msc_freertos/sdkconfig.defaults b/examples/device/cdc_msc_freertos/sdkconfig.defaults
index 23de48ebd..3253f605c 100644
--- a/examples/device/cdc_msc_freertos/sdkconfig.defaults
+++ b/examples/device/cdc_msc_freertos/sdkconfig.defaults
@@ -2,3 +2,4 @@ CONFIG_IDF_CMAKE=y
CONFIG_IDF_TARGET="esp32s2"
CONFIG_IDF_TARGET_ESP32S2=y
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
+CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
diff --git a/examples/device/hid_composite_freertos/sdkconfig.defaults b/examples/device/hid_composite_freertos/sdkconfig.defaults
index 23de48ebd..3253f605c 100644
--- a/examples/device/hid_composite_freertos/sdkconfig.defaults
+++ b/examples/device/hid_composite_freertos/sdkconfig.defaults
@@ -2,3 +2,4 @@ CONFIG_IDF_CMAKE=y
CONFIG_IDF_TARGET="esp32s2"
CONFIG_IDF_TARGET_ESP32S2=y
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
+CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
diff --git a/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
index 8515e10e2..ef70f1ee2 100644
--- a/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
+++ b/hw/bsp/esp32s2_saola_1/esp32s2_saola_1.c
@@ -37,8 +37,8 @@
// Note: On the production version (v1.2) WS2812 is connected to GPIO 18,
// however earlier revision v1.1 WS2812 is connected to GPIO 17
-#define LED_PIN 18 // v1.2 and later
-//#define LED_PIN 17 // v1.1
+//#define LED_PIN 18 // v1.2 and later
+#define LED_PIN 17 // v1.1
#define BUTTON_PIN 0
#define BUTTON_STATE_ACTIVE 0
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 62133bdb8..06e724cb3 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -995,12 +995,21 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
TU_LOG2(" Queue EP %02X with %u bytes ... ", ep_addr, total_bytes);
+ // Set busy first since the actual transfer can be complete before dcd_edpt_xfer() could return
+ // and usbd task can preempt and clear the busy
_usbd_dev.ep_status[epnum][dir].busy = true;
- TU_VERIFY_HDLR( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes), _usbd_dev.ep_status[epnum][dir].busy = false);
- TU_LOG2("OK\r\n");
-
- return true;
+ if ( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes) )
+ {
+ TU_LOG2("OK\r\n");
+ return true;
+ }else
+ {
+ _usbd_dev.ep_status[epnum][dir].busy = false;
+ TU_LOG2("failed\r\n");
+ TU_BREAKPOINT();
+ return false;
+ }
}
bool usbd_edpt_busy(uint8_t rhport, uint8_t ep_addr)