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
896b686e
Commit
896b686e
authored
Dec 08, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/v2.6.0' into master
parents
536de938
80ec317c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
18 deletions
+49
-18
CHANGELOG.rst
CHANGELOG.rst
+11
-0
PyAdcLib.py
PyAdcLib/PyAdcLib/PyAdcLib.py
+5
-4
adc-lib-100m14b4cha.h
lib/adc-lib-100m14b4cha.h
+3
-0
adc-lib.h
lib/adc-lib.h
+1
-0
fmc-adc-100m14b4cha.c
lib/fmc-adc-100m14b4cha.c
+14
-0
test_adc_acquisition.py
pytest/fmc-adc-100m14b4cha/test_adc_acquisition.py
+9
-8
test_adc_trigger.py
pytest/fmc-adc-100m14b4cha/test_adc_trigger.py
+6
-6
No files found.
CHANGELOG.rst
View file @
896b686e
...
...
@@ -6,6 +6,17 @@
Changelog
=========
2.6.0 - 2020-12-09
==================
Added
-----
- lib: add temperature attribute
- lib: add buffer size attribue for FMC ADC 100M
Fixed
-----
- tst: major fixes in pytests that were preventing them from running
2.5.4 - 2020-10-07
==================
...
...
PyAdcLib/PyAdcLib/PyAdcLib.py
View file @
896b686e
...
...
@@ -57,10 +57,11 @@ class PyAdcConf(Structure):
ADC_CONF_BRD_N_TRG_EXT
=
5
ADC_CONF_BRD_N_TRG_THR
=
6
ADC_CONF_BRD_N_TRG_TIM
=
7
ADC_CONF_UTC_TIMING_BASE_S
=
8
ADC_CONF_UTC_TIMING_BASE_T
=
9
ADC_CONF_UTC_TIMING_BASE_B
=
10
__ADC_CONF_BRD_ATTRIBUTE_LAST_INDEX
=
11
ADC_CONF_BRD_TEMPERATURE
=
8
ADC_CONF_UTC_TIMING_BASE_S
=
9
ADC_CONF_UTC_TIMING_BASE_T
=
10
ADC_CONF_UTC_TIMING_BASE_B
=
11
__ADC_CONF_BRD_ATTRIBUTE_LAST_INDEX
=
12
# CHANNEL configuration
ADC_CONF_CHN_RANGE
=
0
...
...
lib/adc-lib-100m14b4cha.h
View file @
896b686e
...
...
@@ -58,6 +58,9 @@ enum adc_configuration_100m14b4cha {
in multi-shot mode (in samples) */
ADC_CONF_100M14B4CHA_BUF_SIZE_KB
,
/**< it manually sets the buffer size but
only for VMALLOC buffers */
ADC_CONF_100M14B4CHA_BUF_SIZE_LEN
,
/**< it manually sets the buffer
length, but only for KMALLOC
buffers */
__ADC_CONF_100M14B4CHA_LAST_INDEX
,
/**< It represents the the last index
of this enum. It can be useful for
some sort of automation */
...
...
lib/adc-lib.h
View file @
896b686e
...
...
@@ -213,6 +213,7 @@ enum adc_configuration_board {
ADC_CONF_BRD_N_TRG_EXT
,
/**< Number of external triggers */
ADC_CONF_BRD_N_TRG_THR
,
/**< Number of threshold triggers */
ADC_CONF_BRD_N_TRG_TIM
,
/**< Number of timer triggers */
ADC_CONF_BRD_TEMPERATURE
,
/**< Temperature in milli-Celsius */
/* TODO seconds, ticks and bins are bit -> High - low */
ADC_CONF_UTC_TIMING_BASE_S
,
/**< Board internal time: seconds */
ADC_CONF_UTC_TIMING_BASE_T
,
/**< Board internal time: coarse
...
...
lib/fmc-adc-100m14b4cha.c
View file @
896b686e
/*
* The ADC library for the specific card
*
...
...
@@ -55,6 +56,7 @@
(1LL << ADC_CONF_BRD_N_TRG_EXT) | \
(1LL << ADC_CONF_BRD_N_TRG_THR) | \
(1LL << ADC_CONF_BRD_N_TRG_TIM) | \
(1LL << ADC_CONF_BRD_TEMPERATURE) | \
(1LL << ADC_CONF_UTC_TIMING_BASE_S) | \
(1LL << ADC_CONF_UTC_TIMING_BASE_T)
#define ADC_100M_4CH_14BIT_CUS_MASK (1ULL << ADC_CONF_100M14B4CHA_BUF_TYPE) | \
...
...
@@ -356,6 +358,15 @@ static int adc_100m14b4cha_config_brd(struct adc_dev *adc,
*
value
=
1
;
return
0
;
}
case
ADC_CONF_BRD_TEMPERATURE
:
if
(
direction
)
{
errno
=
ADC_ENOSET
;
return
-
1
;
}
else
{
return
adc_get_param
(
adc
,
"temperature"
,
NULL
,
(
int
*
)
value
);
return
0
;
}
case
ADC_CONF_UTC_TIMING_BASE_S
:
if
(
direction
)
{
errno
=
ADC_ENOSET
;
...
...
@@ -777,6 +788,9 @@ static int adc_100m14b4cha_config_cus(struct adc_dev *adc,
case
ADC_CONF_100M14B4CHA_BUF_SIZE_KB
:
return
adc_param
[
direction
](
adc
,
"cset0/chani/buffer/max-buffer-kb"
,
NULL
,
(
int
*
)
value
);
case
ADC_CONF_100M14B4CHA_BUF_SIZE_LEN
:
return
adc_param
[
direction
](
adc
,
"cset0/chani/buffer/max-buffer-len"
,
NULL
,
(
int
*
)
value
);
default:
errno
=
ADC_ENOCAP
;
return
-
1
;
...
...
pytest/fmc-adc-100m14b4cha/test_adc_acquisition.py
View file @
896b686e
...
...
@@ -45,7 +45,7 @@ class TestAdcAcquisitionPattern(object):
adc_simple
.
acq_poll
(
0
,
timeout
)
@
pytest
.
mark
.
parametrize
(
"pre_samples,post_samples"
,
[(
10
**
x
,
10
**
y
)
for
x
in
range
(
1
,
3
)
for
y
in
range
(
1
,
3
)])
[(
10
**
x
,
10
**
y
)
for
x
in
range
(
1
,
3
)
for
y
in
range
(
1
,
4
)])
@
pytest
.
mark
.
parametrize
(
"nshots"
,
range
(
1
,
10
))
def
test_adc_acq_basic
(
self
,
adc_simple_pattern
,
pre_samples
,
post_samples
,
nshots
):
...
...
@@ -57,25 +57,26 @@ class TestAdcAcquisitionPattern(object):
adc_simple_pattern
.
apply_config
(
conf
,
0
)
nsamples
=
pre_samples
+
post_samples
buf
=
adc_simple_pattern
.
request_buffer
(
nsamples
*
nshots
,
None
,
0
)
buf
=
adc_simple_pattern
.
request_buffer
(
nsamples
,
None
,
0
)
adc_simple_pattern
.
acq_start
(
PyFmcAdc100m14b4ch
.
ADC_F_FLUSH
,
timeval
(
0
,
0
))
for
n
in
range
(
nshots
):
time
.
sleep
(
1e-8
*
pre_samples
)
time
.
sleep
(
0.5
+
1e-8
*
(
pre_samples
+
post_samples
)
)
adc_simple_pattern
.
trigger_fire
()
adc_simple_pattern
.
acq_poll
(
0
,
timeval
(
10
,
0
))
adc_simple_pattern
.
fill_buffer
(
buf
,
0
,
timeval
(
10
,
0
))
assert
buf
.
contents
.
nsamples
==
nsamples
pattern
=
adc_simple_pattern
.
pattern_data
for
n
in
range
(
nshots
):
adc_simple_pattern
.
acq_poll
(
0
,
timeval
(
10
,
0
))
adc_simple_pattern
.
fill_buffer
(
buf
,
0
,
timeval
(
10
,
0
))
assert
buf
.
contents
.
nsamples
==
nsamples
for
chan
in
range
(
4
):
for
s
in
range
(
nsamples
):
sample
=
abs
(
buf
.
contents
.
get_sample
(
chan
,
s
)
>>
2
)
if
pattern
>=
0x2000
:
# for negative numbers
assert
0x4000
==
pattern
+
sample
,
buf
.
contents
.
data
[:
nsamples
]
assert
0x4000
==
pattern
+
sample
,
str
(
buf
.
contents
.
data
[:
nsamples
*
4
])
else
:
assert
sample
==
pattern
,
buf
.
contents
.
data
[:
nsamples
]
assert
sample
==
pattern
,
str
(
buf
.
contents
.
data
[:
nsamples
*
4
])
adc_simple_pattern
.
release_buffer
(
buf
,
None
)
pytest/fmc-adc-100m14b4cha/test_adc_trigger.py
View file @
896b686e
...
...
@@ -158,11 +158,11 @@ class TestAdcTriggerThreshold(object):
buf
=
adc_simple
.
request_buffer
(
1024
,
None
,
0
)
adc_simple
.
fill_buffer
(
buf
,
0
,
timeval
(
10
,
0
))
assert
buf
.
contents
.
nsamples
==
3
assert
buf
.
get_sample
(
channel
,
0
)
==
min_value
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
0
)
==
min_value
,
\
buf
.
contents
.
data
[:
3
*
4
]
assert
buf
.
get_sample
(
channel
,
1
)
==
value
<<
2
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
1
)
==
value
<<
2
,
\
buf
.
contents
.
data
[:
3
*
4
]
assert
buf
.
get_sample
(
channel
,
2
)
==
value
<<
2
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
2
)
==
value
<<
2
,
\
buf
.
contents
.
data
[:
3
*
4
]
adc_simple
.
release_buffer
(
buf
,
None
)
...
...
@@ -206,11 +206,11 @@ class TestAdcTriggerThreshold(object):
buf
=
adc_simple
.
request_buffer
(
1024
,
None
,
0
)
adc_simple
.
fill_buffer
(
buf
,
0
,
timeval
(
10
,
0
))
assert
buf
.
contents
.
nsamples
==
3
assert
buf
.
get_sample
(
channel
,
0
)
==
max_value
<<
2
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
0
)
==
max_value
,
\
buf
.
contents
.
data
[:
3
*
4
]
assert
buf
.
get_sample
(
channel
,
1
)
==
value
<<
2
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
1
)
==
value
<<
2
,
\
buf
.
contents
.
data
[:
3
*
4
]
assert
buf
.
get_sample
(
channel
,
2
)
==
value
<<
2
,
\
assert
buf
.
contents
.
get_sample
(
channel
,
2
)
==
value
<<
2
,
\
buf
.
contents
.
data
[:
3
*
4
]
adc_simple
.
release_buffer
(
buf
,
None
)
...
...
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