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
0dfe5620
Commit
0dfe5620
authored
Jun 13, 2022
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to timespec64 for kernel 5.15
parent
6cb4c9ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
23 deletions
+25
-23
fmc-dio-internal.c
sw/kernel/fmc-dio-internal.c
+16
-15
fmc-dio.h
sw/kernel/fmc-dio.h
+3
-2
wr-dio-cmd.c
sw/tools/wr-dio-cmd.c
+1
-1
wr-dio-ruler.c
sw/tools/wr-dio-ruler.c
+5
-5
No files found.
sw/kernel/fmc-dio-internal.c
View file @
0dfe5620
...
...
@@ -55,13 +55,14 @@
/* This is the structure we need to manage interrupts and loop internally */
#define FMC_DIO_BUFFER_LEN 512
struct
dio_channel
{
struct
timespec
tsbuf
[
FMC_DIO_BUFFER_LEN
];
struct
timespec
64
tsbuf
[
FMC_DIO_BUFFER_LEN
];
struct
wr_timestamp_info
wr_ts_info_buf
[
FMC_DIO_BUFFER_LEN
];
int
bhead
,
btail
;
wait_queue_head_t
q
;
/* The input event may fire a new pulse on this or another channel */
struct
timespec
prevts
,
delay
;
struct
timespec
64
prevts
,
delay
;
atomic_t
count
;
int
target_channel
;
};
...
...
@@ -71,14 +72,14 @@ struct dio_device {
};
/* Instead of timespec_sub, just subtract the nanos */
static
inline
void
fmc_dio_int_ts_sub
(
struct
timespec
*
ts
,
int
nano
)
static
inline
void
fmc_dio_int_ts_sub
(
struct
timespec
64
*
ts
,
int
nano
)
{
set_normalized_timespec
(
ts
,
ts
->
tv_sec
,
ts
->
tv_nsec
-
nano
);
set_normalized_timespec
64
(
ts
,
ts
->
tv_sec
,
ts
->
tv_nsec
-
nano
);
}
/* This programs a new pulse without changing the width */
static
void
__fmc_dio_int_new_pulse
(
struct
fmc_dio
*
dev
,
int
ch
,
struct
timespec
*
ts
)
struct
timespec
64
*
ts
)
{
void
__iomem
*
base
=
dev
->
dio
;
struct
regmap
*
map
;
...
...
@@ -105,7 +106,7 @@ static int fmc_dio_int_cmd_pulse(struct fmc_dio *dev,
struct
dio_device
*
d
=
dev
->
priv
;
struct
dio_channel
*
c
;
struct
regmap
*
map
;
struct
timespec
*
ts
;
struct
timespec
64
*
ts
;
uint32_t
reg
;
int
ch
;
struct
regmap_common
dio
;
...
...
@@ -209,7 +210,7 @@ static int fmc_dio_int_cmd_update_width(struct fmc_dio *dev,
struct
dio_device
*
d
=
dev
->
priv
;
struct
dio_channel
*
c
;
struct
regmap
*
map
;
struct
timespec
*
ts
;
struct
timespec
64
*
ts
;
int
ch
;
struct
regmap_common
dio
;
uint32_t
period
;
...
...
@@ -247,7 +248,7 @@ static int fmc_dio_int_cmd_stamp(struct fmc_dio *dev,
{
struct
dio_device
*
d
=
dev
->
priv
;
struct
dio_channel
*
c
=
0
;
struct
timespec
*
ts
=
cmd
->
t
;
struct
timespec
64
*
ts
=
cmd
->
t
;
struct
wr_timestamp_info
*
ts_info
=
cmd
->
wr_ts_info_buf
;
struct
regmap
*
map
;
int
mask
,
ch
,
last
;
...
...
@@ -304,7 +305,7 @@ again:
ch
--
;
c
--
;
/* The for above incremeted them */
try_module_get
(
THIS_MODULE
);
if
(
cmd
->
wait_mode_flags
&
WR_DIO_F_WAIT_MODE_TIMEOUT
)
{
unsigned
long
tmo
=
timespec_to_jiffies
(
&
(
cmd
->
wait_mode_timeout
));
unsigned
long
tmo
=
timespec
64
_to_jiffies
(
&
(
cmd
->
wait_mode_timeout
));
ret_wait
=
wait_event_interruptible_timeout
(
c
->
q
,
c
->
bhead
!=
c
->
btail
,
tmo
);
if
(
!
ret_wait
)
ret_wait
=
-
ETIMEDOUT
;
...
...
@@ -427,7 +428,7 @@ static int fmc_dio_int_cmd_irq(struct fmc_dio *dev,
struct
dio_device
*
d
=
dev
->
priv
;
struct
dio_channel
*
c
;
struct
regmap
*
map
;
struct
timespec
*
ts
;
struct
timespec
64
*
ts
;
uint32_t
reg
;
int
ch
;
struct
regmap_common
dio
;
...
...
@@ -580,15 +581,15 @@ out:
/* This is called from the interrupt handler to program a new pulse */
static
void
fmc_dio_int_trig_next_pulse
(
struct
fmc_dio
*
dev
,
int
ch
,
struct
dio_channel
*
c
,
struct
timespec
*
ts
)
struct
dio_channel
*
c
,
struct
timespec
64
*
ts
)
{
struct
timespec
newts
;
struct
timespec
64
newts
;
if
(
c
->
target_channel
==
ch
)
{
c
->
prevts
=
timespec_add
(
c
->
prevts
,
c
->
delay
);
c
->
prevts
=
timespec
64
_add
(
c
->
prevts
,
c
->
delay
);
newts
=
c
->
prevts
;
}
else
{
newts
=
timespec_add
(
*
ts
,
c
->
delay
);
newts
=
timespec
64
_add
(
*
ts
,
c
->
delay
);
}
__fmc_dio_int_new_pulse
(
dev
,
c
->
target_channel
,
&
newts
);
...
...
@@ -605,7 +606,7 @@ irqreturn_t fmc_dio_int_interrupt(struct fmc_dio *dev)
static
ktime_t
t_ini
,
t_end
;
static
int
rate_avg
;
struct
dio_channel
*
c
;
struct
timespec
*
ts
;
struct
timespec
64
*
ts
;
struct
wr_timestamp_info
*
ts_info
;
struct
regmap
*
map
;
uint32_t
mask
,
reg
;
...
...
sw/kernel/fmc-dio.h
View file @
0dfe5620
...
...
@@ -16,6 +16,7 @@
#include <linux/fmc.h>
//FIXME: Back hack to maintain the IOCTL command numbers
#include <linux/sockios.h>
#include <linux/time64.h>
#include "hw/wr-dio-regs.h"
#include "hw/ppsg-regs.h"
...
...
@@ -160,10 +161,10 @@ struct wr_dio_cmd {
uint32_t
value
;
/* for DAC or I/O */
uint32_t
flags
;
uint32_t
nstamp
;
/* from kernel, if IN_STAMP */
struct
timespec
t
[
WR_DIO_N_STAMP
];
struct
timespec
64
t
[
WR_DIO_N_STAMP
];
struct
wr_timestamp_info
wr_ts_info_buf
[
WR_DIO_N_STAMP
];
uint32_t
wait_mode_flags
;
struct
timespec
wait_mode_timeout
;
struct
timespec
64
wait_mode_timeout
;
};
#define WR_DIO_F_NOW 0x01
/* Output is now, t[0] ignored */
...
...
sw/tools/wr-dio-cmd.c
View file @
0dfe5620
...
...
@@ -34,7 +34,7 @@ void *last_cmd;
struct
wr_dio_cmd
_cmd
;
struct
wr_dio_cmd
*
cmd
=
&
_cmd
;
static
int
parse_ts
(
char
*
s
,
struct
timespec
*
ts
)
static
int
parse_ts
(
char
*
s
,
struct
timespec
64
*
ts
)
{
int
i
,
n
;
unsigned
long
nano
;
...
...
sw/tools/wr-dio-ruler.c
View file @
0dfe5620
...
...
@@ -49,11 +49,11 @@ unsigned char ruler_macaddr[ETH_ALEN];
struct
ruler_action
{
int
isremote
;
int
channel
;
struct
timespec
delay
;
struct
timespec
64
delay
;
};
/* Boring parsing separated to a separate function (same code as elsewhere) */
static
int
parse_ts
(
char
*
s
,
struct
timespec
*
ts
)
static
int
parse_ts
(
char
*
s
,
struct
timespec
64
*
ts
)
{
int
i
,
n
;
unsigned
long
nano
;
...
...
@@ -238,7 +238,7 @@ static struct ruler_action *ruler_build_actions(int nact, char **strings)
}
/* The main loop will wait for an event... */
static
int
ruler_wait_event
(
int
inch
,
struct
timespec
*
ts
)
static
int
ruler_wait_event
(
int
inch
,
struct
timespec
64
*
ts
)
{
ruler_cmd
.
command
=
WR_DIO_CMD_STAMP
;
ruler_cmd
.
flags
=
WR_DIO_F_WAIT
;
...
...
@@ -255,7 +255,7 @@ static int ruler_wait_event(int inch, struct timespec *ts)
}
/* ...and run all actions when the event happens */
static
int
ruler_run_actions
(
int
nact
,
struct
timespec
*
ts
,
static
int
ruler_run_actions
(
int
nact
,
struct
timespec
64
*
ts
,
struct
ruler_action
*
actions
)
{
int
i
;
...
...
@@ -315,7 +315,7 @@ static void print_version(char *pname)
int
main
(
int
argc
,
char
**
argv
)
{
struct
ruler_action
*
actions
;
struct
timespec
ts
;
struct
timespec
64
ts
;
int
inch
;
if
((
argc
==
2
)
&&
(
!
strcmp
(
argv
[
1
],
"-V"
)))
{
...
...
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