0001-base.patch (3380B)
1 From 6fecad819376442d057bdd35a0909cfac9df02f5 Mon Sep 17 00:00:00 2001 2 From: John Crispin <blogic@openwrt.org> 3 Date: Thu, 23 Jul 2015 12:18:39 +0200 4 Subject: [PATCH 1/4] base 5 6 --- 7 CMakeLists.txt | 10 ++++------ 8 api/mraa/types.h | 1 + 9 include/mraa_internal.h | 7 +++++++ 10 src/CMakeLists.txt | 5 +++++ 11 src/i2c/i2c.c | 2 +- 12 src/mraa.c | 3 +++ 13 src/uart/uart.c | 1 + 14 7 files changed, 22 insertions(+), 7 deletions(-) 15 16 --- a/CMakeLists.txt 17 +++ b/CMakeLists.txt 18 @@ -14,12 +14,7 @@ 19 set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) 20 21 # Make a version file containing the current version from git. 22 -include (GetGitRevisionDescription) 23 -git_describe (VERSION "--tags") 24 -if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND") 25 - message (WARNING " - Install git to compile a production libmraa!") 26 - set (VERSION "v0.8.0-dirty") 27 -endif () 28 +set (VERSION "v0.8.0") 29 30 message (INFO " - libmraa Version ${VERSION}") 31 32 @@ -84,8 +79,10 @@ 33 set (X86PLAT ON) 34 elseif (DETECTED_ARCH MATCHES "arm.*") 35 set (ARMPLAT ON) 36 +elseif (DETECTED_ARCH MATCHES "mips") 37 + set (MIPSPLAT ON) 38 else () 39 - message(FATAL_ERROR "Only x86 and arm platforms currently supported") 40 + message(FATAL_ERROR "Only x86, arm and mips platforms currently supported") 41 endif() 42 43 if (BUILDSWIGPYTHON) 44 --- a/api/mraa/types.h 45 +++ b/api/mraa/types.h 46 @@ -46,6 +46,7 @@ 47 MRAA_BEAGLEBONE = 6, /**< The different BeagleBone Black Modes B/C */ 48 MRAA_BANANA = 7, /**< Allwinner A20 based Banana Pi and Banana Pro */ 49 MRAA_INTEL_NUC5 = 8, /**< The Intel 5th generations Broadwell NUCs */ 50 + MRAA_MTK_LINKIT = 9, /**< Mediatek MT7688 based Linkit (Air) */ 51 52 // USB platform extenders start at 256 53 MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */ 54 --- a/include/mraa_internal.h 55 +++ b/include/mraa_internal.h 56 @@ -66,6 +66,13 @@ 57 mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board); 58 59 /** 60 + * runtime detect running arm platforms 61 + * 62 + * @return mraa_platform_t of the init'ed platform 63 + */ 64 +mraa_platform_t mraa_mips_platform(); 65 + 66 +/** 67 * helper function to check if file exists 68 * 69 * @param filename to check 70 --- a/src/CMakeLists.txt 71 +++ b/src/CMakeLists.txt 72 @@ -71,6 +71,11 @@ 73 add_subdirectory(usb) 74 endif () 75 76 +if (MIPSPLAT) 77 + add_subdirectory(mips) 78 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMIPSPLAT=1") 79 +endif() 80 + 81 set (mraa_LIB_SRCS 82 ${mraa_LIB_PLAT_SRCS_NOAUTO} 83 # autogenerated version file 84 --- a/src/i2c/i2c.c 85 +++ b/src/i2c/i2c.c 86 @@ -31,9 +31,9 @@ 87 #include <stdlib.h> 88 #include <unistd.h> 89 #include <fcntl.h> 90 +#include <errno.h> 91 #include <inttypes.h> 92 #include <sys/types.h> 93 -#include <sys/errno.h> 94 #include <sys/ioctl.h> 95 #include "linux/i2c-dev.h" 96 97 --- a/src/mraa.c 98 +++ b/src/mraa.c 99 @@ -111,6 +111,9 @@ 100 #elif defined(ARMPLAT) 101 // Use runtime ARM platform detection 102 platform_type = mraa_arm_platform(); 103 +#elif MIPSPLAT 104 + // Use runtime ARM platform detection 105 + platform_type = mraa_mips_platform(); 106 #else 107 #error mraa_ARCH NOTHING 108 #endif 109 --- a/src/uart/uart.c 110 +++ b/src/uart/uart.c 111 @@ -26,6 +26,7 @@ 112 113 #include <stdlib.h> 114 #include <sys/stat.h> 115 +#include <sys/time.h> 116 #include <unistd.h> 117 #include <string.h> 118 #include <termios.h>