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
90108de7
Commit
90108de7
authored
Apr 10, 2014
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/fdelay-output.c: fix reverse-application of the offsets when reading output config
parent
26d4fe14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
22 deletions
+27
-22
fdelay-output.c
lib/fdelay-output.c
+27
-22
No files found.
lib/fdelay-output.c
View file @
90108de7
...
...
@@ -77,7 +77,7 @@ int fdelay_config_pulse(struct fdelay_board *userb,
return
-
1
;
/* errno already set */
a
=
ctrl
.
attr_channel
.
ext_val
;
a
[
FD_ATTR_OUT_MODE
]
=
pulse
->
mode
;
a
[
FD_ATTR_OUT_MODE
]
=
pulse
->
mode
&
0x7f
;
a
[
FD_ATTR_OUT_REP
]
=
pulse
->
rep
;
a
[
FD_ATTR_OUT_START_H
]
=
pulse
->
start
.
utc
>>
32
;
...
...
@@ -174,6 +174,7 @@ int fdelay_get_config_pulse(struct fdelay_board *userb,
__define_board
(
b
,
userb
);
char
s
[
32
];
uint32_t
utc_h
,
utc_l
,
tmp
;
uint32_t
input_offset
,
output_offset
,
output_user_offset
;
sprintf
(
s
,
"fd-ch%i/%s"
,
channel
+
1
,
"mode"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
tmp
)
<
0
)
...
...
@@ -228,26 +229,37 @@ int fdelay_get_config_pulse(struct fdelay_board *userb,
* un-apply all offsets that the driver added
*/
sprintf
(
s
,
"fd-ch%i/%s"
,
channel
+
1
,
"delay-offset"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
tmp
)
<
0
)
if
(
fdelay_sysfs_get
(
b
,
s
,
&
output_offset
)
<
0
)
return
-
1
;
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
tmp
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
tmp
);
sprintf
(
s
,
"fd-ch%i/%s"
,
channel
+
1
,
"user-offset"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
tmp
)
<
0
)
if
(
fdelay_sysfs_get
(
b
,
s
,
&
output_user_offset
)
<
0
)
return
-
1
;
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
tmp
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
tmp
);
if
((
pulse
->
mode
&
0x7f
)
==
FD_OUT_MODE_DELAY
)
{
/* Delay used the input offset too: undo it */
sprintf
(
s
,
"fd-input/%s"
,
"offset"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
tmp
)
<
0
)
return
-
1
;
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
tmp
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
tmp
);
}
sprintf
(
s
,
"fd-input/%s"
,
"offset"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
input_offset
)
<
0
)
return
-
1
;
int
m
=
pulse
->
mode
&
0x7f
;
switch
(
m
)
{
case
FD_OUT_MODE_DISABLED
:
/* hack for Steen/COHAL: if channel is disabled, apply delay-mode offsets */
case
FD_OUT_MODE_DELAY
:
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
output_offset
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
output_offset
);
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
output_user_offset
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
output_user_offset
);
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
input_offset
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
input_offset
);
break
;
case
FD_OUT_MODE_PULSE
:
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
output_offset
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
output_offset
);
fdelay_add_signed_ps
(
&
pulse
->
start
,
-
(
signed
)
output_user_offset
);
fdelay_add_signed_ps
(
&
pulse
->
end
,
-
(
signed
)
output_user_offset
);
break
;
}
return
0
;
}
...
...
@@ -279,13 +291,6 @@ int fdelay_get_config_pulse_ps(struct fdelay_board *userb,
fdelay_subtract_ps
(
&
pulse
.
end
,
&
pulse
.
start
,
(
int64_t
*
)
&
ps
->
length
);
fdelay_time_to_pico
(
&
pulse
.
loop
,
&
ps
->
period
);
sprintf
(
s
,
"fd-ch%i/%s"
,
channel
+
1
,
"delay-offset"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
delay_offset
)
<
0
)
return
-
1
;
if
(
fdelay_sysfs_get
(
b
,
"fd-input/offset"
,
&
offset
)
<
0
)
return
-
1
;
ps
->
length
-=
delay_offset
+
offset
;
return
0
;
}
int
fdelay_has_triggered
(
struct
fdelay_board
*
userb
,
int
channel
)
...
...
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