Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr2rf-vme
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
wr2rf-vme
Commits
4aaa6c69
Commit
4aaa6c69
authored
Sep 12, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wr2rf.c: decode nco-reset-ctrl values
parent
ff7b8a9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
44 deletions
+55
-44
wr2rf.c
software/libwr2rf/wr2rf.c
+55
-44
No files found.
software/libwr2rf/wr2rf.c
View file @
4aaa6c69
...
...
@@ -583,53 +583,64 @@ nco_reset_ctrl (struct libwr2rf_dev *dev, int argc, char **argv)
if
(
argc
!=
1
&&
argc
!=
3
)
goto
usage
;
if
(
argc
==
1
)
{
printf
(
"nco_reset_ctrl=%02x
\n
"
,
libwr2rf_read16
(
dev
,
addr
));
return
;
if
(
argc
==
3
)
{
if
(
strcmp
(
argv
[
2
],
"on"
)
==
0
)
set
=
1
;
else
if
(
strcmp
(
argv
[
2
],
"off"
)
==
0
)
set
=
0
;
else
goto
usage
;
if
(
strcmp
(
argv
[
1
],
"dds_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_DDS
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_DDS
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf1nco_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH1
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf2nco_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH2
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH2
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf1_t1_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF1_TRIG1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF1_TRIG1
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf2_t1_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF2_TRIG1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF2_TRIG1
;
}
else
if
(
strcmp
(
argv
[
1
],
"soft_nco_reset"
)
==
0
)
{
if
(
set
==
1
)
// autoclr register
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_SOFT
;
}
else
{
printf
(
"Unexpected input:
\n
"
);
goto
usage
;
}
libwr2rf_write16
(
dev
,
addr
,
v
);
}
if
(
strcmp
(
argv
[
2
],
"on"
)
==
0
)
set
=
1
;
else
if
(
strcmp
(
argv
[
2
],
"off"
)
==
0
)
set
=
0
;
else
goto
usage
;
if
(
strcmp
(
argv
[
1
],
"dds_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_DDS
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_DDS
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf1nco_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH1
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf2nco_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH2
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH2
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf1_t1_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF1_TRIG1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF1_TRIG1
;
}
else
if
(
strcmp
(
argv
[
1
],
"rf2_t1_mask"
)
==
0
)
{
if
(
set
==
1
)
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF2_TRIG1
;
else
v
=
v
&
~
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF2_TRIG1
;
}
else
if
(
strcmp
(
argv
[
1
],
"soft_nco_reset"
)
==
0
)
{
if
(
set
==
1
)
// autoclr register
v
=
v
|
WR2RF_CTRL_REGS_NCO_RESET_CTRL_SOFT
;
}
else
{
printf
(
"Unexpected input:
\n
"
);
goto
usage
;
}
v
=
libwr2rf_read16
(
dev
,
addr
);
libwr2rf_write16
(
dev
,
addr
,
v
);
printf
(
"nco_reset_ctrl=%02x
\n
"
,
libwr2rf_read16
(
dev
,
addr
));
printf
(
"nco_reset_ctrl=%02x"
,
v
);
if
(
v
&
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_DDS
)
printf
(
" dds_mask"
);
if
(
v
&
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH1
)
printf
(
" rf1nco_mask"
);
if
(
v
&
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RFNCO_CH2
)
printf
(
" rf2nco_mask"
);
if
(
v
&
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF1_TRIG1
)
printf
(
" rf1_t1_mask"
);
if
(
v
&
WR2RF_CTRL_REGS_NCO_RESET_CTRL_MASK_RF2_TRIG1
)
printf
(
" rf2_t1_mask"
);
printf
(
"
\n
"
);
return
;
usage:
...
...
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