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
223af9c2
Commit
223af9c2
authored
Oct 08, 2020
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: Improve user exit mechanism for irq-demo
parent
6ba4b281
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
14 deletions
+9
-14
irq-demo-private.h
sw/irq-demo/irq-demo-private.h
+1
-0
irq-demo.c
sw/irq-demo/irq-demo.c
+8
-14
No files found.
sw/irq-demo/irq-demo-private.h
View file @
223af9c2
...
...
@@ -35,6 +35,7 @@ static void destroy_user_arguments(user_args args);
static
void
show_help
(
void
);
static
unsigned
int
check_user_stop
(
void
);
static
void
set_stdin_as_nonblocking
(
void
);
#endif
sw/irq-demo/irq-demo.c
View file @
223af9c2
...
...
@@ -70,6 +70,8 @@ int main(int argc, char *argv[])
enable_fmc_dio_device_irq
(
dev
,
TEST_FMC_DIO_CH
);
setup_fmc_dio_device_irq
(
dev
,
user_arguments
->
irq_period
,
TEST_FMC_DIO_COUNT
);
set_stdin_as_nonblocking
();
while
(
!
user_stop
)
{
demo_irq_process_loop
(
dev
,
sengine
);
user_stop
=
check_user_stop
();
...
...
@@ -148,22 +150,14 @@ static void show_help(void)
static
unsigned
int
check_user_stop
(
void
)
{
int
ret
=
0
;
char
c
;
fd_set
fds
;
struct
timeval
tv
;
FD_ZERO
(
&
fds
);
FD_SET
(
STDIN_FILENO
,
&
fds
);
c
=
getchar
();
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
1
;
if
(
select
(
STDIN_FILENO
+
1
,
&
fds
,
NULL
,
NULL
,
&
tv
)
==
1
)
{
c
=
getchar
();
if
(
c
==
'q'
)
ret
=
1
;
}
return
(
c
==
'q'
);
}
return
ret
;
static
void
set_stdin_as_nonblocking
(
void
)
{
fcntl
(
STDIN_FILENO
,
F_SETFL
,
O_NONBLOCK
);
}
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