Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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 - Software
Commits
1a2f76a5
Commit
1a2f76a5
authored
Apr 30, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: new dir with fd-raw-input
parent
c658c47a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
144 additions
and
10 deletions
+144
-10
Makefile
Makefile
+3
-0
fine-delay.h
fine-delay.h
+12
-10
.gitignore
tools/.gitignore
+2
-0
Makefile
tools/Makefile
+20
-0
fd-raw-input.c
tools/fd-raw-input.c
+107
-0
No files found.
Makefile
View file @
1a2f76a5
...
...
@@ -9,6 +9,8 @@ ccflags-y = -I$(ZIO)/include -I$(SPEC_SW)/kernel -I$M
ccflags-y
+=
-DDEBUG
# temporary
subdirs-ccflags-y
=
$
(
ccflags-y
)
obj-m
:=
spec-fine-delay.o
spec-fine-delay-objs
=
fd-zio.o fd-spec.o fd-core.o
...
...
@@ -19,3 +21,4 @@ all: modules
modules_install clean modules
:
$(MAKE)
-C
$(LINUX)
M
=
$(
shell
/bin/pwd
)
$@
$(MAKE)
-C
tools
M
=
$(
shell
/bin/pwd
)
$@
fine-delay.h
View file @
1a2f76a5
#ifndef __FINE_DELAY_H__
#define __FINE_DELAY_H__
/* input ZIO attributes (actually, the internal time is represented as attrs */
enum
fd_zattr_in_idx
{
FD_ATTR_IN_UTC_H
=
0
,
FD_ATTR_IN_UTC_L
,
FD_ATTR_IN_COARSE
,
FD_ATTR_IN_FRAC
,
FD_ATTR_IN_SEQ
,
FD_ATTR_IN_CHAN
,
};
#ifdef __KERNEL__
/* All the rest is only of kernel users */
#include <linux/spinlock.h>
#include <linux/timer.h>
...
...
@@ -65,16 +76,6 @@ struct fd_time {
uint16_t
seq_id
;
};
/* input ZIO attributes (actually, the internal time is represented as attrs */
enum
fd_zattr_in_idx
{
FD_ATTR_IN_UTC_H
=
0
,
FD_ATTR_IN_UTC_L
,
FD_ATTR_IN_COARSE
,
FD_ATTR_IN_FRAC
,
FD_ATTR_IN_SEQ
,
FD_ATTR_IN_CHAN
,
};
static
inline
uint32_t
fd_readl
(
struct
spec_fd
*
fd
,
unsigned
long
reg
)
{
...
...
@@ -212,4 +213,5 @@ extern int fd_spec_init(void);
extern
void
fd_spec_exit
(
void
);
#endif
/* __KERNEL__ */
#endif
/* __FINE_DELAY_H__ */
tools/.gitignore
0 → 100644
View file @
1a2f76a5
fd-raw-input
tools/Makefile
0 → 100644
View file @
1a2f76a5
# user-space tools for spec-fine-delay
HOST_EXTRACFLAGS
+=
-I
$(M)
-I
$(ZIO)
/include
-Wno-trigraphs
HOSTCC
?=
gcc
hostprogs-y
:=
fd-raw-input
# we are not in the kernel, so we need to piggy-back on "make modules"
modules
:
$(hostprogs-y)
clean
:
rm
-f
$
(
hostprogs-y
)
*
.o
*
~
# make nothing for module_install, but avoid errors
module_install
:
# we need this as we are out of the kernel
%
:
%.c
$(HOSTCC)
$(HOST_EXTRACFLAGS)
-Wall
$^
-o
$@
tools/fd-raw-input.c
0 → 100644
View file @
1a2f76a5
/*
* an input tools that accesses the ZIO device
*
* Copyright (C) 2012 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2 as published by the Free Software Foundation or, at your
* option, any later version.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <glob.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/zio.h>
#include <linux/zio-user.h>
#include <fine-delay.h>
#define MAXFD 16
struct
zio_control
ctrl
;
int
main
(
int
argc
,
char
**
argv
)
{
glob_t
glob_buf
;
int
fd
[
MAXFD
];
int
i
,
j
,
maxfd
=
0
;
fd_set
allset
,
curset
;
if
(
argc
<
2
)
{
/* rebuild argv using globbing */
glob_buf
.
gl_offs
=
1
;
/* "????" spits a trigraph warning: use "*" instead (bah!) */
glob
(
"/dev/zio-fd-*-0-0-ctrl"
,
GLOB_DOOFFS
,
NULL
,
&
glob_buf
);
glob
(
"/dev/zio/zio-fd-*-0-0-ctrl"
,
GLOB_DOOFFS
|
GLOB_APPEND
,
NULL
,
&
glob_buf
);
glob_buf
.
gl_pathv
[
0
]
=
argv
[
0
];
argv
=
glob_buf
.
gl_pathv
;
argc
=
glob_buf
.
gl_pathc
+
glob_buf
.
gl_offs
;
}
if
(
argc
==
1
)
{
fprintf
(
stderr
,
"%s: no arguments and no glob results
\n
"
,
argv
[
0
]);
exit
(
1
);
};
if
(
argc
>=
MAXFD
)
{
fprintf
(
stderr
,
"%s: too many file names
\n
"
,
argv
[
0
]);
exit
(
1
);
};
FD_ZERO
(
&
allset
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
fd
[
i
]
=
open
(
argv
[
i
],
O_RDONLY
);
if
(
fd
[
i
]
<
0
)
{
fprintf
(
stderr
,
"%s: %s: %s
\n
"
,
argv
[
0
],
argv
[
1
],
strerror
(
errno
));
exit
(
1
);
}
if
(
fd
[
i
]
>
maxfd
)
maxfd
=
fd
[
i
];
FD_SET
(
fd
[
i
],
&
allset
);
}
/* Ok, now wait for each of them to spit a timestamp */
while
(
1
)
{
curset
=
allset
;
switch
(
select
(
maxfd
+
1
,
&
curset
,
NULL
,
NULL
,
NULL
))
{
case
-
1
:
if
(
errno
==
EINTR
)
continue
;
fprintf
(
stderr
,
"%s: select: %s
\n
"
,
argv
[
0
],
strerror
(
errno
));
exit
(
1
);
case
0
:
continue
;
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
FD_ISSET
(
fd
[
i
],
&
curset
))
continue
;
/* Ok, it's there: read and decode */
j
=
read
(
fd
[
i
],
&
ctrl
,
sizeof
(
ctrl
));
if
(
j
!=
sizeof
(
ctrl
))
{
fprintf
(
stderr
,
"%s: read(): got %i not %i
\n
"
,
argv
[
0
],
j
,
sizeof
(
ctrl
));
exit
(
1
);
}
printf
(
"%s: %08x %08x %08x %08x %08x
\n
"
,
argv
[
i
],
ctrl
.
attr_channel
.
ext_val
[
0
],
ctrl
.
attr_channel
.
ext_val
[
1
],
ctrl
.
attr_channel
.
ext_val
[
2
],
ctrl
.
attr_channel
.
ext_val
[
3
],
ctrl
.
attr_channel
.
ext_val
[
4
]);
}
}
return
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