Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmytro Levit
Software
Commits
7b2d3be3
Commit
7b2d3be3
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
First version of the writestream slow control function
parent
243b38dc
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!3
Feature/BIIDAQ-73 implement write stream slow control functionality
,
!5
6links
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Pcie40Libraries/pcie40_b2slc.c
+62
-1
62 additions, 1 deletion
Pcie40Libraries/pcie40_b2slc.c
with
62 additions
and
1 deletion
Pcie40Libraries/pcie40_b2slc.c
+
62
−
1
View file @
7b2d3be3
...
...
@@ -297,5 +297,66 @@ int pcie40_writefee32( int dev , int ch , int adr , int val ) {
}
int
pcie40_writestream
(
int
dev
,
int
ch
,
char
*
filename
)
{
return
0
;
// PCIe40
// Check if the file exists
const
char
*
mode
=
"r"
;
FILE
*
fp
=
fopen
(
filename
,
mode
)
;
if
(
0
==
fp
)
{
printf
(
"The file does not exist
\n
"
)
;
return
-
1
;
}
// Reset the FIFO
unsigned
ret
=
0
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
(
SLC_WFIFO_RESET_BIT
)
)
;
if
(
ret
!=
0
)
{
fclose
(
fp
)
;
return
-
1
;
}
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
0
)
;
if
(
ret
!=
0
)
{
fclose
(
fp
)
;
return
-
1
;
}
// Fill the FIFO with the requested information: write MSB first
// This is a stream write -> FFFD
int
data_word_1
=
0xFFFC
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
+
ch
*
0x20
,
(
int
)
(
data_word_1
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
{
fclose
(
fp
)
;
return
-
1
;
}
// Read the file
int
c
=
0
;
while
((
c
=
getc
(
fp
))
!=
EOF
)
{
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
+
ch
*
0x20
,
(
int
)
(
(
(
0x70
<<
8
)
|
(
c
&
0xFF
)
)
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
{
fclose
(
fp
)
;
return
-
1
;
}
}
fclose
(
fp
)
;
// End of the file -> 0xEEEE
int
data_word_3
=
0xEEEE
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
+
ch
*
0x20
,
(
int
)
(
data_word_3
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
// start emit
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_START_ADD
,
0
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_START_ADD
,
1
<<
(
SLC_WFIFO_EMIT_BIT
+
ch
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_START_ADD
,
0
)
;
if
(
ret
!=
0
)
return
-
1
;
return
ret
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment