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
d29602e6
Commit
d29602e6
authored
Feb 21, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rt iocopyarea for ATv, DTv and Sv, and time and string locks
parent
4f7e57f2
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1333 additions
and
280 deletions
+1333
-280
nmps/lib/nmps/src/nmps_appl.c
nmps/lib/nmps/src/nmps_appl.c
+5
-5
nmps/lib/nmps/src/nmps_plc.c
nmps/lib/nmps/src/nmps_plc.c
+26
-26
src/exe/rt_ini/src/rt_ini.c
src/exe/rt_ini/src/rt_ini.c
+186
-0
src/exp/rt/src/rt_plc_process.c
src/exp/rt/src/rt_plc_process.c
+29
-8
src/lib/rt/src/rt_gdh.c
src/lib/rt/src/rt_gdh.c
+259
-0
src/lib/rt/src/rt_gdh.h
src/lib/rt/src/rt_gdh.h
+15
-1
src/lib/rt/src/rt_ini_load.c
src/lib/rt/src/rt_ini_load.c
+50
-1
src/lib/rt/src/rt_io_base.c
src/lib/rt/src/rt_io_base.c
+203
-1
src/lib/rt/src/rt_nmps_lock.c
src/lib/rt/src/rt_nmps_lock.c
+0
-95
src/lib/rt/src/rt_nmps_lock.h
src/lib/rt/src/rt_nmps_lock.h
+0
-60
src/lib/rt/src/rt_plc.h
src/lib/rt/src/rt_plc.h
+10
-1
src/lib/rt/src/rt_plc_dirlink.c
src/lib/rt/src/rt_plc_dirlink.c
+18
-0
src/lib/rt/src/rt_plc_ioarea.h
src/lib/rt/src/rt_plc_ioarea.h
+14
-1
src/lib/rt/src/rt_plc_macro.h
src/lib/rt/src/rt_plc_macro.h
+2
-1
src/lib/rt/src/rt_plc_macro_string.h
src/lib/rt/src/rt_plc_macro_string.h
+33
-3
src/lib/rt/src/rt_plc_macro_time.h
src/lib/rt/src/rt_plc_macro_time.h
+62
-13
src/lib/rt/src/rt_plc_thread.c
src/lib/rt/src/rt_plc_thread.c
+27
-5
src/wbl/pwrb/src/pwrb_c_atv.wb_load
src/wbl/pwrb/src/pwrb_c_atv.wb_load
+26
-1
src/wbl/pwrb/src/pwrb_c_atvarea.wb_load
src/wbl/pwrb/src/pwrb_c_atvarea.wb_load
+70
-0
src/wbl/pwrb/src/pwrb_c_cstosv.wb_load
src/wbl/pwrb/src/pwrb_c_cstosv.wb_load
+1
-1
src/wbl/pwrb/src/pwrb_c_dtv.wb_load
src/wbl/pwrb/src/pwrb_c_dtv.wb_load
+26
-1
src/wbl/pwrb/src/pwrb_c_dtvarea.wb_load
src/wbl/pwrb/src/pwrb_c_dtvarea.wb_load
+70
-0
src/wbl/pwrb/src/pwrb_c_getatp.wb_load
src/wbl/pwrb/src/pwrb_c_getatp.wb_load
+7
-11
src/wbl/pwrb/src/pwrb_c_getatv.wb_load
src/wbl/pwrb/src/pwrb_c_getatv.wb_load
+3
-0
src/wbl/pwrb/src/pwrb_c_getdtp.wb_load
src/wbl/pwrb/src/pwrb_c_getdtp.wb_load
+7
-11
src/wbl/pwrb/src/pwrb_c_getdtv.wb_load
src/wbl/pwrb/src/pwrb_c_getdtv.wb_load
+3
-0
src/wbl/pwrb/src/pwrb_c_getsp.wb_load
src/wbl/pwrb/src/pwrb_c_getsp.wb_load
+7
-10
src/wbl/pwrb/src/pwrb_c_getsv.wb_load
src/wbl/pwrb/src/pwrb_c_getsv.wb_load
+3
-0
src/wbl/pwrb/src/pwrb_c_iohandler.wb_load
src/wbl/pwrb/src/pwrb_c_iohandler.wb_load
+30
-0
src/wbl/pwrb/src/pwrb_c_sv.wb_load
src/wbl/pwrb/src/pwrb_c_sv.wb_load
+25
-0
src/wbl/pwrb/src/pwrb_c_svarea.wb_load
src/wbl/pwrb/src/pwrb_c_svarea.wb_load
+70
-0
wb/lib/wb/src/wb_gcg.cpp
wb/lib/wb/src/wb_gcg.cpp
+46
-24
No files found.
nmps/lib/nmps/src/nmps_appl.c
View file @
d29602e6
...
...
@@ -57,7 +57,7 @@
#include "co_math.h"
#include "rt_gdh.h"
#include "rt_errh.h"
#include "rt_
nmps_lo
ck.h"
#include "rt_
l
ck.h"
#include "rt_gdh_msg.h"
#include "rt_hash_msg.h"
#include "rs_nmps_msg.h"
...
...
@@ -410,7 +410,7 @@ nmpsappl_MirrorInit(
(
nmpsappl_t_datainfo
*
)
calloc
(
applctx
->
total_cellsize
,
sizeof
(
nmpsappl_t_datainfo
));
nmps_create_lock
(
&
st
s
);
lck_Create
(
&
sts
,
lck_eLock_NMp
s
);
if
(
EVEN
(
sts
))
return
sts
;
applctx
->
options
=
options
;
...
...
@@ -505,10 +505,10 @@ nmpsappl_Mirror(
for
(
i
=
0
;
i
<
applctx
->
cellist_count
;
i
++
)
{
cellist_ptr
=
applctx
->
cellist
[
i
];
nmps_Lock
;
lck_LockNMps
;
memcpy
(
cellist_ptr
->
tmp_cell
,
cellist_ptr
->
object_ptr
,
cellist_ptr
->
tmp_size
);
nmps_Unlock
;
lck_UnlockNMps
;
}
applctx
->
data_count
=
0
;
...
...
@@ -1068,4 +1068,4 @@ pwr_tStatus nmpsappl_RemoveAndKeepData(
}
return
NMPS__SUCCESS
;
}
\ No newline at end of file
}
nmps/lib/nmps/src/nmps_plc.c
View file @
d29602e6
...
...
@@ -47,7 +47,7 @@
#include "co_math.h"
#include "rt_gdh.h"
#include "rt_plc.h"
#include "rt_
nmps_lo
ck.h"
#include "rt_
l
ck.h"
#include "nmps.h"
#include "rs_nmps_msg.h"
...
...
@@ -101,7 +101,7 @@ void NMpsCell_init( pwr_sClass_NMpsCell *object)
int
i
;
pwr_tStatus
sts
;
nmps_create_lock
(
&
st
s
);
lck_Create
(
&
sts
,
lck_eLock_NMp
s
);
if
(
!
(
object
->
Function
&
NMPS_CELLFUNC_BACKUP
))
NMpsCell_init_time
(
object
);
...
...
@@ -149,13 +149,13 @@ void NMpsCell_exec(
if
(
!
(
object
->
ReloadDone
&
NMPS_CELL_RELOADDONE
))
return
;
else
{
nmps_Lock
;
lck_LockNMps
;
NMpsCell_init_time
(
object
);
object
->
ReloadDone
&=
~
NMPS_CELL_RELOADDONE
;
}
}
else
nmps_Lock
;
lck_LockNMps
;
if
(
object
->
FrontNew
)
object
->
FrontNew
=
0
;
...
...
@@ -434,7 +434,7 @@ void NMpsCell_exec(
case
NMPS_OPTYPE_FORWARD_FRONT
:
/* Insert at front of object front of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
if
(
object
->
LastIndex
>
0
)
...
...
@@ -472,7 +472,7 @@ void NMpsCell_exec(
{
/* This it not the correct object */
object
->
InFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
object
->
Data1_Back
=
1
;
...
...
@@ -485,7 +485,7 @@ void NMpsCell_exec(
break
;
case
NMPS_OPTYPE_FORWARD_UNIT
:
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
if
(
object
->
LastIndex
>
0
)
...
...
@@ -520,7 +520,7 @@ void NMpsCell_exec(
case
NMPS_OPTYPE_REVERSE_BACK
:
/* Insert at rear of object back of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
=
(
plc_t_DataInfo
*
)
&
object
->
Data1P
;
...
...
@@ -541,7 +541,7 @@ void NMpsCell_exec(
case
NMPS_OPTYPE_REVERSE_UNIT
:
/* Insert at rear of object all of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
=
(
plc_t_DataInfo
*
)
&
object
->
Data1P
;
...
...
@@ -567,7 +567,7 @@ void NMpsCell_exec(
{
/* This it not the correct object */
object
->
InFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
->
Data_Front
=
1
;
...
...
@@ -591,7 +591,7 @@ void NMpsCell_exec(
if
(
object
->
LastIndex
==
0
)
{
object
->
OutRearFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
...
...
@@ -637,7 +637,7 @@ void NMpsCell_exec(
if
(
object
->
LastIndex
==
0
)
{
object
->
OutFrontFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
#if defined OS_LINUX
...
...
@@ -683,7 +683,7 @@ void NMpsCell_exec(
}
object
->
NumberOfData
=
object
->
LastIndex
;
nmps_Unlock
;
lck_UnlockNMps
;
}
...
...
@@ -695,7 +695,7 @@ void NMpsStoreCell_init( pwr_sClass_NMpsStoreCell *object)
int
i
;
pwr_tStatus
sts
;
nmps_create_lock
(
&
st
s
);
lck_Create
(
&
sts
,
lck_eLock_NMp
s
);
if
(
!
(
object
->
Function
&
NMPS_CELLFUNC_BACKUP
))
NMpsCell_init_time
(
(
pwr_sClass_NMpsCell
*
)
object
);
...
...
@@ -747,13 +747,13 @@ void NMpsStoreCell_exec(
return
;
else
{
nmps_Lock
;
lck_LockNMps
;
NMpsCell_init_time
(
(
pwr_sClass_NMpsCell
*
)
object
);
object
->
ReloadDone
&=
~
NMPS_CELL_RELOADDONE
;
}
}
else
nmps_Lock
;
lck_LockNMps
;
if
(
object
->
FrontNew
)
object
->
FrontNew
=
0
;
if
(
object
->
RearNew
)
object
->
RearNew
=
0
;
...
...
@@ -1195,7 +1195,7 @@ void NMpsStoreCell_exec(
case
NMPS_OPTYPE_FORWARD_FRONT
:
/* Insert at front of object front of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
if
(
object
->
LastIndex
>
0
)
...
...
@@ -1232,7 +1232,7 @@ void NMpsStoreCell_exec(
{
/* This it not the correct object */
object
->
InFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
object
->
Data1_Back
=
1
;
...
...
@@ -1245,7 +1245,7 @@ void NMpsStoreCell_exec(
break
;
case
NMPS_OPTYPE_FORWARD_UNIT
:
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
if
(
object
->
LastIndex
>
0
)
...
...
@@ -1279,7 +1279,7 @@ void NMpsStoreCell_exec(
case
NMPS_OPTYPE_REVERSE_BACK
:
/* Insert at rear of object back of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
=
(
plc_t_DataInfo
*
)
&
object
->
Data1P
;
...
...
@@ -1297,7 +1297,7 @@ void NMpsStoreCell_exec(
case
NMPS_OPTYPE_REVERSE_UNIT
:
/* Insert at rear of object all of data */
if
(
object
->
CellFull
)
{
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
=
(
plc_t_DataInfo
*
)
&
object
->
Data1P
;
...
...
@@ -1320,7 +1320,7 @@ void NMpsStoreCell_exec(
{
/* This it not the correct object */
object
->
InFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
data_last
->
Data_Front
=
1
;
...
...
@@ -1341,7 +1341,7 @@ void NMpsStoreCell_exec(
if
(
object
->
LastIndex
==
0
)
{
object
->
OutRearFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
...
...
@@ -1411,7 +1411,7 @@ void NMpsStoreCell_exec(
if
(
object
->
LastIndex
==
0
)
{
object
->
OutFrontFlag
=
0
;
nmps_Unlock
;
lck_UnlockNMps
;
return
;
}
...
...
@@ -1481,7 +1481,7 @@ void NMpsStoreCell_exec(
}
object
->
NumberOfData
=
object
->
DataSelected
;
nmps_Unlock
;
lck_UnlockNMps
;
}
/*_*
...
...
@@ -3107,4 +3107,4 @@ void NMpsStoreCell120_exec( plc_sThread *tp,
pwr_sClass_NMpsStoreCell120
*
object
)
{
NMpsStoreCell_exec
(
tp
,
(
pwr_sClass_NMpsStoreCell
*
)
object
);
}
\ No newline at end of file
}
src/exe/rt_ini/src/rt_ini.c
View file @
d29602e6
...
...
@@ -927,9 +927,15 @@ load_backup ()
pwr_sClass_AvArea
*
avp
;
pwr_sClass_DvArea
*
dvp
;
pwr_sClass_IvArea
*
ivp
;
pwr_sClass_ATvArea
*
atvp
;
pwr_sClass_DTvArea
*
dtvp
;
pwr_sClass_SvArea
*
svp
;
pwr_sClass_InitArea
*
iavp
;
pwr_sClass_InitArea
*
idvp
;
pwr_sClass_InitArea
*
iivp
;
pwr_sClass_InitArea
*
iatvp
;
pwr_sClass_InitArea
*
idtvp
;
pwr_sClass_InitArea
*
isvp
;
pwr_tStatus
sts
;
int
i
;
pwr_sClass_IOHandler
*
iop
;
...
...
@@ -1001,6 +1007,42 @@ load_backup ()
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-atv"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-atv, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
atvp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &atvp), %m"
,
sts
);
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-dtv"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-dtv, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
dtvp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &dtvp), %m"
,
sts
);
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-sv"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-sv, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
svp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &svp), %m"
,
sts
);
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-iv_init"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-iv_init, &oid), %m"
,
sts
);
...
...
@@ -1013,6 +1055,42 @@ load_backup ()
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-atv_init"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-atv_init, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
iatvp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &iatvp), %m"
,
sts
);
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-dtv_init"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-dtv_init, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
idtvp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &idtvp), %m"
,
sts
);
return
;
}
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-sv_init"
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_NameToObjid(pwrNode-active-io-sv_init, &oid), %m"
,
sts
);
return
;
}
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
isvp
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_ObjidToPointer(oid, (void *) &isvp), %m"
,
sts
);
return
;
}
for
(
i
=
0
;
i
<
iop
->
AvCount
;
i
++
)
{
pwr_tFloat32
*
ifp
=
gdh_TranslateRtdbPointer
(
iavp
->
Value
[
i
]);
avp
->
Value
[
i
]
=
*
ifp
;
...
...
@@ -1028,11 +1106,29 @@ load_backup ()
ivp
->
Value
[
i
]
=
*
iip
;
}
for
(
i
=
1
;
i
<
iop
->
ATvCount
;
i
++
)
{
pwr_tTime
*
iatp
=
gdh_TranslateRtdbPointer
(
iatvp
->
Value
[
i
]);
atvp
->
Value
[
i
]
=
*
iatp
;
}
for
(
i
=
0
;
i
<
iop
->
DTvCount
;
i
++
)
{
pwr_tDeltaTime
*
idtp
=
gdh_TranslateRtdbPointer
(
idtvp
->
Value
[
i
]);
dtvp
->
Value
[
i
]
=
*
idtp
;
}
for
(
i
=
0
;
i
<
iop
->
SvCount
;
i
++
)
{
char
*
istrp
=
gdh_TranslateRtdbPointer
(
isvp
->
Value
[
i
]);
strncpy
(
svp
->
Value
[
i
],
istrp
,
sizeof
(
svp
->
Value
[
0
]));
}
typedef
struct
{
union
{
pwr_tFloat32
*
f
;
pwr_tInt32
*
i
;
pwr_tBoolean
*
b
;
pwr_tTime
*
at
;
pwr_tDeltaTime
*
dt
;
pwr_tString80
*
str
;
}
actval_p
;
pwr_tUInt32
validx
;
union
{
...
...
@@ -1046,6 +1142,9 @@ load_backup ()
pwr_sClass_Di
*
di
;
pwr_sClass_Do
*
dox
;
pwr_sClass_Co
*
co
;
pwr_sClass_ATv
*
atv
;
pwr_sClass_DTv
*
dtv
;
pwr_sClass_Sv
*
sv
;
}
op
;
}
ini_sRestoreSig
;
...
...
@@ -1104,6 +1203,60 @@ load_backup ()
i
++
;
}
ini_sRestoreSig
*
rsatv
=
calloc
(
sizeof
(
ini_sRestoreSig
),
iop
->
ATvCount
);
i
=
1
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_ATv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_ATv
,
&
aref
,
&
aref
))
{
if
(
i
>=
iop
->
ATvCount
)
break
;
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
pwr_tAddress
*
)
&
rsatv
[
i
].
op
.
atv
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_AttrRefToPointer ATv, %m"
,
sts
);
return
;
}
rsatv
[
i
].
actval_p
.
at
=
rsatv
[
i
].
op
.
atv
->
ActualValue
;
rsatv
[
i
].
validx
=
rsatv
[
i
].
op
.
atv
->
ValueIndex
;
i
++
;
}
ini_sRestoreSig
*
rsdtv
=
calloc
(
sizeof
(
ini_sRestoreSig
),
iop
->
DTvCount
);
i
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_DTv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_DTv
,
&
aref
,
&
aref
))
{
if
(
i
>=
iop
->
DTvCount
)
break
;
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
pwr_tAddress
*
)
&
rsdtv
[
i
].
op
.
dtv
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_AttrRefToPointer DTv, %m"
,
sts
);
return
;
}
rsdtv
[
i
].
actval_p
.
dt
=
rsdtv
[
i
].
op
.
dtv
->
ActualValue
;
rsdtv
[
i
].
validx
=
rsdtv
[
i
].
op
.
dtv
->
ValueIndex
;
i
++
;
}
ini_sRestoreSig
*
rssv
=
calloc
(
sizeof
(
ini_sRestoreSig
),
iop
->
SvCount
);
i
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_Sv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Sv
,
&
aref
,
&
aref
))
{
if
(
i
>=
iop
->
SvCount
)
break
;
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
pwr_tAddress
*
)
&
rssv
[
i
].
op
.
sv
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"gdh_AttrRefToPointer Sv, %m"
,
sts
);
return
;
}
rssv
[
i
].
actval_p
.
str
=
rssv
[
i
].
op
.
sv
->
ActualValue
;
rssv
[
i
].
validx
=
rssv
[
i
].
op
.
sv
->
ValueIndex
;
i
++
;
}
ini_sRestoreSig
*
rsai
=
calloc
(
sizeof
(
ini_sRestoreSig
),
iop
->
AiCount
);
i
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_Ai
,
&
aref
);
...
...
@@ -1258,6 +1411,24 @@ load_backup ()
}
free
(
rsiv
);
for
(
i
=
1
;
i
<
iop
->
ATvCount
;
i
++
)
{
rsatv
[
i
].
op
.
atv
->
ActualValue
=
rsatv
[
i
].
actval_p
.
at
;
rsatv
[
i
].
op
.
atv
->
ValueIndex
=
rsatv
[
i
].
validx
;
}
free
(
rsatv
);
for
(
i
=
0
;
i
<
iop
->
DTvCount
;
i
++
)
{
rsdtv
[
i
].
op
.
dtv
->
ActualValue
=
rsdtv
[
i
].
actval_p
.
dt
;
rsdtv
[
i
].
op
.
dtv
->
ValueIndex
=
rsdtv
[
i
].
validx
;
}
free
(
rsdtv
);
for
(
i
=
0
;
i
<
iop
->
SvCount
;
i
++
)
{
rssv
[
i
].
op
.
sv
->
ActualValue
=
rssv
[
i
].
actval_p
.
str
;
rssv
[
i
].
op
.
sv
->
ValueIndex
=
rssv
[
i
].
validx
;
}
free
(
rssv
);
for
(
i
=
0
;
i
<
iop
->
AiCount
;
i
++
)
{
rsai
[
i
].
op
.
ai
->
ActualValue
=
rsai
[
i
].
actval_p
.
f
;
rsai
[
i
].
op
.
ai
->
ValueIndex
=
rsai
[
i
].
validx
;
...
...
@@ -1317,6 +1488,21 @@ load_backup ()
pwr_tInt32
*
iip
=
gdh_TranslateRtdbPointer
(
iivp
->
Value
[
i
]);
*
iip
=
ivp
->
Value
[
i
];
}
for
(
i
=
1
;
i
<
iop
->
ATvCount
;
i
++
)
{
pwr_tTime
*
iatp
=
gdh_TranslateRtdbPointer
(
iatvp
->
Value
[
i
]);
*
iatp
=
atvp
->
Value
[
i
];
}
for
(
i
=
0
;
i
<
iop
->
DTvCount
;
i
++
)
{
pwr_tDeltaTime
*
idtp
=
gdh_TranslateRtdbPointer
(
idtvp
->
Value
[
i
]);
*
idtp
=
dtvp
->
Value
[
i
];
}
for
(
i
=
0
;
i
<
iop
->
SvCount
;
i
++
)
{
char
*
istrp
=
gdh_TranslateRtdbPointer
(
isvp
->
Value
[
i
]);
strncpy
(
istrp
,
svp
->
Value
[
i
],
80
);
}
}
static
void
ini_errl_cb
(
void
*
userdata
,
char
*
str
,
char
severity
,
pwr_tStatus
sts
,
int
anix
,
...
...
src/exp/rt/src/rt_plc_process.c
View file @
d29602e6
...
...
@@ -68,7 +68,7 @@
#include "rt_que.h"
#include "rt_csup.h"
#include "rt_ini_event.h"
#include "rt_
nmps_lo
ck.h"
#include "rt_
l
ck.h"
#include "rt_aproc.h"
#include "rt_pwr_msg.h"
...
...
@@ -208,7 +208,9 @@ int main (
stop_threads
(
pp
);
clean_all
(
pp
);
nmps_delete_lock
(
&
sts
);
lck_Delete
(
&
sts
,
lck_eLock_NMps
);
lck_Delete
(
&
sts
,
lck_eLock_Time
);
lck_Delete
(
&
sts
,
lck_eLock_Str
);
break
;
case
ini_mEvent_oldPlcStop
:
errh_SetStatus
(
PWR__SRVTERM
);
...
...
@@ -258,12 +260,15 @@ init_process ( char *name)
exit
(
sts
);
}
// nmps_create_lock( &sts);
// if (EVEN(sts)) {
// errh_Fatal("nmps_create_lock, %m", sts);
// errh_SetStatus( PWR__SRVTERM);
// exit(sts);
//}
lck_Create
(
&
sts
,
lck_eLock_Time
);
if
(
EVEN
(
sts
))
errh_Fatal
(
"lock create time, %m"
,
sts
);
lck_Create
(
&
sts
,
lck_eLock_Str
);
if
(
EVEN
(
sts
))
errh_Fatal
(
"lock create str, %m"
,
sts
);
lck_Create
(
&
sts
,
lck_eLock_NMps
);
if
(
EVEN
(
sts
))
errh_Fatal
(
"lock create NMps, %m"
,
sts
);
if
(
strstr
(
name
,
"rt_plc_core"
)
!=
0
)
pp
->
is_core
=
1
;
...
...
@@ -427,6 +432,7 @@ init_plc (
init_grafcet
(
pp
);
link_io_base_areas
(
pp
);
pp
->
system_time
=
(
pwr_tTime
*
)
pp
->
base
.
atv_a
.
p
;
return
sts
;
}
...
...
@@ -555,6 +561,9 @@ link_io_base_areas (
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
ii_a
,
"pwrNode-active-io-ii"
,
pp
->
IOHandler
->
IiCount
*
sizeof
(
pwr_tInt32
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
io_a
,
"pwrNode-active-io-io"
,
pp
->
IOHandler
->
IoCount
*
sizeof
(
pwr_tInt32
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
iv_a
,
"pwrNode-active-io-iv"
,
pp
->
IOHandler
->
IvCount
*
sizeof
(
pwr_tInt32
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
atv_a
,
"pwrNode-active-io-atv"
,
pp
->
IOHandler
->
ATvCount
*
sizeof
(
pwr_tTime
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
dtv_a
,
"pwrNode-active-io-dtv"
,
pp
->
IOHandler
->
DTvCount
*
sizeof
(
pwr_tDeltaTime
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
sv_a
,
"pwrNode-active-io-sv"
,
pp
->
IOHandler
->
SvCount
*
sizeof
(
pwr_tString80
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
bi_a
,
"pwrNode-active-io-bi"
,
pp
->
IOHandler
->
BiSize
);
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
bo_a
,
"pwrNode-active-io-bo"
,
pp
->
IOHandler
->
BoSize
);
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
av_i
,
"pwrNode-active-io-av_init"
,
pp
->
IOHandler
->
AvCount
*
sizeof
(
pwr_tUInt64
));
...
...
@@ -566,6 +575,9 @@ link_io_base_areas (
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
do_i
,
"pwrNode-active-io-do_init"
,
pp
->
IOHandler
->
DoCount
*
sizeof
(
pwr_tUInt64
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
ii_i
,
"pwrNode-active-io-ii_init"
,
pp
->
IOHandler
->
IiCount
*
sizeof
(
pwr_tUInt64
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
io_i
,
"pwrNode-active-io-io_init"
,
pp
->
IOHandler
->
IoCount
*
sizeof
(
pwr_tUInt64
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
atv_i
,
"pwrNode-active-io-iatv_init"
,
pp
->
IOHandler
->
ATvCount
*
sizeof
(
pwr_tTime
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
dtv_i
,
"pwrNode-active-io-idtv_init"
,
pp
->
IOHandler
->
DTvCount
*
sizeof
(
pwr_tDeltaTime
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
sv_i
,
"pwrNode-active-io-isv_init"
,
pp
->
IOHandler
->
SvCount
*
sizeof
(
pwr_tString80
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
bi_i
,
"pwrNode-active-io-bi_init"
,
pp
->
IOHandler
->
BiCount
*
sizeof
(
pwr_tUInt64
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
bi_isize
,
"pwrNode-active-io-bi_initsize"
,
pp
->
IOHandler
->
BiCount
*
sizeof
(
pwr_tUInt64
));
dlink_area
((
plc_sDlink
*
)
&
pp
->
base
.
bo_i
,
"pwrNode-active-io-bo_init"
,
pp
->
IOHandler
->
BoCount
*
sizeof
(
pwr_tUInt64
));
...
...
@@ -617,6 +629,15 @@ link_io_copy_areas (
tp
->
copy
.
iv_a
=
pp
->
base
.
iv_a
;
tp
->
copy
.
iv_a
.
p
=
calloc
(
1
,
tp
->
copy
.
iv_a
.
size
);
tp
->
copy
.
atv_a
=
pp
->
base
.
atv_a
;
tp
->
copy
.
atv_a
.
p
=
calloc
(
1
,
tp
->
copy
.
atv_a
.
size
);
tp
->
copy
.
dtv_a
=
pp
->
base
.
dtv_a
;
tp
->
copy
.
dtv_a
.
p
=
calloc
(
1
,
tp
->
copy
.
dtv_a
.
size
);
tp
->
copy
.
sv_a
=
pp
->
base
.
sv_a
;
tp
->
copy
.
sv_a
.
p
=
calloc
(
1
,
tp
->
copy
.
sv_a
.
size
);
tp
->
copy
.
bi_a
=
pp
->
base
.
bi_a
;
tp
->
copy
.
bi_a
.
p
=
calloc
(
1
,
tp
->
copy
.
bi_a
.
size
);
...
...
src/lib/rt/src/rt_gdh.c
View file @
d29602e6
...
...
@@ -67,6 +67,7 @@
#include "rt_subc.h"
#include "rt_sanc.h"
#include "rt_dl.h"
#include "rt_lck.h"
#if defined (OS_LYNX) || defined(OS_LINUX) || defined OS_MACOS
# define gdh_Lock pthread_mutex_lock(&gdbroot->thread_lock); gdb_Lock
...
...
@@ -5159,3 +5160,261 @@ pwr_tStatus gdh_GetLocalClassList( int cidcnt, pwr_tCid *cid, int attrobjects, p
array_Close
(
arr
);
return
GDH__SUCCESS
;
}
/**
* @brief Thread save function to fetch a direct linked absolute time value.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
void
gdh_GetTimeDL
(
pwr_tTime
*
atp
,
/**< Direct link to time attribute */
pwr_tTime
*
time
/**< Receives the requested time */
)
{
lck_Lock
(
lck_eLock_Time
);
*
time
=
*
atp
;
lck_Unlock
(
lck_eLock_Time
);
}
/**
* @brief Thread save function to store a direct linked absolute time value.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
void
gdh_SetTimeDL
(
pwr_tTime
*
atp
,
/**< Direct link to time attribute */
pwr_tTime
*
time
/**< Time value to set */
)
{
if
(
time
)
{
lck_Lock
(
lck_eLock_Time
);
*
atp
=
*
time
;
lck_Unlock
(
lck_eLock_Time
);
}
else
{
/* Set current time */
lck_Lock
(
lck_eLock_Time
);
time_GetTime
(
atp
);
lck_Unlock
(
lck_eLock_Time
);
}
}
/**
* @brief Thread save function to fetch a direct linked delta time value.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
void
gdh_GetDeltaTimeDL
(
pwr_tDeltaTime
*
dtp
,
/**< Direct link to time attribute */
pwr_tDeltaTime
*
time
/**< Receives the requested time */
)
{
lck_Lock
(
lck_eLock_Time
);
*
time
=
*
dtp
;
lck_Unlock
(
lck_eLock_Time
);
}
/**
* @brief Thread save function to store a direct linked delta time value.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
void
gdh_SetDeltaTimeDL
(
pwr_tDeltaTime
*
dtp
,
/**< Direct link to time attribute */
pwr_tDeltaTime
*
time
/**< Time value to set */
)
{
lck_Lock
(
lck_eLock_Time
);
*
dtp
=
*
time
;
lck_Unlock
(
lck_eLock_Time
);
}
/**
* @brief Thread save function to fetch a direct linked string value.
* Sets the string lock to ensure that the string is not modified during
* the operation.
* The application first has to attach the string lock with a call to
* lck_Create(&sts, lck_eLock_Str).
*
* @return pwr_tStatus
*/
void
gdh_GetStrDL
(
char
*
sp
,
/**< Direct link to string attribute */
char
*
str
,
/**< Receives the requested string */
int
size
/**< Size of string */
)
{
lck_Lock
(
lck_eLock_Str
);
strncpy
(
str
,
sp
,
size
);
lck_Unlock
(
lck_eLock_Str
);
}
/**
* @brief Thread save function to store a direct linked string value.
* Sets the string lock to ensure that the string is not modified during
* the operation.
* The application first has to attach the string lock with a call to
* lck_Create(&sts, lck_eLock_Str).
*
* @return pwr_tStatus
*/
void
gdh_SetStrDL
(
char
*
sp
,
/**< Direct link to string attribute */
char
*
str
,
/**< Time value to set */
int
size
/**< Size of string */
)
{
lck_Lock
(
lck_eLock_Str
);
strncpy
(
sp
,
str
,
size
);
lck_Unlock
(
lck_eLock_Str
);
}
/**
* @brief Fetch an absolute time value from an attribute.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_GetObjectInfoTime
(
char
*
name
,
/**< Attribute name */
pwr_tTime
*
time
/**< Receives the requested time */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Time
);
sts
=
gdh_GetObjectInfo
(
name
,
(
pwr_tAddress
)
time
,
sizeof
(
pwr_tTime
));
lck_Unlock
(
lck_eLock_Time
);
return
sts
;
}
/**
* @brief Store an absolute time value in an attribute.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_SetObjectInfoTime
(
char
*
name
,
/**< Attribute name */
pwr_tTime
*
time
/**< Time to set */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Time
);
sts
=
gdh_SetObjectInfo
(
name
,
(
void
*
)
time
,
sizeof
(
pwr_tTime
));
lck_Unlock
(
lck_eLock_Time
);
return
sts
;
}
/**
* @brief Fetch an delta time value from an attribute.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_GetObjectInfoDeltaTime
(
char
*
name
,
/**< Attribute name */
pwr_tDeltaTime
*
time
/**< Receives the requested time */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Time
);
sts
=
gdh_GetObjectInfo
(
name
,
(
void
*
)
time
,
sizeof
(
pwr_tDeltaTime
));
lck_Unlock
(
lck_eLock_Time
);
return
sts
;
}
/**
* @brief Store a delta time value in an attribute.
* Sets the time lock to ensure that the time is not modified during
* the operation.
* The application first has to attach the time lock with a call to
* lck_Create(&sts, lck_eLock_Time).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_SetObjectInfoDeltaTime
(
char
*
name
,
/**< Attribute name */
pwr_tDeltaTime
*
time
/**< Time to set */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Time
);
sts
=
gdh_SetObjectInfo
(
name
,
(
void
*
)
time
,
sizeof
(
pwr_tDeltaTime
));
lck_Unlock
(
lck_eLock_Time
);
return
sts
;
}
/**
* @brief Fetch a string value from an attribute.
* Sets the string lock to ensure that the string is not modified during
* the operation.
* The application first has to attach the string lock with a call to
* lck_Create(&sts, lck_eLock_Str).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_GetObjectInfoStr
(
char
*
name
,
/**< Attribute name */
char
*
str
,
/**< Receives the requested string */
int
size
/**< String size */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Str
);
sts
=
gdh_GetObjectInfo
(
name
,
(
void
*
)
str
,
size
);
lck_Unlock
(
lck_eLock_Str
);
return
sts
;
}
/**
* @brief Store a string value in an attribute.
* Sets the string lock to ensure that the string is not modified during
* the operation.
* The application first has to attach the string lock with a call to
* lck_Create(&sts, lck_eLock_Str).
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_SetObjectInfoStr
(
char
*
name
,
/**< Attribute name */
char
*
str
,
/**< String to set */
int
size
/**< String size */
)
{
pwr_tStatus
sts
;
lck_Lock
(
lck_eLock_Str
);
sts
=
gdh_SetObjectInfo
(
name
,
(
void
*
)
str
,
size
);
lck_Unlock
(
lck_eLock_Str
);
return
sts
;
}
src/lib/rt/src/rt_gdh.h
View file @
d29602e6
...
...
@@ -861,9 +861,23 @@ gdh_GetLocalClassList(
int
*
listcnt
);
/* Thread safe functions for times and strings */
void
gdh_GetTimeDL
(
pwr_tTime
*
atp
,
pwr_tTime
*
time
);
void
gdh_SetTimeDL
(
pwr_tTime
*
atp
,
pwr_tTime
*
time
);
void
gdh_GetDeltaTimeDL
(
pwr_tDeltaTime
*
dtp
,
pwr_tDeltaTime
*
time
);
void
gdh_SetDeltaTimeDL
(
pwr_tDeltaTime
*
dtp
,
pwr_tDeltaTime
*
time
);
void
gdh_GetStrDL
(
char
*
sp
,
char
*
str
,
int
size
);
void
gdh_SetStrDL
(
char
*
sp
,
char
*
str
,
int
size
);
pwr_tStatus
gdh_GetObjectInfoTime
(
char
*
name
,
pwr_tTime
*
time
);
pwr_tStatus
gdh_SetObjectInfoTime
(
char
*
name
,
pwr_tTime
*
time
);
pwr_tStatus
gdh_GetObjectInfoDeltaTime
(
char
*
name
,
pwr_tDeltaTime
*
time
);
pwr_tStatus
gdh_SetObjectInfoDeltaTime
(
char
*
name
,
pwr_tDeltaTime
*
time
);
pwr_tStatus
gdh_GetObjectInfoStr
(
char
*
name
,
char
*
str
,
int
size
);
pwr_tStatus
gdh_SetObjectInfoStr
(
char
*
name
,
char
*
str
,
int
size
);
/** @} */
#if defined __cplusplus
}
#endif
#endif
\ No newline at end of file
#endif
src/lib/rt/src/rt_ini_load.c
View file @
d29602e6
...
...
@@ -1920,7 +1920,8 @@ create_active_io ()
pwr_tStatus
sts
;
pwr_tObjid
oid
;
pwr_tAttrRef
aref
;
int
ai_cnt
,
ao_cnt
,
av_cnt
,
di_cnt
,
do_cnt
,
dv_cnt
,
ii_cnt
,
io_cnt
,
iv_cnt
,
co_cnt
,
bi_cnt
,
bo_cnt
;
int
ai_cnt
,
ao_cnt
,
av_cnt
,
di_cnt
,
do_cnt
,
dv_cnt
,
ii_cnt
,
io_cnt
,
iv_cnt
;
int
atv_cnt
,
dtv_cnt
,
sv_cnt
,
co_cnt
,
bi_cnt
,
bo_cnt
;
int
bi_size
,
bo_size
;
pwr_tCid
subcid
;
pwr_tAttrRef
actval_aref
;
...
...
@@ -1984,6 +1985,24 @@ create_active_io ()
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Iv
,
&
aref
,
&
aref
))
iv_cnt
++
;
atv_cnt
=
1
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_ATv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_ATv
,
&
aref
,
&
aref
))
atv_cnt
++
;
dtv_cnt
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_DTv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_DTv
,
&
aref
,
&
aref
))
dtv_cnt
++
;
sv_cnt
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_Sv
,
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Sv
,
&
aref
,
&
aref
))
sv_cnt
++
;
co_cnt
=
0
;
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_Co
,
&
aref
);
ODD
(
sts
);
...
...
@@ -2073,6 +2092,15 @@ create_active_io ()
sts
=
gdh_CreateObject
(
"pwrNode-active-io-iv"
,
pwr_cClass_IvArea
,
iv_cnt
*
sizeof
(((
pwr_sClass_IvArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-atv"
,
pwr_cClass_ATvArea
,
atv_cnt
*
sizeof
(((
pwr_sClass_ATvArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-dtv"
,
pwr_cClass_DTvArea
,
dtv_cnt
*
sizeof
(((
pwr_sClass_DTvArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-sv"
,
pwr_cClass_SvArea
,
sv_cnt
*
sizeof
(((
pwr_sClass_SvArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-bi"
,
pwr_cClass_BiArea
,
bi_size
,
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
...
...
@@ -2106,6 +2134,15 @@ create_active_io ()
sts
=
gdh_CreateObject
(
"pwrNode-active-io-io_init"
,
pwr_cClass_InitArea
,
io_cnt
*
sizeof
(((
pwr_sClass_InitArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-atv_init"
,
pwr_cClass_InitArea
,
atv_cnt
*
sizeof
(((
pwr_sClass_InitArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-dtv_init"
,
pwr_cClass_InitArea
,
dtv_cnt
*
sizeof
(((
pwr_sClass_InitArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-sv_init"
,
pwr_cClass_InitArea
,
sv_cnt
*
sizeof
(((
pwr_sClass_InitArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
sts
=
gdh_CreateObject
(
"pwrNode-active-io-bi_init"
,
pwr_cClass_InitArea
,
bi_cnt
*
sizeof
(((
pwr_sClass_InitArea
*
)
0
)
->
Value
[
0
]),
&
oid
,
pwr_cNObjid
,
0
,
pwr_cNObjid
);
...
...
@@ -2171,6 +2208,12 @@ delete_old_io ()
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-iv"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-atv"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-dtv"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-sv"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-bi"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-bo"
,
&
oid
);
...
...
@@ -2193,6 +2236,12 @@ delete_old_io ()
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-io_init"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-atv_init"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-dtv_init"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-sv_init"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-bi_init"
,
&
oid
);
if
(
ODD
(
sts
))
gdh_DeleteObject
(
oid
);
sts
=
gdh_NameToObjid
(
"pwrNode-old-io-bi_initsize"
,
&
oid
);
...
...
src/lib/rt/src/rt_io_base.c
View file @
d29602e6
...
...
@@ -1185,6 +1185,199 @@ io_init_iv_signals (
return
sts
;
}
/*----------------------------------------------------------------------------*\
Initialization of atv signals.
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
io_init_atv_signals
(
pwr_sClass_IOHandler
*
io_op
)
{
pwr_tObjid
area_objid
;
pwr_sAttrRef
aref
;
pwr_sClass_ATvArea
*
area_op
;
pwr_sClass_ATv
*
o
;
pwr_tStatus
sts
;
pwr_tTime
*
p
;
pwr_tInt32
atv_count
=
0
;
pwr_sClass_InitArea
*
iarea_op
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-atv"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
area_op
);
if
(
EVEN
(
sts
))
return
sts
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-atv_init"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
iarea_op
);
if
(
EVEN
(
sts
))
return
sts
;
/* First index is reserved for system time */
p
=
area_op
->
Value
+
1
;
atv_count
++
;
/* Loop ATv-object */
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_ATv
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NOSUCHOBJ
&&
sts
!=
GDH__BADOBJTYPE
&&
sts
!=
GDH__NO_TYPE
)
{
errh_Error
(
"Get class list of ATv
\n
%m"
,
sts
);
}
while
(
ODD
(
sts
))
{
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
void
*
)
&
o
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
if
(
sts
!=
GDH__REMOTE
)
{
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
o
->
ActualValue
,
p
);
o
->
ValueIndex
=
atv_count
;
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
iarea_op
->
Value
[
atv_count
],
&
o
->
InitialValue
);
atv_count
++
;
p
++
;
}
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_ATv
,
&
aref
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
}
if
(
sts
==
GDH__NO_TYPE
||
sts
==
GDH__NOSUCHOBJ
||
sts
==
GDH__BADOBJTYPE
)
sts
=
IO__SUCCESS
;
io_op
->
ATvCount
=
atv_count
;
return
sts
;
}
/*----------------------------------------------------------------------------*\
Initialization of dtv signals.
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
io_init_dtv_signals
(
pwr_sClass_IOHandler
*
io_op
)
{
pwr_tObjid
area_objid
;
pwr_sAttrRef
aref
;
pwr_sClass_DTvArea
*
area_op
;
pwr_sClass_DTv
*
o
;
pwr_tStatus
sts
;
pwr_tDeltaTime
*
p
;
pwr_tInt32
dtv_count
=
0
;
pwr_sClass_InitArea
*
iarea_op
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-dtv"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
area_op
);
if
(
EVEN
(
sts
))
return
sts
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-dtv_init"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
iarea_op
);
if
(
EVEN
(
sts
))
return
sts
;
p
=
area_op
->
Value
;
/* Loop DTv-object */
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_DTv
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NOSUCHOBJ
&&
sts
!=
GDH__BADOBJTYPE
&&
sts
!=
GDH__NO_TYPE
)
{
errh_Error
(
"Get class list of DTv
\n
%m"
,
sts
);
}
while
(
ODD
(
sts
))
{
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
void
*
)
&
o
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
if
(
sts
!=
GDH__REMOTE
)
{
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
o
->
ActualValue
,
p
);
o
->
ValueIndex
=
dtv_count
;
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
iarea_op
->
Value
[
dtv_count
],
&
o
->
InitialValue
);
dtv_count
++
;
p
++
;
}
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_DTv
,
&
aref
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
}
if
(
sts
==
GDH__NO_TYPE
||
sts
==
GDH__NOSUCHOBJ
||
sts
==
GDH__BADOBJTYPE
)
sts
=
IO__SUCCESS
;
io_op
->
DTvCount
=
dtv_count
;
return
sts
;
}
/*----------------------------------------------------------------------------*\
Initialization of sv signals.
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
io_init_sv_signals
(
pwr_sClass_IOHandler
*
io_op
)
{
pwr_tObjid
area_objid
;
pwr_sAttrRef
aref
;
pwr_sClass_SvArea
*
area_op
;
pwr_sClass_Sv
*
o
;
pwr_tStatus
sts
;
pwr_tString80
*
p
;
pwr_tInt32
sv_count
=
0
;
pwr_sClass_InitArea
*
iarea_op
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-sv"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
area_op
);
if
(
EVEN
(
sts
))
return
sts
;
/* Get pointer to area-object */
sts
=
gdh_NameToObjid
(
"pwrNode-active-io-sv_init"
,
&
area_objid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
area_objid
,
(
void
*
)
&
iarea_op
);
if
(
EVEN
(
sts
))
return
sts
;
p
=
area_op
->
Value
;
/* Loop Sv-object */
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_Sv
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NOSUCHOBJ
&&
sts
!=
GDH__BADOBJTYPE
&&
sts
!=
GDH__NO_TYPE
)
{
errh_Error
(
"Get class list of Sv
\n
%m"
,
sts
);
}
while
(
ODD
(
sts
))
{
sts
=
gdh_AttrRefToPointer
(
&
aref
,
(
void
*
)
&
o
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
if
(
sts
!=
GDH__REMOTE
)
{
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
o
->
ActualValue
,
p
);
o
->
ValueIndex
=
sv_count
;
gdh_StoreRtdbPointer
(
(
unsigned
long
*
)
&
iarea_op
->
Value
[
sv_count
],
&
o
->
InitialValue
);
sv_count
++
;
p
++
;
}
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_Sv
,
&
aref
,
&
aref
);
if
(
EVEN
(
sts
)
&&
sts
!=
GDH__NO_TYPE
)
return
sts
;
}
if
(
sts
==
GDH__NO_TYPE
||
sts
==
GDH__NOSUCHOBJ
||
sts
==
GDH__BADOBJTYPE
)
sts
=
IO__SUCCESS
;
io_op
->
SvCount
=
sv_count
;
return
sts
;
}
/*----------------------------------------------------------------------------*\
Initialization of Bi signals and channels.
\*----------------------------------------------------------------------------*/
...
...
@@ -1616,6 +1809,15 @@ pwr_tStatus io_init_signals( void)
sts
=
io_init_iv_signals
(
io_op
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
io_init_atv_signals
(
io_op
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
io_init_dtv_signals
(
io_op
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
io_init_sv_signals
(
io_op
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
io_init_bi_signals
(
io_op
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -4028,4 +4230,4 @@ void io_methods_print()
}
printf
(
"
\n
"
);
}
}
\ No newline at end of file
}
src/lib/rt/src/rt_nmps_lock.c
deleted
100644 → 0
View file @
4f7e57f2
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
*/
#include <string.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "pwr.h"
#include "rt_sect.h"
#include "rt_nmps_lock.h"
sect_sHead
*
nmps_locksect
=
0
;
void
nmps_create_lock
(
pwr_tStatus
*
sts
)
{
pwr_tBoolean
created
;
if
(
!
nmps_locksect
)
{
nmps_locksect
=
sect_Alloc
(
sts
,
&
created
,
0
,
sizeof
(
sect_sMutex
),
nmps_cName_Lock
,
sect_mFlags_Create
);
if
(
ODD
(
*
sts
)
&&
created
)
sect_InitLock
(
sts
,
nmps_locksect
,
(
sect_sMutex
*
)
nmps_locksect
->
base
);
}
}
void
nmps_unlink_lock
(
pwr_tStatus
*
sts
)
{
if
(
nmps_locksect
)
{
if
(
shmdt
(
nmps_locksect
)
==
-
1
)
*
sts
=
0
;
else
*
sts
=
1
;
}
}
void
nmps_delete_lock
(
pwr_tStatus
*
sts
)
{
if
(
nmps_locksect
)
{
char
segname
[
128
];
char
busid
[
8
];
char
*
str
=
getenv
(
pwr_dEnvBusId
);
key_t
key
;
int
shm_id
;
struct
shmid_ds
ds
;
strncpy
(
busid
,
(
str
?
str
:
"XXX"
),
3
);
busid
[
3
]
=
'\0'
;
sprintf
(
segname
,
"%s_%.3s"
,
nmps_cName_Lock
,
busid
);
key
=
ftok
(
segname
,
'P'
);
shm_id
=
shmget
(
key
,
0
,
0660
);
if
(
shmdt
(
nmps_locksect
->
base
)
==
-
1
)
printf
(
"Detach of nmps lock failed
\n
"
);
if
(
shmctl
(
shm_id
,
IPC_RMID
,
&
ds
)
==
-
1
)
printf
(
"Remove of nmps lock failed
\n
"
);
// unlink(segname);
posix_sem_unlink
(
segname
);
sect_Free
(
sts
,
nmps_locksect
);
}
}
\ No newline at end of file
src/lib/rt/src/rt_nmps_lock.h
deleted
100644 → 0
View file @
4f7e57f2
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
*/
#ifndef rt_nmps_lock_h
#define rt_nmps_lock_h
#if defined __cplusplus
extern
"C"
{
#endif
#include "pwr.h"
#include "rt_sect.h"
#define nmps_cName_Lock "/tmp/pwr_nmps_lock"
#define nmps_Lock sect_Lock( NULL, nmps_locksect, (sect_sMutex *)nmps_locksect->base);
#define nmps_Unlock sect_Unlock( NULL, nmps_locksect, (sect_sMutex *)nmps_locksect->base);
extern
sect_sHead
*
nmps_locksect
;
void
nmps_create_lock
(
pwr_tStatus
*
sts
);
void
nmps_delete_lock
(
pwr_tStatus
*
sts
);
void
nmps_unlink_lock
(
pwr_tStatus
*
sts
);
#if defined __cplusplus
}
#endif
#endif
\ No newline at end of file
src/lib/rt/src/rt_plc.h
View file @
d29602e6
...
...
@@ -116,6 +116,9 @@ typedef struct {
IO_AREA
(
pwr_sClass_IiArea
)
ii_a
;
IO_AREA
(
pwr_sClass_IoArea
)
io_a
;
IO_AREA
(
pwr_sClass_IvArea
)
iv_a
;
IO_AREA
(
pwr_sClass_ATvArea
)
atv_a
;
IO_AREA
(
pwr_sClass_DTvArea
)
dtv_a
;
IO_AREA
(
pwr_sClass_SvArea
)
sv_a
;
IO_AREA
(
pwr_sClass_BiArea
)
bi_a
;
IO_AREA
(
pwr_sClass_BoArea
)
bo_a
;
IO_AREA
(
pwr_sClass_InitArea
)
av_i
;
...
...
@@ -127,6 +130,9 @@ typedef struct {
IO_AREA
(
pwr_sClass_InitArea
)
ao_i
;
IO_AREA
(
pwr_sClass_InitArea
)
do_i
;
IO_AREA
(
pwr_sClass_InitArea
)
io_i
;
IO_AREA
(
pwr_sClass_InitArea
)
atv_i
;
IO_AREA
(
pwr_sClass_InitArea
)
dtv_i
;
IO_AREA
(
pwr_sClass_InitArea
)
sv_i
;
IO_AREA
(
pwr_sClass_InitArea
)
bi_i
;
IO_AREA
(
pwr_sClass_InitArea
)
bi_isize
;
IO_AREA
(
pwr_sClass_InitArea
)
bo_i
;
...
...
@@ -195,6 +201,8 @@ struct plc_sThread {
pwr_tRedundancyStateEnum
redu_state_old
;
int
redu_table_version_req_sent
;
redu_tCtx
redu
;
int
tim_copy_lock
;
int
str_copy_lock
;
};
struct
plc_sProcess
{
...
...
@@ -212,6 +220,7 @@ struct plc_sProcess {
thread_sMutex
io_copy_mutex
;
plc_sArea
base
;
int
is_core
;
pwr_tTime
*
system_time
;
};
#if defined OS_LYNX || defined OS_LINUX
...
...
@@ -225,4 +234,4 @@ typedef struct
#endif
#endif
\ No newline at end of file
#endif
src/lib/rt/src/rt_plc_dirlink.c
View file @
d29602e6
...
...
@@ -200,6 +200,9 @@ plc_rtdbref (
case
pwr_cClass_Av
:
case
pwr_cClass_Iv
:
case
pwr_cClass_Co
:
case
pwr_cClass_ATv
:
case
pwr_cClass_DTv
:
case
pwr_cClass_Sv
:
sts
=
plc_GetObjectAttrValue
(
la
->
ObjType
,
la
->
AttrRef
,
".ValueIndex"
,
&
Index
,
sizeof
(
pwr_tInt32
));
if
(
EVEN
(
sts
))
{
errh_Error
(
"plc_GetObjectAttrValue object %s.ValueIndex
\n
%m"
,
cdh_ObjidToString
(
la
->
AttrRef
.
Objid
,
0
),
sts
);
...
...
@@ -265,6 +268,21 @@ plc_rtdbref (
*
la
->
Pointer
=
&
tp
->
copy
.
iv_a
.
p
->
Value
[
Index
];
break
;
case
pwr_cClass_ATv
:
if
(
la
->
UseCode
==
UC_READ
&&
local_object
)
*
la
->
Pointer
=
&
tp
->
copy
.
atv_a
.
p
->
Value
[
Index
];
break
;
case
pwr_cClass_DTv
:
if
(
la
->
UseCode
==
UC_READ
&&
local_object
)
*
la
->
Pointer
=
&
tp
->
copy
.
dtv_a
.
p
->
Value
[
Index
];
break
;
case
pwr_cClass_Sv
:
if
(
la
->
UseCode
==
UC_READ
&&
local_object
)
*
la
->
Pointer
=
&
tp
->
copy
.
sv_a
.
p
->
Value
[
Index
];
break
;
/* Special: UC_READ => AbsValue, UC_READ2 => RawValue */
case
pwr_cClass_Co
:
if
(
local_object
)
{
...
...
src/lib/rt/src/rt_plc_ioarea.h
View file @
d29602e6
...
...
@@ -132,4 +132,17 @@ typedef struct {
typedef
struct
{
char
ActualValue
[
1
];
}
plc_sClass_BString
;
\ No newline at end of file
}
plc_sClass_BString
;
typedef
struct
{
pwr_tTime
ActualValue
;
}
plc_sClass_ATv
;
typedef
struct
{
pwr_tDeltaTime
ActualValue
;
}
plc_sClass_DTv
;
typedef
struct
{
pwr_tString80
ActualValue
;
}
plc_sClass_Sv
;
src/lib/rt/src/rt_plc_macro.h
View file @
d29602e6
...
...
@@ -41,6 +41,7 @@
#include "pwr_systemclasses.h"
#include "pwr_baseclasses.h"
#include "co_time.h"
#include "rt_lck.h"
#include "rt_plc.h"
#include "rt_plc_rt.h"
#include "rt_plc_dirlink.h"
...
...
@@ -67,4 +68,4 @@
#include "remote_plc_macro.h"
#include "pwr_basecomponentclasses.h"
#include "rt_plc_bcomp.h"
#include "ra_plc_user.h"
\ No newline at end of file
#include "ra_plc_user.h"
src/lib/rt/src/rt_plc_macro_string.h
View file @
d29602e6
...
...
@@ -36,14 +36,24 @@
/* Preprocessor routines for string operations */
/*_*
GETSV
get string value
@aref getsv GetSv
*/
#define GetSv_init(tp) \
tp->str_copy_lock = 1;
/*_*
STOSV
store string value
@aref stosv StoSv
*/
#define stosv_exec(obj,in) \
lck_LockStr; \
strncpy( obj->ActualValue, in, sizeof(obj->ActualValue)); \
obj->ActualValue[sizeof(obj->ActualValue)-1] = 0;
obj->ActualValue[sizeof(obj->ActualValue)-1] = 0; \
lck_UnlockStr;
/*_*
CSTOSV
...
...
@@ -52,8 +62,10 @@
*/
#define cstosv_exec(obj,in,cond) \
if ( cond ) { \
lck_LockStr; \
strncpy( obj->ActualValue, in, sizeof(obj->ActualValue)); \
obj->ActualValue[sizeof(obj->ActualValue)-1] = 0; \
lck_UnlockStr; \
}
/*_*
...
...
@@ -93,8 +105,10 @@
@aref stosp StoSp
*/
#define stosp_exec(ut,in,size) \
lck_LockStr; \
strncpy( ut, in, size); \
ut[size-1] = 0;
ut[size-1] = 0; \
lck_UnlockStr;
/*_*
CSTOSP
...
...
@@ -103,8 +117,10 @@
*/
#define cstosp_exec(ut,in,cond,size) \
if ( cond) { \
lck_LockStr; \
strncpy( ut, in, size); \
ut[size-1] = 0; \
lck_UnlockStr; \
}
/*_*
...
...
@@ -113,8 +129,10 @@
@aref stonumsp StoNumSp
*/
#define stonumsp_exec(ut,in,size,num) \
lck_LockStr; \
strncpy( ut, in, num < size ? num : size); \
ut[size-1] = 0;
ut[size-1] = 0; \
lck_UnlockStr;
/*_*
CSTONUMSP
...
...
@@ -123,10 +141,22 @@
*/
#define cstonumsp_exec(ut,in,cond,size, num) \
if ( cond) { \
lck_LockStr; \
strncpy( ut, in, num < size ? num : size); \
ut[size-1] = 0; \
lck_UnlockStr; \
}
/*_*
GetSp
Get string attribute
@aref getsp GetSp
*/
#define GetSp_exec(object,in) \
lck_LockStr; \
strncpy( object->ActVal, in, sizeof(object->ActVal)); \
lck_UnlockStr;
/*_*
SUBSTR
@aref substr SubStr
...
...
src/lib/rt/src/rt_plc_macro_time.h
View file @
d29602e6
...
...
@@ -36,13 +36,21 @@
/* Preprocessor routines for time operations */
#define GetDTv_init(tp) \
tp->tim_copy_lock = 1;
#define GetATv_init(tp) \
tp->tim_copy_lock = 1;
/*_*
STOATV
store absolute time value
@aref stoatv StoATv
*/
#define StoATv_exec(obj,in) \
obj->ActualValue = in;
lck_LockTime; \
obj->ActualValue = in; \
lck_UnlockTime;
/*_*
STODTV
...
...
@@ -50,7 +58,9 @@
@aref stodtv StoDTv
*/
#define StoDTv_exec(obj,in) \
obj->ActualValue = in;
lck_LockTime; \
obj->ActualValue = in; \
lck_UnlockTime;
/*_*
CSTOATV
...
...
@@ -58,8 +68,11 @@
@aref cstoatv CStoATv
*/
#define CStoATv_exec(obj,in,cond) \
if ( cond ) \
obj->ActualValue = in;
if ( cond ) { \
lck_LockTime; \
obj->ActualValue = in; \
lck_UnlockTime; \
}
/*_*
CSTODTV
...
...
@@ -67,8 +80,11 @@
@aref cstodtv CStoDTv
*/
#define CStoDTv_exec(obj,in,cond) \
if ( cond ) \
obj->ActualValue = in;
if ( cond ) { \
lck_LockTime; \
obj->ActualValue = in; \
lck_UnlockTime; \
}
/*_*
STOATP
...
...
@@ -76,7 +92,9 @@
@aref stoatp StoATp
*/
#define StoATp_exec(ut,in) \
ut = in;
lck_LockTime; \
ut = in; \
lck_UnlockTime;
/*_*
STODTP
...
...
@@ -84,7 +102,9 @@
@aref stodtp StoDTp
*/
#define StoDTp_exec(ut,in) \
ut = in;
lck_LockTime; \
ut = in; \
lck_UnlockTime;
/*_*
CSTOATP
...
...
@@ -92,8 +112,31 @@
@aref cstoatp CStoATp
*/
#define CStoATp_exec(ut,in,cond) \
if ( cond) \
ut = in;
if ( cond) { \
lck_LockTime; \
ut = in; \
lck_UnlockTime; \
}
/*_*
GetATp
Get absolute time attribute
@aref getatp GetATp
*/
#define GetATp_exec(object,in) \
lck_LockTime; \
object->ActVal = in; \
lck_UnlockTime;
/*_*
GetDTp
Get delta time attribute
@aref getatp GetDTp
*/
#define GetDTp_exec(object,in) \
lck_LockTime; \
object->ActVal = in; \
lck_UnlockTime;
/*_*
CSTODTP
...
...
@@ -101,8 +144,11 @@
@aref cstodtp CStoDTp
*/
#define CStoDTp_exec(ut,in,cond) \
if ( cond) \
ut = in;
if ( cond) { \
lck_LockTime; \
ut = in; \
lck_UnlockTime; \
}
/*_*
ATADD
...
...
@@ -157,8 +203,11 @@
CURRENTTIME
@aref currentime CurrentTime
*/
#define CurrentTime_init(tp) \
tp->tim_copy_lock = 1;
#define CurrentTime_exec(obj) \
obj->Time =
tp->pp->Node->SystemT
ime;
obj->Time =
*tp->pp->system_t
ime;
/*_*
ATGREATERTHAN
...
...
src/lib/rt/src/rt_plc_thread.c
View file @
d29602e6
...
...
@@ -74,6 +74,7 @@
#include "rt_csup.h"
#include "rt_c_plcthread.h"
#include "rt_c_node.h"
#include "rt_lck.h"
#define MIN_SCANTIME 1e-9
...
...
@@ -391,7 +392,6 @@ plc_thread (
}
thread_MutexLock
(
&
tp
->
pp
->
io_copy_mutex
);
memcpy
(
tp
->
copy
.
ai_a
.
p
,
tp
->
pp
->
base
.
ai_a
.
p
,
tp
->
copy
.
ai_a
.
size
);
memcpy
(
tp
->
copy
.
ao_a
.
p
,
tp
->
pp
->
base
.
ao_a
.
p
,
tp
->
copy
.
ao_a
.
size
);
memcpy
(
tp
->
copy
.
av_a
.
p
,
tp
->
pp
->
base
.
av_a
.
p
,
tp
->
copy
.
av_a
.
size
);
...
...
@@ -405,8 +405,19 @@ plc_thread (
memcpy
(
tp
->
copy
.
iv_a
.
p
,
tp
->
pp
->
base
.
iv_a
.
p
,
tp
->
copy
.
iv_a
.
size
);
memcpy
(
tp
->
copy
.
bi_a
.
p
,
tp
->
pp
->
base
.
bi_a
.
p
,
tp
->
copy
.
bi_a
.
size
);
memcpy
(
tp
->
copy
.
bo_a
.
p
,
tp
->
pp
->
base
.
bo_a
.
p
,
tp
->
copy
.
bo_a
.
size
);
thread_MutexUnlock
(
&
tp
->
pp
->
io_copy_mutex
);
if
(
tp
->
tim_copy_lock
)
{
lck_LockTime
;
memcpy
(
tp
->
copy
.
atv_a
.
p
,
tp
->
pp
->
base
.
atv_a
.
p
,
tp
->
copy
.
atv_a
.
size
);
memcpy
(
tp
->
copy
.
dtv_a
.
p
,
tp
->
pp
->
base
.
dtv_a
.
p
,
tp
->
copy
.
dtv_a
.
size
);
lck_UnlockTime
;
}
if
(
tp
->
str_copy_lock
)
{
lck_LockStr
;
memcpy
(
tp
->
copy
.
sv_a
.
p
,
tp
->
pp
->
base
.
sv_a
.
p
,
tp
->
copy
.
sv_a
.
size
);
lck_UnlockStr
;
}
que_Put
(
&
sts
,
&
tp
->
q_out
,
&
tp
->
event
,
(
void
*
)
3
);
phase
=
(
long
int
)
que_Get
(
&
sts
,
&
tp
->
q_in
,
NULL
,
NULL
);
...
...
@@ -644,7 +655,6 @@ scan (
tp
->
emergency_break_old
=
pp
->
Node
->
EmergBreakTrue
;
thread_MutexLock
(
&
pp
->
io_copy_mutex
);
memcpy
(
tp
->
copy
.
ai_a
.
p
,
pp
->
base
.
ai_a
.
p
,
tp
->
copy
.
ai_a
.
size
);
memcpy
(
tp
->
copy
.
ao_a
.
p
,
pp
->
base
.
ao_a
.
p
,
tp
->
copy
.
ao_a
.
size
);
memcpy
(
tp
->
copy
.
av_a
.
p
,
pp
->
base
.
av_a
.
p
,
tp
->
copy
.
av_a
.
size
);
...
...
@@ -657,10 +667,22 @@ scan (
memcpy
(
tp
->
copy
.
io_a
.
p
,
pp
->
base
.
io_a
.
p
,
tp
->
copy
.
io_a
.
size
);
memcpy
(
tp
->
copy
.
iv_a
.
p
,
pp
->
base
.
iv_a
.
p
,
tp
->
copy
.
iv_a
.
size
);
memcpy
(
tp
->
copy
.
bi_a
.
p
,
pp
->
base
.
bi_a
.
p
,
tp
->
copy
.
bi_a
.
size
);
memcpy
(
tp
->
copy
.
bo_a
.
p
,
pp
->
base
.
bo_a
.
p
,
tp
->
copy
.
bo_a
.
size
);
memcpy
(
tp
->
copy
.
bo_a
.
p
,
pp
->
base
.
bo_a
.
p
,
tp
->
copy
.
bo_a
.
size
);
thread_MutexUnlock
(
&
pp
->
io_copy_mutex
);
if
(
tp
->
tim_copy_lock
)
{
lck_LockTime
;
*
pp
->
system_time
=
tp
->
before_scan_abs
;
memcpy
(
tp
->
copy
.
atv_a
.
p
,
pp
->
base
.
atv_a
.
p
,
tp
->
copy
.
atv_a
.
size
);
memcpy
(
tp
->
copy
.
dtv_a
.
p
,
pp
->
base
.
dtv_a
.
p
,
tp
->
copy
.
dtv_a
.
size
);
lck_UnlockTime
;
}
if
(
tp
->
str_copy_lock
)
{
lck_LockStr
;
memcpy
(
tp
->
copy
.
sv_a
.
p
,
pp
->
base
.
sv_a
.
p
,
tp
->
copy
.
sv_a
.
size
);
lck_UnlockStr
;
}
/* Execute all the PLC code */
tp
->
exec
(
0
,
tp
);
...
...
src/wbl/pwrb/src/pwrb_c_atv.wb_load
View file @
d29602e6
...
...
@@ -37,7 +37,7 @@
!
SObject pwrb:Class
!/**
! @Version
1
.0
! @Version
2
.0
! @Group PlantConfiguration,Signals
! @Summary Absolute time value
! Absolute time value.
...
...
@@ -69,10 +69,35 @@ SObject pwrb:Class
!*/
Object ActualValue $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr Size = 16
EndBody
EndObject
!/**
! InitialValue specifies starting value of the signal at
! Proview startup.
!*/
Object InitialValue $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
EndBody
EndObject
!/**
! Index in the ATvArea array of the Area objects
! that are used for base frequency and partial frequency
! samples. Initiated at boot time by rt_ini.
!*/
Object ValueIndex $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
EndObject
EndObject
EndSObject
\ No newline at end of file
src/wbl/pwrb/src/pwrb_c_atvarea.wb_load
0 → 100644
View file @
d29602e6
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2017 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_atvarea.wb_load -- Defines the class ATvArea.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Area object for ATv values
! Area object for ATv values.
!
! The values of ATv-signals is stored in the Value
! attribut. The index is given by ValueIndex in the
! ATv-objects which is assigned at io initiation.
!
! The object is created at runtime in the dynamic system volume pwrNode.
!*/
Object ATvArea $ClassDef 702
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "ATvArea"
EndBody
Object Value $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_DYNAMIC
Attr Elements = 1
EndBody
EndObject
EndObject
EndObject
EndSObject
\ No newline at end of file
src/wbl/pwrb/src/pwrb_c_cstosv.wb_load
View file @
d29602e6
...
...
@@ -143,7 +143,7 @@ SObject pwrb:Class
Attr subwindows = 0
Attr graphmethod = 8
Attr graphindex = 1
Attr default_mask[0] =
2
Attr default_mask[0] =
3
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 1
...
...
src/wbl/pwrb/src/pwrb_c_dtv.wb_load
View file @
d29602e6
...
...
@@ -37,7 +37,7 @@
!
SObject pwrb:Class
!/**
! @Version
1
.0
! @Version
2
.0
! @Group PlantConfiguration,Signals
! @Summary Delta time value
! Delta time value.
...
...
@@ -70,7 +70,32 @@ SObject pwrb:Class
Object ActualValue $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$DeltaTime"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr Size = 16
EndBody
EndObject
!/**
! InitialValue specifies starting value of the signal at
! Proview startup.
!*/
Object InitialValue $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$DeltaTime"
EndBody
EndObject
!/**
! Index in the ATvArea array of the Area objects
! that are used for base frequency and partial frequency
! samples. Initiated at boot time by rt_ini.
!*/
Object ValueIndex $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
EndObject
...
...
src/wbl/pwrb/src/pwrb_c_dtvarea.wb_load
0 → 100644
View file @
d29602e6
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2017 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_dtvarea.wb_load -- Defines the class DTvArea.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Area object for DTv values
! Area object for DTv values.
!
! The values of DTv-signals is stored in the Value
! attribut. The index is given by ValueIndex in the
! DTv-objects which is assigned at io initiation.
!
! The object is created at runtime in the dynamic system volume pwrNode.
!*/
Object DTvArea $ClassDef 701
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "DTvArea"
EndBody
Object Value $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$DeltaTime"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_DYNAMIC
Attr Elements = 1
EndBody
EndObject
EndObject
EndObject
EndSObject
\ No newline at end of file
src/wbl/pwrb/src/pwrb_c_getatp.wb_load
View file @
d29602e6
...
...
@@ -46,19 +46,16 @@ SObject pwrb:Class
! Fetches the value of an absolute time attribute.
!
! The complete name of quantity has to be supplied.
!
! The GetATp object
! - is a pure address reference,
! - contains no relevant information (=data) in rtdb,
! - is without executable code.
!*/
Object GetATp $ClassDef 445
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetATp"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
@@ -66,9 +63,8 @@ SObject pwrb:Class
Body SysBody
Attr PgmName = "ActVal"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_DEVBODYREF
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr TypeRef = "pwrs:Type-$Time"
Attr GraphName = "VAL"
EndBody
...
...
@@ -122,12 +118,12 @@ SObject pwrb:Class
Attr default_mask[1] = 1
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod =
10
Attr compmethod =
36
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr connectmethod = 7
Attr executeordermethod =
0
Attr executeordermethod =
2
Attr objname = "GetATp"
Attr graphname = "ATp"
Attr debugpar = ""
...
...
src/wbl/pwrb/src/pwrb_c_getatv.wb_load
View file @
d29602e6
...
...
@@ -60,6 +60,9 @@ SObject pwrb:Class
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetATv"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
src/wbl/pwrb/src/pwrb_c_getdtp.wb_load
View file @
d29602e6
...
...
@@ -46,19 +46,16 @@ SObject pwrb:Class
! Fetches the value of an absolute time attribute.
!
! The complete name of quantity has to be supplied.
!
! The GetDTp object
! - is a pure address reference,
! - contains no relevant information (=data) in rtdb,
! - is without executable code.
!*/
Object GetDTp $ClassDef 446
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetDTp"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
@@ -66,10 +63,9 @@ SObject pwrb:Class
Body SysBody
Attr PgmName = "ActVal"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_DEVBODYREF
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$DeltaTime"
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr GraphName = "VAL"
EndBody
EndObject
...
...
@@ -122,12 +118,12 @@ SObject pwrb:Class
Attr default_mask[1] = 1
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod =
10
Attr compmethod =
36
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr connectmethod = 7
Attr executeordermethod =
0
Attr executeordermethod =
2
Attr objname = "GetDTp"
Attr graphname = "DTp"
Attr debugpar = ""
...
...
src/wbl/pwrb/src/pwrb_c_getdtv.wb_load
View file @
d29602e6
...
...
@@ -60,6 +60,9 @@ SObject pwrb:Class
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetDTv"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
src/wbl/pwrb/src/pwrb_c_getsp.wb_load
View file @
d29602e6
...
...
@@ -49,18 +49,16 @@ SObject pwrb:Class
!
! The complete name of quantity has to be supplied.
!
! The GetSp object
! - is a pure address reference,
! - contains no relevant information (=data) in rtdb,
! - is without executable code.
!*/
Object GetSp $ClassDef 309
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetSp"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
@@ -68,10 +66,9 @@ SObject pwrb:Class
Body SysBody
Attr PgmName = "ActVal"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_DEVBODYREF
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr GraphName = "VAL"
EndBody
EndObject
...
...
@@ -124,12 +121,12 @@ SObject pwrb:Class
Attr default_mask[1] = 1
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod =
10
Attr compmethod =
36
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr connectmethod = 7
Attr executeordermethod =
0
Attr executeordermethod =
2
Attr objname = "GetSp"
Attr graphname = "Sp"
Attr debugpar = ""
...
...
src/wbl/pwrb/src/pwrb_c_getsv.wb_load
View file @
d29602e6
...
...
@@ -60,6 +60,9 @@ SObject pwrb:Class
Attr Flags = pwr_mClassDef_DevOnly
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "GetSv"
EndBody
!/**
! Used by the PLC Editor.
!*/
...
...
src/wbl/pwrb/src/pwrb_c_iohandler.wb_load
View file @
d29602e6
...
...
@@ -263,6 +263,36 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Number of configured ATv objects in the node.
!*/
Object ATvCount $Attribute 23
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Number of configured DTv objects in the node.
!*/
Object DTvCount $Attribute 24
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Number of configured Sv objects in the node.
!*/
Object SvCount $Attribute 25
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Number of configured Bi objects in the node.
!*/
Object BiCount $Attribute 15
...
...
src/wbl/pwrb/src/pwrb_c_sv.wb_load
View file @
d29602e6
...
...
@@ -70,7 +70,32 @@ SObject pwrb:Class
Object ActualValue $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_REDUTRANSFER
Attr Size = 80
EndBody
EndObject
!/**
! InitialValue specifies starting value of the signal at
! Proview startup.
!*/
Object InitialValue $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Index in the SvArea array of the Area objects
! that are used for base frequency and partial frequency
! samples. Initiated at boot time by rt_ini.
!*/
Object ValueIndex $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
EndObject
...
...
src/wbl/pwrb/src/pwrb_c_svarea.wb_load
0 → 100644
View file @
d29602e6
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2017 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_svarea.wb_load -- Defines the class SvArea.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Area object for Sv values
! Area object for Sv values.
!
! The values of Sv-signals is stored in the Value
! attribut. The index is given by ValueIndex in the
! Sv-objects which is assigned at io initiation.
!
! The object is created at runtime in the dynamic system volume pwrNode.
!*/
Object SvArea $ClassDef 703
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SvArea"
EndBody
Object Value $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_DYNAMIC
Attr Elements = 1
EndBody
EndObject
EndObject
EndObject
EndSObject
\ No newline at end of file
wb/lib/wb/src/wb_gcg.cpp
View file @
d29602e6
...
...
@@ -3619,20 +3619,14 @@ static int gcg_get_outputstring_spec(
free
((
char
*
)
attrref
);
return
GSX__SPECFOUND
;
}
case
pwr_cClass_GetSp
:
case
pwr_cClass_GetATp
:
case
pwr_cClass_GetDTp
:
case
pwr_cClass_GetDataRefp
:
{
/**********************************************************
* Get
Sp, GetATP, GetDTp, Get
DataRefp
* GetDataRefp
***********************************************************/
pwr_tAName
aname
;
switch
(
output_node
->
ln
.
cid
)
{
case
pwr_cClass_GetSp
:
strcpy
(
aname
,
"SpObject"
);
break
;
case
pwr_cClass_GetATp
:
strcpy
(
aname
,
"ATpObject"
);
break
;
case
pwr_cClass_GetDTp
:
strcpy
(
aname
,
"DTpObject"
);
break
;
case
pwr_cClass_GetDataRefp
:
strcpy
(
aname
,
"DataRefpObject"
);
break
;
default:
;
}
...
...
@@ -6731,6 +6725,7 @@ int gcg_comp_m8( gcg_ctx gcgctx, vldh_t_node node)
pwr_tClassId
cid
;
pwr_tDisableAttr
disabled
;
pwr_tCid
scid
;
char
*
name
;
ldhses
=
(
node
->
hn
.
wind
)
->
hw
.
ldhses
;
...
...
@@ -6888,29 +6883,19 @@ int gcg_comp_m8( gcg_ctx gcgctx, vldh_t_node node)
gcg_error_msg
(
gcgctx
,
GSX__REFCLASS
,
node
);
return
GSX__NEXTNODE
;
}
/* Insert io object in ioread list */
gcg_aref_insert
(
gcgctx
,
attrref
,
GCG_PREFIX_REF
,
node
);
return
GSX__SUCCESS
;
break
;
case
pwr_cClass_GetATv
:
if
(
cid
!=
pwr_cClass_ATv
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFCLASS
,
node
);
return
GSX__NEXTNODE
;
}
/* Insert io object in ioread list */
gcg_aref_insert
(
gcgctx
,
attrref
,
GCG_PREFIX_REF
,
node
);
return
GSX__SUCCESS
;
break
;
case
pwr_cClass_GetDTv
:
if
(
cid
!=
pwr_cClass_DTv
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFCLASS
,
node
);
return
GSX__NEXTNODE
;
}
/* Insert io object in ioread list */
gcg_aref_insert
(
gcgctx
,
attrref
,
GCG_PREFIX_REF
,
node
);
return
GSX__SUCCESS
;
break
;
case
pwr_cClass_GetConstAv
:
if
(
cid
!=
pwr_cClass_ConstAv
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFCLASS
,
node
);
...
...
@@ -6948,6 +6933,18 @@ int gcg_comp_m8( gcg_ctx gcgctx, vldh_t_node node)
/* Insert io object in ioread list */
gcg_ioread_insert
(
gcgctx
,
attrref
,
GCG_PREFIX_REF
);
/* Print init call */
switch
(
node
->
ln
.
cid
)
{
case
pwr_cClass_GetATv
:
case
pwr_cClass_GetDTv
:
case
pwr_cClass_GetSv
:
sts
=
gcg_get_structname
(
gcgctx
,
node
->
ln
.
oid
,
&
name
);
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_REF_FILE
],
"%s_init( tp);
\n
"
,
name
);
default:
;
}
return
GSX__SUCCESS
;
}
...
...
@@ -7034,7 +7031,7 @@ int gcg_comp_m9( gcg_ctx gcgctx, vldh_t_node node)
* vldh_t_node node I vldh node.
*
* Description:
* Compile method for GetDp, GetAp, GetSp, Get
ATp, GetDTp, Get
DataRefp.
* Compile method for GetDp, GetAp, GetSp, GetDataRefp.
* Checks that the referenced object exists and that the referenced
* parameter exists in that object, and that the type of the parameter
* is correct.
...
...
@@ -8315,10 +8312,7 @@ int gcg_comp_m11( gcg_ctx gcgctx, vldh_t_node node)
gcg_error_msg
(
gcgctx
,
GSX__DISABLED
,
node
);
}
if
(
cid
==
pwr_cClass_Sv
||
cid
==
pwr_cClass_ATv
||
cid
==
pwr_cClass_DTv
||
cid
==
pwr_cClass_DataRefv
)
{
if
(
cid
==
pwr_cClass_DataRefv
)
{
/* Insert io object in ref list */
gcg_aref_insert
(
gcgctx
,
refattrref
,
GCG_PREFIX_REF
,
node
);
...
...
@@ -11043,6 +11037,24 @@ int gcg_comp_m36( gcg_ctx gcgctx, vldh_t_node node)
return
GSX__NEXTNODE
;
}
break
;
case
pwr_eType_Time
:
if
(
node
->
ln
.
cid
!=
pwr_cClass_GetATp
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFPARTYPE
,
node
);
return
GSX__NEXTNODE
;
}
break
;
case
pwr_eType_DeltaTime
:
if
(
node
->
ln
.
cid
!=
pwr_cClass_GetDTp
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFPARTYPE
,
node
);
return
GSX__NEXTNODE
;
}
break
;
case
pwr_eType_String
:
if
(
node
->
ln
.
cid
!=
pwr_cClass_GetSp
)
{
gcg_error_msg
(
gcgctx
,
GSX__REFPARTYPE
,
node
);
return
GSX__NEXTNODE
;
}
break
;
default:
/* Not allowed type */
gcg_error_msg
(
gcgctx
,
GSX__REFPARTYPE
,
node
);
...
...
@@ -11063,6 +11075,7 @@ int gcg_comp_m36( gcg_ctx gcgctx, vldh_t_node node)
/* Insert object in ref list */
gcg_aref_insert
(
gcgctx
,
refattrref
,
GCG_PREFIX_REF
,
node
);
return
GSX__SUCCESS
;
}
...
...
@@ -13880,6 +13893,15 @@ int gcg_comp_m55( gcg_ctx gcgctx, vldh_t_node node)
gcg_scantime_print
(
gcgctx
,
node
->
ln
.
oid
);
gcg_timer_print
(
gcgctx
,
node
->
ln
.
oid
);
/* Print init call */
switch
(
node
->
ln
.
cid
)
{
case
pwr_cClass_CurrentTime
:
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_REF_FILE
],
"%s_init( tp);
\n
"
,
name
);
default:
;
}
return
GSX__SUCCESS
;
}
/*************************************************************************
...
...
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