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
67544fe0
Commit
67544fe0
authored
Feb 02, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: flush channel buffer
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
6374e09c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
fmctdc-lib.c
lib/fmctdc-lib.c
+41
-0
fmctdc-lib.h
lib/fmctdc-lib.h
+1
-0
No files found.
lib/fmctdc-lib.c
View file @
67544fe0
...
...
@@ -574,4 +574,45 @@ int fmctdc_reference_set(struct fmctdc_board *userb,
}
/**
* It removes all samples from the channel buffer
* @param[in] userb TDC board instance token
* @param[in] channel target channel [1, 5]
* @return 0 on success, otherwise -1 and errno is set appropriately
*/
int
fmctdc_flush
(
struct
fmctdc_board
*
userb
,
unsigned
int
channel
)
{
struct
__fmctdc_board
*
b
=
(
void
*
)(
userb
);
struct
fmctdc_time
t
[
10
];
char
path
[
64
];
int
i
,
en
,
err
;
if
(
channel
>
FMCTDC_NUM_CHANNELS
||
channel
<=
0
)
{
errno
=
EINVAL
;
return
-
1
;
}
en
=
fmctdc_get_acquisition
(
userb
);
if
(
en
<
0
)
return
-
1
;
/* Disable acquisition, it will flush the hw buffer */
err
=
fmctdc_set_acquisition
(
userb
,
0
);
if
(
err
)
return
err
;
/* FIXME when TDC driver will have its zio-trigger this is not
* necessary anymore */
do
{
i
=
fmctdc_read
(
userb
,
channel
,
t
,
10
,
0
);
}
while
(
i
>
0
);
/* Flush ZIO buffer */
snprintf
(
path
,
sizeof
(
path
),
"ft-ch%d/chan0/buffer/flush"
,
channel
);
err
=
fmctdc_sysfs_set
(
b
,
path
,
&
channel
);
if
(
err
)
{
return
err
;
}
/* Re-enable if it was enable */
return
fmctdc_set_acquisition
(
userb
,
en
);
}
lib/fmctdc-lib.h
View file @
67544fe0
...
...
@@ -89,6 +89,7 @@ extern int fmctdc_check_wr_mode(struct fmctdc_board *b);
extern
void
fmctdc_ts_sub
(
struct
fmctdc_time
*
a
,
struct
fmctdc_time
*
b
);
extern
int
fmctdc_reference_set
(
struct
fmctdc_board
*
userb
,
uint32_t
ch_target
,
uint32_t
ch_reference
);
extern
int
fmctdc_flush
(
struct
fmctdc_board
*
userb
,
unsigned
int
channel
);
/**
*@file fmctdc-lib-math.c
...
...
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