/*------------------------------------------------------------------------ P S I This is the site specific interface to SICS for PSI. This file implements the interface defined in ../site.h copyright: see file COPYRIGHT Mark Koennecke, June 2003 - May 2007 Modules initialized with an installation sics command are added to AddPsiCommands with SCMD. Modules initialized with a startup C command are added to SiteInit with INIT. There is no need to add include statements or prototype declarations for above items. However, for drivers added, we still need to declare the prototypes or include the header file. Markus Zolliker, Jan 2010 -----------------------------------------------------------------------*/ #include #include "sics.h" #include "site.h" #include #include #include "sinqhmdriv.i" #include "tdchm.h" #include "itc4.h" #include "bruker.h" #include "ltc11.h" #include "eurodriv.h" #include "el755driv.h" #include #include "serial.h" #include "sinqhttp.h" /*--------------------------------------------------------------------------*/ void SiteInit(void) { #define INIT(F) { void F(void); F(); } /* insert here initialization routines ... */ INIT(IlmStartup); INIT(IpsStartup); INIT(ItcStartup); INIT(IghStartup); INIT(Euro2kStartup); INIT(StrObjStartup); INIT(ArrayObjStartup); INIT(LinaStartup); INIT(HaakeStartup); /* INIT(MongoLogInit); */ /* * SICS specific Asynchronous I/O protocols */ INIT(AddSeaClientProtocol); INIT(AddDumProtocol); INIT(AddPhytronProtocoll); INIT(AddPfeifferProtocoll); } static pSite sitePSI = NULL; /* * from tclClock.c */ int Tcl_ClockObjCmd (ClientData client, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); /*----------------------------------------------------------------------*/ static void AddPsiCommands(SicsInterp * pInter) { /* declare and add permanent command */ #define PCMD(NAME, FUN) { \ int FUN(SConnection * pCon, SicsInterp * pSics, void *pData, \ int argc, char *argv[]); \ AddCommandWithFlag(pInter, NAME, FUN, NULL, NULL, 0); \ } /* declare and add startup command */ #define SCMD(NAME, FUN) { \ int FUN(SConnection * pCon, SicsInterp * pSics, void *pData, \ int argc, char *argv[]); \ AddCommandWithFlag(pInter, NAME, FUN, NULL, NULL, 1); \ } /* alphabetic order */ /* SCMD("SerialInit", SerialInit); */ PCMD("cnvrt", CnvrtAction); /* * Tcl 8.5 has implemented the clock command in tcl rather then C. * This includes the same command, backported from Tcl 8.4 */ Tcl_CreateObjCommand(InterpGetTcl(pServ->pSics), "clock", Tcl_ClockObjCmd, NULL, NULL); /* SCMD("MakeDifrac",MakeDifrac); */ } /*-------------------------------------------------------------------*/ static pMotor CreatePsiMotor(SConnection * pCon, int argc, char *argv[]) { pMotor pNew = NULL; return pNew; } /*-------------------------------------------------------------------*/ static pCounterDriver CreatePsiCounterDriver(SConnection * pCon, int argc, char *argv[]) { pCounterDriver pNew = NULL; return pNew; } /*-------------------------------------------------------------------*/ static pCodri CreatePsiController(SConnection * pCon, int argc, char *argv[]) { pCodri pNew = NULL; return pNew; } /*------------------------------------------------------------------*/ static pEVControl InstallPsiEnvironmentController(SicsInterp * pSics, SConnection * pCon, int argc, char *argv[]) { return NULL; } /*-----------------------------------------------------------------*/ static int ConfigurePsiScan(pScanData self, char *option) { return 0; } /*--------------------------------------------------------------------*/ static HistDriver *CreatePsiHistMem(char *name, pStringDict pOptions) { return NULL; } /*--------------------------------------------------------------------*/ static void KillPsi(void *site) { free(site); sitePSI = NULL; } /*--------------------------------------------------------------------- The scheme here goes along the lines of the singleton design pattern ---------------------------------------------------------------------*/ pSite getSite(void) { if (sitePSI == NULL) { sitePSI = (pSite) malloc(sizeof(Site)); /* we cannot go on if we do not even have enough memory to allocate the site data structure */ assert(sitePSI); /* initializing function pointers */ sitePSI->AddSiteCommands = AddPsiCommands; sitePSI->RemoveSiteCommands = NULL; sitePSI->CreateMotor = CreatePsiMotor; sitePSI->CreateCounterDriver = CreatePsiCounterDriver; sitePSI->CreateHistogramMemoryDriver = CreatePsiHistMem; sitePSI->CreateVelocitySelector = NULL; sitePSI->CreateControllerDriver = CreatePsiController; sitePSI->InstallEnvironmentController = InstallPsiEnvironmentController; sitePSI->ConfigureScan = ConfigurePsiScan; sitePSI->KillSite = KillPsi; } return sitePSI; }