Browse Source

Support Orange Pi Win/WinPlus

pull/11/head
leeboby 5 years ago
parent
commit
aa9f55f16a
  1. 2
      build
  2. 4
      examples/blink.c
  3. 8
      gpio/Makefile
  4. 88
      gpio/OrangePi.c
  5. 8
      wiringPi/Makefile
  6. 85
      wiringPi/OrangePi.c
  7. 4
      wiringPi/OrangePi.h
  8. 2
      wiringPi/wiringPi.c

2
build

@ -49,7 +49,7 @@ select_boards()
local choice local choice
local call=${1} local call=${1}
boards=("OrangePi_R1" "OrangePi_ZERO" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E" "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_ZEROPLUS2_H3" "OrangePi_PC2" "OrangePi_PRIME" "OrangePi_ZEROPLUS" "OrangePi_ZEROPLUS2_H5" "OrangePi_A64" "OrangePi_3" "OrangePi_LITE2" "OrangePi_ONEPLUS" "OrangePi_4" "OrangePi_RK3399") boards=("OrangePi_R1" "OrangePi_ZERO" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E" "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_ZEROPLUS2_H3" "OrangePi_PC2" "OrangePi_PRIME" "OrangePi_ZEROPLUS" "OrangePi_ZEROPLUS2_H5" "OrangePi_WIN" "OrangePi_WINPLUS" "OrangePi_3" "OrangePi_LITE2" "OrangePi_ONEPLUS" "OrangePi_4" "OrangePi_RK3399")
printf "All available boards:\n" printf "All available boards:\n"
for var in ${boards[@]} ; do for var in ${boards[@]} ; do

4
examples/blink.c

@ -1,8 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include <wiringPi.h> #include <wiringPi.h>
#define NUM 17 //#define NUM 17
//#define NUM 28 #define NUM 28
int main (void) int main (void)
{ {

8
gpio/Makefile

@ -44,7 +44,7 @@ ifeq ($(PLATFORM),)
#PLATFORM = OrangePi_PC2 #PLATFORM = OrangePi_PC2
#PLATFORM = OrangePi_PRIME #PLATFORM = OrangePi_PRIME
#PLATFORM = OrangePi_ZEROPLUS #PLATFORM = OrangePi_ZEROPLUS
#PLATFORM = OrangePi_A64 #PLATFORM = OrangePi_WIN
#PLATFORM = OrangePi_H5 #PLATFORM = OrangePi_H5
#PLATFORM = OrangePi_ZERO #PLATFORM = OrangePi_ZERO
#PLATFORM = OrangePi_R1 #PLATFORM = OrangePi_R1
@ -82,8 +82,8 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZEROPLUS
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
ifeq ($(PLATFORM), OrangePi_A64) ifneq ($(findstring $(PLATFORM), "OrangePi_WIN" "OrangePi_WINPLUS"),)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_A64 EXTRA_CFLAGS = -DCONFIG_ORANGEPI_WIN
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
@ -143,7 +143,7 @@ ifeq ($(PLATFORM), OrangePi_ZEROPLUS)
SRC += OrangePi.c SRC += OrangePi.c
endif endif
ifeq ($(PLATFORM), OrangePi_A64) ifneq ($(findstring $(PLATFORM), "OrangePi_WIN" "OrangePi_WINPLUS"),)
SRC += OrangePi.c SRC += OrangePi.c
endif endif

88
gpio/OrangePi.c

@ -266,7 +266,7 @@ int physToWpi[64] =
}; };
#endif #endif
#ifdef CONFIG_ORANGEPI_A64 #ifdef CONFIG_ORANGEPI_WIN
char *physNames [64] = char *physNames [64] =
{ {
NULL, NULL,
@ -274,30 +274,31 @@ char *physNames [64] =
" 3.3V", "5V ", " 3.3V", "5V ",
" SDA.1", "5V ", " SDA.1", "5V ",
" SCL.1", "GND ", " SCL.1", "GND ",
" GPIO.7", "S_TX ", " PL10", "PL02 ",
" GND", "S_RX ", " GND", "PL03 ",
" RXD3", "GPIO.1 ", " RXD.3", "PD04 ",
" TXD3", "GND ", " TXD.3", "GND ",
" CTS3", "GPIO.4 ", " CTS.3", "PL09 ",
" 3.3V", "GPIO.5 ", " 3.3V", "PC04 ",
" MOSI", "GND ", " MOSI.1", "GND ",
" MISO", "RTS3 ", " MISO.1", "RTS.3 ",
" SCLK", "CE0 ", " SCLK.1", "CE.1 ",
" GND", "GPIO.11 ", " GND", "PD06 ",
" SDA.2", "SCL.2 ", " SDA.2", "SCL.2 ",
" GPIO.21", "GND ", " PB04", "GND ",
" GPIO.22", "RTS2 ", " PB05", "RTS.2 ",
" GPIO.23", "GND ", " PB06", "GND ",
" GPIO.24", "CTS2 ", " PB07", "CTS.2 ",
" GPIO.25", "TXD2 ", " PD05", "TXD.2 ",
" GND", "RXD2 ", " GND", "RXD.2 ",
NULL, NULL,
NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
"GPIO.17", "GPIO.18",
"GPIO.19", "GPIO.20",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
}; };
@ -305,27 +306,28 @@ int physToWpi [64] =
{ {
-1, // 0 -1, // 0
-1, -1, // 1, 2 -1, -1, // 1, 2
8, -1, // 3, 4 0, -1, // 3, 4
9, -1, // 5, 6 1, -1, // 5, 6
7, 15, // 7, 8 2, 3, // 7, 8
-1, 16, // 9, 10 -1, 4, // 9, 10
0, 1, //11, 12 5, 6, //11, 12
2, -1, //13, 14 7, -1, //13, 14
3, 4, //15, 16 8, 9, //15, 16
-1, 5, //17, 18 -1, 10, //17, 18
12, -1, //19, 20 11, -1, //19, 20
13, 6, //21, 22 12, 13, //21, 22
14, 10, //23, 24 14, 15, //23, 24
-1, 11, //25, 26 -1, 16, //25, 26
30, 31, //27, 28 17, 18, //27, 28
21, -1, //29, 30 19, -1, //29, 30
22, 26, //31, 32 20, 21, //31, 32
23, -1, //33, 34 22, -1, //33, 34
24, 27, //35, 36 23, 24, //35, 36
25, 28, //37, 38 25, 26, //37, 38
-1, 29, //39, 40 -1, 27, //39, 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //41-> 55
-1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //41-> 55
-1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63
}; };
#endif #endif
@ -878,7 +880,7 @@ void OrangePiReadAll(void)
printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_ZERO #elif CONFIG_ORANGEPI_ZERO
printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_WIN
printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_LITE2 #elif CONFIG_ORANGEPI_LITE2
printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n");
@ -894,7 +896,7 @@ void OrangePiReadAll(void)
printf (" | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |\n"); printf (" | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |\n");
printf (" +------+-----+----------+------+---+----++----+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+----++----+---+------+----------+-----+------+\n");
#if defined CONFIG_ORANGEPI_H3 || defined CONFIG_ORANGEPI_RK3399 || CONFIG_ORANGEPI_4 || CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_PRIME || CONFIG_ORANGEPI_A64 #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
@ -921,7 +923,7 @@ void OrangePiReadAll(void)
printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_ZERO #elif CONFIG_ORANGEPI_ZERO
printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_WIN
printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_LITE2 #elif CONFIG_ORANGEPI_LITE2
printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n");

8
wiringPi/Makefile

@ -49,7 +49,7 @@ ifeq ($(PLATFORM),)
#PLATFORM = OrangePi_PC2 #PLATFORM = OrangePi_PC2
#PLATFORM = OrangePi_PRIME #PLATFORM = OrangePi_PRIME
#PLATFORM = OrangePi_ZEROPLUS #PLATFORM = OrangePi_ZEROPLUS
#PLATFORM = OrangePi_A64 #PLATFORM = OrangePi_WIN
#PLATFORM = OrangePi_H3 #PLATFORM = OrangePi_H3
#PLATFORM = OrangePi_LITE2 #PLATFORM = OrangePi_LITE2
PLATFORM = OrangePi_ONEPLUS PLATFORM = OrangePi_ONEPLUS
@ -80,8 +80,8 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZEROPLUS
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
ifeq ($(PLATFORM), OrangePi_A64) ifneq ($(findstring $(PLATFORM), "OrangePi_WIN" "OrangePi_WINPLUS"),)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_A64 EXTRA_CFLAGS = -DCONFIG_ORANGEPI_WIN
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
@ -162,7 +162,7 @@ ifeq ($(PLATFORM), OrangePi_ZEROPLUS)
SRC += OrangePi.c SRC += OrangePi.c
endif endif
ifeq ($(PLATFORM), OrangePi_A64) ifneq ($(findstring $(PLATFORM), "OrangePi_WIN" "OrangePi_WINPLUS"),)
SRC += OrangePi.c SRC += OrangePi.c
endif endif

85
wiringPi/OrangePi.c

@ -407,26 +407,26 @@ int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX]
}; };
#endif /* ZEROPLUS */ #endif /* ZEROPLUS */
#ifdef CONFIG_ORANGEPI_A64 #ifdef CONFIG_ORANGEPI_WIN
int pinToGpioOrangePi [64] = int pinToGpioOrangePi [64] =
{ {
229, 100, // 0, 1 227, 226, // 0, 1
228, 231, // 2, 3 362, 354, // 2, 3
361, 68, // 4 5 355, 229, // 4 5
230, 362, // 6, 7 100, 228, // 6, 7
227, 226, // 8, 9 231, 361, // 8, 9
96, 102, //10,11 68, 98, //10,11
98, 99, //12,13 99, 230, //12,13
97, 354, //14,15 97, 96, //14,15
355, -1, //16,17 102, 143, //16,17
-1, -1, //18,19 142, 36, //18,19
-1, 36, //20,21 37, 34, //20,21
37, 38, //22,23 38, 39, //22,23
39, 101, //24,25 35, 101, //24,25
34, 35, //26,27 32, 33, //26,27
32, 33, //28,29
143, 142, //30,31 -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, // ... 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
}; };
@ -458,31 +458,32 @@ int physToGpioOrangePi[64] =
-1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63 -1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63
}; };
int physToPinOrangePi [64] = int physToPinOrangePi [64] =
{ {
-1, // 0 -1, // 0
-1, -1, // 1, 2 -1, -1, // 1, 2
8, -1, // 3, 4 0, -1, // 3, 4
9, -1, // 5, 6 1, -1, // 5, 6
7, 15, // 7, 8 2, 3, // 7, 8
-1, 16, // 9, 10 -1, 4, // 9, 10
0, 1, //11, 12 5, 6, //11, 12
2, -1, //13, 14 7, -1, //13, 14
3, 4, //15, 16 8, 9, //15, 16
-1, 5, //17, 18 -1, 10, //17, 18
12, -1, //19, 20 11, -1, //19, 20
13, 6, //21, 22 12, 13, //21, 22
14, 10, //23, 24 14, 15, //23, 24
-1, 11, //25, 26 -1, 16, //25, 26
30, 31, //27, 28 17, 18, //27, 28
21, -1, //29, 30 19, -1, //29, 30
22, 26, //31, 32 20, 21, //31, 32
23, -1, //33, 34 22, -1, //33, 34
24, 27, //35, 36 23, 24, //35, 36
25, 28, //37, 38 25, 26, //37, 38
-1, 29, //39, 40 -1, 27, //39, 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //41-> 55
-1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //41-> 55
-1, -1, -1, -1, -1, -1, -1, -1 // 56-> 63
}; };
int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX] int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX]
@ -1185,7 +1186,7 @@ const char *piModelNames[6] =
"OrangePi 2G-IOT", "OrangePi 2G-IOT",
#elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_PRIME #elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_PRIME
"OrangePi H5 family", "OrangePi H5 family",
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_WIN
"OrangePi Win/Winplus", "OrangePi Win/Winplus",
#elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3 #elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3
"OrangePi H3 family", "OrangePi H3 family",
@ -1855,7 +1856,7 @@ int isOrangePi(void)
#elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_PRIME #elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_ZEROPLUS || CONFIG_ORANGEPI_ZEROPLUS2_H5 || CONFIG_ORANGEPI_PRIME
/* Support: OrangePi PC2 */ /* Support: OrangePi PC2 */
char *OrangePi_string = "sun50iw2"; char *OrangePi_string = "sun50iw2";
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_WIN
/* Support: OrangePi Win/Win plus */ /* Support: OrangePi Win/Win plus */
char *OrangePi_string = "sun50iw1"; char *OrangePi_string = "sun50iw1";
#elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3 #elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3

4
wiringPi/OrangePi.h

@ -43,7 +43,7 @@
#endif #endif
/************** OrangePi A64 ***********************/ /************** OrangePi A64 ***********************/
#ifdef CONFIG_ORANGEPI_A64 #ifdef CONFIG_ORANGEPI_WIN
#define GPIOA_BASE (0x01C20000) #define GPIOA_BASE (0x01C20000)
#define GPIO_NUM (0x40) #define GPIO_NUM (0x40)
#define GPIO_BASE_MAP (0x01C20800) #define GPIO_BASE_MAP (0x01C20800)
@ -205,7 +205,7 @@ extern const char *piModelNames[6];
extern int ORANGEPI_PIN_MASK[4][32]; extern int ORANGEPI_PIN_MASK[4][32];
#elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_PRIME #elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_PRIME
extern int ORANGEPI_PIN_MASK[9][32]; extern int ORANGEPI_PIN_MASK[9][32];
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_WIN
extern int ORANGEPI_PIN_MASK[12][32]; extern int ORANGEPI_PIN_MASK[12][32];
#elif CONFIG_ORANGEPI_H3 #elif CONFIG_ORANGEPI_H3
extern int ORANGEPI_PIN_MASK[9][32]; extern int ORANGEPI_PIN_MASK[9][32];

2
wiringPi/wiringPi.c

@ -2377,7 +2377,7 @@ int wiringPiSetup (void)
return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (PWM) failed: %s\n", strerror (errno)) ; return wiringPiFailure (WPI_ALMOST, "wiringPiSetup: mmap (PWM) failed: %s\n", strerror (errno)) ;
#if CONFIG_ORANGEPI_A64 || CONFIG_ORANGEPI_ZEROPLUS2_H3 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZEROPLUS2_H5 #if CONFIG_ORANGEPI_WIN || CONFIG_ORANGEPI_ZEROPLUS2_H3 || CONFIG_ORANGEPI_3 || CONFIG_ORANGEPI_ZEROPLUS2_H5
/* GPIOC connect CPU with Modem */ /* GPIOC connect CPU with Modem */
OrangePi_gpioC = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ | PROT_WRITE, OrangePi_gpioC = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, GPIOL_BASE_MAP); MAP_SHARED, fd, GPIOL_BASE_MAP);

Loading…
Cancel
Save