From 97c5e37453f27d3659893c9abb2a820b6bd48877 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sat, 4 May 2024 15:49:54 +0800 Subject: [PATCH] add check for rtt config --- SConscript | 3 +- osal/usb_osal_rtthread.c | 4 --- third_party/rt-thread-5.0/usb_check.c | 51 +++++++++++++++++++++++++++ third_party/rt-thread-5.0/usb_msh.c | 4 --- 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 third_party/rt-thread-5.0/usb_check.c diff --git a/SConscript b/SConscript index 9cd1750c..8e90b776 100644 --- a/SConscript +++ b/SConscript @@ -185,11 +185,12 @@ if GetDepend(['PKG_CHERRYUSB_HOST']): if GetDepend(['PKG_CHERRYUSB_HOST_TEMPLATE']): src += Glob('demo/usb_host.c') - + if GetDepend('RT_USING_DFS'): src += Glob('third_party/rt-thread-5.0/dfs_usbh_msc.c') src += Glob('third_party/rt-thread-5.0/usb_msh.c') +src += Glob('third_party/rt-thread-5.0/usb_check.c') group = DefineGroup('CherryUSB', src, depend = ['PKG_USING_CHERRYUSB'], CPPPATH = path, CPPDEFINES = CPPDEFINES) diff --git a/osal/usb_osal_rtthread.c b/osal/usb_osal_rtthread.c index 830159d7..18b66a49 100644 --- a/osal/usb_osal_rtthread.c +++ b/osal/usb_osal_rtthread.c @@ -8,10 +8,6 @@ #include #include -#ifndef RT_USING_TIMER_SOFT -#error must enable RT_USING_TIMER_SOFT to support timer callback in thread -#endif - usb_osal_thread_t usb_osal_thread_create(const char *name, uint32_t stack_size, uint32_t prio, usb_thread_entry_t entry, void *args) { rt_thread_t htask; diff --git a/third_party/rt-thread-5.0/usb_check.c b/third_party/rt-thread-5.0/usb_check.c new file mode 100644 index 00000000..247c0ad2 --- /dev/null +++ b/third_party/rt-thread-5.0/usb_check.c @@ -0,0 +1,51 @@ +#include "rtthread.h" + +#ifdef PKG_CHERRYUSB_HOST + +#ifndef RT_USING_TIMER_SOFT +#error must enable RT_USING_TIMER_SOFT to support timer callback in thread +#endif + +#if IDLE_THREAD_STACK_SIZE < 2048 +#error "IDLE_THREAD_STACK_SIZE must be greater than 2048" +#endif + +#if RT_TIMER_THREAD_STACK_SIZE < 2048 +#error "RT_TIMER_THREAD_STACK_SIZE must be greater than 2048" +#endif + +#ifdef RT_USING_LWIP + +#include "lwip/opt.h" + +#ifndef RT_USING_LWIP212 +#error must enable RT_USING_LWIP212 +#endif + +#ifndef LWIP_NO_RX_THREAD +#error must enable LWIP_NO_RX_THREAD, we do not use rtthread eth thread +#endif + +#ifndef LWIP_NO_TX_THREAD +#error must enable LWIP_NO_TX_THREAD, we do not use rtthread eth thread +#endif + +#ifndef LWIP_NO_TX_THREAD +#error must enable LWIP_NO_TX_THREAD, we do not use rtthread eth thread +#endif + +#ifndef LWIP_TCPIP_CORE_LOCKING_INPUT +#error must set LWIP_TCPIP_CORE_LOCKING_INPUT to 1, usb handle eth input with own thread +#endif + +#ifndef LWIP_TCPIP_CORE_LOCKING +#error must set LWIP_TCPIP_CORE_LOCKING to 1 +#endif + +#if PBUF_POOL_BUFSIZE < 1514 +#error PBUF_POOL_BUFSIZE must be larger than 1514 +#endif + +#endif + +#endif \ No newline at end of file diff --git a/third_party/rt-thread-5.0/usb_msh.c b/third_party/rt-thread-5.0/usb_msh.c index 5b127cee..db04e059 100644 --- a/third_party/rt-thread-5.0/usb_msh.c +++ b/third_party/rt-thread-5.0/usb_msh.c @@ -7,10 +7,6 @@ #ifdef PKG_CHERRYUSB_HOST -#if IDLE_THREAD_STACK_SIZE < 2048 -#error "IDLE_THREAD_STACK_SIZE must be greater than 2048" -#endif - #include "usbh_core.h" int usbh_init(int argc, char **argv)