uart_select.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _UART_SELECT_H_
  14. #define _UART_SELECT_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "driver/uart.h"
  19. typedef enum {
  20. UART_SELECT_READ_NOTIF,
  21. UART_SELECT_WRITE_NOTIF,
  22. UART_SELECT_ERROR_NOTIF,
  23. } uart_select_notif_t;
  24. typedef void (*uart_select_notif_callback_t)(uart_port_t uart_num, uart_select_notif_t uart_select_notif, BaseType_t *task_woken);
  25. /**
  26. * @brief Set notification callback function for select() events
  27. * @param uart_num UART port number
  28. * @param uart_select_notif_callback callback function
  29. */
  30. void uart_set_select_notif_callback(uart_port_t uart_num, uart_select_notif_callback_t uart_select_notif_callback);
  31. /**
  32. * @brief Get mutex guarding select() notifications
  33. */
  34. portMUX_TYPE *uart_get_selectlock(void);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif //_UART_SELECT_H_