2012-04-17 16:25:38 +02:00
|
|
|
/*
|
|
|
|
|
* 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
|
2014-03-21 08:10:47 +11:00
|
|
|
* http://www.rtems.org/license/LICENSE.
|
2012-04-17 16:25:38 +02:00
|
|
|
*/
|
|
|
|
|
|
2018-12-22 07:13:44 +01:00
|
|
|
#include <grlib/ambapp.h>
|
2012-04-17 16:25:38 +02:00
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
}
|