static double InitializeAdcModules(double targetFrameRate, int numChannelsPerFrame) { int i; double actualRate = 0.0; /* add and initialize 1 ics-110bl ADC per VmeCrate */ for(i=0; i<numVmeCrates; i++) { VmeModule *pmod; int rc; pmod = (VmeModule *)calloc(1, sizeof(VmeModule)); if(pmod == NULL) { syslog(LOG_INFO, "Failed to allocated VmeModule!\n"); FatalErrorHandler(0); } /* insert essential info here... */ pmod->crate = &VmeCrates[i]; pmod->vmeBaseAddr = ICS110B_DEFAULT_BASEADDR; pmod->type = "ics-110bl"; AdcModules[i] = pmod; #ifdef USE_MACRO_VME_ACCESSORS rc = vme_set_mmap_entry(VmeCrates[i].fd, 0x00000000, 0x39/*AM*/,0xFF010800/*hdr*/, (1<<24)-1,&(pmod->pcBaseAddr)); #endif rc = InitICS110BL(pmod, targetFrameRate, &actualRate, INTERNAL_CLOCK, ICS110B_INTERNAL, numChannelsPerFrame); if(rc) { syslog(LOG_INFO, "Failed to initialize adc %d\n"); FatalErrorHandler(0); } syslog(LOG_INFO, "AdcModule[%d] rate is %.9f\n",i,actualRate); } return actualRate; }
VOID ErrorHandler(DWORD dwLevel,DWORD dwReason,LPSTR lpszMsg) { switch(dwLevel) { case ERROR_LEVEL_FATAL: FatalErrorHandler(dwReason,lpszMsg); break; case ERROR_LEVEL_CRITICAL: CriticalErrorHandler(dwReason,lpszMsg); break; case ERROR_LEVEL_IMPORTANT: ImportantErrorHandler(dwReason,lpszMsg); break; case ERROR_LEVEL_ALARM: AlarmErrorHandler(dwReason,lpszMsg); break; case ERROR_LEVEL_INFORM: InformErrorHandler(dwReason,lpszMsg); break; default: break; } }
static void unhandled_exception_trampoline(XtExcFrame *frame) { FatalErrorHandler(); CODE_UNREACHABLE; }