Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha
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
FMC ADC 100M 14b 4cha
Commits
1a5ced0d
Commit
1a5ced0d
authored
Jul 05, 2021
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/v5.0.3'
parents
dd9bb0b8
a9bfbf14
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
128 additions
and
107 deletions
+128
-107
.gitignore
.gitignore
+2
-1
.gitlab-ci.yml
.gitlab-ci.yml
+60
-40
CHANGELOG.rst
CHANGELOG.rst
+12
-0
Makefile
doc/gateware/regs/Makefile
+6
-4
driver.rst
doc/software/driver.rst
+8
-3
fa-calibration.c
software/kernel/fa-calibration.c
+10
-5
fa-core.c
software/kernel/fa-core.c
+2
-7
fa-debug.c
software/kernel/fa-debug.c
+2
-0
fa-zio-drv.c
software/kernel/fa-zio-drv.c
+2
-16
fmc-adc-100m14b4cha-private.h
software/kernel/fmc-adc-100m14b4cha-private.h
+2
-0
fau-calibration.c
software/tools/fau-calibration.c
+22
-31
No files found.
.gitignore
View file @
1a5ced0d
...
...
@@ -111,4 +111,5 @@ GTAGS
GPATH
GRTAGS
.clangd
compile_commands.json
\ No newline at end of file
compile_commands.json
.cache
.gitlab-ci.yml
View file @
1a5ced0d
...
...
@@ -3,20 +3,12 @@
#
# SPDX-License-Identifier: CC0-1.0
---
variables
:
KOJI_TARGET
:
'
ohwr7'
KOJI_DISTTAG
:
'
.el7.cern'
DIST_PATH
:
distribution
BUILD_PATH
:
distribution/build
GIT_SUBMODULE_STRATEGY
:
normal
stages
:
-
static-analysis
-
build
-
dkms
-
srpm
-
kscratch
-
kbuild
reuse
:
stage
:
static-analysis
...
...
@@ -25,50 +17,78 @@ reuse:
entrypoint
:
[
"
"
]
script
:
-
reuse lint
allow_failure
:
true
cppcheck
:
stage
:
static-analysis
image
:
name
:
gitlab-registry.cern.ch/coht/common-containers/static-analysis:latest
script
:
-
yum install -y cppcheck
-
make -C software cppcheck
build
:
documentation
:
stage
:
build
image
:
name
:
gitlab-registry.cern.ch/coht/common-containers/documentation:latest
script
:
-
yum install -y kernel-devel
-
LINUX=/usr/src/kernels/*/ make -C software
-
make -C doc html
build_dkms_rpm
:
stage
:
dkms
script
:
-
yum install -y dkms
-
make -C distribution dkms-rpm
.script_fetch_kernel_dep
:
&script_fetch_kernel_dep
-
git clone --depth 1 https://gitlab.cern.ch/cohtdrivers/coht.git ~/git/coht
-
export VMEBUS=~/git/coht/vmebridge-ng
-
git clone -b v1.1.1 --depth 1 https://gitlab.cern.ch/coht/fmc.git ~/git/fmc
-
export FMC=~/git/fmc
-
git clone -b v1.4.0 --depth 1 https://ohwr.org/project/zio.git ~/git/zio
-
export ZIO=~/git/zio
build_srpm
:
stage
:
srpm
script
:
-
yum-builddep -y ${DIST_PATH}/*.spec
-
LINUX=/usr/src/kernels/*/ make -C distribution srpm
artifacts
:
paths
:
-
distribution/build/SRPMS/${CI_PROJECT_NAME}*src.rpm
expire_in
:
1 day
.script_build_kernel_dep
:
&script_build_kernel_dep
-
make -C $FMC/drivers/fmc all
-
make -C $ZIO/drivers/zio all
.koji_deps_template
:
&koji_deps
build-centos-7
:
stage
:
build
variables
:
LINUX
:
/usr/src/kernels/*/
image
:
name
:
gitlab-registry.cern.ch/coht/common-containers/build-centos-7:latest
before_script
:
-
yum install -y koji krb5-workstation rpm-build
-
echo ${OHWR_PASSWORD} | kinit ${OHWR_USER}
-
*script_fetch_kernel_dep
-
*script_build_kernel_dep
script
:
-
make -C software
.script_build_kernel_ver
:
&script_build_kernel_ver
-
source /linux-versions.sh
-
fetch $VERSION && prepare $VERSION && export LINUX=$(linux $VERSION)
-
*script_build_kernel_dep
-
make -C software/kernel all
kscratch
:
<<
:
*koji_deps
stage
:
kscratch
build-kernel-5.4.129
:
stage
:
build
allow_failure
:
true
variables
:
VERSION
:
5.4.129
image
:
name
:
gitlab-registry.cern.ch/coht/common-containers/build-kernel:latest
before_script
:
-
*script_fetch_kernel_dep
script
:
-
koji --config=.koji build --wait --scratch ${KOJI_TARGET} distribution/build/SRPMS/${CI_PROJECT_NAME}*src.rpm
-
*script_build_kernel_ver
.script_build_kernel_ver
:
&script_build_kernel_ver
-
source /linux-versions.sh
-
fetch $VERSION && prepare $VERSION && export LINUX=$(linux $VERSION)
-
*script_build_kernel_dep
-
make -C software/kernel all
kbuild-ohwr
:
<<
:
*koji_deps
stage
:
kbuild
only
:
-
tags
build-kernel-5.10.47
:
stage
:
build
allow_failure
:
true
variables
:
VERSION
:
5.10.47
image
:
name
:
gitlab-registry.cern.ch/coht/common-containers/build-kernel:latest
before_script
:
-
*script_fetch_kernel_dep
script
:
-
koji --config=.koji build --wait ${KOJI_TARGET} distribution/build/SRPMS/${CI_PROJECT_NAME}*src.rpm
-
*script_build_kernel_ver
CHANGELOG.rst
View file @
1a5ced0d
...
...
@@ -6,6 +6,18 @@
Changelog
=========
5.0.3 - 2021-07-05
==================
Added:
-----
- bld: CI support
Fixed
-----
- doc: add offset units
- sw: calibration value at boot time incorrect
- sw: use YAML for fau-calibration
5.0.2 - 2021-07-03
==================
Fixed
...
...
doc/gateware/regs/Makefile
View file @
1a5ced0d
...
...
@@ -2,22 +2,24 @@
#
# SPDX-License-Identifier: CC0-1.0
TOP_DIR
=
../../..
all
:
spec_base_regs.htm svec_base_regs.htm svec_ref_fmc_adc_100Ms_mmap.htm spec_ref_fmc_adc_100Ms_mmap.htm
.PHONY
:
clean
CHEBY_BUILD
=(
cd
$
(
dir
$<
)
;
cheby
-i
$
(
notdir
$<
)
--gen-doc
--doc
html
)
>
$@
spec_ref_fmc_adc_100Ms_mmap.htm
:
../../..
/hdl/cheby/spec_ref_fmc_adc_100Ms_mmap.cheby
spec_ref_fmc_adc_100Ms_mmap.htm
:
$(TOP_DIR)
/hdl/cheby/spec_ref_fmc_adc_100Ms_mmap.cheby
$(CHEBY_BUILD)
svec_ref_fmc_adc_100Ms_mmap.htm
:
../../..
/hdl/cheby/svec_ref_fmc_adc_100Ms_mmap.cheby
svec_ref_fmc_adc_100Ms_mmap.htm
:
$(TOP_DIR)
/hdl/cheby/svec_ref_fmc_adc_100Ms_mmap.cheby
$(CHEBY_BUILD)
svec_base_regs.htm
:
../../..
/hdl/ip_cores/svec/hdl/rtl/svec_base_regs.cheby
svec_base_regs.htm
:
$(TOP_DIR)
/hdl/ip_cores/svec/hdl/rtl/svec_base_regs.cheby
$(CHEBY_BUILD)
spec_base_regs.htm
:
../../..
/hdl/ip_cores/spec/hdl/rtl/spec_base_regs.cheby
spec_base_regs.htm
:
$(TOP_DIR)
/hdl/ip_cores/spec/hdl/rtl/spec_base_regs.cheby
$(CHEBY_BUILD)
clean
:
...
...
doc/software/driver.rst
View file @
1a5ced0d
...
...
@@ -124,6 +124,10 @@ the actual input connectors, and their software counterpart is used to
configure the channels; the last channel is called *i*, and is the
interleave channel where data is retrieved.
.. note::
Unless specified, the units are the same as for the ADC HDL design.
Therefore, this driver does not perform any data processing.
The Overall Device
''''''''''''''''''
...
...
@@ -191,8 +195,8 @@ chN-50ohm-term
turn on the termination resistor. Default is 0.
chN-offset
The user offset is an integer value in the range [-5000
,5
000], and
it represents mi
lli
volts. The offset represents the center-scale
The user offset is an integer value in the range [-5000
000,5000
000], and
it represents mi
cro
volts. The offset represents the center-scale
of conversion for the input channel. Internally, a DAC is used to
generate the requested voltage, which is then subtracted from the
input signal. DAC values are corrected according to the
...
...
@@ -200,7 +204,8 @@ chN-offset
the offset may saturate at values less than +/- 5V.
chN-offset-zero
The necessary offset to to bring the signal to 0.
The necessary offset to to bring the signal to 0 in microvolts (it must be
withing the range of chN-offset).
chN-vref
The "voltage reference" used for conversion. This attribute may be
...
...
software/kernel/fa-calibration.c
View file @
1a5ced0d
...
...
@@ -293,17 +293,22 @@ int fa_calib_dac_config_chan(struct fa_dev *fa, unsigned int chan,
return
fa_dac_offset_set
(
fa
,
chan
,
hwval
);
}
void
fa_calib_config_chan
(
struct
fa_dev
*
fa
,
unsigned
int
chan
,
int32_t
temperature
,
unsigned
int
flags
)
{
fa_calib_adc_config_chan
(
fa
,
chan
,
temperature
,
flags
);
fa_calib_dac_config_chan
(
fa
,
chan
,
temperature
,
flags
);
}
void
fa_calib_config
(
struct
fa_dev
*
fa
)
{
int32_t
temperature
;
int
i
;
temperature
=
fa_temperature_read
(
fa
);
temperature
=
fa_temperature_read
(
fa
);
spin_lock
(
&
fa
->
zdev
->
cset
->
lock
);
for
(
i
=
0
;
i
<
FA100M14B4C_NCHAN
;
++
i
)
{
fa_calib_adc_config_chan
(
fa
,
i
,
temperature
,
0
);
fa_calib_dac_config_chan
(
fa
,
i
,
temperature
,
0
);
}
for
(
i
=
0
;
i
<
FA100M14B4C_NCHAN
;
++
i
)
fa_calib_config_chan
(
fa
,
i
,
temperature
,
0
);
spin_unlock
(
&
fa
->
zdev
->
cset
->
lock
);
}
/**
...
...
software/kernel/fa-core.c
View file @
1a5ced0d
...
...
@@ -251,6 +251,7 @@ int fa_adc_range_set(struct fa_dev *fa, struct zio_channel *chan, int range)
spin_lock
(
&
fa
->
zdev
->
cset
->
lock
);
fa
->
range
[
chan
->
index
]
=
range
;
fa_calib_config_chan
(
fa
,
i
,
0
,
FA_CALIB_FLAG_READ_TEMP
);
spin_unlock
(
&
fa
->
zdev
->
cset
->
lock
);
return
0
;
...
...
@@ -517,16 +518,10 @@ static int __fa_init(struct fa_dev *fa)
FA100M14B4C_CMD_STOP
);
/* Initialize channels to use 1V range */
for
(
i
=
0
;
i
<
4
;
++
i
)
{
int
addr
=
zfad_get_chx_index
(
ZFA_CHx_CTL_RANGE
,
zdev
->
cset
->
chan
[
i
].
index
);
fa_writel
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
addr
],
FA100M14B4C_RANGE_1V
);
fa_adc_range_set
(
fa
,
&
zdev
->
cset
->
chan
[
i
],
FA100M14B4C_RANGE_1V
);
fa_adc_range_set
(
fa
,
&
zdev
->
cset
->
chan
[
i
],
FA100M14B4C_RANGE_1V
);
/* reset channel offset */
fa
->
user_offset
[
i
]
=
0
;
fa
->
zero_offset
[
i
]
=
0
;
}
/* Set decimation to minimum */
...
...
software/kernel/fa-debug.c
View file @
1a5ced0d
...
...
@@ -4,6 +4,8 @@
* Author: Federico Vaga <federico.vaga@cern.ch>
*/
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include "fmc-adc-100m14b4cha-private.h"
#define FA_DBG_REG32_CH(_n) \
...
...
software/kernel/fa-zio-drv.c
View file @
1a5ced0d
...
...
@@ -295,27 +295,13 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
range
=
zfad_convert_user_range
(
usr_val
);
if
(
range
<
0
)
return
range
;
err
=
fa_adc_range_set
(
fa
,
&
to_zio_cset
(
dev
)
->
chan
[
i
],
range
);
if
(
err
)
return
err
;
spin_lock
(
&
fa
->
zdev
->
cset
->
lock
);
fa_calib_adc_config_chan
(
fa
,
i
,
0
,
FA_CALIB_FLAG_READ_TEMP
);
fa_calib_dac_config_chan
(
fa
,
i
,
0
,
FA_CALIB_FLAG_READ_TEMP
);
spin_unlock
(
&
fa
->
zdev
->
cset
->
lock
);
return
0
;
return
fa_adc_range_set
(
fa
,
&
to_zio_cset
(
dev
)
->
chan
[
i
],
range
);
case
ZFA_CHx_CTL_RANGE
:
range
=
zfad_convert_user_range
(
usr_val
);
if
(
range
<
0
)
return
range
;
err
=
fa_adc_range_set
(
fa
,
&
to_zio_cset
(
dev
)
->
chan
[
i
],
range
);
if
(
err
)
return
err
;
spin_lock
(
&
fa
->
zdev
->
cset
->
lock
);
fa_calib_adc_config_chan
(
fa
,
i
,
0
,
FA_CALIB_FLAG_READ_TEMP
);
fa_calib_dac_config_chan
(
fa
,
i
,
0
,
FA_CALIB_FLAG_READ_TEMP
);
spin_unlock
(
&
fa
->
zdev
->
cset
->
lock
);
return
0
;
return
fa_adc_range_set
(
fa
,
&
to_zio_cset
(
dev
)
->
chan
[
i
],
range
);
case
ZFA_UTC_COARSE
:
if
(
usr_val
>=
FA100M14B4C_UTC_CLOCK_FREQ
)
{
...
...
software/kernel/fmc-adc-100m14b4cha-private.h
View file @
1a5ced0d
...
...
@@ -539,6 +539,8 @@ extern void fa_calib_adc_config_chan(struct fa_dev *fa, unsigned int chan,
int32_t
temperature
,
unsigned
int
flags
);
extern
int
fa_calib_dac_config_chan
(
struct
fa_dev
*
fa
,
unsigned
int
chan
,
int32_t
temperature
,
unsigned
int
flags
);
extern
void
fa_calib_config_chan
(
struct
fa_dev
*
fa
,
unsigned
int
chan
,
int32_t
temperature
,
unsigned
int
flags
);
/* functions exported by fa-debug.c */
extern
int
fa_debug_init
(
struct
fa_dev
*
fa
);
...
...
software/tools/fau-calibration.c
View file @
1a5ced0d
...
...
@@ -66,49 +66,40 @@ static int fau_calibration_read(char *path, struct fa_calib *calib,
return
ret
;
}
static
void
fau_calibration_dump_stanza
(
struct
fa_calib_stanza
*
stanza
)
static
void
fau_calibration_dump_stanza
(
const
struct
fa_calib_stanza
*
stanza
)
{
fprintf
(
stdout
,
" temperature: %f C
\n
"
,
stanza
->
temperature
*
0
.
01
);
fprintf
(
stdout
,
" gain: [0x%04"
PRIx16
", 0x%04"
PRIx16
", 0x%04"
PRIx16
", 0x%04"
PRIx16
"]
\n
"
,
stanza
->
gain
[
0
],
stanza
->
gain
[
1
],
stanza
->
gain
[
2
],
stanza
->
gain
[
3
]);
fprintf
(
stdout
,
" offset: [0x%04"
PRIx16
", 0x%04"
PRIx16
", 0x%04"
PRIx16
", 0x%04"
PRIx16
"]
\n
"
,
stanza
->
offset
[
0
],
stanza
->
offset
[
1
],
stanza
->
offset
[
2
],
stanza
->
offset
[
3
]);
int
i
;
fprintf
(
stdout
,
" temperature: %f C
\n
"
,
le16toh
(
stanza
->
temperature
)
*
0
.
01
);
fputs
(
" calibration:
\n
"
,
stdout
);
for
(
i
=
0
;
i
<
4
;
++
i
)
fprintf
(
stdout
,
" - {channel: %d, gain: 0x%04"
PRIx16
", offset: 0x%04"
PRIx16
"}
\n
"
,
i
+
1
,
(
uint16_t
)
le16toh
(
stanza
->
gain
[
i
]),
(
uint16_t
)
le16toh
(
stanza
->
offset
[
i
]));
}
/**
* Print calibration data on stdout in humand readable format
* @calib: calibration data
*/
static
void
fau_calibration_dump_human
(
struct
fa_calib
*
calib
)
static
void
fau_calibration_dump_human
(
const
struct
fa_calib
*
calib
)
{
uint16_t
*
data16
=
(
uint16_t
*
)
calib
;
int
i
;
/* Fix endianess */
for
(
i
=
0
;
i
<
sizeof
(
*
calib
)
/
sizeof
(
uint16_t
);
++
i
)
data16
[
i
]
=
le16toh
(
data16
[
i
]);
fputs
(
"ADC Range 10V
\n
"
,
stdout
);
fputs
(
"ADC:
\n
"
,
stdout
);
fputs
(
" - Range: 100mV
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
adc
[
FA100M14B4C_RANGE_100mV
]);
fputs
(
" - Range: 1V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
adc
[
FA100M14B4C_RANGE_1V
]);
fputs
(
" - Range: 10V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
adc
[
FA100M14B4C_RANGE_10V
]);
fputs
(
"DAC Range 10V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
dac
[
FA100M14B4C_RANGE_10V
]);
fputs
(
"ADC Range 1V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
adc
[
FA100M14B4C_RANGE_1V
]);
fputs
(
"DAC Range 1V
\n
"
,
stdout
);
fputs
(
"DAC:
\n
"
,
stdout
);
fputs
(
" - Range: 100mV
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
dac
[
FA100M14B4C_RANGE_100mV
]);
fputs
(
" - Range: 1V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
dac
[
FA100M14B4C_RANGE_1V
]);
fputs
(
" - Range: 10V
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
dac
[
FA100M14B4C_RANGE_10V
]);
fputs
(
"ADC Range 100mV
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
adc
[
FA100M14B4C_RANGE_100mV
]);
fputs
(
"DAC Range 100mV
\n
"
,
stdout
);
fau_calibration_dump_stanza
(
&
calib
->
dac
[
FA100M14B4C_RANGE_100mV
]);
fputc
(
'\n'
,
stdout
);
}
...
...
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