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
0d7eae66
Commit
0d7eae66
authored
Apr 21, 2016
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
features from fmc-adc-100m gateware 4.1
parents
a6a3d20d
b501b6f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
19 deletions
+24
-19
fa-core.c
kernel/fa-core.c
+2
-0
fa-irq.c
kernel/fa-irq.c
+7
-12
fa-regtable.c
kernel/fa-regtable.c
+2
-0
fa-zio-drv.c
kernel/fa-zio-drv.c
+1
-0
fmc-adc-100m14b4cha.h
kernel/fmc-adc-100m14b4cha.h
+12
-7
No files found.
kernel/fa-core.c
View file @
0d7eae66
...
...
@@ -343,6 +343,8 @@ static int __fa_init(struct fa_dev *fa)
/* Retrieve calibration from the eeprom and validate*/
fa_read_eeprom_calib
(
fa
);
fa
->
mshot_max_samples
=
fa_readl
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFA_MULT_MAX_SAMP
]);
/* Force stop FSM to prevent early trigger fire */
fa_writel
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFA_CTL_FMS_CMD
],
...
...
kernel/fa-irq.c
View file @
0d7eae66
...
...
@@ -227,19 +227,14 @@ void zfat_irq_acq_end(struct zio_cset *cset)
* This ultimate check is not crucial because the HW implements
* a solid state machine and acq-end can happens only after
* the execution of the n requested shots.
*
* FIXME (v4.0) this work only for multi-shot acquisition
*/
fa
->
n_fires
=
fa
->
n_shots
;
if
(
fa
->
n_shots
>
1
)
{
fa
->
n_fires
-=
fa_readl
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFAT_SHOTS_REM
]);
if
(
fa
->
n_fires
!=
fa
->
n_shots
)
{
dev_err
(
&
fa
->
fmc
->
dev
,
"Expected %i trigger fires, but %i occurs
\n
"
,
fa
->
n_shots
,
fa
->
n_fires
);
}
fa
->
n_fires
=
fa
->
n_shots
-
fa_readl
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFAT_SHOTS_REM
]);
if
(
fa
->
n_fires
!=
fa
->
n_shots
)
{
dev_err
(
&
fa
->
fmc
->
dev
,
"Expected %i trigger fires, but %i occurs
\n
"
,
fa
->
n_shots
,
fa
->
n_fires
);
}
}
...
...
kernel/fa-regtable.c
View file @
0d7eae66
...
...
@@ -78,6 +78,8 @@ const struct zfa_field_desc zfad_regs[] = {
[
ZFA_CH4_GAIN
]
=
{
0x78
,
0x0000FFFF
,
0
},
[
ZFA_CH4_OFFSET
]
=
{
0x7C
,
0x0000FFFF
,
0
},
[
ZFA_CH4_SAT
]
=
{
0x80
,
0x00007FFF
,
0
},
/* Other options */
[
ZFA_MULT_MAX_SAMP
]
=
{
0x84
,
0xFFFFFFFF
,
0
},
/* IRQ */
[
ZFA_IRQ_ADC_DISABLE_MASK
]
=
{
0x00
,
0x00000003
,
0
},
[
ZFA_IRQ_ADC_ENABLE_MASK
]
=
{
0x04
,
0x00000003
,
0
},
...
...
kernel/fa-zio-drv.c
View file @
0d7eae66
...
...
@@ -121,6 +121,7 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
ZIO_PARAM_EXT
(
"rst-ch-offset"
,
ZIO_WO_PERM
,
ZFA_CTL_DAC_CLR_N
,
1
),
ZIO_PARAM_EXT
(
"sample-frequency"
,
ZIO_RO_PERM
,
ZFAT_SAMPLING_HZ
,
0
),
ZIO_PARAM_EXT
(
"max-sample-mshot"
,
ZIO_RO_PERM
,
ZFA_MULT_MAX_SAMP
,
0
),
};
#if 0 /* FIXME Unused until TLV control will be available */
...
...
kernel/fmc-adc-100m14b4cha.h
View file @
0d7eae66
...
...
@@ -67,8 +67,6 @@ enum fa100m14b4c_dev_ext_attr {
/* ADC DDR memory */
#define FA100M14B4C_MAX_ACQ_BYTE 0x10000000
/* 256MB */
/* In Multi shot mode samples go through a dpram which has a limited size */
#define FA100M14B4C_MAX_MSHOT_ACQ_BYTE 0x3FE8
/* 2045 samples (2045*8 bytes) */
enum
fa100m14b4c_input_range
{
FA100M14B4C_RANGE_10V
=
0x0
,
...
...
@@ -195,6 +193,9 @@ enum zfadc_dregs_enum {
ZFA_CHx_GAIN
,
ZFA_CHx_OFFSET
,
ZFA_CHx_SAT
,
/* Other options */
ZFA_MULT_MAX_SAMP
,
/* end:declaration block requiring some order */
/* two wishbone core for IRQ: VIC, ADC */
ZFA_IRQ_ADC_DISABLE_MASK
,
...
...
@@ -342,6 +343,7 @@ struct fa_dev {
/* Acquisition */
unsigned
int
n_shots
;
unsigned
int
n_fires
;
unsigned
int
mshot_max_samples
;
/* Statistic informations */
unsigned
int
n_dma_err
;
...
...
@@ -402,8 +404,9 @@ extern struct zio_trigger_type zfat_type;
static
inline
int
zfat_overflow_detection
(
struct
zio_ti
*
ti
,
unsigned
int
addr
,
uint32_t
val
)
{
struct
fa_dev
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
zio_attribute
*
ti_zattr
=
ti
->
zattr_set
.
std_zattr
;
uint32_t
pre_t
,
post_t
,
nshot_t
;
uint32_t
pre_t
,
post_t
,
nshot_t
,
nsamples
;
size_t
shot_size
;
if
(
!
addr
)
...
...
@@ -424,18 +427,20 @@ static inline int zfat_overflow_detection(struct zio_ti *ti, unsigned int addr,
* post-sample by the ADC
* +2 because of the timetag at the end
*/
shot_size
=
((
pre_t
+
post_t
+
1
+
2
)
*
ti
->
cset
->
ssize
)
*
FA100M14B4C_NCHAN
;
nsamples
=
pre_t
+
post_t
+
1
;
shot_size
=
((
nsamples
+
2
)
*
ti
->
cset
->
ssize
)
*
FA100M14B4C_NCHAN
;
if
(
(
shot_size
*
nshot_t
)
>
FA100M14B4C_MAX_ACQ_BYTE
)
{
dev_err
(
&
ti
->
head
.
dev
,
"Cannot acquire, dev memory overflow
\n
"
);
return
-
ENOMEM
;
}
/* in case of multi shot, each shot cannot exceed the dpram size */
if
(
(
nshot_t
>
1
)
&&
(
shot_size
>
FA100M14B4C_MAX_MSHOT_ACQ_BYTE
)
)
{
(
nsamples
>
fa
->
mshot_max_samples
)
)
{
dev_err
(
&
ti
->
head
.
dev
,
"Cannot acquire such amount of samples "
"(
shot_size: %d pre-samp:%d post-samp:
%d) in multi shot mode."
"(
req: %d , max:
%d) in multi shot mode."
"dev memory overflow
\n
"
,
(
int
)
shot_size
,
pre_t
,
post_t
);
nsamples
,
fa
->
mshot_max_samples
);
return
-
ENOMEM
;
}
return
0
;
...
...
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