adds frontend and makes some small modifications for the newer midas version and cpp
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
cmake_minimum_required(VERSION 3.03)
|
||||
|
||||
project(keller_dv2ps VERSION 1.0)
|
||||
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wformat=2
|
||||
-Wno-format-nonliteral
|
||||
-Wno-strict-aliasing
|
||||
-Wuninitialized
|
||||
-Wno-unused-function
|
||||
)
|
||||
|
||||
set(
|
||||
LIBS
|
||||
-lz
|
||||
-lpthread
|
||||
-lutil
|
||||
-lrt
|
||||
-ldl
|
||||
)
|
||||
|
||||
set(
|
||||
DRIVERS
|
||||
$ENV{MIDASSYS}/drivers/bus/tcpip.cxx
|
||||
$ENV{MIDASSYS}/drivers/class/multi.cxx
|
||||
)
|
||||
|
||||
add_executable(
|
||||
keller_dv2ps
|
||||
keller_dv2ps_scfe.cxx
|
||||
device/keller_dv2ps.cxx
|
||||
${DRIVERS}
|
||||
)
|
||||
|
||||
set_property(
|
||||
TARGET
|
||||
keller_dv2ps
|
||||
PROPERTY
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
keller_dv2ps
|
||||
PRIVATE
|
||||
$ENV{MIDASSYS}/drivers
|
||||
$ENV{MIDASSYS}/include
|
||||
$ENV{MIDASSYS}/mscb/include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
keller_dv2ps
|
||||
$ENV{MIDAS_PREFIX}/lib/libmfe.a
|
||||
$ENV{MIDAS_PREFIX}/lib/libmidas.a
|
||||
${LIBS}
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
# Keller dV-2 PS Digital Manometer
|
||||
|
||||
This repository contains the driver code and Midas frontend for the Keller dV-2
|
||||
PS Digital Manometer.
|
||||
|
||||
## Requirements
|
||||
|
||||
Requires a Midas installation with the environment variables `MIDASSYS` and
|
||||
`MIDAS_PREFIX` pointing to the source code and the built artifacts,
|
||||
respectively.
|
||||
|
||||
## Build
|
||||
|
||||
Clone this repository, enter the cloned directory, and then build via CMake.
|
||||
|
||||
```bash
|
||||
cmake -S "$(pwd)" -B <directory-to-build-in>
|
||||
cmake --build <directory-to-build-in> --clean-first -- -j8
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
/build/driver/keller_dv2ps -e flame
|
||||
```
|
||||
-849
@@ -1,849 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: langpib.c
|
||||
Created by: RA35
|
||||
|
||||
Contents: LAN/GPIB communication routines
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#define OMIT_MIDAS_RPC_CALL
|
||||
#include "midas.h"
|
||||
#include "msystem.h"
|
||||
#include "gpib_musr.h"
|
||||
#include "vxi11.h"
|
||||
#include "langpib.h"
|
||||
|
||||
|
||||
/* #define MIDEBUG */
|
||||
#define DELTA_TIME_ERROR 3600 //!< reset error counter after DELTA_TIME_ERROR seconds
|
||||
|
||||
static int debug_last = 0, debug_first = TRUE;
|
||||
|
||||
typedef struct {
|
||||
char server[256];
|
||||
int address;
|
||||
int locktmo;
|
||||
int debug;
|
||||
} LANGPIB_SETTINGS;
|
||||
|
||||
#define LANGPIB_SETTINGS_STR "\
|
||||
Server = STRING : [256] myhost.my.domain\n\
|
||||
Address = INT : 1\n\
|
||||
LockTMO = INT : 30000\n\
|
||||
Debug = INT : 0\n\
|
||||
"
|
||||
|
||||
typedef struct {
|
||||
LANGPIB_SETTINGS settings;
|
||||
gpibinfoPtr gpib; /* device handle */
|
||||
DWORD lasterrtime; //!< timer for error handling
|
||||
INT errorcount; //!< error counter
|
||||
} LANGPIB_INFO;
|
||||
|
||||
#define IO_TIMEOUT 10000
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_lock(LANGPIB_INFO * , int );
|
||||
INT langpib_unlock(LANGPIB_INFO * );
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
void langpib_debug(LANGPIB_INFO * info, char *dbg_str)
|
||||
{
|
||||
FILE *f;
|
||||
int delta;
|
||||
|
||||
if (debug_last == 0)
|
||||
delta = 0;
|
||||
else
|
||||
delta = ss_millitime() - debug_last;
|
||||
debug_last = ss_millitime();
|
||||
|
||||
f = fopen("langpib.log", "a");
|
||||
|
||||
if (debug_first)
|
||||
fprintf(f, "\n==== new session =============\n\n");
|
||||
debug_first = FALSE;
|
||||
if (dbg_str != NULL) {
|
||||
fprintf(f, "{%d} %s\n", delta, dbg_str);
|
||||
|
||||
if ((info != NULL) && (info->settings.debug > 1))
|
||||
printf("{%d} %s\n", delta, dbg_str);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
int langpib_reset_errorcount(LANGPIB_INFO *info)
|
||||
{
|
||||
if ( info != NULL) {
|
||||
DWORD nowtime, difftime;
|
||||
|
||||
nowtime = ss_time();
|
||||
if (nowtime > info->lasterrtime) {
|
||||
difftime = nowtime - info->lasterrtime;
|
||||
if (difftime > DELTA_TIME_ERROR) {
|
||||
info->errorcount = 0;
|
||||
info->lasterrtime = nowtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CM_SUCCESS;
|
||||
}
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
gpibinfoPtr langpib_open(char *server, int address, int rpctmo)
|
||||
{
|
||||
gpibinfoPtr lgpib;
|
||||
char addr[20];
|
||||
|
||||
lgpib = NULL;
|
||||
if ((server != NULL) && (strlen(server) > 0)) {
|
||||
sprintf(addr, "%d", address);
|
||||
/*
|
||||
* hpib = LAN/GPIB symbolic name
|
||||
* -1 = no secondary address
|
||||
* 0 = no device locking
|
||||
* 120000 = set large IO timeout (2min) to get a large RPC timeout
|
||||
* NOTE: make sure (lock timeout + IO timeout) < RPC timeout
|
||||
* when executing RPC call to LAN/GPIB device!
|
||||
*/
|
||||
|
||||
if (rpctmo < 120000)
|
||||
rpctmo = 120000;
|
||||
|
||||
lgpib = gpib_init(server, "hpib", addr, "-1", 0, rpctmo);
|
||||
if (lgpib == NULL) {
|
||||
cm_msg(MERROR, "langpib_open", "ERROR opening connection to LAN/GPIB");
|
||||
cm_msg_flush_buffer();
|
||||
} else {
|
||||
gpib_iotimeout(lgpib, IO_TIMEOUT, NULL); /* set IO timeout now */
|
||||
}
|
||||
}
|
||||
return lgpib;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int langpib_exit(LANGPIB_INFO * info)
|
||||
{
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
|
||||
if (info->gpib->locked > 0)
|
||||
gpib_reset_lock(info->gpib);
|
||||
|
||||
if (!gpib_close(&info->gpib)) {
|
||||
cm_msg(MERROR, "langpib_exit", "ERROR closing connection to LAN/GPIB");
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->gpib = NULL;
|
||||
}
|
||||
|
||||
if (info != NULL)
|
||||
free(info); /* RA35 05-NOV-2004 */
|
||||
|
||||
return CM_SUCCESS;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int langpib_write(LANGPIB_INFO * info, char *data, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info != NULL) {
|
||||
if (info->settings.debug) {
|
||||
char dbg_str[256];
|
||||
|
||||
sprintf(dbg_str, "write: ");
|
||||
for (i = 0; (int) i < MIN(size, (sizeof(dbg_str) - 8) / 3 - 1); i++)
|
||||
sprintf(dbg_str + strlen(dbg_str), "%X ", data[i]);
|
||||
|
||||
langpib_debug(info, dbg_str);
|
||||
}
|
||||
|
||||
i = -1;
|
||||
|
||||
if (info->gpib != NULL) {
|
||||
char *string;
|
||||
|
||||
string = (char *) malloc(size + 1);
|
||||
if (string != NULL) {
|
||||
long retval;
|
||||
|
||||
strncpy(string, data, size); /* copy string */
|
||||
*(string + size) = '\0'; /* add string terminator */
|
||||
|
||||
retval = gpib_send(info->gpib, info->settings.locktmo, string);
|
||||
|
||||
/* is there an error? */
|
||||
if (retval < 0) {
|
||||
char errorstr[40];
|
||||
|
||||
if (info->errorcount < 5) {
|
||||
cm_msg(MERROR, "langpib_write", "gpib_send to server returned \"%s\"",
|
||||
gpib_error(-retval, errorstr));
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->errorcount++;
|
||||
|
||||
if (retval == -VXI_IOTIMEOUT) i = 0; /* RA36 27-JAN-2006 */
|
||||
} else
|
||||
i = strlen(string);/*number of characters sent = occurence of first '\0'*/
|
||||
|
||||
free(string);
|
||||
|
||||
} else {
|
||||
cm_msg(MERROR, "langpib_write", "Not able to allocate string");
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
}
|
||||
} else
|
||||
i = -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int langpib_read(LANGPIB_INFO * info, char *data, int size, int millisec)
|
||||
{
|
||||
|
||||
int n;
|
||||
|
||||
n = -1;
|
||||
|
||||
if ((data != NULL) && (size > 0))
|
||||
memset(data, 0, size);
|
||||
|
||||
if ((info != NULL) && (data != NULL) && (size > 0)) {
|
||||
u_long ms, mso;
|
||||
u_int sz;
|
||||
long retval;
|
||||
|
||||
langpib_reset_errorcount(info);
|
||||
|
||||
if (millisec <= 0) {
|
||||
mso = info->gpib->iotimeoutms; /* save previous value */
|
||||
info->gpib->iotimeoutms = 0; /* set value directly as 0 is special and
|
||||
<0 not allowed */
|
||||
} else {
|
||||
ms = (u_long) millisec;
|
||||
gpib_iotimeout(info->gpib, ms, &mso); /* set IO timeout */
|
||||
}
|
||||
|
||||
sz = (u_int) size;
|
||||
/*
|
||||
* NOTE: buffer is read out until EOI mark, buffer size reached or timeout occurs.
|
||||
* if buffer size is reached additional readout will be discarded (flag = TRUE)!
|
||||
* NOTE: timeout is not waited for, if a message is available and EndOfInformation
|
||||
* mark is returned.
|
||||
*/
|
||||
retval = gpib_enter(info->gpib, info->settings.locktmo, data, &sz, TRUE);
|
||||
|
||||
gpib_iotimeout(info->gpib, mso, NULL); /* reset IO timeout */
|
||||
|
||||
if (retval > 0) {
|
||||
if (size > sz) /* if size==sz data WITHOUT string terminator! */
|
||||
*(data + sz) = '\0';
|
||||
|
||||
n = (int) sz; /* return number of characters */
|
||||
} else if (retval == 0)
|
||||
n = -1;
|
||||
else if (retval < 0) {
|
||||
if (retval == -VXI_IOTIMEOUT)
|
||||
n = 0; /* return 0= IO TIMEOUT */
|
||||
else
|
||||
n = -1; /* return error */
|
||||
}
|
||||
|
||||
if (info->settings.debug) {
|
||||
int i;
|
||||
char dbg_str[256];
|
||||
|
||||
sprintf(dbg_str, "read: ");
|
||||
|
||||
if (n == 0)
|
||||
sprintf(dbg_str + strlen(dbg_str), "<TIMEOUT>");
|
||||
else
|
||||
#ifdef BITOUT
|
||||
for (i = 0; i < MIN(n, (sizeof(dbg_str) - 7) / 3 - 1); i++)
|
||||
sprintf(dbg_str + strlen(dbg_str), "%X ", data[i]);
|
||||
#else
|
||||
sprintf(dbg_str + strlen(dbg_str), "%*s", MIN(n, ((INT)sizeof(dbg_str) - 8)),
|
||||
data);
|
||||
#endif
|
||||
langpib_debug(info, dbg_str);
|
||||
}
|
||||
} else
|
||||
n = -1;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int langpib_writeread(LANGPIB_INFO * info, char *str, int size, char *str1, INT size1,
|
||||
INT timeout)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = -1;
|
||||
|
||||
if (langpib_lock(info, 0) == CM_SUCCESS) {
|
||||
if (langpib_write(info, str, size) >= 0) {
|
||||
n = langpib_read(info, str1, size1, timeout);
|
||||
} else {
|
||||
if (info->errorcount < 5) {
|
||||
cm_msg(MERROR, "langpib_writeread","Not able to write to GPIB device %d on %s",
|
||||
info->settings.address, info->settings.server);
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->errorcount++;
|
||||
}
|
||||
langpib_unlock(info);
|
||||
} else {
|
||||
if (info->errorcount < 3) {
|
||||
cm_msg(MERROR, "langpib_writeread", "Not able to lock GPIB device %d on %s",
|
||||
info->settings.address, info->settings.server);
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->errorcount++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int langpib_puts(LANGPIB_INFO * info, char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info != NULL) {
|
||||
|
||||
if (info->settings.debug) {
|
||||
char dbg_str[256];
|
||||
|
||||
sprintf(dbg_str, "puts: %*s", (INT) MIN(strlen(str), sizeof(dbg_str) - 8), str);
|
||||
langpib_debug(info, dbg_str);
|
||||
}
|
||||
|
||||
i = -1;
|
||||
|
||||
if (info->gpib != NULL) {
|
||||
long retval;
|
||||
|
||||
retval = gpib_send(info->gpib, info->settings.locktmo, str);
|
||||
|
||||
/* is there an error? */
|
||||
if (retval < 0) {
|
||||
char errorstr[40];
|
||||
|
||||
if (info->errorcount < 5) {
|
||||
cm_msg(MERROR, "langpib_puts", "gpib_send %d to server %s returned \"%s\"",
|
||||
info->settings.address,info->settings.server,
|
||||
gpib_error(-retval, errorstr));
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->errorcount++;
|
||||
|
||||
if (retval == -VXI_IOTIMEOUT) i = 0; /* RA36 27-JAN-2006 */
|
||||
|
||||
} else
|
||||
i = strlen(str);
|
||||
}
|
||||
} else
|
||||
i = -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
int langpib_gets(LANGPIB_INFO * info, char *data, int size, char *pattern, int millisec)
|
||||
{
|
||||
fd_set readfds;
|
||||
struct timeval timeout;
|
||||
int i, status, n;
|
||||
|
||||
n = 0;
|
||||
|
||||
if ((data != NULL) && (size > 0))
|
||||
memset(data, 0, size);
|
||||
|
||||
if ((info != NULL) && (data != NULL) && (size > 0)) {
|
||||
u_long ms, mso;
|
||||
u_int sz;
|
||||
long retval;
|
||||
|
||||
langpib_reset_errorcount(info);
|
||||
|
||||
if (millisec <= 0) {
|
||||
mso = info->gpib->iotimeoutms; /* save previous value */
|
||||
info->gpib->iotimeoutms = 0; /* set value directly as 0 is special and <0 not allowed */
|
||||
} else {
|
||||
ms = (u_long) millisec;
|
||||
gpib_iotimeout(info->gpib, ms, &mso); /* set IO timeout */
|
||||
}
|
||||
|
||||
sz = (u_int) size;
|
||||
/*
|
||||
* NOTE: buffer is read out until EOI mark, buffer size reached or timeout occurs.
|
||||
* if buffer size is reached additional readout will be discarded (flag = TRUE)!
|
||||
* NOTE: timeout is not waited for, if a message is available and EndOfInformation
|
||||
* mark is returned.
|
||||
*/
|
||||
retval = gpib_enter(info->gpib, info->settings.locktmo, data, &sz, TRUE);
|
||||
|
||||
gpib_iotimeout(info->gpib, mso, NULL); /* reset IO timeout */
|
||||
|
||||
if (retval > 0) {
|
||||
/* discard rest of buffer after pattern is read */
|
||||
if (pattern && pattern[0]) {
|
||||
char *str;
|
||||
if ((str = strstr(data, pattern)) != NULL) {
|
||||
str += strlen(pattern);
|
||||
*str = '\0';
|
||||
sz = (str - data) / sizeof(char *);
|
||||
}
|
||||
}
|
||||
|
||||
if (size > sz) /* if size==sz data WITHOUT string terminator! */
|
||||
*(data + sz) = '\0';
|
||||
|
||||
n = (int) sz; /* return number of characters */
|
||||
} else if (retval == 0)
|
||||
n = -1;
|
||||
else if (retval < 0) {
|
||||
if (retval == -VXI_IOTIMEOUT)
|
||||
n = 0; /* return 0= IO TIMEOUT */
|
||||
else
|
||||
n = -1; /* return error */
|
||||
}
|
||||
|
||||
}
|
||||
if (info->settings.debug) {
|
||||
char dbg_str[256];
|
||||
|
||||
sprintf(dbg_str, "gets [%*s]: ", (INT) MIN(strlen(pattern), sizeof(dbg_str) - 10),
|
||||
pattern);
|
||||
|
||||
if (data[0] == 0) {
|
||||
if (strlen(dbg_str) < sizeof(dbg_str) - 10)
|
||||
sprintf(dbg_str + strlen(dbg_str), "<TIMEOUT>");
|
||||
} else {
|
||||
if (strlen(dbg_str) < (sizeof(dbg_str) - 1))
|
||||
sprintf(dbg_str + strlen(dbg_str), "%*s",
|
||||
(INT)MIN(sizeof(dbg_str) - 1 - strlen(dbg_str), strlen(data)), data);
|
||||
}
|
||||
langpib_debug(info, dbg_str);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_lock(LANGPIB_INFO * info, int tmo)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
if (tmo == 0)
|
||||
tmo = info->settings.locktmo;
|
||||
if (gpib_lock(info->gpib, -tmo)) /* RA35 15-SEP-2004 WAIT for lock */
|
||||
ret = CM_SUCCESS;
|
||||
else {
|
||||
if (info->errorcount < 3) {
|
||||
cm_msg(MERROR, "langpib_lock", "Not able to lock device %d on %s",
|
||||
info->settings.address, info->settings.server);
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->errorcount++;
|
||||
|
||||
ret = SS_IO_ERROR;
|
||||
}
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_lock_tmo(LANGPIB_INFO * info)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
ret = info->settings.locktmo;
|
||||
} else
|
||||
ret = 30000;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_unlock(LANGPIB_INFO * info)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
if (gpib_unlock(info->gpib))
|
||||
ret = CM_SUCCESS;
|
||||
else
|
||||
ret = SS_IO_ERROR;
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_resetlock(LANGPIB_INFO * info)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
if (gpib_reset_lock(info->gpib))
|
||||
ret = CM_SUCCESS;
|
||||
else
|
||||
ret = SS_IO_ERROR;
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_flush(LANGPIB_INFO * info, INT timeout)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
INT ltmo;
|
||||
if (info->gpib->locked > 0)
|
||||
ltmo = 0;
|
||||
else
|
||||
ltmo = info->settings.locktmo;
|
||||
|
||||
if (gpib_flush(info->gpib, ltmo, timeout)) {
|
||||
|
||||
gpib_wait(info->gpib, 100); /* wait 100 ms after IO timeout
|
||||
* to be sure device is ready */
|
||||
ret = CM_SUCCESS;
|
||||
} else
|
||||
ret = SS_IO_ERROR;
|
||||
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_ren(LANGPIB_INFO * info, INT flag)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
INT ltmo;
|
||||
if (info->gpib->locked > 0)
|
||||
ltmo = 0;
|
||||
else
|
||||
ltmo = info->settings.locktmo;
|
||||
|
||||
if (gpib_ren(info->gpib, ltmo, flag)) {
|
||||
|
||||
gpib_wait(info->gpib, 100); /* wait 100 ms after IO timeout
|
||||
* to be sure device is ready */
|
||||
ret = CM_SUCCESS;
|
||||
} else
|
||||
ret = SS_IO_ERROR;
|
||||
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_gotolocal(LANGPIB_INFO * info)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
INT ltmo;
|
||||
if (info->gpib->locked > 0)
|
||||
ltmo = 0;
|
||||
else
|
||||
ltmo = info->settings.locktmo;
|
||||
// 20-MAR-06 changed from -ltmo to +ltmo to avoid problems with already locked device
|
||||
if (gpib_device_local(info->gpib, ltmo)) {
|
||||
ret = CM_SUCCESS;
|
||||
} else
|
||||
ret = SS_IO_ERROR;
|
||||
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_reconnect(LANGPIB_INFO * info, INT waitms)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if (info != NULL) {
|
||||
INT locked;
|
||||
|
||||
locked = 0;
|
||||
if (info->gpib != NULL) {
|
||||
/* remember number of locks, then reset lock */
|
||||
if ((locked = info->gpib->locked) > 0)
|
||||
gpib_reset_lock(info->gpib);
|
||||
|
||||
if (!gpib_close(&info->gpib)) {
|
||||
cm_msg(MERROR, "langpib_reconnect", "ERROR closing connection to LAN/GPIB");
|
||||
cm_msg_flush_buffer();
|
||||
}
|
||||
info->gpib = NULL;
|
||||
}
|
||||
|
||||
if (waitms > 0)
|
||||
ss_sleep(waitms); /* wait some time before reconnect */
|
||||
|
||||
/* open LAN/GPIB connection */
|
||||
info->gpib = langpib_open(info->settings.server, info->settings.address,
|
||||
info->settings.locktmo + IO_TIMEOUT);
|
||||
|
||||
if (info->gpib != NULL) {
|
||||
INT i;
|
||||
|
||||
/* get as many locks as there were */
|
||||
for (i = 0; i < locked; i++) {
|
||||
if (!gpib_lock(info->gpib, info->settings.locktmo))
|
||||
break;
|
||||
}
|
||||
|
||||
cm_msg(MLOG, "langpib_reconnect", "Reconnected to LAN/GPIB device");
|
||||
cm_msg_flush_buffer();
|
||||
|
||||
info->errorcount = 0;
|
||||
info->lasterrtime = ss_time();
|
||||
|
||||
ret = CM_SUCCESS;
|
||||
} else {
|
||||
cm_msg(MERROR, "langpib_reconnect", "Failed to reconnect to LAN/GPIB!");
|
||||
cm_msg_flush_buffer();
|
||||
ret = SS_IO_ERROR;
|
||||
}
|
||||
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
INT langpib_stb(LANGPIB_INFO * info, INT *pstb)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
if ((info != NULL) && (info->gpib != NULL)) {
|
||||
INT ltmo;
|
||||
unsigned char stb;
|
||||
|
||||
if (info->gpib->locked > 0)
|
||||
ltmo = 0;
|
||||
else
|
||||
ltmo = info->settings.locktmo;
|
||||
|
||||
stb = 0;
|
||||
if (gpib_status(info->gpib, ltmo, &stb)) {
|
||||
|
||||
if (pstb) *pstb = stb; // return status byte
|
||||
|
||||
ret = CM_SUCCESS;
|
||||
} else
|
||||
ret = SS_IO_ERROR;
|
||||
|
||||
} else
|
||||
ret = SS_INVALID_HANDLE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int langpib_init(HNDLE hkey, void **pinfo)
|
||||
{
|
||||
HNDLE hDB, hkeybd;
|
||||
INT size, status;
|
||||
LANGPIB_INFO *info;
|
||||
|
||||
/* allocate info structure */
|
||||
info = calloc(1, sizeof(LANGPIB_INFO));
|
||||
*pinfo = info;
|
||||
|
||||
info->lasterrtime = ss_time();
|
||||
|
||||
cm_get_experiment_database(&hDB, NULL);
|
||||
|
||||
/* create LANGPIB settings record */
|
||||
status = db_create_record(hDB, hkey, "BD", LANGPIB_SETTINGS_STR);
|
||||
if (status != DB_SUCCESS)
|
||||
return FE_ERR_ODB;
|
||||
|
||||
db_find_key(hDB, hkey, "BD", &hkeybd);
|
||||
size = sizeof(info->settings);
|
||||
db_get_record(hDB, hkeybd, &info->settings, &size, 0);
|
||||
|
||||
/* open langpib connection */
|
||||
#ifdef MIDEBUG
|
||||
cm_msg(MLOG, "",
|
||||
"langpib_init : opening connection to %s, GPIB address = %d, RPC timeout = %d",
|
||||
info->settings.server, info->settings.address,
|
||||
info->settings.locktmo + IO_TIMEOUT);
|
||||
cm_msg_flush_buffer();
|
||||
#endif
|
||||
info->gpib = langpib_open(info->settings.server, info->settings.address,
|
||||
info->settings.locktmo + IO_TIMEOUT);
|
||||
if (info->gpib == NULL)
|
||||
return FE_ERR_HW;
|
||||
|
||||
return CM_SUCCESS;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
INT langpib(INT cmd, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
HNDLE hkey;
|
||||
INT status, size, size1, timeout, waitms, flag, *pstb;
|
||||
void *info;
|
||||
char *str, *str1, *pattern;
|
||||
|
||||
va_start(argptr, cmd);
|
||||
status = FE_SUCCESS;
|
||||
|
||||
#ifdef MIDEBUG
|
||||
cm_msg(MLOG, "", "langpib(CMD=%d)", cmd);
|
||||
#endif
|
||||
|
||||
switch (cmd) {
|
||||
case CMD_INIT:
|
||||
hkey = va_arg(argptr, HNDLE);
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_init(hkey, info);
|
||||
break;
|
||||
|
||||
case CMD_EXIT:
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_exit(info);
|
||||
break;
|
||||
|
||||
case CMD_NAME:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
strcpy(str, "langpib");
|
||||
break;
|
||||
|
||||
case CMD_WRITE:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
size = va_arg(argptr, int);
|
||||
status = langpib_write(info, str, size);
|
||||
break;
|
||||
|
||||
case CMD_WRITEREAD:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
size = va_arg(argptr, int);
|
||||
str1 = va_arg(argptr, char *);
|
||||
size1 = va_arg(argptr, INT);
|
||||
timeout = va_arg(argptr, INT);
|
||||
status = langpib_writeread(info, str, size, str1, size1, timeout);
|
||||
break;
|
||||
|
||||
case CMD_READ:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
size = va_arg(argptr, INT);
|
||||
timeout = va_arg(argptr, INT);
|
||||
status = langpib_read(info, str, size, timeout);
|
||||
break;
|
||||
|
||||
case CMD_PUTS:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
status = langpib_puts(info, str);
|
||||
break;
|
||||
|
||||
case CMD_GETS:
|
||||
info = va_arg(argptr, void *);
|
||||
str = va_arg(argptr, char *);
|
||||
size = va_arg(argptr, INT);
|
||||
pattern = va_arg(argptr, char *);
|
||||
timeout = va_arg(argptr, INT);
|
||||
status = langpib_gets(info, str, size, pattern, timeout);
|
||||
break;
|
||||
|
||||
case CMD_LOCK:
|
||||
info = va_arg(argptr, void *);
|
||||
timeout = va_arg(argptr, INT);
|
||||
status = langpib_lock(info, timeout);
|
||||
break;
|
||||
|
||||
case CMD_LOCK_TMO:
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_lock_tmo(info);
|
||||
break;
|
||||
|
||||
case CMD_UNLOCK:
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_unlock(info);
|
||||
break;
|
||||
|
||||
case CMD_RESETLOCK:
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_resetlock(info);
|
||||
break;
|
||||
|
||||
case CMD_FLUSH:
|
||||
info = va_arg(argptr, void *);
|
||||
timeout = va_arg(argptr, INT);
|
||||
status = langpib_flush(info, timeout);
|
||||
break;
|
||||
|
||||
case CMD_REN:
|
||||
info = va_arg(argptr, void *);
|
||||
flag = va_arg(argptr, INT);
|
||||
status = langpib_ren(info, flag);
|
||||
break;
|
||||
|
||||
case CMD_GOTOLOCAL:
|
||||
info = va_arg(argptr, void *);
|
||||
status = langpib_gotolocal(info);
|
||||
break;
|
||||
|
||||
case CMD_RECONNECT:
|
||||
info = va_arg(argptr, void *);
|
||||
waitms = va_arg(argptr, INT);
|
||||
status = langpib_reconnect(info, waitms);
|
||||
break;
|
||||
|
||||
case CMD_STB:
|
||||
info = va_arg(argptr, void *);
|
||||
pstb = va_arg(argptr, INT *);
|
||||
status = langpib_stb(info, pstb);
|
||||
break;
|
||||
|
||||
case CMD_DEBUG:
|
||||
info = va_arg(argptr, void *);
|
||||
status = va_arg(argptr, INT);
|
||||
((LANGPIB_INFO *) info)->settings.debug = status;
|
||||
break;
|
||||
}
|
||||
|
||||
va_end(argptr);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: langpib.h
|
||||
Created by: RA35
|
||||
|
||||
Contents: Header file for "normal" lan/gpib bus driver
|
||||
|
||||
Revision 1.1 2017/01/24 15:39:53 raselli
|
||||
Original Midas 1.9.5 version
|
||||
|
||||
Revision 1.8 2016/09/09 13:11:51 raselli
|
||||
Bulk musr 09-SEP-2016
|
||||
|
||||
Revision 1.1 2001/02/26 13:58:06 midas
|
||||
Added files
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#define CMD_WRITEREAD 200
|
||||
#define CMD_LOCK 201
|
||||
#define CMD_UNLOCK 202
|
||||
#define CMD_RESETLOCK 203
|
||||
#define CMD_FLUSH 204
|
||||
#define CMD_LOCK_TMO 205
|
||||
#define CMD_RECONNECT 206
|
||||
#define CMD_GOTOLOCAL 207
|
||||
#define CMD_REN 208
|
||||
#define CMD_STB 209
|
||||
|
||||
#ifdef BD_READS
|
||||
#undef BD_READS // there is a bug in midas.h
|
||||
#endif
|
||||
|
||||
// redefine macro
|
||||
#define BD_READS(s,z,t) info->bd(CMD_READ, info->bd_info, s, z, t)
|
||||
|
||||
#define BD_WRITEREAD(s,z,s1,z1,t) info->bd(CMD_WRITEREAD, info->bd_info, s, z, s1, z1, t)
|
||||
|
||||
#define BD_LOCK(t) info->bd(CMD_LOCK, info->bd_info, t)
|
||||
#define BD_UNLOCK() info->bd(CMD_UNLOCK, info->bd_info)
|
||||
#define BD_RESETLOCK(s) info->bd(CMD_RESETLOCK, info->bd_info)
|
||||
#define BD_LOCK_TMO() info->bd(CMD_LOCK_TMO, info->bd_info)
|
||||
|
||||
#define BD_FLUSH(t) info->bd(CMD_FLUSH, info->bd_info, t)
|
||||
|
||||
#define BD_RECONNECT(t) info->bd(CMD_RECONNECT, info->bd_info, t)
|
||||
|
||||
#define BD_GOTOLOCAL() info->bd(CMD_GOTOLOCAL, info->bd_info)
|
||||
|
||||
#define BD_REN(f) info->bd(CMD_REN, info->bd_info, f)
|
||||
|
||||
#define BD_STB(s) info->bd(CMD_STB, info->bd_info, s)
|
||||
|
||||
INT langpib(INT cmd, ...);
|
||||
-1407
File diff suppressed because it is too large
Load Diff
-46
@@ -1,46 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: tcpip.h
|
||||
Created by: Stefan Ritt
|
||||
|
||||
Contents: Header file for TCPIP bus driver
|
||||
|
||||
$Id: tcpip.h,v 1.1.1.1 2019/02/21 10:07:20 raselli Exp $
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef _TCPIP_H_
|
||||
#define _TCPIP_H_
|
||||
|
||||
INT tcpip(INT cmd, ...);
|
||||
|
||||
#endif /* #ifndef _TCPIP_H_ */
|
||||
|
||||
#ifdef TCPIP_RECONNECT
|
||||
|
||||
#ifndef _TCPIP_PRIVATE_H_
|
||||
#define _TCPIP_PRIVATE_H_
|
||||
|
||||
typedef struct {
|
||||
char host[256];
|
||||
int port;
|
||||
int debug;
|
||||
} TCPIP_SETTINGS;
|
||||
|
||||
typedef struct {
|
||||
TCPIP_SETTINGS settings;
|
||||
int fd; /* device handle for socket device */
|
||||
} TCPIP_INFO;
|
||||
|
||||
int tcpip_connect(char *host, int port);
|
||||
|
||||
int tcpip_open(TCPIP_INFO * info);
|
||||
int tcpip_close(TCPIP_INFO * info);
|
||||
|
||||
int tcpip_fd_get(TCPIP_INFO * info);
|
||||
|
||||
#endif /* #ifndef _TCPIP_PRIVATE_H_ */
|
||||
|
||||
#endif /* #ifdef TCPIP_RECONNECT */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
||||
/*******************************************************************\
|
||||
|
||||
Name: keller_dv2ps_scfe.cxx
|
||||
Created by: Edward Wall
|
||||
Contents: Slow Control Frontend for Keller dV 2PS Manometer
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#include "midas.h"
|
||||
#include "mfe.h"
|
||||
|
||||
#include "bus/tcpip.h"
|
||||
#include "class/multi.h"
|
||||
|
||||
#include "device/keller_dv2ps.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Global Variables Required by mfe.h
|
||||
******************************************************************************/
|
||||
|
||||
//! The frontend name (client name) as seen by other MIDAS clients
|
||||
const char *frontend_name = "Keller_dV-2_PS";
|
||||
|
||||
//! The frontend file name, don't change it
|
||||
const char *frontend_file_name = __FILE__;
|
||||
|
||||
//! frontend_loop is called periodically if this variable is TRUE
|
||||
BOOL frontend_call_loop = FALSE;
|
||||
|
||||
//! a frontend status page is displayed with this frequency in ms
|
||||
INT display_period = 1000;
|
||||
|
||||
//! maximum event size produced by this frontend
|
||||
INT max_event_size = 10000;
|
||||
|
||||
//! maximum event size for fragmented events (EQ_FRAGMENTED)
|
||||
INT max_event_size_frag = 5 * 1024 * 1024;
|
||||
|
||||
//! buffer size to hold events
|
||||
INT event_buffer_size = 10 * 10000;
|
||||
|
||||
/*******************************************************************************
|
||||
* Equipment List Required by mfe.h
|
||||
******************************************************************************/
|
||||
|
||||
DEVICE_DRIVER manometer_driver[] = {
|
||||
// { name, *dd, channels, *bd, flags }
|
||||
{"Keller_dv2ps_inp", keller_dv2ps, 4, tcpip, DF_INPUT}};
|
||||
|
||||
/*!
|
||||
* equipment_common_overwrite:
|
||||
*
|
||||
* - If that flag is TRUE, then the contents of the "equipment" structure is
|
||||
* copied to the ODB on each start of the front-end.
|
||||
*
|
||||
* - If the flag is FALSE, then the ODB values are kept on the start of the
|
||||
* front-end
|
||||
*/
|
||||
BOOL equipment_common_overwrite = FALSE;
|
||||
|
||||
/*******************************************************************************
|
||||
* Equipment Structure Required by mfe.h
|
||||
******************************************************************************/
|
||||
|
||||
EQUIPMENT equipment[] = {
|
||||
{
|
||||
"Manometer", /* equipment name */
|
||||
{
|
||||
160, /* Event ID associated with equipm. */
|
||||
0, /* Trigger mask */
|
||||
"SYSTEM", /* Event buffer to send events into */
|
||||
EQ_SLOW, /* equipment type */
|
||||
0, /* Event source (LAM/IRQ) */
|
||||
"FIXED", /* Data format to produce */
|
||||
TRUE, /* Enable flag */
|
||||
RO_RUNNING |
|
||||
RO_TRANSITIONS, /* Combination of Read-On flags RO_xxx */
|
||||
10000, /* Readout interval/Polling time in ms */
|
||||
0, /* Stop run when limit is reached */
|
||||
0, /* Number of events in super event */
|
||||
1, /* log history every event */
|
||||
"", /* Host on which FE is running */
|
||||
"", /* Frontend name */
|
||||
"" /* Source file used for user FE */
|
||||
},
|
||||
cd_multi_read, /* readout routine */
|
||||
cd_multi, /* class driver main routine */
|
||||
manometer_driver, /* device driver list */
|
||||
NULL, /* init string */
|
||||
},
|
||||
{""}};
|
||||
|
||||
/*******************************************************************************
|
||||
* Routines Required by mfe.h
|
||||
*
|
||||
* Can be overwritten to modify the default frontend behaviour.
|
||||
******************************************************************************/
|
||||
|
||||
INT poll_event(INT source, INT count, BOOL test) { return CM_SUCCESS; };
|
||||
|
||||
INT interrupt_configure(INT cmd, INT source, POINTER_T adr) {
|
||||
return CM_SUCCESS;
|
||||
};
|
||||
|
||||
INT frontend_init() {
|
||||
// de-register run-transition notifications
|
||||
cm_deregister_transition(TR_START);
|
||||
cm_deregister_transition(TR_STOP);
|
||||
cm_deregister_transition(TR_PAUSE);
|
||||
cm_deregister_transition(TR_RESUME);
|
||||
|
||||
return CM_SUCCESS;
|
||||
}
|
||||
|
||||
INT frontend_loop() { return CM_SUCCESS; }
|
||||
|
||||
INT frontend_exit() { return CM_SUCCESS; }
|
||||
|
||||
INT begin_of_run(INT run_number, char *error) { return CM_SUCCESS; }
|
||||
|
||||
INT pause_run(INT run_number, char *error) { return CM_SUCCESS; }
|
||||
|
||||
INT resume_run(INT run_number, char *error) { return CM_SUCCESS; }
|
||||
|
||||
INT end_of_run(INT run_number, char *error) { return CM_SUCCESS; }
|
||||
-2198
File diff suppressed because it is too large
Load Diff
-653
@@ -1,653 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: MSYSTEM.H
|
||||
Created by: Stefan Ritt
|
||||
|
||||
Contents: Function declarations and constants for internal
|
||||
routines
|
||||
|
||||
$Id: msystem.h,v 1.1.1.1 2019/02/21 10:07:22 raselli Exp $
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @file msystem.h
|
||||
The Midas System include file
|
||||
*/
|
||||
|
||||
/** @defgroup msystemincludecode The msystem.h & system.c
|
||||
*/
|
||||
/** @defgroup msdefineh System Define
|
||||
*/
|
||||
/** @defgroup msmacroh System Macros
|
||||
*/
|
||||
/** @defgroup mssectionh System Structure Declaration
|
||||
*/
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @addtogroup msystemincludecode
|
||||
*
|
||||
* @{ */
|
||||
|
||||
/**dox***************************************************************/
|
||||
#ifndef _MSYSTEM_H_
|
||||
#define _MSYSTEM_H_
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
#include "midasinc.h"
|
||||
|
||||
/**dox***************************************************************/
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @addtogroup msdefineh
|
||||
*
|
||||
* @{ */
|
||||
|
||||
/**
|
||||
data representations
|
||||
*/
|
||||
#define DRI_16 (1<<0) /**< - */
|
||||
#define DRI_32 (1<<1) /**< - */
|
||||
#define DRI_64 (1<<2) /**< - */
|
||||
#define DRI_LITTLE_ENDIAN (1<<3) /**< - */
|
||||
#define DRI_BIG_ENDIAN (1<<4) /**< - */
|
||||
#define DRF_IEEE (1<<5) /**< - */
|
||||
#define DRF_G_FLOAT (1<<6) /**< - */
|
||||
#define DR_ASCII (1<<7) /**< - */
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @} *//* end of msdefineh */
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @addtogroup msmacroh
|
||||
*
|
||||
* @{ */
|
||||
|
||||
/* Byte and Word swapping big endian <-> little endian */
|
||||
/**
|
||||
SWAP WORD macro */
|
||||
#ifndef WORD_SWAP
|
||||
#define WORD_SWAP(x) { BYTE _tmp; \
|
||||
_tmp= *((BYTE *)(x)); \
|
||||
*((BYTE *)(x)) = *(((BYTE *)(x))+1); \
|
||||
*(((BYTE *)(x))+1) = _tmp; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
SWAP DWORD macro */
|
||||
#ifndef DWORD_SWAP
|
||||
#define DWORD_SWAP(x) { BYTE _tmp; \
|
||||
_tmp= *((BYTE *)(x)); \
|
||||
*((BYTE *)(x)) = *(((BYTE *)(x))+3); \
|
||||
*(((BYTE *)(x))+3) = _tmp; \
|
||||
_tmp= *(((BYTE *)(x))+1); \
|
||||
*(((BYTE *)(x))+1) = *(((BYTE *)(x))+2); \
|
||||
*(((BYTE *)(x))+2) = _tmp; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
SWAP QWORD macro */
|
||||
#ifndef QWORD_SWAP
|
||||
#define QWORD_SWAP(x) { BYTE _tmp; \
|
||||
_tmp= *((BYTE *)(x)); \
|
||||
*((BYTE *)(x)) = *(((BYTE *)(x))+7); \
|
||||
*(((BYTE *)(x))+7) = _tmp; \
|
||||
_tmp= *(((BYTE *)(x))+1); \
|
||||
*(((BYTE *)(x))+1) = *(((BYTE *)(x))+6); \
|
||||
*(((BYTE *)(x))+6) = _tmp; \
|
||||
_tmp= *(((BYTE *)(x))+2); \
|
||||
*(((BYTE *)(x))+2) = *(((BYTE *)(x))+5); \
|
||||
*(((BYTE *)(x))+5) = _tmp; \
|
||||
_tmp= *(((BYTE *)(x))+3); \
|
||||
*(((BYTE *)(x))+3) = *(((BYTE *)(x))+4); \
|
||||
*(((BYTE *)(x))+4) = _tmp; }
|
||||
#endif
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @} *//* end of msmacroh */
|
||||
|
||||
/**dox***************************************************************/
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/**
|
||||
Definition of implementation specific constants */
|
||||
#define MESSAGE_BUFFER_SIZE 100000 /**< buffer used for messages */
|
||||
#define MESSAGE_BUFFER_NAME "SYSMSG" /**< buffer name for messages */
|
||||
#define MAX_RPC_CONNECTION 64 /**< server/client connections */
|
||||
#define MAX_STRING_LENGTH 256 /**< max string length for odb */
|
||||
#define NET_BUFFER_SIZE (8*1024*1024) /**< size of network receive buffers */
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* flag for conditional compilation of debug messages */
|
||||
#undef DEBUG_MSG
|
||||
|
||||
/* flag for local routines (not for pure network clients) */
|
||||
#if !defined ( OS_MSDOS ) && !defined ( OS_VXWORKS )
|
||||
#define LOCAL_ROUTINES
|
||||
#endif
|
||||
|
||||
/* YBOS support not in MSDOS */
|
||||
#if !defined ( OS_MSDOS )
|
||||
#define YBOS_SUPPORT
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/* Mapping of function names for socket operations */
|
||||
|
||||
#ifdef OS_MSDOS
|
||||
|
||||
#define closesocket(s) close(s)
|
||||
#define ioctlsocket(s,c,d) ioctl(s,c,d)
|
||||
#define malloc(i) farmalloc(i)
|
||||
|
||||
#undef NET_TCP_SIZE
|
||||
#define NET_TCP_SIZE 0x7FFF
|
||||
|
||||
#endif /* OS_MSDOS */
|
||||
|
||||
#ifdef OS_VMS
|
||||
|
||||
#define closesocket(s) close(s)
|
||||
#define ioctlsocket(s,c,d)
|
||||
|
||||
#ifndef FD_SET
|
||||
typedef struct {
|
||||
INT fds_bits;
|
||||
} fd_set;
|
||||
|
||||
#define FD_SET(n, p) ((p)->fds_bits |= (1 << (n)))
|
||||
#define FD_CLR(n, p) ((p)->fds_bits &= ~(1 << (n)))
|
||||
#define FD_ISSET(n, p) ((p)->fds_bits & (1 << (n)))
|
||||
#define FD_ZERO(p) ((p)->fds_bits = 0)
|
||||
#endif /* FD_SET */
|
||||
|
||||
#endif /* OS_VMS */
|
||||
|
||||
/* Missing #defines in VMS */
|
||||
|
||||
#ifdef OS_VMS
|
||||
|
||||
#define P_WAIT 0
|
||||
#define P_NOWAIT 1
|
||||
#define P_DETACH 4
|
||||
|
||||
#endif
|
||||
|
||||
/* and for UNIX */
|
||||
|
||||
#ifdef OS_UNIX
|
||||
|
||||
#define closesocket(s) close(s)
|
||||
#define ioctlsocket(s,c,d) ioctl(s,c,d)
|
||||
#ifndef stricmp
|
||||
#define stricmp(s1, s2) strcasecmp(s1, s2)
|
||||
#endif
|
||||
|
||||
#define P_WAIT 0
|
||||
#define P_NOWAIT 1
|
||||
#define P_DETACH 4
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 32
|
||||
#endif
|
||||
|
||||
/* and VXWORKS */
|
||||
|
||||
#ifdef OS_VXWORKS
|
||||
|
||||
#define P_NOWAIT 1
|
||||
#define closesocket(s) close(s)
|
||||
#define ioctlsocket(s,c,d) ioctl(s,c,d)
|
||||
|
||||
#endif
|
||||
|
||||
/* missing O_BINARY for non-PC */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#define O_TEXT 0
|
||||
#endif
|
||||
|
||||
/* min/max/abs macros */
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
/* missing tell() for some operating systems */
|
||||
#define TELL(fh) lseek(fh, 0, SEEK_CUR)
|
||||
|
||||
/* define file truncation */
|
||||
#ifdef OS_WINNT
|
||||
#define TRUNCATE(fh) chsize(fh, TELL(fh))
|
||||
#else
|
||||
#define TRUNCATE(fh) ftruncate(fh, TELL(fh))
|
||||
#endif
|
||||
|
||||
/* reduced shared memory size */
|
||||
#ifdef OS_SOLARIS
|
||||
#define MAX_SHM_SIZE 0x20000 /* 128k */
|
||||
#endif
|
||||
|
||||
/* missing isnan() & co under Windows */
|
||||
#ifdef OS_WINNT
|
||||
#include <float.h>
|
||||
#define isnan(x) _isnan(x)
|
||||
#define isinf(x) (!_finite(x))
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define ftruncate(x,y) _chsize(x,y)
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/* Network structures */
|
||||
|
||||
typedef struct {
|
||||
DWORD routine_id; /* routine ID like ID_BM_xxx */
|
||||
DWORD param_size; /* size in Bytes of parameter */
|
||||
} NET_COMMAND_HEADER;
|
||||
|
||||
typedef struct {
|
||||
NET_COMMAND_HEADER header;
|
||||
char param[32]; /* parameter array */
|
||||
} NET_COMMAND;
|
||||
|
||||
|
||||
typedef struct {
|
||||
DWORD serial_number;
|
||||
DWORD sequence_number;
|
||||
} UDP_HEADER;
|
||||
|
||||
#define UDP_FIRST 0x80000000l
|
||||
#define TCP_FAST 0x80000000l
|
||||
|
||||
#define MSG_BM 1
|
||||
#define MSG_ODB 2
|
||||
#define MSG_CLIENT 3
|
||||
#define MSG_SERVER 4
|
||||
#define MSG_LISTEN 5
|
||||
#define MSG_WATCHDOG 6
|
||||
|
||||
/* RPC structures */
|
||||
|
||||
struct callback_addr {
|
||||
char host_name[HOST_NAME_LENGTH];
|
||||
unsigned short host_port1;
|
||||
unsigned short host_port2;
|
||||
unsigned short host_port3;
|
||||
int debug;
|
||||
char experiment[NAME_LENGTH];
|
||||
char directory[MAX_STRING_LENGTH];
|
||||
char user[NAME_LENGTH];
|
||||
INT index;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char host_name[HOST_NAME_LENGTH]; /* server name */
|
||||
INT port; /* ip port */
|
||||
char exp_name[NAME_LENGTH]; /* experiment to connect */
|
||||
int send_sock; /* tcp send socket */
|
||||
int connected; /* socket is connected */
|
||||
INT remote_hw_type; /* remote hardware type */
|
||||
char client_name[NAME_LENGTH]; /* name of remote client */
|
||||
INT transport; /* RPC_TCP/RPC_FTCP */
|
||||
INT rpc_timeout; /* in milliseconds */
|
||||
|
||||
} RPC_CLIENT_CONNECTION;
|
||||
|
||||
typedef struct {
|
||||
char host_name[HOST_NAME_LENGTH]; /* server name */
|
||||
INT port; /* ip port */
|
||||
char exp_name[NAME_LENGTH]; /* experiment to connect */
|
||||
int send_sock; /* tcp send socket */
|
||||
int recv_sock; /* tcp receive socket */
|
||||
int event_sock; /* event socket */
|
||||
INT remote_hw_type; /* remote hardware type */
|
||||
INT transport; /* RPC_TCP/RPC_FTCP */
|
||||
INT rpc_timeout; /* in milliseconds */
|
||||
|
||||
} RPC_SERVER_CONNECTION;
|
||||
|
||||
typedef struct {
|
||||
INT tid; /* thread id */
|
||||
char prog_name[NAME_LENGTH]; /* client program name */
|
||||
char host_name[HOST_NAME_LENGTH]; /* client name */
|
||||
int send_sock; /* tcp send socket */
|
||||
int recv_sock; /* tcp receive socket */
|
||||
int event_sock; /* tcp event socket */
|
||||
INT remote_hw_type; /* hardware type */
|
||||
INT transport; /* RPC_TCP/RPC_FTCP */
|
||||
INT watchdog_timeout; /* in milliseconds */
|
||||
DWORD last_activity; /* time of last recv */
|
||||
INT convert_flags; /* convertion flags */
|
||||
char *net_buffer; /* TCP cache buffer */
|
||||
char *ev_net_buffer;
|
||||
INT net_buffer_size; /* size of TCP cache */
|
||||
INT write_ptr, read_ptr, misalign; /* pointers for cache */
|
||||
INT ev_write_ptr, ev_read_ptr, ev_misalign;
|
||||
HNDLE odb_handle; /* handle to online datab. */
|
||||
HNDLE client_handle; /* client key handle . */
|
||||
|
||||
} RPC_SERVER_ACCEPTION;
|
||||
|
||||
/**dox***************************************************************/
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @addtogroup mssectionh
|
||||
*
|
||||
* @{ */
|
||||
|
||||
typedef struct {
|
||||
INT size; /**< size in bytes */
|
||||
INT next_free; /**< Address of next free block */
|
||||
} FREE_DESCRIP;
|
||||
|
||||
typedef struct {
|
||||
INT handle; /**< Handle of record base key */
|
||||
WORD access_mode; /**< R/W flags */
|
||||
WORD flags; /**< Data format, ... */
|
||||
|
||||
} OPEN_RECORD;
|
||||
|
||||
typedef struct {
|
||||
char name[NAME_LENGTH]; /* name of client */
|
||||
INT pid; /* process ID */
|
||||
INT unused0; /* was thread ID */
|
||||
INT unused; /* was thread handle */
|
||||
INT port; /* UDP port for wake up */
|
||||
INT num_open_records; /* number of open records */
|
||||
DWORD last_activity; /* time of last activity */
|
||||
DWORD watchdog_timeout; /* timeout in ms */
|
||||
INT max_index; /* index of last opren record */
|
||||
|
||||
OPEN_RECORD open_record[MAX_OPEN_RECORDS];
|
||||
|
||||
} DATABASE_CLIENT;
|
||||
|
||||
typedef struct {
|
||||
char name[NAME_LENGTH]; /* name of database */
|
||||
INT version; /* database version */
|
||||
INT num_clients; /* no of active clients */
|
||||
INT max_client_index; /* index of last client */
|
||||
INT key_size; /* size of key area in bytes */
|
||||
INT data_size; /* size of data area in bytes */
|
||||
INT root_key; /* root key offset */
|
||||
INT first_free_key; /* first free key memory */
|
||||
INT first_free_data; /* first free data memory */
|
||||
|
||||
DATABASE_CLIENT client[MAX_CLIENTS]; /* entries for clients */
|
||||
|
||||
} DATABASE_HEADER;
|
||||
|
||||
/* Per-process buffer access structure (descriptor) */
|
||||
|
||||
typedef struct {
|
||||
char name[NAME_LENGTH]; /* Name of database */
|
||||
BOOL attached; /* TRUE if database is attached */
|
||||
INT client_index; /* index to CLIENT str. in buf. */
|
||||
DATABASE_HEADER *database_header; /* pointer to database header */
|
||||
void *database_data; /* pointer to database data */
|
||||
HNDLE semaphore; /* semaphore handle */
|
||||
INT lock_cnt; /* flag to avoid multiple locks */
|
||||
HNDLE shm_handle; /* handle (id) to shared memory */
|
||||
INT index; /* connection index / tid */
|
||||
BOOL protect; /* read/write protection */
|
||||
BOOL protect_read; /* read is permitted */
|
||||
BOOL protect_write; /* write is permitted */
|
||||
MUTEX_T *mutex; /* mutex for multi-thread access */
|
||||
INT timeout; /* timeout for mutex and semaphore */
|
||||
|
||||
} DATABASE;
|
||||
|
||||
/* Open record descriptor */
|
||||
|
||||
typedef struct {
|
||||
HNDLE handle; /* Handle of record base key */
|
||||
HNDLE hDB; /* Handle of record's database */
|
||||
WORD access_mode; /* R/W flags */
|
||||
void *data; /* Pointer to local data */
|
||||
void *copy; /* Pointer of copy to data */
|
||||
INT buf_size; /* Record size in bytes */
|
||||
void (*dispatcher) (INT, INT, void *); /* Pointer to dispatcher func. */
|
||||
void *info; /* addtl. info for dispatcher */
|
||||
|
||||
} RECORD_LIST;
|
||||
|
||||
/* Watch record descriptor */
|
||||
|
||||
typedef struct {
|
||||
HNDLE handle; /* Handle of watched base key */
|
||||
HNDLE hDB; /* Handle of watched database */
|
||||
void (*dispatcher) (INT, INT, INT, void* info); /* Pointer to dispatcher func. */
|
||||
void* info; /* addtl. info for dispatcher */
|
||||
} WATCH_LIST;
|
||||
|
||||
/* Event request descriptor */
|
||||
|
||||
typedef struct {
|
||||
INT buffer_handle; /* Buffer handle */
|
||||
short int event_id; /* same as in EVENT_HEADER */
|
||||
short int trigger_mask;
|
||||
void (*dispatcher) (HNDLE, HNDLE, EVENT_HEADER *, void *); /* Dispatcher func. */
|
||||
|
||||
} REQUEST_LIST;
|
||||
|
||||
/**dox***************************************************************/
|
||||
/** @} *//* end of mssectionh */
|
||||
|
||||
/**dox***************************************************************/
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/*---- Logging channel information ---------------------------------*/
|
||||
|
||||
#define LOG_TYPE_DISK 1
|
||||
#define LOG_TYPE_TAPE 2
|
||||
#define LOG_TYPE_FTP 3
|
||||
|
||||
/*---- VxWorks specific taskSpawn arguments ----------------------*/
|
||||
|
||||
typedef struct {
|
||||
char name[32];
|
||||
int priority;
|
||||
int options;
|
||||
int stackSize;
|
||||
int arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10;
|
||||
} VX_TASK_SPAWN;
|
||||
|
||||
/*---- Channels for ss_suspend_set_dispatch() ----------------------*/
|
||||
|
||||
#define CH_IPC 1
|
||||
#define CH_CLIENT 2
|
||||
#define CH_SERVER 3
|
||||
#define CH_LISTEN 4
|
||||
|
||||
/*---- Function declarations ---------------------------------------*/
|
||||
|
||||
/* make functions callable from a C++ program */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---- common function ----*/
|
||||
INT EXPRT cm_set_path(const char *path);
|
||||
INT EXPRT cm_get_path(char *path, int path_size);
|
||||
#ifdef __cplusplus
|
||||
INT EXPRT cm_get_path_string(std::string* path);
|
||||
#endif
|
||||
INT EXPRT cm_set_experiment_name(const char *name);
|
||||
INT cm_dispatch_ipc(const char *message, int s);
|
||||
INT EXPRT cm_msg_log(INT message_type, const char *facility, const char *message);
|
||||
void EXPRT name2c(char *str);
|
||||
INT cm_delete_client_info(HNDLE hDB, INT pid);
|
||||
|
||||
/*---- buffer manager ----*/
|
||||
INT bm_lock_buffer(INT buffer_handle);
|
||||
INT bm_unlock_buffer(INT buffer_handle);
|
||||
INT bm_notify_client(char *buffer_name, int s);
|
||||
INT EXPRT bm_mark_read_waiting(BOOL flag);
|
||||
INT bm_push_event(char *buffer_name);
|
||||
INT bm_check_buffers(void);
|
||||
INT EXPRT bm_remove_event_request(INT buffer_handle, INT request_id);
|
||||
void EXPRT bm_defragment_event(HNDLE buffer_handle, HNDLE request_id,
|
||||
EVENT_HEADER * pevent, void *pdata,
|
||||
void (*dispatcher) (HNDLE, HNDLE,
|
||||
EVENT_HEADER *, void *));
|
||||
|
||||
/*---- online database ----*/
|
||||
INT EXPRT db_lock_database(HNDLE database_handle);
|
||||
INT EXPRT db_unlock_database(HNDLE database_handle);
|
||||
INT EXPRT db_get_lock_cnt(HNDLE database_handle);
|
||||
INT EXPRT db_set_lock_timeout(HNDLE database_handle, int timeout_millisec);
|
||||
INT db_update_record(INT hDB, INT hKeyRoot, INT hKey, int index, int s);
|
||||
INT db_close_all_records(void);
|
||||
INT EXPRT db_flush_database(HNDLE hDB);
|
||||
INT EXPRT db_notify_clients(HNDLE hDB, HNDLE hKey, int index, BOOL bWalk);
|
||||
INT EXPRT db_set_client_name(HNDLE hDB, const char *client_name);
|
||||
INT db_delete_key1(HNDLE hDB, HNDLE hKey, INT level, BOOL follow_links);
|
||||
INT EXPRT db_show_mem(HNDLE hDB, char *result, INT buf_size, BOOL verbose);
|
||||
INT EXPRT db_get_free_mem(HNDLE hDB, INT *key_size, INT *data_size);
|
||||
INT db_allow_write_locked(DATABASE* p, const char* caller_name);
|
||||
void db_update_last_activity(DWORD actual_time);
|
||||
void db_cleanup(const char *who, DWORD actual_time, BOOL wrong_interval);
|
||||
void db_cleanup2(const char* client_name, int ignore_timeout, DWORD actual_time, const char *who);
|
||||
void db_set_watchdog_params(DWORD timeout);
|
||||
INT db_check_client(HNDLE hDB, HNDLE hKeyClient);
|
||||
|
||||
/*---- rpc functions -----*/
|
||||
RPC_LIST EXPRT *rpc_get_internal_list(INT flag);
|
||||
INT rpc_server_receive(INT idx, int sock, BOOL check);
|
||||
INT rpc_server_callback(struct callback_addr *callback);
|
||||
INT EXPRT rpc_server_accept(int sock);
|
||||
INT rpc_client_accept(int sock);
|
||||
INT rpc_get_server_acception(void);
|
||||
INT rpc_set_server_acception(INT idx);
|
||||
INT EXPRT rpc_set_server_option(INT item, POINTER_T value);
|
||||
POINTER_T EXPRT rpc_get_server_option(INT item);
|
||||
INT recv_tcp_check(int sock);
|
||||
INT recv_event_check(int sock);
|
||||
INT rpc_deregister_functions(void);
|
||||
INT rpc_check_channels(void);
|
||||
void EXPRT rpc_client_check(void);
|
||||
INT rpc_server_disconnect(void);
|
||||
int EXPRT rpc_get_send_sock(void);
|
||||
int EXPRT rpc_get_event_sock(void);
|
||||
INT EXPRT rpc_set_opt_tcp_size(INT tcp_size);
|
||||
INT EXPRT rpc_get_opt_tcp_size(void);
|
||||
|
||||
/*---- system services ----*/
|
||||
INT ss_shm_open(const char *name, INT size, void **adr, HNDLE *handle, BOOL get_size);
|
||||
INT ss_shm_close(const char *name, void *adr, HNDLE handle, INT destroy_flag);
|
||||
INT ss_shm_flush(const char *name, const void *adr, INT size, HNDLE handle);
|
||||
INT EXPRT ss_shm_delete(const char *name);
|
||||
INT ss_shm_protect(HNDLE handle, void *adr);
|
||||
INT ss_shm_unprotect(HNDLE handle, void **adr, BOOL read, BOOL write, const char* caller_name);
|
||||
INT ss_spawnv(INT mode, const char *cmdname, const char* const argv[]);
|
||||
INT ss_shell(int sock);
|
||||
INT EXPRT ss_daemon_init(BOOL keep_stdout);
|
||||
INT EXPRT ss_system(const char *command);
|
||||
INT EXPRT ss_exec(const char *cmd, INT * child_pid);
|
||||
BOOL EXPRT ss_existpid(INT pid);
|
||||
INT EXPRT ss_getpid(void);
|
||||
INT EXPRT ss_gettid(void);
|
||||
INT ss_set_async_flag(INT flag);
|
||||
INT EXPRT ss_semaphore_create(const char *semaphore_name, HNDLE * semaphore_handle);
|
||||
INT EXPRT ss_semaphore_wait_for(HNDLE semaphore_handle, INT timeout);
|
||||
INT EXPRT ss_semaphore_release(HNDLE semaphore_handle);
|
||||
INT EXPRT ss_semaphore_delete(HNDLE semaphore_handle, INT destroy_flag);
|
||||
INT EXPRT ss_mutex_create(MUTEX_T **mutex, BOOL recursive);
|
||||
INT EXPRT ss_mutex_wait_for(MUTEX_T *mutex, INT timeout);
|
||||
INT EXPRT ss_mutex_release(MUTEX_T *mutex);
|
||||
INT EXPRT ss_mutex_delete(MUTEX_T *mutex);
|
||||
INT ss_alarm(INT millitime, void (*func) (int));
|
||||
INT ss_suspend_get_port(INT * port);
|
||||
INT ss_suspend_set_dispatch(INT channel, void *connection, INT(*dispatch) (void));
|
||||
INT ss_resume(INT port, const char *message);
|
||||
INT ss_suspend_exit(void);
|
||||
INT ss_exception_handler(void (*func) (void));
|
||||
void EXPRT ss_force_single_thread(void);
|
||||
INT EXPRT ss_suspend(INT millisec, INT msg);
|
||||
midas_thread_t EXPRT ss_thread_create(INT(*func) (void *), void *param);
|
||||
INT EXPRT ss_thread_kill(midas_thread_t thread_id);
|
||||
INT EXPRT ss_get_struct_align(void);
|
||||
INT EXPRT ss_get_struct_padding(void);
|
||||
INT EXPRT ss_timezone(void);
|
||||
INT EXPRT ss_stack_get(char ***string);
|
||||
void EXPRT ss_stack_print(void);
|
||||
void EXPRT ss_stack_history_entry(char *tag);
|
||||
void EXPRT ss_stack_history_dump(char *filename);
|
||||
INT ss_gethostname(char* buffer, int buffer_size);
|
||||
|
||||
/*---- socket routines ----*/
|
||||
INT EXPRT send_tcp(int sock, char *buffer, DWORD buffer_size, INT flags);
|
||||
INT EXPRT recv_tcp(int sock, char *buffer, DWORD buffer_size, INT flags);
|
||||
INT EXPRT recv_tcp2(int sock, char *buffer, int buffer_size, int timeout_ms);
|
||||
INT send_udp(int sock, char *buffer, DWORD buffer_size, INT flags);
|
||||
INT recv_udp(int sock, char *buffer, DWORD buffer_size, INT flags);
|
||||
INT EXPRT recv_string(int sock, char *buffer, DWORD buffer_size, INT flags);
|
||||
INT EXPRT ss_socket_wait(int sock, int millisec);
|
||||
INT EXPRT ss_recv_net_command(int sock, DWORD* routine_id, DWORD* param_size, char **param_ptr, int timeout_ms);
|
||||
|
||||
/*---- event buffer routines ----*/
|
||||
INT EXPRT eb_create_buffer(INT size);
|
||||
INT EXPRT eb_free_buffer(void);
|
||||
BOOL EXPRT eb_buffer_full(void);
|
||||
BOOL EXPRT eb_buffer_empty(void);
|
||||
EVENT_HEADER EXPRT *eb_get_pointer(void);
|
||||
INT EXPRT eb_increment_pointer(INT buffer_handle, INT event_size);
|
||||
INT EXPRT eb_send_events(BOOL send_all);
|
||||
|
||||
/*---- dual memory event buffer routines ----*/
|
||||
INT EXPRT dm_buffer_create(INT size, INT usize);
|
||||
INT EXPRT dm_buffer_release(void);
|
||||
BOOL EXPRT dm_area_full(void);
|
||||
EVENT_HEADER EXPRT *dm_pointer_get(void);
|
||||
INT EXPRT dm_pointer_increment(INT buffer_handle, INT event_size);
|
||||
INT EXPRT dm_area_send(void);
|
||||
INT EXPRT dm_area_flush(void);
|
||||
INT EXPRT dm_task(void *pointer);
|
||||
DWORD EXPRT dm_buffer_time_get(void);
|
||||
INT EXPRT dm_async_area_send(void *pointer);
|
||||
|
||||
/*---- ring buffer routines ----*/
|
||||
int EXPRT rb_set_nonblocking(void);
|
||||
int EXPRT rb_create(int size, int max_event_size, int *ring_buffer_handle);
|
||||
int EXPRT rb_delete(int ring_buffer_handle);
|
||||
int EXPRT rb_get_wp(int handle, void **p, int millisec);
|
||||
int EXPRT rb_increment_wp(int handle, int size);
|
||||
int EXPRT rb_get_rp(int handle, void **p, int millisec);
|
||||
int EXPRT rb_increment_rp(int handle, int size);
|
||||
int EXPRT rb_get_buffer_level(int handle, int * n_bytes);
|
||||
|
||||
/*---- Include RPC identifiers -------------------------------------*/
|
||||
|
||||
#include "mrpc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**dox***************************************************************/
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
#endif /* _MSYSTEM_H_ */
|
||||
|
||||
/**dox***************************************************************//** @} *//* end of msystemincludecode */
|
||||
/* emacs
|
||||
* Local Variables:
|
||||
* tab-width: 8
|
||||
* c-basic-offset: 3
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
Reference in New Issue
Block a user