Merge commit 'refs/merge-requests/1' of ssh://gitorious.psi.ch/sinqdev/sics into merge-requests/1
First merge with ANSTO which compiles Conflicts: SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c exebuf.c hipadaba.c interface.h make_gen motor.c nserver.c nwatch.c ofac.c protocol.c sicshipadaba.c
This commit is contained in:
64
counter.c
64
counter.c
@ -551,7 +551,7 @@ static int SetCounterModeImpl(pCounter self, CounterMode eNew)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
CounterMode GetCounterMode(pCounter self)
|
||||
{
|
||||
return self->getMode(self);
|
||||
return self->getMode(self);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static CounterMode GetCounterModeImpl(pCounter self)
|
||||
@ -562,7 +562,7 @@ static CounterMode GetCounterModeImpl(pCounter self)
|
||||
/*------------------------------------------------------------------------*/
|
||||
int GetNMonitor(pCounter self)
|
||||
{
|
||||
return self->getNMonitor(self);
|
||||
return self->getNMonitor(self);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int GetNMonitorImpl(pCounter self)
|
||||
@ -571,13 +571,28 @@ static int GetNMonitorImpl(pCounter self)
|
||||
return self->pDriv->iNoOfMonitors;
|
||||
}
|
||||
|
||||
int GetControlMonitor(pCounter self)
|
||||
{
|
||||
return self->pDriv->iControlMonitor;
|
||||
}
|
||||
|
||||
int SetControlMonitor(pCounter self, int channel)
|
||||
{
|
||||
int maxchan = self->pDriv->iNoOfMonitors - 1;
|
||||
if (channel < 0 || channel > maxchan) {
|
||||
return 0;
|
||||
}
|
||||
self->pDriv->iControlMonitor = channel;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef NONINTF
|
||||
extern float nintf(float f);
|
||||
#endif
|
||||
/*------------------------------------------------------------------------*/
|
||||
int SetCounterPreset(pCounter self, float fVal)
|
||||
{
|
||||
return self->setPreset(self,fVal);
|
||||
return self->setPreset(self,fVal);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int SetCounterPresetImpl(pCounter self, float fVal)
|
||||
@ -603,17 +618,17 @@ static int SetCounterPresetImpl(pCounter self, float fVal)
|
||||
/*------------------------------------------------------------------------*/
|
||||
float GetCounterPreset(pCounter self)
|
||||
{
|
||||
return self->getPreset(self);
|
||||
return self->getPreset(self);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
float GetControlValue(pCounter self)
|
||||
{
|
||||
return self->getControlValue(self);
|
||||
return self->getControlValue(self);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static float GetControlValueImpl(pCounter self)
|
||||
{
|
||||
return self->pDriv->fLastCurrent;
|
||||
return self->pDriv->fLastCurrent;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static float GetCounterPresetImpl(pCounter self)
|
||||
@ -634,7 +649,7 @@ static float GetCounterPresetImpl(pCounter self)
|
||||
/*-----------------------------------------------------------------------*/
|
||||
long GetCounts(pCounter self, SConnection * pCon)
|
||||
{
|
||||
return self->getCounts(self, pCon);
|
||||
return self->getCounts(self, pCon);
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static long GetCountsImpl(pCounter self, SConnection * pCon)
|
||||
@ -643,12 +658,12 @@ static long GetCountsImpl(pCounter self, SConnection * pCon)
|
||||
if (!self->isUpToDate) {
|
||||
self->pCountInt->TransferData(self, pCon);
|
||||
}
|
||||
return self->pDriv->lCounts[0];
|
||||
return self->pDriv->lCounts[self->pDriv->iControlMonitor];
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
long GetMonitor(pCounter self, int iNum, SConnection * pCon)
|
||||
{
|
||||
return self->getMonitor(self, iNum, pCon);
|
||||
return self->getMonitor(self, iNum, pCon);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static long GetMonitorImpl(pCounter self, int iNum, SConnection * pCon)
|
||||
@ -658,7 +673,7 @@ static long GetMonitorImpl(pCounter self, int iNum, SConnection * pCon)
|
||||
if (!self->isUpToDate) {
|
||||
self->pCountInt->TransferData(self, pCon);
|
||||
}
|
||||
if ((iNum < 0) || (iNum > self->pDriv->iNoOfMonitors)) {
|
||||
if ((iNum < 0) || (iNum >= self->pDriv->iNoOfMonitors)) {
|
||||
return -1L;
|
||||
} else {
|
||||
return self->pDriv->lCounts[iNum];
|
||||
@ -667,7 +682,7 @@ static long GetMonitorImpl(pCounter self, int iNum, SConnection * pCon)
|
||||
/*-----------------------------------------------------------------------*/
|
||||
void SetMonitorValue(pCounter self, int index, long value)
|
||||
{
|
||||
return self->setMonitor(self, index, value);
|
||||
return self->setMonitor(self, index, value);
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static void SetMonitorValueImpl(pCounter self, int index, long value)
|
||||
@ -681,7 +696,7 @@ static void SetMonitorValueImpl(pCounter self, int index, long value)
|
||||
/*------------------------------------------------------------------------*/
|
||||
float GetCountTime(pCounter self, SConnection * pCon)
|
||||
{
|
||||
return self->getTime(self, pCon);
|
||||
return self->getTime(self, pCon);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static float GetCountTimeImpl(pCounter self, SConnection * pCon)
|
||||
@ -832,6 +847,8 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
{"getnmon", 0, {0, 0}},
|
||||
{"state", 0, {0, 0}},
|
||||
{"error", 0, {0, 0}},
|
||||
{"getchannel",0,{0}},
|
||||
{"setchannel",1,{FUPAINT}},
|
||||
{"countstatus", 0, {0, 0}}
|
||||
};
|
||||
char *pMode[] = {
|
||||
@ -849,8 +866,8 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
argtolower(argc, argv);
|
||||
argx = &argv[1];
|
||||
iRet =
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 26, argc - 1, argx,
|
||||
&PaRes);
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 28, argc - 1, argx,
|
||||
&PaRes);
|
||||
if (iRet < 0) {
|
||||
snprintf(pBueffel, 255,"%s", PaRes.pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
@ -958,7 +975,7 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
case 11: /* status */
|
||||
case 25:
|
||||
case 27:
|
||||
self->pCountInt->TransferData(self, pCon);
|
||||
if (GetCounterMode(self) == ePreset) {
|
||||
lVal = GetCounterPreset(self);
|
||||
@ -1144,8 +1161,8 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
iRet = self->pDriv->Get(self->pDriv, PaRes.Arg[0].text,
|
||||
PaRes.Arg[1].iVal, &fVal);
|
||||
if (iRet == 1) {
|
||||
snprintf(pBueffel,255, "%s.%s %d = %f", argv[0], PaRes.Arg[0].text,
|
||||
PaRes.Arg[1].iVal, fVal);
|
||||
snprintf(pBueffel,255, "%s.%s %s = %f", argv[0], PaRes.Arg[0].text,
|
||||
PaRes.Arg[1].text, fVal);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
@ -1172,6 +1189,19 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
break;
|
||||
case 25: /* getchannel */
|
||||
snprintf(pBueffel,131,"%s.getchannel = %d", argv[0], GetControlMonitor(self));
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
break;
|
||||
case 26: /* setchannel */
|
||||
if (SetControlMonitor(self, PaRes.Arg[0].iVal)) {
|
||||
return 1;
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: Invalid channel id",eError);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0); /* internal error */
|
||||
}
|
||||
|
Reference in New Issue
Block a user