Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
8be8c98c
Commit
8be8c98c
authored
May 03, 2023
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libertm: working API call for configuring/reading out SPLL debug data
parent
cd48cfb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
libertm.c
libertm/libertm.c
+26
-6
libertm.h
libertm/libertm.h
+3
-0
No files found.
libertm/libertm.c
View file @
8be8c98c
...
...
@@ -1364,16 +1364,16 @@ int ertm_read_spll_debug_data( struct ertm_status *handle, uint32_t *buf, size_t
{
int
res
=
0
,
i
;
struct
uart_link
*
link
=
&
handle
->
link
;
struct
uart_packet
pkt
;
struct
ertm14_spll_debug_dump_data
*
dbgdata
=
&
pkt
.
payload
;
struct
uart_packet
*
pkt
;
struct
ertm14_spll_debug_dump_data
*
dbgdata
;
res
=
uart_link_recv
(
link
,
&
pkt
,
1000
);
if
(
res
<
0
)
return
res
;
if
(
pkt
.
ptype
!=
ERTM14_UART_PTYPE_SNMP_RESP
)
{
fprintf
(
stderr
,
"error (bad packet type != RESP) in uart_link_recv
\n
"
);
if
(
pkt
->
ptype
!=
ERTM14_UART_PTYPE_SOFTPLL_LOG
)
{
fprintf
(
stderr
,
"error (bad packet type != RESP) in uart_link_recv
[got %d exp %d]
\n
"
,
pkt
->
ptype
,
ERTM14_UART_PTYPE_SOFTPLL_LOG
);
errno
=
EINVAL
;
return
ERTM_UART_PROTO_ERR
;
}
...
...
@@ -1384,17 +1384,37 @@ int ertm_read_spll_debug_data( struct ertm_status *handle, uint32_t *buf, size_t
return
ERTM_UART_PROTO_ERR
;
}
if
(
*
buf_size
<
pkt
.
length
)
if
(
*
buf_size
<
pkt
->
length
)
{
errno
=
ENOSPC
;
return
ERTM_UART_PROTO_ERR
;
}
dbgdata
=
&
pkt
->
payload
;
dbgdata
->
flags
=
ntohl
(
dbgdata
->
flags
);
int
cnt
=
pkt
.
length
/
sizeof
(
uint32_t
)
-
1
;
int
cnt
=
pkt
->
length
/
sizeof
(
uint32_t
)
-
1
;
if
(
cnt
<=
0
)
return
ERTM_UART_PROTO_ERR
;
if
(
(
dbgdata
->
flags
&
0xffff
)
!=
ERTM14_SPLL_DEBUG_DUMP_HEADER
)
{
errno
=
EINVAL
;
return
ERTM_UART_PROTO_ERR
;
}
// printf("cnt %d res %d plen %d flags %08x\n", cnt, res, pkt->length, dbgdata->flags );
for
(
i
=
0
;
i
<
cnt
;
i
++
)
dbgdata
->
payload
[
i
]
=
ntohl
(
dbgdata
->
payload
[
i
]
);
memcpy
(
buf
,
dbgdata
->
payload
,
cnt
*
sizeof
(
uint32_t
)
);
*
buf_size
=
cnt
;
if
(
dbgdata
->
flags
&
ERTM14_SPLL_DEBUG_DUMP_OVERFLOW
)
return
ERTM_SPLL_LOG_OVERFLOW
;
return
0
;
}
libertm/libertm.h
View file @
8be8c98c
...
...
@@ -15,6 +15,8 @@ extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
#include "ertm-common.h"
#include "hw/wrc_diags_regs.h"
...
...
@@ -37,6 +39,7 @@ struct ertm_lib_version {
#define ERTM_UART_PROTO_ERR (-8)
#define ERTM_BAD_CLKAB_FREQ (-9)
#define ERTM_BAD_SYNC_SOURCE (-10)
#define ERTM_SPLL_LOG_OVERFLOW (-11)
struct
ertm_error_codes
{
int
code
;
...
...
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