/* * File: * tiLibTest.c * * Description: * Test Vme TI interrupts with GEFANUC Linux Driver * and TI library * * */ #include #include #include #include #include "jvme.h" #include "moLib.h" #define DO(x) if(x!=OK) goto CLOSE; int main(int argc, char *argv[]) { int chan=0, prescale=0, duty_mode; uint32_t read_prescale=0, read_dutymode=0; float read_dutycycle=0; if(argc!=4) return ERROR; chan = atoi(argv[1]); prescale = atoi(argv[2]); duty_mode = atoi(argv[3]); printf(" chan = %d prescale = %d\n", chan, prescale); DO(vmeOpenDefaultWindows()); DO(moInit(0xed0000,0)); DO(moConfigPrint()); DO(moGetPrescale(chan, &read_prescale)); printf("before: read_prescale = %d\n",read_prescale); DO(moSetPrescale(chan, prescale)); DO(moGetPrescale(chan, &read_prescale)); printf(" after: read_prescale = %d\n",read_prescale); DO(moConfigPrint()); DO(moGetDutyMode(chan, &read_dutymode)); DO(moGetDutyCycle(chan, &read_dutycycle)); printf(" before: read_dutymode = %d read_dutycycle = %6.3f\n", read_dutymode, read_dutycycle); DO(moSetDutyMode(chan, duty_mode)); DO(moGetDutyMode(chan, &read_dutymode)); DO(moGetDutyCycle(chan, &read_dutycycle)); printf(" after: read_dutymode = %d read_dutycycle = %6.3f\n", read_dutymode, read_dutycycle); DO(moConfigPrint()); CLOSE: vmeCloseDefaultWindows(); return OK; }