utc: added the local utc module. 77/157877/2
authorSegwon <segwon.han@samsung.com>
Thu, 26 Oct 2017 15:01:36 +0000 (00:01 +0900)
committerSegwon <segwon.han@samsung.com>
Fri, 27 Oct 2017 04:57:52 +0000 (13:57 +0900)
  - generated with the new 'capi-system-peripheral-io-test' rpm.

Signed-off-by: Segwon <segwon.han@samsung.com>
Change-Id: Ie0e310e0ee0b6a3ac1574181b4d41e34e458e3c2

14 files changed:
CMakeLists.txt
packaging/capi-system-peripheral-io.spec
test/CMakeLists.txt [new file with mode: 0644]
test/include/test_peripheral_gpio.h [new file with mode: 0644]
test/include/test_peripheral_i2c.h [new file with mode: 0644]
test/include/test_peripheral_pwm.h [new file with mode: 0644]
test/include/test_peripheral_spi.h [new file with mode: 0644]
test/include/test_peripheral_uart.h [new file with mode: 0644]
test/peripheral-io-test.c [new file with mode: 0644]
test/src/test_peripheral_gpio.c [new file with mode: 0644]
test/src/test_peripheral_i2c.c [new file with mode: 0644]
test/src/test_peripheral_pwm.c [new file with mode: 0644]
test/src/test_peripheral_spi.c [new file with mode: 0644]
test/src/test_peripheral_uart.c [new file with mode: 0644]

index c7ae260dc221ed14cd290fe3b83d5c5f99f75fe2..55ed4af04bc75a6abca4d7fcdeefb300ca20620d 100644 (file)
@@ -83,3 +83,5 @@ CONFIGURE_FILE(
        @ONLY
 )
 INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${libdir}/pkgconfig)
+
+ADD_SUBDIRECTORY(test)
index 2f105bc5ba049be2bd26305b740f58da47981267..4a062ee94382bd5bd8ce1ebf443cfce419481878 100644 (file)
@@ -28,6 +28,14 @@ Requires:   %{name} = %{version}-%{release}
 %description devel
 Tizen Peripheral Input & Output library (devel)
 
+%package test
+Summary:    Tizen Peripheral Input & Output Test Programs (test)
+Group:      System & System Tools/Testing
+Requires:   %{name} = %{version}-%{release}
+
+%description test
+Tizen Peripheral Input & Output Test Programs (test)
+
 %prep
 %setup -q
 cp %{SOURCE1} ./%{name}.manifest
@@ -55,3 +63,9 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %{_includedir}/*.h
 %{_libdir}/lib%{name}.so
 %{_libdir}/pkgconfig/%{name}.pc
+
+%files test
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/peripheral-io-test
+%license LICENSE.APLv2
\ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..48799da
--- /dev/null
@@ -0,0 +1,29 @@
+PROJECT(peripheral-io-test C)
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED capi-system-info)
+
+FOREACH(flag ${${fw_test}_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH()
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+SET(UTC_INCLUDE_DIR ./include)
+INCLUDE_DIRECTORIES(${UTC_INCLUDE_DIR})
+
+AUX_SOURCE_DIRECTORY(src test_sources)
+FOREACH(src ${test_sources})
+       SET(test_src ${test_src} ${src})
+ENDFOREACH()
+
+AUX_SOURCE_DIRECTORY(. sources)
+FOREACH(src ${sources})
+       GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+       ADD_EXECUTABLE(${src_name} ${src} ${test_src})
+       TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
+
+INSTALL(TARGETS peripheral-io-test RUNTIME DESTINATION bin/)
\ No newline at end of file
diff --git a/test/include/test_peripheral_gpio.h b/test/include/test_peripheral_gpio.h
new file mode 100644 (file)
index 0000000..dc747fb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017 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 __TEST_PERIPHERAL_GPIO_H__
+#define __TEST_PERIPHERAL_GPIO_H__
+
+int test_peripheral_io_gpio_initialize(char *model, bool feature);
+
+int test_peripheral_io_gpio_peripheral_gpio_open_p(void);
+int test_peripheral_io_gpio_peripheral_gpio_open_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_open_n2(void);
+int test_peripheral_io_gpio_peripheral_gpio_close_p(void);
+int test_peripheral_io_gpio_peripheral_gpio_close_n(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p1(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p2(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p3(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n2(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n3(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p1(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p2(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p3(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p4(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n2(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n3(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_p(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n2(void);
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p1(void);
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p2(void);
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_n(void);
+int test_peripheral_io_gpio_peripheral_gpio_read_p(void);
+int test_peripheral_io_gpio_peripheral_gpio_read_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_read_n2(void);
+int test_peripheral_io_gpio_peripheral_gpio_write_p(void);
+int test_peripheral_io_gpio_peripheral_gpio_write_n1(void);
+int test_peripheral_io_gpio_peripheral_gpio_write_n2(void);
+
+#endif /* __TEST_PERIPHERAL_GPIO_H__ */
\ No newline at end of file
diff --git a/test/include/test_peripheral_i2c.h b/test/include/test_peripheral_i2c.h
new file mode 100644 (file)
index 0000000..0c032ae
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017 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 __TEST_PERIPHERAL_I2C_H__
+#define __TEST_PERIPHERAL_I2C_H__
+
+int test_peripheral_io_i2c_initialize(char *model, bool feature);
+
+int test_peripheral_io_i2c_peripheral_i2c_open_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_open_n1(void);
+int test_peripheral_io_i2c_peripheral_i2c_open_n2(void);
+int test_peripheral_io_i2c_peripheral_i2c_open_n3(void);
+int test_peripheral_io_i2c_peripheral_i2c_close_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_close_n(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_n1(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_n2(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_n1(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_n2(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n1(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n2(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_register_byte_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_register_byte_n(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_n1(void);
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_n2(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_register_word_p(void);
+int test_peripheral_io_i2c_peripheral_i2c_write_register_word_n(void);
+
+#endif /* __TEST_PERIPHERAL_I2C_H__ */
\ No newline at end of file
diff --git a/test/include/test_peripheral_pwm.h b/test/include/test_peripheral_pwm.h
new file mode 100644 (file)
index 0000000..a7113e9
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017 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 __TEST_PERIPHERAL_PWM_H__
+#define __TEST_PERIPHERAL_PWM_H__
+
+int test_peripheral_io_pwm_initialize(char *model, bool feature);
+
+int test_peripheral_io_pwm_peripheral_pwm_open_p(void);
+int test_peripheral_io_pwm_peripheral_pwm_open_n1(void);
+int test_peripheral_io_pwm_peripheral_pwm_open_n2(void);
+int test_peripheral_io_pwm_peripheral_pwm_open_n3(void);
+int test_peripheral_io_pwm_peripheral_pwm_close_p(void);
+int test_peripheral_io_pwm_peripheral_pwm_close_n(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_period_p(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_period_n(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_p(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_n(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_p1(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_p2(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n1(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n2(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n3(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_p1(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_p2(void);
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_n(void);
+
+#endif /* __TEST_PERIPHERAL_PWM_H__ */
\ No newline at end of file
diff --git a/test/include/test_peripheral_spi.h b/test/include/test_peripheral_spi.h
new file mode 100644 (file)
index 0000000..c69826f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 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 __TEST_PERIPHERAL_SPI_H__
+#define __TEST_PERIPHERAL_SPI_H__
+
+int test_peripheral_io_spi_initialize(char *model, bool feature);
+
+int test_peripheral_io_spi_peripheral_spi_open_p(void);
+int test_peripheral_io_spi_peripheral_spi_open_n1(void);
+int test_peripheral_io_spi_peripheral_spi_open_n2(void);
+int test_peripheral_io_spi_peripheral_spi_open_n3(void);
+int test_peripheral_io_spi_peripheral_spi_close_p(void);
+int test_peripheral_io_spi_peripheral_spi_close_n(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_p1(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_p2(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_p3(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_p4(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_n1(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_n2(void);
+int test_peripheral_io_spi_peripheral_spi_set_mode_n3(void);
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_p1(void);
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_p2(void);
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n1(void);
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n2(void);
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n3(void);
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_p(void);
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n1(void);
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n2(void);
+int test_peripheral_io_spi_peripheral_spi_set_frequency_p(void);
+int test_peripheral_io_spi_peripheral_spi_set_frequency_n(void);
+int test_peripheral_io_spi_peripheral_spi_read_p(void);
+int test_peripheral_io_spi_peripheral_spi_read_n1(void);
+int test_peripheral_io_spi_peripheral_spi_read_n2(void);
+int test_peripheral_io_spi_peripheral_spi_write_p(void);
+int test_peripheral_io_spi_peripheral_spi_write_n1(void);
+int test_peripheral_io_spi_peripheral_spi_write_n2(void);
+int test_peripheral_io_spi_peripheral_spi_transfer_p(void);
+int test_peripheral_io_spi_peripheral_spi_transfer_n1(void);
+int test_peripheral_io_spi_peripheral_spi_transfer_n2(void);
+int test_peripheral_io_spi_peripheral_spi_transfer_n3(void);
+
+#endif /* __TEST_PERIPHERAL_SPI_H__ */
\ No newline at end of file
diff --git a/test/include/test_peripheral_uart.h b/test/include/test_peripheral_uart.h
new file mode 100644 (file)
index 0000000..89e2b33
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2017 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 __TEST_PERIPHERAL_UART_H__
+#define __TEST_PERIPHERAL_UART_H__
+
+int test_peripheral_io_uart_initialize(char *model, bool feature);
+
+int test_peripheral_io_uart_peripheral_uart_open_p(void);
+int test_peripheral_io_uart_peripheral_uart_open_n1(void);
+int test_peripheral_io_uart_peripheral_uart_open_n2(void);
+int test_peripheral_io_uart_peripheral_uart_close_p(void);
+int test_peripheral_io_uart_peripheral_uart_close_n(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p1(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p2(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p3(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p4(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p5(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p6(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p7(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p8(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p9(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p10(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p11(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p12(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p13(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p14(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p15(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p16(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p17(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p18(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n1(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n2(void);
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n3(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p1(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p2(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p3(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p4(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n1(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n2(void);
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n3(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_p1(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_p2(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_p3(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_n1(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_n2(void);
+int test_peripheral_io_uart_peripheral_uart_set_parity_n3(void);
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_p1(void);
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_p2(void);
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n1(void);
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n2(void);
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n3(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p1(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p2(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p3(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p4(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n1(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n2(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n3(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n4(void);
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n5(void);
+int test_peripheral_io_uart_peripheral_uart_read_p(void);
+int test_peripheral_io_uart_peripheral_uart_read_n1(void);
+int test_peripheral_io_uart_peripheral_uart_read_n2(void);
+int test_peripheral_io_uart_peripheral_uart_write_p(void);
+int test_peripheral_io_uart_peripheral_uart_write_n1(void);
+int test_peripheral_io_uart_peripheral_uart_write_n2(void);
+
+#endif /* __TEST_PERIPHERAL_UART_H__ */
\ No newline at end of file
diff --git a/test/peripheral-io-test.c b/test/peripheral-io-test.c
new file mode 100644 (file)
index 0000000..21062a1
--- /dev/null
@@ -0,0 +1,528 @@
+
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <system_info.h>
+
+#include "peripheral_io.h"
+#include "test_peripheral_gpio.h"
+#include "test_peripheral_i2c.h"
+#include "test_peripheral_pwm.h"
+#include "test_peripheral_uart.h"
+#include "test_peripheral_spi.h"
+
+#define KEY_SYSTEM_MODEL_NAME          "http://tizen.org/system/model_name"
+#define KEY_FEATURE_PERIPHERAL_IO_GPIO "http://tizen.org/feature/peripheral_io.gpio"
+#define KEY_FEATURE_PERIPHERAL_IO_I2C  "http://tizen.org/feature/peripheral_io.i2c"
+#define KEY_FEATURE_PERIPHERAL_IO_PWM  "http://tizen.org/feature/peripheral_io.pwm"
+#define KEY_FEATURE_PERIPHERAL_IO_UART "http://tizen.org/feature/peripheral_io.uart"
+#define KEY_FEATURE_PERIPHERAL_IO_SPI  "http://tizen.org/feature/peripheral_io.spi"
+
+static int fail_count = 0;
+static int pass_count = 0;
+
+static void __error_check(int ret, char *name)
+{
+       if (ret != PERIPHERAL_ERROR_NONE) {
+               printf("[FAIL] %s\n", name);
+               fail_count++;
+       } else {
+               printf("[PASS] %s\n", name);
+               pass_count++;
+       }
+}
+
+static int __get_model_name(char **model_name)
+{
+       int ret = SYSTEM_INFO_ERROR_NONE;
+       ret = system_info_get_platform_string(KEY_SYSTEM_MODEL_NAME, model_name);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               printf("[Message] Failed to get model name.\n\n");
+               return -1;
+       }
+       return 0;
+}
+
+static int __get_feature(const char *key, bool *feature)
+{
+       int ret = SYSTEM_INFO_ERROR_NONE;
+       ret = system_info_get_platform_bool(key, feature);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               printf("[Message] Failed to feature (%s).\n\n", key);
+               return -1;
+       }
+       return 0;
+}
+
+static int __test_peripheral_init()
+{
+       int ret = 0;
+
+       char *model_name = NULL;
+       bool feature = false;
+
+       ret = __get_model_name(&model_name);
+       if (ret != 0) return ret;
+
+       ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_GPIO, &feature);
+       if (ret != 0) return ret;
+       ret = test_peripheral_io_gpio_initialize(model_name, feature);
+       if (ret != 0) return ret;
+
+       ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_I2C, &feature);
+       if (ret != 0) return ret;
+       ret = test_peripheral_io_i2c_initialize(model_name, feature);
+       if (ret != 0) return ret;
+
+       ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_PWM, &feature);
+       if (ret != 0) return ret;
+       ret = test_peripheral_io_pwm_initialize(model_name, feature);
+       if (ret != 0) return ret;
+
+       ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_UART, &feature);
+       if (ret != 0) return ret;
+       ret = test_peripheral_io_uart_initialize(model_name, feature);
+       if (ret != 0) return ret;
+
+       ret = __get_feature(KEY_FEATURE_PERIPHERAL_IO_SPI, &feature);
+       if (ret != 0) return ret;
+       ret = test_peripheral_io_spi_initialize(model_name, feature);
+       if (ret != 0) return ret;
+
+       return ret;
+}
+
+static void __test_peripheral_gpio_run()
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = test_peripheral_io_gpio_peripheral_gpio_open_p();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_open_p");
+       ret = test_peripheral_io_gpio_peripheral_gpio_open_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_open_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_open_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_open_n2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_close_p();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_close_p");
+       ret = test_peripheral_io_gpio_peripheral_gpio_close_n();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_close_n");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_p1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_p1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_p2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_p2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_p3();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_p3");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_n2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_direction_n3();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_direction_n3");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p3();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p3");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p4();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p4");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n3();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n3");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_p();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_p");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_n();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_n");
+       ret = test_peripheral_io_gpio_peripheral_gpio_read_p();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_read_p");
+       ret = test_peripheral_io_gpio_peripheral_gpio_read_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_read_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_read_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_read_n2");
+       ret = test_peripheral_io_gpio_peripheral_gpio_write_p();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_write_p");
+       ret = test_peripheral_io_gpio_peripheral_gpio_write_n1();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_write_n1");
+       ret = test_peripheral_io_gpio_peripheral_gpio_write_n2();
+       __error_check(ret, "test_peripheral_io_gpio_peripheral_gpio_write_n2");
+}
+
+static void __test_peripheral_i2c_run()
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = test_peripheral_io_i2c_peripheral_i2c_open_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_open_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_open_n1();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_open_n1");
+       ret = test_peripheral_io_i2c_peripheral_i2c_open_n2();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_open_n2");
+       ret = test_peripheral_io_i2c_peripheral_i2c_open_n3();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_open_n3");
+       ret = test_peripheral_io_i2c_peripheral_i2c_close_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_close_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_close_n();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_close_n");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_n1();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_n1");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_n2();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_n2");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_n1();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_n1");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_n2();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_n2");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_byte_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_byte_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n1();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n1");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n2();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n2");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_register_byte_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_register_byte_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_register_byte_n();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_register_byte_n");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_word_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_word_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_word_n1();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_word_n1");
+       ret = test_peripheral_io_i2c_peripheral_i2c_read_register_word_n2();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_read_register_word_n2");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_register_word_p();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_register_word_p");
+       ret = test_peripheral_io_i2c_peripheral_i2c_write_register_word_n();
+       __error_check(ret, "test_peripheral_io_i2c_peripheral_i2c_write_register_word_n");
+}
+
+static void __test_peripheral_pwm_run()
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = test_peripheral_io_pwm_peripheral_pwm_open_p();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_open_p");
+       ret = test_peripheral_io_pwm_peripheral_pwm_open_n1();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_open_n1");
+       ret = test_peripheral_io_pwm_peripheral_pwm_open_n2();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_open_n2");
+       ret = test_peripheral_io_pwm_peripheral_pwm_open_n3();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_open_n3");
+       ret = test_peripheral_io_pwm_peripheral_pwm_close_p();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_close_p");
+       ret = test_peripheral_io_pwm_peripheral_pwm_close_n();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_close_n");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_period_p();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_period_p");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_period_n();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_period_n");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_p();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_p");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_n();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_n");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_polarity_p1();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_polarity_p1");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_polarity_p2();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_polarity_p2");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_polarity_n1();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_polarity_n1");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_polarity_n2();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_polarity_n2");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_polarity_n3();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_polarity_n3");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_enabled_p1();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_enabled_p1");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_enabled_p2();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_enabled_p2");
+       ret = test_peripheral_io_pwm_peripheral_pwm_set_enabled_n();
+       __error_check(ret, "test_peripheral_io_pwm_peripheral_pwm_set_enabled_n");
+}
+
+static void __test_peripheral_uart_run()
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = test_peripheral_io_uart_peripheral_uart_open_p();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_open_p");
+       ret = test_peripheral_io_uart_peripheral_uart_open_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_open_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_open_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_open_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_close_p();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_close_p");
+       ret = test_peripheral_io_uart_peripheral_uart_close_n();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_close_n");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p4();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p4");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p5();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p5");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p6();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p6");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p7();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p7");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p8();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p8");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p9();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p9");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p10();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p10");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p11();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p11");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p12();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p12");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p13();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p13");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p14();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p14");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p15();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p15");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p16();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p16");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p17();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p17");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_p18();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_p18");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_baud_rate_n3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_baud_rate_n3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_p1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_p1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_p2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_p2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_p3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_p3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_p4();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_p4");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_byte_size_n3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_byte_size_n3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_p1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_p1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_p2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_p2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_p3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_p3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_parity_n3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_parity_n3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_stop_bits_p1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_stop_bits_p1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_stop_bits_p2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_stop_bits_p2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_stop_bits_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_stop_bits_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_stop_bits_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_stop_bits_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_stop_bits_n3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_stop_bits_n3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_p1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_p1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_p2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_p2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_p3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_p3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_p4();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_p4");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_n3();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_n3");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_n4();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_n4");
+       ret = test_peripheral_io_uart_peripheral_uart_set_flow_control_n5();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_set_flow_control_n5");
+       ret = test_peripheral_io_uart_peripheral_uart_read_p();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_read_p");
+       ret = test_peripheral_io_uart_peripheral_uart_read_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_read_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_read_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_read_n2");
+       ret = test_peripheral_io_uart_peripheral_uart_write_p();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_write_p");
+       ret = test_peripheral_io_uart_peripheral_uart_write_n1();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_write_n1");
+       ret = test_peripheral_io_uart_peripheral_uart_write_n2();
+       __error_check(ret, "test_peripheral_io_uart_peripheral_uart_write_n2");
+}
+
+static void __test_peripheral_spi_run()
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       ret = test_peripheral_io_spi_peripheral_spi_open_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_open_p");
+       ret = test_peripheral_io_spi_peripheral_spi_open_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_open_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_open_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_open_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_open_n3();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_open_n3");
+       ret = test_peripheral_io_spi_peripheral_spi_close_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_close_p");
+       ret = test_peripheral_io_spi_peripheral_spi_close_n();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_close_n");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_p1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_p1");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_p2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_p2");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_p3();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_p3");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_p4();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_p4");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_set_mode_n3();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_mode_n3");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bit_order_p1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bit_order_p1");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bit_order_p2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bit_order_p2");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bit_order_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bit_order_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bit_order_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bit_order_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bit_order_n3();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bit_order_n3");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bits_per_word_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bits_per_word_p");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_set_frequency_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_frequency_p");
+       ret = test_peripheral_io_spi_peripheral_spi_set_frequency_n();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_set_frequency_n");
+       ret = test_peripheral_io_spi_peripheral_spi_read_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_read_p");
+       ret = test_peripheral_io_spi_peripheral_spi_read_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_read_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_read_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_read_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_write_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_write_p");
+       ret = test_peripheral_io_spi_peripheral_spi_write_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_write_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_write_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_write_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_transfer_p();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_transfer_p");
+       ret = test_peripheral_io_spi_peripheral_spi_transfer_n1();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_transfer_n1");
+       ret = test_peripheral_io_spi_peripheral_spi_transfer_n2();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_transfer_n2");
+       ret = test_peripheral_io_spi_peripheral_spi_transfer_n3();
+       __error_check(ret, "test_peripheral_io_spi_peripheral_spi_transfer_n3");
+}
+
+int main(int argc, char **argv)
+{
+       int ret;
+
+       int menu;
+
+       printf("\n\n\n*** Peripheral-IO API Test (UTC) ***");
+
+       while (1) {
+
+               printf("\n\n******************************************************************\n");
+               printf("*                                                                *\n");
+               printf("*    MENU: 1.All  2.GPIO  3.I2C  4.PWM  5.UART  6.SPI  7.Exit    *\n");
+               printf("*                                                                *\n");
+               printf("******************************************************************\n");
+               printf("     Input Menu : ");
+
+               if (scanf("%d", &menu) < 0) return -1;
+
+               printf("\n\n");
+
+               fail_count = 0;
+               pass_count = 0;
+
+               ret = __test_peripheral_init();
+               if (ret != 0) {
+                       printf("[Message] Failed test init...\n\n");
+                       return -1;
+               }
+
+               switch (menu) {
+               case 1:
+                       __test_peripheral_gpio_run();
+                       __test_peripheral_i2c_run();
+                       __test_peripheral_pwm_run();
+                       __test_peripheral_uart_run();
+                       break;
+               case 2:
+                       __test_peripheral_gpio_run();
+                       break;
+               case 3:
+                       __test_peripheral_i2c_run();
+                       break;
+               case 4:
+                       __test_peripheral_pwm_run();
+                       break;
+               case 5:
+                       __test_peripheral_uart_run();
+                       break;
+               case 6:
+                       __test_peripheral_spi_run();
+                       break;
+               case 7:
+                       printf("[Message] Close the Peripheral-IO API local Test...\n\n");
+                       return 0;
+               default:
+                       printf("[Message] Input is wrong...\n\n");
+                       return -1;
+               }
+
+               printf("\n\nTotal : %d, Pass : %d, Fail : %d\n", pass_count + fail_count, pass_count, fail_count);
+
+       }
+
+       return -1;
+}
\ No newline at end of file
diff --git a/test/src/test_peripheral_gpio.c b/test/src/test_peripheral_gpio.c
new file mode 100644 (file)
index 0000000..9c594ff
--- /dev/null
@@ -0,0 +1,824 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <peripheral_io.h>
+#include "test_peripheral_gpio.h"
+
+#define GPIO_PIN_RPI3 26
+#define GPIO_PIN_ARTIK530 128
+#define GPIO_PIN_INVALID -99
+
+static bool g_feature = false;
+static int pin;
+
+int test_peripheral_io_gpio_initialize(char *model, bool feature)
+{
+       g_feature = feature;
+
+       if (!strcmp(model, "rpi3"))
+               pin = GPIO_PIN_RPI3;
+       else if (!strcmp(model, "artik"))
+               pin = GPIO_PIN_ARTIK530;
+       else
+               return -1;
+       return 0;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_open_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_open_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_open(pin, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_open_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(GPIO_PIN_INVALID, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_close_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_close_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_close(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_close(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_set_direction(NULL, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_direction_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
+               if (ret != PERIPHERAL_ERROR_NONE && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_FALLING);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_p4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_set_edge_mode(NULL, PERIPHERAL_GPIO_EDGE_RISING);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_edge_mode_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_BOTH + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+static void gpio_interrupted_cb(peripheral_gpio_h gpio_h, peripheral_error_e error, void *user_data)
+{
+       // interrupted callback
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_p(void)
+{
+       // see the gpio_interrupted_cb();
+
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_set_edge_mode(gpio_h, PERIPHERAL_GPIO_EDGE_RISING);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_set_interrupted_cb(NULL, gpio_interrupted_cb, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_set_interrupted_cb_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_interrupted_cb(gpio_h, NULL, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_interrupted_cb(gpio_h, gpio_interrupted_cb, NULL);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_unset_interrupted_cb(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_unset_interrupted_cb_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_unset_interrupted_cb(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_unset_interrupted_cb(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_read_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       uint32_t value;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_read(gpio_h, &value);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_read(gpio_h, &value);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_read_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint32_t value;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_read(NULL, &value);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_read(NULL, &value);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_read_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_read(gpio_h, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_IN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_read(gpio_h, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_write_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       uint32_t value = 1;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_write(gpio_h, value);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_write(gpio_h, value);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_write_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint32_t value = 1;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_write(NULL, value);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_write(NULL, value);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_gpio_peripheral_gpio_write_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_gpio_h gpio_h = NULL;
+
+       uint32_t value = 2;
+
+       if (g_feature == false) {
+               ret = peripheral_gpio_write(gpio_h, value);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_gpio_open(pin, &gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_gpio_set_direction(gpio_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_write(gpio_h, value);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_gpio_close(gpio_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_gpio_close(gpio_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
diff --git a/test/src/test_peripheral_i2c.c b/test/src/test_peripheral_i2c.c
new file mode 100644 (file)
index 0000000..a9a81ee
--- /dev/null
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <peripheral_io.h>
+#include "test_peripheral_i2c.h"
+
+#define I2C_BUS 4
+#define I2C_BUS_INVALID -99
+#define I2C_ADDRESS 0x39
+#define I2C_ADDRESS_INVALID -99
+#define I2C_BUFFER_LEN 10
+#define I2C_BUFFER_VALUE 0x00
+#define I2C_REGISTER 0x00
+
+static bool g_feature = true;
+static int bus;
+static int address;
+
+int test_peripheral_io_i2c_initialize(char *model, bool feature)
+{
+       g_feature = feature;
+
+       if ((!strcmp(model, "rpi3")) || (!strcmp(model, "artik")))
+               bus = I2C_BUS;
+       else
+               return -1;
+
+       address = I2C_ADDRESS;
+
+       return 0;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_open_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_open_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_open(bus, address, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_open_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(I2C_BUS_INVALID, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_open_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, I2C_ADDRESS_INVALID, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_close_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_close_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_close(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_close(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       uint8_t buf[I2C_BUFFER_LEN];
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read(i2c_h, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t buf[I2C_BUFFER_LEN];
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_read(NULL, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read(i2c_h, NULL, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       unsigned char buf[I2C_BUFFER_LEN] = {I2C_BUFFER_VALUE, };
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_write(i2c_h, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       unsigned char buf[I2C_BUFFER_LEN] = {I2C_BUFFER_VALUE, };
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_write(NULL, buf, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_write(i2c_h, NULL, I2C_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       uint8_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_read_register_byte(NULL, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_byte_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read_register_byte(i2c_h, I2C_REGISTER, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_register_byte_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_write_register_byte(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_register_byte_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_write_register_byte(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       uint16_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint16_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_read_register_word(NULL, I2C_REGISTER, &data);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+
+int test_peripheral_io_i2c_peripheral_i2c_read_register_word_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_read_register_word(i2c_h, I2C_REGISTER, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+
+int test_peripheral_io_i2c_peripheral_i2c_write_register_word_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_i2c_h i2c_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_open(bus, address, &i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_i2c_write_register_word(i2c_h, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_i2c_close(i2c_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_i2c_close(i2c_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_i2c_peripheral_i2c_write_register_word_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_i2c_write_register_word(NULL, I2C_REGISTER, I2C_BUFFER_VALUE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
diff --git a/test/src/test_peripheral_pwm.c b/test/src/test_peripheral_pwm.c
new file mode 100644 (file)
index 0000000..7b88d5e
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <peripheral_io.h>
+#include "test_peripheral_pwm.h"
+
+#define PWM_CHIP 0
+#define PWM_CHIP_INVALID -99
+#define PWM_PIN 2
+#define PWM_PIN_INVALID -99
+#define PWM_PERIOD 1000
+#define PWM_DUTY_CYCLE 100
+
+static bool g_feature = true;
+static int chip;
+static int pin;
+
+int test_peripheral_io_pwm_initialize(char *model, bool feature)
+{
+       g_feature = feature;
+
+       if ((!strcmp(model, "rpi3")) || (!strcmp(model, "artik"))) {
+               chip = PWM_CHIP;
+               pin = PWM_PIN;
+       } else {
+               return -1;
+       }
+       return 0;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_open_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_open_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(PWM_CHIP_INVALID, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_open_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, PWM_PIN_INVALID, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_open_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_open(chip, pin, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_close_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_close_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_close(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_close(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_period_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_period(pwm_h, PWM_PERIOD);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_period_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_set_period(NULL, PWM_PERIOD);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_duty_cycle(pwm_h, PWM_DUTY_CYCLE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_duty_cycle_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_set_duty_cycle(NULL, PWM_DUTY_CYCLE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_set_polarity(NULL, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_polarity_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_polarity(pwm_h, PERIPHERAL_PWM_POLARITY_ACTIVE_LOW + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       bool enable = true;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_enabled(pwm_h, enable);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_enabled(pwm_h, enable);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_pwm_h pwm_h = NULL;
+
+       bool enable = false;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_enabled(pwm_h, enable);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_open(chip, pin, &pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_pwm_set_enabled(pwm_h, enable);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_pwm_close(pwm_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_pwm_close(pwm_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_pwm_peripheral_pwm_set_enabled_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       bool enable = true;
+
+       if (g_feature == false) {
+               ret = peripheral_pwm_set_enabled(NULL, enable);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_pwm_set_enabled(NULL, enable);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
diff --git a/test/src/test_peripheral_spi.c b/test/src/test_peripheral_spi.c
new file mode 100644 (file)
index 0000000..41576c2
--- /dev/null
@@ -0,0 +1,855 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <peripheral_io.h>
+#include "test_peripheral_spi.h"
+
+#define SPI_BUS_RPI3 0
+#define SPI_BUS_ARTIK530 2
+#define SPI_BUS_INVALID -99
+#define SPI_CS 0
+#define SPI_CS_INVALID -99
+#define SPI_BITS_PER_WORD 8
+#define SPI_BITS_PER_WORD_INVALID 1
+#define SPI_FREQUENCY 15000
+#define SPI_BUFFER_LEN 1
+#define        SPI_WRITE_DATA 0x00
+
+static bool g_feature = true;
+static int bus;
+static int cs;
+
+int test_peripheral_io_spi_initialize(char *model, bool feature)
+{
+       g_feature = feature;
+
+       if (!strcmp(model, "rpi3"))
+               bus = SPI_BUS_RPI3;
+       else if (!strcmp(model, "artik"))
+               bus = SPI_BUS_ARTIK530;
+       else
+               return -1;
+
+       cs = SPI_CS;
+
+       return 0;
+}
+
+int test_peripheral_io_spi_peripheral_spi_open_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_open_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(SPI_BUS_INVALID, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_open_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, SPI_CS_INVALID, &spi_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_open_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_open(bus, cs, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_close_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_close_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_close(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_close(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_1);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_2);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_p4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(NULL, PERIPHERAL_SPI_MODE_0);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0 - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_mode_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_3 + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB);
+               if (ret != PERIPHERAL_ERROR_IO_ERROR) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_set_bit_order(NULL, PERIPHERAL_SPI_BIT_ORDER_MSB);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_MSB - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bit_order_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bit_order(spi_h, PERIPHERAL_SPI_BIT_ORDER_LSB + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_set_bits_per_word(NULL, SPI_BITS_PER_WORD);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_bits_per_word_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD_INVALID);
+               if (ret != PERIPHERAL_ERROR_IO_ERROR) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_frequency_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_set_mode(spi_h, PERIPHERAL_SPI_MODE_0);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_set_bits_per_word(spi_h, SPI_BITS_PER_WORD);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_set_frequency(spi_h, SPI_FREQUENCY);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_set_frequency_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_set_frequency(NULL, SPI_FREQUENCY);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_read_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       uint8_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_read(spi_h, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_read_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t data;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_read(NULL, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_read_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_read(spi_h, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_write_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       uint8_t data = SPI_WRITE_DATA;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_write(spi_h, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_write_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t data = SPI_WRITE_DATA;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_write(NULL, &data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+
+int test_peripheral_io_spi_peripheral_spi_write_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_write(spi_h, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_transfer_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       uint8_t tx_data = SPI_WRITE_DATA;
+       uint8_t rx_data;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_transfer(spi_h, &tx_data, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_transfer_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t tx_data = SPI_WRITE_DATA;
+       uint8_t rx_data;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_transfer(NULL, &tx_data, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_transfer_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       uint8_t rx_data;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_transfer(spi_h, NULL, &rx_data, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_spi_peripheral_spi_transfer_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_spi_h spi_h = NULL;
+
+       uint8_t tx_data = SPI_WRITE_DATA;
+
+       if (g_feature == false) {
+               ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_spi_open(bus, cs, &spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_spi_transfer(spi_h, &tx_data, NULL, SPI_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_spi_close(spi_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_spi_close(spi_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
diff --git a/test/src/test_peripheral_uart.c b/test/src/test_peripheral_uart.c
new file mode 100644 (file)
index 0000000..442961a
--- /dev/null
@@ -0,0 +1,1525 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <peripheral_io.h>
+#include "test_peripheral_uart.h"
+
+#define UART_PORT_RPI3 0
+#define UART_PORT_ARTIK530 4
+#define UART_PORT_INVALID -99
+#define UART_BUFFER_LEN 10
+#define        UART_WRITE_DATA 0x00
+
+static bool g_feature = true;
+static int port;
+
+int test_peripheral_io_uart_initialize(char *model, bool feature)
+{
+       g_feature = feature;
+
+       if (!strcmp(model, "rpi3"))
+               port = UART_PORT_RPI3;
+       else if (!strcmp(model, "artik"))
+               port = UART_PORT_ARTIK530;
+       else
+               return -1;
+
+       return 0;
+}
+
+int test_peripheral_io_uart_peripheral_uart_open_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_open_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(UART_PORT_INVALID, &uart_h);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_open_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_open(port, NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_close_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_close_n(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_close(NULL);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_close(NULL);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_50);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_110);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_134);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p5(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_150);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p6(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_200);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p7(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_300);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p8(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_600);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p9(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1200);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p10(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_1800);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p11(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_2400);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p12(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_4800);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p13(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_9600);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p14(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_19200);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p15(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_38400);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p16(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_57600);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p17(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_115200);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_p18(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_set_baud_rate(NULL, PERIPHERAL_UART_BAUD_RATE_1200);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_0 - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_baud_rate_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_baud_rate(uart_h, PERIPHERAL_UART_BAUD_RATE_230400 + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_6BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_7BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_p4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_set_byte_size(NULL, PERIPHERAL_UART_BYTE_SIZE_5BIT);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_5BIT - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_byte_size_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_byte_size(uart_h, PERIPHERAL_UART_BYTE_SIZE_8BIT + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_EVEN);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_set_parity(NULL, PERIPHERAL_UART_PARITY_NONE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_parity_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_parity(uart_h, PERIPHERAL_UART_PARITY_ODD + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_set_stop_bits(NULL, PERIPHERAL_UART_STOP_BITS_1BIT);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_1BIT - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_stop_bits_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_stop_bits(uart_h, PERIPHERAL_UART_STOP_BITS_2BIT + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_p4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS);
+               if (ret != PERIPHERAL_ERROR_NONE) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_set_flow_control(NULL, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE - 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n3(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n4(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE - 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_set_flow_control_n5(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_set_flow_control(uart_h, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE, PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF + 1);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_read_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       uint8_t data[UART_BUFFER_LEN];
+
+       if (g_feature == false) {
+               ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_read(uart_h, data, UART_BUFFER_LEN);
+               if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_read_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t data[UART_BUFFER_LEN];
+
+       if (g_feature == false) {
+               ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_read(NULL, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_read_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_read(uart_h, NULL, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_write_p(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       uint8_t data[UART_BUFFER_LEN] = {UART_WRITE_DATA, };
+
+       if (g_feature == false) {
+               ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_write(uart_h, data, UART_BUFFER_LEN);
+               if (ret <= 0 && ret != PERIPHERAL_ERROR_TRY_AGAIN) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+int test_peripheral_io_uart_peripheral_uart_write_n1(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       uint8_t data[UART_BUFFER_LEN] = {UART_WRITE_DATA, };
+
+       if (g_feature == false) {
+               ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_write(NULL, data, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}
+
+
+int test_peripheral_io_uart_peripheral_uart_write_n2(void)
+{
+       int ret = PERIPHERAL_ERROR_NONE;
+
+       peripheral_uart_h uart_h = NULL;
+
+       if (g_feature == false) {
+               ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_NOT_SUPPORTED) return PERIPHERAL_ERROR_UNKNOWN;
+
+       } else {
+               ret = peripheral_uart_open(port, &uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+
+               ret = peripheral_uart_write(uart_h, NULL, UART_BUFFER_LEN);
+               if (ret != PERIPHERAL_ERROR_INVALID_PARAMETER) {
+                       peripheral_uart_close(uart_h);
+                       return PERIPHERAL_ERROR_UNKNOWN;
+               }
+
+               ret = peripheral_uart_close(uart_h);
+               if (ret != PERIPHERAL_ERROR_NONE) return PERIPHERAL_ERROR_UNKNOWN;
+       }
+
+       return PERIPHERAL_ERROR_NONE;
+}