70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "list_probes.h"
|
|
#include "../utils.h"
|
|
|
|
const char cmd_list_probes_help[] = "Bla bla.";
|
|
|
|
struct probe {
|
|
int drv;
|
|
int probe;
|
|
int probe_id;
|
|
char name[PROBE_NAME_SIZE];
|
|
};
|
|
|
|
int list_probes(jtag_core *jc, struct probe probes[], int show) {
|
|
int i = 0;
|
|
int j = 0;
|
|
int n = 0;
|
|
|
|
char probe_name[PROBE_NAME_SIZE] = {0};
|
|
int n_probe_drv = 0;
|
|
int n_probes = 0;
|
|
|
|
/* Drivers and probes */
|
|
n_probe_drv = jtagcore_get_number_of_probes_drv(jc);
|
|
if (n_probe_drv > 0) {
|
|
if (0 != show) printf("Found a debug probe driver:\n");
|
|
} else {
|
|
if (0 != show) printf("No probes driver found\n");
|
|
return n;
|
|
}
|
|
|
|
for (i=0;i<n_probe_drv;i++) {
|
|
if (0 != show) printf(" JTAG probe driver %d\n", i);
|
|
|
|
n_probes = jtagcore_get_number_of_probes(jc, i);
|
|
|
|
if (n_probes > 0) {
|
|
|
|
if (0 != show) printf("Found a debug probe:\n");
|
|
|
|
} else {
|
|
|
|
if (0 != show) printf("No probe found.\n");
|
|
continue;
|
|
}
|
|
for (j=0;j<n_probes;j++) {
|
|
jtagcore_get_probe_name(jc, PROBE_ID(i,j), probe_name);
|
|
|
|
if (n < PROBES_MAX_NUM) {
|
|
probes[n].drv = i;
|
|
probes[n].probe = j;
|
|
probes[n].probe_id = PROBE_ID(i,j);
|
|
strncpy(probes[n].name, probe_name, PROBE_NAME_SIZE);
|
|
}
|
|
if (0 != show) {
|
|
printf(" JTAG probe %d: ", n+1);
|
|
printf("%s.\n", probe_name);
|
|
}
|
|
n++;
|
|
}
|
|
}
|
|
return n;
|
|
}
|
|
|
|
int cmd_list_probes(jtag_core *jc, int argc, char *argv[]) {
|
|
|
|
}
|