summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2015-02-10 16:05:38 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2015-04-17 01:10:23 +0200
commit3f38335b02d1b9a7853a0e133b406f57428eb07f (patch)
tree28879e50cad41dd709b2aa46714efaf718c007d9 /c
parentGR1553B: fixed build warnings (diff)
downloadrtems-3f38335b02d1b9a7853a0e133b406f57428eb07f.tar.bz2
LEON: added get_resarray_count() helper routine
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/Makefile.am3
-rw-r--r--c/src/lib/libbsp/sparc/leon2/Makefile.am2
-rw-r--r--c/src/lib/libbsp/sparc/leon2/preinstall.am4
-rw-r--r--c/src/lib/libbsp/sparc/leon3/Makefile.am2
-rw-r--r--c/src/lib/libbsp/sparc/leon3/preinstall.am4
-rw-r--r--c/src/lib/libbsp/sparc/shared/drvmgr/get_resarray_count.c20
-rw-r--r--c/src/lib/libbsp/sparc/shared/include/drvmgr/bspcommon.h28
7 files changed, 63 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/Makefile.am b/c/src/lib/libbsp/sparc/Makefile.am
index e17f03a74c..af0df0a364 100644
--- a/c/src/lib/libbsp/sparc/Makefile.am
+++ b/c/src/lib/libbsp/sparc/Makefile.am
@@ -149,10 +149,13 @@ EXTRA_DIST += shared/drvmgr/ambapp_bus.c
EXTRA_DIST += shared/drvmgr/ambapp_bus_grlib.c
EXTRA_DIST += shared/drvmgr/ambapp_bus_leon2.c
EXTRA_DIST += shared/drvmgr/leon2_amba_bus.c
+EXTRA_DIST += shared/drvmgr/get_resarray_count.c
EXTRA_DIST += shared/include/drvmgr/ambapp_bus_grlib.h
EXTRA_DIST += shared/include/drvmgr/ambapp_bus.h
EXTRA_DIST += shared/include/drvmgr/leon2_amba_bus.h
+EXTRA_DIST += shared/include/drvmgr/bspcommon.h
+
# GR712
EXTRA_DIST += shared/ascs/grascs.c
EXTRA_DIST += shared/include/grascs.h
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index 3f2cd9fc88..32ca8aacd8 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -200,9 +200,11 @@ libbsp_a_SOURCES += ../../sparc/shared/tmtc/grtm.c
include_drvmgrdir = $(includedir)/drvmgr
include_drvmgr_HEADERS = ../../sparc/shared/include/drvmgr/ambapp_bus.h
include_drvmgr_HEADERS += ../../sparc/shared/include/drvmgr/leon2_amba_bus.h
+include_drvmgr_HEADERS += ../../sparc/shared/include/drvmgr/bspcommon.h
libbsp_a_SOURCES += ../../sparc/shared/drvmgr/ambapp_bus.c
libbsp_a_SOURCES += ../../sparc/shared/drvmgr/ambapp_bus_leon2.c
libbsp_a_SOURCES += ../../sparc/shared/drvmgr/leon2_amba_bus.c
+libbsp_a_SOURCES += ../../sparc/shared/drvmgr/get_resarray_count.c
if HAS_SMP
libbsp_a_SOURCES += ../../shared/bspsmp.c
diff --git a/c/src/lib/libbsp/sparc/leon2/preinstall.am b/c/src/lib/libbsp/sparc/leon2/preinstall.am
index cf5515b282..3240720045 100644
--- a/c/src/lib/libbsp/sparc/leon2/preinstall.am
+++ b/c/src/lib/libbsp/sparc/leon2/preinstall.am
@@ -262,6 +262,10 @@ $(PROJECT_INCLUDE)/drvmgr/leon2_amba_bus.h: ../../sparc/shared/include/drvmgr/le
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/drvmgr/leon2_amba_bus.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/drvmgr/leon2_amba_bus.h
+$(PROJECT_INCLUDE)/drvmgr/bspcommon.h: ../../sparc/shared/include/drvmgr/bspcommon.h $(PROJECT_INCLUDE)/drvmgr/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/drvmgr/bspcommon.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/drvmgr/bspcommon.h
+
if HAS_NETWORKING
$(PROJECT_INCLUDE)/greth.h: ../../sparc/shared/include/greth.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/greth.h
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index de6a4f8225..5fa2d5a1e8 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -231,8 +231,10 @@ libbsp_a_SOURCES += ../../sparc/shared/tmtc/grtm.c
include_drvmgrdir = $(includedir)/drvmgr
include_drvmgr_HEADERS = ../../sparc/shared/include/drvmgr/ambapp_bus_grlib.h
include_drvmgr_HEADERS += ../../sparc/shared/include/drvmgr/ambapp_bus.h
+include_drvmgr_HEADERS += ../../sparc/shared/include/drvmgr/bspcommon.h
libbsp_a_SOURCES += ../../sparc/shared/drvmgr/ambapp_bus.c
libbsp_a_SOURCES += ../../sparc/shared/drvmgr/ambapp_bus_grlib.c
+libbsp_a_SOURCES += ../../sparc/shared/drvmgr/get_resarray_count.c
if HAS_SMP
libbsp_a_SOURCES += startup/bspsmp.c
diff --git a/c/src/lib/libbsp/sparc/leon3/preinstall.am b/c/src/lib/libbsp/sparc/leon3/preinstall.am
index 441102f013..98d94abf6f 100644
--- a/c/src/lib/libbsp/sparc/leon3/preinstall.am
+++ b/c/src/lib/libbsp/sparc/leon3/preinstall.am
@@ -310,6 +310,10 @@ $(PROJECT_INCLUDE)/drvmgr/ambapp_bus.h: ../../sparc/shared/include/drvmgr/ambapp
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/drvmgr/ambapp_bus.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/drvmgr/ambapp_bus.h
+$(PROJECT_INCLUDE)/drvmgr/bspcommon.h: ../../sparc/shared/include/drvmgr/bspcommon.h $(PROJECT_INCLUDE)/drvmgr/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/drvmgr/bspcommon.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/drvmgr/bspcommon.h
+
if HAS_NETWORKING
$(PROJECT_INCLUDE)/greth.h: ../../sparc/shared/include/greth.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/greth.h
diff --git a/c/src/lib/libbsp/sparc/shared/drvmgr/get_resarray_count.c b/c/src/lib/libbsp/sparc/shared/drvmgr/get_resarray_count.c
new file mode 100644
index 0000000000..6fb57195c1
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/shared/drvmgr/get_resarray_count.c
@@ -0,0 +1,20 @@
+/* Common driver configuration routines.
+ *
+ * COPYRIGHT (c) 2015.
+ * Cobham Gaisler.
+ *
+ * The license and distribution terms for this file may be
+ * found in found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <stdlib.h>
+#include <drvmgr/bspcommon.h>
+
+int get_resarray_count(struct drvmgr_bus_res **array)
+{
+ int i = 0;
+ while (array[i] != NULL)
+ i++;
+ return i;
+}
diff --git a/c/src/lib/libbsp/sparc/shared/include/drvmgr/bspcommon.h b/c/src/lib/libbsp/sparc/shared/include/drvmgr/bspcommon.h
new file mode 100644
index 0000000000..08c6198859
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/shared/include/drvmgr/bspcommon.h
@@ -0,0 +1,28 @@
+/* Common BSP/driver configuration routines.
+ *
+ * COPYRIGHT (c) 2015.
+ * Cobham Gaisler.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ */
+
+#ifndef __BSPCOMMON_H__
+#define __BSPCOMMON_H__
+
+#include <drvmgr/drvmgr.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Count driver resource array length. Array must be terminated with a NULL */
+int get_resarray_count(struct drvmgr_bus_res **array);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif