serial_dm.h 831 B

1234567891011121314151617181920212223242526272829
  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. #ifndef __SERIAL_DM_H__
  11. #define __SERIAL_DM_H__
  12. #include <rtthread.h>
  13. #include <rtdevice.h>
  14. #include <posix/string.h>
  15. int serial_dev_set_name(struct rt_serial_device *sdev);
  16. void *serial_base_from_args(char *str);
  17. struct serial_configure serial_cfg_from_args(char *str);
  18. #define serial_for_each_args(arg, args) \
  19. for (char *context = (arg = (typeof(arg))args, (void *)RT_NULL), \
  20. *context_end = strchrnul((char *)args, ' '); \
  21. (arg = strtok_r(arg, ",", &context)) && arg < context_end; \
  22. arg = RT_NULL)
  23. #endif /* __SERIAL_DM_H__ */