/***************************************************************************** * * This routine removes a XiaDefaults entry * *****************************************************************************/ HANDEL_SHARED int HANDEL_API xiaRemoveDefault(char *alias) { int status = XIA_SUCCESS; XiaDefaults *prev = NULL; XiaDefaults *current = NULL; XiaDefaults *next = NULL; sprintf(info_string, "Preparing to remove default w/ alias %s", alias); xiaLogDebug("xiaRemoveDefault", info_string); if (isListEmpty(xiaDefaultsHead)) { status = XIA_NO_ALIAS; sprintf(info_string, "Alias %s does not exist", alias); xiaLogError("xiaRemoveDefault", info_string, status); return status; } /* First check if this alias exists already? */ prev = NULL; current = xiaDefaultsHead; next = current->next; while (next != NULL) { if (STREQ(alias, current->alias)) { break; } /* Move to the next element */ prev = current; current = next; next = current->next; } /* Check if we found nothing */ if ((next == NULL) && (!STREQ(current->alias, alias))) { status = XIA_NO_ALIAS; sprintf(info_string,"Alias %s does not exist.", alias); xiaLogError("xiaRemoveDefault", info_string, status); return status; } /* Check if match is the head of the list */ if (current == xiaDefaultsHead) { xiaDefaultsHead = next; } else { prev->next = next; } /* Free up the memory associated with this element */ xiaFreeXiaDefaults(current); return status; }
/***************************************************************************** * * This routine modifies information about a Firmware Item entry * *****************************************************************************/ HANDEL_SHARED int HANDEL_API xiaModifyDefaultItem(char *alias, char *name, void *value) { int status = XIA_SUCCESS; XiaDefaults *chosen = NULL; XiaDaqEntry *current = NULL; /* Check that the name and value are not NULL */ if (value == NULL) { status = XIA_BAD_VALUE; sprintf(info_string,"Value can not be NULL"); xiaLogError("xiaModifyDefaultItem", info_string, status); return status; } if (name == NULL) { status = XIA_BAD_VALUE; sprintf(info_string,"Name can not be NULL"); xiaLogError("xiaModifyDefaultItem", info_string, status); return status; } /* Locate the XiaDefaults entry first */ chosen = xiaFindDefault(alias); if (chosen == NULL) { status = XIA_NO_ALIAS; sprintf(info_string,"Alias %s was not found.", alias); xiaLogError("xiaModifyDefaultItem", info_string, status); return status; } /* Now find a match to the name */ current = chosen->entry; while (current!=NULL) { if (STREQ(name, current->name)) { break; } current=current->next; } if (current == NULL) { status = XIA_BAD_VALUE; sprintf(info_string,"No entry named %s found.", name); xiaLogError("xiaModifyDefaultItem", info_string, status); return status; } /* Now modify the value */ current->data = *((double *) value); return status; }
/* * Frees the memory allocated to a FirmwareSet structure. */ HANDEL_SHARED int HANDEL_API xiaFreeFirmwareSet(FirmwareSet *firmwareSet) /* FirmwareSet *firmwareSet; Input: pointer to structure to free */ { int status = XIA_SUCCESS; unsigned int i; Firmware *next, *current; if (firmwareSet == NULL) { status = XIA_NOMEM; sprintf(info_string,"FirmwareSet object unallocated: can not free"); xiaLogError("xiaFreeFirmwareSet", info_string, status); return status; } if (firmwareSet->alias != NULL) { handel_md_free(firmwareSet->alias); } if (firmwareSet->filename != NULL) { handel_md_free(firmwareSet->filename); } if (firmwareSet->mmu != NULL) { handel_md_free(firmwareSet->mmu); } if (firmwareSet->tmpPath != NULL) { handel_md_free(firmwareSet->tmpPath); } /* Loop over the Firmware information, deallocating memory */ current = firmwareSet->firmware; while (current != NULL) { next = current->next; status = xiaFreeFirmware(current); if (status != XIA_SUCCESS) { xiaLogError("xiaFreeFirmwareSet", "Error freeing firmware", status); return status; } current = next; } for (i = 0; i < firmwareSet->numKeywords; i++) { handel_md_free((void *)firmwareSet->keywords[i]); } handel_md_free((void *)firmwareSet->keywords); /* Free the FirmwareSet structure */ handel_md_free(firmwareSet); firmwareSet = NULL; return status; }
/* * Shuts down communication on each module. */ HANDEL_STATIC int HANDEL_API xiaUnHook(void) { int status; char boardType[MAXITEM_LEN]; DetChanElement *current = xiaDetChanHead; PSLFuncs localFuncs; while (current != NULL) { /* Only do the single channels since sets * are made up of single channels and would * make the whole thing a little too redundant. */ if (current->type == SINGLE) { status = xiaGetBoardType(current->detChan, boardType); if (status != XIA_SUCCESS) { sprintf(info_string, "Unable to get boardType for detChan %d", current->detChan); xiaLogError("xiaUnHook", info_string, status); return status; } status = xiaLoadPSL(boardType, &localFuncs); if (status != XIA_SUCCESS) { sprintf(info_string, "Unable to load PSL functions for boardType %s", boardType); xiaLogError("xiaUnHook", info_string, status); return status; } status = localFuncs.unHook(current->detChan); if (status != XIA_SUCCESS) { sprintf(info_string, "Unable to close communications for boardType %s", boardType); xiaLogError("xiaUnHook", info_string, status); return status; } } current = current->next; } return XIA_SUCCESS; }
/* * Frees the memory allocated to a Detector structure. */ HANDEL_SHARED int HANDEL_API xiaFreeDetector(Detector *detector) /* Detector *detector; Input: pointer to structure to free */ { int status = XIA_SUCCESS; if (detector == NULL) { status = XIA_NOMEM; sprintf(info_string,"Detector object unallocated: can not free"); xiaLogError("xiaFreeDetector", info_string, status); return status; } if (detector->alias != NULL) { handel_md_free(detector->alias); } if (detector->polarity != NULL) { handel_md_free(detector->polarity); } if (detector->gain != NULL) { handel_md_free(detector->gain); } handel_md_free(detector->typeValue); /* Free the Board_Info structure */ handel_md_free(detector); detector = NULL; return status; }
/***************************************************************************** * * This routine retrieves the value of a XiaDefaults entry * *****************************************************************************/ HANDEL_SHARED int HANDEL_API xiaGetDefaultItem(char *alias, char *name, void *value) { int status = XIA_SUCCESS; XiaDefaults *chosen = NULL; XiaDaqEntry *current = NULL; /* Find the alias */ chosen = xiaFindDefault(alias); if (chosen == NULL) { status = XIA_NO_ALIAS; sprintf(info_string, "Alias: %s does not exist", alias); xiaLogError("xiaGetDefaultItem", info_string, status); return status; } /* Decide which data to return by searching through the entries LL */ current = chosen->entry; /* Search first and then cast as the last step. A little opposite of * the way that we usually do this, but these structures are also * organized different then usual, so... */ while (current!=NULL) { if (STREQ(name, current->name)) { break; } current=current->next; } if (current == NULL) { status = XIA_BAD_NAME; sprintf(info_string, "Invalid name: %s", name); xiaLogError("xiaGetDefaultItem", info_string, status); return status; } *((double *)value) = current->data; return status; }
HANDEL_EXPORT int HANDEL_API xiaInit(char *iniFile) { int status; int nFilesOpen; /* We need to clear and re-initialize Handel */ status = xiaInitHandel(); if (status != XIA_SUCCESS) { xiaLogError("xiaInit", "Error reinitializing Handel", status); return status; } if (iniFile == NULL) { xiaLogError("xiaInit", ".INI file name must be non-NULL", XIA_BAD_NAME); return XIA_BAD_NAME; } /* Verify that we currently don't have any file handles open. This is * not a legitimate error condition and indicates that we are not cleaning * up all of our handles somewhere else in the library. */ nFilesOpen = xia_num_open_handles(); if (nFilesOpen > 0) { xia_print_open_handles(stdout); FAIL(); } status = xiaReadIniFile(iniFile); if (status != XIA_SUCCESS) { sprintf(info_string, "Error reading in .INI file '%s'", iniFile); xiaLogError("xiaInit", info_string, status); return status; } return XIA_SUCCESS; }
/* * Frees the memory allocated to an XiaDefaults structure. */ HANDEL_SHARED int HANDEL_API xiaFreeXiaDefaults(XiaDefaults *xiaDefaults) { int status = XIA_SUCCESS; XiaDaqEntry *next = NULL; XiaDaqEntry *current = NULL; if (xiaDefaults == NULL) { status = XIA_NOMEM; sprintf(info_string,"XiaDefaults object unallocated: can not free"); xiaLogError("xiaFreeXiaDefaults", info_string, status); return status; } if (xiaDefaults->alias != NULL) { handel_md_free(xiaDefaults->alias); } /* Loop over the xiaDaqEntry information, deallocating memory */ current = xiaDefaults->entry; while (current != NULL) { next = current->next; status = xiaFreeXiaDaqEntry(current); if (status != XIA_SUCCESS) { xiaLogError("xiaFreeXiaDefaults", "Error freeing DAQ entry", status); return status; } current = next; } /* Free the XiaDefaults structure */ handel_md_free(xiaDefaults); xiaDefaults = NULL; return status; }
/* * This routine initializes the data structures. */ HANDEL_STATIC int HANDEL_API xiaInitMemory(void) { int status = XIA_SUCCESS; xiaLogInfo("xiaInitMemory", "Initializing Handel data structure."); status = xiaInitDetectorDS(); if(status != XIA_SUCCESS) { xiaLogError("xiaInitMemory", "Unable to clear the Detector LL", status); return status; } status = xiaInitFirmwareSetDS(); if(status != XIA_SUCCESS) { xiaLogError("xiaInitMemory", "Unable to clear the FirmwareSet LL", status); return status; } status = xiaInitModuleDS(); if (status != XIA_SUCCESS) { xiaLogError("xiaInitMemory", "Unable to clear Module LL", status); return status; } status = xiaInitDetChanDS(); if (status != XIA_SUCCESS) { xiaLogError("xiaInitMemory", "Unable to clear DetChan LL", status); return status; } status = xiaInitXiaDefaultsDS(); if (status != XIA_SUCCESS) { xiaLogError("xiaInitMemory", "Unable to clear Defaults LL", status); return status; } return status; }
/* * This routines disconnects from the hardware and cleans Handel's * internal data structures. */ HANDEL_EXPORT int HANDEL_API xiaExit(void) { int status; /* Close down any communications that need to be shutdown. */ status = xiaUnHook(); if (status != XIA_SUCCESS) { xiaLogError("xiaExit", "Error shutting down communications", status); /* Ignore this status since we're on the way out */ } /* Other shutdown procedures go here */ status = xiaInitMemory(); status = dxp_init_ds(); return XIA_SUCCESS; }
/* * Frees the memory allocated to a Firmware structure. */ HANDEL_SHARED int HANDEL_API xiaFreeFirmware(Firmware *firmware) /* Firmware *firmware; Input: pointer to structure to free */ { int status = XIA_SUCCESS; if (firmware == NULL) { status = XIA_NOMEM; sprintf(info_string,"Firmware object unallocated: can not free"); xiaLogError("xiaFreeFirmware", info_string, status); return status; } if (firmware->dsp != NULL) { handel_md_free((void *)firmware->dsp); } if (firmware->fippi != NULL) { handel_md_free((void *)firmware->fippi); } if (firmware->user_fippi != NULL) { handel_md_free((void *)firmware->user_fippi); } if (firmware->user_dsp != NULL) { handel_md_free((void *)firmware->user_dsp); } if (firmware->system_fpga != NULL) { handel_md_free((void *)firmware->system_fpga); } if (firmware->filterInfo != NULL) { handel_md_free((void *)firmware->filterInfo); } handel_md_free((void *)firmware); firmware = NULL; return status; }
/* * Frees the memory allocated to an XiaDaqEntry structure. */ HANDEL_SHARED int HANDEL_API xiaFreeXiaDaqEntry(XiaDaqEntry *entry) { int status = XIA_SUCCESS; if (entry == NULL) { status = XIA_NOMEM; sprintf(info_string,"XiaDaqEntry object unallocated: can not free"); xiaLogError("xiaFreeXiaDaqEntry", info_string, status); return status; } if (entry->name != NULL) { handel_md_free(entry->name); } /* Free the XiaDaqEntry structure */ handel_md_free(entry); entry = NULL; return status; }
/* * Frees the Module data structure. */ HANDEL_STATIC int HANDEL_API xiaInitModuleDS(void) { int status; Module *current = NULL; Module *head = xiaModuleHead; current = head; while (current != NULL) { head = current; current = current->next; status = xiaFreeModule(head); if (status != XIA_SUCCESS) { xiaLogError("xiaInitModuleDS", "Error freeing module(s)", status); return status; } } xiaModuleHead = NULL; return XIA_SUCCESS; }
/* * Initializes the XiaDefaults structure. */ HANDEL_STATIC int HANDEL_API xiaInitXiaDefaultsDS(void) { int status = XIA_SUCCESS; XiaDefaults *next; XiaDefaults *current = xiaDefaultsHead; /* Search thru the XiaDefaults LL and clear them out */ while ((current != NULL) && (status == XIA_SUCCESS)) { next = current->next; status = xiaFreeXiaDefaults(current); if (status != XIA_SUCCESS) { xiaLogError("xiaInitXiaDefaultDS", "Error freeing default", status); return status; } current = next; } /* And clear out the pointer to the head of the list(the memory is freed) */ xiaDefaultsHead = NULL; return status; }
/* * Initializes the FirmwareSet data structures to an empty state. */ HANDEL_STATIC int HANDEL_API xiaInitFirmwareSetDS(void) { int status = XIA_SUCCESS; FirmwareSet *next; FirmwareSet *current = xiaFirmwareSetHead; /* Search thru the FirmwareSet LL and clear them out */ while ((current != NULL) && (status == XIA_SUCCESS)) { next = current->next; status = xiaFreeFirmwareSet(current); if (status != XIA_SUCCESS) { xiaLogError("xiaInitFirmwareSetDS", "Error freeing FirmwareSet", status); return status; } current = next; } xiaFirmwareSetHead = NULL; return status; }
/* * Initializes the Detector data structures to an empty state. */ HANDEL_STATIC int HANDEL_API xiaInitDetectorDS(void) { int status = XIA_SUCCESS; Detector *next = NULL; Detector *current = xiaDetectorHead; /* Search thru the Detector LL and clear them out */ while ((current != NULL) && (status == XIA_SUCCESS)) { next = current->next; status = xiaFreeDetector(current); if (status != XIA_SUCCESS) { xiaLogError("xiaInitDetectorDS", "Error freeing detector", status); return status; } current = next; } xiaDetectorHead = NULL; return status; }
/***************************************************************************** * * This routine adds information about a Default Item entry * *****************************************************************************/ HANDEL_SHARED int HANDEL_API xiaAddDefaultItem(char *alias, char *name, void *value) { int status = XIA_SUCCESS; XiaDefaults *chosen = NULL; XiaDaqEntry *prev = NULL; XiaDaqEntry *current = NULL; /* Locate the XiaDefaults entry first */ chosen = xiaFindDefault(alias); if (chosen == NULL) { status = XIA_NO_ALIAS; sprintf(info_string,"Alias %s has not been created.", alias); xiaLogError("xiaAddDefaultItem", info_string, status); return status; } /* Check that the value is not NULL. */ if (value == NULL) { status = XIA_BAD_VALUE; sprintf(info_string,"Value can not be NULL"); xiaLogError("xiaAddDefualtItem", info_string, status); return status; } if (name == NULL) { status = XIA_BAD_NAME; sprintf(info_string,"Name can not be NULL"); xiaLogError("xiaAddDefaultItem", info_string, status); return status; } /* Since its not easy to check all possible names, accept anything, an error * will be generated if an invalid name is used at a later time in program * execution. */ current = chosen->entry; if (current != NULL) { /* First check if the default exists already. If so, just modify and * return. */ /* Now find a match to the name. */ while (current!=NULL) { if (STREQ(name, current->name)) { break; } prev = current; current=current->next; } if (current != NULL) { /* Now modify the value. */ current->data = *((double *) value); status = XIA_SUCCESS; return status; } } /* If we are here, then we are at the end of the defaults list, else we found * a match and returned already. Time to allocate memory for a new entry. */ if (chosen->entry == NULL) { chosen->entry = (XiaDaqEntry *) handel_md_alloc(sizeof(XiaDaqEntry)); current = chosen->entry; } else { prev->next = (XiaDaqEntry *) handel_md_alloc(sizeof(XiaDaqEntry)); current = prev->next; } if (current == NULL) { status = XIA_NOMEM; xiaLogError("xiaAddDefaultItem", "Unable to allocate memory for DAQ entry", status); return status; } current->next = NULL; /* Create the name entry. */ current->name = (char *) handel_md_alloc((strlen(name)+1)*sizeof(char)); if (current->name == NULL) { status = XIA_NOMEM; xiaLogError("xiaAddDefaultItem", "Unable to allocate memory for current->name", status); return status; } strcpy(current->name, name); current->data = *((double *) value); current->pending = 0.0; current->state = AV_STATE_UNKNOWN; return XIA_SUCCESS; }
/* * Frees a previously allocated module and all if its subcomponents. * * Assumes module has been allocated. Does _not_ assume that all of * modules's subcomponents have. */ HANDEL_SHARED int HANDEL_API xiaFreeModule(Module *module) { int status; unsigned int i; unsigned int j; unsigned int k; unsigned int numDetStr; unsigned int numFirmStr; unsigned int numDefStr; PSLFuncs f; ASSERT(module != NULL); switch (module->interface_info->type) { default: /* Impossible */ FAIL(); break; case NO_INTERFACE: /* Only free the top-level struct */ ASSERT(module->interface_info != NULL); handel_md_free(module->interface_info); break; #ifndef EXCLUDE_PLX case PLX: handel_md_free(module->interface_info->info.plx); handel_md_free(module->interface_info); break; #endif /* EXCLUDE_PLX */ #ifndef EXCLUDE_EPP case EPP: case GENERIC_EPP: handel_md_free((void *)module->interface_info->info.epp); handel_md_free((void *)module->interface_info); break; #endif /* EXCLUDE_EPP */ #ifndef EXCLUDE_SERIAL case SERIAL: if (module->interface_info->info.serial->device_file) handel_md_free(module->interface_info->info.serial->device_file); handel_md_free((void *)module->interface_info->info.serial); handel_md_free((void *)module->interface_info); break; #endif /* EXCLUDE_SERIAL */ #ifndef EXCLUDE_USB case USB: handel_md_free((void *)module->interface_info->info.usb); handel_md_free((void *)module->interface_info); break; #endif /* EXCLUDE_USB */ #ifndef EXCLUDE_USB2 case USB2: handel_md_free((void *)module->interface_info->info.usb2); handel_md_free((void *)module->interface_info); break; #endif /* EXCLUDE_USB2 */ } module->interface_info = NULL; for (i = 0; i < module->number_of_channels; i++) { if (module->channels[i] != -1) { status = xiaRemoveDetChan((unsigned int)module->channels[i]); if (status != XIA_SUCCESS) { sprintf(info_string, "Error removing detChan member"); xiaLogError("xiaFreeModule", info_string, status); /* Should this continue since we'll leak memory if we return * prematurely? */ return status; } } } handel_md_free(module->channels); module->channels = NULL; if (module->detector != NULL) { numDetStr = module->number_of_channels; for (i = 0; i < numDetStr; i++) { handel_md_free((void *)module->detector[i]); } } handel_md_free((void *)module->detector); handel_md_free((void *)module->detector_chan); if (module->firmware != NULL) { numFirmStr = module->number_of_channels; for (j = 0; j < numFirmStr; j++) { handel_md_free((void *)module->firmware[j]); } } handel_md_free((void *)module->firmware); if (module->defaults != NULL) { numDefStr = module->number_of_channels; for (k = 0; k < numDefStr; k++) { /* Remove the defaults from the system */ status = xiaRemoveDefault(module->defaults[k]); if (status != XIA_SUCCESS) { sprintf(info_string, "Error removing values associated with modChan %u", k); xiaLogError("xiaFreeModule", info_string, status); return status; } handel_md_free((void *)module->defaults[k]); } } handel_md_free((void *)module->defaults); handel_md_free((void *)module->currentFirmware); /* Free up any multichannel info that was allocated */ if (module->isMultiChannel) { handel_md_free(module->state->runActive); handel_md_free(module->state); } /* If the type isn't set, then there is no * chance that any of the type-specific data is set * like the SCA data. */ if (module->type != NULL) { status = xiaLoadPSL(module->type, &f); if (status != XIA_SUCCESS) { sprintf(info_string, "Error loading PSL for '%s'", module->alias); xiaLogError("xiaFreeModule", info_string, status); return status; } if (module->ch != NULL) { for (i = 0; i < module->number_of_channels; i++) { status = f.freeSCAs(module, i); if (status != XIA_SUCCESS) { sprintf(info_string, "Error removing SCAs from modChan '%u', alias '%s'", i, module->alias); xiaLogError("xiaFreeModule", info_string, status); return status; } } handel_md_free(module->ch); } handel_md_free(module->type); module->type = NULL; } handel_md_free(module->alias); module->alias = NULL; /* This (freeing the module) was previously absent, which I think was causing a * small (16-bit) memory leak. */ handel_md_free(module); module = NULL; /* XXX If this is the last module, i.e. the # of detChans besides "-1" and * any "SET"s is 0, then release the rest of the detChan list. */ return XIA_SUCCESS; }
/***************************************************************************** * * This routine creates a new XiaDefaults entry * *****************************************************************************/ HANDEL_SHARED int HANDEL_API xiaNewDefault(char *alias) { int status = XIA_SUCCESS; XiaDefaults *current=NULL; /* If HanDeL isn't initialized, go ahead and call it... */ if (!isHandelInit) { status = xiaInitHandel(); if (status != XIA_SUCCESS) { fprintf(stderr, "FATAL ERROR: Unable to load libraries.\n"); exit(XIA_INITIALIZE); } xiaLogWarning("xiaNewDefault", "HanDeL was initialized silently"); } if ((strlen(alias) + 1) > MAXALIAS_LEN) { status = XIA_ALIAS_SIZE; sprintf(info_string, "Alias contains too many characters"); xiaLogError("xiaNewDefault", info_string, status); return status; } /* First check if this alias exists already? */ current = xiaFindDefault(alias); if (current != NULL) { status = XIA_ALIAS_EXISTS; sprintf(info_string,"Alias %s already in use.", alias); xiaLogError("xiaNewDefault", info_string, status); return status; } /* Check that the Head of the linked list exists */ if (xiaDefaultsHead == NULL) { /* Create an entry that is the Head of the linked list */ xiaDefaultsHead = (XiaDefaults *) handel_md_alloc(sizeof(XiaDefaults)); current = xiaDefaultsHead; } else { /* Find the end of the linked list */ current= xiaDefaultsHead; while (current->next != NULL) { current= current->next; } current->next = (XiaDefaults *) handel_md_alloc(sizeof(XiaDefaults)); current= current->next; } /* Make sure memory was allocated */ if (current == NULL) { status = XIA_NOMEM; sprintf(info_string,"Unable to allocate memory for default %s.", alias); xiaLogError("xiaNewDefault", info_string, status); return status; } /* Do any other allocations, or initialize to NULL/0 */ current->alias = (char *) handel_md_alloc((strlen(alias)+1)*sizeof(char)); if (current->alias == NULL) { status = XIA_NOMEM; xiaLogError("xiaNewDefault", "Unable to allocate memory for default->alias", status); return status; } strcpy(current->alias,alias); current->entry = NULL; current->next = NULL; return XIA_SUCCESS; }
HANDEL_EXPORT int HANDEL_API xiaInitHandel(void) { int status = XIA_SUCCESS; /* Arbitrary length here */ char version[120]; if (!isHandelInit) { /* Make sure the everything is working on the Xerxes side of things. */ status = dxp_init_library(); if (status != DXP_SUCCESS) { /* Use printf() here since dxp_md_error() won't be properly initialized until * I assign the function pointers to the imported utils variable */ printf("[ERROR] [%d] %s: %s\n", XIA_XERXES, "xiaInitHandel", "Unable to initialize XerXes libraries\n"); return XIA_XERXES; } /* Make our function pointers equal to XerXes function pointers using the * imported utils variable */ handel_md_log = utils->funcs->dxp_md_log; handel_md_output = utils->funcs->dxp_md_output; handel_md_enable_log = utils->funcs->dxp_md_enable_log; handel_md_suppress_log = utils->funcs->dxp_md_suppress_log; handel_md_set_log_level = utils->funcs->dxp_md_set_log_level; handel_md_alloc = utils->funcs->dxp_md_alloc; handel_md_free = utils->funcs->dxp_md_free; handel_md_puts = utils->funcs->dxp_md_puts; handel_md_wait = utils->funcs->dxp_md_wait; handel_md_fgets = utils->funcs->dxp_md_fgets; /* Init the FDD lib here */ status = xiaFddInitialize(); if (status != XIA_SUCCESS) { xiaLogError("xiaInitHandel", "Error initializing FDD layer", status); return status; } isHandelInit = TRUE_; } else { /* * Most user will be calling xiaInit after xiaInitHandel has already * executed from xiaSetLogLevel. To be safe the connection is always * re-initialized. */ xiaLogInfo("xiaInitHandel", "Closing off existing connections."); status = xiaUnHook(); } xiaLogInfo("xiaInitHandel", "Starting Handel"); /* Initialize the memory of both Handel and Xerxes. */ status = xiaInitMemory(); if (status != XIA_SUCCESS) { xiaLogError("xiaInitHandel", "Unable to Initialize memory", status); return status; } xiaGetVersionInfo(NULL, NULL, NULL, version); sprintf(info_string, "Successfully initialized Handel %s", version); xiaLogInfo("xiaInitHandel", info_string); return status; }