Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
e63c05d6
Commit
e63c05d6
authored
Mar 03, 2023
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/ppsi_conf: support change of alpha
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
cc101d87
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
0 deletions
+81
-0
ppsi_exports.h
arch-wrs/include/ppsi_exports.h
+13
-0
wrs-ipcserver.c
arch-wrs/wrs-ipcserver.c
+40
-0
ppsi_conf.c
tools/ppsi_conf.c
+28
-0
No files found.
arch-wrs/include/ppsi_exports.h
View file @
e63c05d6
...
...
@@ -14,6 +14,9 @@
#define PPSIEXP_PARAM_PRIORITY1_CMD 1
#define PPSIEXP_PARAM_PRIORITY2_CMD 2
/* Commands for ppsiexp_update_param64_cmd */
#define PPSIEXP_PARAM64_ALPHA_CMD 1
/* Export structures, shared by server and client for argument matching */
#ifdef PPSI_EXPORT_STRUCTURES
...
...
@@ -38,6 +41,16 @@ struct minipc_pd ppsiexp_update_param_cmd = {
},
};
struct
minipc_pd
ppsiexp_update_param64_cmd
=
{
.
name
=
"params64"
,
.
retval
=
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
.
args
=
{
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
/* Command/parameter */
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT64
,
int64_t
),
/* New value */
MINIPC_ARG_END
,
},
};
#endif
/* PPSI_EXPORT_STRUCTURES */
#endif
/* __PPSI_EXPORTS_H */
arch-wrs/wrs-ipcserver.c
View file @
e63c05d6
...
...
@@ -89,6 +89,44 @@ static int update_param_cmd(const struct minipc_pd *pd, uint32_t *args,
return
0
;
}
static
int
update_param64_cmd
(
const
struct
minipc_pd
*
pd
,
uint32_t
*
args
,
void
*
ret
)
{
int
rval
=
PPSIEXP_RET_OK
;
int
param_type
=
args
[
0
];
int64_t
param_val
=
*
((
int64_t
*
)
&
args
[
1
]);
switch
(
param_type
)
{
case
PPSIEXP_PARAM64_ALPHA_CMD
:
printf
(
"%s: cmd %d (PPSIEXP_PARAM64_ALPHA_CMD) value %lld
\n
"
,
__func__
,
param_type
,
param_val
);
{
struct
pp_instance
*
ppi
;
int
i
;
for
(
i
=
0
;
i
<
get_numberPorts
(
GDSDEF
(
ppg_local
));
i
++
)
{
ppi
=
INST
(
ppg_local
,
i
);
ppi
->
asymmetryCorrectionPortDS
.
scaledDelayCoefficient
=
param_val
;
ppi
->
portDS
->
delayAsymCoeff
=
pp_servo_calculateDelayAsymCoefficient
(
ppi
->
asymmetryCorrectionPortDS
.
scaledDelayCoefficient
);
}
}
break
;
default:
printf
(
"%s: not found cmd %d value %lld
\n
"
,
__func__
,
param_type
,
param_val
);
rval
=
PPSIEXP_RET_ERROR_CMD
;
break
;
}
*
(
int
*
)
ret
=
rval
;
return
0
;
}
/* To be called at startup, right after the creation of server channel */
void
wrs_init_ipcserver
(
struct
pp_globals
*
ppg
,
struct
minipc_ch
*
ppsi_ch
)
...
...
@@ -96,7 +134,9 @@ void wrs_init_ipcserver(struct pp_globals *ppg, struct minipc_ch *ppsi_ch)
ppg_local
=
ppg
;
__rpcdef_cmd
.
f
=
export_cmd
;
ppsiexp_update_param_cmd
.
f
=
update_param_cmd
;
ppsiexp_update_param64_cmd
.
f
=
update_param64_cmd
;
minipc_export
(
ppsi_ch
,
&
__rpcdef_cmd
);
minipc_export
(
ppsi_ch
,
&
ppsiexp_update_param_cmd
);
minipc_export
(
ppsi_ch
,
&
ppsiexp_update_param64_cmd
);
}
tools/ppsi_conf.c
View file @
e63c05d6
...
...
@@ -25,6 +25,7 @@ static struct minipc_ch *ptp_ch;
enum
input_arg
{
arg_help
=
'Z'
+
1
,
/* avoid conflicts with short options */
arg_alpha
,
arg_prio1
,
arg_prio2
,
arg_tracking
,
...
...
@@ -33,6 +34,7 @@ enum input_arg {
static
struct
option
long_opts
[]
=
{
{
"help"
,
no_argument
,
NULL
,
arg_help
},
{
"alpha"
,
required_argument
,
NULL
,
arg_alpha
},
{
"prio1"
,
required_argument
,
NULL
,
arg_prio1
},
{
"priority1"
,
required_argument
,
NULL
,
arg_prio1
},
{
"prio2"
,
required_argument
,
NULL
,
arg_prio2
},
...
...
@@ -51,6 +53,8 @@ void help(char *prgname)
" -h|--help - print help
\n
"
" -v|--verbose - verbose output
\n
"
"Global parameters:
\n
"
" --alpha=<alpha64bit>
\n
"
" - change the currently used alpha
\n
"
" --prio1=<num>
\n
"
" --priority1=<num> - set priority 1 to <num>
\n
"
" --prio2=<num>
\n
"
...
...
@@ -101,6 +105,17 @@ static int ppsi_set_param(int param, int val) {
return
rval
;
}
static
int
ppsi_set_param64
(
int
param
,
int64_t
val64
)
{
int
rval
=
0
;
printf
(
"%s: set param %d val %lld
\n
"
,
__func__
,
param
,
val64
);
minipc_call
(
ptp_ch
,
MINIPC_TIMEOUT
,
&
ppsiexp_update_param64_cmd
,
&
rval
,
param
,
val64
);
return
rval
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
opt
;
...
...
@@ -143,6 +158,19 @@ int main(int argc, char *argv[])
while
((
opt
=
getopt_long
(
argc
,
argv
,
"vh"
,
long_opts
,
NULL
))
!=
-
1
)
{
switch
(
opt
)
{
case
arg_alpha
:
if
(
verbose
)
printf
(
"Setting alpha to %lld
\n
"
,
atoll
(
optarg
));
ret
=
ppsi_set_param64
(
PPSIEXP_PARAM64_ALPHA_CMD
,
atoll
(
optarg
));
if
(
ret
)
{
fprintf
(
stderr
,
"Error setting alpha to %lld
\n
"
,
atoll
(
optarg
));
exit
(
1
);
}
break
;
case
arg_prio1
:
tmp
=
atoi
(
optarg
);
if
(
verbose
)
...
...
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