From 569aed843bae56169259f3af12fe1a418b148b5e Mon Sep 17 00:00:00 2001 From: baiywt Date: Mon, 20 May 2019 13:14:05 +0800 Subject: [PATCH] Fixed the problem that pin values could not be read for RK3399 --- wiringPi/OrangePi.c | 6 +++--- wiringPi/OrangePi.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c index 10abd09..7009bcb 100755 --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -1511,11 +1511,11 @@ int OrangePi_digitalRead(int pin) #elif CONFIG_ORANGEPI_RK3399 unsigned int phyaddr; if(bank == 1) - phyaddr = GPIO1_BASE + GPIO_SWPORTA_DR_OFFSET; + phyaddr = GPIO1_BASE + GPIO_EXT_PORTA_OFFSET; else if(bank == 2) - phyaddr = GPIO2_BASE + GPIO_SWPORTA_DR_OFFSET; + phyaddr = GPIO2_BASE + GPIO_EXT_PORTA_OFFSET; else if(bank == 4) - phyaddr = GPIO4_BASE + GPIO_SWPORTA_DR_OFFSET; + phyaddr = GPIO4_BASE + GPIO_EXT_PORTA_OFFSET; else; #endif diff --git a/wiringPi/OrangePi.h b/wiringPi/OrangePi.h index 0433947..78bc5de 100755 --- a/wiringPi/OrangePi.h +++ b/wiringPi/OrangePi.h @@ -86,6 +86,7 @@ #define GPIO_BIT(x) (1UL << (x)) #define GPIO_SWPORTA_DR_OFFSET 0x00 #define GPIO_SWPORTA_DDR_OFFSET 0x04 +#define GPIO_EXT_PORTA_OFFSET 0x50 #define PMUGRF_BASE 0xff320000 #define PMUGRF_GPIO1A_IOMUX 0x00010