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
ea51ad5e
Commit
ea51ad5e
authored
Jul 02, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:py: add method to program the FPGA
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
a108596a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
PySPEC.py
software/PySPEC/PySPEC/PySPEC.py
+16
-0
No files found.
software/PySPEC/PySPEC/PySPEC.py
View file @
ea51ad5e
...
...
@@ -24,6 +24,22 @@ class PySPEC:
self
.
debugfs
=
"/sys/kernel/debug/0000:{:s}"
.
format
(
self
.
pci_id
)
self
.
debugfs_fpga
=
os
.
path
.
join
(
self
.
debugfs
,
"spec-0000:{:s}"
.
format
(
self
.
pci_id
))
def
program_fpga
(
self
,
bitstream
):
"""
Program the FPGA with the given bitstream
:var path: path to bitstream
:raise OSError: on failure
"""
with
open
(
"/sys/module/firmware_class/parameters/path"
,
"r"
)
as
f
:
prev
=
f
.
read
()
with
open
(
"/sys/module/firmware_class/parameters/path"
,
"w"
)
as
f
:
f
.
write
(
os
.
path
.
dirname
(
bitstream
))
with
open
(
os
.
path
.
join
(
self
.
debugfs
,
"fpga_firmware"
),
"w"
)
as
f
:
f
.
write
(
os
.
path
.
basename
(
bitstream
))
with
open
(
"/sys/module/firmware_class/parameters/path"
,
"w"
)
as
f
:
f
.
write
(
os
.
path
.
dirname
(
prev
))
@
contextmanager
def
dma
(
self
):
"""
...
...
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