LEON: added get_resarray_count() helper routine

This commit is contained in:
Daniel Hellstrom
2015-02-10 16:05:38 +01:00
parent b787bead30
commit 3f38335b02
7 changed files with 63 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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