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
e8866fd4
Commit
e8866fd4
authored
Oct 21, 2020
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
irq-demo: Add a new user parameter to control sleep period of DEMO
parent
465bb76a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
irq-demo-private.h
sw/irq-demo/irq-demo-private.h
+4
-2
irq-demo.c
sw/irq-demo/irq-demo.c
+10
-4
No files found.
sw/irq-demo/irq-demo-private.h
View file @
e8866fd4
...
...
@@ -19,17 +19,19 @@
#define TEST_FMC_DIO_COUNT -1
#define TEST_FMC_DIO_PERIOD 100000000
#define STATS_LOG_PATH "./.irq-demo.log"
#define PROCESS_SLEEP_US 1
#define PROCESS_SLEEP_US 1
00000
#define MAX_FMC_DIO_PATH 100
struct
_user_args
{
char
fmc_dev_path
[
MAX_FMC_DIO_PATH
];
unsigned
int
irq_period
;
unsigned
int
sleep_period_us
;
int
verbose
;
};
typedef
struct
_user_args
*
user_args
;
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
);
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
,
unsigned
int
sleep_us
);
static
void
process_timestamps_to_engine
(
stats_engine
engine
,
struct
usr_timestamp
*
ts
,
unsigned
int
nts
);
...
...
sw/irq-demo/irq-demo.c
View file @
e8866fd4
...
...
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
global_fmc_dev
=
dev
;
/* Main loop of IRQ demo (until user requests to exit) */
demo_irq_process_loop
(
dev
,
sengine
);
demo_irq_process_loop
(
dev
,
sengine
,
user_arguments
->
sleep_period_us
);
/* Exit sequence */
...
...
@@ -151,7 +151,8 @@ out_log:
return
ret
;
}
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
)
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
,
unsigned
int
sleep_us
)
{
struct
usr_timestamp
*
ts
;
unsigned
int
nts
;
...
...
@@ -167,7 +168,7 @@ static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine)
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
);
usleep
(
sleep_us
);
user_stop
=
check_user_stop
();
}
while
(
!
user_stop
);
}
...
...
@@ -200,6 +201,7 @@ static int parse_user_arguments(int argc, char *argv[], user_args parsed_args)
int
opt
;
parsed_args
->
irq_period
=
TEST_FMC_DIO_PERIOD
;
parsed_args
->
sleep_period_us
=
PROCESS_SLEEP_US
;
parsed_args
->
verbose
=
0
;
if
(
argc
==
1
)
{
...
...
@@ -207,7 +209,7 @@ static int parse_user_arguments(int argc, char *argv[], user_args parsed_args)
return
1
;
}
while
((
opt
=
getopt
(
argc
,
argv
,
"hvf:p:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"hvf:p:
s:
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'f'
:
strncpy
(
parsed_args
->
fmc_dev_path
,
optarg
,
MAX_FMC_DIO_PATH
-
1
);
...
...
@@ -215,6 +217,9 @@ static int parse_user_arguments(int argc, char *argv[], user_args parsed_args)
case
'p'
:
sscanf
(
optarg
,
"%d"
,
&
parsed_args
->
irq_period
);
break
;
case
's'
:
sscanf
(
optarg
,
"%d"
,
&
parsed_args
->
sleep_period_us
);
break
;
case
'v'
:
parsed_args
->
verbose
=
1
;
break
;
...
...
@@ -245,6 +250,7 @@ static void show_help(void)
printf
(
"%s -f <FMC DIO device path> [options]
\n
"
,
PROG_NAME
);
printf
(
"
\t
-f <path>
\t
Set FMC DIO device path
\n
"
);
printf
(
"
\t
-p <period>
\t
Set IRQ period (in nanoseconds)
\n
"
);
printf
(
"
\t
-s <sleep us>
\t
Set Sleep period in microseconds
\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 + ENTER or CNTRL+C to exit from the demo tool
\n
"
);
...
...
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