mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-05 04:47:14 +02:00
263 lines
10 KiB
Diff
263 lines
10 KiB
Diff
Patch-Source: https://github.com/wiringX/wiringX/pull/128
|
|
From b437b14372d903a264eafab0b59023126871c136 Mon Sep 17 00:00:00 2001
|
|
From: amazingfate <liujianfeng1994@gmail.com>
|
|
Date: Thu, 2 Jan 2025 17:02:56 +0800
|
|
Subject: [PATCH] fix compile warnings
|
|
|
|
---
|
|
CMakeLists.txt | 1 +
|
|
src/i2c-dev.h | 1 +
|
|
src/soc/rockchip/common.c | 4 ++--
|
|
src/soc/rockchip/rk3399.c | 24 ++++++++++++------------
|
|
src/soc/rockchip/rk3588.c | 24 ++++++++++++------------
|
|
src/soc/sophgo/cv180x.c | 18 +++++++++---------
|
|
6 files changed, 37 insertions(+), 35 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 89093934..9a0485dd 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -74,6 +74,7 @@ execute_process(COMMAND git log --oneline
|
|
|
|
STRING(REGEX REPLACE "\n" "" git_ver "${git_ver}")
|
|
add_definitions(-DHASH="${git_ver}")
|
|
+add_definitions(-fgnu89-inline)
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src/)
|
|
|
|
diff --git a/src/i2c-dev.h b/src/i2c-dev.h
|
|
index 2aa92cac..99b0ffcf 100644
|
|
--- a/src/i2c-dev.h
|
|
+++ b/src/i2c-dev.h
|
|
@@ -16,6 +16,7 @@
|
|
#include <sys/ioctl.h>
|
|
#include <linux/types.h>
|
|
#include <linux/i2c.h>
|
|
+#include <string.h>
|
|
|
|
#define I2C_SLAVE 0x0703
|
|
#define I2C_SMBUS 0x0720
|
|
diff --git a/src/soc/rockchip/common.c b/src/soc/rockchip/common.c
|
|
index c65f1bc2..c9deaf8b 100644
|
|
--- a/src/soc/rockchip/common.c
|
|
+++ b/src/soc/rockchip/common.c
|
|
@@ -54,7 +54,7 @@ struct layout_t *rockchipGetLayout(struct soc_t *soc, int i, int *mapping) {
|
|
|
|
int rockchipDigitalRead(struct soc_t *soc, int i) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *data_reg = NULL;
|
|
+ volatile unsigned int *data_reg = NULL;
|
|
uint32_t val = 0;
|
|
|
|
if((pin = rockchipGetPinLayout(soc, i)) == NULL) {
|
|
@@ -153,7 +153,7 @@ int rockchipGC(struct soc_t *soc) {
|
|
int rockchipSelectableFd(struct soc_t *soc, int i) {
|
|
struct layout_t *pin = NULL;
|
|
|
|
- if((pin = rockchipGetIrqLayout(soc, (i)) == NULL)) {
|
|
+ if((pin = rockchipGetIrqLayout(soc,i)) == NULL) {
|
|
return -1;
|
|
}
|
|
|
|
diff --git a/src/soc/rockchip/rk3399.c b/src/soc/rockchip/rk3399.c
|
|
index 069142bf..b0a0f2f2 100644
|
|
--- a/src/soc/rockchip/rk3399.c
|
|
+++ b/src/soc/rockchip/rk3399.c
|
|
@@ -18,10 +18,10 @@ const static uintptr_t gpio_register_physical_address[MAX_REG_AREA] = {0xff72000
|
|
#define GPIO_SWPORTA_DDR 0x0004 // GPIO direction control register offset
|
|
#define GPIO_EXT_PORTA 0x0050 // GPIO data read register offset
|
|
|
|
-static uintptr_t pmucru_register_virtual_address = NULL;
|
|
-static uintptr_t cru_register_virtual_address = NULL;
|
|
-static uintptr_t pmugrf_register_virtual_address = NULL;
|
|
-static uintptr_t grf_register_virtual_address = NULL;
|
|
+static unsigned char *pmucru_register_virtual_address = NULL;
|
|
+static unsigned char *cru_register_virtual_address = NULL;
|
|
+static unsigned char *pmugrf_register_virtual_address = NULL;
|
|
+static unsigned char *grf_register_virtual_address = NULL;
|
|
#define PMUCRU_REGISTER_PHYSICAL_ADDRESS 0xff750000
|
|
#define CRU_REGISTER_PHYSICAL_ADDRESS 0xff760000
|
|
#define PMUGRF_REGISTER_PHYSICAL_ADDRESS 0xff320000
|
|
@@ -265,7 +265,7 @@ struct layout_t *rk3399GetLayout(int i, int *mapping) {
|
|
|
|
static int rk3399DigitalWrite(int i, enum digital_value_t value) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *data_reg = 0;
|
|
+ volatile unsigned int *data_reg = 0;
|
|
|
|
if((pin = rockchipGetPinLayout(rk3399, i)) == NULL) {
|
|
return -1;
|
|
@@ -295,9 +295,9 @@ static int rk3399DigitalRead(int i) {
|
|
|
|
static int rk3399PinMode(int i, enum pinmode_t mode) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *cru_reg = NULL;
|
|
- unsigned int *grf_reg = NULL;
|
|
- unsigned int *dir_reg = NULL;
|
|
+ volatile unsigned int *cru_reg = NULL;
|
|
+ volatile unsigned int *grf_reg = NULL;
|
|
+ volatile unsigned int *dir_reg = NULL;
|
|
|
|
if((pin = rockchipGetPinLayout(rk3399, i)) == NULL) {
|
|
return -1;
|
|
@@ -349,19 +349,19 @@ static int rk3399GC(void) {
|
|
rockchipGC(rk3399);
|
|
|
|
if(cru_register_virtual_address != NULL) {
|
|
- munmap(cru_register_virtual_address, rk3399->page_size);
|
|
+ munmap((void*)cru_register_virtual_address, rk3399->page_size);
|
|
cru_register_virtual_address = NULL;
|
|
}
|
|
if(pmucru_register_virtual_address != NULL) {
|
|
- munmap(pmucru_register_virtual_address, rk3399->page_size);
|
|
+ munmap((void*)pmucru_register_virtual_address, rk3399->page_size);
|
|
pmucru_register_virtual_address = NULL;
|
|
}
|
|
if(pmugrf_register_virtual_address != NULL) {
|
|
- munmap(pmugrf_register_virtual_address, rk3399->page_size);
|
|
+ munmap((void*)pmugrf_register_virtual_address, rk3399->page_size);
|
|
pmugrf_register_virtual_address = NULL;
|
|
}
|
|
if(grf_register_virtual_address != NULL) {
|
|
- munmap(grf_register_virtual_address, rk3399->page_size);
|
|
+ munmap((void*)grf_register_virtual_address, rk3399->page_size);
|
|
grf_register_virtual_address = NULL;
|
|
}
|
|
for(int i = 0; i < GPIO_BANK_COUNT; i++) {
|
|
diff --git a/src/soc/rockchip/rk3588.c b/src/soc/rockchip/rk3588.c
|
|
index a309ce46..e278c480 100644
|
|
--- a/src/soc/rockchip/rk3588.c
|
|
+++ b/src/soc/rockchip/rk3588.c
|
|
@@ -15,10 +15,10 @@
|
|
|
|
const uintptr_t rk3588_gpio_register_physical_address[MAX_REG_AREA] = {0xfd8a0000, 0xfec20000, 0xfec30000, 0xfec40000, 0xfec50000};
|
|
|
|
-uintptr_t cru_ns_register_virtual_address = NULL;
|
|
-uintptr_t pmu1_ioc_register_virtual_address = NULL;
|
|
-uintptr_t pmu2_ioc_register_virtual_address = NULL;
|
|
-uintptr_t bus_ioc_register_virtual_address = NULL;
|
|
+unsigned char *cru_ns_register_virtual_address = NULL;
|
|
+unsigned char *pmu1_ioc_register_virtual_address = NULL;
|
|
+unsigned char *pmu2_ioc_register_virtual_address = NULL;
|
|
+unsigned char *bus_ioc_register_virtual_address = NULL;
|
|
#define CRU_NS_REGISTER_PHYSICAL_ADDRESS 0xfd7c0000
|
|
#define PMU1_IOC_REGISTER_PHYSICAL_ADDRESS 0xfd5f0000
|
|
#define PMU2_IOC_REGISTER_PHYSICAL_ADDRESS 0xfd5f4000
|
|
@@ -288,7 +288,7 @@ struct layout_t * rk3588GetLayout(int i, int* mapping) {
|
|
|
|
static int rk3588DigitalWrite(int i, enum digital_value_t value) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *out_reg = 0;
|
|
+ volatile unsigned int *out_reg = 0;
|
|
|
|
if((pin = rockchipGetPinLayout(rk3588, i)) == NULL) {
|
|
return -1;
|
|
@@ -319,9 +319,9 @@ static int rk3588DigitalRead(int i) {
|
|
|
|
static int rk3588PinMode(int i, enum pinmode_t mode) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *cru_reg = NULL;
|
|
- unsigned int *grf_reg = NULL;
|
|
- unsigned int *dir_reg = NULL;
|
|
+ volatile unsigned int *cru_reg = NULL;
|
|
+ volatile unsigned int *grf_reg = NULL;
|
|
+ volatile unsigned int *dir_reg = NULL;
|
|
|
|
if((pin = rockchipGetPinLayout(rk3588, i)) == NULL) {
|
|
return -1;
|
|
@@ -369,19 +369,19 @@ static int rk3588GC(void) {
|
|
rockchipGC(rk3588);
|
|
|
|
if(cru_ns_register_virtual_address != NULL) {
|
|
- munmap(cru_ns_register_virtual_address, rk3588->page_size);
|
|
+ munmap((void*)cru_ns_register_virtual_address, rk3588->page_size);
|
|
cru_ns_register_virtual_address = NULL;
|
|
}
|
|
if(pmu1_ioc_register_virtual_address != NULL) {
|
|
- munmap(pmu1_ioc_register_virtual_address, rk3588->page_size);
|
|
+ munmap((void*)pmu1_ioc_register_virtual_address, rk3588->page_size);
|
|
pmu1_ioc_register_virtual_address = NULL;
|
|
}
|
|
if(pmu2_ioc_register_virtual_address != NULL) {
|
|
- munmap(pmu2_ioc_register_virtual_address, rk3588->page_size);
|
|
+ munmap((void*)pmu2_ioc_register_virtual_address, rk3588->page_size);
|
|
pmu2_ioc_register_virtual_address = NULL;
|
|
}
|
|
if(bus_ioc_register_virtual_address != NULL) {
|
|
- munmap(bus_ioc_register_virtual_address, rk3588->page_size);
|
|
+ munmap((void*)bus_ioc_register_virtual_address, rk3588->page_size);
|
|
bus_ioc_register_virtual_address = NULL;
|
|
}
|
|
for(int i = 0; i < GPIO_BANK_COUNT; i++) {
|
|
diff --git a/src/soc/sophgo/cv180x.c b/src/soc/sophgo/cv180x.c
|
|
index 26c9985a..59bf872c 100644
|
|
--- a/src/soc/sophgo/cv180x.c
|
|
+++ b/src/soc/sophgo/cv180x.c
|
|
@@ -34,7 +34,7 @@ const static uintptr_t gpio_register_physical_address[MAX_REG_AREA] = {0x0302000
|
|
#define GPIO_SWPORTA_DDR 0x004
|
|
#define GPIO_EXT_PORTA 0x050
|
|
|
|
-static uintptr_t pinmux_register_virtual_address = NULL;
|
|
+static unsigned char *pinmux_register_virtual_address = NULL;
|
|
|
|
#define PINMUX_BASE 0x03001000 // pinmux group 1
|
|
|
|
@@ -270,7 +270,7 @@ struct layout_t *cv180xGetLayout(int i, int *mapping) {
|
|
|
|
static int cv180xDigitalWrite(int i, enum digital_value_t value) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *data_reg = 0;
|
|
+ volatile unsigned int *data_reg = 0;
|
|
uint32_t val = 0;
|
|
|
|
if((pin = cv180xGetPinLayout(i)) == NULL) {
|
|
@@ -297,7 +297,7 @@ static int cv180xDigitalWrite(int i, enum digital_value_t value) {
|
|
|
|
static int cv180xDigitalRead(int i) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *data_reg = NULL;
|
|
+ volatile unsigned int *data_reg = NULL;
|
|
uint32_t val = 0;
|
|
|
|
if((pin = cv180xGetPinLayout(i)) == NULL) {
|
|
@@ -317,8 +317,8 @@ static int cv180xDigitalRead(int i) {
|
|
|
|
static int cv180xPinMode(int i, enum pinmode_t mode) {
|
|
struct layout_t *pin = NULL;
|
|
- unsigned int *pinmux_reg = NULL;
|
|
- unsigned int *dir_reg = NULL;
|
|
+ volatile unsigned int *pinmux_reg = NULL;
|
|
+ volatile unsigned int *dir_reg = NULL;
|
|
unsigned int mask = 0;
|
|
|
|
if((pin = cv180xGetPinLayout(i)) == NULL) {
|
|
@@ -360,17 +360,17 @@ static int cv180xISR(int i, enum isr_mode_t mode) {
|
|
}
|
|
}
|
|
|
|
- sprintf(path, "/sys/devices/platform/%x.gpio/gpiochip%d/gpio/gpio%d/direction", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
+ sprintf(path, "/sys/devices/platform/%lx.gpio/gpiochip%d/gpio/gpio%d/direction", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
if(soc_sysfs_set_gpio_direction(cv180x, path, "in") == -1) {
|
|
return -1;
|
|
}
|
|
|
|
- sprintf(path, "/sys/devices/platform/%x.gpio/gpiochip%d/gpio/gpio%d/edge", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
+ sprintf(path, "/sys/devices/platform/%lx.gpio/gpiochip%d/gpio/gpio%d/edge", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
if(soc_sysfs_set_gpio_interrupt_mode(cv180x, path, mode) == -1) {
|
|
return -1;
|
|
}
|
|
|
|
- sprintf(path, "/sys/devices/platform/%x.gpio/gpiochip%d/gpio/gpio%d/value", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
+ sprintf(path, "/sys/devices/platform/%lx.gpio/gpiochip%d/gpio/gpio%d/value", gpio_register_physical_address[pin->gpio_group], pin->gpio_group, pin->num);
|
|
if((pin->fd = soc_sysfs_gpio_reset_value(cv180x, path)) == -1) {
|
|
return -1;
|
|
}
|
|
@@ -422,7 +422,7 @@ static int cv180xGC(void) {
|
|
}
|
|
|
|
if(pinmux_register_virtual_address != NULL) {
|
|
- munmap(pinmux_register_virtual_address, cv180x->page_size);
|
|
+ munmap((void*)pinmux_register_virtual_address, cv180x->page_size);
|
|
pinmux_register_virtual_address = NULL;
|
|
}
|
|
for(i = 0; i < CV180X_GPIO_GROUP_COUNT; i++) {
|