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
aff79eb4
Commit
aff79eb4
authored
Nov 28, 2016
by
Tjeerd J. Pinkert
Committed by
Grzegorz Daniluk
Nov 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flash tools, add help message and description in the manual
parent
c0e18a70
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
13 deletions
+46
-13
spec-sw.in
doc/spec-sw.in
+20
-1
flash-read.c
tools/flash-read.c
+12
-5
flash-write.c
tools/flash-write.c
+14
-7
No files found.
doc/spec-sw.in
View file @
aff79eb4
...
...
@@ -1350,7 +1350,7 @@ one specific SPEC card if you have more than one:
@item
-
b <bus>
This option specifies the bus number
This option specifies the bus number
. See @i
{
flash
-
read
}
for an example.
@item
-
d <devfn>
...
...
@@ -1403,6 +1403,25 @@ The tools currently available are:
SPEC. The default base address for the peripheral is
0
xe
0500
but you can can change it passing @code
{
-
u <address>
}
.
@item flash
-
read
Program to read
(
a part of
)
the flash memory on the SPEC. The argument
for the @code
{
-
b
}
option can be found using @code
{
lspci
}
or @code
{
dmesg
}
to search for the PCI bus on which the SPEC is present. It is the second
number in the address that is shown on insertion of the @code
{
spec.ko
}
kernel module. For the SPEC from the @code
{
dmesg
}
line below
@code
{
-
b
0
x
03
}
is found.
@code
{
[
182
.
700162
]
spec
0000
:
03
:
00
.
0
: got file "fmc
/
spec
-
init.bin",
}
@code
{
1485236
(
0
x
16
a
9
b
4
)
bytes
}
@item flash
-
write
Program to write
(
a part of
)
the flash memory on the SPEC. See
@i
{
flash
-
read
}
for an example of how to find the address of the
@code
{
-
b
}
option.
@end table
@c ##########################################################################
...
...
tools/flash-read.c
View file @
aff79eb4
...
...
@@ -214,11 +214,15 @@ static int spec_scan_pci(struct spec_pci_id *id, struct spec_device *arr,
return
ndevs
;
}
static
int
help
(
void
)
static
int
help
(
int
retv
)
{
fprintf
(
stderr
,
"%s: Use:
\"
%s [-v] [-b <bus>] <addr> <len>
\n
"
,
prgname
,
prgname
);
return
1
;
fprintf
(
stderr
,
"
\n
<bus> = PCI bus number of SPEC card. (See lspci or dmesg)
\n
"
);
fprintf
(
stderr
,
" <offset> = syscon_offset
\n
"
);
fprintf
(
stderr
,
" <addr> = start address in flash to write
\n
"
);
fprintf
(
stderr
,
" <len> = amount of bytes to write
\n
"
);
return
retv
;
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -229,7 +233,7 @@ int main(int argc, char **argv)
syscon_offset
=
SPEC_SYSCON_OFFSET
;
while
((
c
=
getopt
(
argc
,
argv
,
"b:vc:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"
h
b:vc:"
))
!=
-
1
)
{
switch
(
c
)
{
case
'b'
:
sscanf
(
optarg
,
"%i"
,
&
bus
);
...
...
@@ -240,12 +244,15 @@ int main(int argc, char **argv)
case
'c'
:
sscanf
(
optarg
,
"%i"
,
&
syscon_offset
);
break
;
case
'h'
:
exit
(
help
(
0
));
break
;
default:
exit
(
help
());
exit
(
help
(
1
));
}
}
if
(
optind
!=
argc
-
2
)
exit
(
help
());
exit
(
help
(
1
));
/* find which one to use */
ndev
=
spec_scan_pci
(
spec_devices
,
devs
,
MAX_DEVICES
);
...
...
tools/flash-write.c
View file @
aff79eb4
...
...
@@ -80,7 +80,7 @@ static int spec_write_flash(struct spec_device *spec, int addr, int len)
fprintf
(
stderr
,
"Reading from stdin, please type the data
\n
"
);
i
=
fread
(
buf
,
1
,
len
,
stdin
);
if
(
i
!=
len
)
{
fprintf
(
stderr
,
"%s: read error (%i, expeted %i)
\n
"
,
prgname
,
fprintf
(
stderr
,
"%s: read error (%i, expe
c
ted %i)
\n
"
,
prgname
,
i
,
len
);
return
1
;
}
...
...
@@ -230,11 +230,15 @@ static int spec_scan_pci(struct spec_pci_id *id, struct spec_device *arr,
return
ndevs
;
}
static
int
help
(
void
)
static
int
help
(
int
retv
)
{
fprintf
(
stderr
,
"%s: Use:
\"
%s [-v] [-b <bus>] <addr> <len>
\n
"
,
fprintf
(
stderr
,
"%s: Use:
\"
%s [-v] [-b <bus>]
[-c <offset>]
<addr> <len>
\n
"
,
prgname
,
prgname
);
return
1
;
fprintf
(
stderr
,
"
\n
<bus> = PCI bus number of SPEC card. (See lspci or dmesg)
\n
"
);
fprintf
(
stderr
,
" <offset> = syscon_offset
\n
"
);
fprintf
(
stderr
,
" <addr> = start address in flash to write
\n
"
);
fprintf
(
stderr
,
" <len> = amount of bytes to write
\n
"
);
return
retv
;
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -245,7 +249,7 @@ int main(int argc, char **argv)
syscon_offset
=
SPEC_SYSCON_OFFSET
;
while
((
c
=
getopt
(
argc
,
argv
,
"b:vc:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"
h
b:vc:"
))
!=
-
1
)
{
switch
(
c
)
{
case
'b'
:
sscanf
(
optarg
,
"%i"
,
&
bus
);
...
...
@@ -256,12 +260,15 @@ int main(int argc, char **argv)
case
'c'
:
sscanf
(
optarg
,
"%i"
,
&
syscon_offset
);
break
;
case
'h'
:
exit
(
help
(
0
));
break
;
default:
exit
(
help
());
exit
(
help
(
1
));
}
}
if
(
optind
!=
argc
-
2
)
exit
(
help
());
exit
(
help
(
1
));
/* find which one to use */
ndev
=
spec_scan_pci
(
spec_devices
,
devs
,
MAX_DEVICES
);
...
...
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