aboutsummaryrefslogtreecommitdiff
path: root/libs/libmraa/patches/0001-base.patch
blob: 9b36ea3c65b5939e28ded7cbb35f573aa667d0a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
 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" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
-  message (WARNING " - Install git to compile a production libmraa!")
-  set (VERSION "v0.8.1-dirty")
-endif ()
+set (VERSION "v0.9.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>