diff --git a/include/arm/am335x.h b/include/arm/am335x.h index 3339af2..02a74e7 100644 --- a/include/arm/am335x.h +++ b/include/arm/am335x.h @@ -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' diff --git a/src/arm/96boards.c b/src/arm/96boards.c index a0afc68..345c80b 100644 --- a/src/arm/96boards.c +++ b/src/arm/96boards.c @@ -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; diff --git a/src/arm/am335x.c b/src/arm/am335x.c index 6199cb3..6531bc9 100644 --- a/src/arm/am335x.c +++ b/src/arm/am335x.c @@ -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) { diff --git a/src/arm/banana.c b/src/arm/banana.c index 83643bd..88436a6 100644 --- a/src/arm/banana.c +++ b/src/arm/banana.c @@ -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++; diff --git a/src/arm/beaglebone.c b/src/arm/beaglebone.c index 81f48e0..b5ae2ba 100644 --- a/src/arm/beaglebone.c +++ b/src/arm/beaglebone.c @@ -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; } diff --git a/src/arm/phyboard.c b/src/arm/phyboard.c index 7ead282..8842121 100644 --- a/src/arm/phyboard.c +++ b/src/arm/phyboard.c @@ -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"); diff --git a/src/arm/raspberry_pi.c b/src/arm/raspberry_pi.c index 3e20464..b7a12f0 100644 --- a/src/arm/raspberry_pi.c +++ b/src/arm/raspberry_pi.c @@ -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));