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
4bf95691
Commit
4bf95691
authored
Oct 08, 2020
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: Create a basic signal handler to disable interrupts in case of force exit
parent
223af9c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
irq-demo-private.h
sw/irq-demo/irq-demo-private.h
+1
-1
irq-demo.c
sw/irq-demo/irq-demo.c
+15
-0
No files found.
sw/irq-demo/irq-demo-private.h
View file @
4bf95691
...
...
@@ -36,6 +36,6 @@ 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
);
static
void
exit_abruptly
(
int
sig
);
#endif
sw/irq-demo/irq-demo.c
View file @
4bf95691
...
...
@@ -17,6 +17,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
...
...
@@ -26,6 +27,9 @@
#include "file-log.h"
#include "irq-demo-private.h"
/* Static data for signal handlers */
static
fmc_dio_device
global_fmc_dev
=
NULL
;
int
main
(
int
argc
,
char
*
argv
[])
{
fmc_dio_device
dev
;
...
...
@@ -38,6 +42,9 @@ int main(int argc, char *argv[])
stats_engine
sengine
;
int
ret
=
0
;
signal
(
SIGINT
,
exit_abruptly
);
signal
(
SIGQUIT
,
exit_abruptly
);
gen_log
=
create_printf_log_device
();
stats_log
=
create_file_log_device
(
STATS_LOG_PATH
);
logs
[
0
]
=
gen_log
;
...
...
@@ -72,6 +79,8 @@ int main(int argc, char *argv[])
set_stdin_as_nonblocking
();
global_fmc_dev
=
dev
;
while
(
!
user_stop
)
{
demo_irq_process_loop
(
dev
,
sengine
);
user_stop
=
check_user_stop
();
...
...
@@ -161,3 +170,9 @@ static void set_stdin_as_nonblocking(void)
{
fcntl
(
STDIN_FILENO
,
F_SETFL
,
O_NONBLOCK
);
}
static
void
exit_abruptly
(
int
sig
)
{
disable_fmc_dio_device_all_irq
(
global_fmc_dev
);
exit
(
0
);
}
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