Skip to content
Snippets Groups Projects
Commit 9ae3c905 authored by Adam Wujek's avatar Adam Wujek
Browse files

tools/ppsi_conf: add support to change parameter of all instances/ports


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent 006d46e9
Branches
Tags
No related merge requests found
......@@ -170,14 +170,16 @@ static int update_param_instance_cmd(const struct minipc_pd *pd,
int param_val = args[2];
struct pp_instance *ppi;
char iface_name[16];
int all_ports = 0;
if (param_instance & PPSI_INSTANCE_USE_PORT) {
all_ports = (param_instance == PPSI_INSTANCE_USE_PORT);
/* Execute command for all instances in a given interface */
snprintf(iface_name, 16, "wri%d",
param_instance & ~PPSI_INSTANCE_USE_PORT);
for (i = 0; i < get_numberPorts(GDSDEF(ppg_local)); i++) {
ppi = INST(ppg_local, i);
if (strcmp(iface_name, ppi->iface_name))
if (!all_ports && strcmp(iface_name, ppi->iface_name))
continue;
rval_tmp = update_param_instance(ppi, i, param_type,
param_val);
......
......@@ -69,9 +69,10 @@ void help(char *prgname)
" - enable/disable tracking in servo\n"
"\n"
"Parameters specific for PPSi instance:\n"
" --instance=<num>\n"
" --ppi=<num> - Select PPSi instance\n"
" --port=<num> - Select all instances on a defined port\n"
" --instance=<num|all>\n"
" --ppi=<num|all> - Select PPSi instance <num> or all instances\n"
" --port=<num|all> - Select all instances on a defined port <num> or all\n"
" instances\n"
" --delay-req-interval=<num>\n"
" - sets logarithm to the base 2 of the mean interval of delay\n"
" request message transmission; used when a port is in Slave state\n"
......@@ -216,19 +217,42 @@ int main(int argc, char *argv[])
case arg_instance:
ppsi_instance = atoi(optarg);
if (ppsi_instance == 0 && strcmp("0", optarg)
&& strcmp("all", optarg)) {
fprintf(stderr, "Wrong instance value: %s\n",
optarg);
exit (1);
}
if (!strcmp("all", optarg)) {
ppsi_port = 0;
ppsi_instance = PPSI_INSTANCE_USE_PORT;
} else {
ppsi_port = -1;
}
if (verbose)
printf("Setting instance to %d\n",
ppsi_instance);
ppsi_port = -1;
printf("Setting instance to %d%s\n",
ppsi_instance & ~PPSI_INSTANCE_USE_PORT,
ppsi_instance == PPSI_INSTANCE_USE_PORT
? " (all)" : ""
);
break;
case arg_port:
ppsi_instance = atoi(optarg);
if (verbose)
printf("Setting port to %d\n",
ppsi_instance);
if (ppsi_instance == 0 && strcmp("all", optarg)) {
fprintf(stderr, "Wrong port value: %s\n",
optarg);
exit (1);
}
ppsi_port = ppsi_instance;
ppsi_instance |= PPSI_INSTANCE_USE_PORT;
if (verbose)
printf("Setting port to %d%s\n",
ppsi_port,
ppsi_instance == PPSI_INSTANCE_USE_PORT
? " (all)" : ""
);
break;
case arg_prio1:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment