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
983a1ad3
Commit
983a1ad3
authored
Apr 23, 2014
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Add feature: start acquisition time-tag inside zio_control
parents
784e50ef
fa0aaad8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
19 deletions
+159
-19
fa-irq.c
kernel/fa-irq.c
+15
-1
fa-zio-drv.c
kernel/fa-zio-drv.c
+8
-7
fa-zio-trg.c
kernel/fa-zio-trg.c
+11
-11
fmc-adc.h
kernel/fmc-adc.h
+55
-0
fmc-adc-100m14b4cha.h
lib/fmc-adc-100m14b4cha.h
+64
-0
fald-acq.c
libtools/fald-acq.c
+6
-0
No files found.
kernel/fa-irq.c
View file @
983a1ad3
...
...
@@ -54,14 +54,22 @@ void zfad_dma_done(struct zio_cset *cset)
struct
zio_control
*
ctrl
=
NULL
;
struct
zio_ti
*
ti
=
cset
->
ti
;
struct
zio_block
*
block
;
struct
zio_timestamp
ztstamp
;
int
i
;
uint32_t
*
trig_timetag
;
fa
->
carrier_op
->
dma_done
(
cset
);
/* for each shot, set the timetag of each ctrl block by reading the
* trig-timetag appended after the samples
* trig-timetag appended after the samples. Set also the acquisition
* start timetag on every blocks
*/
ztstamp
.
secs
=
fa_readl
(
fa
,
fa
->
fa_utc_base
,
&
zfad_regs
[
ZFA_UTC_ACQ_START_SECONDS
]);
ztstamp
.
ticks
=
fa_readl
(
fa
,
fa
->
fa_utc_base
,
&
zfad_regs
[
ZFA_UTC_ACQ_START_COARSE
]);
ztstamp
.
bins
=
fa_readl
(
fa
,
fa
->
fa_utc_base
,
&
zfad_regs
[
ZFA_UTC_ACQ_START_FINE
]);
for
(
i
=
0
;
i
<
fa
->
n_shots
;
++
i
)
{
block
=
zfad_block
[
i
].
block
;
ctrl
=
zio_get_ctrl
(
block
);
...
...
@@ -74,6 +82,12 @@ void zfad_dma_done(struct zio_cset *cset)
ctrl
->
tstamp
.
secs
=
*
(
++
trig_timetag
);
ctrl
->
tstamp
.
ticks
=
*
(
++
trig_timetag
);
ctrl
->
tstamp
.
bins
=
*
(
++
trig_timetag
);
/* Acquisition start Timetag */
ctrl
->
attr_channel
.
ext_val
[
ZFAD_ATTR_ACQ_START_S
]
=
ztstamp
.
secs
;
ctrl
->
attr_channel
.
ext_val
[
ZFAD_ATTR_ACQ_START_C
]
=
ztstamp
.
ticks
;
ctrl
->
attr_channel
.
ext_val
[
ZFAD_ATTR_ACQ_START_F
]
=
ztstamp
.
bins
;
/* resize the datalen and clear stamp from data block */
block
->
datalen
-=
FA_TRIG_TIMETAG_BYTES
;
memset
(
block
->
data
+
block
->
datalen
,
0
,
FA_TRIG_TIMETAG_BYTES
);
...
...
kernel/fa-zio-drv.c
View file @
983a1ad3
...
...
@@ -61,6 +61,14 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
ZIO_ATTR_EXT
(
"ch2-50ohm-term"
,
ZIO_RW_PERM
,
ZFA_CH3_CTL_TERM
,
0
),
ZIO_ATTR_EXT
(
"ch3-50ohm-term"
,
ZIO_RW_PERM
,
ZFA_CH4_CTL_TERM
,
0
),
/* last acquisition start time stamp */
ZIO_ATTR_EXT
(
"tstamp-acq-str-s"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_SECONDS
,
0
),
ZIO_ATTR_EXT
(
"tstamp-acq-str-t"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_COARSE
,
0
),
ZIO_ATTR_EXT
(
"tstamp-acq-str-b"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_FINE
,
0
),
/* Parameters (not attributes) follow */
/*
...
...
@@ -85,13 +93,6 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
* 7: Illegal
* */
ZIO_PARAM_EXT
(
"fsm-state"
,
ZIO_RO_PERM
,
ZFA_STA_FSM
,
0
),
/* last acquisition start time stamp */
ZIO_PARAM_EXT
(
"tstamp-acq-str-s"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_SECONDS
,
0
),
ZIO_PARAM_EXT
(
"tstamp-acq-str-t"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_COARSE
,
0
),
ZIO_PARAM_EXT
(
"tstamp-acq-str-b"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_START_FINE
,
0
),
/* last acquisition end time stamp */
ZIO_PARAM_EXT
(
"tstamp-acq-end-s"
,
ZIO_RO_PERM
,
ZFA_UTC_ACQ_END_SECONDS
,
0
),
...
...
kernel/fa-zio-trg.c
View file @
983a1ad3
...
...
@@ -44,35 +44,35 @@ static struct zio_attribute zfat_ext_zattr[] = {
* 0: internal (data threshold)
* 1: external (front panel trigger input)
*/
ZIO_ATTR_EXT
(
"external"
,
ZIO_RW_PERM
,
ZFAT_CFG_HW_SEL
,
0
),
[
ZFAT_ATTR_EXT
]
=
ZIO_ATTR_EXT
(
"external"
,
ZIO_RW_PERM
,
ZFAT_CFG_HW_SEL
,
0
),
/*
* Internal Hardware trigger polarity
* 0: positive edge/slope
* 1: negative edge/slope
*/
ZIO_ATTR_EXT
(
"polarity"
,
ZIO_RW_PERM
,
ZFAT_CFG_HW_POL
,
0
),
[
ZFAT_ATTR_POL
]
=
ZIO_ATTR_EXT
(
"polarity"
,
ZIO_RW_PERM
,
ZFAT_CFG_HW_POL
,
0
),
/*
* Channel selection for internal trigger
* 0: channel 1, 1: channel 2, 2: channel 3, 3: channel 4
*/
ZIO_ATTR_EXT
(
"int-channel"
,
ZIO_RW_PERM
,
ZFAT_CFG_INT_SEL
,
0
),
[
ZFAT_ATTR_INT_CHAN
]
=
ZIO_ATTR_EXT
(
"int-channel"
,
ZIO_RW_PERM
,
ZFAT_CFG_INT_SEL
,
0
),
/* Internal trigger threshold value is 2 complement format */
ZIO_ATTR_EXT
(
"int-threshold"
,
ZIO_RW_PERM
,
ZFAT_CFG_THRES
,
0
),
[
ZFAT_ATTR_INT_THRES
]
=
ZIO_ATTR_EXT
(
"int-threshold"
,
ZIO_RW_PERM
,
ZFAT_CFG_THRES
,
0
),
/*
* Delay to apply on the trigger in sampling clock period. The default
* clock frequency is 100MHz (period = 10ns)
*/
ZIO_ATTR_EXT
(
"delay"
,
ZIO_RW_PERM
,
ZFAT_DLY
,
0
),
[
ZFAT_ATTR_DELAY
]
=
ZIO_ATTR_EXT
(
"delay"
,
ZIO_RW_PERM
,
ZFAT_DLY
,
0
),
/* Software Trigger */
/* Enable (1) or disable (0) software trigger */
ZIO_PARAM_EXT
(
"sw-trg-enable"
,
ZIO_RW_PERM
,
ZFAT_CFG_SW_EN
,
0
),
ZIO_PARAM_EXT
(
"sw-trg-fire"
,
ZIO_WO_PERM
,
ZFAT_SW
,
0
),
[
ZFAT_ATTR_SW_EN
]
=
ZIO_PARAM_EXT
(
"sw-trg-enable"
,
ZIO_RW_PERM
,
ZFAT_CFG_SW_EN
,
0
),
[
ZFAT_ATTR_SW_FIRE
]
=
ZIO_PARAM_EXT
(
"sw-trg-fire"
,
ZIO_WO_PERM
,
ZFAT_SW
,
0
),
/* last trigger time stamp */
ZIO_PARAM_EXT
(
"tstamp-trg-lst-s"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_SECONDS
,
0
),
ZIO_PARAM_EXT
(
"tstamp-trg-lst-t"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_COARSE
,
0
),
ZIO_PARAM_EXT
(
"tstamp-trg-lst-b"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_FINE
,
0
),
[
ZFAT_ATTR_TRG_S
]
=
ZIO_PARAM_EXT
(
"tstamp-trg-lst-s"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_SECONDS
,
0
),
[
ZFAT_ATTR_TRG_C
]
=
ZIO_PARAM_EXT
(
"tstamp-trg-lst-t"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_COARSE
,
0
),
[
ZFAT_ATTR_TRG_F
]
=
ZIO_PARAM_EXT
(
"tstamp-trg-lst-b"
,
ZIO_RO_PERM
,
ZFA_UTC_TRIG_FINE
,
0
),
};
...
...
@@ -114,7 +114,7 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
break
;
case
ZFAT_SW
:
/* Fire if software trigger is enabled (index 5) */
if
(
!
ti
->
zattr_set
.
ext_zattr
[
5
].
value
)
{
if
(
!
ti
->
zattr_set
.
ext_zattr
[
ZFAT_ATTR_SW_EN
].
value
)
{
dev_info
(
dev
,
"sw trigger is not enabled
\n
"
);
return
-
EPERM
;
}
...
...
kernel/fmc-adc.h
View file @
983a1ad3
...
...
@@ -219,6 +219,61 @@ enum zfadc_dregs_enum {
ZFA_HW_PARAM_COMMON_LAST
,
};
/*
* Trigger Extended Attribute Enumeration
*/
enum
fa_trig_ext_attributes
{
/*
* The trigger extended attribute order is the same in the declaration
* and in the zio_control, so we can always use enumeration. But, the
* enumeration must start with 0 followed by only consecutive value.
*
* NOTE: this values are temporary copied also in the userspace
* library, so if you change the order you have to fix also the
* library header.
*/
ZFAT_ATTR_EXT
=
0
,
ZFAT_ATTR_POL
,
ZFAT_ATTR_INT_CHAN
,
ZFAT_ATTR_INT_THRES
,
ZFAT_ATTR_DELAY
,
ZFAT_ATTR_SW_EN
,
ZFAT_ATTR_SW_FIRE
,
ZFAT_ATTR_TRG_S
,
ZFAT_ATTR_TRG_C
,
ZFAT_ATTR_TRG_F
,
};
/*
* Device Extended Attribute Enumeration
*/
enum
fa_dev_ext_attributes
{
/*
* NOTE: At the moment the only extended attributes we have in
* the device hierarchy are in the cset level, so we can safely
* start from index 0
* NOTE: this values are temporary copied also in the userspace
* library, so if you change the order you have to fix also the
* library header.
*/
ZFAD_ATTR_DECI
=
0
,
ZFAD_ATTR_CH0_OFFSET
,
ZFAD_ATTR_CH1_OFFSET
,
ZFAD_ATTR_CH2_OFFSET
,
ZFAD_ATTR_CH3_OFFSET
,
ZFAD_ATTR_CH0_VREF
,
ZFAD_ATTR_CH1_VREF
,
ZFAD_ATTR_CH2_VREF
,
ZFAD_ATTR_CH3_VREF
,
ZFAD_ATTR_CH0_50TERM
,
ZFAD_ATTR_CH1_50TERM
,
ZFAD_ATTR_CH2_50TERM
,
ZFAD_ATTR_CH3_50TERM
,
ZFAD_ATTR_ACQ_START_S
,
ZFAD_ATTR_ACQ_START_C
,
ZFAD_ATTR_ACQ_START_F
,
};
/*
* ADC parameter id not mapped to Hw register
* Id is used as zio attribute id
...
...
lib/fmc-adc-100m14b4cha.h
0 → 100644
View file @
983a1ad3
/*
* The ADC library for the specific card
*
* Copyright (C) 2014 CERN (www.cern.ch)
* Author: Federico Vaga <federico.vaga@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2 as published by the Free Software Foundation or, at your
* option, any later version.
*/
#ifndef FMCA_ADC_100MA4B4CHA_H_
#define FMCA_ADC_100MA4B4CHA_H_
/*
* Trigger Extended Attribute Enumeration
*/
enum
fa_trig_ext_attributes
{
/*
* The trigger extended attribute order is the same in the declaration
* and in the zio_control, so we can always use enumeration. But, the
* enumeration must start with 0 followed by only consecutive value.
*
* NOTE: this values are temporary copied from the adc driver, so
* do not change this enum
*/
ZFAT_ATTR_EXT
=
0
,
ZFAT_ATTR_POL
,
ZFAT_ATTR_INT_CHAN
,
ZFAT_ATTR_INT_THRES
,
ZFAT_ATTR_DELAY
,
};
/*
* Device Extended Attribute Enumeration
*/
enum
fa_dev_ext_attributes
{
/*
* NOTE: At the moment the only extended attributes we have in
* the device hierarchy are in the cset level, so we can safely
* start from index 0
* NOTE: this values are temporary copied from the adc driver, so
* do not change this enum
*/
ZFAD_ATTR_DECI
=
0
,
ZFAD_ATTR_CH0_OFFSET
,
ZFAD_ATTR_CH1_OFFSET
,
ZFAD_ATTR_CH2_OFFSET
,
ZFAD_ATTR_CH3_OFFSET
,
ZFAD_ATTR_CH0_VREF
,
ZFAD_ATTR_CH1_VREF
,
ZFAD_ATTR_CH2_VREF
,
ZFAD_ATTR_CH3_VREF
,
ZFAD_ATTR_CH0_50TERM
,
ZFAD_ATTR_CH1_50TERM
,
ZFAD_ATTR_CH2_50TERM
,
ZFAD_ATTR_CH3_50TERM
,
ZFAD_ATTR_ACQ_START_S
,
ZFAD_ATTR_ACQ_START_C
,
ZFAD_ATTR_ACQ_START_F
,
};
#endif
/* FMCA_ADC_100MA4B4CHA_H_ */
libtools/fald-acq.c
View file @
983a1ad3
...
...
@@ -24,6 +24,7 @@
#include <linux/zio-user.h>
#include <fmcadc-lib.h>
#include <fmc-adc-100m14b4cha.h>
static
void
fald_help
()
{
...
...
@@ -627,6 +628,11 @@ int main(int argc, char *argv[])
}
ctrl
=
buf
->
metadata
;
data
=
buf
->
data
;
/* FIXME adc-lib should provide enums to retrive
* attributes values */
fprintf
(
stderr
,
"Acquisition started at secs:%u ticks:%u
\n
"
,
ctrl
->
attr_channel
.
ext_val
[
ZFAD_ATTR_ACQ_START_S
],
ctrl
->
attr_channel
.
ext_val
[
ZFAD_ATTR_ACQ_START_C
]);
fprintf
(
stderr
,
"Read %d samples from shot %i/%i secs:%lld ticks:%lld (loop: %d)
\n
"
,
ctrl
->
nsamples
,
i
+
1
,
acq_cfg
.
value
[
FMCADC_CONF_ACQ_N_SHOTS
],
...
...
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