interface: change the type of parameters in interface functions. 75/159975/4
authorSegwon <segwon.han@samsung.com>
Tue, 14 Nov 2017 04:19:48 +0000 (13:19 +0900)
committerSegwon <segwon.han@samsung.com>
Tue, 14 Nov 2017 08:24:56 +0000 (17:24 +0900)
 - it matches the parameter type of the API

Change-Id: I79d7b66fb917affd4398c1609b367859bc5da3bc
Signed-off-by: Segwon <segwon.han@samsung.com>
include/interface/peripheral_interface_gpio.h
include/interface/peripheral_interface_i2c.h
include/interface/peripheral_interface_pwm.h
include/interface/peripheral_interface_spi.h
include/interface/peripheral_interface_uart.h
src/interface/peripheral_interface_gpio.c
src/interface/peripheral_interface_i2c.c
src/interface/peripheral_interface_pwm.c
src/interface/peripheral_interface_spi.c
src/interface/peripheral_interface_uart.c

index 9792a1c..cc68e92 100644 (file)
@@ -25,8 +25,8 @@
 int peripheral_interface_gpio_close(peripheral_gpio_h gpio);
 int peripheral_interface_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge);
 int peripheral_interface_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction);
-int peripheral_interface_gpio_write(peripheral_gpio_h gpio, int value);
-int peripheral_interface_gpio_read(peripheral_gpio_h gpio, int *value);
+int peripheral_interface_gpio_write(peripheral_gpio_h gpio, uint32_t value);
+int peripheral_interface_gpio_read(peripheral_gpio_h gpio, uint32_t *value);
 
 int peripheral_interface_gpio_open_isr(peripheral_gpio_h gpio);
 int peripheral_interface_gpio_close_isr(peripheral_gpio_h gpio);
index b41c555..67c7019 100644 (file)
@@ -59,8 +59,8 @@ struct i2c_smbus_ioctl_data {
 
 int peripheral_interface_i2c_close(peripheral_i2c_h i2c);
 int peripheral_interface_i2c_set_address(peripheral_i2c_h i2c, int address);
-int peripheral_interface_i2c_read(peripheral_i2c_h i2c, unsigned char *data, int length);
-int peripheral_interface_i2c_write(peripheral_i2c_h i2c, const unsigned char *data, int length);
+int peripheral_interface_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length);
+int peripheral_interface_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length);
 int peripheral_interface_i2c_smbus_ioctl(peripheral_i2c_h i2c, struct i2c_smbus_ioctl_data *data);
 
 #endif/* __PERIPHERAL_INTERFACE_I2C_H__ */
index e45c2d6..0867663 100644 (file)
@@ -36,7 +36,7 @@ int peripheral_interface_pwm_close(peripheral_pwm_h pwm);
 * @param[in] period pwm period
 * @return On success, 0 is returned. On failure, a negative value is returned.
 */
-int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, int period);
+int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period);
 
 /**
 * @brief pwm_set_duty_cycle() sets the pwm duty cycle.
@@ -46,7 +46,7 @@ int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, int period);
 * @param[in] duty_cycle pwm duty cycle
 * @return On success, 0 is returned. On failure, a negative value is returned.
 */
-int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle);
+int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle);
 
 /**
 * @brief pwm_set_polarity() sets the pwm polarity.
index 2cee142..d7a471d 100644 (file)
 int peripheral_interface_spi_close(peripheral_spi_h spi);
 int peripheral_interface_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode);
 int peripheral_interface_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order);
-int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, unsigned char bits);
-int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, unsigned int freq);
-int peripheral_interface_spi_read(peripheral_spi_h spi, unsigned char *rxbuf, int length);
-int peripheral_interface_spi_write(peripheral_spi_h spi, unsigned char *txbuf, int length);
-int peripheral_interface_spi_transfer(peripheral_spi_h spi, unsigned char *txbuf, unsigned char *rxbuf, int length);
+int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits);
+int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, uint32_t freq);
+int peripheral_interface_spi_read(peripheral_spi_h spi, uint8_t *rxbuf, uint32_t length);
+int peripheral_interface_spi_write(peripheral_spi_h spi, uint8_t *txbuf, uint32_t length);
+int peripheral_interface_spi_transfer(peripheral_spi_h spi, uint8_t *txbuf, uint8_t *rxbuf, uint32_t length);
 
 #endif /* __PERIPHERAL_INTERFACE_SPI_H__ */
index 5541618..4648ae1 100644 (file)
@@ -91,7 +91,7 @@ int peripheral_interface_uart_set_flow_control(peripheral_uart_h uart, periphera
 * @param[in] length size to read
 * @return On success, 0 is returned. On failure, a negative value is returned.
 */
-int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, unsigned int length);
+int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, uint32_t length);
 
 /**
 * @brief uart_write() writes data over uart bus.
@@ -101,7 +101,7 @@ int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, unsigne
 * @param[in] length size to write
 * @return On success, 0 is returned. On failure, a negative value is returned.
 */
-int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, unsigned int length);
+int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, uint32_t length);
 
 #endif /* __PERIPHERAL_INTERFACE_UART_H__ */
 
index 24c1837..e2ce235 100644 (file)
@@ -76,7 +76,7 @@ int peripheral_interface_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_g
        return 0;
 }
 
-int peripheral_interface_gpio_write(peripheral_gpio_h gpio, int value)
+int peripheral_interface_gpio_write(peripheral_gpio_h gpio, uint32_t value)
 {
        int status;
 
@@ -97,7 +97,7 @@ int peripheral_interface_gpio_write(peripheral_gpio_h gpio, int value)
        return 0;
 }
 
-int peripheral_interface_gpio_read(peripheral_gpio_h gpio, int *value)
+int peripheral_interface_gpio_read(peripheral_gpio_h gpio, uint32_t *value)
 {
        int len;
        char gpio_buf[GPIO_BUFFER_MAX] = {0, };
index 9da17bd..cc703fe 100644 (file)
@@ -64,7 +64,7 @@ int peripheral_interface_i2c_set_address(peripheral_i2c_h i2c, int address)
        return 0;
 }
 
-int peripheral_interface_i2c_read(peripheral_i2c_h i2c, unsigned char *data, int length)
+int peripheral_interface_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
 {
        int status;
 
@@ -81,7 +81,7 @@ int peripheral_interface_i2c_read(peripheral_i2c_h i2c, unsigned char *data, int
        return 0;
 }
 
-int peripheral_interface_i2c_write(peripheral_i2c_h i2c, const unsigned char *data, int length)
+int peripheral_interface_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length)
 {
        int status;
 
index da6cbca..822332b 100644 (file)
@@ -63,7 +63,7 @@ int peripheral_interface_pwm_close(peripheral_pwm_h pwm)
        return 0;
 }
 
-int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, int period)
+int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period)
 {
        int len, status;
        char pwm_buf[PWM_BUF_MAX] = {0};
@@ -78,7 +78,7 @@ int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, int period)
        return 0;
 }
 
-int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle)
+int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle)
 {
        int len, status;
        char pwm_buf[PWM_BUF_MAX] = {0};
index 1ea88de..ddc643c 100644 (file)
@@ -86,7 +86,7 @@ int peripheral_interface_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_
        return 0;
 }
 
-int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, unsigned char bits)
+int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits)
 {
        int status;
 
@@ -104,7 +104,7 @@ int peripheral_interface_spi_set_bits_per_word(peripheral_spi_h spi, unsigned ch
        return 0;
 }
 
-int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, unsigned int freq)
+int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, uint32_t freq)
 {
        int status;
 
@@ -122,7 +122,7 @@ int peripheral_interface_spi_set_frequency(peripheral_spi_h spi, unsigned int fr
        return 0;
 }
 
-int peripheral_interface_spi_read(peripheral_spi_h spi, unsigned char *rxbuf, int length)
+int peripheral_interface_spi_read(peripheral_spi_h spi, uint8_t *rxbuf, uint32_t length)
 {
        int status;
        struct spi_ioc_transfer xfer;
@@ -144,7 +144,7 @@ int peripheral_interface_spi_read(peripheral_spi_h spi, unsigned char *rxbuf, in
        return 0;
 }
 
-int peripheral_interface_spi_write(peripheral_spi_h spi, unsigned char *txbuf, int length)
+int peripheral_interface_spi_write(peripheral_spi_h spi, uint8_t *txbuf, uint32_t length)
 {
        int status;
        struct spi_ioc_transfer xfer;
@@ -166,14 +166,14 @@ int peripheral_interface_spi_write(peripheral_spi_h spi, unsigned char *txbuf, i
        return 0;
 }
 
-int peripheral_interface_spi_transfer(peripheral_spi_h spi, unsigned char *txbuf, unsigned char *rxbuf, int length)
+int peripheral_interface_spi_transfer(peripheral_spi_h spi, uint8_t *txbuf, uint8_t *rxbuf, uint32_t length)
 {
        int status;
        struct spi_ioc_transfer xfer;
 
        RETVM_IF(spi->fd < 0, -EINVAL, "Invalid fd : %d", spi->fd);
 
-       if (!txbuf || !rxbuf || length < 0) return -EINVAL;
+       if (!txbuf || !rxbuf) return -EINVAL;
 
        memset(&xfer, 0, sizeof(xfer));
        xfer.tx_buf = (unsigned long)txbuf;
index 49f9346..4933ab4 100644 (file)
@@ -328,7 +328,7 @@ int peripheral_interface_uart_set_flow_control(peripheral_uart_h uart, periphera
        return 0;
 }
 
-int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, unsigned int length)
+int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
 {
        int ret;
 
@@ -350,7 +350,7 @@ int peripheral_interface_uart_read(peripheral_uart_h uart, uint8_t *buf, unsigne
        return ret;
 }
 
-int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, unsigned int length)
+int peripheral_interface_uart_write(peripheral_uart_h uart, uint8_t *buf, uint32_t length)
 {
        int ret;