Commit 0b7f0cb1 authored by Claes Sjofors's avatar Claes Sjofors

PSS9000 remote rack check of return status added

parent 07267d37
......@@ -38,3 +38,15 @@ pwr_tUInt16 bfbeth_get_data(io_sRackLocal *r, pwr_tUInt16 address, int *sts) {
}
return 0;
}
void bfbeth_get_write_status(io_sRackLocal *r, pwr_tUInt16 address, int *sts) {
int i;
*sts = 1;
for (i=0; i<350; i++) {
if ( (0x8000 | r->write_area.item[i].address) == address) {
*sts = 0x8000 & r->write_area.item[i].address ? 1 : -1;
return;
}
}
}
......@@ -8,3 +8,7 @@ void bfbeth_set_write_req( io_sRackLocal *r,
pwr_tUInt16 bfbeth_get_data( io_sRackLocal *r,
pwr_tUInt16 address,
int *sts);
void bfbeth_get_write_status( io_sRackLocal *r,
pwr_tUInt16 address,
int *sts);
......@@ -77,6 +77,7 @@ typedef struct {
pwr_tBoolean OldTestOn[IO_MAXCHAN];
int WriteFirst;
pwr_tTime ErrTime;
int FirstScan;
} io_sLocal;
static pwr_tStatus AoRangeToCoef(
......@@ -148,6 +149,7 @@ static pwr_tStatus IoCardInit (
local = calloc( 1, sizeof(*local));
local->Address = op->RegAddress;
local->Qbus_fp = r_local->Qbus_fp;
local->FirstScan = 1;
errh_Info( "Init of ao card '%s'", cp->Name);
......@@ -214,6 +216,8 @@ static pwr_tStatus IoCardWrite (
qbus_io_write wb;
int sts;
pwr_tTime now;
int bfb_error = 0;
pwr_sClass_Ssab_RemoteRack *rrp;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_BaseACard *) cp->op;
......@@ -271,9 +275,36 @@ static pwr_tStatus IoCardWrite (
}
else {
/* Ethernet I/O, Request a write to current address */
sts = 1;
if ( !local->FirstScan)
bfbeth_get_write_status(r_local, (pwr_tUInt16) (local->Address + 2*i), &sts);
bfbeth_set_write_req(r_local, (pwr_tUInt16) (local->Address + 2*i), data);
if (sts == -1) {
/* Error handling for ethernet Qbus-I/O */
rrp = (pwr_sClass_Ssab_RemoteRack *) rp->op;
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs ) {
sts = 1;
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_EmergencyBreak ) {
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
}
if (sts == -1) continue;
}
else {
op->ErrorCount = 0;
}
}
if ( sts == -1)
{
......
......@@ -77,6 +77,7 @@ typedef struct {
pwr_tBoolean Found;
} Filter[2];
pwr_tTime ErrTime;
int FirstScan;
} io_sLocal;
static pwr_tStatus IoCardInit (
......@@ -99,6 +100,7 @@ static pwr_tStatus IoCardInit (
local->Address[0] = op->RegAddress;
local->Address[1] = op->RegAddress + 2;
local->Qbus_fp = ((io_sRackLocal *)(rp->Local))->Qbus_fp;
local->FirstScan = 1;
/* Init filter for Po signals */
for ( i = 0; i < 2; i++)
......@@ -166,6 +168,8 @@ static pwr_tStatus IoCardWrite (
qbus_io_write wb;
int sts;
pwr_tTime now;
int bfb_error = 0;
pwr_sClass_Ssab_RemoteRack *rrp;
local = (io_sLocal *) cp->Local;
op = (pwr_sClass_Ssab_BaseDoCard *) cp->op;
......@@ -227,23 +231,41 @@ static pwr_tStatus IoCardWrite (
}
else {
/* Ethernet I/O, Request a write to current address */
sts = 1;
if ( !local->FirstScan)
bfbeth_get_write_status(r_local, (pwr_tUInt16) local->Address[i], &sts);
bfbeth_set_write_req(r_local, (pwr_tUInt16) local->Address[i], data);
if (sts == -1) {
/* Error handling for ethernet Qbus-I/O */
rrp = (pwr_sClass_Ssab_RemoteRack *) rp->op;
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs ) {
sts = 1;
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_EmergencyBreak ) {
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
}
if (sts == -1) continue;
}
else {
op->ErrorCount = 0;
}
}
/* Error handling for local Qbus-I/O */
if ( sts == -1)
{
#if 0
/* Exceptionhandler was called */
if ( io_fatal_error)
{
/* Activate emergency break */
errh_Error( "Fatal write error, card '%s', IO is stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
#endif
/* Increase error count and check error limits */
time_GetTime( &now);
......@@ -268,6 +290,8 @@ static pwr_tStatus IoCardWrite (
continue;
}
}
if ( local->FirstScan)
local->FirstScan = 0;
return 1;
}
......@@ -302,6 +326,7 @@ static pwr_tStatus IoCardSwap (
local->Address[0] = op->RegAddress;
local->Address[1] = op->RegAddress + 2;
local->Qbus_fp = ((io_sRackLocal *)(rp->Local))->Qbus_fp;
local->FirstScan = 1;
}
for ( i = 0; i < 2; i++) {
......
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