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
d4a5c939
Commit
d4a5c939
authored
Oct 09, 2020
by
Jorge Machado
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group leap second values in a struct
parent
2dba3f53
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
27 deletions
+23
-27
fmc-dio-internal.c
sw/kernel/fmc-dio-internal.c
+11
-20
fmc-dio.h
sw/kernel/fmc-dio.h
+9
-5
wr-dio-cmd.c
sw/tools/wr-dio-cmd.c
+3
-2
No files found.
sw/kernel/fmc-dio-internal.c
View file @
d4a5c939
...
...
@@ -55,10 +55,7 @@
#define FMC_DIO_BUFFER_LEN 512
struct
dio_channel
{
struct
timespec
tsbuf
[
FMC_DIO_BUFFER_LEN
];
uint16_t
leap_second
[
FMC_DIO_BUFFER_LEN
];
uint8_t
leap_second_valid
[
FMC_DIO_BUFFER_LEN
];
uint8_t
flag59
[
FMC_DIO_BUFFER_LEN
];
uint8_t
flag61
[
FMC_DIO_BUFFER_LEN
];
struct
wr_timestamp_info
wr_ts_info_buf
[
FMC_DIO_BUFFER_LEN
];
int
bhead
,
btail
;
wait_queue_head_t
q
;
...
...
@@ -250,10 +247,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
;
uint16_t
*
leap_second
=
cmd
->
leap_second
;
uint8_t
*
leap_second_valid
=
cmd
->
leap_second_valid
;
uint8_t
*
flag59
=
cmd
->
flag59
;
uint8_t
*
flag61
=
cmd
->
flag61
;
struct
wr_timestamp_info
*
ts_info
=
cmd
->
wr_ts_info_buf
;
struct
regmap
*
map
;
int
mask
,
ch
,
last
;
int
nstamp
=
0
;
...
...
@@ -290,17 +284,11 @@ again:
if
(
c
->
bhead
==
c
->
btail
)
break
;
*
ts
=
c
->
tsbuf
[
c
->
btail
];
*
leap_second
=
c
->
leap_second
[
c
->
btail
];
*
leap_second_valid
=
c
->
leap_second_valid
[
c
->
btail
];
*
flag59
=
c
->
flag59
[
c
->
btail
];
*
flag61
=
c
->
flag61
[
c
->
btail
];
*
ts_info
=
c
->
wr_ts_info_buf
[
c
->
btail
];
c
->
btail
=
(
c
->
btail
+
1
)
%
FMC_DIO_BUFFER_LEN
;
nstamp
++
;
ts
++
;
leap_second
++
;
leap_second_valid
++
;
flag59
++
;
flag61
++
;
ts_info
++
;
}
if
(
nstamp
)
{
cmd
->
channel
=
ch
;
...
...
@@ -604,6 +592,7 @@ irqreturn_t fmc_dio_int_interrupt(struct fmc_dio *dev)
static
int
rate_avg
;
struct
dio_channel
*
c
;
struct
timespec
*
ts
;
struct
wr_timestamp_info
*
ts_info
;
struct
regmap
*
map
;
uint32_t
mask
,
reg
;
int
ch
,
chm
;
...
...
@@ -659,12 +648,14 @@ irqreturn_t fmc_dio_int_interrupt(struct fmc_dio *dev)
map
+=
ch
;
ts
=
NULL
;
ts_info
=
NULL
;
while
(
1
)
{
reg
=
readl
(
base
+
map
->
fifo_status
);
if
(
reg
&
0x20000
)
/* empty */
break
;
h
=
c
->
bhead
;
ts
=
c
->
tsbuf
+
h
;
ts_info
=
c
->
wr_ts_info_buf
+
h
;
c
->
bhead
=
(
h
+
1
)
%
FMC_DIO_BUFFER_LEN
;
if
(
c
->
bhead
==
c
->
btail
)
c
->
btail
=
(
c
->
btail
+
1
)
%
FMC_DIO_BUFFER_LEN
;
...
...
@@ -678,10 +669,10 @@ irqreturn_t fmc_dio_int_interrupt(struct fmc_dio *dev)
ts
->
tv_nsec
=
8
*
readl
(
base
+
map
->
fifo_cycle
);
uint32_t
leap_second_reg
=
readl
(
base
+
map
->
fifo_leap_second
);
c
->
leap_second
[
h
]
=
leap_second_reg
&
DIO_TSF_R3_LEAP_SECOND_VALUE_MASK
;
c
->
leap_second_valid
[
h
]
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_VALID_SHIFT
)
&
1
;
c
->
flag59
[
h
]
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_FLAG_59_SHIFT
)
&
1
;
c
->
flag61
[
h
]
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_FLAG_61_SHIFT
)
&
1
;
ts_info
->
leap_second
=
leap_second_reg
&
DIO_TSF_R3_LEAP_SECOND_VALUE_MASK
;
ts_info
->
leap_second_valid
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_VALID_SHIFT
)
&
1
;
ts_info
->
flag59
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_FLAG_59_SHIFT
)
&
1
;
ts_info
->
flag61
=
(
leap_second_reg
>>
DIO_TSF_R3_LEAP_SECOND_FLAG_61_SHIFT
)
&
1
;
/* subtract 4 cycles lost in input sync circuits */
fmc_dio_int_ts_sub
(
ts
,
32
);
}
...
...
sw/kernel/fmc-dio.h
View file @
d4a5c939
...
...
@@ -147,17 +147,21 @@ enum wr_dio_cmd_name {
#define WR_DIO_N_STAMP 16
/* At least 5 * 3 */
struct
wr_timestamp_info
{
uint16_t
leap_second
;
int
leap_second_valid
;
int
flag59
;
int
flag61
;
};
struct
wr_dio_cmd
{
uint16_t
command
;
/* from user */
uint16_t
channel
;
/* 0..4 or mask from user */
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
];
/* may be from user */
uint16_t
leap_second
[
WR_DIO_N_STAMP
];
uint8_t
leap_second_valid
[
WR_DIO_N_STAMP
];
uint8_t
flag59
[
WR_DIO_N_STAMP
];
uint8_t
flag61
[
WR_DIO_N_STAMP
];
struct
timespec
t
[
WR_DIO_N_STAMP
];
struct
wr_timestamp_info
wr_ts_info_buf
[
WR_DIO_N_STAMP
];
};
#define WR_DIO_F_NOW 0x01
/* Output is now, t[0] ignored */
...
...
sw/tools/wr-dio-cmd.c
View file @
d4a5c939
...
...
@@ -247,8 +247,9 @@ static int scan_stamp(int argc, char **argv, int ismask)
return
-
1
;
}
for
(
i
=
0
;
i
<
cmd
->
nstamp
;
i
++
)
printf
(
"ch %i, %9li.%09li, leap second 0x%04X, leap second valid %02x, flag59 %01x, flag61 %01x
\n
"
,
cmd
->
channel
,
(
long
)
cmd
->
t
[
i
].
tv_sec
,
cmd
->
t
[
i
].
tv_nsec
,
cmd
->
leap_second
[
i
],
cmd
->
leap_second_valid
[
i
],
cmd
->
flag59
[
i
],
cmd
->
flag61
[
i
]);
printf
(
"ch %i, %9li.%09li, leap second 0x%04X, leap second valid %01x, flag59 %01x, flag61 %01x
\n
"
,
cmd
->
channel
,
(
long
)
cmd
->
t
[
i
].
tv_sec
,
cmd
->
t
[
i
].
tv_nsec
,
cmd
->
wr_ts_info_buf
[
i
].
leap_second
,
cmd
->
wr_ts_info_buf
[
i
].
leap_second_valid
,
cmd
->
wr_ts_info_buf
[
i
].
flag59
,
cmd
->
wr_ts_info_buf
[
i
].
flag61
);
}
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