From: Segwon Date: Tue, 14 Nov 2017 03:43:07 +0000 (+0900) Subject: uart: remove unused interface function that peripheral_interface_uart_set_mode(). X-Git-Tag: submit/tizen_4.0/20171220.125806^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51613a796376575bd56788548453136486d7c1c5;p=platform%2Fcore%2Fapi%2Fperipheral-io.git uart: remove unused interface function that peripheral_interface_uart_set_mode(). Change-Id: I9e1c5a7326d65598e2ce326162abd9c5c0b4806e Signed-off-by: Segwon --- diff --git a/include/interface/peripheral_interface_uart.h b/include/interface/peripheral_interface_uart.h index f5273fe..c9a8c30 100644 --- a/include/interface/peripheral_interface_uart.h +++ b/include/interface/peripheral_interface_uart.h @@ -98,17 +98,6 @@ int peripheral_interface_uart_flush(peripheral_uart_h uart); */ int peripheral_interface_uart_set_baud_rate(peripheral_uart_h uart, uart_baud_rate_e baud); -/** -* @brief uart_set_mode() sets byte size, parity bit and stop bits. -* -* @param[in] file_hndl handle of uart_context -* @param[in] byte_size uart byte size -* @param[in] parity uart parity type (even/odd/none) -* @param[in] stop_bits uart stop bits -* @return On success, 0 is returned. On failure, a negative value is returned. -*/ -int peripheral_interface_uart_set_mode(peripheral_uart_h uart, uart_byte_size_e byte_size, uart_parity_e parity, uart_stop_bits_e stop_bits); - /** * @brief peripheral_bus_uart_set_byte_size() set byte size. * diff --git a/src/interface/peripheral_interface_uart.c b/src/interface/peripheral_interface_uart.c index 92fffce..c563fc6 100644 --- a/src/interface/peripheral_interface_uart.c +++ b/src/interface/peripheral_interface_uart.c @@ -147,78 +147,6 @@ int peripheral_interface_uart_set_baud_rate(peripheral_uart_h uart, uart_baud_ra return 0; } -int peripheral_interface_uart_set_mode(peripheral_uart_h uart, uart_byte_size_e byte_size, uart_parity_e parity, uart_stop_bits_e stop_bits) -{ - int ret; - struct termios tio; - - _D("file_hndl : %d, bytesize : %d, parity : %d, stopbits : %d", uart->fd, byte_size, parity, stop_bits); - - if (!uart->fd) { - _E("Invalid NULL parameter"); - return -EINVAL; - } - - if (byte_size > UART_BYTE_SIZE_8BIT) { - _E("Invalid bytesize parameter"); - return -EINVAL; - } - - ret = tcgetattr(uart->fd, &tio); - if (ret) { - char errmsg[MAX_ERR_LEN]; - strerror_r(errno, errmsg, MAX_ERR_LEN); - _E("tcgetattr failed, errmsg: %s", errmsg); - return -1; - } - - /* set byte size */ - tio.c_cflag &= ~CSIZE; - tio.c_cflag |= byteinfo[byte_size]; - tio.c_cflag |= (CLOCAL | CREAD); - - /* set parity info */ - switch (parity) { - case UART_PARITY_EVEN: - tio.c_cflag |= PARENB; - tio.c_cflag &= ~PARODD; - break; - case UART_PARITY_ODD: - tio.c_cflag |= PARENB; - tio.c_cflag |= PARODD; - break; - case UART_PARITY_NONE: - default: - tio.c_cflag &= ~PARENB; - tio.c_cflag &= ~PARODD; - break; - } - - /* set stop bit */ - switch (stop_bits) { - case UART_STOP_BITS_1BIT: - tio.c_cflag &= ~CSTOPB; - break; - case UART_STOP_BITS_2BIT: - tio.c_cflag |= CSTOPB; - break; - default: - _E("Invalid parameter stop_bits"); - return -EINVAL; - } - - peripheral_interface_uart_flush(uart); - ret = tcsetattr(uart->fd, TCSANOW, &tio); - if (ret) { - char errmsg[MAX_ERR_LEN]; - strerror_r(errno, errmsg, MAX_ERR_LEN); - _E("tcsetattr failed, errmsg : %s", errmsg); - return -1; - } - - return 0; -} - int peripheral_interface_uart_set_byte_size(peripheral_uart_h uart, uart_byte_size_e byte_size) { int ret;