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 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-12-17 22:33:53 +08:00 committed by CeDeROM
parent f94bccf119
commit 84d4fe0bfd
3 changed files with 10 additions and 2 deletions

View file

@ -28,7 +28,7 @@ config UORB_TESTS
config UORB_LOOP_MAX_EVENTS
int "uorb loop max events"
default 16
default 0
if UORB_TESTS

View file

@ -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

View file

@ -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
}