Commit 961dd9ac authored by Claes Sjofors's avatar Claes Sjofors

PSS9000 error count incrementation modified

parent 1389cbf7
......@@ -76,7 +76,8 @@ typedef struct {
int Qbus_fp;
unsigned int bfb_item;
int ScanCount[IO_MAXCHAN];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus AiRangeToCoef(
......@@ -155,6 +156,10 @@ static pwr_tStatus IoCardInit (
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -202,7 +207,6 @@ static pwr_tStatus IoCardRead (
int sts;
qbus_io_read rb;
int bfb_error = 0;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ai_AI32uP *) cp->op;
......@@ -290,16 +294,7 @@ static pwr_tStatus IoCardRead (
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -346,6 +341,15 @@ static pwr_tStatus IoCardRead (
}
chanp++;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -76,7 +76,8 @@ typedef struct {
unsigned int Address;
int Qbus_fp;
int ScanCount[IO_MAXCHAN];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus AiRangeToCoef(
......@@ -151,6 +152,11 @@ static pwr_tStatus IoCardInit (
AiRangeToCoef( chanp);
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -198,7 +204,6 @@ static pwr_tStatus IoCardRead (
qbus_io_read rb;
qbus_io_write wb;
int timeout;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ai_HVAI32 *) cp->op;
......@@ -261,16 +266,7 @@ static pwr_tStatus IoCardRead (
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -325,6 +321,15 @@ static pwr_tStatus IoCardRead (
}
chanp++;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -77,7 +77,8 @@ typedef struct {
pwr_tFloat32 OldValue[IO_MAXCHAN];
pwr_tBoolean OldTestOn[IO_MAXCHAN];
int WriteFirst;
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus AoRangeToCoef(
......@@ -163,6 +164,10 @@ static pwr_tStatus IoCardInit (
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -212,7 +217,6 @@ static pwr_tStatus IoCardWrite (
pwr_tFloat32 rawvalue;
qbus_io_write wb;
int sts;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ao_HVAO4 *) cp->op;
......@@ -287,16 +291,7 @@ static pwr_tStatus IoCardWrite (
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -322,6 +317,15 @@ static pwr_tStatus IoCardWrite (
}
if ( local->WriteFirst)
local->WriteFirst--;
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -81,7 +81,8 @@ typedef struct {
unsigned int bfb_item;
pwr_tInt32 OldValue[IO_MAXCHAN];
int FirstScan[IO_MAXCHAN];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -175,6 +176,10 @@ static pwr_tStatus IoCardInit (
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -223,7 +228,6 @@ static pwr_tStatus IoCardRead (
qbus_io_read rb;
qbus_io_write wb;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Co_PI24BO *) cp->op;
......@@ -346,16 +350,7 @@ static pwr_tStatus IoCardRead (
if ( sts1 == -1 || sts2 == -1)
{
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -446,6 +441,15 @@ static pwr_tStatus IoCardRead (
}
local->FirstScan[i] = 0;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -78,7 +78,8 @@ typedef struct {
void *Data[16];
pwr_tBoolean Found;
} Filter[2];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -114,6 +115,10 @@ static pwr_tStatus IoCardInit (
local->Filter[i].Data, ctx->ScanTime);
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -169,7 +174,6 @@ static pwr_tStatus IoCardRead (
int sts;
qbus_io_read rb;
int bfb_error = 0;
pwr_tTime now;
pwr_sClass_Di_DIX2 *op = (pwr_sClass_Di_DIX2 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
......@@ -238,16 +242,7 @@ static pwr_tStatus IoCardRead (
if ( sts <= 0)
{
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit)
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -270,6 +265,15 @@ static pwr_tStatus IoCardRead (
/* Move data to valuebase */
io_DiUnpackWord( cp, data, convmask, i);
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -76,7 +76,8 @@ typedef struct {
void *Data[16];
pwr_tBoolean Found;
} Filter[2];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -114,6 +115,10 @@ static pwr_tStatus IoCardInit (
local->Filter[i].Data, ctx->ScanTime);
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -167,7 +172,6 @@ static pwr_tStatus IoCardWrite (
int i;
qbus_io_write wb;
int sts;
pwr_tTime now;
pwr_sClass_Do_HVDO32 *op = (pwr_sClass_Do_HVDO32 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
......@@ -246,16 +250,7 @@ static pwr_tStatus IoCardWrite (
}
#endif
/* Increase error count and check error limits */
time_GetTime(&now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -273,6 +268,15 @@ static pwr_tStatus IoCardWrite (
continue;
}
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -73,7 +73,8 @@ typedef struct {
unsigned int Address;
int Qbus_fp;
int ScanCount[IO_MAXCHAN];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus AiRangeToCoef(
......@@ -150,6 +151,10 @@ static pwr_tStatus IoCardInit (
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -197,7 +202,6 @@ static pwr_tStatus IoCardRead (
int sts;
qbus_io_read rb;
int bfb_error = 0;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_BaseACard *) cp->op;
......@@ -286,16 +290,7 @@ static pwr_tStatus IoCardRead (
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -345,6 +340,15 @@ static pwr_tStatus IoCardRead (
}
chanp++;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -76,7 +76,8 @@ typedef struct {
pwr_tFloat32 OldValue[IO_MAXCHAN];
pwr_tBoolean OldTestOn[IO_MAXCHAN];
int WriteFirst;
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
int FirstScan;
pwr_tBoolean CheckWrite[IO_MAXCHAN];
} io_sLocal;
......@@ -167,6 +168,10 @@ static pwr_tStatus IoCardInit (
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -216,7 +221,6 @@ static pwr_tStatus IoCardWrite (
pwr_tFloat32 rawvalue;
qbus_io_write wb;
int sts;
pwr_tTime now;
int bfb_error = 0;
pwr_sClass_Ssab_RemoteRack *rrp;
int remote;
......@@ -339,16 +343,7 @@ static pwr_tStatus IoCardWrite (
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -376,6 +371,15 @@ static pwr_tStatus IoCardWrite (
local->WriteFirst--;
if ( local->FirstScan)
local->FirstScan = 0;
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -78,7 +78,8 @@ typedef struct {
int Qbus_fp;
pwr_tInt32 OldValue[IO_MAXCHAN];
int FirstScan[IO_MAXCHAN];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -172,6 +173,10 @@ static pwr_tStatus IoCardInit (
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -220,7 +225,6 @@ static pwr_tStatus IoCardRead (
qbus_io_read rb;
qbus_io_write wb;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_CO4uP *) cp->op;
......@@ -334,16 +338,7 @@ static pwr_tStatus IoCardRead (
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -434,6 +429,15 @@ static pwr_tStatus IoCardRead (
}
local->FirstScan[i] = 0;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -76,7 +76,8 @@ typedef struct {
void *Data[16];
pwr_tBoolean Found;
} Filter[2];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -110,6 +111,10 @@ static pwr_tStatus IoCardInit (
local->Filter[i].Data, ctx->ScanTime);
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -164,7 +169,6 @@ static pwr_tStatus IoCardRead (
int sts;
qbus_io_read rb;
int bfb_error = 0;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_BaseDiCard *) cp->op;
......@@ -236,16 +240,7 @@ static pwr_tStatus IoCardRead (
/* Error handling for local Qbus-I/O */
{
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -273,6 +268,15 @@ static pwr_tStatus IoCardRead (
/* Move data to valuebase */
io_DiUnpackWord( cp, data, convmask, i);
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -77,7 +77,8 @@ typedef struct {
void *Data[16];
pwr_tBoolean Found;
} Filter[2];
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
int FirstScan;
} io_sLocal;
......@@ -116,6 +117,10 @@ static pwr_tStatus IoCardInit (
local->Filter[i].Data, ctx->ScanTime);
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -168,7 +173,6 @@ static pwr_tStatus IoCardWrite (
int i;
qbus_io_write wb;
int sts;
pwr_tTime now;
int bfb_error = 0;
pwr_sClass_Ssab_RemoteRack *rrp;
......@@ -274,17 +278,7 @@ static pwr_tStatus IoCardWrite (
if ( sts == -1)
{
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -304,6 +298,15 @@ static pwr_tStatus IoCardWrite (
}
if ( local->FirstScan)
local->FirstScan = 0;
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview Open Source Process Control.
* Copyright (C) 2005-2016 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -13,8 +15,23 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_ssab_mioup.c -- io methods for ssab cards. */
......@@ -64,7 +81,8 @@ typedef struct {
pwr_tFloat32 OldValue[IO_MAXCHAN];
pwr_tBoolean OldTestOn[IO_MAXCHAN];
int WriteFirst;
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
} io_sLocal;
static pwr_tStatus AoRangeToCoef(
......@@ -264,6 +282,11 @@ static pwr_tStatus IoCardInit (
chanp++;
}
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -312,7 +335,6 @@ static pwr_tStatus IoCardRead (
qbus_io_read rb;
qbus_io_write writeb;
int bfb_error = 0;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_BaseMCard *) cp->op;
......@@ -405,16 +427,7 @@ static pwr_tStatus IoCardRead (
/* Error handling for local Qbus-I/O */
{
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -487,7 +500,6 @@ static pwr_tStatus IoCardWrite (
pwr_tFloat32 rawvalue;
qbus_io_write writeb;
int sts;
pwr_tTime now;
pwr_tUInt16 invmask;
pwr_tUInt16 testmask;
pwr_tUInt16 testvalue;
......@@ -563,16 +575,7 @@ static pwr_tStatus IoCardWrite (
{
/* Exceptionhandler was called */
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -642,17 +645,7 @@ static pwr_tStatus IoCardWrite (
if ( sts == -1) {
/* Increase error count and check error limits */
time_GetTime( &now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -668,6 +661,13 @@ static pwr_tStatus IoCardWrite (
}
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
......@@ -163,7 +163,8 @@ typedef struct {
unsigned short stat_ind;
unsigned short ran_ind;
unsigned short init;
pwr_tTime ErrTime;
unsigned int ErrReset;
unsigned int ErrScanCnt;
unsigned short Valid;
} io_sLocal;
......@@ -251,6 +252,10 @@ static pwr_tStatus IoCardInit (
local->stat_ind = ((char *) &local->Stat - (char *) local) / 2;
local->ran_ind = ((char *) &local->AoRange - (char *) local) / 2;
local->ErrReset = 1.0 / ctx->ScanTime + 0.5;
if ( local->ErrReset < 2)
local->ErrReset = 2;
return 1;
}
......@@ -291,7 +296,6 @@ static pwr_tStatus IoCardRead (
card_stat c_stat;
unsigned short *datap;
unsigned short diff;
pwr_tTime now;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_PIDuP *) cp->op;
......@@ -317,16 +321,7 @@ static pwr_tStatus IoCardRead (
if ( sts == -1) {
/* Increase error count and check error limits */
time_GetTime(&now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -377,7 +372,6 @@ static pwr_tStatus IoCardWrite (
pwr_sClass_Ssab_PIDuP *op;
int ii;
int sts;
pwr_tTime now;
unsigned short diff;
card_dyn c_dyn;
card_par c_par;
......@@ -526,16 +520,7 @@ static pwr_tStatus IoCardWrite (
if ( sts == -1) {
/* Increase error count and check error limits */
time_GetTime(&now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -577,16 +562,7 @@ static pwr_tStatus IoCardWrite (
if ( sts == -1) {
/* Increase error count and check error limits */
time_GetTime(&now);
if (op->ErrorCount > op->ErrorSoftLimit) {
/* Ignore if some time has expired */
if (now.tv_sec - local->ErrTime.tv_sec < 600)
op->ErrorCount++;
}
else
op->ErrorCount++;
local->ErrTime = now;
op->ErrorCount++;
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
......@@ -626,6 +602,14 @@ static pwr_tStatus IoCardWrite (
return IO__ERRDEVICE;
}
/* Fix for qbus errors */
local->ErrScanCnt++;
if ( local->ErrScanCnt >= local->ErrReset) {
local->ErrScanCnt = 0;
if ( op->ErrorCount > op->ErrorSoftLimit)
op->ErrorCount--;
}
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment