Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
677a962d
Commit
677a962d
authored
Jul 12, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New io design
parent
8219a622
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
724 additions
and
105 deletions
+724
-105
src/lib/rt/src/os_linux/rt_io_m_pb_dp_slave.c
src/lib/rt/src/os_linux/rt_io_m_pb_dp_slave.c
+15
-1
src/lib/rt/src/os_linux/rt_io_m_pb_module.c
src/lib/rt/src/os_linux/rt_io_m_pb_module.c
+517
-4
src/lib/rt/src/os_linux/rt_io_m_ssab_aiup.c
src/lib/rt/src/os_linux/rt_io_m_ssab_aiup.c
+3
-2
src/lib/rt/src/os_linux/rt_io_m_ssab_aoup.c
src/lib/rt/src/os_linux/rt_io_m_ssab_aoup.c
+3
-2
src/lib/rt/src/os_linux/rt_io_m_ssab_co.c
src/lib/rt/src/os_linux/rt_io_m_ssab_co.c
+2
-2
src/lib/rt/src/os_linux/rt_io_pb_locals.h
src/lib/rt/src/os_linux/rt_io_pb_locals.h
+1
-1
src/lib/rt/src/rt_io_base.c
src/lib/rt/src/rt_io_base.c
+183
-93
No files found.
src/lib/rt/src/os_linux/rt_io_m_pb_dp_slave.c
View file @
677a962d
...
...
@@ -25,6 +25,7 @@
#include "rt_errh.h"
#include "co_cdh.h"
#include "rt_io_profiboard.h"
#include "rt_pb_msg.h"
/*----------------------------------------------------------------------------*\
...
...
@@ -47,8 +48,10 @@ static pwr_tStatus IoRackInit (
pwr_sClass_Pb_Ao
*
aop
;
pwr_sClass_Pb_Ii
*
iip
;
pwr_sClass_Pb_Io
*
iop
;
pwr_sClass_Pb_Module
*
mp
;
char
name
[
196
];
pwr_tStatus
sts
;
pwr_tCid
cid
;
sts
=
gdh_ObjidToName
(
rp
->
Objid
,
(
char
*
)
&
name
,
sizeof
(
name
),
cdh_mNName
);
errh_Info
(
"Init of Profibus DP Slave and modules %s"
,
name
);
...
...
@@ -68,7 +71,10 @@ static pwr_tStatus IoRackInit (
local_card
->
input_area
=
(
void
*
)
&
(
op
->
Inputs
);
local_card
->
output_area
=
(
void
*
)
&
(
op
->
Outputs
);
switch
(
cardp
->
Class
)
{
cid
=
cardp
->
Class
;
while
(
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
cardp
->
Objid
)))
;
switch
(
cid
)
{
case
pwr_cClass_Pb_Di
:
dip
=
(
pwr_sClass_Pb_Di
*
)
cardp
->
op
;
...
...
@@ -117,6 +123,14 @@ static pwr_tStatus IoRackInit (
output_counter
+=
iop
->
BytesOfOutput
;
iop
->
Status
=
PB_MODULE_STATE_OPERATE
;
break
;
case
pwr_cClass_Pb_Module
:
mp
=
(
pwr_sClass_Pb_Module
*
)
cardp
->
op
;
// iop->OffsetOutputs = output_counter;
// iop->BytesOfOutput = iop->NumberOfChannels * iop->BytesPerChannel;
// output_counter += iop->BytesOfOutput;
mp
->
Status
=
PB__SUCCESS
;
break
;
}
op
->
NumberModules
++
;
...
...
src/lib/rt/src/os_linux/rt_io_m_pb_module.c
View file @
677a962d
/* rt_io_m_pb_
ai
.c
/* rt_io_m_pb_
module
.c
PROVIEW/R */
#pragma pack(1)
...
...
@@ -23,9 +23,90 @@
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_profiboard.h"
#include "rt_pb_msg.h"
pwr_tInt32
GetChanSize
(
pwr_eDataRepEnum
rep
)
{
switch
(
rep
)
{
case
pwr_eDataRepEnum_Int64
:
case
pwr_eDataRepEnum_UInt64
:
case
pwr_eDataRepEnum_Float64
:
return
8
;
break
;
case
pwr_eDataRepEnum_Int32
:
case
pwr_eDataRepEnum_UInt32
:
case
pwr_eDataRepEnum_Float32
:
return
4
;
break
;
case
pwr_eDataRepEnum_Int16
:
case
pwr_eDataRepEnum_UInt16
:
return
2
;
break
;
default:
return
1
;
break
;
}
}
/*----------------------------------------------------------------------------*\
Convert ai from raw float value to signal value and actual value
\*----------------------------------------------------------------------------*/
void
PbConvertAi
(
io_tCtx
ctx
,
pwr_tFloat32
f_raw
,
pwr_sClass_ChanAi
*
chan_ai
,
pwr_sClass_Ai
*
sig_ai
,
io_sChannel
*
chanp
)
{
pwr_tFloat32
sigvalue
;
pwr_tFloat32
actvalue
;
pwr_tFloat32
*
polycoef_p
;
int
i
;
sigvalue
=
chan_ai
->
SigValPolyCoef0
+
chan_ai
->
SigValPolyCoef1
*
f_raw
;
switch
(
chan_ai
->
SensorPolyType
)
{
case
0
:
actvalue
=
sigvalue
;
break
;
case
1
:
actvalue
=
chan_ai
->
SensorPolyCoef0
+
chan_ai
->
SensorPolyCoef1
*
f_raw
;
break
;
case
2
:
polycoef_p
=
&
chan_ai
->
SensorPolyCoef2
;
actvalue
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
actvalue
=
sigvalue
*
actvalue
+
*
polycoef_p
;
polycoef_p
--
;
}
break
;
case
3
:
actvalue
=
chan_ai
->
SensorPolyCoef0
+
chan_ai
->
SensorPolyCoef1
*
sigvalue
;
if
(
actvalue
>=
0
)
actvalue
=
chan_ai
->
SensorPolyCoef2
*
sqrt
(
actvalue
);
else
actvalue
=
0
;
break
;
case
4
:
actvalue
=
chan_ai
->
SensorPolyCoef0
+
chan_ai
->
SensorPolyCoef1
*
sigvalue
;
if
(
actvalue
>=
0
)
actvalue
=
chan_ai
->
SensorPolyCoef2
*
sqrt
(
actvalue
);
else
actvalue
=
-
chan_ai
->
SensorPolyCoef2
*
sqrt
(
-
actvalue
);
break
;
}
if
(
sig_ai
->
FilterType
==
1
&&
sig_ai
->
FilterAttribute
[
0
]
>
0
&&
sig_ai
->
FilterAttribute
[
0
]
>
ctx
->
ScanTime
)
{
actvalue
=
*
(
sig_ai
->
ActualValue
)
+
ctx
->
ScanTime
/
sig_ai
->
FilterAttribute
[
0
]
*
(
actvalue
-
*
(
sig_ai
->
ActualValue
));
}
sig_ai
->
SigValue
=
sigvalue
;
*
(
pwr_tFloat32
*
)
chanp
->
vbp
=
actvalue
;
return
;
}
/*----------------------------------------------------------------------------*\
Init method for the Pb module
\*----------------------------------------------------------------------------*/
...
...
@@ -36,7 +117,106 @@ static pwr_tStatus IoCardInit (
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
int
i
,
input_count
,
output_count
,
chan_size
,
bit_pos
;
io_sChannel
*
chanp
;
pwr_sClass_ChanDi
*
chan_di
;
pwr_sClass_ChanAi
*
chan_ai
;
pwr_sClass_ChanAit
*
chan_ait
;
pwr_sClass_ChanIi
*
chan_ii
;
pwr_sClass_ChanDo
*
chan_do
;
pwr_sClass_ChanAo
*
chan_ao
;
pwr_sClass_ChanIo
*
chan_io
;
op
=
(
pwr_sClass_Pb_Module
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
op
->
Status
==
PB__SUCCESS
)
{
input_count
=
0
;
output_count
=
0
;
bit_pos
=
0
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
switch
(
chanp
->
ChanClass
)
{
/*
case pwr_cClass_ChanDi:
printf("Di channel found in %s\n", cp->Name);
chan_di = (pwr_sClass_ChanDi *) chanp->cop;
chanp->offset = byte_count;
chan_size = GetChanSize(chan_di->Representation);
chanp->mask = 1<<bit_pos;
bit_pos++;
if (bit_pos >= 8) {
byte_count++;
bit_pos = 0;
}
break;
*/
case
pwr_cClass_ChanAi
:
// printf("Ai channel found in %s\n", cp->Name);
chan_ai
=
(
pwr_sClass_ChanAi
*
)
chanp
->
cop
;
chanp
->
offset
=
input_count
;
chan_size
=
GetChanSize
(
chan_ai
->
Representation
);
chanp
->
size
=
chan_size
;
chanp
->
mask
=
0
;
input_count
+=
chan_size
;
io_AiRangeToCoef
(
chanp
);
break
;
case
pwr_cClass_ChanAit
:
// printf("Ait channel found in %s\n", cp->Name);
chan_ait
=
(
pwr_sClass_ChanAit
*
)
chanp
->
cop
;
chanp
->
offset
=
input_count
;
chan_size
=
GetChanSize
(
chan_ait
->
Representation
);
chanp
->
size
=
chan_size
;
chanp
->
mask
=
0
;
input_count
+=
chan_size
;
io_AiRangeToCoef
(
chanp
);
break
;
case
pwr_cClass_ChanIi
:
// printf("Ii channel found in %s\n", cp->Name);
chan_ii
=
(
pwr_sClass_ChanIi
*
)
chanp
->
cop
;
chanp
->
offset
=
input_count
;
chan_size
=
GetChanSize
(
chan_ii
->
Representation
);
chanp
->
size
=
chan_size
;
chanp
->
mask
=
0
;
input_count
+=
chan_size
;
break
;
case
pwr_cClass_ChanAo
:
// printf("Ao channel found in %s\n", cp->Name);
chan_ao
=
(
pwr_sClass_ChanAo
*
)
chanp
->
cop
;
chanp
->
offset
=
output_count
;
chan_size
=
GetChanSize
(
chan_ao
->
Representation
);
chanp
->
size
=
chan_size
;
chanp
->
mask
=
0
;
output_count
+=
chan_size
;
io_AoRangeToCoef
(
chanp
);
break
;
case
pwr_cClass_ChanIo
:
// printf("Io channel found in %s\n", cp->Name);
chan_io
=
(
pwr_sClass_ChanIo
*
)
chanp
->
cop
;
chanp
->
offset
=
output_count
;
chan_size
=
GetChanSize
(
chan_io
->
Representation
);
chanp
->
size
=
chan_size
;
chanp
->
mask
=
0
;
output_count
+=
chan_size
;
break
;
}
}
for
(
i
=
0
;
i
<
IO_MAXCHAN
;
i
++
)
{
local
->
scancount
[
i
]
=
0
;
}
}
else
{
errh_Info
(
"Error initializing Pb module %s"
,
cp
->
Name
);
op
->
Status
=
PB__INITFAIL
;
}
printf
(
"Method Pb_Module-IoCardInit
\n
"
);
printf
(
"Module size: input %d, output %d
\n
"
,
input_count
,
output_count
);
return
IO__SUCCESS
;
}
...
...
@@ -51,7 +231,158 @@ static pwr_tStatus IoCardRead (
io_sCard
*
cp
)
{
printf
(
"Method Pb_Module-IoCardRead
\n
"
);
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
io_sChannel
*
chanp
;
// pwr_sClass_ChanDi *chan_di;
pwr_sClass_ChanAi
*
chan_ai
;
pwr_sClass_Ai
*
sig_ai
;
// pwr_sClass_ChanAit *chan_ait;
pwr_sClass_ChanIi
*
chan_ii
;
pwr_sClass_Ii
*
sig_ii
;
pwr_sClass_Pb_DP_Slave
*
slave
;
pwr_tUInt8
udata8
=
0
;
pwr_tUInt16
udata16
=
0
;
pwr_tUInt32
udata32
=
0
;
pwr_tInt8
data8
=
0
;
pwr_tInt16
data16
=
0
;
pwr_tInt32
data32
=
0
;
pwr_tFloat32
f_raw
=
0
.
0
;
int
i
;
op
=
(
pwr_sClass_Pb_Module
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
slave
->
Status
==
PB_SLAVE_STATE_NOTINIT
)
{
op
->
Status
=
PB__INITFAIL
;
}
else
if
(
slave
->
Status
==
PB_SLAVE_STATE_STOPPED
)
{
op
->
Status
=
PB__NOCONN
;
}
else
if
(
slave
->
Status
==
PB_SLAVE_STATE_OPERATE
)
{
op
->
Status
=
PB__NORMAL
;
}
if
(
slave
->
DisableSlave
==
1
)
{
op
->
Status
=
PB__DISABLED
;
}
else
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
break
;
// Channel type is Ai (analog input)
case
pwr_cClass_ChanAi
:
chan_ai
=
(
pwr_sClass_ChanAi
*
)
chanp
->
cop
;
sig_ai
=
(
pwr_sClass_Ai
*
)
chanp
->
sop
;
if
(
chan_ai
&&
sig_ai
&&
chan_ai
->
ConversionOn
)
{
if
(
chan_ai
->
CalculateNewCoef
)
io_AiRangeToCoef
(
chanp
);
switch
(
chan_ai
->
Representation
)
{
case
pwr_eDataRepEnum_Int8
:
memcpy
(
&
data8
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
1
);
f_raw
=
(
float
)
data8
;
break
;
case
pwr_eDataRepEnum_UInt8
:
memcpy
(
&
udata8
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
1
);
f_raw
=
(
float
)
udata8
;
break
;
case
pwr_eDataRepEnum_Int16
:
memcpy
(
&
data16
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data16
=
swap16
(
data16
);
f_raw
=
(
float
)
data16
;
break
;
case
pwr_eDataRepEnum_UInt16
:
memcpy
(
&
udata16
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data16
=
swap16
(
udata16
);
f_raw
=
(
float
)
udata16
;
break
;
case
pwr_eDataRepEnum_Int32
:
memcpy
(
&
data32
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data32
=
swap32
(
data32
);
f_raw
=
(
float
)
data32
;
break
;
case
pwr_eDataRepEnum_UInt32
:
memcpy
(
&
udata32
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata32
=
swap32
(
udata32
);
f_raw
=
(
float
)
udata32
;
break
;
}
sig_ai
->
RawValue
=
0
;
PbConvertAi
(
ctx
,
f_raw
,
chan_ai
,
sig_ai
,
chanp
);
}
break
;
// Channel type is Ait (analog input with table conversion)
case
pwr_cClass_ChanAit
:
break
;
// Channel type is Ii (integer input)
case
pwr_cClass_ChanIi
:
chan_ii
=
(
pwr_sClass_ChanIi
*
)
chanp
->
cop
;
sig_ii
=
(
pwr_sClass_Ii
*
)
chanp
->
sop
;
if
(
chan_ii
&&
sig_ii
/* && chan_ii->ConversionOn */
)
{
switch
(
chan_ii
->
Representation
)
{
case
pwr_eDataRepEnum_Int8
:
memcpy
(
&
data8
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
1
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
data8
;
break
;
case
pwr_eDataRepEnum_UInt8
:
memcpy
(
&
udata8
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
1
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata8
;
break
;
case
pwr_eDataRepEnum_Int16
:
memcpy
(
&
data16
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data16
=
swap16
(
data16
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
data16
;
break
;
case
pwr_eDataRepEnum_UInt16
:
memcpy
(
&
udata16
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata16
=
swap16
(
udata16
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata16
;
break
;
case
pwr_eDataRepEnum_Int32
:
memcpy
(
&
data32
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data32
=
swap32
(
data32
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
data32
;
break
;
case
pwr_eDataRepEnum_UInt32
:
memcpy
(
&
udata32
,
local
->
input_area
+
cp
->
offset
+
chanp
->
offset
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata32
=
swap32
(
udata32
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata32
;
break
;
}
}
break
;
}
}
}
// printf("Method Pb_Module-IoCardRead\n");
return
IO__SUCCESS
;
}
...
...
@@ -66,7 +397,184 @@ static pwr_tStatus IoCardWrite (
io_sCard
*
cp
)
{
printf
(
"Method Pb_Module-IoCardWrite
\n
"
);
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
io_sChannel
*
chanp
;
// pwr_sClass_ChanDo *chan_do;
// pwr_sClass_Do *sig_do;
pwr_sClass_ChanAo
*
chan_ao
;
pwr_sClass_Ao
*
sig_ao
;
pwr_sClass_ChanIo
*
chan_io
;
pwr_sClass_Io
*
sig_io
;
pwr_sClass_Pb_DP_Slave
*
slave
;
pwr_tUInt8
udata8
=
0
;
pwr_tUInt16
udata16
=
0
;
pwr_tUInt32
udata32
=
0
;
pwr_tInt8
data8
=
0
;
pwr_tInt16
data16
=
0
;
pwr_tInt32
data32
=
0
;
pwr_tFloat32
value
,
rawvalue
;
int
fixout
;
int
i
;
op
=
(
pwr_sClass_Pb_Module
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
slave
->
Status
==
PB_SLAVE_STATE_NOTINIT
)
{
op
->
Status
=
PB__INITFAIL
;
}
else
if
(
slave
->
Status
==
PB_SLAVE_STATE_STOPPED
)
{
op
->
Status
=
PB__NOCONN
;
}
else
if
(
slave
->
Status
==
PB_SLAVE_STATE_OPERATE
)
{
op
->
Status
=
PB__NORMAL
;
}
if
(
slave
->
DisableSlave
==
1
)
{
op
->
Status
=
PB__DISABLED
;
}
else
{
fixout
=
ctx
->
Node
->
EmergBreakTrue
&&
ctx
->
Node
->
EmergBreakSelect
==
FIXOUT
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDo
:
break
;
// Channel type is Ao (analog output)
case
pwr_cClass_ChanAo
:
chan_ao
=
(
pwr_sClass_ChanAo
*
)
chanp
->
cop
;
sig_ao
=
(
pwr_sClass_Ao
*
)
chanp
->
sop
;
if
(
chan_ao
&&
sig_ao
)
{
if
(
fixout
)
value
=
chan_ao
->
FixedOutValue
;
else
if
(
chan_ao
->
TestOn
)
value
=
chan_ao
->
TestValue
;
else
value
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
;
if
(
chan_ao
->
CalculateNewCoef
)
io_AoRangeToCoef
(
chanp
);
if
(
value
>
chan_ao
->
ActValRangeHigh
)
value
=
chan_ao
->
ActValRangeHigh
;
else
if
(
value
<
chan_ao
->
ActValRangeLow
)
value
=
chan_ao
->
ActValRangeLow
;
rawvalue
=
chan_ao
->
OutPolyCoef1
*
value
+
chan_ao
->
OutPolyCoef0
;
if
(
rawvalue
>
0
)
rawvalue
=
rawvalue
+
0
.
5
;
else
rawvalue
=
rawvalue
-
0
.
5
;
sig_ao
->
RawValue
=
0
;
sig_ao
->
SigValue
=
chan_ao
->
SigValPolyCoef1
*
value
+
chan_ao
->
SigValPolyCoef0
;
switch
(
chan_ao
->
Representation
)
{
case
pwr_eDataRepEnum_Int8
:
data8
=
(
pwr_tInt8
)
rawvalue
;
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data8
,
1
);
break
;
case
pwr_eDataRepEnum_UInt8
:
udata8
=
(
pwr_tUInt8
)
rawvalue
;
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata8
,
1
);
break
;
case
pwr_eDataRepEnum_Int16
:
data16
=
(
pwr_tInt16
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data16
=
swap16
(
data16
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data16
,
2
);
break
;
case
pwr_eDataRepEnum_UInt16
:
udata16
=
(
pwr_tUInt16
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata16
=
swap16
(
udata16
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata16
,
2
);
break
;
case
pwr_eDataRepEnum_Int32
:
data32
=
(
pwr_tInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data32
,
4
);
break
;
case
pwr_eDataRepEnum_UInt32
:
udata32
=
(
pwr_tUInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata32
=
swap32
(
udata32
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata32
,
4
);
break
;
}
}
break
;
// Channel type is Io (integer output)
case
pwr_cClass_ChanIo
:
chan_io
=
(
pwr_sClass_ChanIo
*
)
chanp
->
cop
;
sig_io
=
(
pwr_sClass_Io
*
)
chanp
->
sop
;
if
(
chan_io
&&
sig_io
)
{
if
(
fixout
)
data32
=
(
pwr_tInt32
)
chan_io
->
FixedOutValue
;
else
if
(
chan_io
->
TestOn
)
data32
=
(
pwr_tInt32
)
chan_io
->
TestValue
;
else
data32
=
*
(
pwr_tInt32
*
)
chanp
->
vbp
;
switch
(
chan_io
->
Representation
)
{
case
pwr_eDataRepEnum_Int8
:
data8
=
(
pwr_tInt8
)
data32
;
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data8
,
1
);
break
;
case
pwr_eDataRepEnum_UInt8
:
udata8
=
(
pwr_tUInt8
)
data32
;
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata8
,
1
);
break
;
case
pwr_eDataRepEnum_Int16
:
data16
=
(
pwr_tInt16
)
data32
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data16
=
swap16
(
data16
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data16
,
2
);
break
;
case
pwr_eDataRepEnum_UInt16
:
udata16
=
(
pwr_tUInt16
)
data32
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata16
=
swap16
(
udata16
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata16
,
2
);
break
;
case
pwr_eDataRepEnum_Int32
:
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
data32
,
4
);
break
;
case
pwr_eDataRepEnum_UInt32
:
udata32
=
(
pwr_tUInt32
)
data32
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrdering_BigEndian
)
udata32
=
swap32
(
udata32
);
memcpy
(
local
->
output_area
+
cp
->
offset
+
chanp
->
offset
,
&
udata32
,
4
);
break
;
}
}
break
;
}
}
}
// printf("Method Pb_Module-IoCardWrite\n");
return
IO__SUCCESS
;
}
...
...
@@ -81,6 +589,11 @@ static pwr_tStatus IoCardClose (
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
free
((
char
*
)
local
);
printf
(
"Method Pb_Module-IoCardClose
\n
"
);
return
IO__SUCCESS
;
}
...
...
src/lib/rt/src/os_linux/rt_io_m_ssab_aiup.c
View file @
677a962d
...
...
@@ -113,7 +113,8 @@ static pwr_tStatus IoCardInit (
chanp
=
cp
->
chanlist
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
AiRangeToCoef
(
chanp
);
if
(
chanp
->
sop
)
AiRangeToCoef
(
chanp
);
chanp
++
;
}
...
...
@@ -168,7 +169,7 @@ static pwr_tStatus IoCardRead (
chanp
=
&
cp
->
chanlist
[
0
];
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
if
(
!
chanp
->
cop
)
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
{
chanp
++
;
continue
;
...
...
src/lib/rt/src/os_linux/rt_io_m_ssab_aoup.c
View file @
677a962d
...
...
@@ -125,7 +125,8 @@ static pwr_tStatus IoCardInit (
chanp
=
cp
->
chanlist
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
AoRangeToCoef
(
chanp
);
if
(
chanp
->
sop
)
AoRangeToCoef
(
chanp
);
chanp
++
;
}
...
...
@@ -186,7 +187,7 @@ static pwr_tStatus IoCardWrite (
chanp
=
&
cp
->
chanlist
[
0
];
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
if
(
!
chanp
->
cop
)
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
{
chanp
++
;
continue
;
...
...
src/lib/rt/src/os_linux/rt_io_m_ssab_co.c
View file @
677a962d
...
...
@@ -78,7 +78,7 @@ static pwr_tStatus IoCardInit (
/* Configure card */
for
(
i
=
0
;
i
<
op
->
MaxNoOfCounters
;
i
++
)
{
if
(
!
cp
->
chanlist
[
i
].
cop
)
if
(
!
cp
->
chanlist
[
i
].
cop
||
!
cp
->
chanlist
[
i
].
sop
)
continue
;
wr_data_p
=
(
pwr_tUInt32
*
)
&
wr_data
;
...
...
@@ -182,7 +182,7 @@ static pwr_tStatus IoCardRead (
for
(
i
=
0
;
i
<
op
->
MaxNoOfCounters
;
i
++
)
{
if
(
!
cp
->
chanlist
[
i
].
cop
)
if
(
!
cp
->
chanlist
[
i
].
cop
||
!
cp
->
chanlist
[
i
].
sop
)
continue
;
if
(
op
->
ConvMask
&
(
1
<<
i
))
...
...
src/lib/rt/src/os_linux/rt_io_pb_locals.h
View file @
677a962d
#define IO_MAXCHAN
32
#define IO_MAXCHAN
96
#define PB_MODULE_STATE_NOTINIT 0
#define PB_MODULE_STATE_OPERATE 1
...
...
src/lib/rt/src/rt_io_base.c
View file @
677a962d
...
...
@@ -121,10 +121,13 @@ static pwr_tStatus io_replace_symbol( pwr_sAttrRef *chan, pwr_sAttrRef *sig)
pwr_tStatus
sts
;
pwr_sAttrRef
connect
;
pwr_tCid
cid
;
char
*
s
;
sts
=
gdh_
ObjidToName
(
sig
->
Objid
,
name
,
sizeof
(
name
),
sts
=
gdh_
AttrrefToName
(
sig
,
name
,
sizeof
(
name
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
(
s
=
strrchr
(
name
,
'.'
)))
*
s
=
0
;
strcat
(
name
,
".IoConnect"
);
sts
=
gdh_GetObjectInfo
(
name
,
&
connect
,
sizeof
(
connect
));
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -147,6 +150,80 @@ static pwr_tStatus io_replace_symbol( pwr_sAttrRef *chan, pwr_sAttrRef *sig)
return
IO__SUCCESS
;
}
int
io_connect_status
(
pwr_sAttrRef
*
sig_aref
,
pwr_sAttrRef
*
chan_aref
)
{
pwr_sAttrRef
status_aref
;
pwr_sAttrRef
ioconnect_aref
;
static
pwr_sAttrRef
last_ioconnect
=
{{
0
,
0
},
0
,
0
,
0
,{
0
}};
pwr_sAttrRef
iostatus_aref
;
pwr_sAttrRef
card_aref
;
pwr_tStatus
sts
;
pwr_tStatus
*
status_p
;
pwr_tStatus
*
iostatus_p
;
pwr_tAName
sname
;
char
*
s
;
int
found
;
if
(
chan_aref
->
Offset
==
0
||
sig_aref
->
Offset
==
0
)
return
0
;
/* Find content of IoConnect attribute in the signal object */
sts
=
gdh_AttrrefToName
(
sig_aref
,
sname
,
sizeof
(
sname
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
0
;
found
=
0
;
for
(;;)
{
s
=
strrchr
(
sname
,
'.'
);
if
(
!
s
)
break
;
*
s
=
0
;
strcat
(
sname
,
".IoConnect"
);
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
sname
,
&
ioconnect_aref
);
if
(
ODD
(
sts
))
{
if
(
cdh_ArefIsEqual
(
&
ioconnect_aref
,
&
last_ioconnect
))
return
1
;
found
=
1
;
*
s
=
0
;
strcat
(
sname
,
".IoStatus"
);
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
sname
,
&
iostatus_aref
);
if
(
EVEN
(
sts
))
return
0
;
break
;
}
*
s
=
0
;
}
if
(
!
found
)
return
0
;
/* Get the Status attribute in the connected module */
sts
=
gdh_GetObjectInfoAttrref
(
&
ioconnect_aref
,
&
card_aref
,
sizeof
(
card_aref
));
if
(
EVEN
(
sts
))
return
0
;
sts
=
gdh_AttrrefToName
(
&
card_aref
,
sname
,
sizeof
(
sname
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
0
;
strcat
(
sname
,
".Status"
);
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
sname
,
&
status_aref
);
if
(
EVEN
(
sts
))
return
0
;
/* Store status pointer in IoStatus */
sts
=
gdh_AttrRefToPointer
(
&
iostatus_aref
,
(
void
**
)
&
iostatus_p
);
if
(
EVEN
(
sts
))
return
0
;
sts
=
gdh_AttrRefToPointer
(
&
status_aref
,
(
void
**
)
&
status_p
);
if
(
EVEN
(
sts
))
return
0
;
gdh_StoreRtdbPointer
(
iostatus_p
,
status_p
);
last_ioconnect
=
ioconnect_aref
;
return
1
;
}
/*----------------------------------------------------------------------------*\
Initialization of ai signals and channels.
...
...
@@ -215,6 +292,7 @@ pwr_tStatus io_init_ai_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Ai
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -293,6 +371,7 @@ pwr_tStatus io_init_ao_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Ao
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -370,6 +449,7 @@ pwr_tStatus io_init_di_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Di
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -449,6 +529,7 @@ pwr_tStatus io_init_do_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Do
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -485,6 +566,8 @@ pwr_tStatus io_init_do_signals(
}
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
sig_op
->
ActualValue
,
&
area_op
->
Value
[
sig_count
]);
sig_op
->
ValueIndex
=
sig_count
;
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Po
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -561,6 +644,7 @@ pwr_tStatus io_init_co_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
sig_op
->
RawValue
,
&
area_op
->
Value
[
sig_count
]);
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
sig_op
->
AbsValue
,
&
abs_area_op
->
Value
[
sig_count
]);
sig_op
->
ValueIndex
=
sig_count
;
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Co
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -777,6 +861,7 @@ pwr_tStatus io_init_ii_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Ii
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -856,6 +941,7 @@ pwr_tStatus io_init_io_signals(
gdh_StoreRtdbPointer
(
(
pwr_tUInt32
*
)
&
iarea_op
->
Value
[
sig_count
],
&
sig_op
->
InitialValue
);
io_connect_status
(
&
sig_aref
,
&
sig_op
->
SigChanCon
);
sig_count
++
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Io
,
&
sig_aref
,
&
sig_aref
);
...
...
@@ -1588,6 +1674,7 @@ static pwr_tStatus io_init_card(
int
chan_cnt
=
0
;
int
i
,
j
;
int
elem
;
int
sig_found
;
sts
=
gdh_GetObjectBodyDef
(
cp
->
Class
,
&
bd
,
&
rows
,
pwr_cNObjid
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -1668,19 +1755,19 @@ static pwr_tStatus io_init_card(
chan_cnt
++
;
/* Find signal */
if
(
cdh_ObjidIsNull
(
sigchancon
.
Objid
))
{
/* Not connected */
continue
;
sig_found
=
0
;
if
(
cdh_ObjidIsNotNull
(
sigchancon
.
Objid
))
{
sts
=
gdh_GetAttrRefTid
(
&
sigchancon
,
&
sigclass
);
if
(
ODD
(
sts
))
{
sts
=
gdh_DLRefObjectInfoAttrref
(
&
sigchancon
,
(
void
*
)
&
sig_op
,
&
sigdlid
);
if
(
ODD
(
sts
))
sig_found
=
1
;
}
}
if
(
!
sig_found
)
{
sig_op
=
0
;
sigdlid
=
pwr_cNDlid
;
}
sts
=
gdh_GetAttrRefTid
(
&
sigchancon
,
&
sigclass
);
if
(
EVEN
(
sts
))
continue
;
sts
=
gdh_DLRefObjectInfoAttrref
(
&
sigchancon
,
(
void
*
)
&
sig_op
,
&
sigdlid
);
if
(
EVEN
(
sts
))
continue
;
/* Insert */
if
(
elem
>
1
)
sprintf
(
attrname
,
"%s.%s[%d]"
,
cname
,
bd
[
i
].
attrName
,
j
);
...
...
@@ -1697,47 +1784,50 @@ static pwr_tStatus io_init_card(
chanp
->
SigAref
=
sigchancon
;
chanp
->
ChanClass
=
bd
[
i
].
attr
->
Param
.
TypeRef
;
chanp
->
SigClass
=
sigclass
;
switch
(
sigclass
)
{
case
pwr_cClass_Di
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
if
(
sig_found
)
{
switch
(
sigclass
)
{
case
pwr_cClass_Di
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Di
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Do
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Do
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Do
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Po
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Po
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Po
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Ai
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Ai
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Ai
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Ao
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Ao
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Ao
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Ii
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Ii
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Ii
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Io
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Io
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Io
*
)
sig_op
)
->
ActualValue
);
break
;
case
pwr_cClass_Co
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
break
;
case
pwr_cClass_Co
:
chanp
->
vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Co
*
)
sig_op
)
->
RawValue
);
chanp
->
abs_vbp
=
gdh_TranslateRtdbPointer
(
chanp
->
abs_vbp
=
gdh_TranslateRtdbPointer
(
(
pwr_tUInt32
)
((
pwr_sClass_Co
*
)
sig_op
)
->
AbsValue
);
break
;
default:
errh_Error
(
"IO init error: unknown signal class card %, chan nr %d"
,
cp
->
Name
,
number
);
sts
=
gdh_DLUnrefObjectInfo
(
sigdlid
);
memset
(
chanp
,
0
,
sizeof
(
*
chanp
));
break
;
default:
errh_Error
(
"IO init error: unknown signal class card %, chan nr %d"
,
cp
->
Name
,
number
);
sts
=
gdh_DLUnrefObjectInfo
(
sigdlid
);
sig_op
=
0
;
sigdlid
=
pwr_cNDlid
;
}
}
}
}
...
...
@@ -2029,103 +2119,103 @@ void io_DiUnpackWord(
if
(
mask
==
IO_CONVMASK_ALL
)
{
/* No conversion test */
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
1
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
2
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
4
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
8
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
16
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
32
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
64
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
128
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
256
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
512
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
1024
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
2048
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
4096
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
8192
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
16384
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
)
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
32768
)
!=
0
);
chanp
++
;
}
else
{
if
(
chanp
->
cop
&&
mask
&
1
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
1
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
1
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
2
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
2
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
2
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
4
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
4
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
4
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
8
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
8
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
8
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
16
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
16
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
16
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
32
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
32
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
32
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
64
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
64
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
64
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
128
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
128
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
128
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
256
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
256
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
256
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
512
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
512
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
512
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
1024
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
1024
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
1024
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
2048
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
2048
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
2048
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
4096
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
4096
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
4096
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
8192
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
8192
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
8192
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
16384
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
16384
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
16384
)
!=
0
);
chanp
++
;
if
(
chanp
->
cop
&&
mask
&
32768
)
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
32768
)
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
)
=
((
data
&
32768
)
!=
0
);
chanp
++
;
}
...
...
@@ -2147,52 +2237,52 @@ void io_DoPackWord(
chanp
=
&
cp
->
chanlist
[
16
];
*
data
=
0
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
1
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
2
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
4
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
8
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
16
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
32
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
64
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
128
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
256
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
512
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
1024
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
2048
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
4096
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
8192
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
16384
;
chanp
++
;
if
(
chanp
->
cop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
if
(
chanp
->
cop
&&
chanp
->
sop
&&
*
(
pwr_tUInt16
*
)
(
chanp
->
vbp
))
*
data
|=
32768
;
chanp
++
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment