Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Trigger Distribution
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
White Rabbit Trigger Distribution
Commits
f71de082
Commit
f71de082
authored
Aug 08, 2018
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: add simulation option for both tdc and fd firmware
parent
a2b76479
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
1 deletion
+82
-1
wrtd-rt-fd.c
software/firmware/fd/wrtd-rt-fd.c
+42
-1
wrtd-rt-tdc.c
software/firmware/tdc/wrtd-rt-tdc.c
+35
-0
wrtd-common.h
software/include/wrtd-common.h
+5
-0
No files found.
software/firmware/fd/wrtd-rt-fd.c
View file @
f71de082
...
...
@@ -25,6 +25,12 @@
#define OUT_TIMEOUT 10
#ifdef SIMULATION
static
const
int
is_simulation
=
1
;
#else
static
const
int
is_simulation
=
0
;
#endif
struct
wrtd_out_trigger
triggers
[
FD_HASH_ENTRIES
];
/**< list of triggers */
struct
wrtd_out_trigger
*
ht
[
FD_HASH_ENTRIES
];
/* hash table */
static
unsigned
int
tlist_count
=
0
;
/**< number of valid trigger entry
...
...
@@ -78,6 +84,11 @@ static void wr_update_link(void)
{
int
i
;
if
(
is_simulation
)
{
wr_state
=
WR_LINK_SYNCED
;
return
;
}
switch
(
wr_state
)
{
case
WR_LINK_OFFLINE
:
for
(
i
=
0
;
i
<
FD_NUM_CHANNELS
;
i
++
)
...
...
@@ -884,6 +895,31 @@ static trtl_fw_action_t *wrtd_out_actions[] = {
};
static
int
wrtd_o_sim_init
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
FD_NUM_CHANNELS
;
i
++
)
{
int
hidx
;
wrtd_out_channels
[
i
].
config
.
log_level
=
WRTD_LOG_ALL
;
wrtd_out_channels
[
i
].
config
.
state
=
OUT_ST_ARMED
;
wrtd_out_channels
[
i
].
config
.
flags
=
WRTD_ENABLED
|
WRTD_ARMED
|
WRTD_TRIGGER_ASSIGNED
;
triggers
[
i
].
id
.
system
=
0
;
triggers
[
i
].
id
.
source_port
=
i
;
triggers
[
i
].
id
.
trigger
=
i
;
triggers
[
i
].
flags
=
ENTRY_FLAG_VALID
;
triggers
[
i
].
ocfg
[
i
].
delay_cycles
=
0
;
triggers
[
i
].
ocfg
[
i
].
delay_frac
=
0
;
triggers
[
i
].
ocfg
[
i
].
state
=
HASH_ENT_DIRECT
;
hidx
=
wrtd_out_hash_table_free
(
&
triggers
[
i
].
id
);
tlist_count
++
;
ht
[
hidx
]
=
&
triggers
[
i
];
}
return
0
;
}
/**
* Initialize data structures, RT application and variables
*/
...
...
@@ -949,7 +985,12 @@ static int wrtd_o_init(void)
rmq_bind_in
(
WRTD_OUT_RMQ
,
TRTL_EP_ETH
,
&
addr
);
fd_init
();
/* Skip WR sync and automatically generate some events when simulating */
if
(
is_simulation
)
wrtd_o_sim_init
();
if
(
!
is_simulation
)
fd_init
();
pr_debug
(
"rt-output firmware initialized.
\n\r
"
);
...
...
software/firmware/tdc/wrtd-rt-tdc.c
View file @
f71de082
...
...
@@ -25,6 +25,12 @@
#define BASE_DP_TDC_REGS 0x2000
#define BASE_DP_TDC_DIRECT 0x8000
#ifdef SIMULATION
static
const
int
is_simulation
=
1
;
#else
static
const
int
is_simulation
=
0
;
#endif
enum
wrtd_in_wr_link
{
WR_LINK_OFFLINE
=
1
,
WR_LINK_ONLINE
,
...
...
@@ -308,6 +314,11 @@ void wr_update_link(void)
{
int
i
;
if
(
is_simulation
)
{
wr_state
=
WR_LINK_SYNCED
;
return
;
}
switch
(
wr_state
)
{
case
WR_LINK_OFFLINE
:
for
(
i
=
0
;
i
<
TDC_NUM_CHANNELS
;
i
++
)
...
...
@@ -415,6 +426,24 @@ static trtl_fw_action_t *wrtd_in_actions[] = {
[
WRTD_IN_ACTION_SW_TRIG
]
=
wrtd_in_trigger_sw
,
};
static
int
wrtd_i_sim_init
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
TDC_NUM_CHANNELS
;
i
++
)
{
wrtd_in_channels
[
i
].
config
.
log_level
=
WRTD_LOG_ALL
;
wrtd_in_channels
[
i
].
config
.
id
.
system
=
0
;
wrtd_in_channels
[
i
].
config
.
id
.
source_port
=
i
;
wrtd_in_channels
[
i
].
config
.
id
.
trigger
=
i
;
wrtd_in_channels
[
i
].
config
.
flags
=
WRTD_ENABLED
|
WRTD_ARMED
|
WRTD_TRIGGER_ASSIGNED
;
}
dp_writel
(
0x1f
,
BASE_DP_TDC_DIRECT
+
DR_REG_CHAN_ENABLE
);
dp_writel
(
0x40
,
BASE_DP_TDC_DIRECT
+
DR_REG_DEAD_TIME
);
return
0
;
}
static
int
wrtd_i_init
(
void
)
{
...
...
@@ -455,6 +484,12 @@ static int wrtd_i_init(void)
rmq_bind_out
(
WRTD_IN_RMQ
,
TRTL_EP_ETH
,
&
addr
);
/* Skip WR sync and automatically generate some events when simulating */
if
(
is_simulation
)
wrtd_i_sim_init
();
pr_debug
(
"rt-input firmware initialized.
\n\r
"
);
return
0
;
}
...
...
software/include/wrtd-common.h
View file @
f71de082
...
...
@@ -86,7 +86,12 @@
#define TDC_NUM_CHANNELS 5
#ifdef SIMULATION
#define TDC_TRIGGER_COALESCE_LIMIT 1
#else
#define TDC_TRIGGER_COALESCE_LIMIT 5
#endif // SIMULATION
#define FD_NUM_CHANNELS 4
#define FD_HASH_ENTRIES 32
...
...
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