Low-Energy Muon (LEM) Experiment
0.5.1
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include "midas.h"
#include "ps64.h"
Go to the source code of this file.
Data Structures | |
struct | PS64_INTERN |
Stores DD specific internal information. More... | |
struct | PS64_NAMES |
Stores the names of the various channels which are than transferred form the DD to the variable names. More... | |
struct | PS64_INFO |
This structure contains private variables for the device driver. More... | |
Macros | |
#define | LV_BIT0 0x0100 |
#define | LV_BIT1 0x0200 |
#define | LV_BIT2 0x0400 |
#define | LV_BIT3 0x0800 |
#define | LV_BIT4 0x1000 |
#define | LV_BIT5 0x2000 |
#define | LV_BIT6 0x4000 |
#define | LV_BIT7 0x8000 |
#define | LV_BIT8 0x0001 |
#define | LV_BIT9 0x0002 |
#define | LV_BIT10 0x0004 |
#define | LV_BIT11 0x0008 |
#define | LV_BIT12 0x0010 |
#define | LV_BIT13 0x0020 |
#define | LV_BIT14 0x0040 |
#define | LV_BIT15 0x0080 |
#define | PS64_LIFESIGN 0 |
#define | PS64_GP 1 |
#define | PS64_GS64 2 |
#define | PS64_SW1 3 |
#define | PS64_SW2 4 |
#define | SPS_MAX_BYTES 680 |
length of the data structure exchanged between SPS and midas More... | |
#define | PS64_TIME_CONST 0 |
trigger time constant for read out of the SPS More... | |
#define | PS64_TIMEOUT_ERROR 3600 |
after what time (sec.) read errors should be reported More... | |
#define | LAMVAC_INTERN_STR "\Detailed Messages = INT : 0\n\" |
Initializing string for the struct PS64_INTERN. More... | |
#define | PS64_NAMES_STR "\Input Names = STRING[5] : \n\[32] PS64 Life Sign\n\[32] PS64 GP Pirani\n\[32] PS64 GS64\n\[32] PS64 Status Word 1\n\[32] PS64 Status Word 2\n\Output Names = STRING : [32] PS64 Cmd\n\" |
Initializing string for the struct PS64_NAMES. More... | |
Functions | |
short | spsToNumber (unsigned char *buffer) |
int | spsToWord (unsigned char *buffer) |
double | ps64_pkr251 (int analog) |
double | ps64_pirani_tpr280 (int analog) |
BOOL | ps64_decode_data (PS64_INFO *info, const char *buffer) |
void | ps64_get_all (PS64_INFO *info) |
void | ps64_write_cmd (PS64_INFO *info) |
INT | ps64_in_init (HNDLE hKey, void **pinfo, INT channels, INT(*bd)(INT cmd,...)) |
INT | ps64_out_init (HNDLE hKey, void **pinfo, INT channels, INT(*bd)(INT cmd,...)) |
INT | ps64_exit (PS64_INFO *info) |
INT | ps64_in_get_label (PS64_INFO *info, INT channel, char *name) |
INT | ps64_out_get_label (PS64_INFO *info, INT channel, char *name) |
INT | ps64_get (PS64_INFO *info, INT channel, float *pvalue) |
void | ps64_start_pump (PS64_INFO *info) |
void | ps64_stop_pump (PS64_INFO *info) |
INT | ps64_set (PS64_INFO *info, INT channel, float value) |
INT | ps64_in (INT cmd,...) |
INT | ps64_out (INT cmd,...) |
Variables | |
PS64_INFO * | gInfo |
global info structure, in/out-init routines need the same structure More... | |
INT | ps64_sc_vent_state |
#define LAMVAC_INTERN_STR "\Detailed Messages = INT : 0\n\" |
Initializing string for the struct PS64_INTERN.
Definition at line 56 of file ps64.c.
Referenced by ps64_in_init().
#define PS64_GP 1 |
Definition at line 41 of file ps64.c.
Referenced by ps64_decode_data().
#define PS64_GS64 2 |
Definition at line 42 of file ps64.c.
Referenced by ps64_decode_data().
#define PS64_LIFESIGN 0 |
Definition at line 40 of file ps64.c.
Referenced by ps64_decode_data().
#define PS64_NAMES_STR "\Input Names = STRING[5] : \n\[32] PS64 Life Sign\n\[32] PS64 GP Pirani\n\[32] PS64 GS64\n\[32] PS64 Status Word 1\n\[32] PS64 Status Word 2\n\Output Names = STRING : [32] PS64 Cmd\n\" |
Initializing string for the struct PS64_NAMES.
Definition at line 67 of file ps64.c.
Referenced by ps64_in_init().
#define PS64_SW1 3 |
Definition at line 43 of file ps64.c.
Referenced by ps64_decode_data().
#define PS64_SW2 4 |
Definition at line 44 of file ps64.c.
Referenced by ps64_decode_data().
#define PS64_TIME_CONST 0 |
trigger time constant for read out of the SPS
Definition at line 47 of file ps64.c.
Referenced by ps64_get_all().
#define PS64_TIMEOUT_ERROR 3600 |
after what time (sec.) read errors should be reported
Definition at line 48 of file ps64.c.
Referenced by ps64_get_all().
#define SPS_MAX_BYTES 680 |
length of the data structure exchanged between SPS and midas
Definition at line 46 of file ps64.c.
Referenced by ps64_get_all(), and ps64_in_init().
BOOL ps64_decode_data | ( | PS64_INFO * | info, |
const char * | buffer | ||
) |
decodes the DB buffer and write it into an array which mirrors the midas input variables.
info | pointer to the DD info structure. |
buffer | pointer to the internal DB buffer structure. |
Definition at line 196 of file ps64.c.
References PS64_INFO::ps64_data, PS64_GP, PS64_GS64, PS64_LIFESIGN, ps64_pirani_tpr280(), ps64_pkr251(), PS64_SW1, PS64_SW2, spsToNumber(), and spsToWord().
Referenced by ps64_get_all().
INT ps64_exit | ( | PS64_INFO * | info | ) |
quits the bus driver and free's the memory allocated for the info structure
PS64_INFO
.
info | is a pointer to the DD specific info structure |
Definition at line 497 of file ps64.c.
References PS64_INFO::bd, PS64_INFO::bd_info, PS64_INFO::hDB, and PS64_INFO::hKey_DB_Buffer.
Referenced by ps64_in().
INT ps64_get | ( | PS64_INFO * | info, |
INT | channel, | ||
float * | pvalue | ||
) |
reads the status of the lem SPS vacuum control unit
info | is a pointer to the DD specific info structure |
channel | to be read back |
pvalue | pointer to the ODB value |
Definition at line 553 of file ps64.c.
References PS64_INTERN::detailed_msg, PS64_INFO::intern, PS64_INFO::ps64_data, ps64_get_all(), and PS64_IN_VARS.
Referenced by ps64_in().
void ps64_get_all | ( | PS64_INFO * | info | ) |
Establishes the communication to the SPS controll unit for reading, reads the data and stores them in the local structure
ps64_data
. Since the communication sometimes fails, an error protocol system is implemented as well. It record the errors over a period of 10 min. and sends them (cm_msg) to midas.
info | is a pointer to the DD specific info structure |
Definition at line 251 of file ps64.c.
References PS64_INFO::bd, PS64_INFO::bd_info, PS64_INTERN::detailed_msg, PS64_INFO::errTime, PS64_INFO::intern, PS64_INFO::last_success, PS64_INFO::ps64_buffer, ps64_decode_data(), PS64_INFO::ps64_diag, PS64_TIME_CONST, PS64_TIMEOUT_ERROR, PS64_INFO::read_counts, PS64_INFO::read_error, SPS_MAX_BYTES, PS64_INFO::tcpip_open_error, and PS64_INFO::time.
Referenced by ps64_get().
INT ps64_in | ( | INT | cmd, |
... | |||
) |
ps64 vacuum controller device driver (read routines) entry function. Establishes the communication with the SPS controll unit of the PS64 (QSM610-612) and reads the state of the pumps, valves, and the pressure values.
Definition at line 617 of file ps64.c.
References hKey, info, ps64_exit(), ps64_get(), ps64_in_get_label(), and ps64_in_init().
INT ps64_in_get_label | ( | PS64_INFO * | info, |
INT | channel, | ||
char * | name | ||
) |
at startup, after initialization of the DD, this routine allows to write default names into the ODB.
info | is a pointer to the DD specific info structure |
channel | of the name to be set |
name | pointer to the ODB name |
Definition at line 520 of file ps64.c.
References PS64_NAMES::in_name, and PS64_INFO::ps64_names.
Referenced by ps64_in().
INT ps64_in_init | ( | HNDLE | hKey, |
void ** | pinfo, | ||
INT | channels, | ||
INT(*)(INT cmd,...) | bd | ||
) |
Initializes the ps64 device driver for reading, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the ps64.
hKey | is the device driver handle given from the class driver |
**pinfo | is needed to store the internal info structure |
channels | is the number of channels of the device (from the class driver) |
*bd | is a pointer to the bus driver |
Definition at line 367 of file ps64.c.
References PS64_INFO::bd, PS64_INFO::bd_info, PS64_INTERN::detailed_msg, PS64_INFO::errTime, gInfo, PS64_INFO::hDB, hDB, hKey, PS64_INFO::hKey_DB_Buffer, PS64_INFO::hKey_in, PS64_INFO::intern, LAMVAC_INTERN_STR, PS64_INFO::last_success, PS64_INFO::ps64_buffer, PS64_INFO::ps64_names, PS64_NAMES_STR, PS64_INFO::read_counts, PS64_INFO::read_error, SPS_MAX_BYTES, PS64_INFO::tcpip_open_error, and PS64_INFO::time.
Referenced by ps64_in().
INT ps64_out | ( | INT | cmd, |
... | |||
) |
Definition at line 668 of file ps64.c.
References hKey, info, ps64_out_get_label(), ps64_out_init(), and ps64_set().
INT ps64_out_get_label | ( | PS64_INFO * | info, |
INT | channel, | ||
char * | name | ||
) |
at startup, after initialization of the DD, this routine allows to write default names into the ODB.
info | is a pointer to the DD specific info structure |
channel | of the name to be set |
name | pointer to the ODB name |
Definition at line 537 of file ps64.c.
References PS64_NAMES::out_name, and PS64_INFO::ps64_names.
Referenced by ps64_out().
INT ps64_out_init | ( | HNDLE | hKey, |
void ** | pinfo, | ||
INT | channels, | ||
INT(*)(INT cmd,...) | bd | ||
) |
Initializes the lemvac device driver for writing, i.e. generates all the necessary structures in the ODB if necessary, initializes the bus driver and the lemvac.
hKey | is the device driver handle given from the class driver |
**pinfo | is needed to store the internal info structure |
channels | is the number of channels of the device (from the class driver) |
*bd | is a pointer to the bus driver |
Definition at line 478 of file ps64.c.
References gInfo, hKey, and PS64_INFO::hKey_out.
Referenced by ps64_out().
double ps64_pirani_tpr280 | ( | int | analog | ) |
Conversion of the analog output (mV) of the Pirani TPR280 to real pressure in (mbar). The TPR280 has the same calibration curve as the TPR265!
analog | pressure in (mV) |
Definition at line 180 of file ps64.c.
Referenced by ps64_decode_data().
double ps64_pkr251 | ( | int | analog | ) |
Conversion of the analog output (mV) of the all range pressure gauge PKR 251 to real pressure in (mbar).
analog | pressure in (mV) |
Definition at line 166 of file ps64.c.
Referenced by ps64_decode_data().
INT ps64_set | ( | PS64_INFO * | info, |
INT | channel, | ||
float | value | ||
) |
Definition at line 593 of file ps64.c.
References PS64_INFO::hDB, hKey, ps64_start_pump(), and ps64_stop_pump().
Referenced by ps64_out().
void ps64_start_pump | ( | PS64_INFO * | info | ) |
Definition at line 574 of file ps64.c.
References PS64_INFO::ps64_buffer, and ps64_write_cmd().
Referenced by ps64_set().
void ps64_stop_pump | ( | PS64_INFO * | info | ) |
Definition at line 583 of file ps64.c.
References PS64_INFO::ps64_buffer, and ps64_write_cmd().
Referenced by ps64_set().
void ps64_write_cmd | ( | PS64_INFO * | info | ) |
sends a command from midas to the SPS. The command is encoded in the DB structure.
info | pointer to the DD info structure |
Definition at line 337 of file ps64.c.
References PS64_INFO::bd, PS64_INFO::bd_info, PS64_INTERN::detailed_msg, PS64_INFO::intern, PS64_INFO::ps64_buffer, and PS64_INFO::tcpip_open_error.
Referenced by ps64_start_pump(), and ps64_stop_pump().
short spsToNumber | ( | unsigned char * | buffer | ) |
int spsToWord | ( | unsigned char * | buffer | ) |
PS64_INFO* gInfo |