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
97c3debf
Commit
97c3debf
authored
Dec 19, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
out_queue_check_timeout: pass timestamp (to log it).
parent
fe755dd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
19 deletions
+20
-19
out_queue.h
software/firmware/adc/out_queue.h
+5
-13
wrtd-adcout.c
software/firmware/adc/wrtd-adcout.c
+11
-6
wrtd-rt-common.h
software/firmware/common/wrtd-rt-common.h
+4
-0
No files found.
software/firmware/adc/out_queue.h
View file @
97c3debf
...
...
@@ -95,31 +95,23 @@ static void OUT_QUEUE_NAME(out_queue_pop)(struct OUT_QUEUE_STRUCT *p)
* Checks if the timestamp of the last programmed pulse is lost because
* of timeout
*/
static
int
OUT_QUEUE_NAME
(
out_queue_check_timeout
)
(
struct
OUT_QUEUE_STRUCT
*
q
)
static
int
OUT_QUEUE_NAME
(
out_queue_check_timeout
)
(
struct
OUT_QUEUE_STRUCT
*
q
,
struct
wrtd_tstamp
*
now
)
{
uint32_t
now_sec
;
uint32_t
now_ns
;
int
delta
;
/*
* Read the current WR time, order is important: first seconds,
* then cycles (cycles get latched on reading secs register.
*/
now_sec
=
lr_readl
(
MT_CPU_LR_REG_TAI_SEC
);
now_ns
=
lr_readl
(
MT_CPU_LR_REG_TAI_CYCLES
)
*
8
;
if
(
q
->
last_programmed_sec
>
now_sec
+
OUT_QUEUE_MAXTIME
)
{
if
(
q
->
last_programmed_sec
>
now
->
seconds
+
OUT_QUEUE_MAXTIME
)
{
pr_error
(
"Enqueued event very far in the future. Dropping."
);
return
0
;
}
/* Current time exceeds FD setpoint? */
delta
=
now
_sec
-
q
->
last_programmed_sec
;
delta
=
now
->
seconds
-
q
->
last_programmed_sec
;
if
(
delta
!=
0
)
return
delta
>
0
;
delta
=
now
_
ns
-
q
->
last_programmed_ns
;
delta
=
now
->
ns
-
q
->
last_programmed_ns
;
return
(
delta
>
0
);
}
...
...
software/firmware/adc/wrtd-adcout.c
View file @
97c3debf
...
...
@@ -76,13 +76,16 @@ static inline uint32_t adcout_readl (struct wrtd_adcout_dev *dev, uint32_t reg)
* Drop the given enqueued trigger
*/
static
void
adcout_drop_trigger
(
struct
wrtd_adcout_dev
*
dev
,
struct
wrtd_event
*
ev
,
unsigned
reason
)
struct
wrtd_event
*
ev
,
unsigned
reason
,
struct
wrtd_tstamp
*
now
)
{
struct
adcout_out_queue
*
q
=
&
dev
->
queue
;
dev
->
idle
=
1
;
if
(
adcout_out_queue_empty
(
q
))
if
(
adcout_out_queue_empty
(
q
))
{
/* Should never happen. */
return
;
}
/* Drop the pulse */
adcout_out_queue_pop
(
q
);
...
...
@@ -90,7 +93,7 @@ static void adcout_drop_trigger(struct wrtd_adcout_dev *dev,
/* Disarm the FD output */
adcout_writel
(
dev
,
0
,
ALT_TRIGIN_CTRL
);
wrtd_log
(
WRTD_LOG_MSG_EV_DISCARDED
,
reason
,
ev
,
NULL
);
wrtd_log
(
WRTD_LOG_MSG_EV_DISCARDED
,
reason
,
ev
,
now
);
}
...
...
@@ -116,9 +119,11 @@ static void adcout_output (struct wrtd_adcout_dev *dev)
#endif
if
(
ctrl
&
ALT_TRIGIN_CTRL_ENABLE
)
{
/* Armed but still waiting for trigger */
if
(
adcout_out_queue_check_timeout
(
q
))
{
struct
wrtd_tstamp
now
;
ts_now
(
&
now
);
if
(
adcout_out_queue_check_timeout
(
q
,
&
now
))
{
/* Will never trigger. Missed. */
adcout_drop_trigger
(
dev
,
ev
,
WRTD_LOG_DISCARD_TIMEOUT
);
adcout_drop_trigger
(
dev
,
ev
,
WRTD_LOG_DISCARD_TIMEOUT
,
&
now
);
}
}
else
{
/* Has been triggered. */
...
...
@@ -138,7 +143,7 @@ static void adcout_output (struct wrtd_adcout_dev *dev)
ts
=
&
ev
->
ts
;
if
(
!
wr_is_timing_ok
())
{
adcout_drop_trigger
(
dev
,
ev
,
WRTD_LOG_DISCARD_NO_SYNC
);
adcout_drop_trigger
(
dev
,
ev
,
WRTD_LOG_DISCARD_NO_SYNC
,
NULL
);
return
;
}
...
...
software/firmware/common/wrtd-rt-common.h
View file @
97c3debf
...
...
@@ -205,6 +205,10 @@ static inline int ts_cmp(const struct wrtd_tstamp *l, const struct wrtd_tstamp *
static
void
ts_now
(
struct
wrtd_tstamp
*
now
)
{
/*
* Read the current WR time, order is important: first seconds,
* then cycles (cycles get latched on reading secs register.
*/
now
->
seconds
=
lr_readl
(
MT_CPU_LR_REG_TAI_SEC
);
now
->
ns
=
lr_readl
(
MT_CPU_LR_REG_TAI_CYCLES
)
*
8
;
now
->
frac
=
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