Private
Public Access
2
0

arm: add initial skeleton for arm platform support

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-11-21 00:35:57 +00:00
parent 79afd9173a
commit f9d466bb84
5 changed files with 59 additions and 1 deletions

View 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

View 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

5
src/arm/CMakeLists.txt Normal file
View File

@@ -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
)

36
src/arm/arm.c Normal file
View File

@@ -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;
}

View 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) {