From 7e9d52a11322171f21a19d17244b72d7d81a040f Mon Sep 17 00:00:00 2001 From: Segwon Date: Tue, 14 Nov 2017 13:19:48 +0900 Subject: [PATCH] interface: change the type of parameters in interface functions. - it matches the parameter type of the API Change-Id: I79d7b66fb917affd4398c1609b367859bc5da3bc Signed-off-by: Segwon --- include/interface/peripheral_interface_gpio.h | 4 ++-- include/interface/peripheral_interface_i2c.h | 4 ++-- include/interface/peripheral_interface_pwm.h | 4 ++-- include/interface/peripheral_interface_spi.h | 10 +++++----- include/interface/peripheral_interface_uart.h | 4 ++-- src/interface/peripheral_interface_gpio.c | 4 ++-- src/interface/peripheral_interface_i2c.c | 4 ++-- src/interface/peripheral_interface_pwm.c | 4 ++-- src/interface/peripheral_interface_spi.c | 12 ++++++------ src/interface/peripheral_interface_uart.c | 4 ++-- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/interface/peripheral_interface_gpio.h b/include/interface/peripheral_interface_gpio.h index 9792a1c..cc68e92 100644 --- a/include/interface/peripheral_interface_gpio.h +++ b/include/interface/peripheral_interface_gpio.h @@ -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); diff --git a/include/interface/peripheral_interface_i2c.h b/include/interface/peripheral_interface_i2c.h index b41c555..67c7019 100644 --- a/include/interface/peripheral_interface_i2c.h +++ b/include/interface/peripheral_interface_i2c.h @@ -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__ */ diff --git a/include/interface/peripheral_interface_pwm.h b/include/interface/peripheral_interface_pwm.h index e45c2d6..0867663 100644 --- a/include/interface/peripheral_interface_pwm.h +++ b/include/interface/peripheral_interface_pwm.h @@ -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. diff --git a/include/interface/peripheral_interface_spi.h b/include/interface/peripheral_interface_spi.h index 2cee142..d7a471d 100644 --- a/include/interface/peripheral_interface_spi.h +++ b/include/interface/peripheral_interface_spi.h @@ -22,10 +22,10 @@ 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__ */ diff --git a/include/interface/peripheral_interface_uart.h b/include/interface/peripheral_interface_uart.h index 5541618..4648ae1 100644 --- a/include/interface/peripheral_interface_uart.h +++ b/include/interface/peripheral_interface_uart.h @@ -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__ */ diff --git a/src/interface/peripheral_interface_gpio.c b/src/interface/peripheral_interface_gpio.c index 24c1837..e2ce235 100644 --- a/src/interface/peripheral_interface_gpio.c +++ b/src/interface/peripheral_interface_gpio.c @@ -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, }; diff --git a/src/interface/peripheral_interface_i2c.c b/src/interface/peripheral_interface_i2c.c index 9da17bd..cc703fe 100644 --- a/src/interface/peripheral_interface_i2c.c +++ b/src/interface/peripheral_interface_i2c.c @@ -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; diff --git a/src/interface/peripheral_interface_pwm.c b/src/interface/peripheral_interface_pwm.c index da6cbca..822332b 100644 --- a/src/interface/peripheral_interface_pwm.c +++ b/src/interface/peripheral_interface_pwm.c @@ -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}; diff --git a/src/interface/peripheral_interface_spi.c b/src/interface/peripheral_interface_spi.c index 1ea88de..ddc643c 100644 --- a/src/interface/peripheral_interface_spi.c +++ b/src/interface/peripheral_interface_spi.c @@ -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; diff --git a/src/interface/peripheral_interface_uart.c b/src/interface/peripheral_interface_uart.c index 49f9346..4933ab4 100644 --- a/src/interface/peripheral_interface_uart.c +++ b/src/interface/peripheral_interface_uart.c @@ -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; -- 2.7.4