Commit f016d0a9 authored by Federico Vaga's avatar Federico Vaga

Merge branch '2-review-v8-0-0-release' into 'master'

Resolve "Review v8.0.0 release"

Closes #2

See merge request be-cem-edl/fec/hardware-modules/fmc-tdc-1ns-5cha!4
parents bca32bf1 307f71dc
......@@ -5,28 +5,21 @@
variables:
GIT_SUBMODULE_STRATEGY: normal
stages:
- static-analysis
- build
reuse:
stage: static-analysis
image:
name: fsfe/reuse:latest
entrypoint: [""]
script:
- reuse lint
allow_failure: true
include:
- project: 'be-cem-edl/evergreen/gitlab-ci'
ref: master
file:
- 'edl-gitlab-ci.yml'
cppcheck:
stage: static-analysis
stage: analyse
image:
name: gitlab-registry.cern.ch/coht/common-containers/static-analysis:latest
script:
- make -C software cppcheck
flawfinder:
stage: static-analysis
stage: analyse
image:
name: gitlab-registry.cern.ch/coht/common-containers/static-analysis:latest
script:
......@@ -38,6 +31,11 @@ documentation:
name: gitlab-registry.cern.ch/coht/common-containers/documentation:latest
script:
- make -C doc html
- mkdir -p $EDL_CI_EOS_OUTPUT_DIR
- cp -a doc/_build/html/* $EDL_CI_EOS_OUTPUT_DIR
artifacts:
paths:
- $EDL_CI_EOS_OUTPUT_DIR
.script_fetch_kernel_dep: &script_fetch_kernel_dep
- git clone --depth 1 https://gitlab.cern.ch/cohtdrivers/coht.git ~/git/coht
......@@ -69,32 +67,18 @@ build-centos-7:
- *script_build_kernel_dep
- make -C software/kernel all
build-kernel-5.4.207:
build-kernel:
stage: build
allow_failure: true
variables:
VERSION: 5.4.207
image:
name: gitlab-registry.cern.ch/coht/common-containers/build-kernel:latest
parallel:
matrix:
- VERSION: [5.10.149, 5.15.74]
before_script:
- *script_fetch_kernel_dep
script:
- *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
build-kernel-5.10.132:
stage: build
allow_failure: true
variables:
VERSION: 5.10.132
image:
name: gitlab-registry.cern.ch/coht/common-containers/build-kernel:latest
before_script:
- *script_fetch_kernel_dep
script:
- *script_build_kernel_ver
- source /linux-versions.sh
- fetch $VERSION && prepare $VERSION && export LINUX=$(linux $VERSION) && export KERNELSRC=$(linux $VERSION)
- *script_build_kernel_dep
- make -C software/kernel all
......@@ -41,10 +41,13 @@ rest: $(REST)
.PHONY: clean
CHEBY_BUILD=(cd $(dir $<); ~/.local/bin/cheby -i $(notdir $<) --gen-doc --doc html) > $@
CHEBY_BUILD_REST=(cd $(dir $<); ~/.local/bin/cheby -i $(notdir $<) --gen-doc --doc rest) > $@
WBGEN2_BUILD=(~/wr/tdc/wishbone-gen/wbgen2 -D $@ $<)
WBGEN2_BUILD_TEX=(~/wr/tdc/wishbone-gen/wbgen2 -f latex -D $@ $<)
CHEBY ?= cheby
WBGEN2 ?= wbgen2
CHEBY_BUILD=(cd $(dir $<); $(CHEBY) -i $(notdir $<) --gen-doc --doc html) > $@
CHEBY_BUILD_REST=(cd $(dir $<); $(CHEBY) -i $(notdir $<) --gen-doc --doc rest) > $@
WBGEN2_BUILD=($(WBGEN2) -D $@ $<)
WBGEN2_BUILD_TEX=($(WBGEN2) -f latex -D $@ $<)
fmc_tdc_mezzanine_mmap.htm: $(TOP_DIR)/hdl/cheby/fmc_tdc_mezzanine_mmap.cheby
$(CHEBY_BUILD)
......
......@@ -58,6 +58,7 @@ Trigger input:
Power supply:
* Used power supplies: P12V0, P3V3, P3V3 AUX, VADJ (voltage monitor only).
.. * Typical current consumption: FIXME (P12V0) + FIXME (P3V3).
.. * Power dissipation: [fixme: Eva] W
......
......@@ -51,7 +51,7 @@ Following an example from the ``example.c`` code available under ``tools``
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 54-62
:lines: 55-62
Error Reporting
----------------
......@@ -72,7 +72,7 @@ Following an example from the ``example.c`` code available under ``tools``
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 74-75
:lines: 74-76
Opening and closing
--------------------
......@@ -104,7 +104,7 @@ session. You can do this with :cpp:func:`fmctdc_flush()`
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 72-90
:lines: 73-91
Configuration and Status
------------------------
......@@ -120,7 +120,7 @@ termination. You can use the following getter and setter:
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 124-129
:lines: 125-130
The *IRQ coalescing timeout* option allows to force an IRQ when the
timeout expire to inform the driver that there is at least one pending
......@@ -130,7 +130,7 @@ timestamp to be transfered. You can use the following getter and setter:
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 132-137
:lines: 133-138
The TDC main functionality is to timestap incoming pulses. To assign a
timestamp the board needs a time reference. This can be provided by
......@@ -143,7 +143,7 @@ network.
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 140-145
:lines: 141-146
If you do not have white-rabbit connected to the TDC, or simply this
is not what you want, then be sure to disable. When white-rabbit is
......@@ -154,14 +154,14 @@ the time using :cpp:func:`fmctdc_set_time()` or
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 148-150
:lines: 149-151
Whater you are using white-rabbit or not, you can get the current
board time with :cpp:func:`fmctdc_get_time()`.
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 151-153
:lines: 152-154
Still about time, the user can add it's own offset without changing
the timebase using :cpp:func:`fmctdc_get_offset_user()` and
......@@ -169,7 +169,7 @@ the timebase using :cpp:func:`fmctdc_get_offset_user()` and
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 156-161
:lines: 157-162
Finally, you can monitor the board temperature using
:cpp:func:`fmctdc_read_temperature()`, and pulse and timestamps
......@@ -178,7 +178,7 @@ statistics with :cpp:func:`fmctdc_stats_recv_get()` and
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 227-232
:lines: 226-233
.. note::
If it can be useful there is one last status function in the API
......@@ -195,7 +195,7 @@ allocator type. You can handle this option with the pair:
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 164-169
:lines: 165-170
You can configure - and get - the buffer size (number of
timestamps) with: :cpp:func:`fmctdc_get_buffer_len()` and
......@@ -204,7 +204,7 @@ only when using :cpp:any:`FMCTDC_BUFFER_VMALLOC`.
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 172-177
:lines: 173-178
Finally, you can select between to modes to handle buffer's overflows:
:cpp:any:`FMCTDC_BUFFER_CIRC` and :cpp:any:`FMCTDC_BUFFER_FIFO`. The
......@@ -216,7 +216,7 @@ consumed. To configure this option you can use:
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 180-185
:lines: 181-186
Acquisiton
----------
......@@ -228,7 +228,7 @@ gateware using, respectivily, :cpp:func:`fmctdc_channel_enable()` and
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 195-205
:lines: 196-206
To read timestamps you may use functions :cpp:func:`fmctdc_read()`
and :cpp:func:`fmctdc_fread()`. As the name may suggest, the first
......@@ -236,13 +236,13 @@ behaves like :manpage:`read` and the second as :manpage:`fread`.
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 219-223
:lines: 220-224
If you need to flush the buffer, you can use :cpp:func:`fmctdc_flush()`.
.. literalinclude:: ../../software/tools/example.c
:language: c
:lines: 79-81
:lines: 80-82
Timestamp Math
--------------
......
......@@ -23,7 +23,6 @@
#include "fmc-tdc.h"
#include "platform_data/fmc-tdc.h"
#include "hw/channel_regs.h"
#include "hw/timestamp_fifo_regs.h"
#include "hw/tdc_onewire_regs.h"
......@@ -83,9 +82,9 @@ static void ft_update_offsets(struct fmctdc_dev *ft, int channel)
if (st->user_offset)
ft_ts_apply_offset(&hw_offset, st->user_offset);
ft_iowrite(ft, hw_offset.seconds, fifo_addr + CH_REG_REG_OFFSET1);
ft_iowrite(ft, hw_offset.coarse, fifo_addr + CH_REG_REG_OFFSET2);
ft_iowrite(ft, hw_offset.frac, fifo_addr + CH_REG_REG_OFFSET3);
ft_iowrite(ft, hw_offset.seconds, fifo_addr + TSF_REG_OFFSET1);
ft_iowrite(ft, hw_offset.coarse, fifo_addr + TSF_REG_OFFSET2);
ft_iowrite(ft, hw_offset.frac, fifo_addr + TSF_REG_OFFSET3);
}
static enum ft_devtype __ft_get_type(struct device *dev)
......@@ -103,14 +102,14 @@ static void ft_raw_mode_set(struct fmctdc_dev *ft,
unsigned int raw_enable)
{
void *fifo_addr = ft->ft_fifo_base + TDC_FIFO_OFFSET * chan;
uint32_t csr = ft_ioread(ft, fifo_addr + CH_REG_REG_CSR);
uint32_t csr = ft_ioread(ft, fifo_addr + TSF_REG_CSR);
if (raw_enable)
csr |= CH_REG_CSR_RAW_MODE;
csr |= TSF_CSR_RAW_MODE;
else
csr &= ~CH_REG_CSR_RAW_MODE;
csr &= ~TSF_CSR_RAW_MODE;
ft_iowrite(ft, csr, fifo_addr + CH_REG_REG_CSR);
ft_iowrite(ft, csr, fifo_addr + TSF_REG_CSR);
}
......@@ -118,9 +117,9 @@ static int ft_raw_mode_get(struct fmctdc_dev *ft,
unsigned int chan)
{
void *fifo_addr = ft->ft_fifo_base + TDC_FIFO_OFFSET * chan;
uint32_t csr = ft_ioread(ft, fifo_addr + CH_REG_REG_CSR);
uint32_t csr = ft_ioread(ft, fifo_addr + TSF_REG_CSR);
return (csr & CH_REG_CSR_RAW_MODE) ? 1 : 0;
return (csr & TSF_CSR_RAW_MODE) ? 1 : 0;
}
......
......@@ -37,6 +37,7 @@ CFLAGS += -DZIO_GIT_VERSION="\"$(ZIO_GIT_VERSION)\""
CFLAGS += $(EXTRACFLAGS)
DESTDIR ?= /usr/local
CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
modules all: lib
......@@ -72,6 +73,9 @@ modules_install:
cppcheck:
$(CPPCHECK) -q -I. -I../kernel -I $(ZIO_ABS)/include --suppress=missingIncludeSystem --enable=warning,style,information,missingInclude *.c *.h
flawfinder:
$(FLAWFINDER) -SQDC --error-level=5 .
-include .depend
.PHONY=cppcheck
......@@ -35,6 +35,7 @@ LDFLAGS = -L$(LIBTDC)
LDLIBS = -lfmctdc -lrt
CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
all: $(TESTS) $(OTHERS) $(LIST_TOOL)
......@@ -58,3 +59,6 @@ install:
cppcheck:
$(CPPCHECK) -q -I. -I../kernel -I$(LIBTDC) --suppress=missingIncludeSystem --enable=all *.c *.h
flawfinder:
$(FLAWFINDER) -SQDC --error-level=5 .
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment