Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - Software
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 TDC 1ns 5cha - Software
Commits
34e7aa43
Commit
34e7aa43
authored
Oct 15, 2012
by
Samuel Iglesias Gonsálvez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdc: add pulse width verification
Signed-off-by:
Samuel Iglesias Gonsalvez
<
siglesias@igalia.com
>
parent
445eb82a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
tdc-fmc.c
drivers/tdc-fmc.c
+36
-4
No files found.
drivers/tdc-fmc.c
View file @
34e7aa43
...
...
@@ -88,6 +88,29 @@ static int tdc_fmc_check_lost_events(u32 curr_wr_ptr, u32 prev_wr_ptr, int *coun
return
0
;
}
static
inline
int
tdc_is_valid_pulse_width
(
struct
tdc_event
rising
,
struct
tdc_event
falling
)
{
/* Check pulse width from smaller to bigger quantities. */
if
(
likely
(
rising
.
fine_time
<
(
falling
.
fine_time
-
124
)))
{
/* Valid pulse width (higher or equal to 100 ns) */
return
1
;
}
else
{
if
(
likely
(
rising
.
coarse_time
<
(
falling
.
coarse_time
-
13
)))
/* Valid pulse width (higher or equal to 100 ns) */
return
1
;
else
{
if
(
likely
(
rising
.
local_utc
<
(
falling
.
local_utc
-
1
)))
/* Valid pulse width (higher or equal to 100 ns) */
return
1
;
}
}
/* Invalid pulse width (less than 100 ns) */
return
0
;
}
static
void
tdc_fmc_irq_work
(
struct
work_struct
*
work
)
{
struct
spec_tdc
*
tdc
=
container_of
(
work
,
struct
spec_tdc
,
irq_work
);
...
...
@@ -146,11 +169,20 @@ static void tdc_fmc_irq_work(struct work_struct *work)
chan
=
tmp_data
->
metadata
&
TDC_EVENT_CHANNEL_MASK
;
/* Add the DaCapo flag to notify the user */
tdc
->
event
[
chan
].
dacapo_flag
=
dacapo_flag
;
/* Copy the data and notify the readers (ZIO trigger) */
tdc
->
event
[
chan
].
data
=
*
tmp_data
;
/* Check if the event is due to rising edge or falling edge */
if
(
tmp_data
->
metadata
&
TDC_EVENT_SLOPE_MASK
)
/* Copy the data as it is a rising edge one */
tdc
->
event
[
chan
].
data
=
*
tmp_data
;
else
{
/* Check pulse width using the falling edge event */
if
(
tdc_is_valid_pulse_width
(
tdc
->
event
[
chan
].
data
,
*
tmp_data
))
{
/* Valid pulse width -> Fire ZIO trigger */
zio_fire_trigger
(
tdc
->
zdev
->
cset
[
chan
].
ti
);
}
}
rd_ptr
=
(
rd_ptr
+
1
)
%
TDC_EVENT_BUFFER_SIZE
;
/* Fire ZIO trigger to save the adquisitions in ZIO buffers */
zio_fire_trigger
(
tdc
->
zdev
->
cset
[
chan
].
ti
);
}
dma_out:
...
...
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