ODROID-M1: New support for ODROID-M1
Change-Id: I8691f53540d566d00945fe3c7b6fb2f5f317cc1f Signed-off-by: Steve Jeong <jkhpro1003@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ cc_library_shared {
|
||||
"wiringPi/odroidc2.c",
|
||||
"wiringPi/odroidc4.c",
|
||||
"wiringPi/odroidhc4.c",
|
||||
"wiringPi/odroidm1.c",
|
||||
"wiringPi/drcSerial.c",
|
||||
"wiringPi/mcp23s08.c",
|
||||
"wiringPi/odroidn1.c",
|
||||
|
||||
3
build
3
build
@@ -86,10 +86,9 @@ configure_gpiomem() {
|
||||
}
|
||||
|
||||
install() {
|
||||
echo "====================="
|
||||
echo "wiringPi Build script"
|
||||
echo "====================="
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "WiringPi Library"
|
||||
cd wiringPi
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -1,7 +1,7 @@
|
||||
Source: odroid-wiringpi
|
||||
Section: electronics
|
||||
Priority: optional
|
||||
Maintainer: Deokgyu Yang <secugyu@gmail.com>
|
||||
Maintainer: Deokgyu Yang <secugyu@gmail.com>, Steve Jeong <jkhpro@gmail.com>
|
||||
Standards-Version: 3.8.0
|
||||
Homepage: https://wiki.odroid.com
|
||||
Build-Depends: debhelper (>= 10)
|
||||
@@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 10)
|
||||
Package: libwiringpi2
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libgpiod-dev
|
||||
Description: GPIO libraries for ODROID (runtime).
|
||||
Runtime for the popular wiringPi library.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ INCLUDE = -I$(DESTDIR)$(PREFIX)/include
|
||||
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
|
||||
|
||||
LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
|
||||
LIBS = -lwiringPi -lpthread -lrt -lm -lcrypt
|
||||
LIBS = -lwiringPi -lpthread -lrt -lm -lcrypt -lgpiod
|
||||
|
||||
# May not need to alter anything below this line
|
||||
###############################################################################
|
||||
|
||||
@@ -590,6 +590,68 @@ static const char *physNamesOdroidHC4 [64] =
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static const char *physNamesOdroidM1All [64] =
|
||||
{
|
||||
NULL,
|
||||
|
||||
" 3.3V", "5V ",
|
||||
"I2C0_SDA", "5V ",
|
||||
"I2C0_SCL", "GND(0V) ",
|
||||
"GPIO0_B6", "UART1_TX",
|
||||
" GND(0V)", "UART1_RX",
|
||||
"GPIO0_C0", "GPIO3_D0",
|
||||
"GPIO0_C1", "GND(0V) ",
|
||||
"GPIO3_B2", "GPIO3_C6",
|
||||
" 3.3V", "GPIO3_C7",
|
||||
"SPI_MOSI", "GND(0V) ",
|
||||
"SPI_MISO", "GPIO3_D1",
|
||||
" SPI_CLK", "SPI_CS0 ",
|
||||
" GND(0V)", "GPIO3_D2",
|
||||
"I2C1_SDA", "I2C1_SCL",
|
||||
"GPIO4_C1", "GND(0V) ",
|
||||
"GPIO4_B6", "GPIO3_D3",
|
||||
"GPIO0_B5", "GND(0V) ",
|
||||
"GPIO3_D5", "GPIO3_D4",
|
||||
"ADC.AIN1", "1V8 ",
|
||||
" GND(0V)", "ADC.AIN0",
|
||||
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static const char *physNamesOdroidM1 [64] =
|
||||
{
|
||||
NULL,
|
||||
|
||||
" 3.3V", "5V ",
|
||||
" SDA0", "5V ",
|
||||
" SCL0", "0V ",
|
||||
" IO0_B6", "UART.TX",
|
||||
" 0V", "UART.RX",
|
||||
" IO0_C0", "IO3_D0 ",
|
||||
" IO0_C1", "0V ",
|
||||
" IO3_B2", "IO3_C6 ",
|
||||
" 3.3V", "IO3_C7 ",
|
||||
"SPI.TXD", "0V ",
|
||||
"SPI.RXD", "IO3_D1 ",
|
||||
"SPI.CLK", "SPI.CS0",
|
||||
" 0V", "IO3_D2 ",
|
||||
" SDA1", "SCL1 ",
|
||||
" IO4_C1", "0V ",
|
||||
" IO4_B6", "IO3_D3 ",
|
||||
" IO0_B5", "0V ",
|
||||
" IO3_D5", "IO3_D4 ",
|
||||
" AIN1", "1V8 ",
|
||||
" 0V", "AIN0 ",
|
||||
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void readallPhys(int model, int UNU rev, int physPin, const char *physNames[], int isAll) {
|
||||
int pin ;
|
||||
@@ -643,6 +705,7 @@ static void readallPhys(int model, int UNU rev, int physPin, const char *physNam
|
||||
case MODEL_ODROID_XU3:
|
||||
case MODEL_ODROID_N2:
|
||||
case MODEL_ODROID_C4:
|
||||
case MODEL_ODROID_M1:
|
||||
printf (" | %2d | %5s", getDrive(pin), pupd[getPUPD(pin)]);
|
||||
break;
|
||||
default:
|
||||
@@ -684,6 +747,7 @@ static void readallPhys(int model, int UNU rev, int physPin, const char *physNam
|
||||
case MODEL_ODROID_XU3:
|
||||
case MODEL_ODROID_N2:
|
||||
case MODEL_ODROID_C4:
|
||||
case MODEL_ODROID_M1:
|
||||
printf (" | %-5s | %-2d", pupd[getPUPD(pin)], getDrive(pin));
|
||||
break;
|
||||
default:
|
||||
@@ -902,6 +966,10 @@ void doReadall(int argc, char *argv[]) {
|
||||
headerName = (isAll == FALSE) ? " HC4 " : " Model ODROID-HC4 ";
|
||||
physNames = (char *) ((isAll == FALSE) ? physNamesOdroidHC4 : physNamesOdroidHC4All);
|
||||
break;
|
||||
case MODEL_ODROID_M1:
|
||||
headerName = (isAll == FALSE) ? "--- M1 ---" : "---- Model ODROID-M1 ----";
|
||||
physNames = (char *) ((isAll == FALSE) ? physNamesOdroidM1 : physNamesOdroidM1All);
|
||||
break;
|
||||
default:
|
||||
printf("Oops - unknown model: %d\n", model);
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,8 @@ SRC = odroid_xu3.tex \
|
||||
odroid_c2.tex \
|
||||
odroid_n1.tex \
|
||||
odroid_n2.tex \
|
||||
odroid_c4.tex
|
||||
odroid_c4.tex \
|
||||
odroid_m1.tex
|
||||
|
||||
DVI = $(SRC:.tex=.dvi)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ INCLUDE = -I.
|
||||
DEFS = -D_GNU_SOURCE
|
||||
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline -Wno-format-truncation $(INCLUDE) -pipe -fPIC
|
||||
|
||||
LIBS = -lm -lpthread -lrt -lcrypt
|
||||
LIBS = -lm -lpthread -lrt -lcrypt -lgpiod
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -69,7 +69,8 @@ SRC = wiringPi.c \
|
||||
odroidn1.c \
|
||||
odroidn2.c \
|
||||
odroidc4.c \
|
||||
odroidhc4.c
|
||||
odroidhc4.c \
|
||||
odroidm1.c
|
||||
|
||||
HEADERS = $(shell ls *.h)
|
||||
|
||||
@@ -87,7 +88,7 @@ $(STATIC): $(OBJ)
|
||||
|
||||
$(DYNAMIC): $(OBJ)
|
||||
$Q echo "[Link (Dynamic)]"
|
||||
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
|
||||
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS)
|
||||
|
||||
.c.o:
|
||||
$Q echo [Compile] $<
|
||||
@@ -184,3 +185,4 @@ odroidn1.o : wiringPi.h odroidn1.h
|
||||
odroidn2.o : wiringPi.h odroidn2.h
|
||||
odroidc4.o : wiringPi.h odroidc4.h
|
||||
odroidhc4.o : wiringPi.h odroidc4.h
|
||||
odroidm1.o : wiringPi.h odroidm1.h
|
||||
|
||||
1285
wiringPi/odroidm1.c
Normal file
1285
wiringPi/odroidm1.c
Normal file
File diff suppressed because it is too large
Load Diff
104
wiringPi/odroidm1.h
Normal file
104
wiringPi/odroidm1.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
|
||||
WiringPi ODROID-M1 Board Header file
|
||||
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2021 steve Jeong <jkhpro1003@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __ODROID_M1_H__
|
||||
#define __ODROID_M1_H__
|
||||
|
||||
#define WIRINGPI 0
|
||||
#define LIBGPIOD 1
|
||||
/*----------------------------------------------------------------------------*/
|
||||
// Common mmap block size for ODROID-M1 GRF register
|
||||
#define M1_GPIO_PIN_BASE 0
|
||||
//setClkState mode
|
||||
#define M1_CLK_ENABLE 0
|
||||
#define M1_CLK_DISABLE 1
|
||||
#define M1_CLK_BYTE_ENABLE 2
|
||||
#define M1_CLK_BYTE_DISABLE 3
|
||||
|
||||
#define M1_GRF_BLOCK_SIZE 0xFFFF
|
||||
#define GPIO_SIZE 32
|
||||
|
||||
#define M1_FUNC_GPIO 0
|
||||
|
||||
// GPIO[0]
|
||||
#define M1_GPIO_0_BASE 0xFDD60000
|
||||
// to control clock (PMU_CRU)
|
||||
#define M1_PMU_CRU_BASE 0xFDD00000
|
||||
#define M1_PMU_CRU_GPIO_CLK_OFFSET 0x0184
|
||||
#define M1_PMU_CRU_GPIO_PCLK_BIT 9
|
||||
// to control IOMUX
|
||||
#define M1_PMU_GRF_BASE 0xFDC20000
|
||||
#define M1_PMU_GRF_IOMUX_OFFSET 0x0000
|
||||
#define M1_PMU_GRF_PUPD_OFFSET 0x0020
|
||||
#define M1_PMU_GRF_DS_OFFSET 0x0070
|
||||
|
||||
// GPIO[1:4]
|
||||
#define M1_GPIO_1_BASE 0xFE740000
|
||||
#define M1_GPIO_2_BASE 0xFE750000
|
||||
#define M1_GPIO_3_BASE 0xFE760000
|
||||
#define M1_GPIO_4_BASE 0xFE770000
|
||||
// to control clock (SYS_CRU)
|
||||
#define M1_CRU_BASE 0xFDD20000
|
||||
#define M1_CRU_GPIO_CLK_OFFSET 0x037C
|
||||
#define M1_CRU_GPIO_PCLK_BIT 2
|
||||
// to control IOMUX
|
||||
#define M1_SYS_GRF_BASE 0xFDC60000
|
||||
#define M1_SYS_GRF_IOMUX_OFFSET 0x0000
|
||||
#define M1_SYS_GRF_PUPD_OFFSET 0x0080
|
||||
#define M1_SYS_GRF_DS_OFFSET 0x0200
|
||||
|
||||
// Common offset for GPIO registers from each GPIO bank's base address
|
||||
#define M1_GPIO_DIR_OFFSET 0x0008
|
||||
#define M1_GPIO_SET_OFFSET 0x0000
|
||||
#define M1_GPIO_GET_OFFSET 0x0070
|
||||
|
||||
// GPIO DS LEVELS
|
||||
#define DS_LEVEL_0 0x01 //0b000001
|
||||
#define DS_LEVEL_1 0x03 //0b000011
|
||||
#define DS_LEVEL_2 0x07 //0b000111
|
||||
#define DS_LEVEL_3 0x0f //0b001111
|
||||
#define DS_LEVEL_4 0x1f //0b011111
|
||||
#define DS_LEVEL_5 0x3f //0b111111
|
||||
|
||||
//GPIO write mask for WriteByte
|
||||
#define WRITE_BYTE_MASK_GPIO0_H 0x00030000
|
||||
#define WRITE_BYTE_MASK_GPIO0_L 0x40000000
|
||||
#define WRITE_BYTE_MASK_GPIO3_H 0x03C00000
|
||||
#define WRITE_BYTE_MASK_GPIO3_L 0x04000000
|
||||
|
||||
#define CONSUMER "consumer"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void init_odroidm1 (struct libodroid *libwiring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#endif /* __ODROID_M1_H__ */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "odroidn1.h"
|
||||
#include "odroidn2.h"
|
||||
#include "odroidc4.h"
|
||||
#include "odroidm1.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
// Const string define
|
||||
@@ -61,6 +62,7 @@ const char *piModelNames [16] =
|
||||
"ODROID-N2/N2Plus",
|
||||
"ODROID-C4",
|
||||
"ODROID-HC4",
|
||||
"ODROID-M1",
|
||||
};
|
||||
|
||||
const char *piRevisionNames [16] =
|
||||
@@ -507,6 +509,11 @@ int piGpioLayout (void) {
|
||||
libwiring.mem = 4;
|
||||
libwiring.rev = 1;
|
||||
break;
|
||||
case MODEL_ODROID_M1:
|
||||
libwiring.maker = MAKER_ROCKCHIP;
|
||||
libwiring.mem = 5;
|
||||
libwiring.rev = 1;
|
||||
break;
|
||||
case MODEL_UNKNOWN:
|
||||
default:
|
||||
libwiring.model = MAKER_UNKNOWN;
|
||||
@@ -536,7 +543,8 @@ int piGpioLayout (void) {
|
||||
* Rev 1.1 : /sys/class/odroid/boardrev value is 1 (Mass board)
|
||||
* 03xx - Model ODROID N1, 4096M, Hardkernel
|
||||
* 04xx - Model ODROID N2, 4096M, Hardkernel
|
||||
* 05xx - Model ODROID C4, 4096M, Hardkernel
|
||||
* 05xx - Model ODROID C4/HC4, 4096M, Hardkernel
|
||||
* 06xx - Model ODROID M1, 8192M, Hardkernel
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty)
|
||||
@@ -1217,6 +1225,9 @@ int wiringPiSetup (void)
|
||||
case MODEL_ODROID_HC4:
|
||||
init_odroidhc4(&libwiring);
|
||||
break;
|
||||
case MODEL_ODROID_M1:
|
||||
init_odroidm1(&libwiring);
|
||||
break;
|
||||
default:
|
||||
return wiringPiFailure (WPI_ALMOST,
|
||||
"wiringPiSetup: Unknown model\n");
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#define MODEL_ODROID_N2 5
|
||||
#define MODEL_ODROID_C4 6
|
||||
#define MODEL_ODROID_HC4 7
|
||||
#define MODEL_ODROID_M1 8
|
||||
|
||||
#define MAKER_UNKNOWN 0
|
||||
#define MAKER_AMLOGIC 1
|
||||
|
||||
@@ -261,6 +261,7 @@ int wiringPiI2CSetup (const int devId)
|
||||
case MODEL_ODROID_N2:
|
||||
case MODEL_ODROID_C4:
|
||||
case MODEL_ODROID_HC4:
|
||||
case MODEL_ODROID_M1:
|
||||
if (cmpKernelVersion(KERN_NUM_TO_REVISION, 4, 9, 230))
|
||||
device = "/dev/i2c-0";
|
||||
else
|
||||
|
||||
@@ -148,6 +148,7 @@ int wiringPiSPISetupMode (int channel, int speed, int mode)
|
||||
case MODEL_ODROID_C1:
|
||||
case MODEL_ODROID_N2:
|
||||
case MODEL_ODROID_C4:
|
||||
case MODEL_ODROID_M1:
|
||||
sprintf(device, "%s%d", spiDevType0, channel);
|
||||
break;
|
||||
case MODEL_ODROID_XU3:
|
||||
|
||||
Reference in New Issue
Block a user