Commit 09c197b6 authored by Claes Sjofors's avatar Claes Sjofors

PSS9000 IO, fix for 16 channel di and do cards

parent 088d7e6f
...@@ -87,15 +87,16 @@ static pwr_tStatus IoCardInit ( ...@@ -87,15 +87,16 @@ static pwr_tStatus IoCardInit (
io_sCard *cp io_sCard *cp
) )
{ {
pwr_sClass_Di_DIX2 *op; pwr_sClass_Di_DIX2 *op = (pwr_sClass_Di_DIX2 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
io_sLocal *local; io_sLocal *local;
int i, j; int i, j;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local); io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
op = (pwr_sClass_Di_DIX2 *) cp->op;
local = calloc( 1, sizeof(*local)); local = calloc( 1, sizeof(*local));
cp->Local = local; cp->Local = local;
errh_Info( "Init of di card '%s'", cp->Name); errh_Info( "Init of di card '%s'", cp->Name);
local->Address[0] = op->RegAddress; local->Address[0] = op->RegAddress;
...@@ -103,7 +104,7 @@ static pwr_tStatus IoCardInit ( ...@@ -103,7 +104,7 @@ static pwr_tStatus IoCardInit (
local->Qbus_fp = r_local->Qbus_fp; local->Qbus_fp = r_local->Qbus_fp;
/* Init filter */ /* Init filter */
for ( i = 0; i < 2; i++) for ( i = 0; i < words; i++)
{ {
/* The filter handles one 16-bit word */ /* The filter handles one 16-bit word */
for ( j = 0; j < 16; j++) for ( j = 0; j < 16; j++)
...@@ -128,13 +129,15 @@ static pwr_tStatus IoCardClose ( ...@@ -128,13 +129,15 @@ static pwr_tStatus IoCardClose (
{ {
io_sLocal *local; io_sLocal *local;
int i; int i;
pwr_sClass_Di_DIX2 *op = (pwr_sClass_Di_DIX2 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
local = (io_sLocal *) cp->Local; local = (io_sLocal *) cp->Local;
errh_Info( "IO closing di card '%s'", cp->Name); errh_Info( "IO closing di card '%s'", cp->Name);
/* Free filter data */ /* Free filter data */
for ( i = 0; i < 2; i++) for ( i = 0; i < words; i++)
{ {
if ( local->Filter[i].Found) if ( local->Filter[i].Found)
io_CloseDiFilter( local->Filter[i].Data); io_CloseDiFilter( local->Filter[i].Data);
...@@ -158,7 +161,6 @@ static pwr_tStatus IoCardRead ( ...@@ -158,7 +161,6 @@ static pwr_tStatus IoCardRead (
io_sLocal *local = (io_sLocal *) cp->Local; io_sLocal *local = (io_sLocal *) cp->Local;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local); io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
pwr_tUInt16 data = 0; pwr_tUInt16 data = 0;
pwr_sClass_Di_DIX2 *op;
pwr_sClass_Ssab_RemoteRack *rrp; pwr_sClass_Ssab_RemoteRack *rrp;
pwr_tUInt16 invmask; pwr_tUInt16 invmask;
pwr_tUInt16 convmask; pwr_tUInt16 convmask;
...@@ -167,10 +169,10 @@ static pwr_tStatus IoCardRead ( ...@@ -167,10 +169,10 @@ static pwr_tStatus IoCardRead (
qbus_io_read rb; qbus_io_read rb;
int bfb_error = 0; int bfb_error = 0;
pwr_tTime now; pwr_tTime now;
pwr_sClass_Di_DIX2 *op = (pwr_sClass_Di_DIX2 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
op = (pwr_sClass_Di_DIX2 *) cp->op; for ( i = 0; i < words; i++)
for ( i = 0; i < 2; i++)
{ {
if ( i == 0) if ( i == 0)
{ {
......
...@@ -85,12 +85,12 @@ static pwr_tStatus IoCardInit ( ...@@ -85,12 +85,12 @@ static pwr_tStatus IoCardInit (
io_sCard *cp io_sCard *cp
) )
{ {
pwr_sClass_Do_HVDO32 *op; pwr_sClass_Do_HVDO32 *op = (pwr_sClass_Do_HVDO32 *) cp->op;
io_sLocal *local; io_sLocal *local;
int i, j; int i, j;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local); io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
op = (pwr_sClass_Do_HVDO32 *) cp->op;
local = calloc( 1, sizeof(*local)); local = calloc( 1, sizeof(*local));
cp->Local = local; cp->Local = local;
...@@ -101,7 +101,7 @@ static pwr_tStatus IoCardInit ( ...@@ -101,7 +101,7 @@ static pwr_tStatus IoCardInit (
local->Qbus_fp = r_local->Qbus_fp; local->Qbus_fp = r_local->Qbus_fp;
/* Init filter for Po signals */ /* Init filter for Po signals */
for ( i = 0; i < 2; i++) for ( i = 0; i < words; i++)
{ {
/* The filter handles one 16-bit word */ /* The filter handles one 16-bit word */
for ( j = 0; j < 16; j++) for ( j = 0; j < 16; j++)
...@@ -128,13 +128,15 @@ static pwr_tStatus IoCardClose ( ...@@ -128,13 +128,15 @@ static pwr_tStatus IoCardClose (
{ {
io_sLocal *local; io_sLocal *local;
int i; int i;
pwr_sClass_Do_HVDO32 *op = (pwr_sClass_Do_HVDO32 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
local = (io_sLocal *) cp->Local; local = (io_sLocal *) cp->Local;
errh_Info( "IO closing do card '%s'", cp->Name); errh_Info( "IO closing do card '%s'", cp->Name);
/* Free filter data */ /* Free filter data */
for ( i = 0; i < 2; i++) for ( i = 0; i < words; i++)
{ {
if ( local->Filter[i].Found) if ( local->Filter[i].Found)
io_ClosePoFilter( local->Filter[i].Data); io_ClosePoFilter( local->Filter[i].Data);
...@@ -158,7 +160,6 @@ static pwr_tStatus IoCardWrite ( ...@@ -158,7 +160,6 @@ static pwr_tStatus IoCardWrite (
io_sLocal *local = (io_sLocal *) cp->Local; io_sLocal *local = (io_sLocal *) cp->Local;
io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local); io_sRackLocal *r_local = (io_sRackLocal *)(rp->Local);
pwr_tUInt16 data = 0; pwr_tUInt16 data = 0;
pwr_sClass_Do_HVDO32 *op;
pwr_tUInt16 invmask; pwr_tUInt16 invmask;
pwr_tUInt16 testmask; pwr_tUInt16 testmask;
pwr_tUInt16 testvalue; pwr_tUInt16 testvalue;
...@@ -166,14 +167,15 @@ static pwr_tStatus IoCardWrite ( ...@@ -166,14 +167,15 @@ static pwr_tStatus IoCardWrite (
qbus_io_write wb; qbus_io_write wb;
int sts; int sts;
pwr_tTime now; pwr_tTime now;
pwr_sClass_Do_HVDO32 *op = (pwr_sClass_Do_HVDO32 *) cp->op;
int words = op->MaxNoOfChannels <= 16 ? 1 : 2;
op = (pwr_sClass_Do_HVDO32 *) cp->op;
#if defined(OS_ELN) #if defined(OS_ELN)
vaxc$establish(machfailwrite); vaxc$establish(machfailwrite);
#endif #endif
for ( i = 0; i < 2; i++) for ( i = 0; i < words; i++)
{ {
if ( i == 1 && op->MaxNoOfChannels <= 16) if ( i == 1 && op->MaxNoOfChannels <= 16)
break; break;
......
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