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
6
Merge Requests
6
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
ad0f0da8
Commit
ad0f0da8
authored
Jan 05, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/wrpc-dump: make common a checking the type's size
Signed-off-by:
Adam Wujek
<
adam.wujek@creotech.pl
>
parent
e99b38ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
45 deletions
+25
-45
dump-info.c
dump-info.c
+1
-1
dump-info.h
include/dump-info.h
+2
-2
wrpc-dump.c
tools/wrpc-dump.c
+22
-42
No files found.
dump-info.c
View file @
ad0f0da8
...
...
@@ -288,7 +288,7 @@ struct dump_info dump_info[] = {
DUMP_FIELD
(
yes_no_Boolean
,
received_dresp_fup
),
/* Count the number of delay response follow up messages received for a given delay request */
DUMP_FIELD
(
yes_no_Boolean
,
ptp_support
),
/* True if allow pure PTP support */
DUMP_FIELD
(
yes_no_Boolean
,
bmca_execute
),
/* True: Ask fsm to run bmca state decision */
DUMP_FIELD
(
pdstate
,
pdstate
),
/* Protocol detection state */
DUMP_FIELD
(
p
p_p
dstate
,
pdstate
),
/* Protocol detection state */
DUMP_FIELD
(
int
,
/* FIXME:pp_exstate_t */
extState
),
/* Extension state */
...
...
include/dump-info.h
View file @
ad0f0da8
...
...
@@ -59,7 +59,7 @@ enum dump_type {
dump_type_wr_config_Enumeration8
,
dump_type_wr_role
,
dump_type_wr_role_Enumeration8
,
dump_type_pdstate
,
dump_type_p
p_p
dstate
,
};
/* because of the sizeof later on, we need these typedefs */
...
...
@@ -82,7 +82,7 @@ typedef int wr_config;
typedef
Enumeration8
wr_config_Enumeration8
;
typedef
int
wr_role
;
typedef
Enumeration8
wr_role_Enumeration8
;
typedef
pp_pdstate_t
pdstate
;
typedef
pp_pdstate_t
p
p_p
dstate
;
/*
* This is generated with the target compiler, and then linked
...
...
tools/wrpc-dump.c
View file @
ad0f0da8
...
...
@@ -118,6 +118,27 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
type
=
wrpc_get_i32
(
&
info
->
type
);
size
=
wrpc_get_i32
(
&
info
->
size
);
// printf("%3d|%2d|", wrpc_get_i32(&info->offset), size);
/* For some (mostly enum like types) the size may vary. Check the size
* and assign a proper value to variable i */
switch
(
type
)
{
case
dump_type_yes_no
:
case
dump_type_yes_no_Boolean
:
case
dump_type_ppi_state
:
case
dump_type_ppi_state_Enumeration8
:
case
dump_type_wr_config
:
case
dump_type_wr_config_Enumeration8
:
case
dump_type_wr_role
:
case
dump_type_wr_role_Enumeration8
:
case
dump_type_pp_pdstate
:
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
}
/* check the size of Boolean, which is declared as Enum */
if
(
type
==
dump_type_Boolean
)
{
switch
(
size
)
{
...
...
@@ -190,15 +211,6 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
break
;
case
dump_type_yes_no
:
case
dump_type_yes_no_Boolean
:
/* check the size of type, e.g. Boolean is not 8 bits! */
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
printf
(
"%d"
,
i
);
if
(
i
==
0
)
print_str
(
"no"
);
...
...
@@ -327,14 +339,6 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
case
dump_type_ppi_state
:
case
dump_type_ppi_state_Enumeration8
:
/* check the size of type, e.g. Boolean is not 8 bits! */
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
switch
(
i
)
{
ENUM_TO_P_IN_CASE
(
PPS_END_OF_TABLE
,
char_p
);
ENUM_TO_P_IN_CASE
(
PPS_INITIALIZING
,
char_p
);
...
...
@@ -356,14 +360,6 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
case
dump_type_wr_config
:
case
dump_type_wr_config_Enumeration8
:
/* check the size of type, e.g. Boolean is not 8 bits! */
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
switch
(
i
)
{
ENUM_TO_P_IN_CASE
(
NON_WR
,
char_p
);
ENUM_TO_P_IN_CASE
(
WR_M_ONLY
,
char_p
);
...
...
@@ -380,14 +376,6 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
case
dump_type_wr_role
:
case
dump_type_wr_role_Enumeration8
:
/* check the size of type, e.g. Boolean is not 8 bits! */
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
switch
(
i
)
{
ENUM_TO_P_IN_CASE
(
WR_ROLE_NONE
,
char_p
);
ENUM_TO_P_IN_CASE
(
WR_MASTER
,
char_p
);
...
...
@@ -400,15 +388,7 @@ void dump_one_field(void *addr, struct dump_info *info, char *info_prefix)
printf
(
"
\n
"
);
break
;
case
dump_type_pdstate
:
/* check the size of type, e.g. Boolean is not 8 bits! */
if
(
size
==
1
)
i
=
*
(
uint8_t
*
)
p
;
else
if
(
size
==
2
)
i
=
wrpc_get_16
(
p
);
else
i
=
wrpc_get_l32
(
p
);
case
dump_type_pp_pdstate
:
switch
(
i
)
{
ENUM_TO_P_IN_CASE
(
PP_PDSTATE_NONE
,
char_p
);
ENUM_TO_P_IN_CASE
(
PP_PDSTATE_WAIT_MSG
,
char_p
);
...
...
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