Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spec-sw
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
fmc-projects
spec
spec-sw
Commits
1162d036
Commit
1162d036
authored
12 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
tools: added '-g' option to specmem
parent
4355020e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
tools/spec-cl.c
+1
-1
1 addition, 1 deletion
tools/spec-cl.c
tools/spec-tools.h
+8
-1
8 additions, 1 deletion
tools/spec-tools.h
tools/speclib.c
+7
-4
7 additions, 4 deletions
tools/speclib.c
tools/specmem.c
+10
-3
10 additions, 3 deletions
tools/specmem.c
with
26 additions
and
9 deletions
tools/spec-cl.c
+
1
−
1
View file @
1162d036
...
...
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
exit
(
1
);
}
base
=
spec_get_base
();
base
=
spec_get_base
(
BASE_BAR0
);
if
(
base
==
(
typeof
(
base
))
-
1
)
{
fprintf
(
stderr
,
"%s: spec_get_base(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
...
...
This diff is collapsed.
Click to expand it.
tools/spec-tools.h
+
8
−
1
View file @
1162d036
uint32_t
spec_get_base
(
void
);
uint32_t
spec_get_base
(
int
basenr
);
enum
{
BASE_BAR0
=
0
,
/* for wrpc etc (but lm32 is at 0x80000 offset) */
BASE_BAR2
,
BASE_BAR4
/* for gennum-internal registers */
};
This diff is collapsed.
Click to expand it.
tools/speclib.c
+
7
−
4
View file @
1162d036
/*
* Trivial library function to return
the first
spec memory address
* Trivial library function to return
one of the
spec memory address
es
*/
#include
<stdint.h>
#include
<string.h>
#include
<stdio.h>
#include
<errno.h>
uint32_t
spec_get_base
(
void
)
#include
"spec-tools.h"
uint32_t
spec_get_base
(
int
base
)
{
FILE
*
f
;
int
found
=
0
;
...
...
@@ -21,9 +23,10 @@ uint32_t spec_get_base(void)
if
(
strstr
(
s
,
"Device 10dc:018d"
))
found
=
1
;
}
if
(
found
)
{
if
(
sscanf
(
s
,
" Memory at %x"
,
&
res
)
==
1
)
if
(
found
&&
sscanf
(
s
,
" Memory at %x"
,
&
res
)
==
1
)
{
if
(
!
base
)
break
;
base
--
;
}
}
pclose
(
f
);
...
...
This diff is collapsed.
Click to expand it.
tools/specmem.c
+
10
−
3
View file @
1162d036
...
...
@@ -17,15 +17,22 @@
int
main
(
int
argc
,
char
**
argv
)
{
int
i
,
fd
;
int
i
,
fd
,
bar
=
BASE_BAR0
;
uint32_t
base
,
*
ptr
;
uint32_t
uarg
[
3
];
void
*
map_base
;
char
*
end
;
if
(
argc
>
1
&&
!
strcmp
(
argv
[
1
],
"-g"
))
{
bar
=
BASE_BAR4
;
argv
[
1
]
=
argv
[
0
];
argc
--
;
argv
++
;
}
if
(
argc
<
2
||
argc
>
3
)
{
fprintf
(
stderr
,
"Use:
\"
%s <offset> [<value>]
\"
(I/O is 32 bits)
\n
"
,
"Use:
\"
%s [-g] <offset> [<value>]
\"
"
"(-g selects gennum memory, I/O is 32 bits)
\n
"
,
argv
[
0
]);
exit
(
1
);
}
...
...
@@ -36,7 +43,7 @@ int main(int argc, char **argv)
exit
(
1
);
}
base
=
spec_get_base
();
base
=
spec_get_base
(
bar
);
if
(
base
==
(
typeof
(
base
))
-
1
)
{
fprintf
(
stderr
,
"%s: spec_get_base(): %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment