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
a793d590
Commit
a793d590
authored
Apr 14, 2021
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wr2rf: improve vtu-watch command (show diff time)
parent
caf2bc67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
13 deletions
+52
-13
wr2rf.c
software/libwr2rf/wr2rf.c
+52
-13
No files found.
software/libwr2rf/wr2rf.c
View file @
a793d590
...
@@ -868,10 +868,13 @@ wrc_print_status (unsigned status)
...
@@ -868,10 +868,13 @@ wrc_print_status (unsigned status)
}
}
static
void
static
void
wrc_print_time
(
struct
libwr2rf_dev
*
dev
)
wrc_get_time
(
struct
libwr2rf_dev
*
dev
,
unsigned
*
tai_h
,
unsigned
*
tai_l
,
unsigned
*
cyc
)
{
{
unsigned
tai
[
3
];
unsigned
tai
[
3
];
unsigned
cyc
[
2
];
unsigned
t
cyc
[
2
];
do
{
do
{
tai
[
2
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
tai
[
2
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
...
@@ -883,16 +886,27 @@ wrc_print_time (struct libwr2rf_dev *dev)
...
@@ -883,16 +886,27 @@ wrc_print_time (struct libwr2rf_dev *dev)
}
while
(
tai
[
2
]
!=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
}
while
(
tai
[
2
]
!=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
+
WR2RF_INIT_REGS_WRC_TAI
+
6
));
+
WR2RF_INIT_REGS_WRC_TAI
+
6
));
do
{
do
{
cyc
[
0
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
t
cyc
[
0
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
+
WR2RF_INIT_REGS_WRC_CYCLES
+
0
);
+
WR2RF_INIT_REGS_WRC_CYCLES
+
0
);
cyc
[
1
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
t
cyc
[
1
]
=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
+
WR2RF_INIT_REGS_WRC_CYCLES
+
2
);
+
WR2RF_INIT_REGS_WRC_CYCLES
+
2
);
}
}
while
(
cyc
[
0
]
!=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
while
(
tcyc
[
0
]
!=
libwr2rf_read16
(
dev
,
WR2RF_VME_REGS_INIT
+
WR2RF_INIT_REGS_WRC_CYCLES
));
+
WR2RF_INIT_REGS_WRC_CYCLES
));
printf
(
"tai: %04x%04x%04x, cycles: %04x%04x"
,
*
tai_h
=
tai
[
0
];
tai
[
0
],
tai
[
1
],
tai
[
2
],
*
tai_l
=
(
tai
[
1
]
<<
16
)
|
tai
[
2
];
cyc
[
0
],
cyc
[
1
]);
*
cyc
=
(
tcyc
[
0
]
<<
16
)
|
tcyc
[
1
];
}
static
void
wrc_print_time
(
struct
libwr2rf_dev
*
dev
)
{
unsigned
tai_h
;
unsigned
tai_l
;
unsigned
cyc
;
wrc_get_time
(
dev
,
&
tai_h
,
&
tai_l
,
&
cyc
);
printf
(
"tai: %04x%08x, cycles: %08x"
,
tai_h
,
tai_l
,
cyc
);
}
}
static
void
static
void
...
@@ -2695,9 +2709,10 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
...
@@ -2695,9 +2709,10 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
static
const
char
*
const
state_names
[]
=
{
"idle "
,
static
const
char
*
const
state_names
[]
=
{
"idle "
,
"started"
,
"started"
,
"running"
,
"running"
,
"
unknown
"
};
"
stopped
"
};
enum
state
prev
[
2
],
cur
[
2
];
enum
state
prev
[
2
],
cur
[
2
];
unsigned
base
=
WR2RF_VME_REGS_CTRL
;
unsigned
base
=
WR2RF_VME_REGS_CTRL
;
unsigned
long
long
prev_time
;
if
(
argc
!=
2
)
{
if
(
argc
!=
2
)
{
printf
(
"usage: %s 1|2
\n
"
,
argv
[
0
]);
printf
(
"usage: %s 1|2
\n
"
,
argv
[
0
]);
...
@@ -2715,6 +2730,13 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
...
@@ -2715,6 +2730,13 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
cur
[
0
]
=
0xff
;
cur
[
0
]
=
0xff
;
cur
[
1
]
=
0xff
;
cur
[
1
]
=
0xff
;
{
unsigned
tai_h
;
unsigned
tai_l
;
unsigned
cyc
;
wrc_get_time
(
dev
,
&
tai_h
,
&
tai_l
,
&
cyc
);
prev_time
=
(
cyc
*
16
)
/
1000
+
(
tai_l
*
1000000ULL
);
}
while
(
1
)
{
while
(
1
)
{
int
i
;
int
i
;
...
@@ -2740,12 +2762,29 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
...
@@ -2740,12 +2762,29 @@ vtu_watch (struct libwr2rf_dev *dev, int argc, char **argv)
cur
[
i
]
=
RUNNING
;
cur
[
i
]
=
RUNNING
;
else
else
cur
[
i
]
=
UNKNOWN
;
cur
[
i
]
=
UNKNOWN
;
if
(
0
&&
cur
[
i
]
==
UNKNOWN
)
{
printf
(
"VTU%u status=0x%04x
\n
"
,
i
+
1
,
v
);
libwr2rf_vtu_dump_by_addr
(
dev
,
addr
);
}
}
}
if
(
cur
[
0
]
!=
prev
[
0
]
||
cur
[
1
]
!=
prev
[
1
])
{
if
(
cur
[
0
]
!=
prev
[
0
]
||
cur
[
1
]
!=
prev
[
1
])
{
printf
(
"VTU T1: %s T2: %s
\n
"
,
unsigned
tai_h
;
unsigned
tai_l
;
unsigned
cyc
;
unsigned
long
long
ntime
,
delta
,
delta_ms
;
wrc_get_time
(
dev
,
&
tai_h
,
&
tai_l
,
&
cyc
);
printf
(
"VTU T1: %s T2: %s "
,
state_names
[
cur
[
0
]],
state_names
[
cur
[
0
]],
state_names
[
cur
[
1
]]);
state_names
[
cur
[
1
]]);
ntime
=
(
cyc
*
16
)
/
1000
+
(
tai_l
*
1000000ULL
);
delta
=
ntime
-
prev_time
;
delta_ms
=
delta
/
1000
;
printf
(
"tai: %08x, cyc: %07x +%6ums%03uus
\n
"
,
tai_l
,
cyc
,
(
unsigned
)
delta_ms
,
(
unsigned
)(
delta
-
delta_ms
*
1000
));
prev_time
=
ntime
;
}
}
}
}
}
}
...
...
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