1 
2 /*
3  * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef _UART_SELECT_H_
9 #define _UART_SELECT_H_
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include "driver/uart.h"
16 
17 typedef enum {
18     UART_SELECT_READ_NOTIF,
19     UART_SELECT_WRITE_NOTIF,
20     UART_SELECT_ERROR_NOTIF,
21 } uart_select_notif_t;
22 
23 typedef void (*uart_select_notif_callback_t)(uart_port_t uart_num, uart_select_notif_t uart_select_notif, BaseType_t *task_woken);
24 
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 /**
33  * @brief Get mutex guarding select() notifications
34  */
35 portMUX_TYPE *uart_get_selectlock(void);
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif //_UART_SELECT_H_
42