From 6fecad819376442d057bdd35a0909cfac9df02f5 Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <blogic@openwrt.org>
|
|
Date: Thu, 23 Jul 2015 12:18:39 +0200
|
|
Subject: [PATCH 1/4] base
|
|
|
|
---
|
|
CMakeLists.txt | 10 ++++------
|
|
api/mraa/types.h | 1 +
|
|
include/mraa_internal.h | 7 +++++++
|
|
src/CMakeLists.txt | 5 +++++
|
|
src/i2c/i2c.c | 2 +-
|
|
src/mraa.c | 3 +++
|
|
src/uart/uart.c | 1 +
|
|
7 files changed, 22 insertions(+), 7 deletions(-)
|
|
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -14,12 +14,7 @@
|
|
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
|
|
|
# Make a version file containing the current version from git.
|
|
-include (GetGitRevisionDescription)
|
|
-git_describe (VERSION "--tags")
|
|
-if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND")
|
|
- message (WARNING " - Install git to compile a production libmraa!")
|
|
- set (VERSION "v0.8.0-dirty")
|
|
-endif ()
|
|
+set (VERSION "v0.8.0")
|
|
|
|
message (INFO " - libmraa Version ${VERSION}")
|
|
|
|
@@ -84,8 +79,10 @@
|
|
set (X86PLAT ON)
|
|
elseif (DETECTED_ARCH MATCHES "arm.*")
|
|
set (ARMPLAT ON)
|
|
+elseif (DETECTED_ARCH MATCHES "mips")
|
|
+ set (MIPSPLAT ON)
|
|
else ()
|
|
- message(FATAL_ERROR "Only x86 and arm platforms currently supported")
|
|
+ message(FATAL_ERROR "Only x86, arm and mips platforms currently supported")
|
|
endif()
|
|
|
|
if (BUILDSWIGPYTHON)
|
|
--- a/api/mraa/types.h
|
|
+++ b/api/mraa/types.h
|
|
@@ -46,6 +46,7 @@
|
|
MRAA_BEAGLEBONE = 6, /**< The different BeagleBone Black Modes B/C */
|
|
MRAA_BANANA = 7, /**< Allwinner A20 based Banana Pi and Banana Pro */
|
|
MRAA_INTEL_NUC5 = 8, /**< The Intel 5th generations Broadwell NUCs */
|
|
+ MRAA_MTK_LINKIT = 9, /**< Mediatek MT7688 based Linkit (Air) */
|
|
|
|
// USB platform extenders start at 256
|
|
MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
|
|
--- a/include/mraa_internal.h
|
|
+++ b/include/mraa_internal.h
|
|
@@ -66,6 +66,13 @@
|
|
mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);
|
|
|
|
/**
|
|
+ * runtime detect running arm platforms
|
|
+ *
|
|
+ * @return mraa_platform_t of the init'ed platform
|
|
+ */
|
|
+mraa_platform_t mraa_mips_platform();
|
|
+
|
|
+/**
|
|
* helper function to check if file exists
|
|
*
|
|
* @param filename to check
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -71,6 +71,11 @@
|
|
add_subdirectory(usb)
|
|
endif ()
|
|
|
|
+if (MIPSPLAT)
|
|
+ add_subdirectory(mips)
|
|
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMIPSPLAT=1")
|
|
+endif()
|
|
+
|
|
set (mraa_LIB_SRCS
|
|
${mraa_LIB_PLAT_SRCS_NOAUTO}
|
|
# autogenerated version file
|
|
--- a/src/i2c/i2c.c
|
|
+++ b/src/i2c/i2c.c
|
|
@@ -31,9 +31,9 @@
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
+#include <errno.h>
|
|
#include <inttypes.h>
|
|
#include <sys/types.h>
|
|
-#include <sys/errno.h>
|
|
#include <sys/ioctl.h>
|
|
#include "linux/i2c-dev.h"
|
|
|
|
--- a/src/mraa.c
|
|
+++ b/src/mraa.c
|
|
@@ -111,6 +111,9 @@
|
|
#elif defined(ARMPLAT)
|
|
// Use runtime ARM platform detection
|
|
platform_type = mraa_arm_platform();
|
|
+#elif MIPSPLAT
|
|
+ // Use runtime ARM platform detection
|
|
+ platform_type = mraa_mips_platform();
|
|
#else
|
|
#error mraa_ARCH NOTHING
|
|
#endif
|
|
--- a/src/uart/uart.c
|
|
+++ b/src/uart/uart.c
|
|
@@ -26,6 +26,7 @@
|
|
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
+#include <sys/time.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <termios.h>
|