Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple PCIe FMC carrier SPEC - Software
Commits
1162d036
Commit
1162d036
authored
Mar 19, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: added '-g' option to specmem
parent
4355020e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
spec-cl.c
tools/spec-cl.c
+1
-1
spec-tools.h
tools/spec-tools.h
+8
-1
speclib.c
tools/speclib.c
+7
-4
specmem.c
tools/specmem.c
+10
-3
No files found.
tools/spec-cl.c
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
));
...
...
tools/spec-tools.h
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 */
};
tools/speclib.c
View file @
1162d036
/*
* Trivial library function to return
the first spec memory addres
s
* Trivial library function to return
one of the spec memory addresse
s
*/
#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
);
...
...
tools/specmem.c
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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment