- Introduced a new trace facility

- Fixed performance problems in many protocol drivers.
This commit is contained in:
koennecke
2011-06-29 07:53:54 +00:00
parent 30fa6e9081
commit 8162f117bd
5 changed files with 38 additions and 3 deletions

View File

@ -67,6 +67,7 @@ int JulchoHandler(Ascon * a)
a->state = AsconTimeout; a->state = AsconTimeout;
} }
} }
return 0;
} }
break; break;
default: default:

View File

@ -62,6 +62,7 @@ static int PhytronHandler(Ascon * a)
a->state = AsconTimeout; a->state = AsconTimeout;
} }
} }
return 0;
} }
break; break;
default: default:

View File

@ -16,6 +16,10 @@
* copyright: see file COPYRIGHT * copyright: see file COPYRIGHT
* *
* Mark Koennecke, December 2008 * Mark Koennecke, December 2008
*
* Introduced a delay on read in order to throttle requests
*
* Mark Koennecke, June 2011
*/ */
#include <errno.h> #include <errno.h>
#include <ascon.h> #include <ascon.h>
@ -79,8 +83,12 @@ typedef struct {
char *ptr; char *ptr;
int bytesToWrite; int bytesToWrite;
int expectACK; int expectACK;
double startTime;
} PMACPrivate, *pPMACPrivate; } PMACPrivate, *pPMACPrivate;
/*---------------------------------------------------------------------------*
* wait period before read
----------------------------------------------------------------------------*/
#define READDELAY .05
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int PMACHandler(Ascon * a) static int PMACHandler(Ascon * a)
{ {
@ -123,11 +131,19 @@ static int PMACHandler(Ascon * a)
a->wrPos += ret; a->wrPos += ret;
if (a->wrPos >= priv->bytesToWrite) { if (a->wrPos >= priv->bytesToWrite) {
a->state = AsconWriteDone; a->state = AsconWriteDone;
priv->startTime = DoubleTime();
} else { } else {
priv->ptr += ret; priv->ptr += ret;
} }
} }
break; break;
case AsconReadStart:
DynStringClear(a->rdBuffer);
if(DoubleTime() > priv->startTime + READDELAY){
a->start = DoubleTime();
a->state = AsconReading;
}
break;
case AsconReading: case AsconReading:
ret = AsconReadChar(a->fd, &chr); ret = AsconReadChar(a->fd, &chr);
if (ret < 0) { if (ret < 0) {
@ -166,6 +182,7 @@ static int PMACHandler(Ascon * a)
a->state = AsconTimeout; a->state = AsconTimeout;
} }
} }
return 0;
} }
break; break;
default: default:

View File

@ -6,6 +6,8 @@
copyright: see copyright.h copyright: see copyright.h
Uwe Filges, November 2001 Uwe Filges, November 2001
Various edits, added rotaion_speed_targtes, Mark Koennecke, 2011
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
@ -24,6 +26,7 @@
#include "polterwrite.h" #include "polterwrite.h"
#include "sicsvar.h" #include "sicsvar.h"
#include "nxscript.h" #include "nxscript.h"
#include "sicshipadaba.h"
/* /*
diaphragm1 - chopper diaphragm1 - chopper
@ -128,9 +131,18 @@ static void writePolterdiGlobal(NXhandle hfil, NXdict hdict,
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
static void writeChopper(NXhandle hfil, NXdict hdict, SConnection * pCon) static void writeChopper(NXhandle hfil, NXdict hdict, SConnection * pCon)
{ {
pHdb node = NULL;
float fVal;
SNXSPutVariable(pServ->pSics, pCon, hfil, hdict, "cname", "choppername"); SNXSPutVariable(pServ->pSics, pCon, hfil, hdict, "cname", "choppername");
SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperspeed", "crot"); SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperspeed", "crot");
SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperphase", "cphase"); SNXSPutDrivable(pServ->pSics, pCon, hfil, hdict, "chopperphase", "cphase");
node = FindHdbNode(NULL,"/sics/choco/chopper/nspee", NULL);
if(node != NULL){
fVal = (float)node->value.v.doubleValue;
NXDputalias(hfil,hdict,"crottarget",&fVal);
}
} }
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/

View File

@ -164,7 +164,7 @@ static char *S7WriteHandler(void *actionData, char *reply, int comerror)
static void UpdateSPSDataBase(pS7Action self) static void UpdateSPSDataBase(pS7Action self)
{ {
char *pPtr; char *pPtr;
char name[15], unit[9], description[25], reference[11], error[50]; char name[15], unit[9], description[25], reference[11], error[50], alarms[10];
unsigned char type, alarm; unsigned char type, alarm;
unsigned short val; unsigned short val;
int ival; int ival;
@ -220,6 +220,8 @@ static void UpdateSPSDataBase(pS7Action self)
snprintf(error,50,"Alarm %d on par",alarm); snprintf(error,50,"Alarm %d on par",alarm);
SetHdbProperty(node,"geterror", error); SetHdbProperty(node,"geterror", error);
} }
snprintf(alarms,sizeof(alarms),"%d",alarm);
SetHdbProperty(node,"alarm", alarms);
} }
} }
/*------------------------------------------------------------------ /*------------------------------------------------------------------
@ -308,7 +310,7 @@ static hdbCallbackReturn S7WriteCallback(pHdb currentNode,
static void InitializeSPSDataBase(pS7Action self, pHdb parent) static void InitializeSPSDataBase(pS7Action self, pHdb parent)
{ {
char *pPtr; char *pPtr;
char name[15], unit[9], description[25], reference[11], num[11], error[50]; char name[15], unit[9], description[25], reference[11], num[11], error[50], alarms[10];
unsigned char type, alarm; unsigned char type, alarm;
short val; short val;
int ival; int ival;
@ -364,6 +366,8 @@ static void InitializeSPSDataBase(pS7Action self, pHdb parent)
snprintf(error,10,"Alarm %d on par",alarm); snprintf(error,10,"Alarm %d on par",alarm);
SetHdbProperty(node,"geterror", error); SetHdbProperty(node,"geterror", error);
} }
snprintf(alarms,sizeof(alarms),"%d",alarm);
SetHdbProperty(node,"alarm", alarms);
SetHdbProperty(node,"unit", unit); SetHdbProperty(node,"unit", unit);
SetHdbProperty(node,"description", description); SetHdbProperty(node,"description", description);
SetHdbProperty(node,"reference", reference); SetHdbProperty(node,"reference", reference);