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
63201f33
Commit
63201f33
authored
Nov 12, 2020
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
irq-demo: Use blocking mode for the ioctl() syscall and remove sleep
parent
b7887f05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
18 deletions
+7
-18
fmc-dio-device.c
sw/irq-demo/dep/fmc-dio-device.c
+2
-2
irq-demo-private.h
sw/irq-demo/irq-demo-private.h
+1
-4
irq-demo.c
sw/irq-demo/irq-demo.c
+4
-12
No files found.
sw/irq-demo/dep/fmc-dio-device.c
View file @
63201f33
...
...
@@ -261,12 +261,12 @@ static int get_hw_ts_from_fmc_dio_device(fmc_dio_device dev, int ch,
int
ret
;
c
->
command
=
WR_DIO_CMD_STAMP
;
c
->
flags
=
0
;
c
->
flags
=
WR_DIO_F_WAIT
;
c
->
channel
=
ch
;
ret
=
ioctl
(
dev
->
fd
,
PRIV_MEZZANINE_CMD
,
(
unsigned
long
)
c
);
if
(
ret
<
0
)
{
return
-
EFAULT
;
return
ret
;
}
if
(
c
->
nstamp
<=
0
)
{
...
...
sw/irq-demo/irq-demo-private.h
View file @
63201f33
...
...
@@ -19,19 +19,16 @@
#define TEST_FMC_DIO_COUNT -1
#define TEST_FMC_DIO_PERIOD 100000000
#define STATS_LOG_PATH "./.irq-demo.log"
#define PROCESS_SLEEP_US 100000
#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
,
unsigned
int
sleep_us
);
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
);
static
void
process_timestamps_to_engine
(
stats_engine
engine
,
struct
usr_timestamp
*
ts
,
unsigned
int
nts
,
int
last_only
);
...
...
sw/irq-demo/irq-demo.c
View file @
63201f33
...
...
@@ -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
,
user_arguments
->
sleep_period_us
);
demo_irq_process_loop
(
dev
,
sengine
);
/* Exit sequence */
...
...
@@ -151,8 +151,7 @@ out_log:
return
ret
;
}
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
,
unsigned
int
sleep_us
)
static
void
demo_irq_process_loop
(
fmc_dio_device
fmc_dev
,
stats_engine
engine
)
{
struct
usr_timestamp
*
ts
;
unsigned
int
nts
;
...
...
@@ -160,9 +159,8 @@ static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine,
int
ret
;
/* Process loop:
* -
G
et timestamps from FMC DIO device (specific channel under testing)
* -
Blocking: g
et 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
{
...
...
@@ -171,7 +169,6 @@ static void demo_irq_process_loop(fmc_dio_device fmc_dev, stats_engine engine,
// Use only the last TS for stats
process_timestamps_to_engine
(
engine
,
ts
,
nts
,
1
);
}
usleep
(
sleep_us
);
user_stop
=
check_user_stop
();
}
while
(
!
user_stop
);
}
...
...
@@ -212,7 +209,6 @@ 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
)
{
...
...
@@ -220,7 +216,7 @@ static int parse_user_arguments(int argc, char *argv[], user_args parsed_args)
return
1
;
}
while
((
opt
=
getopt
(
argc
,
argv
,
"hvf:p:
s:
"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"hvf:p:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'f'
:
strncpy
(
parsed_args
->
fmc_dev_path
,
optarg
,
MAX_FMC_DIO_PATH
-
1
);
...
...
@@ -228,9 +224,6 @@ 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
;
...
...
@@ -261,7 +254,6 @@ 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