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
8a48c54a
Commit
8a48c54a
authored
Apr 08, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: notify and show (dbg) when a valid timestamp is ready
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
c951193d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
ft-irq.c
kernel/ft-irq.c
+22
-9
No files found.
kernel/ft-irq.c
View file @
8a48c54a
...
...
@@ -126,16 +126,17 @@ int ft_read_sw_fifo(struct fmctdc_dev *ft, int channel,
}
static
inline
void
process_timestamp
(
struct
fmctdc_dev
*
ft
,
struct
ft_hw_timestamp
*
hwts
,
int
dacapo_flag
)
static
inline
int
process_timestamp
(
struct
fmctdc_dev
*
ft
,
struct
ft_hw_timestamp
*
hwts
,
struct
ft_wr_timestamp
*
wrts
,
int
dacapo_flag
)
{
struct
ft_channel_state
*
st
;
struct
ft_wr_timestamp
ts
;
struct
ft_wr_timestamp
diff
;
int
channel
,
edge
,
frac
;
int
channel
,
edge
,
frac
,
ret
=
0
;
dev_dbg
(
&
ft
->
fmc
->
dev
,
"process TS(%p): 0x%x 0x%x 0x%x 0x%x
\n
"
,
dev_
v
dbg
(
&
ft
->
fmc
->
dev
,
"process TS(%p): 0x%x 0x%x 0x%x 0x%x
\n
"
,
hwts
,
hwts
->
metadata
,
hwts
->
utc
,
hwts
->
coarse
,
hwts
->
bins
);
channel
=
(
hwts
->
metadata
&
0x7
)
+
1
;
edge
=
hwts
->
metadata
&
(
1
<<
4
)
?
1
:
0
;
...
...
@@ -169,7 +170,7 @@ 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
;
return
;
return
0
;
}
...
...
@@ -180,7 +181,7 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
wait for the falling edge */
st
->
prev_ts
=
ts
;
st
->
expected_edge
=
0
;
return
;
return
0
;
}
...
...
@@ -209,6 +210,10 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
st
->
cur_seq_id
++
;
}
/* Return a valid timestamp */
*
wrts
=
ts
;
ret
=
1
;
/* Put the timestamp in the FIFO */
kfifo_in_spinlocked
(
&
st
->
fifo
,
&
ts
,
sizeof
(
struct
ft_wr_timestamp
),
&
ft
->
lock
);
...
...
@@ -221,6 +226,7 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
/* Wait for the next raising edge */
st
->
expected_edge
=
1
;
return
ret
;
}
static
irqreturn_t
ft_irq_handler
(
int
irq
,
void
*
dev_id
)
...
...
@@ -285,8 +291,9 @@ static void ft_readout_tasklet(unsigned long arg)
struct
fmctdc_dev
*
ft
=
(
struct
fmctdc_dev
*
)
arg
;
struct
fmc_device
*
fmc
=
ft
->
fmc
;
struct
zio_device
*
zdev
=
ft
->
zdev
;
struct
ft_wr_timestamp
wrts
;
uint32_t
rd_ptr
;
int
count
,
dacapo
,
i
,
err
;
int
count
,
dacapo
,
i
,
err
,
ret
;
ft
->
prev_wr_ptr
=
ft
->
cur_wr_ptr
;
ft
->
cur_wr_ptr
=
ft_readl
(
ft
,
TDC_REG_BUFFER_PTR
);
...
...
@@ -307,8 +314,14 @@ static void ft_readout_tasklet(unsigned long arg)
copy_timestamps
(
ft
,
rd_ptr
*
sizeof
(
struct
ft_hw_timestamp
),
sizeof
(
struct
ft_hw_timestamp
),
&
hwts
);
process_timestamp
(
ft
,
&
hw
ts
,
dacapo
);
ret
=
process_timestamp
(
ft
,
&
hwts
,
&
wr
ts
,
dacapo
);
rd_ptr
=
(
rd_ptr
+
1
)
%
FT_BUFFER_EVENTS
;
if
(
ret
)
{
dev_dbg
(
&
ft
->
fmc
->
dev
,
"processed TS(%p): ch %d: seq %d: gseq %d 0x%x 0x%x 0x%x
\n
"
,
wrts
,
wrts
.
channel
,
wrts
.
seq_id
,
wrts
.
gseq_id
,
wrts
.
seconds
,
wrts
.
coarse
,
wrts
.
frac
);
}
}
if
(
!
zdev
)
...
...
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