summaryrefslogtreecommitdiffstats
path: root/tools/cpu/nios2/bridges.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-08-15 21:02:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-08-15 21:02:55 +0000
commit16fd5a99e1a8c433077e70c1a48e42cc01bf7d29 (patch)
tree72d3d6b2daa4c48f453ac18e32ab20fbaa11d92a /tools/cpu/nios2/bridges.c
parent5f885443699b77018acccb9fff05f7d436f4fbb8 (diff)
downloadrtems-16fd5a99e1a8c433077e70c1a48e42cc01bf7d29.tar.bz2
2006-08-15 Kolja Waschk <kawk@telos.de>
* linkcmds.c, linkcmds.h, memory.c, memory.h, sample.ptf: New files. * bridges.c: corrected detection of bridged connections * clocks.c: removed a printf * linkcmds.[ch] new files, added output of linker script * Makefile.am: added new files * memory.[ch]: new files, detection of memory in SOPC configuration * nios2gen.c: updated command line parsing and output control * output.[ch]: improved output of BSP header file * ptf.[ch]: added ptf_dump_ptf_item and small fixes * sample.ptf: new file, sample configuration for nios2gen * README: updated
Diffstat (limited to 'tools/cpu/nios2/bridges.c')
-rw-r--r--tools/cpu/nios2/bridges.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/cpu/nios2/bridges.c b/tools/cpu/nios2/bridges.c
index f792d5e1aa..e5f36e07c4 100644
--- a/tools/cpu/nios2/bridges.c
+++ b/tools/cpu/nios2/bridges.c
@@ -29,6 +29,9 @@
now we simply assume that bridges never translate anything.
*/
+#include <string.h>
+#include <stdlib.h>
+
#include "ptf.h"
#include "bridges.h"
@@ -40,24 +43,15 @@ int is_bridged(
char *curr_master;
bus_bridge_pair *bbp;
- curr_master = dev_master;
- while(curr_master != NULL)
- {
- /* Does cpu_master master curr_master? */
- if(strcmp(cpu_master, curr_master) == 0) return 1; /* yes, cpu_masters cm */
+ if(strcmp(cpu_master, dev_master) == 0) return 1; /* cpu directly masters dev */
- /* No, cm is attached to a bridge? */
- bbp = bridges;
- while(bbp != NULL)
+ for(bbp = bridges; bbp != NULL; bbp=bbp->next)
+ {
+ if(strcmp(cpu_master, bbp->mastered_by) == 0 &&
+ is_bridged(bbp->bridges_to, dev_master, bridges))
{
- if(strcmp(bbp->bridges_to, curr_master) == 0)
- {
- curr_master = bbp->mastered_by;
- break;
- };
- bbp = bbp->next;
- };
- if(bbp == NULL) curr_master = NULL;
+ return 1; /* cpu masters dev via bridge */
+ }
};
return 0;