1
0

lwp_console.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-02-23 Jesven first version.
  9. */
  10. #ifndef LWP_CONSOLE_H__
  11. #define LWP_CONSOLE_H__
  12. #include <lwp.h>
  13. #include <rtthread.h>
  14. #include <rtdevice.h>
  15. #include <dfs_posix.h>
  16. #include <dfs_poll.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define RT_PROCESS_KERNEL RT_NULL
  21. struct rt_console_device
  22. {
  23. struct rt_device parent;
  24. int init_flag;
  25. struct rt_device *iodev;
  26. struct rt_lwp *foreground;
  27. struct rt_wqueue wait_queue; /* for kernel when current == 0 */
  28. struct rt_ringbuffer input_rb;
  29. rt_uint8_t input_buf[LWP_CONSOLE_INPUT_BUFFER_SIZE];
  30. };
  31. rt_err_t rt_console_register(const char *name, struct rt_device *iodev);
  32. struct rt_device *rt_console_set_iodev(struct rt_device *iodev);
  33. struct rt_device *rt_console_get_iodev(void);
  34. void rt_console_set_foreground(struct rt_lwp *lwp);
  35. struct rt_lwp* rt_console_get_foreground(void);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* LWP_CONSOLE_H__*/