This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 71c5e2e  tinyusb: Allow tinyusb task without scheduling
71c5e2e is described below

commit 71c5e2e47ddb6fa21c7e4644ed4eaa46ca7e5928
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Thu Nov 25 09:59:47 2021 +0100

    tinyusb: Allow tinyusb task without scheduling
    
    Function tinyusb_start creates task.
    For running TinyUSB stack in bootloader task creation is
    not needed.
    
    Now tinyusb stack can be run without scheduling in DFU mode.
---
 hw/usb/tinyusb/pkg.yml       | 2 +-
 hw/usb/tinyusb/src/tinyusb.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/usb/tinyusb/pkg.yml b/hw/usb/tinyusb/pkg.yml
index 7dd7b7c..5e33402 100644
--- a/hw/usb/tinyusb/pkg.yml
+++ b/hw/usb/tinyusb/pkg.yml
@@ -33,7 +33,7 @@ pkg.deps:
     - "@apache-mynewt-core/kernel/os"
     - "@tinyusb/tinyusb"
 
-pkg.init:
+pkg.init.OS_SCHEDULING:
     tinyusb_start: 'MYNEWT_VAL(USBD_SYSINIT_STAGE)'
 
 pkg.deps.USBD_STD_DESCRIPTORS:
diff --git a/hw/usb/tinyusb/src/tinyusb.c b/hw/usb/tinyusb/src/tinyusb.c
index a05a135..d61bbbb 100755
--- a/hw/usb/tinyusb/src/tinyusb.c
+++ b/hw/usb/tinyusb/src/tinyusb.c
@@ -28,8 +28,10 @@
 #define USBD_STACK_SIZE     MYNEWT_VAL(USBD_STACK_SIZE)
 #define USBD_TASK_PRIORITY  MYNEWT_VAL(USBD_TASK_PRIORITY)
 
+#if MYNEWT_VAL(OS_SCHEDULING)
 static struct os_task usbd_task;
 static os_stack_t usbd_stack[OS_STACK_ALIGN(USBD_STACK_SIZE)];
+#endif
 
 /**
  * USB Device Driver task
@@ -59,7 +61,11 @@ tinyusb_start(void)
     /* USB stack initialization */
     tusb_init();
 
+#if MYNEWT_VAL(OS_SCHEDULING)
     /* Create a task for tinyusb device stack */
     os_task_init(&usbd_task, "usbd", tinyusb_device_task, NULL, 
USBD_TASK_PRIORITY,
                  OS_WAIT_FOREVER, usbd_stack, USBD_STACK_SIZE);
+#else
+    tinyusb_device_task(NULL);
+#endif
 }

Reply via email to