Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - 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 TDC 1ns 5cha - Software
Commits
ad82c9e8
Commit
ad82c9e8
authored
Jan 28, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: use zio features
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
144a8bcf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
36 deletions
+41
-36
fmc-tdc.h
kernel/fmc-tdc.h
+3
-2
ft-irq.c
kernel/ft-irq.c
+7
-5
ft-zio.c
kernel/ft-zio.c
+21
-21
fmctdc-lib.c
lib/fmctdc-lib.c
+7
-6
fmctdc-lib.h
lib/fmctdc-lib.h
+3
-2
No files found.
kernel/fmc-tdc.h
View file @
ad82c9e8
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
#ifndef __FMC_TDC_H__
#ifndef __FMC_TDC_H__
#define __FMC_TDC_H__
#define __FMC_TDC_H__
#define FT_VERSION 2
/* version of the driver */
#define FT_VERSION_MAJ 2
/* version of the driver */
#define FT_VERSION_MIN 1
/* default gatewares */
/* default gatewares */
#define FT_GATEWARE_SVEC "fmc/svec-fmc-tdc.bin"
#define FT_GATEWARE_SVEC "fmc/svec-fmc-tdc.bin"
...
@@ -29,6 +30,7 @@ enum ft_zattr_dev_idx {
...
@@ -29,6 +30,7 @@ enum ft_zattr_dev_idx {
FT_ATTR_DEV_VERSION
=
0
,
FT_ATTR_DEV_VERSION
=
0
,
FT_ATTR_DEV_SECONDS
,
FT_ATTR_DEV_SECONDS
,
FT_ATTR_DEV_COARSE
,
FT_ATTR_DEV_COARSE
,
FT_ATTR_DEV_SEQUENCE
,
FT_ATTR_DEV_COMMAND
,
/* see below for commands */
FT_ATTR_DEV_COMMAND
,
/* see below for commands */
FT_ATTR_DEV_TEMP
,
FT_ATTR_DEV_TEMP
,
FT_ATTR_DEV_ENABLE_INPUTS
,
FT_ATTR_DEV_ENABLE_INPUTS
,
...
@@ -41,7 +43,6 @@ enum ft_zattr_in_idx {
...
@@ -41,7 +43,6 @@ enum ft_zattr_in_idx {
FT_ATTR_TDC_SECONDS
=
FT_ATTR_DEV__LAST
,
FT_ATTR_TDC_SECONDS
=
FT_ATTR_DEV__LAST
,
FT_ATTR_TDC_COARSE
,
FT_ATTR_TDC_COARSE
,
FT_ATTR_TDC_FRAC
,
FT_ATTR_TDC_FRAC
,
FT_ATTR_TDC_SEQ
,
FT_ATTR_TDC_TERMINATION
,
FT_ATTR_TDC_TERMINATION
,
FT_ATTR_TDC_OFFSET
,
FT_ATTR_TDC_OFFSET
,
FT_ATTR_TDC_USER_OFFSET
,
FT_ATTR_TDC_USER_OFFSET
,
...
...
kernel/ft-irq.c
View file @
ad82c9e8
...
@@ -95,14 +95,15 @@ int ft_read_sw_fifo(struct fmctdc_dev *ft, int channel,
...
@@ -95,14 +95,15 @@ int ft_read_sw_fifo(struct fmctdc_dev *ft, int channel,
ctrl
->
nsamples
=
1
;
ctrl
->
nsamples
=
1
;
v
=
ctrl
->
attr_channel
.
ext_val
;
v
=
ctrl
->
attr_channel
.
ext_val
;
v
[
FT_ATTR_DEV_SEQUENCE
]
=
ts
.
gseq_id
;
v
[
FT_ATTR_TDC_SECONDS
]
=
ts
.
seconds
;
v
[
FT_ATTR_TDC_COARSE
]
=
ts
.
coarse
;
v
[
FT_ATTR_TDC_FRAC
]
=
ts
.
frac
;
v
[
FT_ATTR_TDC_SEQ
]
=
ts
.
seq_id
;
v
[
FT_ATTR_TDC_OFFSET
]
=
ft
->
calib
.
zero_offset
[
channel
-
1
];
v
[
FT_ATTR_TDC_OFFSET
]
=
ft
->
calib
.
zero_offset
[
channel
-
1
];
v
[
FT_ATTR_TDC_USER_OFFSET
]
=
st
->
user_offset
;
v
[
FT_ATTR_TDC_USER_OFFSET
]
=
st
->
user_offset
;
/* Only for sysfs debugging */
v
[
FT_ATTR_TDC_SECONDS
]
=
ctrl
->
tstamp
.
secs
;
v
[
FT_ATTR_TDC_COARSE
]
=
ctrl
->
tstamp
.
ticks
;
v
[
FT_ATTR_TDC_FRAC
]
=
ctrl
->
tstamp
.
bins
;
return
0
;
return
0
;
}
}
...
@@ -263,6 +264,7 @@ static void ft_readout_tasklet(unsigned long arg)
...
@@ -263,6 +264,7 @@ static void ft_readout_tasklet(unsigned long arg)
uint32_t
rd_ptr
;
uint32_t
rd_ptr
;
int
count
,
dacapo
,
i
;
int
count
,
dacapo
,
i
;
pr_info
(
"%s:%d
\n
"
,
__func__
,
__LINE__
);
ft
->
prev_wr_ptr
=
ft
->
cur_wr_ptr
;
ft
->
prev_wr_ptr
=
ft
->
cur_wr_ptr
;
ft
->
cur_wr_ptr
=
ft_readl
(
ft
,
TDC_REG_BUFFER_PTR
);
ft
->
cur_wr_ptr
=
ft_readl
(
ft
,
TDC_REG_BUFFER_PTR
);
...
...
kernel/ft-zio.c
View file @
ad82c9e8
...
@@ -32,28 +32,28 @@
...
@@ -32,28 +32,28 @@
/* The sample size. Mandatory, device-wide */
/* The sample size. Mandatory, device-wide */
ZIO_ATTR_DEFINE_STD
(
ZIO_DEV
,
ft_zattr_dev_std
)
=
{
ZIO_ATTR_DEFINE_STD
(
ZIO_DEV
,
ft_zattr_dev_std
)
=
{
ZIO_ATTR
(
zdev
,
ZIO_ATTR_NBITS
,
S_IRUGO
,
0
,
32
),
/* 32 bits. Really? */
ZIO_ATTR
(
zdev
,
ZIO_ATTR_NBITS
,
ZIO_RO_PERM
,
0
,
32
),
/* 32 bits. Really? */
ZIO_SET_ATTR_VERSION
(
ZIO_HEX_VERSION
(
FT_VERSION_MAJ
,
FT_VERSION_MIN
,
0
)),
};
};
/* Extended attributes for the device */
/* Extended attributes for the device */
static
struct
zio_attribute
ft_zattr_dev
[]
=
{
static
struct
zio_attribute
ft_zattr_dev
[]
=
{
ZIO_ATTR_EXT
(
"
version"
,
S_IRUGO
,
FT_ATTR_DEV_VERSION
,
FT_VERSION
),
ZIO_ATTR_EXT
(
"
seconds"
,
ZIO_RW_PERM
,
FT_ATTR_DEV_SECONDS
,
0
),
ZIO_ATTR_EXT
(
"
seconds"
,
_RW_
,
FT_ATTR_DEV_SECONDS
,
0
),
ZIO_ATTR_EXT
(
"
coarse"
,
ZIO_RW_PERM
,
FT_ATTR_DEV_COARSE
,
0
),
ZIO_ATTR_EXT
(
"co
arse"
,
_RW_
,
FT_ATTR_DEV_COARSE
,
0
),
ZIO_ATTR_EXT
(
"co
mmand"
,
ZIO_WO_PERM
,
FT_ATTR_DEV_COMMAND
,
0
),
ZIO_ATTR_EXT
(
"
command"
,
S_IWUGO
,
FT_ATTR_DEV_COMMAND
,
0
),
ZIO_ATTR_EXT
(
"
enable_inputs"
,
ZIO_RW_PERM
,
FT_ATTR_DEV_ENABLE_INPUTS
,
0
),
ZIO_ATTR_EXT
(
"
enable_inputs"
,
_RW_
,
FT_ATTR_DEV_ENABLE_INPUTS
,
0
),
ZIO_ATTR_EXT
(
"
sequence"
,
ZIO_RW_PERM
,
FT_ATTR_DEV_SEQUENCE
,
0
),
ZIO_PARAM_EXT
(
"temperature"
,
S_IRUGO
,
FT_ATTR_DEV_TEMP
,
0
)
ZIO_PARAM_EXT
(
"temperature"
,
ZIO_RO_PERM
,
FT_ATTR_DEV_TEMP
,
0
)
};
};
/* Extended attributes for the TDC (== input) cset */
/* Extended attributes for the TDC (== input) cset */
static
struct
zio_attribute
ft_zattr_input
[]
=
{
static
struct
zio_attribute
ft_zattr_input
[]
=
{
ZIO_ATTR_EXT
(
"seconds"
,
S_IRUGO
,
FT_ATTR_TDC_SECONDS
,
0
),
ZIO_ATTR_EXT
(
"seconds"
,
ZIO_RO_PERM
,
FT_ATTR_TDC_SECONDS
,
0
),
ZIO_ATTR_EXT
(
"coarse"
,
S_IRUGO
,
FT_ATTR_TDC_COARSE
,
0
),
ZIO_ATTR_EXT
(
"coarse"
,
ZIO_RO_PERM
,
FT_ATTR_TDC_COARSE
,
0
),
ZIO_ATTR_EXT
(
"frac"
,
S_IRUGO
,
FT_ATTR_TDC_FRAC
,
0
),
ZIO_ATTR_EXT
(
"frac"
,
ZIO_RO_PERM
,
FT_ATTR_TDC_FRAC
,
0
),
ZIO_ATTR_EXT
(
"seq_id"
,
S_IRUGO
,
FT_ATTR_TDC_SEQ
,
0
),
ZIO_ATTR_EXT
(
"termination"
,
ZIO_RW_PERM
,
FT_ATTR_TDC_TERMINATION
,
0
),
ZIO_ATTR_EXT
(
"termination"
,
_RW_
,
FT_ATTR_TDC_TERMINATION
,
0
),
ZIO_ATTR_EXT
(
"offset"
,
ZIO_RO_PERM
,
FT_ATTR_TDC_OFFSET
,
0
),
ZIO_ATTR_EXT
(
"offset"
,
S_IRUGO
,
FT_ATTR_TDC_OFFSET
,
0
),
ZIO_ATTR_EXT
(
"user-offset"
,
ZIO_RW_PERM
,
FT_ATTR_TDC_USER_OFFSET
,
0
),
ZIO_ATTR_EXT
(
"user-offset"
,
_RW_
,
FT_ATTR_TDC_USER_OFFSET
,
0
),
};
};
/* This identifies if our "struct device" is device, input, output */
/* This identifies if our "struct device" is device, input, output */
...
@@ -121,13 +121,13 @@ static int ft_zio_info_get(struct device *dev, struct zio_attribute *zattr,
...
@@ -121,13 +121,13 @@ static int ft_zio_info_get(struct device *dev, struct zio_attribute *zattr,
ft
=
zdev
->
priv_d
;
ft
=
zdev
->
priv_d
;
switch
(
zattr
->
id
)
{
switch
(
zattr
->
id
)
{
case
FT_ATTR_DEV_
VERSION
:
case
FT_ATTR_DEV_
SEQUENCE
:
return
0
;
*
usr_val
=
ft
->
sequence
;
break
;
case
FT_ATTR_DEV_TEMP
:
case
FT_ATTR_DEV_TEMP
:
ft_read_temp
(
ft
,
ft
->
verbose
);
ft_read_temp
(
ft
,
ft
->
verbose
);
*
usr_val
=
ft
->
temp
;
*
usr_val
=
ft
->
temp
;
return
0
;
break
;
case
FT_ATTR_DEV_COARSE
:
case
FT_ATTR_DEV_COARSE
:
case
FT_ATTR_DEV_SECONDS
:
case
FT_ATTR_DEV_SECONDS
:
{
{
...
@@ -143,15 +143,15 @@ static int ft_zio_info_get(struct device *dev, struct zio_attribute *zattr,
...
@@ -143,15 +143,15 @@ static int ft_zio_info_get(struct device *dev, struct zio_attribute *zattr,
*
usr_val
=
*
usr_val
=
(
zattr
->
id
==
(
zattr
->
id
==
FT_ATTR_DEV_COARSE
?
coarse
:
(
uint32_t
)
seconds
);
FT_ATTR_DEV_COARSE
?
coarse
:
(
uint32_t
)
seconds
);
return
0
;
break
;
}
}
case
FT_ATTR_DEV_ENABLE_INPUTS
:
case
FT_ATTR_DEV_ENABLE_INPUTS
:
attr
[
FT_ATTR_DEV_ENABLE_INPUTS
].
value
=
attr
[
FT_ATTR_DEV_ENABLE_INPUTS
].
value
=
ft
->
acquisition_on
?
1
:
0
;
ft
->
acquisition_on
?
1
:
0
;
*
usr_val
=
ft
->
acquisition_on
?
1
:
0
;
*
usr_val
=
ft
->
acquisition_on
?
1
:
0
;
return
0
;
break
;
}
}
return
-
EINVAL
;
return
0
;
}
}
static
int
ft_zio_conf_channel
(
struct
device
*
dev
,
struct
zio_attribute
*
zattr
,
static
int
ft_zio_conf_channel
(
struct
device
*
dev
,
struct
zio_attribute
*
zattr
,
...
...
lib/fmctdc-lib.c
View file @
ad82c9e8
...
@@ -98,9 +98,9 @@ int fmctdc_init(void)
...
@@ -98,9 +98,9 @@ int fmctdc_init(void)
if
(
fmctdc_sysfs_get
(
ft_boards
,
"version"
,
&
v
)
<
0
)
if
(
fmctdc_sysfs_get
(
ft_boards
,
"version"
,
&
v
)
<
0
)
return
-
1
;
return
-
1
;
if
(
v
!=
FT_VERSION
)
{
if
(
v
!=
FT_VERSION
_MAJ
)
{
fprintf
(
stderr
,
"%s: version mismatch, lib(%i) != drv(%i)
\n
"
,
fprintf
(
stderr
,
"%s: version mismatch, lib(%i) != drv(%i)
\n
"
,
__func__
,
FT_VERSION
,
v
);
__func__
,
FT_VERSION
_MAJ
,
v
);
errno
=
EIO
;
errno
=
EIO
;
return
-
1
;
return
-
1
;
}
}
...
@@ -402,10 +402,11 @@ int fmctdc_read(struct fmctdc_board *userb, int channel, struct fmctdc_time *t,
...
@@ -402,10 +402,11 @@ int fmctdc_read(struct fmctdc_board *userb, int channel, struct fmctdc_time *t,
if
(
j
==
sizeof
(
ctrl
))
{
if
(
j
==
sizeof
(
ctrl
))
{
/* one sample: pick it */
/* one sample: pick it */
attrs
=
ctrl
.
attr_channel
.
ext_val
;
attrs
=
ctrl
.
attr_channel
.
ext_val
;
t
->
seconds
=
attrs
[
FT_ATTR_TDC_SECONDS
];
t
->
seconds
=
ctrl
.
tstamp
.
secs
;
t
->
coarse
=
attrs
[
FT_ATTR_TDC_COARSE
];
t
->
coarse
=
ctrl
.
tstamp
.
ticks
;
t
->
frac
=
attrs
[
FT_ATTR_TDC_FRAC
];
t
->
frac
=
ctrl
.
tstamp
.
bins
;
t
->
seq_id
=
attrs
[
FT_ATTR_TDC_SEQ
];
t
->
seq_id
=
ctrl
.
seq_num
;
t
->
gseq_id
=
attrs
[
FT_ATTR_DEV_SEQUENCE
];
i
++
;
i
++
;
continue
;
continue
;
}
}
...
...
lib/fmctdc-lib.h
View file @
ad82c9e8
...
@@ -37,8 +37,9 @@ struct fmctdc_board;
...
@@ -37,8 +37,9 @@ struct fmctdc_board;
struct
fmctdc_time
{
struct
fmctdc_time
{
uint64_t
seconds
;
/**< number of seconds */
uint64_t
seconds
;
/**< number of seconds */
uint32_t
coarse
;
/**< number of ticks of 8ns */
uint32_t
coarse
;
/**< number of ticks of 8ns */
Uint32_t
frac
;
/**< number of frac of 81.03ps */
uint32_t
frac
;
/**< number of frac of 81.03ps */
uint32_t
seq_id
;
uint32_t
seq_id
;
/**< channel sequence number*/
uint32_t
gseq_id
;
/**< board sequence number */
};
};
...
...
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