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
f9c04ec9
Commit
f9c04ec9
authored
Aug 06, 2014
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: improve code readability
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
aba8d387
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
32 deletions
+30
-32
ft-irq.c
kernel/ft-irq.c
+30
-32
No files found.
kernel/ft-irq.c
View file @
f9c04ec9
...
...
@@ -131,6 +131,7 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
{
struct
ft_channel_state
*
st
;
struct
ft_wr_timestamp
ts
;
struct
ft_wr_timestamp
diff
;
int
channel
,
edge
,
frac
;
...
...
@@ -166,32 +167,33 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
if
(
unlikely
(
edge
!=
st
->
expected_edge
))
{
/* wait unconditionally for next rising edge */
st
->
expected_edge
=
1
;
}
else
{
return
;
}
if
(
st
->
expected_edge
==
0
)
{
/* got a falling edge after a rising one */
struct
ft_wr_timestamp
diff
=
ts
;
if
(
st
->
expected_edge
!=
0
)
{
st
->
prev_ts
=
ts
;
st
->
expected_edge
=
1
-
st
->
expected_edge
;
return
;
}
/* got a falling edge after a rising one */
diff
=
ts
;
ft_ts_sub
(
&
diff
,
&
st
->
prev_ts
);
/* Check timestamp width. Must be at least 100 ns
(coarse = 12, frac = 2048) */
if
(
likely
(
diff
.
seconds
||
diff
.
coarse
>
12
if
(
likely
(
diff
.
seconds
||
diff
.
coarse
>
12
||
(
diff
.
coarse
==
12
&&
diff
.
frac
>=
2048
)))
{
ts
=
st
->
prev_ts
;
ft_ts_apply_offset
(
&
ts
,
ft
->
calib
.
zero_offset
[
channel
-
1
]);
ft_ts_apply_offset
(
&
ts
,
ft
->
calib
.
zero_offset
[
channel
-
1
]);
ft_ts_apply_offset
(
&
ts
,
-
ft
->
calib
.
wr_offset
);
if
(
st
->
user_offset
)
ft_ts_apply_offset
(
&
ts
,
st
->
user_offset
);
ft_ts_apply_offset
(
&
ts
,
st
->
user_offset
);
/* Got a dacapo flag? make a gap in
the sequence ID to indicate
/* Got a dacapo flag? make a gap in the sequence ID to indicate
an unknown loss of timestamps */
ts
.
seq_id
=
st
->
cur_seq_id
++
;
...
...
@@ -204,11 +206,7 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
/* Put the timestamp in the FIFO */
enqueue_timestamp
(
ft
,
channel
,
&
ts
);
}
}
else
st
->
prev_ts
=
ts
;
st
->
expected_edge
=
1
-
st
->
expected_edge
;
}
}
static
irqreturn_t
ft_irq_handler
(
int
irq
,
void
*
dev_id
)
...
...
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