Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
FMC DEL 1ns 4cha
Commits
6aa82cf3
Commit
6aa82cf3
authored
Apr 03, 2012
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software: uploaded spec_common.c (SPEC initialization for all test programs)
parent
37d297c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
spec_common.c
software/lib/spec_common.c
+65
-0
No files found.
software/lib/spec_common.c
0 → 100644
View file @
6aa82cf3
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "fdelay_lib.h"
#include "rr_io.h"
void
spec_writel
(
void
*
priv
,
uint32_t
data
,
uint32_t
addr
)
{
rr_writel
(
data
,
addr
);
}
uint32_t
spec_readl
(
void
*
priv
,
uint32_t
addr
)
{
uint32_t
d
=
rr_readl
(
addr
);
return
d
;
}
int
spec_fdelay_init
(
int
argc
,
char
*
argv
[],
fdelay_device_t
*
dev
)
{
int
bus
=
RR_DEVSEL_UNUSED
,
devfn
=
RR_DEVSEL_UNUSED
;
int
opt
=
0
;
char
fw_name
[
1024
];
strcpy
(
fw_name
,
"spec_top.bin"
);
while
((
opt
=
getopt
(
argc
,
argv
,
"hb:d:f:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
printf
(
"Usage: %s [-b PCI_bus] [-d PCI dev/func] [-f firmware file]
\n
"
,
argv
[
0
]);
printf
(
"By default, the first detected SPEC is initialized with 'spec_top.bin' firmware
\n
"
);
return
0
;
case
'b'
:
sscanf
(
optarg
,
"%x"
,
&
bus
);
break
;
case
'd'
:
sscanf
(
optarg
,
"%x"
,
&
devfn
);
break
;
case
'f'
:
strcpy
(
fw_name
,
optarg
);
break
;
}
}
if
(
rr_init
(
bus
,
devfn
)
<
0
)
{
fprintf
(
stderr
,
"Failed to initialize rawrabbit.
\n
"
);
return
-
1
;
}
dev
->
writel
=
spec_writel
;
dev
->
readl
=
spec_readl
;
dev
->
base_addr
=
0x84000
;
if
(
rr_load_bitstream_from_file
(
fw_name
)
<
0
)
{
fprintf
(
stderr
,
"Failed to load FPGA bitstream.
\n
"
);
return
-
1
;
}
if
(
fdelay_init
(
dev
)
<
0
)
return
-
1
;
return
0
;
}
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