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
792d2781
Commit
792d2781
authored
Sep 26, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: some cleanup in error messages, remove a bogus printf
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
a9bf1e86
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
spec-cl.c
tools/spec-cl.c
+6
-5
speclib.c
tools/speclib.c
+12
-11
specmem.c
tools/specmem.c
+0
-1
No files found.
tools/spec-cl.c
View file @
792d2781
...
...
@@ -43,22 +43,23 @@ int main(int argc, char **argv)
}
if
(
optind
>=
argc
)
{
fprintf
(
stderr
,
"Expected binary name after options.
\n
"
);
fprintf
(
stderr
,
"%s: Expected binary name after options.
\n
"
,
argv
[
0
]);
exit
(
1
);
}
card
=
spec_open
(
bus
,
dev_fn
);
if
(
!
card
)
{
fprintf
(
stderr
,
"Can't detect a SPEC card under the given "
"adress.
Make sure a SPEC card is present in your PC "
"and the driver is loaded.
\n
"
);
fprintf
(
stderr
,
"
%s:
Can't detect a SPEC card under the given "
"adress.
\n
Make sure a SPEC card is present in your PC "
"and the driver is loaded.
\n
"
,
argv
[
0
]
);
exit
(
1
);
}
if
(
spec_load_lm32
(
card
,
argv
[
optind
],
lm32_base
)
<
0
)
{
fprintf
(
stderr
,
"
Loader failure.
\n
"
);
fprintf
(
stderr
,
"
%s: Loader failure.
\n
"
,
argv
[
0
]
);
exit
(
1
);
}
...
...
tools/speclib.c
View file @
792d2781
...
...
@@ -167,41 +167,42 @@ static char *load_binary_file(const char *filename, size_t *size)
FILE
*
f
;
f
=
fopen
(
filename
,
"r"
);
if
(
!
f
)
if
(
!
f
)
{
fprintf
(
stderr
,
"%s: %s
\n
"
,
filename
,
strerror
(
errno
));
return
NULL
;
if
(
fstat
(
fileno
(
f
),
&
stbuf
)
)
{
}
if
(
fstat
(
fileno
(
f
),
&
stbuf
)
<
0
)
{
fprintf
(
stderr
,
"%s: %s
\n
"
,
filename
,
strerror
(
errno
));
fclose
(
f
);
return
NULL
;
}
if
(
!
S_ISREG
(
stbuf
.
st_mode
))
{
if
(
!
S_ISREG
(
stbuf
.
st_mode
))
{
fprintf
(
stderr
,
"%s: not a regular file
\n
"
,
filename
);
fclose
(
f
);
return
NULL
;
}
buf
=
malloc
(
stbuf
.
st_size
);
if
(
!
buf
)
{
if
(
!
buf
)
{
fprintf
(
stderr
,
"loading %s: %s
\n
"
,
filename
,
strerror
(
errno
));
fclose
(
f
);
return
NULL
;
}
i
=
fread
(
buf
,
1
,
stbuf
.
st_size
,
f
);
fclose
(
f
);
if
(
i
<
0
)
{
f
close
(
f
);
f
printf
(
stderr
,
"reading %s: %s
\n
"
,
filename
,
strerror
(
errno
)
);
free
(
buf
);
return
NULL
;
}
if
(
i
!=
stbuf
.
st_size
)
{
f
close
(
f
);
f
printf
(
stderr
,
"%s: short read
\n
"
,
filename
,
strerror
(
errno
)
);
free
(
buf
);
return
NULL
;
}
fclose
(
f
);
*
size
=
stbuf
.
st_size
;
return
buf
;
}
...
...
tools/specmem.c
View file @
792d2781
...
...
@@ -91,7 +91,6 @@ int main(int argc, char **argv)
}
ptr
=
map_base
+
uarg
[
0
];
printf
(
"%p
\n
"
,
ptr
);
/* by default, operate quietly (only report read value) */
if
(
!
do_write
)
{
uarg
[
1
]
=
*
ptr
;
...
...
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