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

cederom pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 84d4fe0bfd5fb94ee5ebef1224b781629a0a6916
Author: dongjiuzhu1 <dongjiuz...@xiaomi.com>
AuthorDate: Tue Dec 17 22:33:53 2024 +0800

    system/uorb: using UORB_LOOP_MAX_EVENTS to config loop function
    
    Disable loop events by default (not compile loop.c and epoll.c).
    
    Signed-off-by: dongjiuzhu1 <dongjiuz...@xiaomi.com>
---
 system/uorb/Kconfig     | 2 +-
 system/uorb/Makefile    | 6 +++++-
 system/uorb/uORB/uORB.h | 4 ++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/system/uorb/Kconfig b/system/uorb/Kconfig
index 8457c1362..3d1d9cb5e 100644
--- a/system/uorb/Kconfig
+++ b/system/uorb/Kconfig
@@ -28,7 +28,7 @@ config UORB_TESTS
 
 config UORB_LOOP_MAX_EVENTS
        int "uorb loop max events"
-       default 16
+       default 0
 
 if UORB_TESTS
 
diff --git a/system/uorb/Makefile b/system/uorb/Makefile
index 3b3662208..800cd5cfb 100644
--- a/system/uorb/Makefile
+++ b/system/uorb/Makefile
@@ -22,9 +22,13 @@
 
 include $(APPDIR)/Make.defs
 
-CSRCS    += $(wildcard uORB/*.c)
+CSRCS    += uORB/uORB.c
 CSRCS    += $(wildcard sensor/*.c)
 
+ifneq ($(CONFIG_UORB_LOOP_MAX_EVENTS),0)
+CSRCS    += uORB/loop.c uORB/epoll.c
+endif
+
 ifneq ($(CONFIG_UORB_LISTENER),)
 MAINSRC  += listener.c
 PROGNAME += uorb_listener
diff --git a/system/uorb/uORB/uORB.h b/system/uorb/uORB/uORB.h
index 69cffd08a..b1aa15ef2 100644
--- a/system/uorb/uORB/uORB.h
+++ b/system/uorb/uORB/uORB.h
@@ -88,6 +88,7 @@ typedef CODE int (*orb_eventpri_cb_t)(FAR struct orb_handle_s 
*handle,
 typedef CODE int (*orb_eventerr_cb_t)(FAR struct orb_handle_s *handle,
                                       FAR void *arg);
 
+#if CONFIG_UORB_LOOP_MAX_EVENTS
 enum orb_loop_type_e
 {
   ORB_EPOLL_TYPE = 0,
@@ -111,6 +112,7 @@ struct orb_handle_s
   orb_eventpri_cb_t  eventpri_cb; /* User EPOLLPRI callback funtion. */
   orb_eventerr_cb_t  eventerr_cb; /* User EPOLLERR callback funtion. */
 };
+#endif
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -896,6 +898,7 @@ int orb_fprintf(FAR FILE *stream, FAR const char *format,
                 FAR const void *data);
 #endif
 
+#if CONFIG_UORB_LOOP_MAX_EVENTS
 /****************************************************************************
  * Name: orb_loop_init
  *
@@ -1003,6 +1006,7 @@ int orb_handle_start(FAR struct orb_loop_s *loop,
 
 int orb_handle_stop(FAR struct orb_loop_s *loop,
                     FAR struct orb_handle_s *handle);
+#endif
 
 #ifdef __cplusplus
 }

Reply via email to