Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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 - Software
Commits
69bd8d73
Commit
69bd8d73
authored
Mar 26, 2013
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[improve] fa-zio-drv.c: better management of ZIO software trigger
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
597abb80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
33 deletions
+55
-33
fa-zio-drv.c
kernel/fa-zio-drv.c
+55
-33
No files found.
kernel/fa-zio-drv.c
View file @
69bd8d73
...
...
@@ -263,9 +263,17 @@ int zfad_fsm_command(struct fa_dev *fa, uint32_t command)
* abort an acquisition. If it is START, we abort because if there was
* a previous start but the acquisition end interrupt doesn't occurs,
* START mean RESTART. If it is a clean START, the abort has not
* effects
* effects.
*
* This is done only if ADC is using its own trigger, otherwise it is
* not necessary.
*
* The case of fmc-adc-trg is optimized because is the most common
* case
*/
zio_trigger_abort_disable
(
fa
->
zdev
->
cset
,
0
);
if
(
likely
(
fa
->
zdev
->
cset
->
trig
==
&
zfat_type
||
command
==
ZFA_STOP
))
zio_trigger_abort_disable
(
fa
->
zdev
->
cset
,
0
);
/* Reset counters */
fa
->
n_shots
=
0
;
fa
->
n_fires
=
0
;
...
...
@@ -548,6 +556,47 @@ static const struct zio_sysfs_operations zfad_s_op = {
.
info_get
=
zfad_info_get
,
};
/*
* zfad_input_cset_software
* @fa the adc instance to use
* @cset channel set to acquire
*
* If the user is using the ADC trigger, then it can do a multi-shot
* acquisition.
* If the user is using a software trigger, it cannot do multi-shot.
* The generic arm trigger used by software trigger returns a
* zio_block. We must convert it into a zfad_block to perform DMA
*/
static
int
zfad_input_cset_software
(
struct
fa_dev
*
fa
,
struct
zio_cset
*
cset
)
{
struct
zfad_block
*
tmp
;
int
err
;
/* Check if device memory allows this acquisition */
err
=
zfat_overflow_detection
(
cset
->
ti
,
ZFAT_POST
,
cset
->
ti
->
nsamples
);
if
(
err
)
return
err
;
tmp
=
kzalloc
(
sizeof
(
struct
zfad_block
),
GFP_ATOMIC
);
if
(
!
tmp
)
return
-
ENOMEM
;
tmp
->
block
=
cset
->
interleave
->
active_block
;
cset
->
interleave
->
priv_d
=
tmp
;
tmp
->
dev_mem_ptr
=
0
;
/* Always the first block */
/* Configure post samples */
zfa_common_conf_set
(
fa
,
ZFAT_POST
,
cset
->
ti
->
nsamples
);
/* Start the acquisition */
zfad_fsm_command
(
fa
,
ZFA_START
);
fa
->
n_shots
=
1
;
/* Fire software trigger */
zfa_common_conf_set
(
fa
,
ZFAT_SW
,
1
);
return
-
EAGAIN
;
}
/*
* zfad_input_cset
* @cset: channel set to acquire
...
...
@@ -567,37 +616,9 @@ static int zfad_input_cset(struct zio_cset *cset)
return
-
EINVAL
;
}
/*
* If the user is using the ADC trigger, then it can do a multi-shot
* acquisition.
* If the user is using a software trigger, it cannot do multi-shot.
* The generic arm trigger used by software trigger returns a
* zio_block. We must convert it into a zfad_block to perform DMA
*/
if
(
cset
->
trig
!=
&
zfat_type
)
{
struct
zfad_block
*
tmp
;
int
err
;
/* Check if device memory allows this acquisition */
err
=
zfat_overflow_detection
(
cset
->
ti
,
ZFAT_POST
,
cset
->
ti
->
nsamples
);
if
(
err
)
return
err
;
tmp
=
kmalloc
(
sizeof
(
struct
zfad_block
),
GFP_ATOMIC
);
if
(
!
tmp
)
return
-
ENOMEM
;
tmp
->
block
=
cset
->
interleave
->
active_block
;
cset
->
interleave
->
priv_d
=
tmp
;
fa
->
n_shots
=
1
;
/* Configure post samples */
zfa_common_conf_set
(
fa
,
ZFAT_POST
,
cset
->
ti
->
nsamples
);
/* Start the acquisition */
zfad_fsm_command
(
fa
,
ZFA_START
);
/* Fire software trigger */
zfa_common_conf_set
(
fa
,
ZFAT_SW
,
1
);
/* If not the fmc-adc-trg, then is a ZIO software trigger */
if
(
unlikely
(
cset
->
trig
!=
&
zfat_type
))
{
return
zfad_input_cset_software
(
fa
,
cset
);
}
return
-
EAGAIN
;
/* data_done on DMA_DONE interrupt */
...
...
@@ -690,6 +711,7 @@ static void zfad_start_dma(struct zio_cset *cset)
zfa_common_conf_set
(
fa
,
ZFAT_CFG_SW_EN
,
ti
->
zattr_set
.
ext_zattr
[
5
].
value
);
}
else
{
dev_dbg
(
&
cset
->
head
.
dev
,
"Software acquisition over"
);
zfa_common_conf_set
(
fa
,
ZFAT_CFG_SW_EN
,
1
);
}
...
...
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