Commit dd3eb210 authored by Claes Sjofors's avatar Claes Sjofors

IO Buffer channels BiBlob and BoBlob for not IO-copied data added

parent c8615088
......@@ -1875,6 +1875,14 @@ static pwr_tStatus io_handle_channels(
sigchancon = ((pwr_sClass_ChanBo *) chan_op)->SigChanCon;
number = *chan_cnt;
break;
case pwr_cClass_ChanBiBlob:
sigchancon = ((pwr_sClass_ChanBiBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
case pwr_cClass_ChanBoBlob:
sigchancon = ((pwr_sClass_ChanBoBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
case pwr_cClass_ChanCo:
sigchancon = ((pwr_sClass_ChanCo *) chan_op)->SigChanCon;
number = *chan_cnt;
......@@ -1954,50 +1962,74 @@ static pwr_tStatus io_handle_channels(
break;
default: {
int class_ok = 0;
/* Look for Bi or Bo subclass */
sts = gdh_GetSuperClass( sigclass, &scid, pwr_cNObjid);
if ( ODD(sts)) {
switch ( scid) {
case pwr_cClass_Bi: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
if ( bd[i].attr->Param.TypeRef == pwr_cClass_ChanBiBlob ||
bd[i].attr->Param.TypeRef == pwr_cClass_ChanBoBlob) {
unsigned int a_size, a_offs, a_dim;
pwr_tTypeId a_type;
chanp->vbp = sig_op;
sts = gdh_GetAttributeCharAttrref( &sigchancon, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) ((char *)sig_op + a_offs));
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
chanp->SigStrSize = a_size;
if ( bd[i].attr->Param.TypeRef == pwr_cClass_ChanBiBlob) {
if ( chanp->SigStrSize > ((pwr_sClass_ChanBiBlob *)chanp->cop)->Size)
chanp->SigStrSize = ((pwr_sClass_ChanBiBlob *)chanp->cop)->Size;
}
case pwr_cClass_Bo: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) ((char *)sig_op + a_offs));
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
else {
if ( chanp->SigStrSize > ((pwr_sClass_ChanBoBlob *)chanp->cop)->Size)
chanp->SigStrSize = ((pwr_sClass_ChanBoBlob *)chanp->cop)->Size;
}
class_ok = 1;
}
else {
/* Look for Bi or Bo subclass */
sts = gdh_GetSuperClass( sigclass, &scid, pwr_cNObjid);
if ( ODD(sts)) {
switch ( scid) {
case pwr_cClass_Bi: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) ((char *)sig_op + a_offs));
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
}
case pwr_cClass_Bo: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) ((char *)sig_op + a_offs));
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
}
}
}
}
if ( !class_ok) {
......@@ -2135,6 +2167,8 @@ static pwr_tStatus io_init_card(
case pwr_cClass_ChanCo:
case pwr_cClass_ChanBi:
case pwr_cClass_ChanBo:
case pwr_cClass_ChanBiBlob:
case pwr_cClass_ChanBoBlob:
maxchan++;
break;
default: ;
......@@ -2163,6 +2197,8 @@ static pwr_tStatus io_init_card(
case pwr_cClass_ChanCo:
case pwr_cClass_ChanBi:
case pwr_cClass_ChanBo:
case pwr_cClass_ChanBiBlob:
case pwr_cClass_ChanBoBlob:
if ( bd[i].attr->Param.Info.Elements <= 1)
maxchan++;
else
......@@ -2188,6 +2224,8 @@ static pwr_tStatus io_init_card(
case pwr_cClass_ChanCo:
case pwr_cClass_ChanBi:
case pwr_cClass_ChanBo:
case pwr_cClass_ChanBiBlob:
case pwr_cClass_ChanBoBlob:
if ( bd2[ii].attr->Param.Info.Elements <= 1)
maxchan++;
else
......@@ -2312,6 +2350,14 @@ static pwr_tStatus io_init_card(
sigchancon = ((pwr_sClass_ChanBo *) chan_op)->SigChanCon;
number = ((pwr_sClass_ChanCo *) chan_op)->Number;
break;
case pwr_cClass_ChanBiBlob:
sigchancon = ((pwr_sClass_ChanBiBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
case pwr_cClass_ChanBoBlob:
sigchancon = ((pwr_sClass_ChanBoBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
default:
sts = gdh_DLUnrefObjectInfo( chandlid);
sts = gdh_GetNextSibling( chan, &chan);
......@@ -2415,51 +2461,75 @@ static pwr_tStatus io_init_card(
default: {
int class_ok = 0;
/* Look for Bi or Bo subclass */
sts = gdh_GetSuperClass( sigclass, &scid, pwr_cNObjid);
if ( ODD(sts)) {
switch ( scid) {
case pwr_cClass_Bi: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
pwr_tUInt64 actval = *(pwr_tUInt64 *)((char *)sig_op + a_offs);
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) actval);
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
if ( chan_class == pwr_cClass_ChanBiBlob ||
chan_class == pwr_cClass_ChanBoBlob) {
unsigned int a_size, a_offs, a_dim;
pwr_tTypeId a_type;
chanp->vbp = sig_op;
sts = gdh_GetAttributeCharAttrref( &sigchancon, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
chanp->SigStrSize = a_size;
if ( chan_class == pwr_cClass_ChanBiBlob) {
if ( chanp->SigStrSize > ((pwr_sClass_ChanBiBlob *)chanp->cop)->Size)
chanp->SigStrSize = ((pwr_sClass_ChanBiBlob *)chanp->cop)->Size;
}
case pwr_cClass_Bo: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
pwr_tUInt64 actval = *(pwr_tUInt64 *)((char *)sig_op + a_offs);
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) actval);
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
else {
if ( chanp->SigStrSize > ((pwr_sClass_ChanBoBlob *)chanp->cop)->Size)
chanp->SigStrSize = ((pwr_sClass_ChanBoBlob *)chanp->cop)->Size;
}
class_ok = 1;
}
else {
/* Look for Bi or Bo subclass */
sts = gdh_GetSuperClass( sigclass, &scid, pwr_cNObjid);
if ( ODD(sts)) {
switch ( scid) {
case pwr_cClass_Bi: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
pwr_tUInt64 actval = *(pwr_tUInt64 *)((char *)sig_op + a_offs);
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) actval);
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
}
case pwr_cClass_Bo: {
pwr_tAttrRef actval_aref;
pwr_tTypeId a_type;
unsigned int a_size, a_offs, a_dim;
sts = gdh_ArefANameToAref( &sigchancon, "ActualValue", &actval_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &actval_aref, &a_type, &a_size, &a_offs, &a_dim);
if ( EVEN(sts)) return sts;
pwr_tUInt64 actval = *(pwr_tUInt64 *)((char *)sig_op + a_offs);
chanp->vbp = gdh_TranslateRtdbPointer( (unsigned long) actval);
chanp->SigElem = a_dim;
chanp->SigType = a_type;
if ( a_type == pwr_eType_String)
chanp->SigStrSize = a_size / a_dim;
class_ok = 1;
break;
}
}
}
}
if ( !class_ok) {
......@@ -2524,6 +2594,12 @@ static pwr_tStatus io_init_card(
case pwr_cClass_ChanBo:
csize = sizeof( pwr_sClass_ChanBo);
break;
case pwr_cClass_ChanBiBlob:
csize = sizeof( pwr_sClass_ChanBiBlob);
break;
case pwr_cClass_ChanBoBlob:
csize = sizeof( pwr_sClass_ChanBoBlob);
break;
case pwr_cClass_ChanCo:
csize = sizeof( pwr_sClass_ChanCo);
break;
......@@ -2566,6 +2642,12 @@ static pwr_tStatus io_init_card(
case pwr_cClass_ChanBo:
csize = sizeof( pwr_sClass_ChanBo);
break;
case pwr_cClass_ChanBiBlob:
csize = sizeof( pwr_sClass_ChanBiBlob);
break;
case pwr_cClass_ChanBoBlob:
csize = sizeof( pwr_sClass_ChanBoBlob);
break;
case pwr_cClass_ChanCo:
csize = sizeof( pwr_sClass_ChanCo);
break;
......
......@@ -357,6 +357,34 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
break;
}
case pwr_cClass_ChanBiBlob: {
pwr_sClass_ChanBiBlob *chan_bi = (pwr_sClass_ChanBiBlob *) chanp->cop;
*input_area_offset += *input_area_chansize;
*input_area_chansize = chan_bi->Size;
if ( !chanp->sop || !chan_bi->Size)
continue;
chanp->offset = *input_area_offset;
chanp->size = *input_area_chansize;
chanp->mask = 0;
break;
}
case pwr_cClass_ChanBoBlob: {
pwr_sClass_ChanBoBlob *chan_bo = (pwr_sClass_ChanBoBlob *) chanp->cop;
*output_area_offset += *output_area_chansize;
*output_area_chansize = chan_bo->Size;
if ( !chanp->sop || !chan_bo->Size)
continue;
chanp->offset = *output_area_offset;
chanp->size = *output_area_chansize;
chanp->mask = 0;
break;
}
case pwr_cClass_ChanDo: {
pwr_sClass_ChanDo *chan_do = (pwr_sClass_ChanDo *) chanp->cop;
if (chan_do->Number == 0) {
......@@ -941,6 +969,13 @@ void io_bus_card_read( io_tCtx ctx,
}
break;
}
case pwr_cClass_ChanBiBlob: {
if ( chanp->cop && chanp->sop) {
memcpy( (char *)chanp->vbp, (char *)input_area + cp->offset + chanp->offset,
chanp->SigStrSize);
}
break;
}
}
}
}
......@@ -1404,6 +1439,13 @@ void io_bus_card_write( io_tCtx ctx,
}
break;
}
case pwr_cClass_ChanBoBlob: {
if ( chanp->cop && chanp->sop) {
memcpy( (char *)output_area + cp->offset + chanp->offset, (char *)chanp->vbp,
chanp->SigStrSize);
}
break;
}
}
}
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! 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.
!
! pwrb_c_chanbiblob.wb_load -- Defines the class ChanBiBlob.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group IO,Channels,NodeConfiguration
! @Summary Configures an buffer input channel
! Configures an buffer input channel.
!
! Channel type for data on distributed bus IO of type arrays and
! strings.
!
! ChanBiBlob objects are configured below a suitable module or card object.
! It should be connected to an attribute of arbitrary type with corresponding
! size.
!
! In the Size attribute, the total size of the channel on the bus in bytes
! should be set.
!*/
Object ChanBiBlob $ClassDef 591
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr Flags |= pwr_mClassDef_IO
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "ChanBiBlob"
EndBody
!/**
! Optional text.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Name of the attribute where the data is stored.
!*/
Object AttributeChanCon $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
!/**
! Total size of bus data area for the channel in bytes.
!*/
Object Size $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object Template ChanBiBlob
Body RtBody
Attr Size = 0
EndBody
EndObject
Object RtXtt $RtMenu
Object Signal $MenuRef
Body SysBody
Attr ButtonName = "TargetAttribute"
Attr RefAttribute = "SigChanCon"
EndBody
EndObject
EndObject
EndObject
EndSObject
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 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
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! 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.
!
! pwrb_c_chanboblob.wb_load -- Defines the class ChanBoBlob.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group IO,Channels,NodeConfiguration
! @Summary Configures an buffer input channel
! Configures an buffer input channel.
!
! Channel type for data on distributed bus IO of type arrays and
! strings.
!
! ChanBoBlob objects are configured below a suitable module or card object.
! It should be connected to an attribute of arbitrary type with corresponding
! size.
!
! In the Size attribute, the total size of the channel on the bus in bytes
! should be set.
!*/
Object ChanBoBlob $ClassDef 592
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr Flags |= pwr_mClassDef_IO
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "ChanBoBlob"
EndBody
!/**
! Optional text.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Name of the attribute from where the data is fetched.
!*/
Object AttributeChanCon $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
!/**
! Total size of bus data area for the channel in bytes.
!*/
Object Size $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object Template ChanBoBlob
Body RtBody
Attr Size = 0
EndBody
EndObject
Object RtXtt $RtMenu
Object Signal $MenuRef
Body SysBody
Attr ButtonName = "TargetAttribute"
Attr RefAttribute = "SigChanCon"
EndBody
EndObject
EndObject
EndObject
EndSObject
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