added multi-parm code and made many functions global instead of static
This commit is contained in:
+378
-58
@@ -28,6 +28,7 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 04-14-92 jrw created
|
||||
* .02 05-26-92 jrw changed enumeration of the record types
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -69,9 +70,9 @@
|
||||
|
||||
#include <drvMsg.h>
|
||||
|
||||
int msgDebug = 1;
|
||||
int msgDebug = 0;
|
||||
|
||||
static long drvMsg_initCallback(), drvMsg_write(), drvMsg_AiFmt();
|
||||
static long drvMsg_write(), drvMsg_AiFmt();
|
||||
static long drvMsg_AoFmt(), drvMsg_proc();
|
||||
static long drvMsg_BiFmt(), drvMsg_BoFmt(), drvMsg_MiFmt(), drvMsg_MoFmt();
|
||||
static long drvMsg_LiFmt(), drvMsg_LoFmt(), drvMsg_SiFmt(), drvMsg_SoFmt();
|
||||
@@ -100,6 +101,27 @@ static long (*(msgSupFun[]))() = {
|
||||
};
|
||||
#define NUM_VALID_OPS sizeof(msgSupFun)/sizeof(msgSupFun[0])
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* These are the msgRecEnum structures that are used to define the
|
||||
* types of records supported by the message based driver system.
|
||||
*
|
||||
* This list may be extended by the application developer in the device support
|
||||
* module if necessary.
|
||||
*
|
||||
******************************************************************************/
|
||||
msgRecEnum drvMsgAi = { "Analog In" };
|
||||
msgRecEnum drvMsgAo = { "Analog Out" };
|
||||
msgRecEnum drvMsgBi = { "Binary In" };
|
||||
msgRecEnum drvMsgBo = { "Binary Out" };
|
||||
msgRecEnum drvMsgMi = { "Multibit In" };
|
||||
msgRecEnum drvMsgMo = { "Multibit Out" };
|
||||
msgRecEnum drvMsgLi = { "Long In" };
|
||||
msgRecEnum drvMsgLo = { "Long Out" };
|
||||
msgRecEnum drvMsgSi = { "String In" };
|
||||
msgRecEnum drvMsgSo = { "String Out" };
|
||||
msgRecEnum drvMsgWf = { "Waveform" };
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Driver entry table for the message based I/O driver
|
||||
@@ -162,7 +184,8 @@ msgDset *pdset;
|
||||
initParms.parm = parm;
|
||||
initParms.pdset = pdset;
|
||||
|
||||
printf("Message init routine entered\n");
|
||||
if (msgDebug)
|
||||
printf("Message init routine entered %d, 0x%08.8X\n", parm, pdset);
|
||||
|
||||
if(pdset->pparmBlock->pdrvBlock->drvIoctl != NULL)
|
||||
return((*(pdset->pparmBlock->pdrvBlock->drvIoctl))(MSGIOCTL_INIT, &initParms));
|
||||
@@ -246,6 +269,12 @@ struct dbCommon *prec;
|
||||
msgXact *pmsgXact;
|
||||
msgDrvGenXParm genXactParm;
|
||||
char message[200];
|
||||
#if MULTI_PARM
|
||||
int mpHead;
|
||||
int mpTail;
|
||||
msgMPBuf *pmsgMPBuf;
|
||||
msgMPParm *pmsgMPParm;
|
||||
#endif
|
||||
|
||||
/* allocate and fill in msg specific part */
|
||||
if ((pmsgXact = malloc(sizeof (msgXact))) == NULL)
|
||||
@@ -264,6 +293,9 @@ struct dbCommon *prec;
|
||||
if ((*(pparmBlock->pdrvBlock->drvIoctl))(MSGIOCTL_GENXACT, &genXactParm) == ERROR)
|
||||
{
|
||||
/* free-up the xact structure and clean up */
|
||||
|
||||
/* errMessage() */
|
||||
printf("(Message driver): An error occurred while initializing %s\n", prec->name);
|
||||
return(NULL);
|
||||
}
|
||||
/* Verify that the parm number is within range */
|
||||
@@ -282,30 +314,105 @@ struct dbCommon *prec;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Deal with the multi-parm chain buffers if necessary */
|
||||
#if MULTI_PARM
|
||||
/****************************************************************************
|
||||
*
|
||||
* Deal with the multi-parm chain buffers if necessary
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
if (pparmBlock->pcmds[pmsgXact->parm].flags & (MP_HEAD|MP_TAIL))
|
||||
{ /* The Head and Tail parms are not valid for use by database records. */
|
||||
sprintf(message, "(Message driver) %s parm number %d is an MP marker\n", prec->name, pmsgXact->parm);
|
||||
errMessage(S_db_badField, message);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (pparmBlock->pcmds[pmsgXact->parm].flags & MP_MEMBER)
|
||||
{ /* parm represents a multi-parm chain member, deal with buffer alloc */
|
||||
printf("%s is an MP member\n", prec->name);
|
||||
|
||||
/* Create the msgMPParm to hold the attributes for this xact */
|
||||
/* Figure out the command number of the MP header */
|
||||
mpHead = pmsgXact->parm - 1;
|
||||
while ((mpHead >= 0) && ((pparmBlock->pcmds[mpHead].flags & MP_HEAD) == 0)
|
||||
&& (pparmBlock->pcmds[mpHead].flags & MP_MEMBER))
|
||||
{
|
||||
mpHead--;
|
||||
}
|
||||
if ((mpHead == -1) || !(pparmBlock->pcmds[mpHead].flags & MP_HEAD))
|
||||
{
|
||||
sprintf(message, "(Message driver) %s parm number %d is an MP parm that has no header\n", prec->name, pmsgXact->parm);
|
||||
errMessage(S_db_badField, message);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Figure out the command number of the header */
|
||||
/* Figure out the command number of the MP tail */
|
||||
mpTail = pmsgXact->parm + 1;
|
||||
while ((mpTail < pparmBlock->numCmds)
|
||||
&& ((pparmBlock->pcmds[mpTail].flags & MP_TAIL) == 0)
|
||||
&& (pparmBlock->pcmds[mpTail].flags & MP_MEMBER))
|
||||
{
|
||||
mpTail++;
|
||||
}
|
||||
if ((mpTail == pparmBlock->numCmds) || !(pparmBlock->pcmds[mpTail].flags & MP_TAIL))
|
||||
{
|
||||
sprintf(message, "(Message driver) %s parm number %d is an MP parm that has no tail\n", prec->name, pmsgXact->parm);
|
||||
errMessage(S_db_badField, message);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* See if there is already a buffer created for this MP group */
|
||||
pmsgMPParm = (struct msgMPParm *) (pparmBlock->pcmds[mpHead].writeOp.p);
|
||||
if (pmsgMPParm == NULL)
|
||||
{
|
||||
sprintf(message, "(Message driver) %s message header %d has no parms\n", prec->name, mpHead);
|
||||
errMessage(S_db_badField, message);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* No buffer for this MP group, create a new one */
|
||||
/* We have a MP list member with valid-looking header and tail entries */
|
||||
/* Create the msgMPXact to hold the attributes for this xact */
|
||||
|
||||
/* Put xact into the chain in correct place */
|
||||
pmsgXact->pmp = (msgMPXact *) malloc(sizeof(msgMPXact));
|
||||
|
||||
/* See if a buffer was already created for this MP group */
|
||||
pmsgXact->pmp->pmpb = pmsgXact->phwpvt->pmpbHead;
|
||||
while (pmsgXact->pmp->pmpb != NULL)
|
||||
{
|
||||
if (pmsgXact->pmp->pmpb->head == mpHead)
|
||||
{ /* I got what I am looking for... stop the while loop */
|
||||
printf("got MP member for existing chain (head %d, tail %d)\n", mpHead, mpTail);
|
||||
break;
|
||||
}
|
||||
pmsgXact->pmp->pmpb = pmsgXact->pmp->pmpb->next;
|
||||
}
|
||||
|
||||
if (pmsgXact->pmp->pmpb == NULL)
|
||||
{ /* No buffer for this MP group, create a new one */
|
||||
printf("got a new MP chain, allocating MP buffer structure");
|
||||
pmsgMPBuf = (msgMPBuf *) malloc(sizeof(msgMPBuf));
|
||||
pmsgMPBuf->status = MSG_MP_BUF_DIRTY|MSG_MP_BUF_NO_IO;
|
||||
pmsgMPBuf->pxactHead = NULL;
|
||||
pmsgMPBuf->head = mpHead;
|
||||
pmsgMPBuf->tail = mpTail;
|
||||
pmsgMPBuf->lastXact = -1;
|
||||
pmsgMPBuf->cpos = 0;
|
||||
pmsgMPBuf->len = 0;
|
||||
pmsgMPBuf->time = 0;
|
||||
pmsgMPBuf->pbuf = (unsigned char *) malloc(pmsgMPParm->size);
|
||||
|
||||
pmsgMPBuf->next = pmsgXact->phwpvt->pmpbHead;
|
||||
pmsgXact->phwpvt->pmpbHead = pmsgMPBuf;
|
||||
}
|
||||
|
||||
/* Put xact's msgMPXact structure into the chain */
|
||||
pmsgXact->pmp->next = pmsgXact->pmp->pmpb->pxactHead;
|
||||
pmsgXact->pmp->pmpb->pxactHead = pmsgXact;
|
||||
}
|
||||
else
|
||||
pmsgXact->pmp = NULL;
|
||||
|
||||
#endif /* MULTI_PARM */
|
||||
|
||||
return(pmsgXact);
|
||||
}
|
||||
|
||||
@@ -325,7 +432,9 @@ struct link *plink; /* I/O link structure from record */
|
||||
msgHwpvt *pmsgHwpvt;
|
||||
msgDrvGenHParm genHParms;
|
||||
|
||||
printf("In drvMsg_genHwpvt\n");
|
||||
if (msgDebug)
|
||||
printf("In drvMsg_genHwpvt\n");
|
||||
|
||||
/* allocate and fill in msg specific part */
|
||||
if((pmsgHwpvt = malloc(sizeof(msgHwpvt))) == NULL)
|
||||
return(NULL);
|
||||
@@ -336,6 +445,9 @@ printf("In drvMsg_genHwpvt\n");
|
||||
|
||||
pmsgHwpvt->tmoVal = 0;
|
||||
pmsgHwpvt->tmoCount = 0;
|
||||
#if MULTI_PARM
|
||||
pmsgHwpvt->pmpbHead = NULL;
|
||||
#endif
|
||||
|
||||
genHParms.pparmBlock = pparmBlock;
|
||||
genHParms.plink = plink;
|
||||
@@ -370,7 +482,8 @@ struct link *plink; /* I/O link structure from record */
|
||||
long status;
|
||||
int j;
|
||||
|
||||
printf("In drvMsg_genLink\n");
|
||||
if (msgDebug)
|
||||
printf("In drvMsg_genLink\n");
|
||||
|
||||
/* Allocate and fill in the msg specific part */
|
||||
if ((pmsgLink = malloc(sizeof(msgLink))) == NULL)
|
||||
@@ -424,8 +537,8 @@ printf("In drvMsg_genLink\n");
|
||||
* given device type.
|
||||
*
|
||||
******************************************************************************/
|
||||
static long
|
||||
checkParm(prec, recTyp)
|
||||
long
|
||||
drvMsg_checkParm(prec, recTyp)
|
||||
struct dbCommon *prec;
|
||||
char *recTyp;
|
||||
{
|
||||
@@ -435,7 +548,7 @@ char *recTyp;
|
||||
if (prec->dpvt != NULL)
|
||||
{
|
||||
parm = ((msgXact *)(prec->dpvt))->parm;
|
||||
if ((((msgXact *)(prec->dpvt))->pparmBlock->pcmds)[parm].recTyp != (struct msgDset *)(prec->dset))
|
||||
if ((((msgXact *)(prec->dpvt))->pparmBlock->pcmds)[parm].recTyp != ((struct msgDset *)(prec->dset))->precEnum)
|
||||
{
|
||||
sprintf(message, "Message driver-checkParm: %s parm number %d not valid for %s record type\n", prec->name, parm, recTyp);
|
||||
errMessage(S_db_badField, message);
|
||||
@@ -468,7 +581,7 @@ CALLBACK *pcallback;
|
||||
* phase of the async record processing.
|
||||
*
|
||||
******************************************************************************/
|
||||
static long
|
||||
long
|
||||
drvMsg_initCallback(prec)
|
||||
struct dbCommon *prec;
|
||||
{
|
||||
@@ -543,7 +656,8 @@ msgLink *pmsgLink;
|
||||
msgCmd *pmsgCmd;
|
||||
msgChkEParm checkEventParms;
|
||||
|
||||
printf("Message driver link task %s started\n", pdrvBlock->taskName);
|
||||
if (msgDebug)
|
||||
printf("Message driver link task %s started\n", pdrvBlock->taskName);
|
||||
|
||||
checkEventParms.pdrvBlock = pdrvBlock;
|
||||
checkEventParms.pmsgLink = pmsgLink;
|
||||
@@ -618,26 +732,232 @@ msgLink *pmsgLink;
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This function encapsulates the calls made to the device-specific read and
|
||||
* These functions encapsulates the calls made to the device-specific read and
|
||||
* write functions. The idea here is that we can monitor and/or buffer I/O
|
||||
* operations from here.
|
||||
*
|
||||
* For now, just call the device specific function.
|
||||
* At the moment, this is used to do cehcks on the read-cache's time-to-live.
|
||||
*
|
||||
******************************************************************************/
|
||||
static long
|
||||
drvWrite(pxact, pparm)
|
||||
long
|
||||
drvMsg_drvWrite(pxact, pparm)
|
||||
msgXact *pxact;
|
||||
msgStrParm *pparm;
|
||||
{
|
||||
return(pxact->pparmBlock->pdrvBlock->drvWrite(pxact, pparm));
|
||||
}
|
||||
#if MULTI_PARM
|
||||
|
||||
static long
|
||||
drvRead(pxact, pparm)
|
||||
msgMPParm *pmsgMPParm;
|
||||
msgMPBuf *pmsgMPBuf;
|
||||
|
||||
int mpIOFlag = 0;
|
||||
|
||||
if (pxact->pmp == NULL)
|
||||
{ /* Not a Multi-Parm list member */
|
||||
return(pxact->pparmBlock->pdrvBlock->drvWrite(pxact, pparm));
|
||||
}
|
||||
/* xact is an MP list member... might not have to do any I/O */
|
||||
|
||||
pmsgMPParm = (msgMPParm *)(pxact->pparmBlock->pcmds[pxact->pmp->pmpb->head].writeOp.p);
|
||||
pmsgMPBuf = pxact->pmp->pmpb;
|
||||
|
||||
printf("drvMsg_drvWrite: MP %d (flags 0x%04.4X) xact 0x%08.8X\n", pxact->parm, pmsgMPParm->flags, pxact);
|
||||
|
||||
if (pmsgMPParm->flags & MSG_MP_READ_CACHE)
|
||||
{ /* Init the MP buffer for a new refill (This is a solitation command) */
|
||||
|
||||
if (!(pmsgMPParm->flags & MSG_MP_NO_CHECK_ORDER))
|
||||
{ /* Check to see if parm # is valid */
|
||||
if (pmsgMPBuf->head == pxact->parm - 1)
|
||||
{ /* This is the header operation */
|
||||
if ((pmsgMPBuf->status & MSG_MP_BUF_DIRTY)
|
||||
|| (pmsgMPBuf->lastXact + 1 == pmsgMPBuf->tail))
|
||||
{ /* the order looks OK */
|
||||
pmsgMPBuf->lastXact = pxact->parm;
|
||||
|
||||
/* Check to see if time to refill the read-cache */
|
||||
if ((pmsgMPParm->ttl == 0) || (pmsgMPBuf->time <= tickGet()))
|
||||
{ /* Read cache time-to-live has expired... reset the MP buffer */
|
||||
printf("drvMsg_drvWrite: MP %d processing\n", pxact->parm);
|
||||
mpIOFlag = 1;
|
||||
pmsgMPParm->flags &= ~MSG_MP_BUF_NO_IO;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("drvMsg_drvWrite: MP %d not time to process\n", pxact->parm);
|
||||
pmsgMPParm->flags |= MSG_MP_BUF_NO_IO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* we are not in order */
|
||||
printf("(message driver) drvMsg_drvWrite: processing %s: parm %d out of order, expecting parm %d\n", pxact->prec->name, pxact->parm, pmsgMPBuf->lastXact + 1);
|
||||
pmsgMPBuf->status |= MSG_MP_BUF_ORDER|MSG_MP_BUF_DIRTY;
|
||||
pxact->status = XACT_IOERR;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* Not the header */
|
||||
if (pmsgMPBuf->lastXact == pxact->parm - 1)
|
||||
{ /* non-header order looks OK */
|
||||
pmsgMPBuf->lastXact = pxact->parm;
|
||||
|
||||
/* Only do the I/O if the header was fired out */
|
||||
if (!(pmsgMPParm->flags & MSG_MP_BUF_NO_IO))
|
||||
{
|
||||
printf("drvMsg_drvWrite: MP %d processing\n", pxact->parm);
|
||||
mpIOFlag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("drvMsg_drvWrite: MP %d not time to process (MSG_MP_BUF_NO_IO is set)\n", pxact->parm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("(message driver) drvMsg_drvWrite: processing %s: parm %d out of order\n", pxact->prec->name, pxact->parm);
|
||||
pmsgMPBuf->status |= MSG_MP_BUF_ORDER|MSG_MP_BUF_DIRTY;
|
||||
pxact->status = XACT_IOERR;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* Order is not to be checked */
|
||||
|
||||
/* Check to see if time to refill the read-cache */
|
||||
if ((pmsgMPParm->ttl == 0) || (pmsgMPBuf->time <= tickGet()))
|
||||
{ /* Read cache time-to-live has expired... reset the MP buffer */
|
||||
printf("drvMsg_drvWrite: MP %d processing\n", pxact->parm);
|
||||
mpIOFlag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* Working with an MP list that is write-cached */
|
||||
printf("MP write cacheing is currently non-supported!\n");
|
||||
pmsgMPBuf->status |= MSG_MP_BUF_DIRTY;
|
||||
pxact->status = XACT_IOERR;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
|
||||
/* All checking is complete, if mpIOFlag is set, do the I/O */
|
||||
if (mpIOFlag)
|
||||
{
|
||||
#endif /* MULTI_PARM */
|
||||
|
||||
return(pxact->pparmBlock->pdrvBlock->drvWrite(pxact, pparm));
|
||||
|
||||
#if MULTI_PARM
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("skipping drvMsg_drvWrite operation\n");
|
||||
return(pxact->status);
|
||||
}
|
||||
#endif /* MULTI_PARM */
|
||||
|
||||
/* We never get here */
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
long
|
||||
drvMsg_drvRead(pxact, pparm)
|
||||
msgXact *pxact;
|
||||
msgStrParm *pparm;
|
||||
{
|
||||
#if MULTI_PARM
|
||||
|
||||
msgMPParm *pmsgMPParm;
|
||||
msgMPBuf *pmsgMPBuf;
|
||||
msgStrParm localStrParm;
|
||||
int j;
|
||||
|
||||
if (pxact->pmp == NULL)
|
||||
{
|
||||
return((*(pxact->pparmBlock->pdrvBlock->drvRead))(pxact, pparm));
|
||||
}
|
||||
printf("drvMsg_drvRead: MP %d xact 0x%08.8X\n", pxact->parm, pxact);
|
||||
|
||||
pmsgMPParm = (msgMPParm *)(pxact->pparmBlock->pcmds[pxact->pmp->pmpb->head].writeOp.p);
|
||||
pmsgMPBuf = pxact->pmp->pmpb;
|
||||
|
||||
if (pmsgMPParm->flags & MSG_MP_READ_CACHE)
|
||||
{ /* We ALWAYS read from the MP buffer w/o respect to the ttl value */
|
||||
|
||||
if ((pmsgMPBuf->status & MSG_MP_BUF_READ_STATUS) != MSG_MP_BUF_OK)
|
||||
{
|
||||
printf("drvMsg_drvRead: entered with MPbuf status = 0x%2.2X\n", pmsgMPBuf->status);
|
||||
pxact->status = XACT_IOERR;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
|
||||
/* Make sure the parm number is OK */
|
||||
if (!(pmsgMPParm->flags & MSG_MP_NO_CHECK_ORDER))
|
||||
{ /* We are doing the header, or just finished parm-1 */
|
||||
if (((pmsgMPBuf->head + 1 == pxact->parm)
|
||||
&& (pmsgMPBuf->lastXact == pxact->parm))
|
||||
|| (pmsgMPBuf->lastXact + 1 == pxact->parm))
|
||||
{
|
||||
printf("drvMsg_drvRead: ordered MP read ok\n");
|
||||
pmsgMPBuf->lastXact = pxact->parm;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("drvMsg_drvRead: read operation is out of order\n");
|
||||
pmsgMPBuf->status = MSG_MP_BUF_ORDER|MSG_MP_BUF_DIRTY; /* kill other processing too */
|
||||
pxact->status = XACT_IOERR;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (pmsgMPBuf->lastXact == pxact->parm)
|
||||
{ /* This is the first read in the read chain of the MP list, do the I/O */
|
||||
localStrParm.len = pmsgMPParm->size;
|
||||
localStrParm.buf = pmsgMPBuf->pbuf;
|
||||
if ((*(pxact->pparmBlock->pdrvBlock->drvRead))(pxact, &localStrParm) != XACT_OK)
|
||||
{
|
||||
printf("drvMsg_drvRead died while processing read after the header finished\n");
|
||||
pmsgMPBuf->status = MSG_MP_BUF_DIRTY;
|
||||
return(XACT_IOERR);
|
||||
}
|
||||
pmsgMPBuf->cpos = 0;
|
||||
pmsgMPBuf->len = ?/?/?/?/?;
|
||||
pmsgMPBuf->time = tickGet();
|
||||
}
|
||||
|
||||
/* Everything looks ok, do the read from the buffer cache */
|
||||
if (pmsgMPParm->flags & MSG_MP_PROC_FIFO)
|
||||
{ /* use buffer as a silo & read from the end */
|
||||
printf("reading from cache in FIFO operation\n");
|
||||
j = 0;
|
||||
while ((j < pparm->len) && (pmsgMPBuf->len))
|
||||
{
|
||||
pparm->buf[j] = pmsgMPBuf->pbuf[pmsgMPBuf->cpos];
|
||||
pmsgMPBuf->cpos++;
|
||||
pmsgMPBuf->len--;
|
||||
j++;
|
||||
}
|
||||
pparm->buf[j] = '\0';
|
||||
}
|
||||
else
|
||||
{ /* do the read operation from the head of the buffer */
|
||||
printf("reading from begining of cache\n");
|
||||
j = 0;
|
||||
while ((j < pparm->len) && (j < pmsgMPBuf->len))
|
||||
{
|
||||
pparm->buf[j] = pmsgMPBuf->pbuf[j];
|
||||
j++;
|
||||
}
|
||||
pparm->buf[j] = '\0';
|
||||
}
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
/* MP buffer is a write cache. Do the read operation now */
|
||||
#endif /* MULTI_PARM */
|
||||
|
||||
return((*(pxact->pparmBlock->pdrvBlock->drvRead))(pxact, pparm));
|
||||
}
|
||||
|
||||
@@ -658,7 +978,7 @@ msgCmdOp *pop;
|
||||
if ((pop->op > 0) && (pop->op < NUM_VALID_OPS))
|
||||
return((*(msgSupFun[pop->op]))(pxact, pop->p));
|
||||
|
||||
printf("In drvMsg_xactWork, Invalid operation code -->%d encountered\n", pop->op);
|
||||
printf("drvMsg_xactWork: Invalid operation code %d encountered\n", pop->op);
|
||||
pxact->status = XACT_BADCMD;
|
||||
return(XACT_BADCMD);
|
||||
}
|
||||
@@ -673,7 +993,7 @@ drvMsg_write(pxact, pparm)
|
||||
msgXact *pxact;
|
||||
msgStrParm *pparm;
|
||||
{
|
||||
return(drvWrite(pxact, pparm));
|
||||
return(drvMsg_drvWrite(pxact, pparm));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -701,7 +1021,7 @@ msgAkParm *packParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = packParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
if (msgDebug > 5)
|
||||
printf("drvMsg_CheckAck comparing >%s< at %d against >%s<\n", buf, packParm->index, packParm->str);
|
||||
|
||||
@@ -743,11 +1063,11 @@ msgFiParm *pfiParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = pfiParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
if (pxact->status == XACT_OK)
|
||||
{
|
||||
if (sscanf(buf, pfiParm->format, &(((struct aiRecord *)(pxact->prec))->val)) != 1)
|
||||
if (sscanf(buf, &(pfiParm->format[pfiParm->startLoc]), &(((struct aiRecord *)(pxact->prec))->val)) != 1)
|
||||
pxact->status = XACT_IOERR;
|
||||
}
|
||||
return(pxact->status);
|
||||
@@ -773,11 +1093,11 @@ msgFiParm *pfiParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = pfiParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
if (pxact->status == XACT_OK)
|
||||
{
|
||||
if (sscanf(buf, pfiParm->format, &(((struct biRecord *)(pxact->prec))->rval)) != 1)
|
||||
if (sscanf(buf, &(pfiParm->format[pfiParm->startLoc]), &(((struct biRecord *)(pxact->prec))->rval)) != 1)
|
||||
pxact->status = XACT_IOERR;
|
||||
}
|
||||
return(pxact->status);
|
||||
@@ -803,11 +1123,11 @@ msgFiParm *pfiParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = pfiParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
if (pxact->status == XACT_OK)
|
||||
{
|
||||
if (sscanf(buf, pfiParm->format, &(((struct mbbiRecord *)(pxact->prec))->rval)) != 1)
|
||||
if (sscanf(buf, &(pfiParm->format[pfiParm->startLoc]), &(((struct mbbiRecord *)(pxact->prec))->rval)) != 1)
|
||||
pxact->status = XACT_IOERR;
|
||||
}
|
||||
return(pxact->status);
|
||||
@@ -830,11 +1150,11 @@ msgFiParm *pfiParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = pfiParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
if (pxact->status == XACT_OK)
|
||||
{
|
||||
if (sscanf(buf, pfiParm->format, &(((struct longinRecord *)(pxact->prec))->val)) != 1)
|
||||
if (sscanf(buf, &(pfiParm->format[pfiParm->startLoc]), &(((struct longinRecord *)(pxact->prec))->val)) != 1)
|
||||
pxact->status = XACT_IOERR;
|
||||
}
|
||||
return(pxact->status);
|
||||
@@ -857,11 +1177,11 @@ msgFiParm *pfiParm;
|
||||
strParm.buf = buf;
|
||||
strParm.len = pfiParm->len;
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
if (pxact->status == XACT_OK)
|
||||
{
|
||||
if (sscanf(buf, pfiParm->format, (((struct stringinRecord *)(pxact->prec))->val)) != 1)
|
||||
if (sscanf(buf, &(pfiParm->format[pfiParm->startLoc]), (((struct stringinRecord *)(pxact->prec))->val)) != 1)
|
||||
pxact->status = XACT_IOERR;
|
||||
}
|
||||
return(pxact->status);
|
||||
@@ -869,7 +1189,7 @@ msgFiParm *pfiParm;
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Read a string and use the format string to extract the value field
|
||||
* Read a string
|
||||
*
|
||||
******************************************************************************/
|
||||
static long
|
||||
@@ -882,7 +1202,7 @@ void *parm;
|
||||
strParm.buf = ((struct stringinRecord *)(pxact->prec))->val;
|
||||
strParm.len = sizeof(((struct stringinRecord *)(pxact->prec))->val);
|
||||
|
||||
drvRead(pxact, &strParm);
|
||||
drvMsg_drvRead(pxact, &strParm);
|
||||
|
||||
return(pxact->status);
|
||||
}
|
||||
@@ -907,7 +1227,7 @@ msgFoParm *pfoParm;
|
||||
sprintf(buf, pfoParm->format, ((struct aoRecord *)(pxact->prec))->val);
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -924,7 +1244,7 @@ msgFoParm *pfoParm;
|
||||
sprintf(buf, pfoParm->format, ((struct boRecord *)(pxact->prec))->val);
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -948,7 +1268,7 @@ msgFoParm *pfoParm;
|
||||
sprintf(buf, pfoParm->format, ((struct mbboRecord *)(pxact->prec))->rval);
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -965,7 +1285,7 @@ msgFoParm *pfoParm;
|
||||
sprintf(buf, pfoParm->format, ((struct longoutRecord *)(pxact->prec))->val);
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -982,7 +1302,7 @@ msgFoParm *pfoParm;
|
||||
sprintf(buf, pfoParm->format, ((struct stringoutRecord *)(pxact->prec))->val);
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -996,7 +1316,7 @@ void *parm;
|
||||
wrParm.buf = ((struct stringoutRecord *)(pxact->prec))->val;
|
||||
wrParm.len = -1; /* write until reach NULL character */
|
||||
|
||||
drvWrite(pxact, &wrParm);
|
||||
drvMsg_drvWrite(pxact, &wrParm);
|
||||
return(pxact->status);
|
||||
}
|
||||
|
||||
@@ -1023,7 +1343,7 @@ struct aiRecord *pai;
|
||||
|
||||
if (pai->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pai, "AI");
|
||||
status = drvMsg_checkParm(pai, "AI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pai); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1049,7 +1369,7 @@ struct aoRecord *pao;
|
||||
|
||||
if (pao->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pao, "AO");
|
||||
status = drvMsg_checkParm(pao, "AO");
|
||||
if (status == 0)
|
||||
{
|
||||
drvMsg_initCallback(pao); /* Init for async record completion callback */
|
||||
@@ -1080,7 +1400,7 @@ struct biRecord *pbi;
|
||||
|
||||
if (pbi->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pbi, "BI");
|
||||
status = drvMsg_checkParm(pbi, "BI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pbi); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1106,7 +1426,7 @@ struct boRecord *pbo;
|
||||
|
||||
if (pbo->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pbo, "BO");
|
||||
status = drvMsg_checkParm(pbo, "BO");
|
||||
if (status == 0)
|
||||
{
|
||||
drvMsg_initCallback(pbo); /* Init for async record completion callback */
|
||||
@@ -1137,7 +1457,7 @@ struct mbbiRecord *pmi;
|
||||
|
||||
if (pmi->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pmi, "MBBI");
|
||||
status = drvMsg_checkParm(pmi, "MBBI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pmi); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1163,7 +1483,7 @@ struct mbboRecord *pmo;
|
||||
|
||||
if (pmo->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pmo, "MBBO");
|
||||
status = drvMsg_checkParm(pmo, "MBBO");
|
||||
if (status == 0)
|
||||
{
|
||||
drvMsg_initCallback(pmo); /* Init for async record completion callback */
|
||||
@@ -1194,7 +1514,7 @@ struct longinRecord *pli;
|
||||
|
||||
if (pli->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pli, "LI");
|
||||
status = drvMsg_checkParm(pli, "LI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pli); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1221,7 +1541,7 @@ struct longoutRecord *plo;
|
||||
|
||||
if (plo->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(plo, "LO");
|
||||
status = drvMsg_checkParm(plo, "LO");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(plo); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1249,7 +1569,7 @@ struct stringinRecord *psi;
|
||||
|
||||
if (psi->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(psi, "SI");
|
||||
status = drvMsg_checkParm(psi, "SI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(psi); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1276,7 +1596,7 @@ struct stringoutRecord *pso;
|
||||
|
||||
if (pso->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pso, "SI");
|
||||
status = drvMsg_checkParm(pso, "SI");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pso); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1304,7 +1624,7 @@ struct waveformRecord *pwf;
|
||||
|
||||
if (pwf->dpvt != NULL)
|
||||
{
|
||||
status = checkParm(pwf, "WAVEFORM");
|
||||
status = drvMsg_checkParm(pwf, "WAVEFORM");
|
||||
if (status == 0)
|
||||
drvMsg_initCallback(pwf); /* Init for async record completion callback */
|
||||
else
|
||||
@@ -1408,11 +1728,11 @@ struct stringoutRecord *pso;
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* BUG -- I should probably defigure out the return code from the conversion
|
||||
* BUG -- I should probably figure out the return code from the conversion
|
||||
* routine. Not from a hard-coded value passed in from above.
|
||||
*/
|
||||
|
||||
static long
|
||||
long
|
||||
drvMsg_proc(prec, ret)
|
||||
struct dbCommon *prec; /* record to process */
|
||||
int ret; /* If all goes well, return this value */
|
||||
|
||||
Reference in New Issue
Block a user