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
8e770510
Commit
8e770510
authored
Nov 12, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: format the output for humans and machines
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
09c7e423
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
19 deletions
+85
-19
spec.h
software/include/uapi/linux/spec.h
+10
-0
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+0
-10
spec-firmware-version.c
software/tools/spec-firmware-version.c
+75
-9
No files found.
software/include/uapi/linux/spec.h
View file @
8e770510
...
@@ -38,6 +38,16 @@
...
@@ -38,6 +38,16 @@
#define SPEC_META_BOM_VER_MASK 0x0000FFFF
#define SPEC_META_BOM_VER_MASK 0x0000FFFF
#define SPEC_META_VERSION_MASK 0xFFFF0000
#define SPEC_META_VERSION_MASK 0xFFFF0000
#ifndef BIT
#define BIT(_b) (1 << _b)
#endif
#define SPEC_META_CAP_VIC BIT(0)
#define SPEC_META_CAP_THERM BIT(1)
#define SPEC_META_CAP_SPI BIT(2)
#define SPEC_META_CAP_WR BIT(3)
#define SPEC_META_CAP_BLD BIT(4)
#define SPEC_META_CAP_DMA BIT(5)
/**
/**
* struct spec_meta_id Metadata
* struct spec_meta_id Metadata
*/
*/
...
...
software/kernel/spec-core-fpga.c
View file @
8e770510
...
@@ -64,16 +64,6 @@ enum spec_fpga_therm_offsets {
...
@@ -64,16 +64,6 @@ enum spec_fpga_therm_offsets {
SPEC_FPGA_THERM_TEMP
=
SPEC_BASE_REGS_THERM_ID
+
0x8
,
SPEC_FPGA_THERM_TEMP
=
SPEC_BASE_REGS_THERM_ID
+
0x8
,
};
};
enum
spec_fpga_meta_cap_mask
{
SPEC_META_CAP_VIC
=
BIT
(
0
),
SPEC_META_CAP_THERM
=
BIT
(
1
),
SPEC_META_CAP_SPI
=
BIT
(
2
),
SPEC_META_CAP_WR
=
BIT
(
3
),
SPEC_META_CAP_BLD
=
BIT
(
4
),
SPEC_META_CAP_DMA
=
BIT
(
5
),
};
static
const
struct
debugfs_reg32
spec_fpga_debugfs_reg32
[]
=
{
static
const
struct
debugfs_reg32
spec_fpga_debugfs_reg32
[]
=
{
{
{
.
name
=
"Application offset"
,
.
name
=
"Application offset"
,
...
...
software/tools/spec-firmware-version.c
View file @
8e770510
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <getopt.h>
#include <getopt.h>
#include <libgen.h>
#include <libgen.h>
#include <errno.h>
#include <errno.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -67,28 +68,93 @@ static void print_meta_id_one(struct spec_meta_id *rom)
...
@@ -67,28 +68,93 @@ static void print_meta_id_one(struct spec_meta_id *rom)
SPEC_META_VERSION_MIN
(
rom
->
version
),
SPEC_META_VERSION_MIN
(
rom
->
version
),
SPEC_META_VERSION_PATCH
(
rom
->
version
));
SPEC_META_VERSION_PATCH
(
rom
->
version
));
if
(
verbose
>
0
)
{
if
(
verbose
>
0
)
{
fprintf
(
stdout
,
",%08x%08x%08x%08x,%s,%08x,%08x%08x%08x%08x"
,
fprintf
(
stdout
,
"%08x,%08x,%08x%08x%08x%08x,%08x%08x%08x%08x"
,
rom
->
cap
,
rom
->
bom
,
rom
->
src
[
0
],
rom
->
src
[
1
],
rom
->
src
[
2
],
rom
->
src
[
3
],
rom
->
src
[
0
],
rom
->
src
[
1
],
rom
->
src
[
2
],
rom
->
src
[
3
],
bom_to_str
(
rom
->
bom
),
rom
->
cap
,
rom
->
uuid
[
0
],
rom
->
uuid
[
1
],
rom
->
uuid
[
2
],
rom
->
uuid
[
3
]);
rom
->
uuid
[
0
],
rom
->
uuid
[
1
],
rom
->
uuid
[
2
],
rom
->
uuid
[
3
]);
}
}
fputc
(
'\n'
,
stdout
);
fputc
(
'\n'
,
stdout
);
}
}
static
void
print_meta_vendor
(
uint32_t
vendor
)
{
switch
(
vendor
)
{
case
SPEC_META_VENDOR_ID
:
fputs
(
"CERN"
,
stdout
);
break
;
default:
fprintf
(
stdout
,
"unknown (0x%08"
PRIx32
")"
,
vendor
);
break
;
}
}
static
void
print_meta_device
(
uint32_t
device
)
{
switch
(
device
)
{
case
SPEC_META_DEVICE_ID
:
fputs
(
"spec-base"
,
stdout
);
break
;
default:
fprintf
(
stdout
,
"unknown (0x%08"
PRIx32
")"
,
device
);
break
;
}
}
static
const
char
*
capability
[]
=
{
"vic"
,
"thermometer"
,
"spi"
,
"white-rabbit"
,
"build-info"
,
"dma-engine"
,
};
static
void
print_meta_capabilities
(
uint32_t
cap
)
{
bool
has_cap
=
false
;
int
i
;
for
(
i
=
0
;
i
<
32
;
++
i
)
{
if
(
i
<
6
)
{
/* known bits */
if
(
cap
&
BIT
(
i
))
{
fputs
(
capability
[
i
],
stdout
);
fputs
(
", "
,
stdout
);
has_cap
=
true
;
}
}
else
{
if
(
cap
&
BIT
(
i
))
fprintf
(
stdout
,
"unknown BIT(%d), "
,
i
);
}
}
if
(
has_cap
)
fputs
(
"
\b\b
"
,
stdout
);
}
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
);
fprintf
(
stdout
,
" vendor : 0x%08x
\n
"
,
rom
->
vendor
);
fprintf
(
stdout
,
" device : 0x%08x
\n
"
,
rom
->
device
);
fprintf
(
stdout
,
" vendor : "
);
fprintf
(
stdout
,
" version : %u.%u.%u
\n
"
,
print_meta_vendor
(
rom
->
vendor
);
fputc
(
'\n'
,
stdout
);
fprintf
(
stdout
,
" device : "
);
print_meta_device
(
rom
->
device
);
fputc
(
'\n'
,
stdout
);
fprintf
(
stdout
,
" version : %u.%u.%u
\n
"
,
SPEC_META_VERSION_MAJ
(
rom
->
version
),
SPEC_META_VERSION_MAJ
(
rom
->
version
),
SPEC_META_VERSION_MIN
(
rom
->
version
),
SPEC_META_VERSION_MIN
(
rom
->
version
),
SPEC_META_VERSION_PATCH
(
rom
->
version
));
SPEC_META_VERSION_PATCH
(
rom
->
version
));
if
(
verbose
>
0
)
{
fprintf
(
stdout
,
" capabilities : "
);
print_meta_capabilities
(
rom
->
cap
);
fputc
(
'\n'
,
stdout
);
if
(
verbose
>
0
)
{
fprintf
(
stdout
,
" byte-order : %s
\n
"
,
bom_to_str
(
rom
->
bom
));
fprintf
(
stdout
,
" byte-order : %s
\n
"
,
bom_to_str
(
rom
->
bom
));
fprintf
(
stdout
,
" sources : %08x%08x%08x%08x
\n
"
,
fprintf
(
stdout
,
" sources : %08x%08x%08x%08x
\n
"
,
rom
->
src
[
0
],
rom
->
src
[
1
],
rom
->
src
[
2
],
rom
->
src
[
3
]);
rom
->
src
[
0
],
rom
->
src
[
1
],
rom
->
src
[
2
],
rom
->
src
[
3
]);
fprintf
(
stdout
,
" capabilities : 0x%08x
\n
"
,
rom
->
cap
);
fprintf
(
stdout
,
" UUID : %08x%08x%08x%08x
\n
"
,
fprintf
(
stdout
,
" UUID : %08x%08x%08x%08x
\n
"
,
rom
->
uuid
[
0
],
rom
->
uuid
[
1
],
rom
->
uuid
[
0
],
rom
->
uuid
[
1
],
rom
->
uuid
[
2
],
rom
->
uuid
[
3
]);
rom
->
uuid
[
2
],
rom
->
uuid
[
3
]);
...
@@ -105,7 +171,7 @@ static int print_base_meta_id(int fd)
...
@@ -105,7 +171,7 @@ static int print_base_meta_id(int fd)
fputs
(
"Failed while reading SPEC-BASE FPGA ROM
\n
"
,
stderr
);
fputs
(
"Failed while reading SPEC-BASE FPGA ROM
\n
"
,
stderr
);
return
-
1
;
return
-
1
;
}
}
fputs
(
"
spec-
base: "
,
stdout
);
fputs
(
"base: "
,
stdout
);
if
(
singleline
)
if
(
singleline
)
print_meta_id_one
(
rom
);
print_meta_id_one
(
rom
);
else
else
...
@@ -149,7 +215,7 @@ static int print_app_meta_id(int fd)
...
@@ -149,7 +215,7 @@ static int print_app_meta_id(int fd)
fputs
(
"Failed while reading SPEC-APP FPGA ROM
\n
"
,
stderr
);
fputs
(
"Failed while reading SPEC-APP FPGA ROM
\n
"
,
stderr
);
return
-
1
;
return
-
1
;
}
}
fputs
(
"
spec-
application: "
,
stdout
);
fputs
(
"application: "
,
stdout
);
if
(
singleline
)
if
(
singleline
)
print_meta_id_one
(
rom
);
print_meta_id_one
(
rom
);
else
else
...
...
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