Esempio n. 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;
}
Esempio n. 2
0
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
}
Esempio n. 3
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
}