uart_select.h 933 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef _UART_SELECT_H_
  7. #define _UART_SELECT_H_
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #include "driver/uart.h"
  12. typedef enum {
  13. UART_SELECT_READ_NOTIF,
  14. UART_SELECT_WRITE_NOTIF,
  15. UART_SELECT_ERROR_NOTIF,
  16. } uart_select_notif_t;
  17. typedef void (*uart_select_notif_callback_t)(uart_port_t uart_num, uart_select_notif_t uart_select_notif, BaseType_t *task_woken);
  18. /**
  19. * @brief Set notification callback function for select() events
  20. * @param uart_num UART port number
  21. * @param uart_select_notif_callback callback function
  22. */
  23. void uart_set_select_notif_callback(uart_port_t uart_num, uart_select_notif_callback_t uart_select_notif_callback);
  24. /**
  25. * @brief Get mutex guarding select() notifications
  26. */
  27. portMUX_TYPE *uart_get_selectlock(void);
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #endif //_UART_SELECT_H_