Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
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
Commits
f24b4863
Commit
f24b4863
authored
Nov 16, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:tool: print build information
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
8e770510
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
spec-firmware-version.c
software/tools/spec-firmware-version.c
+35
-2
No files found.
software/tools/spec-firmware-version.c
View file @
f24b4863
...
@@ -34,6 +34,7 @@ static void help(void)
...
@@ -34,6 +34,7 @@ static void help(void)
"
\t
-p <PCIID>
\n
"
"
\t
-p <PCIID>
\n
"
"
\t
-b print spec-base
\n
"
"
\t
-b print spec-base
\n
"
"
\t
-a print spec-application
\n
"
"
\t
-a print spec-application
\n
"
"
\t
-B print FPGA build information
\n
"
,
"
\t
-1 print on a single line
\n
"
"
\t
-1 print on a single line
\n
"
"
\t
-V print version
\n
"
"
\t
-V print version
\n
"
"
\t
-h print help
\n
"
,
"
\t
-h print help
\n
"
,
...
@@ -130,6 +131,33 @@ static void print_meta_capabilities(uint32_t cap)
...
@@ -130,6 +131,33 @@ static void print_meta_capabilities(uint32_t cap)
fputs
(
"
\b\b
"
,
stdout
);
fputs
(
"
\b\b
"
,
stdout
);
}
}
#define SPEC_BASE_REGS_BUILDINFO 0x200UL
#define SPEC_BASE_REGS_BUILDINFO_SIZE 256
static
int
print_build_info
(
int
fd
)
{
char
*
bld
;
char
*
bld_c
;
bld
=
mmap
(
NULL
,
SPEC_BASE_REGS_BUILDINFO
+
SPEC_BASE_REGS_BUILDINFO_SIZE
,
PROT_READ
,
MAP_SHARED
,
fd
,
0
);
if
((
long
)
bld
==
-
1
)
{
fputs
(
"Failed while reading SPEC-BASE FPGA BUILD INFO
\n
"
,
stderr
);
return
-
1
;
}
fputs
(
"build-info :
\n
"
,
stdout
);
bld_c
=
bld
+
SPEC_BASE_REGS_BUILDINFO
;
while
(
*
bld_c
!=
0
)
{
fputc
(
*
bld_c
,
stdout
);
if
(
*
bld_c
==
'\n'
)
fputs
(
" "
,
stdout
);
bld_c
++
;
}
fputc
(
'\n'
,
stdout
);
munmap
(
bld
,
SPEC_BASE_REGS_BUILDINFO
+
SPEC_BASE_REGS_BUILDINFO_SIZE
);
return
0
;
}
static
void
print_meta_id
(
struct
spec_meta_id
*
rom
)
static
void
print_meta_id
(
struct
spec_meta_id
*
rom
)
{
{
fputc
(
'\n'
,
stdout
);
fputc
(
'\n'
,
stdout
);
...
@@ -228,7 +256,7 @@ static int print_app_meta_id(int fd)
...
@@ -228,7 +256,7 @@ static int print_app_meta_id(int fd)
#define PCIID_STR_LEN 16
#define PCIID_STR_LEN 16
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
bool
base
=
false
,
app
=
false
;
bool
base
=
false
,
app
=
false
,
buildinfo
=
false
;
int
err
;
int
err
;
int
fd
;
int
fd
;
char
path
[
128
];
char
path
[
128
];
...
@@ -242,7 +270,7 @@ int main(int argc, char *argv[])
...
@@ -242,7 +270,7 @@ int main(int argc, char *argv[])
if
(
err
)
if
(
err
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
while
((
opt
=
getopt
(
argc
,
argv
,
"h?Vvp:ba1"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"h?Vvp:ba1
B
"
))
!=
-
1
)
{
switch
(
opt
)
{
switch
(
opt
)
{
case
'h'
:
case
'h'
:
case
'?'
:
case
'?'
:
...
@@ -266,6 +294,9 @@ int main(int argc, char *argv[])
...
@@ -266,6 +294,9 @@ int main(int argc, char *argv[])
case
'1'
:
case
'1'
:
singleline
=
true
;
singleline
=
true
;
break
;
break
;
case
'B'
:
buildinfo
=
true
;
break
;
}
}
}
}
if
(
strlen
(
pciid_str
)
==
0
)
{
if
(
strlen
(
pciid_str
)
==
0
)
{
...
@@ -284,6 +315,8 @@ int main(int argc, char *argv[])
...
@@ -284,6 +315,8 @@ int main(int argc, char *argv[])
err
=
print_base_meta_id
(
fd
);
err
=
print_base_meta_id
(
fd
);
if
(
app
)
if
(
app
)
err
=
print_app_meta_id
(
fd
);
err
=
print_app_meta_id
(
fd
);
if
(
buildinfo
)
err
=
print_build_info
(
fd
);
close
(
fd
);
close
(
fd
);
exit
(
err
?
EXIT_FAILURE
:
EXIT_SUCCESS
);
exit
(
err
?
EXIT_FAILURE
:
EXIT_SUCCESS
);
...
...
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