Commit 6dbc960f authored by Claes Sjofors's avatar Claes Sjofors

IO, max limit for number of channels for a card removed

parent ab3f39d7
......@@ -1680,6 +1680,7 @@ static pwr_tStatus io_init_card(
if ( ok) {
/* Treat this card in this process */
strcpy( attrname, cname);
strcat( attrname, ".MaxNoOfChannels");
sts = gdh_GetObjectInfo( attrname, &maxchan, sizeof(maxchan));
......@@ -1693,6 +1694,80 @@ static pwr_tStatus io_init_card(
}
}
if ( !fix_channels) {
/* Count number of channels */
maxchan = 0;
sts = gdh_GetChild( objid, &chan);
while( ODD(sts)) {
sts = gdh_GetObjectClass( chan, &class);
if ( EVEN(sts)) return sts;
switch ( class) {
case pwr_cClass_ChanAi:
case pwr_cClass_ChanAit:
case pwr_cClass_ChanAo:
case pwr_cClass_ChanDo:
case pwr_cClass_ChanDi:
case pwr_cClass_ChanIi:
case pwr_cClass_ChanIo:
case pwr_cClass_ChanCo:
maxchan++;
break;
default: ;
}
sts = gdh_GetNextSibling( chan, &chan);
}
if ( !maxchan) {
gdh_sAttrDef *bd;
int rows;
int i;
sts = gdh_GetObjectBodyDef( class, &bd, &rows, pwr_cNObjid);
if ( EVEN(sts)) return sts;
for ( i = 0; i < rows; i++) {
switch ( bd[i].attr->Param.TypeRef) {
case pwr_cClass_ChanAi:
case pwr_cClass_ChanAit:
case pwr_cClass_ChanAo:
case pwr_cClass_ChanDi:
case pwr_cClass_ChanDo:
case pwr_cClass_ChanIi:
case pwr_cClass_ChanIo:
case pwr_cClass_ChanCo:
maxchan++;
break;
default:
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_CLASS) {
gdh_sAttrDef *bd2;
int rows2, ii;
sts = gdh_GetObjectBodyDef( bd[i].attr->Param.TypeRef, &bd2, &rows2, pwr_cNObjid);
if ( EVEN(sts)) return sts;
for ( ii = 0; ii < rows2; ii++) {
switch ( bd2[ii].attr->Param.TypeRef) {
case pwr_cClass_ChanAi:
case pwr_cClass_ChanAit:
case pwr_cClass_ChanAo:
case pwr_cClass_ChanDi:
case pwr_cClass_ChanDo:
case pwr_cClass_ChanIi:
case pwr_cClass_ChanIo:
case pwr_cClass_ChanCo:
maxchan++;
break;
default: ;
}
}
free( (char *)bd2);
}
}
}
free( (char *)bd);
}
}
cp = calloc( 1, sizeof(io_sCard));
cp->chanlist = (io_sChannel *) calloc( maxchan, sizeof(io_sChannel));
cp->ChanListSize = maxchan;
......
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