Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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 DEL 1ns 4cha
Commits
27a6774b
Commit
27a6774b
authored
Jun 05, 2012
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/lib: added sweep test program
parent
fbb998a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
1 deletion
+92
-1
Makefile
software/lib/Makefile
+5
-1
sweep_test.c
software/lib/sweep_test.c
+87
-0
No files found.
software/lib/Makefile
View file @
27a6774b
...
...
@@ -5,7 +5,7 @@ CFLAGS = -I../include -g -Imini_bone -Ispll
OBJS_LIB
=
fdelay_lib.o i2c_master.o onewire.o mini_bone/minibone_lib.o mini_bone/ptpd_netif.o spec_common.o spec/speclib.o fdelay_dmtd_calibration.o
all
:
testprog lib gs rp-test
all
:
testprog lib gs rp-test
sweep-test
lib
:
$(OBJS_LIB)
gcc
-shared
-o
libfinedelay.so
$(OBJS_LIB)
...
...
@@ -19,5 +19,9 @@ gs: lib fdelay-gs.o
rp-test
:
lib random_pulse_test.o
gcc
-o
fdelay-random-test
$(OBJS_LIB)
random_pulse_test.o
-lm
sweep-test
:
lib sweep_test.o
gcc
-o
fdelay-sweep-test
$(OBJS_LIB)
sweep_test.o
-lm
clean
:
rm
-f
*
.o fdelay-random-test fdelay-gs fdelay_pps_demo fdelay_test
\ No newline at end of file
software/lib/sweep_test.c
0 → 100644
View file @
27a6774b
/* Simple demo that reads samples using the read call */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <unistd.h>
#include <signal.h>
#include <sys/select.h>
#define FDELAY_INTERNAL // for sysfs_get/set
#include "fdelay_lib.h"
int
configure_board
(
fdelay_device_t
*
b
,
int
argc
,
char
*
argv
[])
{
fdelay_time_t
t
;
if
(
spec_fdelay_init
(
b
,
argc
,
argv
)
<
0
)
{
printf
(
"Init failed
\n
"
);
exit
(
-
1
);
}
fdelay_configure_sync
(
b
,
FDELAY_SYNC_LOCAL
);
fdelay_get_time
(
b
,
&
t
);
t
.
frac
=
0
;
t
.
coarse
=
0
;
t
.
utc
+=
2
;
sleep
(
1
);
fdelay_configure_pulse_gen
(
b
,
1
,
1
,
t
,
10
*
1000000
,
99999990
,
-
1
);
fdelay_configure_trigger
(
b
,
0
,
1
);
fdelay_raw_readout
(
b
,
0
);
fdelay_configure_readout
(
b
,
0
);
fdelay_configure_readout
(
b
,
1
);
fdelay_configure_trigger
(
b
,
1
,
0
);
printf
(
"Configuration complete
\n
"
);
fflush
(
stdout
);
return
0
;
}
void
handle_readout
(
fdelay_device_t
*
b
,
int
n_samples
)
{
int64_t
t_ps
;
fdelay_time_t
t
;
static
time_t
start
;
static
int64_t
t_prev
;
static
int
prev_seq
=
-
1
;
int
done
;
for
(;;)
while
(
fdelay_read
(
b
,
&
t
,
1
)
==
1
)
{
t_ps
=
(
t
.
coarse
*
8000LL
)
+
((
t
.
frac
*
8000LL
)
>>
12
);
int64_t
delta
=
t_ps
-
t_prev
;
if
(
delta
<
0
)
delta
+=
1000000000000LL
;
if
(
prev_seq
>=
0
)
printf
(
"Samp %lli.%03lli %lli
\n
"
,
t_ps
/
1000LL
,
t_ps
%
1000LL
,
delta
)
;
prev_seq
=
t
.
seq_id
;
t_prev
=
t_ps
;
n_samples
--
;
if
(
!
n_samples
)
return
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
fdelay_device_t
b
;
configure_board
(
&
b
,
argc
,
argv
);
handle_readout
(
&
b
,
40000
);
}
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