add freertos env
authorSam Sortais <sam.sortais@xilinx.com>
Thu, 18 Aug 2016 11:10:11 +0000 (04:10 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:49 +0000 (22:01 -0700)
env_sleep_msec is needed by openamp lib.
this will eventually disapear when moved to libmetal.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
lib/system/freertos/CMakeLists.txt [new file with mode: 0644]
lib/system/freertos/env.c [new file with mode: 0755]
lib/system/freertos/machine/CMakeLists.txt [new file with mode: 0644]
lib/system/freertos/machine/zynq7/CMakeLists.txt [new file with mode: 0644]
lib/system/freertos/machine/zynqmp_r5/CMakeLists.txt [new file with mode: 0644]

diff --git a/lib/system/freertos/CMakeLists.txt b/lib/system/freertos/CMakeLists.txt
new file mode 100644 (file)
index 0000000..afd06ab
--- /dev/null
@@ -0,0 +1,2 @@
+collect (PROJECT_LIB_SOURCES env.c)
+add_subdirectory (machine)
diff --git a/lib/system/freertos/env.c b/lib/system/freertos/env.c
new file mode 100755 (executable)
index 0000000..3655433
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Mentor Graphics Corporation
+ * All rights reserved.
+ * Copyright (c) 2015 Xilinx, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. Neither the name of Mentor Graphics Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**************************************************************************
+ * FILE NAME
+ *
+ *       env.c
+ *
+ *
+ * DESCRIPTION
+ *
+ *       This file is FreeRTOS Implementation of env layer for OpenAMP.
+ *
+ *
+ **************************************************************************/
+
+#include "openamp/env.h" 
+
+#include "FreeRTOS.h" 
+//#include "portmacro.h" 
+#include "task.h" 
+
+
+/**
+ * env_sleep_msec
+ *
+ * Suspends the calling thread for given time , in msecs.
+ */
+
+void env_sleep_msec(int num_msec)
+{
+       int xDelay; 
+
+       xDelay  = num_msec / portTICK_PERIOD_MS; 
+       if((num_msec % portTICK_PERIOD_MS)!=0) {
+               xDelay++; 
+       }
+       vTaskDelay( xDelay ); 
+} 
+
+
+/**
+ * 
+ * env_get_timestamp
+ *
+ * Returns a 64 bit time stamp.
+ *
+ *
+ */
+unsigned long long env_get_timestamp(void)
+{
+
+       /* TODO: Provide implementation for baremetal */
+       return 0;
+}
+
diff --git a/lib/system/freertos/machine/CMakeLists.txt b/lib/system/freertos/machine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9720224
--- /dev/null
@@ -0,0 +1,3 @@
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
+  add_subdirectory (${PROJECT_MACHINE})
+endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE}/CMakeLists.txt")
diff --git a/lib/system/freertos/machine/zynq7/CMakeLists.txt b/lib/system/freertos/machine/zynq7/CMakeLists.txt
new file mode 100644 (file)
index 0000000..19b24ca
--- /dev/null
@@ -0,0 +1,5 @@
+
+#collect (PROJECT_LIB_SOURCES machine_system.c)
+
+find_path (LIBXIL_INCLUDE_DIR NAMES xparameters.h PATHS ${CMAKE_FIND_ROOT_PATH})
+collect (PROJECT_INC_DIRS ${LIBXIL_INCLUDE_DIR})
diff --git a/lib/system/freertos/machine/zynqmp_r5/CMakeLists.txt b/lib/system/freertos/machine/zynqmp_r5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9f9b680
--- /dev/null
@@ -0,0 +1,4 @@
+
+# FIX ME: CMAKE_FIND_ROOT_PATH doesn't work
+find_path (LIBXIL_INCLUDE_DIR NAMES xparameters.h PATHS ${CMAKE_FIND_ROOT_PATH})
+collect (PROJECT_INC_DIRS ${LIBXIL_INCLUDE_DIR})