From dab7c8035ba1bc4217e40a1060571d37fb392961 Mon Sep 17 00:00:00 2001 From: orangepi-xunlong <258384131@qq.com> Date: Wed, 17 Nov 2021 15:28:31 +0800 Subject: [PATCH] Support Orange Pi 800 --- build | 2 +- examples/blink.c | 3 +- gpio/Makefile | 4 ++ gpio/OrangePi.c | 94 ++++++++++++++++++++++++++++++- wiringPi/Makefile | 4 ++ wiringPi/OrangePi.c | 132 ++++++++++++++++++++++++++++++++++++++------ wiringPi/OrangePi.h | 4 +- wiringPi/wiringPi.c | 10 ++-- 8 files changed, 225 insertions(+), 28 deletions(-) diff --git a/build b/build index 94e34e9..3d49f58 100755 --- a/build +++ b/build @@ -49,7 +49,7 @@ select_boards() local choice local call=${1} - boards=("orangepir1" "orangepizero" "orangepipc" "orangepipch5" "orangepipcplus" "orangepiplus2e" "orangepione" "orangepioneh5" "orangepilite" "orangepiplus" "orangepizeroplus2h3" "orangepizeroplus" "orangepipc2" "orangepiprime" "orangepizeroplus2h5" "orangepiwin" "orangepiwinplus" "orangepi3" "orangepi3-lts" "orangepilite2" "orangepioneplus" "orangepi4" "orangepirk3399" "orangepizero2" "orangepir1plus") + boards=("orangepir1" "orangepizero" "orangepipc" "orangepipch5" "orangepipcplus" "orangepiplus2e" "orangepione" "orangepioneh5" "orangepilite" "orangepiplus" "orangepizeroplus2h3" "orangepizeroplus" "orangepipc2" "orangepiprime" "orangepizeroplus2h5" "orangepiwin" "orangepiwinplus" "orangepi3" "orangepi3-lts" "orangepilite2" "orangepioneplus" "orangepi4" "orangepirk3399" "orangepi800" "orangepizero2" "orangepir1plus") if [[ -f /etc/orangepi-release ]]; then diff --git a/examples/blink.c b/examples/blink.c index 39c2ab8..7181295 100644 --- a/examples/blink.c +++ b/examples/blink.c @@ -2,7 +2,8 @@ #include #define NUM 17 //26pin -#define NUM 20 //for Orange Pi Zero 2 +//#define NUM 18 //26pin +//#define NUM 20 //for Orange Pi Zero 2 //#define NUM 19 //for Orange Pi 4 //#define NUM 28 //40pin diff --git a/gpio/Makefile b/gpio/Makefile index d4d1b14..09564ca 100755 --- a/gpio/Makefile +++ b/gpio/Makefile @@ -99,6 +99,10 @@ ifeq ($(BOARD), orangepi4) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 endif +ifeq ($(BOARD), orangepi800) +EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800 +endif + ifeq ($(BOARD), orangepir1plus-rk3328) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS endif diff --git a/gpio/OrangePi.c b/gpio/OrangePi.c index b6c4e22..e7076b8 100755 --- a/gpio/OrangePi.c +++ b/gpio/OrangePi.c @@ -761,7 +761,7 @@ int pinToGpioOrangePi [64] = 74, 75, //26,27 -1, -1, //28,29 - -1, -1, //30,31 + -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 @@ -831,6 +831,92 @@ char *physNames[64] = }; #endif + +#ifdef CONFIG_ORANGEPI_800 +int pinToGpioOrangePi [64] = +{ + 43, 44, //0,1 + 150, 39, //2,3 + 40, 148, //4,5 + 152, 147, //6,7 + 149, 64, //8,9 + 65, 74, //10,11 + 73, 153, //12,13 + 75, 76, //14,15 + 154, -1, //16,17 + -1, -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 ", + " SDA.4", "5V ", + " SCL.4", "GND ", + " PWM1", "RXD.4 ", + " GND", "TXD.4 ", + " TXD.2", "GPIO4_D0", + " RXD.2", "GND ", + "GPIO4_C5", "SDA.2 ", + " 3.3V", "SCL.2 ", + "SPI2_TXD", "GND ", + "SPI2_RXD", "GPIO4_D1", + "SPI2_CLK", "SPI2_CS ", + " GND", "GPIO4_D2", + 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_4 int pinToGpioOrangePi [64] = { @@ -1031,6 +1117,8 @@ void OrangePiReadAll(void) printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); +#elif CONFIG_ORANGEPI_800 + printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_R1PLUS printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n"); #endif @@ -1041,7 +1129,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 +#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 for (pin = 1 ; pin <= 26; pin += 2) #elif CONFIG_ORANGEPI_R1PLUS @@ -1083,6 +1171,8 @@ void OrangePiReadAll(void) printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); +#elif CONFIG_ORANGEPI_800 + printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_R1PLUS printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n"); #endif diff --git a/wiringPi/Makefile b/wiringPi/Makefile index c2b472f..b031140 100755 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -104,6 +104,10 @@ ifeq ($(BOARD), orangepi4) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 endif +ifeq ($(BOARD), orangepi800) +EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800 +endif + ifeq ($(BOARD), orangepir1plus-rk3328) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS endif diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c index 1081acb..364d796 100755 --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -1079,7 +1079,7 @@ int physToGpioOrangePi[64] =//head num map to OrangePi 40, 83, // 21, 22 41, 42, // 23, 24 -1, 133, // 25, 26 - 154, 50, // 27, 28 + 154, 50, // 27, 28 68, -1, // 29, 30 69, 76, // 31, 32 70, -1, // 33, 34 @@ -1139,6 +1139,104 @@ volatile uint32_t *gpio4_base; #endif /* CONFIG_ORANGEPI_RK3399 */ // add 2019.1.8 +#ifdef CONFIG_ORANGEPI_800 +int pinToGpioOrangePi [64] = +{ + 43, 44, //0,1 + 150, 39, //2,3 + 40, 148, //4,5 + 152, 147, //6,7 + 149, 64, //8,9 + 65, 74, //10,11 + 73, 153, //12,13 + 75, 76, //14,15 + 154, -1, //16,17 + -1, -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 + 43, -1, // 3, 4 + 44, -1, // 5, 6 + 150, 39, // 7, 8 + -1, 40, // 9, 10 + 148, 152, // 11, 12 + 147, -1, // 13, 14 + 149, 64, // 15, 16 + -1, 65, // 17, 18 + 74, -1, // 19, 20 + 73, 153, // 21, 22 + 75, 76, // 23, 24 + -1, 154, // 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, 75, // 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,}, + { 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,}, + { 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,}, + { 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,}, + { 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,}, +}; + +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_800 */ #ifdef CONFIG_ORANGEPI_4 int pinToGpioOrangePi [64] = @@ -1410,7 +1508,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) unsigned int val = 0; unsigned int mmap_base = (addr & ~MAP_MASK); unsigned int mmap_seek = (addr - mmap_base); @@ -1472,7 +1570,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) unsigned int mmap_base = (addr & ~MAP_MASK); unsigned int mmap_seek = (addr - mmap_base); if(mmap_base == CRU_BASE) @@ -1653,7 +1751,7 @@ int OrangePi_get_gpio_mode(int pin) unsigned int phyaddr = 0; unsigned char mode = -1; -#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) unsigned int grf_phyaddr = 0, ddr_phyaddr = 0; int offset = ((index - ((index >> 3) << 3))); if(bank == 1){ @@ -1765,7 +1863,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_R1PLUS) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) int offset = ((index - ((index >> 3) << 3))); unsigned int cru_phyaddr, grf_phyaddr, gpio_phyaddr; #else @@ -1797,7 +1895,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) if(bank == 1){ cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET; grf_phyaddr = PMUGRF_BASE + ((index >> 3) << 2) + 0x10; @@ -1855,7 +1953,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 || CONFIG_ORANGEPI_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || CONFIG_ORANGEPI_R1PLUS) regval = readR(phyaddr); if (wiringPiDebug) printf("Before read reg val: 0x%x offset:%d\n",regval,offset); @@ -1868,7 +1966,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); regval |= 0x3 << ((offset << 1) | 0x10); @@ -1917,7 +2015,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); regval |= 0x3 << ((offset << 1) | 0x10); @@ -1996,7 +2094,7 @@ int OrangePi_set_gpio_mode(int pin, int mode) return 0; } -#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || 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; @@ -2037,7 +2135,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_R1PLUS ) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS ) unsigned int regval = 0; unsigned int cru_phyaddr = 0; @@ -2095,7 +2193,7 @@ int OrangePi_digitalWrite(int pin, int value) else printf("Invalid value\n"); -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) if(bank == 1){ phyaddr = GPIO1_BASE + GPIO_SWPORTA_DR_OFFSET; cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET; @@ -2128,7 +2226,7 @@ int OrangePi_digitalWrite(int pin, int value) writeR(GPIO_BIT(index), phyaddr); #else - #if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) + #if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) writeR(0xffff0180, cru_phyaddr); #elif (defined CONFIG_ORANGEPI_R1PLUS) writeR(0xffff9877, cru_phyaddr); @@ -2164,7 +2262,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_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_2G_IOT || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) unsigned int phyaddr; @@ -2201,7 +2299,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) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) unsigned int phyaddr; if(bank == 1) phyaddr = GPIO1_BASE + GPIO_EXT_PORTA_OFFSET; @@ -2269,7 +2367,7 @@ int isOrangePi(void) #elif CONFIG_ORANGEPI_ZERO2 /* Support: OrangePi zero */ char *OrangePi_string = "sun50iw9"; -#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) +#elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800) /* Support: OrangePi RK3399 */ char *OrangePi_string = "rk3399"; #elif (defined CONFIG_ORANGEPI_R1PLUS) @@ -2296,7 +2394,7 @@ int isOrangePi(void) fclose(cpuFd); -#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || 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 c37df30..07833b7 100755 --- a/wiringPi/OrangePi.h +++ b/wiringPi/OrangePi.h @@ -91,7 +91,7 @@ #endif /*********** OrangePi RK3399 *************/ -#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || 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_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || 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 e2de171..9457adf 100755 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -775,7 +775,7 @@ int piGpioLayout (void) break ; -#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || 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 +#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || 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 || defined CONFIG_ORANGEPI_R1PLUS) +#if (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800 || 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 || defined CONFIG_ORANGEPI_R1PLUS || CONFIG_ORANGEPI_2G_IOT) +#if !(defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || 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_R1PLUS) +#if ! (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4 || defined CONFIG_ORANGEPI_800 || defined CONFIG_ORANGEPI_R1PLUS) /* GPIO */ #if CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO2