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
5a62b350
Commit
5a62b350
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Add functions for 32b read
parent
b8d7e426
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Pcie40Libraries/pcie40_b2slc.c
+102
-14
102 additions, 14 deletions
Pcie40Libraries/pcie40_b2slc.c
Pcie40Libraries/pcie40_b2slc.h
+2
-1
2 additions, 1 deletion
Pcie40Libraries/pcie40_b2slc.h
with
104 additions
and
15 deletions
Pcie40Libraries/pcie40_b2slc.c
+
102
−
14
View file @
5a62b350
...
...
@@ -12,17 +12,24 @@ int pcie40_readfee8( int dev , int adr) {
if
(
(
adr
<=
0
)
||
(
adr
>
0x7F
)
)
return
-
1
;
// Reset the FIFO
unsigned
ret
=
0
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
0
)
;
if
(
ret
!=
0
)
return
-
1
;
// Fill the FIFO with the requested information
// Fill the FIFO with the requested information
: write MSB first
int
data_word_1
=
(
0x73
)
|
(
0x07
<<
8
)
|
(
adr
<<
16
)
|
(
0x0c
<<
24
)
;
int
data_word_2
=
(
0x08
<<
0
)
;
// (temporary : 32 bits only)
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
,
(
int
)
(
data_word_1
&
0xFFFFFFFF
)
)
;
int
data_word_2
=
(
0x08
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
int
)
(
data_word_2
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
int
)
(
data_word_1
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
return
0
;
// Wait for the result to come back
int
i
;
...
...
@@ -40,38 +47,67 @@ int pcie40_readfee8( int dev , int adr) {
return
ret
;
}
//==============================================================================
// Write 8b
//==============================================================================
int
pcie40_writefee8
(
int
dev
,
int
adr
,
int
val
)
{
if
(
(
adr
<=
0
)
||
(
adr
>
0x7F
)
)
return
-
1
;
int
ret
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
if
(
ret
!=
0
)
return
-
1
;
int
data_word_1
=
(
0x73
)
|
(
0x0a
<<
8
)
|
(
adr
<<
16
)
|
(
(
val
&
0xFF
)
<<
24
)
;
int
data_word_2
=
(
0x08
<<
0
)
;
// (temporary : 32 bits only)
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
,
(
int
)
(
data_word_1
&
0xFFFFFFFF
)
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
int
)
(
data_word_1
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
int
)
(
data_word_2
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
return
0
;
}
//==============================================================================
// Read 32b
//==============================================================================
int
pcie40_readfee32
(
int
dev
,
int
adr
,
int
*
valp
)
{
// PCIe40
if
(
(
adr
<=
0
)
||
(
adr
>
0x7F
)
)
return
-
1
;
// Reset the FIFO
unsigned
ret
=
0
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_RESET_ADD
,
1
<<
SLC_WFIFO_RESET_BIT
)
;
if
(
ret
!=
0
)
return
-
1
;
// Fill the FIFO with the requested information
int
data_word_1
=
(
0x73
)
|
(
0x0c
<<
8
)
|
(
(
adr
&
0xFF
)
<<
16
)
|
(
(
(
adr
&
0xFF00
)
>>
8
)
<<
24
)
;
int
data_word_2
=
(
0x08
<<
24
)
|
(
0x02
<<
16
)
|
(
0x0c0c
)
;
(
0x73
)
|
(
0x0c
<<
8
)
|
(
(
adr
&
0xFF
)
<<
16
)
|
(
(
(
adr
&
0xFF00
)
>>
8
)
<<
24
)
;
int
data_word_2
=
(
0x04
<<
24
)
|
(
0x04
<<
16
)
|
(
0x0c0c
)
;
//
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
data_word_1
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
data_word_2
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
int
data_word_3
=
(
0x73
)
|
(
0x0c
<<
8
)
|
(
0x0c
<<
16
)
|
(
0x0c
<<
24
)
;
int
data_word_4
=
(
0x08
<<
24
)
|
(
0x02
<<
16
)
|
(
0x0c0c
)
;
//
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD
,
(
data_word_1
&
0xFFFFFFFF
)
|
(
(
data_word_2
&
0xFFFFFFFF
)
>>
32
)
)
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
data_word_3
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
data_word_4
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
// Wait for the result to come back
...
...
@@ -90,8 +126,60 @@ int pcie40_readfee32( int dev , int adr , int *valp ) {
return
ret
;
}
//==============================================================================
// Read 32b
//==============================================================================
int
pcie40_writefee32
(
int
dev
,
int
adr
,
int
val
)
{
return
0
;
// PCIe40
if
(
(
adr
<=
0
)
||
(
adr
>
0x7F
)
)
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
)
return
-
1
;
// Fill the FIFO with the requested information
int
data_word_1
=
(
0x73
)
|
(
0x0b
<<
8
)
|
(
(
adr
&
0xFF
)
<<
16
)
|
(
(
(
adr
&
0xFF00
)
>>
8
)
<<
24
)
;
int
data_word_2
=
(
0x04
<<
24
)
|
(
0x04
<<
16
)
|
(
val
&
0xFF
)
|
(
(
(
val
&
0xFF00
)
>>
8
)
<<
8
);
//
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
data_word_1
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
data_word_2
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
int
data_word_3
=
(
0x73
)
|
(
0x0c
<<
8
)
|
(
(
(
val
&
0xFF0000
)
>>
16
)
<<
16
)
|
(
(
(
val
&
0xFF000000
)
>>
24
)
<<
24
)
;
int
data_word_4
=
(
0x08
<<
24
)
|
(
0x02
<<
16
)
|
(
0x0c0c
)
;
//
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_MSB
,
(
data_word_3
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
ret
=
ecs_write
(
dev
,
SLC_BAR
,
SLC_WFIFO_ADD_LSB
,
(
data_word_4
&
0xFFFFFFFF
)
)
;
if
(
ret
!=
0
)
return
-
1
;
// Wait for the result to come back
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
usleep
(
10
)
;
//10 ms
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_STATUS
)
;
if
(
ret
==
0x11
)
break
;
}
if
(
i
==
10
)
return
-
1
;
// Read the value
ret
=
ecs_read
(
dev
,
SLC_BAR
,
SLC_RFIFO_ADD
);
return
ret
;
}
int
pcie40_writestream
(
int
dev
,
char
*
filename
)
{
...
...
This diff is collapsed.
Click to expand it.
Pcie40Libraries/pcie40_b2slc.h
+
2
−
1
View file @
5a62b350
...
...
@@ -8,7 +8,8 @@
// Address of the register to reset the write FIFO and bit to use
#define SLC_WFIFO_RESET_ADD 0x00050100
#define SLC_WFIFO_RESET_BIT 8
#define SLC_WFIFO_ADD 0x00050000
#define SLC_WFIFO_ADD_MSB 0x000501F0
#define SLC_WFIFO_ADD_LSB 0x00050000
#define SLC_RFIFO_STATUS 0x00000
#define SLC_RFIFO_ADD 0x0000
...
...
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