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 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"
for var in ${boards[@]} ; do

4
examples/blink.c

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

8
gpio/Makefile

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

88
gpio/OrangePi.c

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

8
wiringPi/Makefile

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

85
wiringPi/OrangePi.c

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

4
wiringPi/OrangePi.h

@ -43,7 +43,7 @@
#endif
/************** OrangePi A64 ***********************/
#ifdef CONFIG_ORANGEPI_A64
#ifdef CONFIG_ORANGEPI_WIN
#define GPIOA_BASE (0x01C20000)
#define GPIO_NUM (0x40)
#define GPIO_BASE_MAP (0x01C20800)
@ -205,7 +205,7 @@ extern const char *piModelNames[6];
extern int ORANGEPI_PIN_MASK[4][32];
#elif CONFIG_ORANGEPI_PC2 || CONFIG_ORANGEPI_PRIME
extern int ORANGEPI_PIN_MASK[9][32];
#elif CONFIG_ORANGEPI_A64
#elif CONFIG_ORANGEPI_WIN
extern int ORANGEPI_PIN_MASK[12][32];
#elif CONFIG_ORANGEPI_H3
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)) ;
#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 */
OrangePi_gpioC = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, GPIOL_BASE_MAP);

Loading…
Cancel
Save