1 #define LIBNEXYS_INTERNAL
5 nexys2_t nexys2_init(void) {
13 printf("DpcInit failed\n");
17 if ((device = DvmgGetDefaultDev(&erc)) == -1)
19 printf("We appear to lack a default device. Sadface :(\n");
23 DvmgGetDevName(device, devname, &erc);
24 printf("Interacting with device %d (%s)\n", device, devname);
26 if (!DpcOpenJtag(&hand, devname, &erc, NULL))
28 printf("JTAG open failed\n");
34 int nexys2_jtag_enable(HANDLE hand)
37 return DpcEnableJtag(hand, &erc, NULL) ? 0 : -1;
40 int nexys2_jtag_disable(HANDLE hand)
43 return DpcDisableJtag(hand, &erc, NULL) ? 0 : -1;
46 int nexys2_jtag_setbits(HANDLE hand, int tms, int tdi, int tck)
49 return DpcSetTmsTdiTck(hand, tms, tdi, tck, &erc, NULL) ? 0 : -1;
52 int nexys2_jtag_puttdi(HANDLE hand, int tms, int nbits, unsigned char *bits, unsigned char *obits)
55 return DpcPutTdiBits(hand, nbits, bits, tms, obits ? 1 : 0, obits, &erc, NULL) ? 0 : -1;
58 int nexys2_jtag_puttmstdi(HANDLE hand, int nbits, unsigned char *bits, unsigned char *obits)
61 return DpcPutTmsTdiBits(hand, nbits, bits, obits ? 1 : 0, obits, &erc, NULL) ? 0 : -1;
64 int nexys2_jtag_gettdo(HANDLE hand, int tdi, int tms, int nbits, unsigned char *obits)
67 return DpcGetTdoBits(hand, nbits, tdi, tms, obits, &erc, NULL) ? 0 : -1;