Move header files in daemon/ to include directory 92/138692/3
authorHyeongsik Min <hyeongsik.min@samsung.com>
Thu, 13 Jul 2017 07:57:01 +0000 (16:57 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Fri, 14 Jul 2017 09:53:44 +0000 (09:53 +0000)
Change-Id: Id8b9aa2e16fc9b604988075613aa53318e13883e
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
21 files changed:
CMakeLists.txt
src/daemon/include/peripheral_bus.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_adc.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_board.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_gpio.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_i2c.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_pwm.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_spi.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_uart.h [new file with mode: 0644]
src/daemon/include/peripheral_bus_util.h [new file with mode: 0644]
src/daemon/include/peripheral_common.h [new file with mode: 0644]
src/daemon/peripheral_bus.h [deleted file]
src/daemon/peripheral_bus_adc.h [deleted file]
src/daemon/peripheral_bus_board.h [deleted file]
src/daemon/peripheral_bus_gpio.h [deleted file]
src/daemon/peripheral_bus_i2c.h [deleted file]
src/daemon/peripheral_bus_pwm.h [deleted file]
src/daemon/peripheral_bus_spi.h [deleted file]
src/daemon/peripheral_bus_uart.h [deleted file]
src/daemon/peripheral_bus_util.h [deleted file]
src/daemon/peripheral_common.h [deleted file]

index 311b233425876fb2dec89f14c7fc53188923e55a..9893aaef653127a55bd6dbce6eca00a7e25685e6 100644 (file)
@@ -16,6 +16,7 @@ EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS
                 ")
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/daemon)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/daemon/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/interface/include)
 
 SET(PERIPHERAL-BUS "peripheral-bus")
diff --git a/src/daemon/include/peripheral_bus.h b/src/daemon/include/peripheral_bus.h
new file mode 100644 (file)
index 0000000..a547f92
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_BUS_H__
+#define __PERIPHERAL_BUS_H__
+
+#include <gio/gio.h>
+
+#include "peripheral_io_gdbus.h"
+#include "peripheral_bus_board.h"
+
+typedef enum {
+       PERIPHERAL_BUS_TYPE_GPIO = 0,
+       PERIPHERAL_BUS_TYPE_I2C,
+       PERIPHERAL_BUS_TYPE_PWM,
+       PERIPHERAL_BUS_TYPE_ADC,
+       PERIPHERAL_BUS_TYPE_UART,
+       PERIPHERAL_BUS_TYPE_SPI,
+} peripheral_bus_type_e;
+
+typedef struct {
+       pb_board_s *board;
+       /* daemon variable */
+       char *adc_path;
+       /* devices */
+       GList *gpio_list;
+       GList *i2c_list;
+       GList *pwm_list;
+       GList *uart_list;
+       GList *spi_list;
+       /* gdbus variable */
+       guint reg_id;
+       GDBusConnection *connection;
+       PeripheralIoGdbusGpio *gpio_skeleton;
+       PeripheralIoGdbusI2c *i2c_skeleton;
+       PeripheralIoGdbusPwm *pwm_skeleton;
+       PeripheralIoGdbusAdc *adc_skeleton;
+       PeripheralIoGdbusUart *uart_skeleton;
+       PeripheralIoGdbusSpi *spi_skeleton;
+} peripheral_bus_s;
+
+typedef struct {
+       char *id;
+       pid_t pid;
+       pid_t pgid;
+} pb_client_info_s;
+
+typedef struct {
+       /* gpio info */
+       int pin;
+       int direction;
+       int edge;
+       /* interrupt variable */
+       int irq_en;
+       int value_fd;
+       GIOChannel *io;
+       guint io_id;
+       /* gdbus variable */
+       PeripheralIoGdbusGpio *gpio_skeleton;
+} peripheral_bus_gpio_s;
+
+typedef struct {
+       /* i2c device information */
+       int bus;
+       int address;
+       int fd;
+       /* data buffer */
+       uint8_t *buffer;
+       int buffer_size;
+} peripheral_bus_i2c_s;
+
+typedef struct {
+       int device;
+       int channel;
+} peripheral_bus_pwm_s;
+
+typedef struct {
+       int port;
+       int fd;
+       uint8_t *buffer;
+       int buffer_size;
+} peripheral_bus_uart_s;
+
+typedef struct {
+       int bus;
+       int cs;
+       int fd;
+       /* data buffer */
+       uint8_t *rx_buf;
+       uint8_t *tx_buf;
+       int rx_buf_size;
+       int tx_buf_size;
+} peripheral_bus_spi_s;
+
+typedef struct {
+       peripheral_bus_type_e type;
+       uint watch_id;
+       GList **list;
+       /* client info */
+       pb_client_info_s client_info;
+       union {
+               peripheral_bus_gpio_s gpio;
+               peripheral_bus_i2c_s i2c;
+               peripheral_bus_pwm_s pwm;
+               peripheral_bus_uart_s uart;
+               peripheral_bus_spi_s spi;
+       } dev;
+} peripheral_bus_data_s;
+
+typedef peripheral_bus_data_s *pb_data_h;
+
+void peripheral_bus_emit_gpio_changed(PeripheralIoGdbusGpio *gpio,
+                                                                       gint pin,
+                                                                       gint value,
+                                                                       guint64 timestamp);
+#endif /* __PERIPHERAL_BUS_H__ */
diff --git a/src/daemon/include/peripheral_bus_adc.h b/src/daemon/include/peripheral_bus_adc.h
new file mode 100644 (file)
index 0000000..436214b
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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 __PERIPHERAL_BUS_ADC_H__
+#define __PERIPHERAL_BUS_ADC_H__
+
+char *peripheral_bus_adc_get_path(unsigned int device);
+int peripheral_bus_adc_read(unsigned int device, unsigned int channel, char *path, int *data);
+
+#endif /* __PERIPHERAL_BUS_ADC_H__ */
diff --git a/src/daemon/include/peripheral_bus_board.h b/src/daemon/include/peripheral_bus_board.h
new file mode 100644 (file)
index 0000000..85ae2b4
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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 __PERIPHERAL_BUS_BOARD_H__
+#define __PERIPHERAL_BUS_BOARD_H__
+
+#define BOARD_DEVICE_TREE      "/proc/device-tree/model"
+#define BOARD_PINS_MAX 4
+#define BOARD_ARGS_MAX 2
+
+typedef enum {
+       PB_BOARD_ARTIK710 = 0,
+       PB_BOARD_ARTIK530,
+       PB_BOARD_RP3_B_12,
+       PB_BOARD_UNKOWN,
+} pb_board_type_e;
+
+typedef enum {
+       PB_BOARD_DEV_GPIO = 0,
+       PB_BOARD_DEV_I2C,
+       PB_BOARD_DEV_PWM,
+       PB_BOARD_DEV_ADC,
+       PB_BOARD_DEV_UART,
+       PB_BOARD_DEV_SPI,
+       PB_BOARD_DEV_MAX,
+} pb_board_dev_e;
+
+typedef struct {
+       pb_board_type_e type;
+       char *name;
+       char *path;
+} pb_board_type_s;
+
+typedef struct {
+       pb_board_dev_e dev_type;
+       unsigned int pins[BOARD_PINS_MAX];
+       unsigned int num_pins;
+       unsigned int args[BOARD_ARGS_MAX];
+} pb_board_dev_s;
+
+typedef struct {
+       pb_board_type_e type;
+       pb_board_dev_s *dev;
+       unsigned int num_dev;
+} pb_board_s;
+
+pb_board_dev_s *peripheral_bus_board_find_device(pb_board_dev_e dev_type, pb_board_s *board, int arg, ...);
+pb_board_s *peripheral_bus_board_init(void);
+void peripheral_bus_board_deinit(pb_board_s *board);
+
+#endif /* __PERIPHERAL_BUS_BOARD_H__ */
diff --git a/src/daemon/include/peripheral_bus_gpio.h b/src/daemon/include/peripheral_bus_gpio.h
new file mode 100644 (file)
index 0000000..3a63530
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_BUS_GPIO_H__
+#define __PERIPHERAL_BUS_GPIO_H__
+
+int peripheral_bus_gpio_open(gint pin, pb_data_h *handle, gpointer user_data);
+int peripheral_bus_gpio_set_direction(pb_data_h handle, gint direction);
+int peripheral_bus_gpio_get_direction(pb_data_h handle, gint *direction);
+int peripheral_bus_gpio_set_edge(pb_data_h handle, gint edge);
+int peripheral_bus_gpio_get_edge(pb_data_h handle, gint *edge);
+int peripheral_bus_gpio_write(pb_data_h handle, gint value);
+int peripheral_bus_gpio_read(pb_data_h handle, gint *value);
+int peripheral_bus_gpio_register_irq(pb_data_h handle);
+int peripheral_bus_gpio_unregister_irq(pb_data_h handle);
+int peripheral_bus_gpio_close(pb_data_h handle);
+
+#endif /* __PERIPHERAL_BUS_GPIO_H__ */
diff --git a/src/daemon/include/peripheral_bus_i2c.h b/src/daemon/include/peripheral_bus_i2c.h
new file mode 100644 (file)
index 0000000..9c337b7
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_BUS_I2C_H__
+#define __PERIPHERAL_BUS_I2C_H__
+
+int peripheral_bus_i2c_open(int bus, int address, pb_data_h *handle, gpointer user_data);
+int peripheral_bus_i2c_close(pb_data_h handle);
+int peripheral_bus_i2c_read(pb_data_h handle, int length, GVariant **data_array);
+int peripheral_bus_i2c_write(pb_data_h handle, int length, GVariant *data_array);
+int peripheral_bus_i2c_smbus_ioctl(pb_data_h handle, uint8_t read_write, uint8_t command, uint32_t size, uint16_t data_in, uint16_t *data_out);
+
+#endif /* __PERIPHERAL_BUS_I2C_H__ */
diff --git a/src/daemon/include/peripheral_bus_pwm.h b/src/daemon/include/peripheral_bus_pwm.h
new file mode 100644 (file)
index 0000000..fbcc6e3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_BUS_PWM_H__
+#define __PERIPHERAL_BUS_PWM_H__
+
+int peripheral_bus_pwm_open(int device, int channel, pb_data_h *handle, gpointer user_data);
+int peripheral_bus_pwm_close(pb_data_h handle);
+int peripheral_bus_pwm_set_period(pb_data_h handle, int period);
+int peripheral_bus_pwm_get_period(pb_data_h handle, int *period);
+int peripheral_bus_pwm_set_duty_cycle(pb_data_h handle, int duty_cycle);
+int peripheral_bus_pwm_get_duty_cycle(pb_data_h handle, int *duty_cycle);
+int peripheral_bus_pwm_set_polarity(pb_data_h handle, int polarity);
+int peripheral_bus_pwm_get_polarity(pb_data_h handle, int *polarity);
+int peripheral_bus_pwm_set_enable(pb_data_h handle, bool enable);
+int peripheral_bus_pwm_get_enable(pb_data_h handle, bool *enable);
+
+#endif /* __PERIPHERAL_BUS_PWM_H__ */
diff --git a/src/daemon/include/peripheral_bus_spi.h b/src/daemon/include/peripheral_bus_spi.h
new file mode 100644 (file)
index 0000000..1140600
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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 __PERIPHERAL_BUS_SPI_H__
+#define __PERIPHERAL_BUS_SPI_H__
+
+int peripheral_bus_spi_open(int bus, int cs, pb_data_h *handle, gpointer user_data);
+int peripheral_bus_spi_close(pb_data_h handle);
+int peripheral_bus_spi_set_mode(pb_data_h handle, unsigned char mode);
+int peripheral_bus_spi_get_mode(pb_data_h handle, unsigned char *mode);
+int peripheral_bus_spi_set_lsb_first(pb_data_h handle, gboolean lsb);
+int peripheral_bus_spi_get_lsb_first(pb_data_h handle, gboolean *lsb);
+int peripheral_bus_spi_set_bits(pb_data_h handle, unsigned char bits);
+int peripheral_bus_spi_get_bits(pb_data_h handle, unsigned char *bits);
+int peripheral_bus_spi_set_frequency(pb_data_h handle, unsigned int freq);
+int peripheral_bus_spi_get_frequency(pb_data_h handle, unsigned int *freq);
+int peripheral_bus_spi_read(pb_data_h handle, GVariant **data_array, int length);
+int peripheral_bus_spi_write(pb_data_h handle, GVariant *data_array, int length);
+int peripheral_bus_spi_read_write(pb_data_h handle, GVariant *tx_data_array, GVariant **rx_data_array, int length);
+
+#endif /* __PERIPHERAL_BUS_SPI_H__ */
diff --git a/src/daemon/include/peripheral_bus_uart.h b/src/daemon/include/peripheral_bus_uart.h
new file mode 100644 (file)
index 0000000..680d72a
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_BUS_UART_H__
+#define __PERIPHERAL_BUS_UART_H__
+
+int peripheral_bus_uart_open(int port, pb_data_h *handle, gpointer user_data);
+int peripheral_bus_uart_close(pb_data_h handle);
+int peripheral_bus_uart_flush(pb_data_h handle);
+int peripheral_bus_uart_set_baudrate(pb_data_h handle, int baudrate);
+int peripheral_bus_uart_set_mode(pb_data_h handle, int byte_size, int parity, int stop_bits);
+int peripheral_bus_uart_set_flowcontrol(pb_data_h handle, int xonxoff, int rtscts);
+int peripheral_bus_uart_read(pb_data_h handle, GVariant **data_array, int length);
+int peripheral_bus_uart_write(pb_data_h handle, GVariant *data_array, int length);
+
+#endif /* __PERIPHERAL_BUS_UART_H__ */
diff --git a/src/daemon/include/peripheral_bus_util.h b/src/daemon/include/peripheral_bus_util.h
new file mode 100644 (file)
index 0000000..103956b
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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 __PERIPHERAL_UTIL_H__
+#define __PERIPHERAL_UTIL_H__
+
+GVariant *peripheral_bus_build_variant_ay(uint8_t *data, int length);
+pb_data_h peripheral_bus_data_new(GList **plist);
+int peripheral_bus_data_free(pb_data_h handle);
+
+#endif /* __PERIPHERAL_UTIL_H__ */
diff --git a/src/daemon/include/peripheral_common.h b/src/daemon/include/peripheral_common.h
new file mode 100644 (file)
index 0000000..9c3b8fe
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-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 __PERIPHERAL_COMMON_H__
+#define __PERIPHERAL_COMMON_H__
+
+#include <unistd.h>
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "PERIPHERAL-BUS"
+
+#define _E(fmt, arg...) LOGE(fmt, ##arg)
+#define _D(fmt, arg...) LOGD(fmt, ##arg)
+#define _W(fmt, arg...) LOGW(fmt, ##arg)
+
+#define RET_IF(expr) \
+       do { \
+               if (expr) { \
+                       _E("(%s)", #expr); \
+                       return; \
+               } \
+       } while (0)
+#define RETV_IF(expr, val) \
+       do {\
+               if (expr) { \
+                       _E("(%s)", #expr); \
+                       return (val); \
+               } \
+       } while (0)
+#define RETM_IF(expr, fmt, arg...) \
+       do {\
+               if (expr) { \
+                       _E(fmt, ##arg); \
+                       return; \
+               } \
+       } while (0)
+#define RETVM_IF(expr, val, fmt, arg...) \
+       do {\
+               if (expr) { \
+                       _E(fmt, ##arg); \
+                       return (val); \
+               } \
+       } while (0)
+
+#endif /* __PERIPHERAL_COMMON_H__ */
diff --git a/src/daemon/peripheral_bus.h b/src/daemon/peripheral_bus.h
deleted file mode 100644 (file)
index a547f92..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_BUS_H__
-#define __PERIPHERAL_BUS_H__
-
-#include <gio/gio.h>
-
-#include "peripheral_io_gdbus.h"
-#include "peripheral_bus_board.h"
-
-typedef enum {
-       PERIPHERAL_BUS_TYPE_GPIO = 0,
-       PERIPHERAL_BUS_TYPE_I2C,
-       PERIPHERAL_BUS_TYPE_PWM,
-       PERIPHERAL_BUS_TYPE_ADC,
-       PERIPHERAL_BUS_TYPE_UART,
-       PERIPHERAL_BUS_TYPE_SPI,
-} peripheral_bus_type_e;
-
-typedef struct {
-       pb_board_s *board;
-       /* daemon variable */
-       char *adc_path;
-       /* devices */
-       GList *gpio_list;
-       GList *i2c_list;
-       GList *pwm_list;
-       GList *uart_list;
-       GList *spi_list;
-       /* gdbus variable */
-       guint reg_id;
-       GDBusConnection *connection;
-       PeripheralIoGdbusGpio *gpio_skeleton;
-       PeripheralIoGdbusI2c *i2c_skeleton;
-       PeripheralIoGdbusPwm *pwm_skeleton;
-       PeripheralIoGdbusAdc *adc_skeleton;
-       PeripheralIoGdbusUart *uart_skeleton;
-       PeripheralIoGdbusSpi *spi_skeleton;
-} peripheral_bus_s;
-
-typedef struct {
-       char *id;
-       pid_t pid;
-       pid_t pgid;
-} pb_client_info_s;
-
-typedef struct {
-       /* gpio info */
-       int pin;
-       int direction;
-       int edge;
-       /* interrupt variable */
-       int irq_en;
-       int value_fd;
-       GIOChannel *io;
-       guint io_id;
-       /* gdbus variable */
-       PeripheralIoGdbusGpio *gpio_skeleton;
-} peripheral_bus_gpio_s;
-
-typedef struct {
-       /* i2c device information */
-       int bus;
-       int address;
-       int fd;
-       /* data buffer */
-       uint8_t *buffer;
-       int buffer_size;
-} peripheral_bus_i2c_s;
-
-typedef struct {
-       int device;
-       int channel;
-} peripheral_bus_pwm_s;
-
-typedef struct {
-       int port;
-       int fd;
-       uint8_t *buffer;
-       int buffer_size;
-} peripheral_bus_uart_s;
-
-typedef struct {
-       int bus;
-       int cs;
-       int fd;
-       /* data buffer */
-       uint8_t *rx_buf;
-       uint8_t *tx_buf;
-       int rx_buf_size;
-       int tx_buf_size;
-} peripheral_bus_spi_s;
-
-typedef struct {
-       peripheral_bus_type_e type;
-       uint watch_id;
-       GList **list;
-       /* client info */
-       pb_client_info_s client_info;
-       union {
-               peripheral_bus_gpio_s gpio;
-               peripheral_bus_i2c_s i2c;
-               peripheral_bus_pwm_s pwm;
-               peripheral_bus_uart_s uart;
-               peripheral_bus_spi_s spi;
-       } dev;
-} peripheral_bus_data_s;
-
-typedef peripheral_bus_data_s *pb_data_h;
-
-void peripheral_bus_emit_gpio_changed(PeripheralIoGdbusGpio *gpio,
-                                                                       gint pin,
-                                                                       gint value,
-                                                                       guint64 timestamp);
-#endif /* __PERIPHERAL_BUS_H__ */
diff --git a/src/daemon/peripheral_bus_adc.h b/src/daemon/peripheral_bus_adc.h
deleted file mode 100644 (file)
index 436214b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 __PERIPHERAL_BUS_ADC_H__
-#define __PERIPHERAL_BUS_ADC_H__
-
-char *peripheral_bus_adc_get_path(unsigned int device);
-int peripheral_bus_adc_read(unsigned int device, unsigned int channel, char *path, int *data);
-
-#endif /* __PERIPHERAL_BUS_ADC_H__ */
diff --git a/src/daemon/peripheral_bus_board.h b/src/daemon/peripheral_bus_board.h
deleted file mode 100644 (file)
index 85ae2b4..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 __PERIPHERAL_BUS_BOARD_H__
-#define __PERIPHERAL_BUS_BOARD_H__
-
-#define BOARD_DEVICE_TREE      "/proc/device-tree/model"
-#define BOARD_PINS_MAX 4
-#define BOARD_ARGS_MAX 2
-
-typedef enum {
-       PB_BOARD_ARTIK710 = 0,
-       PB_BOARD_ARTIK530,
-       PB_BOARD_RP3_B_12,
-       PB_BOARD_UNKOWN,
-} pb_board_type_e;
-
-typedef enum {
-       PB_BOARD_DEV_GPIO = 0,
-       PB_BOARD_DEV_I2C,
-       PB_BOARD_DEV_PWM,
-       PB_BOARD_DEV_ADC,
-       PB_BOARD_DEV_UART,
-       PB_BOARD_DEV_SPI,
-       PB_BOARD_DEV_MAX,
-} pb_board_dev_e;
-
-typedef struct {
-       pb_board_type_e type;
-       char *name;
-       char *path;
-} pb_board_type_s;
-
-typedef struct {
-       pb_board_dev_e dev_type;
-       unsigned int pins[BOARD_PINS_MAX];
-       unsigned int num_pins;
-       unsigned int args[BOARD_ARGS_MAX];
-} pb_board_dev_s;
-
-typedef struct {
-       pb_board_type_e type;
-       pb_board_dev_s *dev;
-       unsigned int num_dev;
-} pb_board_s;
-
-pb_board_dev_s *peripheral_bus_board_find_device(pb_board_dev_e dev_type, pb_board_s *board, int arg, ...);
-pb_board_s *peripheral_bus_board_init(void);
-void peripheral_bus_board_deinit(pb_board_s *board);
-
-#endif /* __PERIPHERAL_BUS_BOARD_H__ */
diff --git a/src/daemon/peripheral_bus_gpio.h b/src/daemon/peripheral_bus_gpio.h
deleted file mode 100644 (file)
index 3a63530..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_BUS_GPIO_H__
-#define __PERIPHERAL_BUS_GPIO_H__
-
-int peripheral_bus_gpio_open(gint pin, pb_data_h *handle, gpointer user_data);
-int peripheral_bus_gpio_set_direction(pb_data_h handle, gint direction);
-int peripheral_bus_gpio_get_direction(pb_data_h handle, gint *direction);
-int peripheral_bus_gpio_set_edge(pb_data_h handle, gint edge);
-int peripheral_bus_gpio_get_edge(pb_data_h handle, gint *edge);
-int peripheral_bus_gpio_write(pb_data_h handle, gint value);
-int peripheral_bus_gpio_read(pb_data_h handle, gint *value);
-int peripheral_bus_gpio_register_irq(pb_data_h handle);
-int peripheral_bus_gpio_unregister_irq(pb_data_h handle);
-int peripheral_bus_gpio_close(pb_data_h handle);
-
-#endif /* __PERIPHERAL_BUS_GPIO_H__ */
diff --git a/src/daemon/peripheral_bus_i2c.h b/src/daemon/peripheral_bus_i2c.h
deleted file mode 100644 (file)
index 9c337b7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_BUS_I2C_H__
-#define __PERIPHERAL_BUS_I2C_H__
-
-int peripheral_bus_i2c_open(int bus, int address, pb_data_h *handle, gpointer user_data);
-int peripheral_bus_i2c_close(pb_data_h handle);
-int peripheral_bus_i2c_read(pb_data_h handle, int length, GVariant **data_array);
-int peripheral_bus_i2c_write(pb_data_h handle, int length, GVariant *data_array);
-int peripheral_bus_i2c_smbus_ioctl(pb_data_h handle, uint8_t read_write, uint8_t command, uint32_t size, uint16_t data_in, uint16_t *data_out);
-
-#endif /* __PERIPHERAL_BUS_I2C_H__ */
diff --git a/src/daemon/peripheral_bus_pwm.h b/src/daemon/peripheral_bus_pwm.h
deleted file mode 100644 (file)
index fbcc6e3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_BUS_PWM_H__
-#define __PERIPHERAL_BUS_PWM_H__
-
-int peripheral_bus_pwm_open(int device, int channel, pb_data_h *handle, gpointer user_data);
-int peripheral_bus_pwm_close(pb_data_h handle);
-int peripheral_bus_pwm_set_period(pb_data_h handle, int period);
-int peripheral_bus_pwm_get_period(pb_data_h handle, int *period);
-int peripheral_bus_pwm_set_duty_cycle(pb_data_h handle, int duty_cycle);
-int peripheral_bus_pwm_get_duty_cycle(pb_data_h handle, int *duty_cycle);
-int peripheral_bus_pwm_set_polarity(pb_data_h handle, int polarity);
-int peripheral_bus_pwm_get_polarity(pb_data_h handle, int *polarity);
-int peripheral_bus_pwm_set_enable(pb_data_h handle, bool enable);
-int peripheral_bus_pwm_get_enable(pb_data_h handle, bool *enable);
-
-#endif /* __PERIPHERAL_BUS_PWM_H__ */
diff --git a/src/daemon/peripheral_bus_spi.h b/src/daemon/peripheral_bus_spi.h
deleted file mode 100644 (file)
index 1140600..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 __PERIPHERAL_BUS_SPI_H__
-#define __PERIPHERAL_BUS_SPI_H__
-
-int peripheral_bus_spi_open(int bus, int cs, pb_data_h *handle, gpointer user_data);
-int peripheral_bus_spi_close(pb_data_h handle);
-int peripheral_bus_spi_set_mode(pb_data_h handle, unsigned char mode);
-int peripheral_bus_spi_get_mode(pb_data_h handle, unsigned char *mode);
-int peripheral_bus_spi_set_lsb_first(pb_data_h handle, gboolean lsb);
-int peripheral_bus_spi_get_lsb_first(pb_data_h handle, gboolean *lsb);
-int peripheral_bus_spi_set_bits(pb_data_h handle, unsigned char bits);
-int peripheral_bus_spi_get_bits(pb_data_h handle, unsigned char *bits);
-int peripheral_bus_spi_set_frequency(pb_data_h handle, unsigned int freq);
-int peripheral_bus_spi_get_frequency(pb_data_h handle, unsigned int *freq);
-int peripheral_bus_spi_read(pb_data_h handle, GVariant **data_array, int length);
-int peripheral_bus_spi_write(pb_data_h handle, GVariant *data_array, int length);
-int peripheral_bus_spi_read_write(pb_data_h handle, GVariant *tx_data_array, GVariant **rx_data_array, int length);
-
-#endif /* __PERIPHERAL_BUS_SPI_H__ */
diff --git a/src/daemon/peripheral_bus_uart.h b/src/daemon/peripheral_bus_uart.h
deleted file mode 100644 (file)
index 680d72a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_BUS_UART_H__
-#define __PERIPHERAL_BUS_UART_H__
-
-int peripheral_bus_uart_open(int port, pb_data_h *handle, gpointer user_data);
-int peripheral_bus_uart_close(pb_data_h handle);
-int peripheral_bus_uart_flush(pb_data_h handle);
-int peripheral_bus_uart_set_baudrate(pb_data_h handle, int baudrate);
-int peripheral_bus_uart_set_mode(pb_data_h handle, int byte_size, int parity, int stop_bits);
-int peripheral_bus_uart_set_flowcontrol(pb_data_h handle, int xonxoff, int rtscts);
-int peripheral_bus_uart_read(pb_data_h handle, GVariant **data_array, int length);
-int peripheral_bus_uart_write(pb_data_h handle, GVariant *data_array, int length);
-
-#endif /* __PERIPHERAL_BUS_UART_H__ */
diff --git a/src/daemon/peripheral_bus_util.h b/src/daemon/peripheral_bus_util.h
deleted file mode 100644 (file)
index 103956b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 __PERIPHERAL_UTIL_H__
-#define __PERIPHERAL_UTIL_H__
-
-GVariant *peripheral_bus_build_variant_ay(uint8_t *data, int length);
-pb_data_h peripheral_bus_data_new(GList **plist);
-int peripheral_bus_data_free(pb_data_h handle);
-
-#endif /* __PERIPHERAL_UTIL_H__ */
diff --git a/src/daemon/peripheral_common.h b/src/daemon/peripheral_common.h
deleted file mode 100644 (file)
index 9c3b8fe..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2016-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 __PERIPHERAL_COMMON_H__
-#define __PERIPHERAL_COMMON_H__
-
-#include <unistd.h>
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG "PERIPHERAL-BUS"
-
-#define _E(fmt, arg...) LOGE(fmt, ##arg)
-#define _D(fmt, arg...) LOGD(fmt, ##arg)
-#define _W(fmt, arg...) LOGW(fmt, ##arg)
-
-#define RET_IF(expr) \
-       do { \
-               if (expr) { \
-                       _E("(%s)", #expr); \
-                       return; \
-               } \
-       } while (0)
-#define RETV_IF(expr, val) \
-       do {\
-               if (expr) { \
-                       _E("(%s)", #expr); \
-                       return (val); \
-               } \
-       } while (0)
-#define RETM_IF(expr, fmt, arg...) \
-       do {\
-               if (expr) { \
-                       _E(fmt, ##arg); \
-                       return; \
-               } \
-       } while (0)
-#define RETVM_IF(expr, val, fmt, arg...) \
-       do {\
-               if (expr) { \
-                       _E(fmt, ##arg); \
-                       return (val); \
-               } \
-       } while (0)
-
-#endif /* __PERIPHERAL_COMMON_H__ */