arm: add initial skeleton for arm platform support
authorThomas Ingleby <thomas.c.ingleby@intel.com>
Fri, 21 Nov 2014 00:35:57 +0000 (00:35 +0000)
committerThomas Ingleby <thomas.c.ingleby@intel.com>
Mon, 8 Dec 2014 15:32:42 +0000 (15:32 +0000)
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
include/mraa_internal.h
src/CMakeLists.txt
src/arm/CMakeLists.txt [new file with mode: 0644]
src/arm/arm.c [new file with mode: 0644]
src/mraa.c

index 8905f65..b5f7a3f 100644 (file)
@@ -54,12 +54,19 @@ mraa_result_t mraa_setup_mux_mapped(mraa_pin_t meta);
 mraa_result_t mraa_setup_uart(int index);
 
 /**
- * Runtime detect running x86 platform
+ * runtime detect running x86 platform
  *
  * @return mraa_platform_t of the init'ed platform
  */
 mraa_platform_t mraa_x86_platform();
 
+/**
+ * runtime detect running arm platforms
+ *
+ * @return mraa_platform_t of the init'ed platform
+ */
+mraa_platform_t mraa_arm_platform();
+
 #ifdef __cplusplus
 }
 #endif
index adf4c71..9cceb96 100644 (file)
@@ -23,6 +23,11 @@ if (X86PLAT)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DX86PLAT=1")
 endif()
 
+if (ARMPLAT)
+  add_subdirectory(arm)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DARMPLAT=1")
+endif()
+
 set (mraa_LIB_SRCS
   ${mraa_LIB_SRCS_NOAUTO}
 # autogenerated version file
diff --git a/src/arm/CMakeLists.txt b/src/arm/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7f06106
--- /dev/null
@@ -0,0 +1,5 @@
+message (INFO " - Adding ARM platforms")
+set (mraa_LIB_SRCS_NOAUTO ${mraa_LIB_SRCS_NOAUTO}
+  ${PROJECT_SOURCE_DIR}/src/arm/arm.c
+  PARENT_SCOPE
+)
diff --git a/src/arm/arm.c b/src/arm/arm.c
new file mode 100644 (file)
index 0000000..f0eda22
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
+ * Copyright (c) 2014 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+
+#include "mraa_internal.h"
+
+mraa_platform_t
+mraa_arm_platform()
+{
+    mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
+    return platform_type;
+}
+
+
index 321e165..6b3a5da 100644 (file)
@@ -81,6 +81,11 @@ mraa_init()
 #ifdef X86PLAT
     // Use runtime x86 platform detection
     platform_type = mraa_x86_platform();
+#elif ARMPLAT
+    // Use runtime ARM platform detection
+    platform_type = mraa_arm_platform();
+#else
+    #error mraa_ARCH NOTHING
 #endif
 
     if (plat == NULL) {