Move newly added uart function into peripheral_io_internal.h 59/289459/6
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 8 Mar 2023 02:00:12 +0000 (11:00 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 9 Mar 2023 02:07:51 +0000 (11:07 +0900)
The commit e14fc739d7de("uart: Add nonblocking IO and assorted functions")
added the new uart function into public header file to support uart
flush and drain operation.

But, after finished the release of Tizen 7.0, it is not permitted to add
the new public API. So that move newly added uart function
into peripheral_io_internal.h as internal function.

- List of moved functions
 : EXPORT_API int peripheral_uart_flush(peripheral_uart_h uart);
 : EXPORT_API int peripheral_uart_drain(peripheral_uart_h uart);

- List of moved enumeration
 : PERIPHERAL_OPEN_FLAGS_NONBLOCK

Change-Id: Ib322016249e857ae6fb01739088613edc7623728
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
CMakeLists.txt
include/peripheral_io.h
include/peripheral_io_internal.h [new file with mode: 0644]
packaging/capi-system-peripheral-io.spec
src/common.h
test/src/test_peripheral_uart.c

index b321988..693066f 100644 (file)
@@ -66,6 +66,7 @@ SET_TARGET_PROPERTIES(${fw_name}
 
 INSTALL(TARGETS ${fw_name} DESTINATION ${libdir})
 INSTALL(FILES ${INC_DIR}/peripheral_io.h DESTINATION include)
+INSTALL(FILES ${INC_DIR}/peripheral_io_internal.h DESTINATION include)
 
 SET(PC_NAME ${fw_name})
 SET(PC_REQUIRED ${pc_dependents})
index 1de9bc0..e5a17e8 100644 (file)
@@ -348,13 +348,10 @@ EXPORT_API int peripheral_i2c_open(int bus, int address, peripheral_i2c_h *i2c);
  * @remarks Enum values are supposed to be used as bitmask, where only one
  * value can be specified for following flag groups:
  * - locking mode - either #PERIPHERAL_OPEN_FLAGS_PRIVATE or #PERIPHERAL_OPEN_FLAGS_SHARED can be used
- *
- * The #PERIPHERAL_OPEN_FLAGS_NONBLOCK can be used with all other available flags.
  */
 typedef enum {
        PERIPHERAL_OPEN_FLAGS_PRIVATE = 0,          /**< Exclusive access to device */
        PERIPHERAL_OPEN_FLAGS_SHARED  = 1,          /**< Shared access to device */
-       PERIPHERAL_OPEN_FLAGS_NONBLOCK = 2,         /**< (Since 7.5) Nonblocking read/write flag */
 } peripheral_open_flags_e;
 
 /**
@@ -1093,49 +1090,6 @@ EXPORT_API int peripheral_uart_set_flow_control(peripheral_uart_h uart,
  */
 EXPORT_API int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length);
 
-
-/**
- * @platform
- * @brief Discards data queued for writing to UART slave device, but not yet transmitted.
- * @since_tizen 7.5
- * @privlevel platform
- * @privilege http://tizen.org/privilege/peripheralio
- *
- * @param[in] uart The UART handle
- *
- * @return #PERIPHERAL_ERROR_NONE on success, otherwise a negative error value
- * @retval #PERIPHERAL_ERROR_NONE Successful
- * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed
- * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again
- * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported
- * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error
- *
- */
-EXPORT_API int peripheral_uart_flush(peripheral_uart_h uart);
-
-/**
- * @platform
- * @brief Waits for all data queued for UART to be transmitted.
- * @since_tizen 7.5
- * @privlevel platform
- * @privilege http://tizen.org/privilege/peripheralio
- *
- * @param[in] uart The UART handle
- *
- * @return #PERIPHERAL_ERROR_NONE on success, otherwise a negative error value
- * @retval #PERIPHERAL_ERROR_NONE Successful
- * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed
- * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again
- * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied
- * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported
- * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error
- *
- */
-EXPORT_API int peripheral_uart_drain(peripheral_uart_h uart);
-
 /**
  * @platform
  * @brief Writes data to the UART slave device.
diff --git a/include/peripheral_io_internal.h b/include/peripheral_io_internal.h
new file mode 100644 (file)
index 0000000..10ec175
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_SYSTEM_PERIPHERAL_IO_INTERNAL_H__
+#define __TIZEN_SYSTEM_PERIPHERAL_IO_INTERNAL_H__
+
+#include "peripheral_io.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PERIPHERAL_OPEN_FLAGS_NONBLOCK 2       /**< (Since 7.0) Nonblocking read/write flag,
+                                                       available for only uart */
+
+/**
+ * @platform
+ * @brief Discards data queued for writing to UART slave device, but not yet transmitted.
+ * @since_tizen 7.0
+ * @privlevel platform
+ * @privilege http://tizen.org/privilege/peripheralio
+ *
+ * @param[in] uart The UART handle
+ *
+ * @return #PERIPHERAL_ERROR_NONE on success, otherwise a negative error value
+ * @retval #PERIPHERAL_ERROR_NONE Successful
+ * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed
+ * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again
+ * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported
+ * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error
+ *
+ */
+EXPORT_API int peripheral_uart_flush(peripheral_uart_h uart);
+
+/**
+ * @platform
+ * @brief Waits for all data queued for UART to be transmitted.
+ * @since_tizen 7.0
+ * @privlevel platform
+ * @privilege http://tizen.org/privilege/peripheralio
+ *
+ * @param[in] uart The UART handle
+ *
+ * @return #PERIPHERAL_ERROR_NONE on success, otherwise a negative error value
+ * @retval #PERIPHERAL_ERROR_NONE Successful
+ * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed
+ * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again
+ * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported
+ * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error
+ *
+ */
+EXPORT_API int peripheral_uart_drain(peripheral_uart_h uart);
+
+/**
+* @}
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_SYSTEM_PERIPHERAL_IO_INTERNAL_H__ */
index fd4cd35..8ff648b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-system-peripheral-io
 Summary:    Tizen Peripheral Input & Output library
-Version:    0.4.0
+Version:    0.4.1
 Release:    0
 Group:      System & System Tools
 License:    Apache-2.0
index 45a1a54..fc78b35 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "log.h"
 #include "peripheral_io.h"
+#include "peripheral_io_internal.h"
 
 #define MAX_ERR_LEN 255
 
index c813fec..7769019 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <peripheral_io.h>
+#include <peripheral_io_internal.h>
 #include "test_peripheral_uart.h"
 
 #define UART_PORT_RPI3 0