Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
adc-lib
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
adc-lib
Commits
49d395eb
Commit
49d395eb
authored
Aug 14, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tst: add trigger time tests
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
4d393cd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
test_adc_trigger.py
pytest/fmc-adc-100m14b4cha/test_adc_trigger.py
+50
-0
No files found.
pytest/fmc-adc-100m14b4cha/test_adc_trigger.py
View file @
49d395eb
...
...
@@ -50,6 +50,56 @@ class TestAdcTriggerSoftware(object):
adc_simple
.
retrieve_config
(
conf
)
assert
conf
.
value_get
(
PyAdcConf
.
ADC_CONF_BRD_STATE_MACHINE_STATUS
)
==
adc_simple
.
ADC_CONF_100M14B4CHA_FSM_STATE_IDLE
class
TestAdcTriggerTime
(
object
):
def
test_adc_trg_tim_disable
(
self
,
adc_simple
):
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_TRG_TIM
,
0
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_ENABLE
,
0
)
adc_simple
.
apply_config
(
conf
,
0
)
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_BRD
,
0
)
conf
.
mask_set
(
PyAdcConf
.
ADC_CONF_UTC_TIMING_BASE_S
)
adc_simple
.
retrieve_config
(
conf
)
time_base
=
conf
.
value_get
(
PyAdcConf
.
ADC_CONF_UTC_TIMING_BASE_S
)
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_TRG_TIM
,
0
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_SECONDS
,
time_base
+
5
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_NANO_SECONDS
,
0
)
adc_simple
.
apply_config
(
conf
,
0
)
adc_simple
.
acq_start
(
PyFmcAdc100m14b4ch
.
ADC_F_FLUSH
,
timeval
(
0
,
0
))
with
pytest
.
raises
(
OSError
):
adc_simple
.
acq_poll
(
0
,
timeval
(
10
,
0
))
@
pytest
.
mark
.
parametrize
(
"seconds"
,
[
2
,
3
,
4
,
5
])
@
pytest
.
mark
.
parametrize
(
"nanoseconds"
,
[
10
**
i
for
i
in
range
(
3
,
9
)])
def
test_adc_trg_tim
(
self
,
adc_simple
,
seconds
,
nanoseconds
):
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_BRD
,
0
)
conf
.
mask_set
(
PyAdcConf
.
ADC_CONF_UTC_TIMING_BASE_S
)
adc_simple
.
retrieve_config
(
conf
)
time_base
=
conf
.
value_get
(
PyAdcConf
.
ADC_CONF_UTC_TIMING_BASE_S
)
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_TRG_TIM
,
0
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_ENABLE
,
0
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_SECONDS
,
time_base
+
seconds
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_NANO_SECONDS
,
nanoseconds
)
adc_simple
.
apply_config
(
conf
,
0
)
conf
=
PyAdcConf
(
PyAdcConf
.
ADC_CONF_TYPE_TRG_TIM
,
0
)
conf
.
value_set
(
PyAdcConf
.
ADC_CONF_TRG_TIM_ENABLE
,
1
)
adc_simple
.
apply_config
(
conf
,
0
)
adc_simple
.
acq_start
(
PyFmcAdc100m14b4ch
.
ADC_F_FLUSH
,
timeval
(
0
,
0
))
adc_simple
.
acq_poll
(
0
,
timeval
(
seconds
+
1
,
0
))
buf_ptr
=
adc_simple
.
request_buffer
(
1024
,
None
,
0
)
buf
=
buf_ptr
.
contents
adc_simple
.
fill_buffer
(
buf_ptr
,
0
,
timeval
(
10
,
0
))
assert
buf
.
tstamp
.
secs
==
time_base
+
seconds
ticks_diff
=
abs
(
buf
.
tstamp
.
ticks
-
(
nanoseconds
*
125000000
)
/
1000000000
)
assert
ticks_diff
<
10
# 80ns margin
assert
buf
.
nsamples
==
3
adc_simple
.
release_buffer
(
buf_ptr
,
None
)
class
TestAdcTriggerThreshold
(
object
):
...
...
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