Browse Source

Support Orange Pi 800

pull/43/head
orangepi-xunlong 3 years ago
parent
commit
dab7c8035b
  1. 2
      build
  2. 3
      examples/blink.c
  3. 4
      gpio/Makefile
  4. 94
      gpio/OrangePi.c
  5. 4
      wiringPi/Makefile
  6. 132
      wiringPi/OrangePi.c
  7. 4
      wiringPi/OrangePi.h
  8. 10
      wiringPi/wiringPi.c

2
build

@ -49,7 +49,7 @@ select_boards()
local choice local choice
local call=${1} 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 if [[ -f /etc/orangepi-release ]]; then

3
examples/blink.c

@ -2,7 +2,8 @@
#include <wiringPi.h> #include <wiringPi.h>
#define NUM 17 //26pin #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 19 //for Orange Pi 4
//#define NUM 28 //40pin //#define NUM 28 //40pin

4
gpio/Makefile

@ -99,6 +99,10 @@ ifeq ($(BOARD), orangepi4)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4
endif endif
ifeq ($(BOARD), orangepi800)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800
endif
ifeq ($(BOARD), orangepir1plus-rk3328) ifeq ($(BOARD), orangepir1plus-rk3328)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS
endif endif

94
gpio/OrangePi.c

@ -761,7 +761,7 @@ int pinToGpioOrangePi [64] =
74, 75, //26,27 74, 75, //26,27
-1, -1, //28,29 -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, // ... 47
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,// ... 63 -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 #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 #ifdef CONFIG_ORANGEPI_4
int pinToGpioOrangePi [64] = int pinToGpioOrangePi [64] =
{ {
@ -1031,6 +1117,8 @@ void OrangePiReadAll(void)
printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_4 #elif CONFIG_ORANGEPI_4
printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_800
printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_R1PLUS #elif CONFIG_ORANGEPI_R1PLUS
printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n");
#endif #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 #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) 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) for (pin = 1 ; pin <= 26; pin += 2)
#elif CONFIG_ORANGEPI_R1PLUS #elif CONFIG_ORANGEPI_R1PLUS
@ -1083,6 +1171,8 @@ void OrangePiReadAll(void)
printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_4 #elif CONFIG_ORANGEPI_4
printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_800
printf (" +------+-----+----------+------+---+ 800 +---+---+--+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_R1PLUS #elif CONFIG_ORANGEPI_R1PLUS
printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ R1 Plus +---+---+--+----------+-----+------+\n");
#endif #endif

4
wiringPi/Makefile

@ -104,6 +104,10 @@ ifeq ($(BOARD), orangepi4)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4 EXTRA_CFLAGS = -DCONFIG_ORANGEPI_4
endif endif
ifeq ($(BOARD), orangepi800)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_800
endif
ifeq ($(BOARD), orangepir1plus-rk3328) ifeq ($(BOARD), orangepir1plus-rk3328)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS EXTRA_CFLAGS = -DCONFIG_ORANGEPI_R1PLUS
endif endif

132
wiringPi/OrangePi.c

@ -1079,7 +1079,7 @@ int physToGpioOrangePi[64] =//head num map to OrangePi
40, 83, // 21, 22 40, 83, // 21, 22
41, 42, // 23, 24 41, 42, // 23, 24
-1, 133, // 25, 26 -1, 133, // 25, 26
154, 50, // 27, 28 154, 50, // 27, 28
68, -1, // 29, 30 68, -1, // 29, 30
69, 76, // 31, 32 69, 76, // 31, 32
70, -1, // 33, 34 70, -1, // 33, 34
@ -1139,6 +1139,104 @@ volatile uint32_t *gpio4_base;
#endif /* CONFIG_ORANGEPI_RK3399 */ #endif /* CONFIG_ORANGEPI_RK3399 */
// add 2019.1.8 // 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 #ifdef CONFIG_ORANGEPI_4
int pinToGpioOrangePi [64] = int pinToGpioOrangePi [64] =
@ -1410,7 +1508,7 @@ unsigned int readR(unsigned int addr)
else /* Group A, B and D */ else /* Group A, B and D */
val = *((char *)OrangePi_gpio + mmap_seek); val = *((char *)OrangePi_gpio + mmap_seek);
return val; 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 val = 0;
unsigned int mmap_base = (addr & ~MAP_MASK); unsigned int mmap_base = (addr & ~MAP_MASK);
unsigned int mmap_seek = (addr - mmap_base); unsigned int mmap_seek = (addr - mmap_base);
@ -1472,7 +1570,7 @@ void writeR(unsigned int val, unsigned int addr)
else else
*((char *)OrangePi_gpio + mmap_seek) = val; *((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_base = (addr & ~MAP_MASK);
unsigned int mmap_seek = (addr - mmap_base); unsigned int mmap_seek = (addr - mmap_base);
if(mmap_base == CRU_BASE) if(mmap_base == CRU_BASE)
@ -1653,7 +1751,7 @@ int OrangePi_get_gpio_mode(int pin)
unsigned int phyaddr = 0; unsigned int phyaddr = 0;
unsigned char mode = -1; 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; unsigned int grf_phyaddr = 0, ddr_phyaddr = 0;
int offset = ((index - ((index >> 3) << 3))); int offset = ((index - ((index >> 3) << 3)));
if(bank == 1){ if(bank == 1){
@ -1765,7 +1863,7 @@ int OrangePi_set_gpio_mode(int pin, int mode)
unsigned int phyaddr = 0; unsigned int phyaddr = 0;
#ifdef CONFIG_ORANGEPI_2G_IOT #ifdef CONFIG_ORANGEPI_2G_IOT
unsigned int base_address = 0; 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))); int offset = ((index - ((index >> 3) << 3)));
unsigned int cru_phyaddr, grf_phyaddr, gpio_phyaddr; unsigned int cru_phyaddr, grf_phyaddr, gpio_phyaddr;
#else #else
@ -1797,7 +1895,7 @@ int OrangePi_set_gpio_mode(int pin, int mode)
phyaddr = base_address + OEN_SET_OUT_REGISTER; phyaddr = base_address + OEN_SET_OUT_REGISTER;
else else
printf("Invalid mode\n"); 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){ if(bank == 1){
cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET; cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_OFFSET;
grf_phyaddr = PMUGRF_BASE + ((index >> 3) << 2) + 0x10; grf_phyaddr = PMUGRF_BASE + ((index >> 3) << 2) + 0x10;
@ -1855,7 +1953,7 @@ int OrangePi_set_gpio_mode(int pin, int mode)
/* Ignore unused gpio */ /* Ignore unused gpio */
if (ORANGEPI_PIN_MASK[bank][index] != -1) { 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); regval = readR(phyaddr);
if (wiringPiDebug) if (wiringPiDebug)
printf("Before read reg val: 0x%x offset:%d\n",regval,offset); 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 #ifdef CONFIG_ORANGEPI_2G_IOT
writeR(GPIO_BIT(index), phyaddr); 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); writeR(0xffff0180, cru_phyaddr);
regval = readR(grf_phyaddr); regval = readR(grf_phyaddr);
regval |= 0x3 << ((offset << 1) | 0x10); regval |= 0x3 << ((offset << 1) | 0x10);
@ -1917,7 +2015,7 @@ int OrangePi_set_gpio_mode(int pin, int mode)
writeR(GPIO_BIT(index), phyaddr); writeR(GPIO_BIT(index), phyaddr);
/* Set default value as 0 */ /* Set default value as 0 */
writeR(GPIO_BIT(index), base_address + CLR_REGISTER); 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); writeR(0xffff0180, cru_phyaddr);
regval = readR(grf_phyaddr); regval = readR(grf_phyaddr);
regval |= 0x3 << ((offset << 1) | 0x10); regval |= 0x3 << ((offset << 1) | 0x10);
@ -1996,7 +2094,7 @@ int OrangePi_set_gpio_mode(int pin, int mode)
return 0; 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) int OrangePi_set_gpio_alt(int pin, int mode)
{ {
unsigned int regval = 0; unsigned int regval = 0;
@ -2037,7 +2135,7 @@ int OrangePi_digitalWrite(int pin, int value)
#ifdef CONFIG_ORANGEPI_2G_IOT #ifdef CONFIG_ORANGEPI_2G_IOT
unsigned int base_address = 0; 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 regval = 0;
unsigned int cru_phyaddr = 0; unsigned int cru_phyaddr = 0;
@ -2095,7 +2193,7 @@ int OrangePi_digitalWrite(int pin, int value)
else else
printf("Invalid value\n"); 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){ if(bank == 1){
phyaddr = GPIO1_BASE + GPIO_SWPORTA_DR_OFFSET; phyaddr = GPIO1_BASE + GPIO_SWPORTA_DR_OFFSET;
cru_phyaddr = PMUCRU_BASE + PMUCRU_CLKGATE_CON1_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); writeR(GPIO_BIT(index), phyaddr);
#else #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); writeR(0xffff0180, cru_phyaddr);
#elif (defined CONFIG_ORANGEPI_R1PLUS) #elif (defined CONFIG_ORANGEPI_R1PLUS)
writeR(0xffff9877, cru_phyaddr); writeR(0xffff9877, cru_phyaddr);
@ -2164,7 +2262,7 @@ int OrangePi_digitalRead(int pin)
int bank = pin >> 5; int bank = pin >> 5;
int index = pin - (bank << 5); int index = pin - (bank << 5);
int val; 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; unsigned int phyaddr;
@ -2201,7 +2299,7 @@ int OrangePi_digitalRead(int pin)
phys_SET_R = base_address + SET_REGISTER; phys_SET_R = base_address + SET_REGISTER;
phys_VAL_R = base_address + VAL_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; unsigned int phyaddr;
if(bank == 1) if(bank == 1)
phyaddr = GPIO1_BASE + GPIO_EXT_PORTA_OFFSET; phyaddr = GPIO1_BASE + GPIO_EXT_PORTA_OFFSET;
@ -2269,7 +2367,7 @@ int isOrangePi(void)
#elif CONFIG_ORANGEPI_ZERO2 #elif CONFIG_ORANGEPI_ZERO2
/* Support: OrangePi zero */ /* Support: OrangePi zero */
char *OrangePi_string = "sun50iw9"; 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 */ /* Support: OrangePi RK3399 */
char *OrangePi_string = "rk3399"; char *OrangePi_string = "rk3399";
#elif (defined CONFIG_ORANGEPI_R1PLUS) #elif (defined CONFIG_ORANGEPI_R1PLUS)
@ -2296,7 +2394,7 @@ int isOrangePi(void)
fclose(cpuFd); 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"); strcpy(line, "Hardware : Rockchip rk3399 Family");
#elif (defined CONFIG_ORANGEPI_R1PLUS) #elif (defined CONFIG_ORANGEPI_R1PLUS)
strcpy(line, "Hardware : Rockchip rk3328 Family"); strcpy(line, "Hardware : Rockchip rk3328 Family");

4
wiringPi/OrangePi.h

@ -91,7 +91,7 @@
#endif #endif
/*********** OrangePi RK3399 *************/ /*********** OrangePi RK3399 *************/
#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 #if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800
#define GPIO1_BASE 0xff730000 #define GPIO1_BASE 0xff730000
#define GPIO2_BASE 0xff780000 #define GPIO2_BASE 0xff780000
@ -233,7 +233,7 @@ extern int pwmmode;
extern unsigned int readR(unsigned int addr); extern unsigned int readR(unsigned int addr);
extern void writeR(unsigned int val, unsigned int addr); extern void writeR(unsigned int val, unsigned int addr);
extern int OrangePi_set_gpio_mode(int pin, int mode); 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); extern int OrangePi_set_gpio_alt(int pin, int mode);
#endif #endif
extern int OrangePi_get_gpio_mode(int pin); extern int OrangePi_get_gpio_mode(int pin);

10
wiringPi/wiringPi.c

@ -775,7 +775,7 @@ int piGpioLayout (void)
break ; break ;
#if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 #if CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_800
strcpy(line, "Hardware : Rockchip rk3399 Family"); strcpy(line, "Hardware : Rockchip rk3399 Family");
#elif CONFIG_ORANGEPI_R1PLUS #elif CONFIG_ORANGEPI_R1PLUS
strcpy(line, "Hardware : Rockchip rk3328 Family"); strcpy(line, "Hardware : Rockchip rk3328 Family");
@ -795,7 +795,7 @@ int piGpioLayout (void)
fclose (cpuFd) ; 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"); strcpy(line, "Revision : 0000");
#endif #endif
@ -961,7 +961,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty)
break ; break ;
fclose (cpuFd) ; 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"); strcpy(line, "Revision : 0000");
#endif #endif
@ -1340,7 +1340,7 @@ void pinModeAlt (int pin, int mode)
#ifdef CONFIG_ORANGEPI #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(version == ORANGEPI) {
if (wiringPiDebug) if (wiringPiDebug)
printf("PinModeAlt: pin:%d,mode:%d\n", pin, mode); printf("PinModeAlt: pin:%d,mode:%d\n", pin, mode);
@ -2398,7 +2398,7 @@ int wiringPiSetup (void)
"wiringPiSetup: mmap (GPIO) failed: %s\n", strerror(errno)); "wiringPiSetup: mmap (GPIO) failed: %s\n", strerror(errno));
#else #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 */ /* GPIO */
#if CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO2 #if CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZERO2

Loading…
Cancel
Save