diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2012-04-17 16:25:38 +0200 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2012-04-17 22:01:46 -0400 |
commit | 9ea65119f400d5ad9acc3c52bdfd978fb96b930c (patch) | |
tree | 7b1175a757256e3772f9c8afb3f366591a5c093c /c/src/lib/libbsp/sparc/shared/amba/ambapp_depth.c | |
parent | no_cpu: replace no_cpu_isr with rtems_isr (diff) | |
download | rtems-9ea65119f400d5ad9acc3c52bdfd978fb96b930c.tar.bz2 |
LEON: updated AMBA PnP API
The old layer had some limitations/problems for multiple AHB
buses since the data structure containing all AMBA devices
were allocated before scanning.
The new layer create devices as they are found and memory is
allocated using malloc() or bsp_early_malloc() during booting.
The old 8 functions for finding a specific AHB-Slave or
APB-Slave device has been replaced with one function,
ambapp_for_each(), which iterates over all devices matching
the specified search options and calls a user provided
function. The new way lowers the footprint and makes searching
more flexible.
The frequency information is now supported, if the frequency
of one device is reported by the user.
More AHB-to-AHB bridges are supported.
The API has been split into several parts in order to lower the
footprint.
The API also introduces the AMBAPP CORE concept, where one
ambapp_core can be created from one AHB Master, AHB Slave
and one APB Slave, at least one device is required for creating
a core.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/amba/ambapp_depth.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/amba/ambapp_depth.c b/c/src/lib/libbsp/sparc/shared/amba/ambapp_depth.c new file mode 100644 index 0000000000..02fa76743b --- /dev/null +++ b/c/src/lib/libbsp/sparc/shared/amba/ambapp_depth.c @@ -0,0 +1,25 @@ +/* + * AMBA Plug & Play routines + * + * COPYRIGHT (c) 2011 + * Aeroflex 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. + */ + +#include <ambapp.h> + +/* Get bus depth a device is located at */ +int ambapp_depth(struct ambapp_dev *dev) +{ + int depth = 0; + + do { + dev = ambapp_find_parent(dev); + depth++; + } while (dev); + + return depth - 1; +} |