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