From f2d6325b43ea1e390f034e03340b41662351b441 Mon Sep 17 00:00:00 2001 From: Shell Date: Fri, 17 May 2024 13:19:00 +0800 Subject: [smart] select console device dynamically (#8949) * [smart] select console device dynamically - Fixed compiler warning on terminal subsystem for `components/lwp/terminal/terminal.h` - Updated default console setup to dynamically select an appropriate tty device based on the configured console device name. Signed-off-by: Shell * fixup: remove useless codes --------- Signed-off-by: Shell --- include/rtdef.h | 9 +++++++++ include/rtthread.h | 1 + 2 files changed, 10 insertions(+) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index 06fcfcb8b8..f0918d5dd6 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -355,6 +355,15 @@ struct rt_object }; typedef struct rt_object *rt_object_t; /**< Type for kernel objects. */ +/** + * iterator of rt_object_for_each() + * + * data is the data passing in to rt_object_for_each(). iterator can return + * RT_EOK to continue the iteration; or any positive value to break the loop + * successfully; or any negative errno to break the loop on failure. + */ +typedef rt_err_t (*rt_object_iter_t)(rt_object_t object, void *data); + /** * The object type can be one of the follows with specific * macros enabled: diff --git a/include/rtthread.h b/include/rtthread.h index c2174cce42..1cad47931a 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -75,6 +75,7 @@ rt_err_t rt_custom_object_destroy(rt_object_t obj); #endif /* RT_USING_HEAP */ rt_bool_t rt_object_is_systemobject(rt_object_t object); rt_uint8_t rt_object_get_type(rt_object_t object); +rt_err_t rt_object_for_each(rt_uint8_t type, rt_object_iter_t iter, void *data); rt_object_t rt_object_find(const char *name, rt_uint8_t type); rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size); -- cgit v1.3.1