From 0a7284942375ff68a9940c44234b6d6ec5f7aa59 Mon Sep 17 00:00:00 2001 From: baiywt Date: Wed, 12 Jan 2022 20:24:40 +0800 Subject: [PATCH] Support Orange Pi 4 LTS --- build | 1 + gpio/Makefile | 4 ++ gpio/OrangePi.c | 93 +++++++++++++++++++++++++++++- wiringPi/Makefile | 4 ++ wiringPi/OrangePi.c | 137 ++++++++++++++++++++++++++++++++++++++------ wiringPi/OrangePi.h | 4 +- wiringPi/wiringPi.c | 10 ++-- 7 files changed, 227 insertions(+), 26 deletions(-) diff --git a/build b/build index 4c9b9b7..e62f18f 100755 --- a/build +++ b/build @@ -72,6 +72,7 @@ select_boards() "orangepilite2" "orangepioneplus" "orangepi4" + "orangepi4-lts" "orangepirk3399" "orangepi800" "orangepizero2" diff --git a/gpio/Makefile b/gpio/Makefile index 09564ca..2ac4070 100755 --- a/gpio/Makefile +++ b/gpio/Makefile @@ -99,6 +99,10 @@ ifeq ($(BOARD), orangepi4) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 endif +ifeq ($(BOARD), orangepi4-lts) +EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4_LTS +endif + ifeq ($(BOARD), orangepi800) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800 endif diff --git a/gpio/OrangePi.c b/gpio/OrangePi.c index e7076b8..f845c29 100755 --- a/gpio/OrangePi.c +++ b/gpio/OrangePi.c @@ -1009,6 +1009,93 @@ char *physNames[64] = }; #endif +#ifdef CONFIG_ORANGEPI_4_LTS +int pinToGpioOrangePi [64] = +{ + 52, 53, // 0, 1 + 150, 145, // 2, 3 + 144, 33, // 4 5 + 50, 35, // 6, 7 + 92, 54, // 8, 9 + 55, 40, //10,11 + 39, 56, //12,13 + 41, 42, //14,15 + 149, 64, //16,17 + 65, -1, //18,19 + -1, -1, //20,21 + -1, -1, //22,23 + -1, -1, //24,25 + -1, -1, //26,27 + -1, -1, //28,29 + -1, -1, //30,31 + + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,// ... 63 +}; +int physToWpi[64] = +{ + -1, // 0 + -1, -1, // 1, 2 + 0, -1, //3, 4 + 1, -1, //5, 6 + 2, 3, //7, 8 + -1, 4, //9,10 + 5, 6, //11,12 + 7, -1, //13,14 + 8, 9, //15,16 + -1, 10, //17,18 + 11, -1, //19,20 + 12, 13, //21,22 + 14, 15, //23, 24 + -1, 16, // 25, 26 + + -1, -1, //27, 28 + -1, -1, //29, 30 + -1, -1, //31, 32 + -1, -1, //33, 34 + -1, -1, //35, 36 + -1, -1, //37, 38 + -1, -1, //39, 40 + // Padding: + + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56 + -1, -1, -1, -1, -1, -1, -1, // ... 63 +}; + +char *physNames[64] = +{ + NULL, + " 3.3V", "5V ", + "I2C8_SDA", "5V ", + "I2C8_SCL", "GND ", + " PWM1", "I2C3_SCL", + " GND", "I2C3_SDA", + "GPIO1_A1", "GPIO1_C2", + "GPIO1_A3", "GND ", + "GPIO2_D4", "GPIO1_C6", + " 3.3V", "GPIO1_C7", + "SPI1_TXD", "GND ", + "SPI1_RXD", "GPIO1_D0", + "SPI1_CLK", "SPI1_CS ", + " GND", "GPIO4_C5", + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +}; +#endif + #ifdef CONFIG_ORANGEPI_R1PLUS int physToWpi[64] = { @@ -1117,6 +1204,8 @@ void OrangePiReadAll(void) printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); +#elif CONFIG_ORANGEPI_4_LTS + printf (" +------+-----+----------+------+---+OPi 4 LTS +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_800 printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_R1PLUS @@ -1129,7 +1218,7 @@ void OrangePiReadAll(void) #if defined CONFIG_ORANGEPI_H3 || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_PRIME || CONFIG_ORANGEPI_WIN for (pin = 1 ; pin <= 40; pin += 2) -#elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_ZEROPLUS2_H3 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_R1 || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_800 +#elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_ZEROPLUS2_H3 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_R1 || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_800 || CONFIG_ORANGEPI_4_LTS for (pin = 1 ; pin <= 26; pin += 2) #elif CONFIG_ORANGEPI_R1PLUS @@ -1171,6 +1260,8 @@ void OrangePiReadAll(void) printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); +#elif CONFIG_ORANGEPI_4_LTS + printf (" +------+-----+----------+------+---+OPi 4 LTS +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_800 printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_R1PLUS diff --git a/wiringPi/Makefile b/wiringPi/Makefile index b031140..10d3087 100755 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -104,6 +104,10 @@ ifeq ($(BOARD), orangepi4) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 endif +ifeq ($(BOARD), orangepi4-lts) +EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4_LTS +endif + ifeq ($(BOARD), orangepi800) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800 endif diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c index 364d796..e141250 100755 --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -1345,6 +1345,107 @@ volatile uint32_t *gpio4_base; #endif /* CONFIG_ORANGEPI_4 */ // add 2019.1.8 +#ifdef CONFIG_ORANGEPI_4_LTS +int pinToGpioOrangePi [64] = +{ + 52, 53, // 0, 1 + 150, 145, // 2, 3 + 144, 33, // 4 5 + 50, 35, // 6, 7 + 92, 54, // 8, 9 + 55, 40, //10,11 + 39, 56, //12,13 + 41, 42, //14,15 + 149, 64, //16,17 + 65, -1, //18,19 + -1, -1, //20,21 + -1, -1, //22,23 + -1, -1, //24,25 + -1, -1, //26,27 + -1, -1, //28,29 + -1, -1, //30,31 + + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,// ... 63 + +}; + +int physToGpioOrangePi[64] =//head num map to OrangePi +{ + -1, // 0 + -1, -1, // 1, 2 + 64, -1, // 3, 4 + 65, -1, // 5, 6 + 150, 145, // 7, 8 + -1, 144, // 9, 10 + 33, 50, // 11, 12 + 35, -1, // 13, 14 + 92, 54, // 15, 16 + -1, 55, // 17, 18 + 40, -1, // 19, 20 + 39, 56, // 21, 22 + 41, 42, // 23, 24 + -1, 149, // 25, 26 + -1, -1, // 27, 28 + -1, -1, // 29, 30 + -1, -1, // 31, 32 + -1, -1, // 33, 34 + -1, -1, // 35, 36 + -1, -1, // 37, 38 + -1, -1, // 39, 40 +//Padding: + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56 + -1, -1, -1, -1, -1, -1, -1, // ... 63 +}; + +int physToPinOrangePi[64] = //return wiringPI pin +{ + -1, // 0 + -1, -1, // 1, 2 + 0, -1, //3, 4 + 1, -1, //5, 6 + 2, 3, //7, 8 + -1, 4, //9,10 + 5, 6, //11,12 + 7, -1, //13,14 + 8, 9, //15,16 + -1, 10, //17,18 + 11, -1, //19,20 + 12, 13, //21,22 + 14, 15, //23, 24 + -1, 16, // 25, 26 + + -1, -1, //27, 28 + -1, -1, //29, 30 + -1, -1, //31, 32 + -1, -1, //33, 34 + -1, -1, //35, 36 + -1, -1, //37, 38 + -1, -1, //39, 40 + // Padding: + + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56 + -1, -1, -1, -1, -1, -1, -1, // ... 63 + +}; + int ORANGEPI_PIN_MASK[5][32] = //[BANK] [INDEX] + { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,},//PA + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,},//PB + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,},//PC + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,},//PD + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,},//PD + }; + +volatile uint32_t *gpio2_base; +volatile uint32_t *cru_base; +volatile uint32_t *grf_base; +volatile uint32_t *pmugrf_base; +volatile uint32_t *pmucru_base; +volatile uint32_t *gpio1_base; +volatile uint32_t *gpio4_base; +#endif /* CONFIG_ORANGEPI_4_LTS */ + #ifdef CONFIG_ORANGEPI_R1PLUS int pinToGpioOrangePi [64] = { @@ -1508,7 +1609,7 @@ unsigned int readR(unsigned int addr) else /* Group A, B and D */ val = *((char *)OrangePi_gpio + mmap_seek); return val; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 ) unsigned int val = 0; unsigned int mmap_base = (addr & ~MAP_MASK); unsigned int mmap_seek = (addr - mmap_base); @@ -1570,7 +1671,7 @@ void writeR(unsigned int val, unsigned int addr) else *((char *)OrangePi_gpio + mmap_seek) = val; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) unsigned int mmap_base = (addr & ~MAP_MASK); unsigned int mmap_seek = (addr - mmap_base); if(mmap_base == CRU_BASE) @@ -1746,12 +1847,12 @@ void sunxi_pwm_set_act(int act_cys) { int OrangePi_get_gpio_mode(int pin) { unsigned int regval = 0; - unsigned int bank = pin >> 5; //算出 pin 属于哪一组 H6 有 2/3/5/6/7 - unsigned int index = pin - (bank << 5); //算出 pin 属于组中的第多少个 + unsigned int bank = pin >> 5; + unsigned int index = pin - (bank << 5); unsigned int phyaddr = 0; unsigned char mode = -1; -#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) unsigned int grf_phyaddr = 0, ddr_phyaddr = 0; int offset = ((index - ((index >> 3) << 3))); if(bank == 1){ @@ -1863,7 +1964,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) unsigned int phyaddr = 0; #ifdef CONFIG_ORANGEPI_2G_IOT unsigned int base_address = 0; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) int offset = ((index - ((index >> 3) << 3))); unsigned int cru_phyaddr, grf_phyaddr, gpio_phyaddr; #else @@ -1895,7 +1996,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) phyaddr = base_address + OEN_SET_OUT_REGISTER; else printf("Invalid mode\n"); -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) if(bank == 1){ cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET; grf_phyaddr = PMUGRF_BASE + ((index >> 3) << 2) + 0x10; @@ -1953,7 +2054,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) /* Ignore unused gpio */ if (ORANGEPI_PIN_MASK[bank][index] != -1) { -#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || CONFIG_ORANGEPI_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || CONFIG_ORANGEPI_R1PLUS) regval = readR(phyaddr); if (wiringPiDebug) printf("Before read reg val: 0x%x offset:%d\n",regval,offset); @@ -1966,7 +2067,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) #ifdef CONFIG_ORANGEPI_2G_IOT writeR(GPIO_BIT(index), phyaddr); -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); regval |= 0x3 << ((offset << 1) | 0x10); @@ -2015,7 +2116,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) writeR(GPIO_BIT(index), phyaddr); /* Set default value as 0 */ writeR(GPIO_BIT(index), base_address + CLR_REGISTER); -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); regval |= 0x3 << ((offset << 1) | 0x10); @@ -2094,7 +2195,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) return 0; } -#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) int OrangePi_set_gpio_alt(int pin, int mode) { unsigned int regval = 0; @@ -2135,7 +2236,7 @@ int OrangePi_digitalWrite(int pin, int value) #ifdef CONFIG_ORANGEPI_2G_IOT unsigned int base_address = 0; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS ) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS ) unsigned int regval = 0; unsigned int cru_phyaddr = 0; @@ -2193,7 +2294,7 @@ int OrangePi_digitalWrite(int pin, int value) else printf("Invalid value\n"); -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) if(bank == 1){ phyaddr = GPIO1_BASE + GPIO_SWPORTA_DR_OFFSET; cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET; @@ -2226,7 +2327,7 @@ int OrangePi_digitalWrite(int pin, int value) writeR(GPIO_BIT(index), phyaddr); #else - #if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) + #if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); #elif (defined CONFIG_ORANGEPI_R1PLUS) writeR(0xffff9877, cru_phyaddr); @@ -2262,7 +2363,7 @@ int OrangePi_digitalRead(int pin) int bank = pin >> 5; int index = pin - (bank << 5); int val; -#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) unsigned int phyaddr; @@ -2299,7 +2400,7 @@ int OrangePi_digitalRead(int pin) phys_SET_R = base_address + SET_REGISTER; phys_VAL_R = base_address + VAL_REGISTER; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) unsigned int phyaddr; if(bank == 1) phyaddr = GPIO1_BASE + GPIO_EXT_PORTA_OFFSET; @@ -2367,7 +2468,7 @@ int isOrangePi(void) #elif CONFIG_ORANGEPI_ZERO2 /* Support: OrangePi zero */ char *OrangePi_string = "sun50iw9"; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) /* Support: OrangePi RK3399 */ char *OrangePi_string = "rk3399"; #elif (defined CONFIG_ORANGEPI_R1PLUS) @@ -2394,7 +2495,7 @@ int isOrangePi(void) fclose(cpuFd); -#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800) strcpy(line, "Hardware : Rockchip rk3399 Family"); #elif (defined CONFIG_ORANGEPI_R1PLUS) strcpy(line, "Hardware : Rockchip rk3328 Family"); diff --git a/wiringPi/OrangePi.h b/wiringPi/OrangePi.h index 07833b7..585e0a9 100755 --- a/wiringPi/OrangePi.h +++ b/wiringPi/OrangePi.h @@ -91,7 +91,7 @@ #endif /*********** OrangePi RK3399 *************/ -#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_4_LTS || CONFIG_ORANGEPI_800 #define GPIO1_BASE 0xff730000 #define GPIO2_BASE 0xff780000 @@ -233,7 +233,7 @@ extern int pwmmode; extern unsigned int readR(unsigned int addr); extern void writeR(unsigned int val, unsigned int addr); extern int OrangePi_set_gpio_mode(int pin, int mode); -#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) extern int OrangePi_set_gpio_alt(int pin, int mode); #endif extern int OrangePi_get_gpio_mode(int pin); diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index 9457adf..fb3c634 100755 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -775,7 +775,7 @@ int piGpioLayout (void) break ; -#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_4_LTS || CONFIG_ORANGEPI_800 strcpy(line, "Hardware : Rockchip rk3399 Family"); #elif CONFIG_ORANGEPI_R1PLUS strcpy(line, "Hardware : Rockchip rk3328 Family"); @@ -795,7 +795,7 @@ int piGpioLayout (void) fclose (cpuFd) ; -#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_800 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_4_LTS || CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_800 strcpy(line, "Revision : 0000"); #endif @@ -961,7 +961,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty) break ; fclose (cpuFd) ; -#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_R1PLUS) strcpy(line, "Revision : 0000"); #endif @@ -1340,7 +1340,7 @@ void pinModeAlt (int pin, int mode) #ifdef CONFIG_ORANGEPI -#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) if(version == ORANGEPI) { if (wiringPiDebug) printf("PinModeAlt: pin:%d,mode:%d\n", pin, mode); @@ -2398,7 +2398,7 @@ int wiringPiSetup (void) "wiringPiSetup: mmap (GPIO) failed: %s\n", strerror(errno)); #else -#if ! (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_4_LTS || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) /* GPIO */ #if CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO2