Low-Energy Muon (LEM) Experiment  0.5.1
twickenham.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "midas.h"
#include "twickenham.h"
#include "ets_logout.h"
Include dependency graph for twickenham.c:

Go to the source code of this file.

Data Structures

struct  TWICKENHAM_SETTINGS
 stores internal informations within the DD. More...
 
struct  TWICKENHAM_INFO
 This structure contains private variables for the device driver. More...
 

Macros

#define TWICKENHAM_ETS_LOGOUT_SLEEP   10000
 sleep time (us) between the telnet commands of the ets_logout More...
 
#define TWICKENHAM_READ_ERROR   -1
 read error tag More...
 
#define TWICKENHAM_DEBUG   FALSE
 
#define TIME_OUT_TWICKENHAM   2000
 be displayed at execution time More...
 
#define TWICKENHAM_MAX_READBACK_FAILURE   5
 maximum number of readback failures before a reconnect will take place More...
 
#define TWICKENHAM_SETTINGS_STR   "\Detailed Messages = INT : 0\n\ETS_IN_USE = INT : 1\n\Name = STRING : [32] HDI_Level\n\"
 initializing string for TWICKENHAM_SETTINGS More...
 

Functions

INT twickenham_init (HNDLE hKey, void **pinfo, INT channels, INT(*bd)(INT cmd,...))
 
INT twickenham_exit (TWICKENHAM_INFO *info)
 
INT twickenham_get (TWICKENHAM_INFO *info, INT channel, float *pvalue)
 
INT twickenham_get_label (TWICKENHAM_INFO *info, INT channel, char *name)
 
INT twickenham (INT cmd,...)
 

Macro Definition Documentation

#define TIME_OUT_TWICKENHAM   2000

be displayed at execution time

timeout in msecs for read action

Definition at line 35 of file twickenham.c.

Referenced by twickenham_get(), and twickenham_init().

#define TWICKENHAM_DEBUG   FALSE

debug tag, if set to TRUE, additional messages will

Definition at line 31 of file twickenham.c.

Referenced by twickenham_get(), and twickenham_init().

#define TWICKENHAM_ETS_LOGOUT_SLEEP   10000

sleep time (us) between the telnet commands of the ets_logout

Definition at line 25 of file twickenham.c.

Referenced by twickenham_get().

#define TWICKENHAM_MAX_READBACK_FAILURE   5

maximum number of readback failures before a reconnect will take place

Definition at line 38 of file twickenham.c.

Referenced by twickenham_get().

#define TWICKENHAM_READ_ERROR   -1

read error tag

Definition at line 29 of file twickenham.c.

Referenced by twickenham_get().

#define TWICKENHAM_SETTINGS_STR   "\Detailed Messages = INT : 0\n\ETS_IN_USE = INT : 1\n\Name = STRING : [32] HDI_Level\n\"

initializing string for TWICKENHAM_SETTINGS

Definition at line 48 of file twickenham.c.

Referenced by twickenham_init().

Function Documentation

INT twickenham ( INT  cmd,
  ... 
)

twickenham device driver (DD). It is handling the communication between the twickenham LN2 level meter and midas.

Definition at line 275 of file twickenham.c.

References hKey, info, twickenham_exit(), twickenham_get(), twickenham_get_label(), and twickenham_init().

INT twickenham_exit ( TWICKENHAM_INFO info)

terminates the bus driver and free's the memory allocated for the info structure TWICKENHAM_INFO.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure

Definition at line 162 of file twickenham.c.

References TWICKENHAM_INFO::bd, and TWICKENHAM_INFO::bd_info.

Referenced by twickenham().

INT twickenham_get ( TWICKENHAM_INFO info,
INT  channel,
float *  pvalue 
)
INT twickenham_get_label ( TWICKENHAM_INFO info,
INT  channel,
char *  name 
)

at startup, after initialization of the DD, this routine allows to write default names of the channels into the ODB.

Return: FE_SUCCESS

Parameters
infois a pointer to the DD specific info structure
channelof the name to be set
namepointer to the ODB name

Definition at line 266 of file twickenham.c.

References TWICKENHAM_SETTINGS::name, and TWICKENHAM_INFO::twickenham_settings.

Referenced by twickenham().

INT twickenham_init ( HNDLE  hKey,
void **  pinfo,
INT  channels,
INT(*)(INT cmd,...)  bd 
)

Initializes the twickenham device driver, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the twickenham controller.

Return:

  • FE_SUCCESS if everything went smooth
  • FE_ERR_ODB otherwise
Parameters
hKeyis the device driver handle given from the class driver
pinfois needed to store the internal info structure
channelsis the number of channels of the device (from the class driver)
bdis a pointer to the bus driver

Definition at line 86 of file twickenham.c.

References TWICKENHAM_INFO::bd, TWICKENHAM_INFO::bd_connected, TWICKENHAM_INFO::bd_info, TWICKENHAM_INFO::errorcount, hDB, TWICKENHAM_INFO::hkey, hKey, info, TWICKENHAM_INFO::last_reconnect, TWICKENHAM_INFO::lasterrtime, TWICKENHAM_SETTINGS::name, TWICKENHAM_INFO::num_channels, TWICKENHAM_INFO::readback_failure, TWICKENHAM_INFO::reconnection_failures, TIME_OUT_TWICKENHAM, TWICKENHAM_DEBUG, TWICKENHAM_INFO::twickenham_settings, and TWICKENHAM_SETTINGS_STR.

Referenced by twickenham().