0001-base.patch 3.3 KB

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