arm: fix compiler warnings
There were unused variables, incorrect pointer operations and plan broken string comparison. Now there's only one - for unused uart3_enabled in beaglebone.c, but we want to keep it for declaration consistency. Also fixes #757. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
@@ -63,9 +63,9 @@ mraa_result_t mraa_am335x_mmap_write(mraa_gpio_context dev, int value);
|
||||
/**
|
||||
* Unsetup register of mmap_gpio[]
|
||||
*
|
||||
* @return static mraa_result_t indicating success of actions.
|
||||
* @return mraa_result_t indicating success of actions.
|
||||
*/
|
||||
static mraa_result_t mraa_am335x_mmap_unsetup();
|
||||
mraa_result_t mraa_am335x_mmap_unsetup();
|
||||
|
||||
/**
|
||||
* Read from gpio_context 'dev'
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#define PLATFORM_NAME_DB410C "DB410C"
|
||||
#define PLATFORM_NAME_HIKEY "HIKEY"
|
||||
#define PLATFORM_NAME_BBGUM "BBGUM"
|
||||
#define MAX_SIZE 64
|
||||
|
||||
int db410c_ls_gpio_pins[MRAA_96BOARDS_LS_GPIO_COUNT] = {
|
||||
36, 12, 13, 69, 115, 4, 24, 25, 35, 34, 28, 33,
|
||||
@@ -79,9 +80,8 @@ mraa_96boards_pininfo(mraa_board_t* board, int index, int sysfs_pin, char* fmt,
|
||||
mraa_board_t*
|
||||
mraa_96boards()
|
||||
{
|
||||
int i, pin;
|
||||
int i;
|
||||
int* ls_gpio_pins = NULL;
|
||||
char ch;
|
||||
|
||||
mraa_board_t* b = (mraa_board_t*) calloc(1, sizeof(mraa_board_t));
|
||||
if (b == NULL) {
|
||||
@@ -97,18 +97,18 @@ mraa_96boards()
|
||||
if (mraa_file_contains(DT_BASE "/model", "Qualcomm Technologies, Inc. APQ 8016 SBC")) {
|
||||
b->platform_name = PLATFORM_NAME_DB410C;
|
||||
ls_gpio_pins = db410c_ls_gpio_pins;
|
||||
b->uart_dev[0].device_path = db410c_serialdev[0];
|
||||
b->uart_dev[1].device_path = db410c_serialdev[1];
|
||||
b->uart_dev[0].device_path = (char *)db410c_serialdev[0];
|
||||
b->uart_dev[1].device_path = (char *)db410c_serialdev[1];
|
||||
} else if (mraa_file_contains(DT_BASE "/model", "HiKey Development Board")) {
|
||||
b->platform_name = PLATFORM_NAME_HIKEY;
|
||||
ls_gpio_pins = hikey_ls_gpio_pins;
|
||||
b->uart_dev[0].device_path = hikey_serialdev[0];
|
||||
b->uart_dev[1].device_path = hikey_serialdev[1];
|
||||
b->uart_dev[0].device_path = (char *)hikey_serialdev[0];
|
||||
b->uart_dev[1].device_path = (char *)hikey_serialdev[1];
|
||||
} else if (mraa_file_contains(DT_BASE "/model", "s900")) {
|
||||
b->platform_name = PLATFORM_NAME_BBGUM;
|
||||
ls_gpio_pins = bbgum_ls_gpio_pins;
|
||||
b->uart_dev[0].device_path = bbgum_serialdev[0];
|
||||
b->uart_dev[1].device_path = bbgum_serialdev[1];
|
||||
b->uart_dev[0].device_path = (char *)bbgum_serialdev[0];
|
||||
b->uart_dev[1].device_path = (char *)bbgum_serialdev[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ mraa_96boards()
|
||||
b->def_uart_dev = 0;
|
||||
|
||||
// I2C
|
||||
if (b->platform_name == PLATFORM_NAME_BBGUM) {
|
||||
if (strncmp(b->platform_name, PLATFORM_NAME_BBGUM, MAX_SIZE) == 0) {
|
||||
b->i2c_bus_count = MRAA_96BOARDS_LS_I2C_COUNT;
|
||||
b->def_i2c_bus = 0;
|
||||
b->i2c_bus[0].bus_id = 1;
|
||||
|
||||
@@ -50,7 +50,7 @@ mraa_am335x_mmap_write(mraa_gpio_context dev, int value)
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
static mraa_result_t
|
||||
mraa_result_t
|
||||
mraa_am335x_mmap_unsetup()
|
||||
{
|
||||
if (mmap_gpio[0] == NULL) {
|
||||
|
||||
@@ -107,7 +107,6 @@ mraa_banana_mmap_write(mraa_gpio_context dev, int value)
|
||||
{
|
||||
uint32_t readvalue =
|
||||
*(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET);
|
||||
volatile uint32_t* addr;
|
||||
if (value) {
|
||||
*(volatile uint32_t*) (mmap_reg + SUNXI_GPIO_DAT + (dev->pin / 32) * SUNXI_GPIO_PORT_OFFSET) =
|
||||
(uint32_t)((1 << (dev->pin % 32)) | readvalue);
|
||||
@@ -559,20 +558,20 @@ mraa_banana()
|
||||
b->def_uart_dev = 0;
|
||||
if ((uart3 >= 0) && (platform_detected == PLATFORM_BANANA_PI)) {
|
||||
b->def_uart_dev = b->uart_dev_count;
|
||||
b->uart_dev[b->uart_dev_count].device_path = serialdev[uart3];
|
||||
b->uart_dev[b->uart_dev_count].device_path = (char *)serialdev[uart3];
|
||||
b->uart_dev[b->uart_dev_count].rx = 11;
|
||||
b->uart_dev[b->uart_dev_count].tx = 13;
|
||||
b->uart_dev_count++;
|
||||
}
|
||||
if ((uart4 >= 0) && (platform_detected == PLATFORM_BANANA_PRO)) {
|
||||
b->def_uart_dev = b->uart_dev_count;
|
||||
b->uart_dev[b->uart_dev_count].device_path = serialdev[uart4];
|
||||
b->uart_dev[b->uart_dev_count].device_path = (char *)serialdev[uart4];
|
||||
b->uart_dev[b->uart_dev_count].rx = 10;
|
||||
b->uart_dev[b->uart_dev_count].tx = 8;
|
||||
b->uart_dev_count++;
|
||||
}
|
||||
if (uart7 >= 0) {
|
||||
b->uart_dev[b->uart_dev_count].device_path = serialdev[uart7];
|
||||
b->uart_dev[b->uart_dev_count].device_path = (char *)serialdev[uart7];
|
||||
if (platform_detected == PLATFORM_BANANA_PRO) {
|
||||
b->uart_dev[b->uart_dev_count].rx = 31;
|
||||
b->uart_dev[b->uart_dev_count].tx = 32;
|
||||
@@ -583,7 +582,7 @@ mraa_banana()
|
||||
b->uart_dev_count++;
|
||||
}
|
||||
if (uart2 >= 0) {
|
||||
b->uart_dev[b->uart_dev_count].device_path = serialdev[uart2];
|
||||
b->uart_dev[b->uart_dev_count].device_path = (char *)serialdev[uart2];
|
||||
b->uart_dev[b->uart_dev_count].rx = 11;
|
||||
b->uart_dev[b->uart_dev_count].tx = 13;
|
||||
b->uart_dev_count++;
|
||||
|
||||
@@ -207,13 +207,14 @@ mraa_beaglebone_uart_init_pre(int index)
|
||||
if (!mraa_file_exist(devpath)) {
|
||||
ret = MRAA_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
if (mraa_file_exist(devpath))
|
||||
if (mraa_file_exist(devpath)) {
|
||||
if (set_pin_mode(plat->uart_dev[index].rx, "uart") == MRAA_SUCCESS &&
|
||||
set_pin_mode(plat->uart_dev[index].tx, "uart") == MRAA_SUCCESS) {
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
syslog(LOG_ERR, "uart: Device not initialized");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ mraa_pwm_context
|
||||
mraa_phyboard_pwm_init_replace(int pin)
|
||||
{
|
||||
char devpath[MAX_SIZE];
|
||||
int length = strlen(SYSFS_CLASS_PWM) + 5;
|
||||
|
||||
if (plat == NULL) {
|
||||
syslog(LOG_ERR, "pwm: Platform Not Initialised");
|
||||
|
||||
@@ -117,7 +117,6 @@ mraa_raspberry_pi_i2c_init_pre(unsigned int bus)
|
||||
mraa_result_t
|
||||
mraa_raspberry_pi_mmap_write(mraa_gpio_context dev, int value)
|
||||
{
|
||||
volatile uint32_t* addr;
|
||||
if (value) {
|
||||
*(volatile uint32_t*) (mmap_reg + BCM283X_GPSET0 + (dev->pin / 32) * 4) =
|
||||
(uint32_t)(1 << (dev->pin % 32));
|
||||
|
||||
Reference in New Issue
Block a user