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
c6dfd06e
Commit
c6dfd06e
authored
Jan 22, 2021
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wr2rf vtu: print decoded mode
parent
9224773d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
21 deletions
+45
-21
wr2rf.c
software/libwr2rf/wr2rf.c
+45
-21
No files found.
software/libwr2rf/wr2rf.c
View file @
c6dfd06e
...
...
@@ -1838,6 +1838,34 @@ parse_vtu (const char *arg,
return
addr
;
}
struct
vtu_mode_xtab
{
unsigned
val
;
const
char
*
name
;
};
static
const
struct
vtu_mode_xtab
vtu_modes
[]
=
{
{
0x00
,
"pulse"
},
{
0x01
,
"infinite"
},
{
0x02
,
"window"
},
{
0x03
,
"syncless"
},
{
0x04
,
"lowfreq"
},
{
0x05
,
"play"
},
{
0x06
,
"highfreq"
},
{
0
,
NULL
}
};
static
const
char
*
get_vtu_mode
(
unsigned
val
)
{
const
struct
vtu_mode_xtab
*
e
;
for
(
e
=
vtu_modes
;
e
->
name
;
e
++
)
if
(
e
->
val
==
val
)
return
e
->
name
;
return
"ERROR"
;
}
static
void
vtu
(
struct
libwr2rf_dev
*
dev
,
int
argc
,
char
**
argv
)
{
...
...
@@ -1879,8 +1907,9 @@ vtu (struct libwr2rf_dev *dev, int argc, char **argv)
v
=
libwr2rf_read16
(
dev
,
addr
+
TRIGUNIT_REGS_CONFIGOFFLINE
);
printf
(
"configoffline: 0x%04x
\n
"
,
v
);
printf
(
" mode: 0x%04x
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGOFFLINE_MODE_MASK
));
printf
(
" mode: 0x%04x (%s)
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGOFFLINE_MODE_MASK
),
get_vtu_mode
((
v
&
TRIGUNIT_REGS_CONFIGOFFLINE_MODE_MASK
)
>>
TRIGUNIT_REGS_CONFIGOFFLINE_MODE_SHIFT
));
printf
(
" htswitchingenable: 0x%04x
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGOFFLINE_HTSWITCHINGENABLE
));
printf
(
" valid: 0x%04x
\n
"
,
...
...
@@ -1897,8 +1926,9 @@ vtu (struct libwr2rf_dev *dev, int argc, char **argv)
v
=
libwr2rf_read16
(
dev
,
addr
+
TRIGUNIT_REGS_CONFIGONLINE
);
printf
(
"configonline: 0x%04x
\n
"
,
v
);
printf
(
" mode: 0x%04x
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGONLINE_MODE_MASK
));
printf
(
" mode: 0x%04x (%s)
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGONLINE_MODE_MASK
),
get_vtu_mode
((
v
&
TRIGUNIT_REGS_CONFIGONLINE_MODE_MASK
)
>>
TRIGUNIT_REGS_CONFIGONLINE_MODE_SHIFT
));
printf
(
" htswitchingenable: 0x%04x
\n
"
,
(
unsigned
)(
v
&
TRIGUNIT_REGS_CONFIGONLINE_HTSWITCHINGENABLE
));
...
...
@@ -1944,26 +1974,20 @@ vtu (struct libwr2rf_dev *dev, int argc, char **argv)
libwr2rf_be_write64
(
dev
,
addr
+
TRIGUNIT_REGS_WVALUEOFFLINE
,
v
);
}
else
if
(
argc
==
4
&&
strcmp
(
argv
[
2
],
"mode"
)
==
0
)
{
const
struct
vtu_mode_xtab
*
e
;
unsigned
v
;
unsigned
mode
;
if
(
strcmp
(
argv
[
3
],
"pulse"
)
==
0
)
mode
=
0x00
;
else
if
(
strcmp
(
argv
[
3
],
"infinite"
)
==
0
)
mode
=
0x01
;
else
if
(
strcmp
(
argv
[
3
],
"window"
)
==
0
)
mode
=
0x02
;
else
if
(
strcmp
(
argv
[
3
],
"syncless"
)
==
0
)
mode
=
0x03
;
else
if
(
strcmp
(
argv
[
3
],
"lowfreq"
)
==
0
)
mode
=
0x04
;
else
if
(
strcmp
(
argv
[
3
],
"play"
)
==
0
)
mode
=
0x05
;
else
if
(
strcmp
(
argv
[
3
],
"highfreq"
)
==
0
)
mode
=
0x06
;
else
{
printf
(
"bad vtu mode, expect: "
"pulse, infinite, window, syncless, lowfreq, play, highfreq
\n
"
);
for
(
e
=
vtu_modes
;
e
->
name
;
e
++
)
if
(
strcmp
(
argv
[
3
],
e
->
name
)
==
0
)
{
mode
=
e
->
val
;
break
;
}
if
(
e
->
name
==
NULL
)
{
printf
(
"bad vtu mode, expect:"
);
for
(
e
=
vtu_modes
;
e
->
name
;
e
++
)
printf
(
" %s"
,
e
->
name
);
printf
(
"
\n
"
);
return
;
}
v
=
libwr2rf_read16
(
dev
,
addr
+
TRIGUNIT_REGS_CONFIGOFFLINE
);
...
...
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