Tizen RT Public API  v1.0 D5
iotbus_uart.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
31 #include <stdint.h>
32 
33 #ifndef IOTBUS_UART_H_
34 #define IOTBUS_UART_H_
35 
44 typedef enum {
45  IOTBUS_UART_PARITY_NONE = 0, IOTBUS_UART_PARITY_EVEN, IOTBUS_UART_PARITY_ODD,
47 
48 struct _iotbus_uart_s;
49 
53 typedef struct _iotbus_uart_s *iotbus_uart_context_h;
54 
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
67 iotbus_uart_context_h iotbus_uart_init(const char *path);
68 
77 
86 
95 int iotbus_uart_set_baudrate(iotbus_uart_context_h hnd, unsigned int baud);
96 
107 int iotbus_uart_set_mode(iotbus_uart_context_h hnd, int bytesize, iotbus_uart_parity_e parity, int stopbits);
108 
118 int iotbus_uart_set_flowcontrol(iotbus_uart_context_h hnd, int xonxoff, int rtscts);
119 
129 int iotbus_uart_read(iotbus_uart_context_h hnd, char *buf, unsigned int length);
130 
140 int iotbus_uart_write(iotbus_uart_context_h hnd, const char *buf, unsigned int length);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* IOTBUS_UART_H_ */
147  // end of UART group
int iotbus_uart_stop(iotbus_uart_context_h hnd)
closes uart_context.
int iotbus_uart_set_baudrate(iotbus_uart_context_h hnd, unsigned int baud)
sets uart baud rate.
iotbus_uart_parity_e
Enumeration of UART parity type.
Definition: iotbus_uart.h:44
int iotbus_uart_write(iotbus_uart_context_h hnd, const char *buf, unsigned int length)
writes data over uart bus.
struct _iotbus_uart_s * iotbus_uart_context_h
Pointer definition to the internal struct _iotbus_uart_s.
Definition: iotbus_uart.h:53
int iotbus_uart_set_flowcontrol(iotbus_uart_context_h hnd, int xonxoff, int rtscts)
set flow control settings.
int iotbus_uart_read(iotbus_uart_context_h hnd, char *buf, unsigned int length)
reads data over uart bus.
int iotbus_uart_flush(iotbus_uart_context_h hnd)
flushes uart buffer.
int iotbus_uart_set_mode(iotbus_uart_context_h hnd, int bytesize, iotbus_uart_parity_e parity, int stopbits)
sets byte size, parity bit and stop bits.
iotbus_uart_context_h iotbus_uart_init(const char *path)
initializes uart_context.