pipe.h 712 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. */
  9. #ifndef PIPE_H__
  10. #define PIPE_H__
  11. #include <rtthread.h>
  12. /**
  13. * Pipe Device
  14. */
  15. struct rt_pipe_device
  16. {
  17. struct rt_device parent;
  18. rt_bool_t is_named;
  19. /* ring buffer in pipe device */
  20. struct rt_ringbuffer *fifo;
  21. rt_uint16_t bufsz;
  22. rt_uint8_t readers;
  23. rt_uint8_t writers;
  24. rt_wqueue_t reader_queue;
  25. rt_wqueue_t writer_queue;
  26. struct rt_mutex lock;
  27. };
  28. typedef struct rt_pipe_device rt_pipe_t;
  29. rt_pipe_t *rt_pipe_create(const char *name, int bufsz);
  30. int rt_pipe_delete(const char *name);
  31. #endif /* PIPE_H__ */