static bool debug;
struct backend {
- int (*init)(const char *target);
+ int (*init)(const char *target, int freq);
int (*reset)(void);
int (*command)(uint8_t op, uint8_t addr, uint64_t *data);
};
static int sim_fd = -1;
-static int sim_init(const char *target)
+static int sim_init(const char *target, int freq)
{
struct sockaddr_in saddr;
struct hostent *hp;
const char *p, *host;
int port, rc;
+ (void)freq;
+
if (!target)
target = "localhost:13245";
p = strchr(target, ':');
static urj_chain_t *jc;
-static int jtag_init(const char *target)
+static int jtag_init(const char *target, int freq)
{
const char *sep;
const char *cable;
return -1;
}
+ if (freq) {
+ urj_tap_cable_set_frequency(jc->cable, freq);
+ }
+
/* XXX Hard wire part 0, that might need to change (use params and detect !) */
rc = urj_tap_manual_add(jc, 6);
if (rc < 0) {
{
const char *progname = argv[0];
const char *target = NULL;
- int rc, i = 1;
+ int rc, i = 1, freq = 0;
b = NULL;
{ "backend", required_argument, 0, 'b' },
{ "target", required_argument, 0, 't' },
{ "debug", no_argument, 0, 'd' },
+ { "frequency", no_argument, 0, 's' },
{ 0, 0, 0, 0 }
};
- c = getopt_long(argc, argv, "dhb:t:", lopts, &oindex);
+ c = getopt_long(argc, argv, "dhb:t:s:", lopts, &oindex);
if (c < 0)
break;
switch(c) {
case 't':
target = optarg;
break;
+ case 's':
+ freq = atoi(optarg);
+ if (freq == 0) {
+ fprintf(stderr, "Bad frequency %s\n", optarg);
+ exit(1);
+ }
+ break;
case 'd':
debug = true;
}
if (b == NULL)
b = &jtag_backend;
- rc = b->init(target);
+ rc = b->init(target, freq);
if (rc < 0)
exit(1);
for (i = optind; i < argc; i++) {