1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-11-16     GuEe-GUI     first version
9  */
10 
11 #ifndef __SERIAL_DM_H__
12 #define __SERIAL_DM_H__
13 
14 #include <rtthread.h>
15 #include <rtdevice.h>
16 #include <posix/string.h>
17 
18 int serial_dev_set_name(struct rt_serial_device *sdev);
19 
20 void *serial_base_from_args(char *str);
21 struct serial_configure serial_cfg_from_args(char *str);
22 
23 #define serial_for_each_args(arg, args)                                 \
24     for (char *context = (arg = (typeof(arg))args, (void *)RT_NULL),    \
25         *context_end = strchrnul((char *)args, ' ');                    \
26          (arg = strtok_r(arg, ",", &context)) && arg < context_end;     \
27          arg = RT_NULL)
28 
29 #endif /* __SERIAL_DM_H__ */
30