Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DIO 5ch TTL a
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
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 DIO 5ch TTL a
Commits
6819b27a
Commit
6819b27a
authored
Oct 21, 2020
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
irq-demo: Fix user stop mechanism
parent
d83d33ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
irq-demo.c
sw/irq-demo/irq-demo.c
+6
-9
No files found.
sw/irq-demo/irq-demo.c
View file @
6819b27a
...
...
@@ -55,7 +55,6 @@ int main(int argc, char *argv[])
user_args
user_arguments
;
log_device
logs
[
2
];
unsigned
int
n_logs
=
2
;
unsigned
int
user_stop
=
0
;
stats_engine
sengine
;
int
ret
=
0
;
...
...
@@ -128,12 +127,7 @@ int main(int argc, char *argv[])
global_fmc_dev
=
dev
;
/* Main loop of IRQ demo (until user requests to exit) */
while
(
!
user_stop
)
{
/* Main logic funtion (get timestamps and process them in the stats engine) */
demo_irq_process_loop
(
dev
,
sengine
);
/* Check if user has requested to exit */
user_stop
=
check_user_stop
();
}
demo_irq_process_loop
(
dev
,
sengine
);
/* Exit sequence */
...
...
@@ -161,18 +155,21 @@ static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine)
{
struct
usr_timestamp
*
ts
;
unsigned
int
nts
;
int
user_stop
=
0
;
int
ret
;
/* Process loop:
* - Get timestamps from FMC DIO device (specific channel under testing)
* - Pass them to the stats engine and generate the statistics
* - Sleep for a while to avoid excesive CPU consumption
* - Check if user has requested to stop the DEMO
*/
do
{
ret
=
get_utc_ts_from_fmc_dio_device
(
fmc_dev
,
TEST_FMC_DIO_CH
,
&
ts
,
&
nts
);
process_timestamps_to_engine
(
engine
,
ts
,
nts
);
usleep
(
PROCESS_SLEEP_US
);
}
while
(
!
ret
||
ret
==
-
EAGAIN
);
user_stop
=
check_user_stop
();
}
while
(
!
user_stop
);
}
static
void
process_timestamps_to_engine
(
stats_engine
engine
,
struct
usr_timestamp
*
ts
,
...
...
@@ -245,7 +242,7 @@ static void show_help(void)
printf
(
"
\t
-p <period>
\t
Set IRQ period (in nanoseconds)
\n
"
);
printf
(
"
\t
-v
\t\t
Enable verbose mode
\n
"
);
printf
(
"
\t
-h
\t\t
Show this help message
\n
"
);
printf
(
"Please, press 'q' key or CNTRL+C to exit from the demo tool
\n
"
);
printf
(
"Please, press 'q' key
+ ENTER
or CNTRL+C to exit from the demo tool
\n
"
);
}
static
unsigned
int
check_user_stop
(
void
)
...
...
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