Exemple #1
0
int main(int argc, char **argv) {
	struct jtag_state state;
	bzero(&state, sizeof(state));

	atexit(cleanup);
	jtag_open(&state);

	printf("ID code: 0x%08x\n", jtag_idcode(&state));

	return 0;
}
Exemple #2
0
void jconnect(void) {
	if (!(jtag = jtag_open())) {
		fprintf(stderr, "jconnect: cannot open usb jtag ifc\n");
		exit(-1);
	}
	if (jtag_enumerate(jtag) <= 0) {
		fprintf(stderr, "jconnect: cannot enumerate jtag devices\n");
		exit(-1);
	}
	if (jtag_select(jtag, 0x13722093)) {
		fprintf(stderr, "jconnect: cannot connect to ZYNQ\n");
		exit(-1);
	}

	jtag_ir_wr(jtag, XIL_USER4);
}
void HDMITest::loadDefaultFirmware()
{
#ifdef linux
	struct jtag_state state;
	uint32_t idcode;
	int fd;

	jtag_open(&state);
	idcode = jtag_idcode(&state);
	jtag_cleanup(&state);


	if (idcode == LX9_JTAG) {
		uint8_t bytes[sizeof(zerobytes_6slx9csg324)];
		fd = open(LX9_FIRMWARE, O_RDONLY);
		if (-1 == fd) {
			qDebug() << "Unable to open LX9 firmware";
			return;
		}
		if (read(fd, bytes, sizeof(bytes)) != sizeof(bytes)) {
			qDebug() << "Unable to read LX9 firmware";
			close(fd);
			return;
		}
		close(fd);
		loadFpgaFirmware(bytes, sizeof(bytes));
	}
	else if (idcode == LX45_JTAG) {
		uint8_t bytes[sizeof(zerobytes_6slx45csg324)];
		fd = open(LX45_FIRMWARE, O_RDONLY);
		if (-1 == fd) {
			qDebug() << "Unable to open LX45 firmware";
			return;
		}
		if (read(fd, bytes, sizeof(bytes)) != sizeof(bytes)) {
			qDebug() << "Unable to read LX45 firmware";
			close(fd);
			return;
		}
		close(fd);
		loadFpgaFirmware(bytes, sizeof(bytes));
	}
	else {
		qDebug() << "Unrecognized JTAG code:" << idcode;
	}
#endif
}
Exemple #4
0
int main(int argc, char **argv) {
	unsigned bits;

	if (jtag_open() < 0)
		return -1;

	if (jtag_reset() < 0)
		return -1;
	if (jtag_dr(32, 0, &bits) < 0)
		return -1;
	fprintf(stderr,"IDCODE: %08x\n", bits);

	if (jtag_open_virtual_device(0xffffffff))
		return -1;

	jtag_close();
	return 0;
}
void HDMITest::loadTestFirmware()
{
#ifdef linux
	struct jtag_state state;
	uint32_t idcode;

	jtag_open(&state);
	idcode = jtag_idcode(&state);
	jtag_cleanup(&state);

	if (idcode == LX9_JTAG)
		loadFpgaFirmware(zerobytes_6slx9csg324, sizeof(zerobytes_6slx9csg324));
	else if (idcode == LX45_JTAG)
		loadFpgaFirmware(zerobytes_6slx45csg324, sizeof(zerobytes_6slx45csg324));
	else {
		QString str;
		str.sprintf("Unrecognized FPGA JTAG: 0x%08x", idcode);
		qDebug() << str.toAscii();
		return;
	}
#endif
}