merged with github/master
This commit is contained in:
@ -171,6 +171,7 @@ class AsynDriverInterface : StreamBusInterface
|
|||||||
epicsTimerQueueActive* timerQueue;
|
epicsTimerQueueActive* timerQueue;
|
||||||
epicsTimer* timer;
|
epicsTimer* timer;
|
||||||
#endif
|
#endif
|
||||||
|
asynStatus previousAsynStatus;
|
||||||
|
|
||||||
AsynDriverInterface(Client* client);
|
AsynDriverInterface(Client* client);
|
||||||
~AsynDriverInterface();
|
~AsynDriverInterface();
|
||||||
@ -229,6 +230,7 @@ class AsynDriverInterface : StreamBusInterface
|
|||||||
timer->cancel();
|
timer->cancel();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
void reportAsynStatus(asynStatus status, const char *name);
|
||||||
|
|
||||||
// asynUser callback functions
|
// asynUser callback functions
|
||||||
friend void handleRequest(asynUser*);
|
friend void handleRequest(asynUser*);
|
||||||
@ -262,6 +264,7 @@ AsynDriverInterface(Client* client) : StreamBusInterface(client)
|
|||||||
eventMask = 0;
|
eventMask = 0;
|
||||||
receivedEvent = 0;
|
receivedEvent = 0;
|
||||||
peeksize = 1;
|
peeksize = 1;
|
||||||
|
previousAsynStatus = asynSuccess;
|
||||||
debug ("AsynDriverInterface(%s) createAsynUser\n", client->name());
|
debug ("AsynDriverInterface(%s) createAsynUser\n", client->name());
|
||||||
pasynUser = pasynManager->createAsynUser(handleRequest,
|
pasynUser = pasynManager->createAsynUser(handleRequest,
|
||||||
handleTimeout);
|
handleTimeout);
|
||||||
@ -490,6 +493,19 @@ connectToBus(const char* portname, int addr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsynDriverInterface::
|
||||||
|
reportAsynStatus(asynStatus status, const char *name)
|
||||||
|
{
|
||||||
|
if (previousAsynStatus != status) {
|
||||||
|
previousAsynStatus = status;
|
||||||
|
if (status == asynSuccess) {
|
||||||
|
error("%s %s: status returned to normal\n", clientName(), name);
|
||||||
|
} else {
|
||||||
|
error("%s %s: %s\n", clientName(), name, pasynUser->errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// interface function: we want exclusive access to the device
|
// interface function: we want exclusive access to the device
|
||||||
// lockTimeout_ms=0 means "block here" (used in @init)
|
// lockTimeout_ms=0 means "block here" (used in @init)
|
||||||
bool AsynDriverInterface::
|
bool AsynDriverInterface::
|
||||||
@ -503,16 +519,11 @@ lockRequest(unsigned long lockTimeout_ms)
|
|||||||
ioAction = Lock;
|
ioAction = Lock;
|
||||||
status = pasynManager->queueRequest(pasynUser,
|
status = pasynManager->queueRequest(pasynUser,
|
||||||
priority(), lockTimeout);
|
priority(), lockTimeout);
|
||||||
if (status != asynSuccess)
|
reportAsynStatus(status, "lockRequest: pasynManager->queueRequest");
|
||||||
{
|
return (status == asynSuccess);
|
||||||
error("%s lockRequest: pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// continues with:
|
// continues with:
|
||||||
// handleRequest() -> lockHandler() -> lockCallback()
|
// handleRequest() -> lockHandler() -> lockCallback()
|
||||||
// or handleTimeout() -> lockCallback(StreamIoTimeout)
|
// or handleTimeout() -> lockCallback(StreamIoTimeout)
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AsynDriverInterface::
|
bool AsynDriverInterface::
|
||||||
@ -562,22 +573,12 @@ connectToAsynPort()
|
|||||||
clientName(), connected ? "already" : "not yet");
|
clientName(), connected ? "already" : "not yet");
|
||||||
if (!connected)
|
if (!connected)
|
||||||
{
|
{
|
||||||
printf ("%s: AsynDriverInterface::connectToAsynPort: "
|
|
||||||
"pasynCommon->connect(%p, %p)\n",
|
|
||||||
clientName(), pvtCommon, pasynUser);
|
|
||||||
status = pasynCommon->connect(pvtCommon, pasynUser);
|
status = pasynCommon->connect(pvtCommon, pasynUser);
|
||||||
printf ("%s: AsynDriverInterface::connectToAsynPort: "
|
|
||||||
"pasynCommon->connect(%p, %p) = %s\n",
|
|
||||||
clientName(), pvtCommon, pasynUser, asynStatusStr[status]);
|
|
||||||
debug("AsynDriverInterface::connectToAsynPort(%s): "
|
debug("AsynDriverInterface::connectToAsynPort(%s): "
|
||||||
"status=%s\n",
|
"status=%s\n",
|
||||||
clientName(), asynStatusStr[status]);
|
clientName(), asynStatusStr[status]);
|
||||||
if (status != asynSuccess)
|
reportAsynStatus(status, "connectToAsynPort: pasynCommon->connect");
|
||||||
{
|
return (status == asynSuccess);
|
||||||
error("%s connectToAsynPort: pasynCommon->connect() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// We probably should set REN=1 prior to sending but this
|
// We probably should set REN=1 prior to sending but this
|
||||||
// seems to hang up the device every other time.
|
// seems to hang up the device every other time.
|
||||||
@ -644,16 +645,11 @@ writeRequest(const void* output, size_t size,
|
|||||||
ioAction = Write;
|
ioAction = Write;
|
||||||
status = pasynManager->queueRequest(pasynUser, priority(),
|
status = pasynManager->queueRequest(pasynUser, priority(),
|
||||||
writeTimeout);
|
writeTimeout);
|
||||||
if (status != asynSuccess)
|
reportAsynStatus(status, "writeRequest: pasynManager->queueRequest");
|
||||||
{
|
return (status == asynSuccess);
|
||||||
error("%s writeRequest: pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// continues with:
|
// continues with:
|
||||||
// handleRequest() -> writeHandler() -> lockCallback()
|
// handleRequest() -> writeHandler() -> lockCallback()
|
||||||
// or handleTimeout() -> writeCallback(StreamIoTimeout)
|
// or handleTimeout() -> writeCallback(StreamIoTimeout)
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now, we can write (called by asynManager)
|
// now, we can write (called by asynManager)
|
||||||
@ -667,25 +663,28 @@ writeHandler()
|
|||||||
|
|
||||||
pasynUser->timeout = 0;
|
pasynUser->timeout = 0;
|
||||||
if (!pasynGpib)
|
if (!pasynGpib)
|
||||||
// discard any early input, but forward it to potential async records
|
{
|
||||||
// thus do not use pasynOctet->flush()
|
// discard any early input, but forward it to potential async records
|
||||||
// unfortunately we cannot do this with GPIB because addressing a device as talker
|
// thus do not use pasynOctet->flush()
|
||||||
// when it has nothing to say is an error. Also timeout=0 does not help here (would need
|
// unfortunately we cannot do this with GPIB because addressing a device as talker
|
||||||
// a change in asynGPIB), thus use flush() for GPIB.
|
// when it has nothing to say is an error. Also timeout=0 does not help here
|
||||||
do {
|
// (would need a change in asynGPIB), thus use flush() for GPIB.
|
||||||
char buffer [256];
|
do {
|
||||||
size_t received = 0;
|
char buffer [256];
|
||||||
int eomReason = 0;
|
size_t received = 0;
|
||||||
debug("AsynDriverInterface::writeHandler(%s): reading old input\n",
|
int eomReason = 0;
|
||||||
clientName());
|
debug("AsynDriverInterface::writeHandler(%s): reading old input\n",
|
||||||
status = pasynOctet->read(pvtOctet, pasynUser,
|
clientName());
|
||||||
buffer, sizeof(buffer), &received, &eomReason);
|
status = pasynOctet->read(pvtOctet, pasynUser,
|
||||||
if (status == asynError || received == 0) break;
|
buffer, sizeof(buffer), &received, &eomReason);
|
||||||
|
if (status == asynError || received == 0) break;
|
||||||
#ifndef NO_TEMPORARY
|
#ifndef NO_TEMPORARY
|
||||||
if (received) debug("AsynDriverInterface::writeHandler(%s): flushing %ld bytes: \"%s\"\n",
|
if (received) debug("AsynDriverInterface::writeHandler(%s): "
|
||||||
clientName(), (long)received, StreamBuffer(buffer, received).expand()());
|
"flushing %ld bytes: \"%s\"\n",
|
||||||
|
clientName(), (long)received, StreamBuffer(buffer, received).expand()());
|
||||||
#endif
|
#endif
|
||||||
} while (status == asynSuccess);
|
} while (status == asynSuccess);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug("AsynDriverInterface::writeHandler(%s): flushing old input\n",
|
debug("AsynDriverInterface::writeHandler(%s): flushing old input\n",
|
||||||
@ -760,11 +759,9 @@ writeHandler()
|
|||||||
{
|
{
|
||||||
status = pasynManager->queueRequest(pasynUser,
|
status = pasynManager->queueRequest(pasynUser,
|
||||||
priority(), lockTimeout);
|
priority(), lockTimeout);
|
||||||
|
reportAsynStatus(status, "writeHandler: pasynManager->queueRequest");
|
||||||
if (status != asynSuccess)
|
if (status != asynSuccess)
|
||||||
{
|
{
|
||||||
error("%s writeHandler: "
|
|
||||||
"pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
writeCallback(StreamIoFault);
|
writeCallback(StreamIoFault);
|
||||||
}
|
}
|
||||||
// continues with:
|
// continues with:
|
||||||
@ -844,6 +841,10 @@ readRequest(unsigned long replyTimeout_ms, unsigned long readTimeout_ms,
|
|||||||
clientName(), priority(), queueTimeout,
|
clientName(), priority(), queueTimeout,
|
||||||
asynStatusStr[status], async? "true" : "false",
|
asynStatusStr[status], async? "true" : "false",
|
||||||
status!=asynSuccess ? pasynUser->errorMessage : "");
|
status!=asynSuccess ? pasynUser->errorMessage : "");
|
||||||
|
if (!async)
|
||||||
|
{
|
||||||
|
reportAsynStatus(status, "readRequest: pasynManager->queueRequest");
|
||||||
|
}
|
||||||
if (status != asynSuccess)
|
if (status != asynSuccess)
|
||||||
{
|
{
|
||||||
// Not queued for some reason (e.g. disconnected / already queued)
|
// Not queued for some reason (e.g. disconnected / already queued)
|
||||||
@ -853,8 +854,6 @@ readRequest(unsigned long replyTimeout_ms, unsigned long readTimeout_ms,
|
|||||||
startTimer(replyTimeout);
|
startTimer(replyTimeout);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
error("%s readRequest: pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// continues with:
|
// continues with:
|
||||||
@ -1428,16 +1427,11 @@ connectRequest(unsigned long connecttimeout_ms)
|
|||||||
clientName());
|
clientName());
|
||||||
status = pasynManager->queueRequest(pasynUser,
|
status = pasynManager->queueRequest(pasynUser,
|
||||||
asynQueuePriorityConnect, queueTimeout);
|
asynQueuePriorityConnect, queueTimeout);
|
||||||
if (status != asynSuccess)
|
reportAsynStatus(status, "connectRequest: pasynManager->queueRequest");
|
||||||
{
|
return (status == asynSuccess);
|
||||||
error("%s connectRequest: pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// continues with:
|
// continues with:
|
||||||
// handleRequest() -> connectHandler() -> connectCallback()
|
// handleRequest() -> connectHandler() -> connectCallback()
|
||||||
// or handleTimeout() -> connectCallback(StreamIoTimeout)
|
// or handleTimeout() -> connectCallback(StreamIoTimeout)
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsynDriverInterface::
|
void AsynDriverInterface::
|
||||||
@ -1456,15 +1450,10 @@ disconnectRequest()
|
|||||||
clientName());
|
clientName());
|
||||||
status = pasynManager->queueRequest(pasynUser,
|
status = pasynManager->queueRequest(pasynUser,
|
||||||
asynQueuePriorityConnect, 0.0);
|
asynQueuePriorityConnect, 0.0);
|
||||||
if (status != asynSuccess)
|
reportAsynStatus(status, "disconnectRequest: pasynManager->queueRequest");
|
||||||
{
|
return (status == asynSuccess);
|
||||||
error("%s disconnectRequest: pasynManager->queueRequest() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// continues with:
|
// continues with:
|
||||||
// handleRequest() -> disconnectHandler()
|
// handleRequest() -> disconnectHandler()
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsynDriverInterface::
|
void AsynDriverInterface::
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define StreamBusInterface_h
|
#define StreamBusInterface_h
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <StreamBuffer.h>
|
#include "StreamBuffer.h"
|
||||||
|
|
||||||
enum StreamIoStatus {
|
enum StreamIoStatus {
|
||||||
StreamIoSuccess, StreamIoTimeout, StreamIoNoReply,
|
StreamIoSuccess, StreamIoTimeout, StreamIoNoReply,
|
||||||
|
@ -139,6 +139,7 @@ StreamCore()
|
|||||||
StreamCore** pstream;
|
StreamCore** pstream;
|
||||||
for (pstream = &first; *pstream; pstream = &(*pstream)->next);
|
for (pstream = &first; *pstream; pstream = &(*pstream)->next);
|
||||||
*pstream = this;
|
*pstream = this;
|
||||||
|
activeCommand = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamCore::
|
StreamCore::
|
||||||
@ -1364,13 +1365,15 @@ normal_format:
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (commandIndex[i] >= ' ') i++;
|
while (commandIndex[i] >= ' ') i++;
|
||||||
error("%s: Input \"%s%s\" mismatch after %ld byte%s\n",
|
error("%s: Input \"%s%s\" mismatch after %ld byte%s: %c != %c\n",
|
||||||
name(),
|
name(),
|
||||||
consumedInput > 10 ? "..." : "",
|
consumedInput > 10 ? "..." : "",
|
||||||
inputLine.expand(consumedInput > 10 ?
|
inputLine.expand(consumedInput > 10 ?
|
||||||
consumedInput-10 : 0,20)(),
|
consumedInput-10 : 0,20)(),
|
||||||
consumedInput,
|
consumedInput,
|
||||||
consumedInput==1 ? "" : "s");
|
consumedInput==1 ? "" : "s",
|
||||||
|
command,
|
||||||
|
inputLine[consumedInput]);
|
||||||
|
|
||||||
#ifndef NO_TEMPORARY
|
#ifndef NO_TEMPORARY
|
||||||
error("%s: got \"%s\" where \"%s\" was expected\n",
|
error("%s: got \"%s\" where \"%s\" was expected\n",
|
||||||
@ -1762,7 +1765,7 @@ void StreamCore::
|
|||||||
printStatus(StreamBuffer& buffer)
|
printStatus(StreamBuffer& buffer)
|
||||||
{
|
{
|
||||||
buffer.print("active command=%s ",
|
buffer.print("active command=%s ",
|
||||||
activeCommand ? commandName(*activeCommand) : "NULL");
|
activeCommand ? commandName(*activeCommand) : "none");
|
||||||
buffer.print("flags=0x%04lx ", flags);
|
buffer.print("flags=0x%04lx ", flags);
|
||||||
if (flags & IgnoreExtraInput) buffer.append("IgnoreExtraInput ");
|
if (flags & IgnoreExtraInput) buffer.append("IgnoreExtraInput ");
|
||||||
if (flags & InitRun) buffer.append("InitRun ");
|
if (flags & InitRun) buffer.append("InitRun ");
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#define epicsExportSharedSymbols
|
|
||||||
#include "devStream.h"
|
|
||||||
#undef epicsExportSharedSymbols
|
|
||||||
#include "StreamCore.h"
|
#include "StreamCore.h"
|
||||||
#include "StreamError.h"
|
#include "StreamError.h"
|
||||||
|
|
||||||
@ -63,6 +60,7 @@ extern DBBASE *pdbbase;
|
|||||||
#include <epicsEvent.h>
|
#include <epicsEvent.h>
|
||||||
#include <epicsTime.h>
|
#include <epicsTime.h>
|
||||||
#include <epicsThread.h>
|
#include <epicsThread.h>
|
||||||
|
#include <epicsString.h>
|
||||||
#include <registryFunction.h>
|
#include <registryFunction.h>
|
||||||
#include <iocsh.h>
|
#include <iocsh.h>
|
||||||
|
|
||||||
@ -79,6 +77,8 @@ epicsShareFunc int epicsShareAPI iocshCmd(const char *command);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "devStream.h"
|
||||||
|
|
||||||
#if defined(__vxworks) || defined(vxWorks)
|
#if defined(__vxworks) || defined(vxWorks)
|
||||||
#include <symLib.h>
|
#include <symLib.h>
|
||||||
#include <sysSymTbl.h>
|
#include <sysSymTbl.h>
|
||||||
@ -93,7 +93,8 @@ enum MoreFlags {
|
|||||||
|
|
||||||
extern "C" void streamExecuteCommand(CALLBACK *pcallback);
|
extern "C" void streamExecuteCommand(CALLBACK *pcallback);
|
||||||
extern "C" void streamRecordProcessCallback(CALLBACK *pcallback);
|
extern "C" void streamRecordProcessCallback(CALLBACK *pcallback);
|
||||||
extern "C" long streamReload(char* recordname);
|
extern "C" long streamReload(const char* recordname);
|
||||||
|
extern "C" long streamReportRecord(const char* recordname);
|
||||||
|
|
||||||
class Stream : protected StreamCore
|
class Stream : protected StreamCore
|
||||||
#ifndef EPICS_3_13
|
#ifndef EPICS_3_13
|
||||||
@ -145,6 +146,7 @@ class Stream : protected StreamCore
|
|||||||
bool execute();
|
bool execute();
|
||||||
friend void streamExecuteCommand(CALLBACK *pcallback);
|
friend void streamExecuteCommand(CALLBACK *pcallback);
|
||||||
friend void streamRecordProcessCallback(CALLBACK *pcallback);
|
friend void streamRecordProcessCallback(CALLBACK *pcallback);
|
||||||
|
friend long streamReportRecord(const char* recordname);
|
||||||
|
|
||||||
// Stream Epics methods
|
// Stream Epics methods
|
||||||
Stream(dbCommon* record, const struct link *ioLink,
|
Stream(dbCommon* record, const struct link *ioLink,
|
||||||
@ -167,7 +169,7 @@ class Stream : protected StreamCore
|
|||||||
friend long streamPrintf(dbCommon *record, format_t *format, ...);
|
friend long streamPrintf(dbCommon *record, format_t *format, ...);
|
||||||
friend long streamScanfN(dbCommon *record, format_t *format,
|
friend long streamScanfN(dbCommon *record, format_t *format,
|
||||||
void*, size_t maxStringSize);
|
void*, size_t maxStringSize);
|
||||||
friend long streamReload(char* recordname);
|
friend long streamReload(const char* recordname);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
long priority() { return record->prio; };
|
long priority() { return record->prio; };
|
||||||
@ -185,12 +187,12 @@ epicsExportAddress(int, streamError);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for subroutine record
|
// for subroutine record
|
||||||
extern "C" long streamReloadSub()
|
long streamReloadSub()
|
||||||
{
|
{
|
||||||
return streamReload(NULL);
|
return streamReload(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" long streamReload(char* recordname)
|
long streamReload(const char* recordname)
|
||||||
{
|
{
|
||||||
DBENTRY dbentry;
|
DBENTRY dbentry;
|
||||||
dbCommon* record;
|
dbCommon* record;
|
||||||
@ -242,17 +244,30 @@ static const iocshArg streamReloadArg0 =
|
|||||||
{ "recordname", iocshArgString };
|
{ "recordname", iocshArgString };
|
||||||
static const iocshArg * const streamReloadArgs[] =
|
static const iocshArg * const streamReloadArgs[] =
|
||||||
{ &streamReloadArg0 };
|
{ &streamReloadArg0 };
|
||||||
static const iocshFuncDef reloadDef =
|
static const iocshFuncDef streamReloadDef =
|
||||||
{ "streamReload", 1, streamReloadArgs };
|
{ "streamReload", 1, streamReloadArgs };
|
||||||
|
|
||||||
extern "C" void streamReloadFunc (const iocshArgBuf *args)
|
void streamReloadFunc (const iocshArgBuf *args)
|
||||||
{
|
{
|
||||||
streamReload(args[0].sval);
|
streamReload(args[0].sval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const iocshArg streamReportRecordArg0 =
|
||||||
|
{ "recordname", iocshArgString };
|
||||||
|
static const iocshArg * const streamReportRecordArgs[] =
|
||||||
|
{ &streamReportRecordArg0 };
|
||||||
|
static const iocshFuncDef streamReportRecordDef =
|
||||||
|
{ "streamReportRecord", 1, streamReportRecordArgs };
|
||||||
|
|
||||||
|
void streamReportRecordFunc (const iocshArgBuf *args)
|
||||||
|
{
|
||||||
|
streamReportRecord(args[0].sval);
|
||||||
|
}
|
||||||
|
|
||||||
static void streamRegistrar ()
|
static void streamRegistrar ()
|
||||||
{
|
{
|
||||||
iocshRegister(&reloadDef, streamReloadFunc);
|
iocshRegister(&streamReloadDef, streamReloadFunc);
|
||||||
|
iocshRegister(&streamReportRecordDef, streamReportRecordFunc);
|
||||||
// make streamReload available for subroutine records
|
// make streamReload available for subroutine records
|
||||||
registryFunctionAdd("streamReload",
|
registryFunctionAdd("streamReload",
|
||||||
(REGISTRYFUNCTION)streamReloadSub);
|
(REGISTRYFUNCTION)streamReloadSub);
|
||||||
@ -361,6 +376,31 @@ report(int interest)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long streamReportRecord(const char* recordname)
|
||||||
|
{
|
||||||
|
Stream* pstream;
|
||||||
|
for (pstream = static_cast<Stream*>(Stream::first); pstream;
|
||||||
|
pstream = static_cast<Stream*>(pstream->next))
|
||||||
|
{
|
||||||
|
if (!recordname ||
|
||||||
|
#ifdef EPICS_3_13
|
||||||
|
strcmp(pstream->name(), recordname) == 0)
|
||||||
|
#else
|
||||||
|
epicsStrGlobMatch(pstream->name(), recordname))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
printf("%s: %s\n", pstream->name(),
|
||||||
|
pstream->ioLink->value.instio.string);
|
||||||
|
StreamBuffer buffer;
|
||||||
|
pstream->printStatus(buffer);
|
||||||
|
printf("%s\n", buffer());
|
||||||
|
pstream->printProtocol();
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
long Stream::
|
long Stream::
|
||||||
drvInit()
|
drvInit()
|
||||||
{
|
{
|
||||||
@ -969,10 +1009,11 @@ getFieldAddress(const char* fieldname, StreamBuffer& address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char dbfMapping[] =
|
static const unsigned char dbfMapping[] =
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
{0, DBF_UINT64, DBF_INT64, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
|
||||||
|
#else
|
||||||
{0, DBF_ULONG, DBF_LONG, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
|
{0, DBF_ULONG, DBF_LONG, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
|
||||||
static const short typeSize[] =
|
#endif
|
||||||
{0, sizeof(epicsUInt32), sizeof(epicsInt32), sizeof(epicsUInt16),
|
|
||||||
sizeof(epicsFloat64), MAX_STRING_SIZE};
|
|
||||||
|
|
||||||
bool Stream::
|
bool Stream::
|
||||||
formatValue(const StreamFormat& format, const void* fieldaddress)
|
formatValue(const StreamFormat& format, const void* fieldaddress)
|
||||||
@ -1020,7 +1061,7 @@ formatValue(const StreamFormat& format, const void* fieldaddress)
|
|||||||
|
|
||||||
/* convert type to LONG, ENUM, DOUBLE, or STRING */
|
/* convert type to LONG, ENUM, DOUBLE, or STRING */
|
||||||
long nelem = pdbaddr->no_elements;
|
long nelem = pdbaddr->no_elements;
|
||||||
size_t size = nelem * typeSize[format.type];
|
size_t size = nelem * dbValueSize(fmt.type);
|
||||||
|
|
||||||
/* print (U)CHAR arrays as string */
|
/* print (U)CHAR arrays as string */
|
||||||
if (format.type == string_format &&
|
if (format.type == string_format &&
|
||||||
@ -1139,7 +1180,7 @@ matchValue(const StreamFormat& format, const void* fieldaddress)
|
|||||||
DBADDR* pdbaddr = (DBADDR*)fieldaddress;
|
DBADDR* pdbaddr = (DBADDR*)fieldaddress;
|
||||||
long nord;
|
long nord;
|
||||||
long nelem = pdbaddr->no_elements;
|
long nelem = pdbaddr->no_elements;
|
||||||
size_t size = nelem * typeSize[format.type];
|
size_t size = nelem * dbValueSize(fmt.type);
|
||||||
buffer = fieldBuffer.clear().reserve(size);
|
buffer = fieldBuffer.clear().reserve(size);
|
||||||
for (nord = 0; nord < nelem; nord++)
|
for (nord = 0; nord < nelem; nord++)
|
||||||
{
|
{
|
||||||
|
@ -656,11 +656,15 @@ printString(StreamBuffer& buffer, const char* s)
|
|||||||
buffer.append("\\\\");
|
buffer.append("\\\\");
|
||||||
break;
|
break;
|
||||||
case format_field:
|
case format_field:
|
||||||
|
// <format_field> field <eos> addrLength AddressStructure formatstr <eos> StreamFormat [info <eos>]
|
||||||
|
unsigned short fieldSize;
|
||||||
buffer.print("%%(%s)", ++s);
|
buffer.print("%%(%s)", ++s);
|
||||||
while (*s++);
|
while (*s++);
|
||||||
s += extract<unsigned short>(s); // skip fieldaddress
|
fieldSize = extract<unsigned short>(s);
|
||||||
|
s += fieldSize; // skip fieldAddress
|
||||||
goto format;
|
goto format;
|
||||||
case format:
|
case format:
|
||||||
|
// <format> formatstr <eos> StreamFormat [info <eos>]
|
||||||
buffer.append('%');
|
buffer.append('%');
|
||||||
s++;
|
s++;
|
||||||
format: {
|
format: {
|
||||||
@ -1057,7 +1061,7 @@ compileNumber(unsigned long& number, const char*& source, unsigned long max)
|
|||||||
|
|
||||||
bool StreamProtocolParser::Protocol::
|
bool StreamProtocolParser::Protocol::
|
||||||
compileString(StreamBuffer& buffer, const char*& source,
|
compileString(StreamBuffer& buffer, const char*& source,
|
||||||
FormatType formatType, Client* client, int quoted)
|
FormatType formatType, Client* client, int quoted, int recursionDepth)
|
||||||
{
|
{
|
||||||
bool escaped = false;
|
bool escaped = false;
|
||||||
int newline = 0;
|
int newline = 0;
|
||||||
@ -1066,8 +1070,8 @@ compileString(StreamBuffer& buffer, const char*& source,
|
|||||||
line = getLineNumber(source);
|
line = getLineNumber(source);
|
||||||
|
|
||||||
debug("StreamProtocolParser::Protocol::compileString "
|
debug("StreamProtocolParser::Protocol::compileString "
|
||||||
"line %d source=\"%s\"\n",
|
"line %d source=\"%s\" recursionDepth=%d\n",
|
||||||
line, source);
|
line, source, recursionDepth);
|
||||||
|
|
||||||
// coding is done in two steps:
|
// coding is done in two steps:
|
||||||
// 1) read a line from protocol source and code quoted strings,
|
// 1) read a line from protocol source and code quoted strings,
|
||||||
@ -1085,7 +1089,7 @@ compileString(StreamBuffer& buffer, const char*& source,
|
|||||||
// compile all formats in this line
|
// compile all formats in this line
|
||||||
// We do this here after all variables in this line
|
// We do this here after all variables in this line
|
||||||
// have been replaced and after string has been coded.
|
// have been replaced and after string has been coded.
|
||||||
if (formatType != NoFormat)
|
if (recursionDepth == 0 && formatType != NoFormat)
|
||||||
{
|
{
|
||||||
int nformats=0;
|
int nformats=0;
|
||||||
char c;
|
char c;
|
||||||
@ -1250,7 +1254,7 @@ compileString(StreamBuffer& buffer, const char*& source,
|
|||||||
source += strlen(source)+1+sizeof(int);
|
source += strlen(source)+1+sizeof(int);
|
||||||
p = value();
|
p = value();
|
||||||
int saveline = line;
|
int saveline = line;
|
||||||
if (!compileString(buffer, p, formatType, client))
|
if (!compileString(buffer, p, formatType, client, false, recursionDepth + 1))
|
||||||
return false;
|
return false;
|
||||||
line = saveline;
|
line = saveline;
|
||||||
continue;
|
continue;
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#ifndef StreamProtocol_h
|
#ifndef StreamProtocol_h
|
||||||
#define StreamProtocol_h
|
#define StreamProtocol_h
|
||||||
|
|
||||||
#include "StreamBuffer.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "StreamBuffer.h"
|
||||||
|
|
||||||
enum FormatType {NoFormat, ScanFormat, PrintFormat};
|
enum FormatType {NoFormat, ScanFormat, PrintFormat};
|
||||||
|
|
||||||
@ -59,6 +59,8 @@ public:
|
|||||||
bool compileCommands(StreamBuffer&, const char*& source, Client*);
|
bool compileCommands(StreamBuffer&, const char*& source, Client*);
|
||||||
bool replaceVariable(StreamBuffer&, const char* varname);
|
bool replaceVariable(StreamBuffer&, const char* varname);
|
||||||
const Variable* getVariable(const char* name);
|
const Variable* getVariable(const char* name);
|
||||||
|
bool compileString(StreamBuffer& buffer, const char*& source,
|
||||||
|
FormatType formatType, Client*, int quoted, int recursionDepth);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -73,7 +75,9 @@ public:
|
|||||||
bool compileNumber(unsigned long& number, const char*& source,
|
bool compileNumber(unsigned long& number, const char*& source,
|
||||||
unsigned long max = 0xFFFFFFFF);
|
unsigned long max = 0xFFFFFFFF);
|
||||||
bool compileString(StreamBuffer& buffer, const char*& source,
|
bool compileString(StreamBuffer& buffer, const char*& source,
|
||||||
FormatType formatType = NoFormat, Client* = NULL, int quoted = false);
|
FormatType formatType = NoFormat, Client* client = NULL, int quoted = false) {
|
||||||
|
return compileString(buffer, source, formatType, client, quoted, 0);
|
||||||
|
}
|
||||||
bool checkUnused();
|
bool checkUnused();
|
||||||
~Protocol();
|
~Protocol();
|
||||||
void report();
|
void report();
|
||||||
|
@ -49,26 +49,19 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef epicsExportSharedSymbols
|
|
||||||
# define devStream_epicsExportSharedSymbols
|
|
||||||
# undef epicsExportSharedSymbols
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <dbCommon.h>
|
#include <dbCommon.h>
|
||||||
#include <dbScan.h>
|
#include <dbScan.h>
|
||||||
#include <devSup.h>
|
#include <devSup.h>
|
||||||
#include <dbAccess.h>
|
#include <dbAccess.h>
|
||||||
|
|
||||||
#ifdef devStream_epicsExportSharedSymbols
|
|
||||||
# define epicsExportSharedSymbols
|
|
||||||
# include "shareLib.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__cplusplus) && defined(EPICS_3_13)
|
#if defined(__cplusplus) && defined(EPICS_3_13)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EPICS_3_13
|
||||||
|
#include "shareLib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef const struct format_s {
|
typedef const struct format_s {
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errlog.h>
|
#include "errlog.h"
|
||||||
#include <aaiRecord.h>
|
#include "aaiRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
((epicsFloat32 *)aai->bptr)[aai->nord] = (epicsFloat32)lval;
|
((epicsFloat32 *)aai->bptr)[aai->nord] = (epicsFloat32)lval;
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
case DBF_UINT64:
|
||||||
|
((epicsInt64 *)aai->bptr)[aai->nord] = (epicsInt64)lval;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
case DBF_ULONG:
|
case DBF_ULONG:
|
||||||
((epicsInt32 *)aai->bptr)[aai->nord] = (epicsInt32)lval;
|
((epicsInt32 *)aai->bptr)[aai->nord] = (epicsInt32)lval;
|
||||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
((char*)aai->bptr)[aai->nelm] = 0;
|
((char*)aai->bptr)[aai->nelm-1] = 0;
|
||||||
for (lval = aai->nelm;
|
for (lval = aai->nelm-2;
|
||||||
lval >= 0 && ((char*)aai->bptr)[lval] == 0;
|
lval >= 0 && ((char*)aai->bptr)[lval] == 0;
|
||||||
lval--);
|
lval--);
|
||||||
aai->nord = lval+1;
|
aai->nord = lval+1;
|
||||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
dval = ((epicsFloat32 *)aai->bptr)[nowd];
|
dval = ((epicsFloat32 *)aai->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
dval = ((epicsInt64 *)aai->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
dval = ((epicsUInt64 *)aai->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
dval = ((epicsInt32 *)aai->bptr)[nowd];
|
dval = ((epicsInt32 *)aai->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
switch (aai->ftvl)
|
switch (aai->ftvl)
|
||||||
{
|
{
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
lval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
lval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
lval = ((epicsInt32 *)aai->bptr)[nowd];
|
lval = ((epicsInt32 *)aai->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
|
|
||||||
static long initRecord (dbCommon *record)
|
static long initRecord (dbCommon *record)
|
||||||
{
|
{
|
||||||
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
|
|
||||||
aaiRecord *aai = (aaiRecord *) record;
|
aaiRecord *aai = (aaiRecord *) record;
|
||||||
|
|
||||||
aai->bptr = calloc(aai->nelm, typesize[aai->ftvl]);
|
aai->bptr = calloc(aai->nelm, dbValueSize(aai->ftvl));
|
||||||
if (aai->bptr == NULL)
|
if (aai->bptr == NULL)
|
||||||
{
|
{
|
||||||
errlogSevPrintf (errlogFatal,
|
errlogSevPrintf (errlogFatal,
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errlog.h>
|
#include "errlog.h"
|
||||||
#include <aaoRecord.h>
|
#include "aaoRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
((epicsFloat32 *)aao->bptr)[aao->nord] = (epicsFloat32)lval;
|
((epicsFloat32 *)aao->bptr)[aao->nord] = (epicsFloat32)lval;
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
case DBF_UINT64:
|
||||||
|
((epicsInt64 *)aao->bptr)[aao->nord] = (epicsInt64)lval;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
case DBF_ULONG:
|
case DBF_ULONG:
|
||||||
((epicsInt32 *)aao->bptr)[aao->nord] = (epicsInt32)lval;
|
((epicsInt32 *)aao->bptr)[aao->nord] = (epicsInt32)lval;
|
||||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
((char*)aao->bptr)[aao->nelm] = 0;
|
((char*)aao->bptr)[aao->nelm-1] = 0;
|
||||||
for (lval = aao->nelm;
|
for (lval = aao->nelm-2;
|
||||||
lval >= 0 && ((char*)aao->bptr)[lval] == 0;
|
lval >= 0 && ((char*)aao->bptr)[lval] == 0;
|
||||||
lval--);
|
lval--);
|
||||||
aao->nord = lval+1;
|
aao->nord = lval+1;
|
||||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
dval = ((epicsFloat32 *)aao->bptr)[nowd];
|
dval = ((epicsFloat32 *)aao->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
dval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
dval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
dval = ((epicsInt32 *)aao->bptr)[nowd];
|
dval = ((epicsInt32 *)aao->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
switch (aao->ftvl)
|
switch (aao->ftvl)
|
||||||
{
|
{
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
lval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
lval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
lval = ((epicsInt32 *)aao->bptr)[nowd];
|
lval = ((epicsInt32 *)aao->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
|
|
||||||
static long initRecord (dbCommon *record)
|
static long initRecord (dbCommon *record)
|
||||||
{
|
{
|
||||||
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
|
|
||||||
aaoRecord *aao = (aaoRecord *) record;
|
aaoRecord *aao = (aaoRecord *) record;
|
||||||
|
|
||||||
aao->bptr = calloc(aao->nelm, typesize[aao->ftvl]);
|
aao->bptr = calloc(aao->nelm, dbValueSize(aao->ftvl));
|
||||||
if (aao->bptr == NULL)
|
if (aao->bptr == NULL)
|
||||||
{
|
{
|
||||||
errlogSevPrintf (errlogFatal,
|
errlogSevPrintf (errlogFatal,
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <biRecord.h>
|
#include "biRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <boRecord.h>
|
#include "boRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <postfix.h>
|
#include "postfix.h"
|
||||||
#include <calcoutRecord.h>
|
#include "calcoutRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <longinRecord.h>
|
#include "longinRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <longoutRecord.h>
|
#include "longoutRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <mbbiDirectRecord.h>
|
#include "mbbiDirectRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mbbiRecord.h>
|
#include "mbbiRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <mbboDirectRecord.h>
|
#include "mbboDirectRecord.h"
|
||||||
#include "alarm.h"
|
#include "alarm.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mbboRecord.h>
|
#include "mbboRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -17,18 +17,18 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <devStream.h>
|
#include "sCalcoutRecord.h"
|
||||||
#include <sCalcoutRecord.h>
|
#include "epicsExport.h"
|
||||||
#include <epicsExport.h>
|
#include "devStream.h"
|
||||||
|
|
||||||
/* scalcout record has a bug: it never calls init_record
|
/* Up to version 2-6-1 of the SynApps calc module
|
||||||
|
scalcout record has a bug: it never calls init_record
|
||||||
of the device support.
|
of the device support.
|
||||||
Fix: sCalcoutRecord.c, end of init_record() add
|
Fix: sCalcoutRecord.c, end of init_record() add
|
||||||
|
|
||||||
if(pscalcoutDSET->init_record ) {
|
if(pscalcoutDSET->init_record ) {
|
||||||
return (*pscalcoutDSET->init_record)(pcalc);
|
return (*pscalcoutDSET->init_record)(pcalc);
|
||||||
}
|
}
|
||||||
The bug has been fixed in version 2-6-1.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <stringinRecord.h>
|
#include "stringinRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <stringoutRecord.h>
|
#include "stringoutRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errlog.h>
|
#include "errlog.h"
|
||||||
#include <waveformRecord.h>
|
#include "waveformRecord.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
#include "devStream.h"
|
#include "devStream.h"
|
||||||
#include <epicsExport.h>
|
|
||||||
|
|
||||||
static long readData (dbCommon *record, format_t *format)
|
static long readData (dbCommon *record, format_t *format)
|
||||||
{
|
{
|
||||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
((epicsFloat32 *)wf->bptr)[wf->nord] = (epicsFloat32)lval;
|
((epicsFloat32 *)wf->bptr)[wf->nord] = (epicsFloat32)lval;
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
case DBF_UINT64:
|
||||||
|
((epicsInt64 *)wf->bptr)[aao->nord] = (epicsInt64)lval;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
case DBF_ULONG:
|
case DBF_ULONG:
|
||||||
((epicsInt32 *)wf->bptr)[wf->nord] = (epicsInt32)lval;
|
((epicsInt32 *)wf->bptr)[wf->nord] = (epicsInt32)lval;
|
||||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
((char*)wf->bptr)[wf->nelm] = 0;
|
((char*)wf->bptr)[wf->nelm-1] = 0;
|
||||||
for (lval = wf->nelm;
|
for (lval = wf->nelm-2;
|
||||||
lval >= 0 && ((char*)wf->bptr)[lval] == 0;
|
lval >= 0 && ((char*)wf->bptr)[lval] == 0;
|
||||||
lval--);
|
lval--);
|
||||||
wf->nord = lval+1;
|
wf->nord = lval+1;
|
||||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
case DBF_FLOAT:
|
case DBF_FLOAT:
|
||||||
dval = ((epicsFloat32 *)wf->bptr)[nowd];
|
dval = ((epicsFloat32 *)wf->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
dval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
dval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
dval = ((epicsInt32 *)wf->bptr)[nowd];
|
dval = ((epicsInt32 *)wf->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
|||||||
{
|
{
|
||||||
switch (wf->ftvl)
|
switch (wf->ftvl)
|
||||||
{
|
{
|
||||||
|
#ifdef DBF_INT64
|
||||||
|
case DBF_INT64:
|
||||||
|
lval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
case DBF_UINT64:
|
||||||
|
lval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DBF_LONG:
|
case DBF_LONG:
|
||||||
lval = ((epicsInt32 *)wf->bptr)[nowd];
|
lval = ((epicsInt32 *)wf->bptr)[nowd];
|
||||||
break;
|
break;
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
#include <epicsThread.h>
|
#include "epicsThread.h"
|
||||||
#include <iocsh.h>
|
#include "iocsh.h"
|
||||||
#include <devStream.h>
|
#include "devStream.h"
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user