Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPSi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projects
PPSi
Commits
194eaef4
Commit
194eaef4
authored
2 years ago
by
Adam Wujek
Browse files
Options
Downloads
Patches
Plain Diff
tools/ppsi_conf: add support for instance
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
e0004f21
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arch-wrs/include/ppsi_exports.h
+12
-0
12 additions, 0 deletions
arch-wrs/include/ppsi_exports.h
arch-wrs/wrs-ipcserver.c
+26
-0
26 additions, 0 deletions
arch-wrs/wrs-ipcserver.c
tools/ppsi_conf.c
+32
-0
32 additions, 0 deletions
tools/ppsi_conf.c
with
70 additions
and
0 deletions
arch-wrs/include/ppsi_exports.h
+
12
−
0
View file @
194eaef4
...
...
@@ -11,6 +11,7 @@
#define PPSIEXP_RET_OK 0
#define PPSIEXP_RET_ERROR_CMD 1
#define PPSIEXP_RET_ERROR_VAL 2
#define PPSIEXP_RET_ERROR_INSTANCE 3
/* Commands for ppsiexp_update_param_cmd */
#define PPSIEXP_PARAM_PRIORITY1_CMD 1
...
...
@@ -39,6 +40,17 @@ struct minipc_pd ppsiexp_update_param_cmd = {
},
};
struct
minipc_pd
ppsiexp_update_param_instance_cmd
=
{
.
name
=
"instance param"
,
.
retval
=
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
.
args
=
{
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
/* Command/parameter */
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
/* Instance */
MINIPC_ARG_ENCODE
(
MINIPC_ATYPE_INT
,
int
),
/* New value */
MINIPC_ARG_END
,
},
};
#endif
/* PPSI_EXPORT_STRUCTURES */
#endif
/* __PPSI_EXPORTS_H */
This diff is collapsed.
Click to expand it.
arch-wrs/wrs-ipcserver.c
+
26
−
0
View file @
194eaef4
...
...
@@ -99,6 +99,30 @@ static int update_param_cmd(const struct minipc_pd *pd, uint32_t *args,
return
0
;
}
static
int
update_param_instance_cmd
(
const
struct
minipc_pd
*
pd
,
uint32_t
*
args
,
void
*
ret
)
{
int
rval
=
PPSIEXP_RET_OK
;
int
param_type
=
args
[
0
];
int
param_instance
=
args
[
1
];
int
param_val
=
args
[
2
];
struct
pp_instance
*
ppi
;
switch
(
param_type
)
{
default:
ppi
=
INST
(
ppg_local
,
param_instance
);
pp_diag
(
ppi
,
config
,
1
,
"Param update Error: not supported param instance cmd "
"%d value %d
\n
"
,
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
)
...
...
@@ -106,7 +130,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_param_instance_cmd
.
f
=
update_param_instance_cmd
;
minipc_export
(
ppsi_ch
,
&
__rpcdef_cmd
);
minipc_export
(
ppsi_ch
,
&
ppsiexp_update_param_cmd
);
minipc_export
(
ppsi_ch
,
&
ppsiexp_update_param_instance_cmd
);
}
This diff is collapsed.
Click to expand it.
tools/ppsi_conf.c
+
32
−
0
View file @
194eaef4
...
...
@@ -26,6 +26,7 @@ static struct minipc_ch *ptp_ch;
enum
input_arg
{
arg_help
=
'Z'
+
1
,
/* avoid conflicts with short options */
arg_instance
,
arg_prio1
,
arg_prio2
,
arg_tracking
,
...
...
@@ -34,6 +35,8 @@ enum input_arg {
static
struct
option
long_opts
[]
=
{
{
"help"
,
no_argument
,
NULL
,
arg_help
},
{
"instance"
,
required_argument
,
NULL
,
arg_instance
},
{
"ppi"
,
required_argument
,
NULL
,
arg_instance
},
{
"prio1"
,
required_argument
,
NULL
,
arg_prio1
},
{
"priority1"
,
required_argument
,
NULL
,
arg_prio1
},
{
"prio2"
,
required_argument
,
NULL
,
arg_prio2
},
...
...
@@ -58,6 +61,10 @@ void help(char *prgname)
" --priority2=<num> - set priority 2 to <num>
\n
"
" --tracking=<on|off|enable|disable|1|0>
\n
"
" - enable/disable tracking in servo
\n
"
"
\n
"
"Parameters specific for PPSi instance:
\n
"
" --instance=<num>
\n
"
" --ppi=<num> - Select PPSi instance
\n
"
);
exit
(
1
);
}
...
...
@@ -82,6 +89,14 @@ void init_shm(void)
ppsi_connect_minipc
();
}
static
void
check_instance
(
int
instance
)
{
if
(
instance
==
-
1
)
{
fprintf
(
stderr
,
"Instance not defined! Please define instance."
"Exiting...
\n
"
);
exit
(
1
);
}
}
static
void
enable_disable_tracking
(
int
onoff
)
{
...
...
@@ -102,11 +117,23 @@ static int ppsi_set_param(int param, int val) {
return
rval
;
}
static
int
ppsi_set_param_instance
(
int
param
,
int
instance
,
int
val
)
{
int
rval
=
0
;
printf
(
"%s: set param instance %d val %d
\n
"
,
__func__
,
param
,
val
);
minipc_call
(
ptp_ch
,
MINIPC_TIMEOUT
,
&
ppsiexp_update_param_instance_cmd
,
&
rval
,
param
,
instance
,
val
);
return
rval
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
opt
;
int
tmp
;
int
ret
;
int
ppsi_instance
=
-
1
;
init_shm
();
...
...
@@ -141,6 +168,11 @@ int main(int argc, char *argv[])
while
((
opt
=
getopt_long
(
argc
,
argv
,
"vh"
,
long_opts
,
NULL
))
!=
-
1
)
{
switch
(
opt
)
{
case
arg_instance
:
ppsi_instance
=
atoi
(
optarg
);
if
(
verbose
)
printf
(
"Setting instance to %d
\n
"
,
ppsi_instance
);
break
;
case
arg_prio1
:
tmp
=
atoi
(
optarg
);
if
(
verbose
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment