uint8_t peek(int reg) { HIF deviceHandle; int status; char deviceName[32] = "Cr2s2"; uint8_t data; status = DmgrOpen(&deviceHandle, deviceName); if (!status) { printf("Problem opening device, code %d\n", DmgrGetLastError()); return 0; } status = DeppEnable(deviceHandle); if (!status) { printf("Problem enabling port 0, code %d\n", DmgrGetLastError()); return 0; } DeppGetReg(deviceHandle, reg, &data, fFalse); status = DeppDisable(deviceHandle); if (!status) { printf("Problem disabling DEPP, code %d\n", DmgrGetLastError()); return 0; } DmgrClose(deviceHandle); return data; }
int main(int cszArg, char * rgszArg[]) { fprintf(stderr,"Opening\n"); if(!DmgrOpen(&hif, "Basys2")) { printf("DmgrOpen failed (check the device name you provided)\n"); return 0; } fprintf(stderr,"Enabling\n"); if(!DeppEnable(hif)) { printf("DeppEnable failed\n"); return 0; } fprintf(stderr,"Outputting\n"); DoPutRegRepeat(); if( hif != hifInvalid ) { DeppDisable(hif); DmgrClose(hif); } return 0; }