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
d1b69caf
Commit
d1b69caf
authored
Mar 12, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc, several plc processes with possibility to set affinity, and plc version removed
parent
6951f26f
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1045 additions
and
755 deletions
+1045
-755
src/exe/rt_ini/src/ini.c
src/exe/rt_ini/src/ini.c
+114
-79
src/exe/rt_ini/src/ini.h
src/exe/rt_ini/src/ini.h
+5
-3
src/exe/rt_ini/src/rt_ini.c
src/exe/rt_ini/src/rt_ini.c
+32
-18
src/exp/rt/src/rt_plc_process.c
src/exp/rt/src/rt_plc_process.c
+60
-7
src/lib/rt/src/rt_load.x
src/lib/rt/src/rt_load.x
+3
-5
src/msg/wb/src/wb_foe_msg.msg
src/msg/wb/src/wb_foe_msg.msg
+1
-0
src/wbl/pwrb/src/pwrb_c_buildoptions.wb_load
src/wbl/pwrb/src/pwrb_c_buildoptions.wb_load
+16
-2
src/wbl/pwrb/src/pwrb_c_plcprocess.wb_load
src/wbl/pwrb/src/pwrb_c_plcprocess.wb_load
+5
-0
wb/lib/wb/src/wb_build.cpp
wb/lib/wb/src/wb_build.cpp
+2
-2
wb/lib/wb/src/wb_gcg.cpp
wb/lib/wb/src/wb_gcg.cpp
+523
-426
wb/lib/wb/src/wb_gcg.h
wb/lib/wb/src/wb_gcg.h
+17
-1
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+257
-205
wb/lib/wb/src/wb_lfu.h
wb/lib/wb/src/wb_lfu.h
+5
-3
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+5
-4
No files found.
src/exe/rt_ini/src/ini.c
View file @
d1b69caf
This diff is collapsed.
Click to expand it.
src/exe/rt_ini/src/ini.h
View file @
d1b69caf
...
...
@@ -141,6 +141,7 @@ typedef struct {
char
id
[
40
];
ini_mProc
flags
;
proc_sProcess
proc
;
void
*
objectp
;
}
ini_sProc
;
typedef
struct
{
...
...
@@ -158,7 +159,8 @@ typedef struct {
ini_sFile
applfile
;
ini_sFile
bootfile
;
ini_sFile
nodefile
;
ini_sFile
plcfile
;
ini_sFile
*
plcfile
;
int
plcfile_cnt
;
int
busid
;
char
dir
[
256
];
char
bdir
[
256
];
/* Base dir (pwr_load) */
...
...
@@ -206,8 +208,8 @@ char * ini_LoadDirectory (pwr_tStatus*, ini_sContext*);
pwr_tBoolean
ini_LoadNode
(
pwr_tStatus
*
,
ini_sContext
*
);
pwr_tBoolean
ini_LoadVolume
(
pwr_tStatus
*
,
ini_sContext
*
,
ivol_sVolume
*
);
FILE
*
ini_OpenFile
(
pwr_tStatus
*
,
ini_sContext
*
,
ini_sFile
*
);
ini_sProc
*
ini_ProcInsert
(
pwr_tStatus
*
,
ini_sContext
*
,
char
*
,
char
*
,
int
,
int
,
char
*
,
int
,
int
,
char
*
);
void
ini_ProcIter
(
pwr_tStatus
*
,
ini_sContext
*
,
int
,
ini_sProc
*
ini_ProcInsert
(
pwr_tStatus
*
,
ini_sContext
*
,
char
*
,
char
*
,
int
,
int
,
char
*
,
int
,
int
,
char
*
,
void
*
);
void
ini_ProcIter
(
pwr_tStatus
*
,
ini_sContext
*
,
int
,
int
,
void
(
*
func
)
(
pwr_tStatus
*
,
ini_sContext
*
,
ini_sProc
*
));
void
ini_ProcLoad
(
pwr_tStatus
*
,
ini_sContext
*
,
ini_sProc
*
);
void
ini_ProcStart
(
pwr_tStatus
*
,
ini_sContext
*
,
ini_sProc
*
);
...
...
src/exe/rt_ini/src/rt_ini.c
View file @
d1b69caf
...
...
@@ -227,9 +227,9 @@ start (
#endif
ini_ProcTable
(
&
sts
,
cp
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
ini_ProcLoad
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
ini_ProcStart
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
ini_ProcPrio
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
0
,
ini_ProcLoad
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
0
,
ini_ProcStart
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_system
,
0
,
ini_ProcPrio
);
net_Connect
(
&
sts
,
&
gdbroot
->
my_aid
,
&
gdbroot
->
my_qid
,
NULL
,
"pwr_ini"
);
/*if (!qcom_Init(&sts, 0)) {*/
...
...
@@ -240,9 +240,9 @@ start (
qcom_SignalOr
(
&
sts
,
&
qcom_cQini
,
ini_mEvent_newPlcInit
|
ini_mEvent_newPlcStart
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
ini_ProcLoad
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
ini_ProcStart
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
ini_ProcPrio
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
0
,
ini_ProcLoad
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
0
,
ini_ProcStart
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
0
,
ini_ProcPrio
);
qcom_CreateQ
(
&
sts
,
&
cp
->
eventQ
,
NULL
,
"iniEvent"
);
if
(
EVEN
(
sts
))
{
...
...
@@ -406,6 +406,9 @@ restart (
)
{
pwr_tStatus
sts
;
char
time
[
24
];
lst_sEntry
*
pl
;
ini_sProc
*
pp
;
ini_CheckContext
(
&
sts
,
cp
);
...
...
@@ -437,8 +440,11 @@ restart (
ini_ProcTable
(
&
sts
,
cp
);
ini_ProcLoad
(
&
sts
,
cp
,
cp
->
plc
);
ini_ProcStart
(
&
sts
,
cp
,
cp
->
plc
);
// ini_ProcLoad(&sts, cp, cp->plc);
// ini_ProcStart(&sts, cp, cp->plc);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
ini_mProc_plc
,
ini_ProcLoad
);
ini_ProcIter
(
&
sts
,
cp
,
proc_mProcess_user
,
ini_mProc_plc
,
ini_ProcStart
);
qcom_SignalOr
(
&
sts
,
&
qcom_cQini
,
ini_mEvent_newPlcInit
);
qcom_WaitAnd
(
&
sts
,
&
cp
->
eventQ
,
&
qcom_cQini
,
ini_mEvent_newPlcInitDone
,
qcom_cTmoEternal
);
...
...
@@ -454,16 +460,21 @@ restart (
errh_LogInfo
(
&
cp
->
log
,
"Time critical period over, new PLC is running"
);
qcom_SignalOr
(
&
sts
,
&
qcom_cQini
,
ini_mEvent_swapDone
);
if
(
cp
->
PlcProcess
!=
NULL
)
{
char
time
[
24
];
for
(
pp
=
lst_Succ
(
NULL
,
&
cp
->
proc_lh
,
&
pl
);
pp
!=
NULL
;
pp
=
lst_Succ
(
NULL
,
pl
,
&
pl
))
{
if
(
pp
->
flags
.
m
&
ini_mProc_plc
&&
pp
->
objectp
)
{
pwr_sClass_PlcProcess
*
plc
=
pp
->
objectp
;
time_GetTime
(
&
cp
->
PlcProcess
->
LastChgTime
);
time_Dsub
(
&
cp
->
PlcProcess
->
StallTime
,
&
cp
->
PlcProcess
->
StartTime
,
&
cp
->
PlcProcess
->
StopTime
);
time_DtoAscii
(
&
cp
->
PlcProcess
->
StallTime
,
1
,
time
,
sizeof
(
time
));
time_GetTime
(
&
plc
->
LastChgTime
);
if
(
time_Dcomp
(
&
plc
->
StartTime
,
&
plc
->
StopTime
)
==
1
)
time_Dsub
(
&
plc
->
StallTime
,
&
plc
->
StartTime
,
&
plc
->
StopTime
);
else
plc
->
StallTime
=
pwr_cNDeltaTime
;
time_DtoAscii
(
&
plc
->
StallTime
,
1
,
time
,
sizeof
(
time
));
cp
->
np
->
RestartStallTime
=
plc
->
StallTime
;
}
}
cp
->
log
.
put
.
type
.
s
=
2
;
errh_LogInfo
(
&
cp
->
log
,
"IO stall time: %s"
,
time
);
cp
->
np
->
RestartStallTime
=
cp
->
PlcProcess
->
StallTime
;
}
ini_FreeBodies
(
&
sts
,
cp
,
0
);
ini_FreeBodies
(
&
sts
,
cp
,
1
);
...
...
@@ -671,7 +682,10 @@ createContext (int argc, char **argv)
exit
(
0
);
}
cp
->
flags
.
b
.
plcfile
=
1
;
strcpy
(
cp
->
plcfile
.
name
,
argv
[
i
+
1
]);
cp
->
plcfile
=
(
ini_sFile
*
)
calloc
(
1
,
sizeof
(
ini_sFile
));
cp
->
plcfile_cnt
=
1
;
strcpy
(
cp
->
plcfile
[
0
].
name
,
argv
[
i
+
1
]);
cp
->
plcfile
[
0
].
logOpenFail
=
errh_LogInfo
;
i
++
;
i_incr
=
1
;
break
;
...
...
src/exp/rt/src/rt_plc_process.c
View file @
d1b69caf
...
...
@@ -51,6 +51,9 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#if defined OS_LINUX
#include <sched.h>
#endif
#include <pwd.h>
#include "pwr.h"
...
...
@@ -79,7 +82,7 @@
#include "rt_pwr_msg.h"
static
plc_sProcess
*
init_process
();
static
pwr_tStatus
init_plc
(
plc_sProcess
*
);
static
pwr_tStatus
init_plc
(
plc_sProcess
*
,
char
*
name
);
static
void
init_threads
(
plc_sProcess
*
);
static
void
start_threads
(
plc_sProcess
*
);
static
void
run_threads
(
plc_sProcess
*
);
...
...
@@ -179,7 +182,7 @@ int main (
qcom_WaitAnd
(
&
sts
,
&
pp
->
eventQ
,
&
qcom_cQini
,
ini_mEvent_newPlcInit
,
qcom_cTmoEternal
);
init_plc
(
pp
);
init_plc
(
pp
,
argv
[
0
]
);
create_threads
(
pp
);
init_threads
(
pp
);
...
...
@@ -302,7 +305,8 @@ init_process ()
static
pwr_tStatus
init_plc
(
plc_sProcess
*
pp
plc_sProcess
*
pp
,
char
*
name
)
{
pwr_tStatus
sts
=
PLC__SUCCESS
;
...
...
@@ -314,6 +318,12 @@ init_plc (
int
msec
;
int
i
;
pwr_tCid
cid
;
int
busid
;
int
found
;
char
busidstr
[
10
];
char
pp_name
[
80
];
pwr_tObjName
oname
;
char
*
s
;
sts
=
gdh_GetNodeObject
(
0
,
&
oid
);
if
(
EVEN
(
sts
))
{
...
...
@@ -324,15 +334,58 @@ init_plc (
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
pp
->
Node
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetClassList
(
pwr_cClass_PlcProcess
,
&
pp_oid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"Found no PlcProcess-object
\n
%m"
,
sts
);
return
sts
;
busid
=
qcom_MyBus
(
&
sts
);
if
(
EVEN
(
sts
))
return
sts
;
sprintf
(
busidstr
,
"_%04d_"
,
busid
);
s
=
strstr
(
name
,
busidstr
);
if
(
s
)
{
strncpy
(
pp_name
,
s
+
6
,
sizeof
(
pp_name
));
if
(
(
s
=
strchr
(
pp_name
,
'.'
)))
*
s
=
0
;
}
else
{
strcpy
(
pp_name
,
""
);
}
for
(
sts
=
gdh_GetClassList
(
pwr_cClass_PlcProcess
,
&
pp_oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
pp_oid
,
&
pp_oid
))
{
sts
=
gdh_ObjidToName
(
pp_oid
,
oname
,
sizeof
(
oname
),
cdh_mName_object
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
cdh_NoCaseStrcmp
(
pp_name
,
oname
)
==
0
)
{
found
=
1
;
break
;
}
}
if
(
!
found
)
{
errh_Error
(
"Found no PlcProcess-object %s"
,
pp_name
);
return
0
;
}
sts
=
gdh_ObjidToPointer
(
pp_oid
,
(
void
*
)
&
pp
->
PlcProcess
);
if
(
EVEN
(
sts
))
return
sts
;
#if defined OS_LINUX
if
(
pp
->
PlcProcess
->
CpuMask
!=
0
)
{
cpu_set_t
mask
;
CPU_ZERO
(
&
mask
);
for
(
i
=
0
;
i
<
32
;
i
++
)
{
if
(
pp
->
PlcProcess
->
CpuMask
&
1
<<
i
)
CPU_SET
(
i
,
&
mask
);
}
sts
=
sched_setaffinity
(
0
,
sizeof
(
mask
),
&
mask
);
if
(
sts
<
0
)
errh_Error
(
"Unable to set affinity mask"
);
else
errh_Info
(
"Affinity mask set to %d"
,
pp
->
PlcProcess
->
CpuMask
);
}
#endif
i
=
0
;
sts
=
gdh_GetChild
(
pp_oid
,
&
thread_oid
);
while
(
ODD
(
sts
))
{
...
...
src/lib/rt/src/rt_load.x
View file @
d1b69caf
...
...
@@ -35,11 +35,10 @@
%#if defined OS_VMS || defined OS_ELN
%# define load_cNameDirectory "pwrp_load:"
%# define load_cDirectory "pwrp_load:"
%# define load_cNamePlc "%splc_%s_%04d_%
05d
.exe"
%# define load_cNamePlc "%splc_%s_%04d_%
s
.exe"
%
%# define load_cNameBootList "pwrp_root:[src.db]pwrp_cnf_bootlist.dat"
%# define load_cNameVolumeList "pwrp_root:[src.db]pwrp_cnf_volumelist.dat"
%# define load_cNamePlcVersion "pwrp_root:[src.db]pwrp_cnf_plcvers_%s.dat"
%# define load_cNameDistribute "pwrp_root:[src.db]pwrp_cnf_distribute.dat"
%# define load_cNameSysObject "pwrp_root:[src.db]pwrp_cnf_sysobject.dat"
%# define load_cNameGblVolumeList "pwra_db:pwr_volumelist.dat"
...
...
@@ -52,11 +51,10 @@
%#elif defined OS_POSIX
%# define load_cNameDirectory "pwrp_load"
%# define load_cDirectory "$pwrp_load/"
%# define load_cNamePlc "%splc_%s_%04d_%
05d
"
%# define load_cNamePlc "%splc_%s_%04d_%
s
"
%
%# define load_cNameBootList "$pwrp_root/src/db/pwrp_cnf_bootlist.dat"
%# define load_cNameVolumeList "$pwrp_root/src/db/pwrp_cnf_volumelist.dat"
%# define load_cNamePlcVersion "$pwrp_root/src/db/pwrp_cnf_plcvers_%s.dat"
%# define load_cNameDistribute "$pwrp_root/src/db/pwrp_cnf_distribute.dat"
%# define load_cNameSysObject "$pwrp_root/src/db/pwrp_cnf_sysobject.dat"
%# define load_cNameFilePath "$pwrp_root/src/db/pwrp_cnf_dirlist.dat"
...
...
@@ -77,7 +75,7 @@
%
%#define load_cNameAlias "%spwrp_alias.dat"
%#define load_cNameAppl "%sld_appl_%s_%d.txt"
%#define load_cNameOpt "%splc_%s_%04d.opt"
%#define load_cNameOpt "%splc_%s_%04d
_%s
.opt"
%#define load_cNameBoot "%sld_boot_%s_%04d.dat"
%#define load_cNameNode "%sld_node_%s_%04d.dat"
%#define load_cNameRc "%sld_rc_%s_%04d.dat"
...
...
src/msg/wb/src/wb_foe_msg.msg
View file @
d1b69caf
...
...
@@ -129,6 +129,7 @@ maxsize <MaxSize is larger than cell size> /error
noseqreset <No SequenceReset object found in main object> /error
compmethod <Invalid compile method> /error
libref <Invalid reference to library hierarchy> /error
misplacedthread <Misplaced thread object> /error
.facility FOE,280 /prefix = FOE__ ! Function object editor
...
...
src/wbl/pwrb/src/pwrb_c_buildoptions.wb_load
View file @
d1b69caf
...
...
@@ -37,7 +37,7 @@
!
SObject pwrb:Class
!/**
! @Version
2
.0
! @Version
3
.0
! @Group ProjectConfiguration
! @Summary Build options for plc program
! Configures the build options for the plc program.
...
...
@@ -55,7 +55,12 @@ SObject pwrb:Class
! - function objects from the class volumes NMps, Remote, Misc or Ssabox are
! used.
!
! The object creates an option file $pwrp_exe/plc_'nodename'_'busnumber'.opt
! From V4.8.4 serveral PLC processes can be configured in the same node, and also
! several BuildOptions object can be configured. Which process a BuildOptions belongs
! to is specified by inserting the name of the PlcProcess object into the PlcProcess
! attribute,
!
! The object creates an option file $pwrp_exe/plc_'nodename'_'busnumber'_'plcprocess'.opt
! with options that is added to the link command. If other requirements are
! needed in this file than the BuildOptions object offers, the file can be
! edited and handled manually if no BuildOptions object is present.
...
...
@@ -70,6 +75,15 @@ SObject pwrb:Class
Attr StructName = "BuildOptions"
EndBody
!/**
! Name of PlcProcess object for the executable that these options
! are specifications for. Only the last name segment should be stated.
!*/
Object PlcProcess $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
!/**
! System archives and system modules.
!*/
Object SystemModules $Attribute 1
...
...
src/wbl/pwrb/src/pwrb_c_plcprocess.wb_load
View file @
d1b69caf
...
...
@@ -75,6 +75,11 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object CpuMask $Attribute 15
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
EndBody
EndObject
Object BootVersion $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
...
...
wb/lib/wb/src/wb_build.cpp
View file @
d1b69caf
...
...
@@ -121,7 +121,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
for
(
int
i
=
0
;
i
<
volumecnt
;
i
++
)
{
if
(
cdh_NoCaseStrcmp
(
nodename
,
vlist
[
i
].
p1
)
==
0
)
{
if
(
bussid
==
-
1
)
{
char
systemname
[
80
],
systemgroup
[
80
]
,
pname
[
80
]
;
char
systemname
[
80
],
systemgroup
[
80
];
pwr_tVid
*
vl
;
pwr_tString40
*
vnl
;
int
vcnt
;
...
...
@@ -137,7 +137,7 @@ void wb_build::node( char *nodename, void *volumelist, int volumecnt)
cdh_ToLower
(
fname
,
fname
);
dcli_translate_filename
(
fname
,
fname
);
status
=
lfu_ReadBootFile
(
fname
,
&
btime
,
systemname
,
systemgroup
,
&
vl
,
&
vnl
,
&
vcnt
,
pname
);
&
vcnt
,
0
,
0
);
if
(
EVEN
(
status
))
{
rebuild
=
1
;
}
...
...
wb/lib/wb/src/wb_gcg.cpp
View file @
d1b69caf
This diff is collapsed.
Click to expand it.
wb/lib/wb/src/wb_gcg.h
View file @
d1b69caf
...
...
@@ -133,11 +133,17 @@ typedef struct {
typedef
struct
{
pwr_tObjid
objdid
;
pwr_tObjid
plcproc_oid
;
float
scantime
;
unsigned
long
prio
;
char
name
[
120
]
;
pwr_tOName
name
;
}
gcg_t_threadlist
;
typedef
struct
{
pwr_tObjid
oid
;
pwr_tOName
name
;
}
gcg_t_plcproclist
;
typedef
struct
{
pwr_tObjid
objdid
;
char
prefix
;
...
...
@@ -326,6 +332,16 @@ int gcg_comp_volume(
ldh_tSesContext
ldhses
);
pwr_tStatus
gcg_read_volume_plclist
(
pwr_tVolumeId
volid
,
unsigned
long
*
plc_count
,
gcg_t_plclist
**
plclist
,
unsigned
long
*
thread_count
,
gcg_t_threadlist
**
threadlist
,
unsigned
long
*
plcproc_count
,
gcg_t_plcproclist
**
plcproclist
);
#ifdef __cplusplus
}
#endif
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
d1b69caf
...
...
@@ -268,7 +268,7 @@ pwr_tStatus lfu_create_bootfile(
int
volumecount
,
int
debug
)
{
int
j
;
int
i
,
j
;
FILE
*
file
;
lfu_t_volumelist
*
volumelist_ptr
;
lfu_t_volumelist
*
first_volumelist_ptr
;
...
...
@@ -281,19 +281,21 @@ pwr_tStatus lfu_create_bootfile(
pwr_mOpSys
os
;
unsigned
long
errorcount
;
unsigned
long
warningcount
;
unsigned
long
plc_version
;
pwr_tFloat32
single_scantime
;
char
nodeconfigname_upper
[
80
];
char
vollistname_upper
[
80
];
char
systemname
[
80
];
char
systemgroup
[
80
];
char
timstr
[
32
];
gcg_t_plcproclist
*
plcproclist
;
unsigned
long
plcproc_count
;
int
noplc
;
char
plcname
[
80
];
volumelist_ptr
=
volumelist
;
utl_toupper
(
nodeconfigname_upper
,
nodeconfigname
);
for
(
j
=
0
;
j
<
volumecount
;
j
++
)
{
for
(
j
=
0
;
j
<
volumecount
;
j
++
)
{
utl_toupper
(
vollistname_upper
,
volumelist_ptr
->
p1
);
if
(
!
strcmp
(
nodeconfigname_upper
,
vollistname_upper
))
{
strcpy
(
nodename
,
volumelist_ptr
->
p2
);
...
...
@@ -319,19 +321,15 @@ pwr_tStatus lfu_create_bootfile(
/* Get data for plc and print volumes on terminal */
printf
(
"-- Creating bootfile for node %s
\n
"
,
nodename
);
sprintf
(
filename
,
load_cNamePlcVersion
,
nodeconfigname
);
cdh_ToLower
(
filename
,
filename
);
sts
=
lfu_IncrementAndGetVersion
(
filename
,
&
plc_version
);
if
(
EVEN
(
sts
))
return
sts
;
sprintf
(
plcname
,
load_cNamePlc
,
""
,
cdh_Low
(
nodename
),
bus
,
(
int
)
plc_version
);
sts
=
gcg_comp_rtnode
(
nodename
,
os
,
bus
,
1
,
&
errorcount
,
&
warningcount
,
debug
,
node_vollist
,
node_vollist_count
,
plc_version
,
single_scantime
);
node_vollist_count
,
0
,
single_scantime
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
sts
==
GSX__NOPLC
)
plc_version
=
0
;
noplc
=
1
;
else
noplc
=
0
;
/* Open the file and print boot data */
sprintf
(
filename
,
load_cNameBoot
,
...
...
@@ -356,8 +354,22 @@ pwr_tStatus lfu_create_bootfile(
fprintf
(
file
,
"%s
\n
"
,
systemgroup
);
}
fprintf
(
file
,
"%s %s
\n
"
,
plcname
,
cdh_VolumeIdToString
(
NULL
,
0
,
0
,
0
));
plcproc_count
=
0
;
gcg_read_volume_plclist
(
first_volumelist_ptr
->
volume_id
,
0
,
0
,
0
,
0
,
&
plcproc_count
,
&
plcproclist
);
if
(
noplc
||
plcproc_count
==
0
)
fprintf
(
file
,
"-
\n
"
);
else
{
for
(
i
=
0
;
i
<
(
int
)
plcproc_count
;
i
++
)
{
if
(
i
!=
0
)
fprintf
(
file
,
","
);
strncpy
(
plcname
,
cdh_Low
(
plcproclist
[
i
].
name
),
sizeof
(
plcname
));
fprintf
(
file
,
load_cNamePlc
,
""
,
cdh_Low
(
nodename
),
bus
,
plcname
);
}
fprintf
(
file
,
"
\n
"
);
}
node_vollist_count
=
0
;
volumelist_ptr
=
first_volumelist_ptr
;
utl_toupper
(
vollistname_upper
,
volumelist_ptr
->
p1
);
...
...
@@ -1342,8 +1354,8 @@ pwr_tStatus lfu_SaveDirectoryVolume(
free
(
(
char
*
)
single_scan_ptr
);
lfu_check_appl_file
(
nodename_ptr
,
*
bus_number_ptr
);
// lfu_check_opt_file( nodename_ptr, *bus_number_ptr, (pwr_mOpSys) os);
lfu_check_appl_file
(
ldhses
,
nodename_ptr
,
*
bus_number_ptr
);
// lfu_check_opt_file(
ldhses,
nodename_ptr, *bus_number_ptr, (pwr_mOpSys) os);
/* Find the volumes in this node */
sts
=
ldh_GetChild
(
ldhses
,
nodeobjid
,
&
volobjid
);
...
...
@@ -2011,10 +2023,15 @@ pwr_tStatus lfu_SaveDirectoryVolume(
char
str
[
2000
]
=
""
;
FILE
*
optfile
;
char
dir
[
80
];
pwr_tObjName
plcproc
;
if
(
os
==
pwr_mOpSys_CustomBuild
&&
custom_os
==
pwr_mOpSys__
)
break
;
sts
=
ldh_ObjidToName
(
ldhses
,
applobjid
,
ldh_eName_Object
,
appl_name
,
sizeof
(
appl_name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectBody
(
ldhses
,
applobjid
,
"RtBody"
,
(
void
**
)
&
bop
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -2098,13 +2115,23 @@ pwr_tStatus lfu_SaveDirectoryVolume(
else
sprintf
(
&
str
[
strlen
(
str
)],
"-lpwr_nodave_dummy "
);
if
(
strcmp
(
bop
->
PlcProcess
,
""
)
==
0
)
{
char
msg
[
200
];
sprintf
(
msg
,
"Error in BuildOptions object '%s', PlcProcess is missing
\n
"
,
appl_name
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
syntax_error
=
1
;
free
(
(
char
*
)
bop
);
}
else
{
strncpy
(
plcproc
,
bop
->
PlcProcess
,
sizeof
(
plcproc
));
free
(
(
char
*
)
bop
);
if
(
os
==
pwr_mOpSys_CustomBuild
)
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
cdh_OpSysToStr
(
(
pwr_mOpSys
)
custom_os
));
else
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
cdh_OpSysToStr
(
(
pwr_mOpSys
)
os
));
sprintf
(
fname
,
load_cNameOpt
,
dir
,
nodename_ptr
,
*
bus_number_ptr
);
sprintf
(
fname
,
load_cNameOpt
,
dir
,
nodename_ptr
,
*
bus_number_ptr
,
cdh_Low
(
plcproc
)
);
dcli_translate_filename
(
fname
,
fname
);
optfile
=
fopen
(
fname
,
"w"
);
if
(
optfile
==
0
)
{
...
...
@@ -2115,6 +2142,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
}
fprintf
(
optfile
,
"%s"
,
str
);
fclose
(
optfile
);
}
break
;
}
default:
;
...
...
@@ -2667,76 +2695,84 @@ pwr_tStatus lfu_ReadBootFile(
pwr_tVolumeId
**
vollist
,
pwr_tString40
**
volnamelist
,
int
*
volcount
,
char
*
plc_name
pwr_tString80
**
plclist
,
int
*
plccount
)
{
FILE
*
file
;
char
timstr
[
40
];
char
vol_name
[
40
];
char
vol_str
[
20
];
int
plc_found
;
pwr_tVolumeId
volid
;
pwr_tStatus
sts
;
char
fname
[
120
];
char
buff
[
1000
];
pwr_tString80
plcarray
[
50
];
dcli_translate_filename
(
fname
,
filename
);
file
=
fopen
(
fname
,
"r"
);
if
(
file
==
0
)
return
LFU__NOFILE
;
if
(
fgets
(
timstr
,
sizeof
(
timstr
),
file
)
==
NULL
)
{
if
(
fgets
(
timstr
,
sizeof
(
timstr
),
file
)
==
NULL
)
{
fclose
(
file
);
return
LFU__FILECRP
;
}
sts
=
time_AsciiToA
(
timstr
,
date
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
{
if
(
EVEN
(
sts
))
{
fclose
(
file
);
return
sts
;
}
if
(
utl_read_line
(
systemname
,
sizeof
(
pwr_tString80
),
file
,
NULL
)
==
0
)
{
if
(
utl_read_line
(
systemname
,
sizeof
(
pwr_tString80
),
file
,
NULL
)
==
0
)
{
fclose
(
file
);
return
LFU__FILECRP
;
}
if
(
utl_read_line
(
systemgroup
,
sizeof
(
pwr_tString80
),
file
,
NULL
)
==
0
)
{
if
(
utl_read_line
(
systemgroup
,
sizeof
(
pwr_tString80
),
file
,
NULL
)
==
0
)
{
fclose
(
file
);
return
LFU__FILECRP
;
}
if
(
utl_read_line
(
buff
,
sizeof
(
buff
),
file
,
NULL
)
==
0
)
{
fclose
(
file
);
return
LFU__FILECRP
;
}
if
(
plclist
)
{
if
(
buff
[
0
]
==
'-'
)
{
*
plccount
=
0
;
*
plclist
=
(
pwr_tString80
*
)
0
;
}
else
{
*
plccount
=
dcli_parse
(
buff
,
","
,
""
,
(
char
*
)
plcarray
,
sizeof
(
plcarray
)
/
sizeof
(
plcarray
[
0
]),
sizeof
(
plcarray
[
0
]),
0
);
*
plclist
=
(
pwr_tString80
*
)
calloc
(
*
plccount
,
sizeof
(
pwr_tString80
));
memcpy
(
*
plclist
,
plcarray
,
*
plccount
*
sizeof
(
pwr_tString80
));
}
}
if
(
vollist
)
{
*
volcount
=
0
;
*
vollist
=
(
pwr_tVolumeId
*
)
calloc
(
LFU_MAX_NODE_VOLUMES
,
sizeof
(
**
vollist
));
*
volnamelist
=
(
pwr_tString40
*
)
calloc
(
LFU_MAX_NODE_VOLUMES
,
sizeof
(
**
volnamelist
));
plc_found
=
0
;
while
(
fscanf
(
file
,
"%s %s"
,
vol_name
,
vol_str
)
==
2
)
{
sts
=
cdh_StringToVolumeId
(
vol_str
,
&
volid
);
if
(
EVEN
(
sts
))
{
fclose
(
file
);
return
sts
;
}
if
(
*
volcount
==
0
&&
volid
==
0
)
{
strcpy
(
plc_name
,
vol_name
);
plc_found
=
1
;
continue
;
}
*
(
*
vollist
+
*
volcount
)
=
volid
;
strcpy
(
*
(
*
volnamelist
+
*
volcount
),
vol_name
);
(
*
volcount
)
++
;
}
}
fclose
(
file
);
if
(
!
plc_found
)
strcpy
(
plc_name
,
""
);
return
LFU__SUCCESS
;
}
...
...
@@ -2961,7 +2997,8 @@ pwr_tStatus lfu_ParseDbmsServer( char *server, char *user, char *password,
return
LFU__SUCCESS
;
}
pwr_tStatus
lfu_check_appl_file
(
char
*
nodename
,
int
bus_number
)
pwr_tStatus
lfu_check_appl_file
(
ldh_tSesContext
ldhses
,
char
*
nodename
,
int
bus_number
)
{
pwr_tFileName
fname
;
pwr_tTime
t
;
...
...
@@ -2993,7 +3030,7 @@ pwr_tStatus lfu_check_appl_file( char *nodename, int bus_number)
"# System processes"
<<
endl
<<
"# System processes can be disabled by removing the #"
<<
endl
<<
"#pwr_neth, , noload, norun, , 5, debug,
\"\"
"
<<
endl
<<
"#pwr_plc, , noload, norun, , , debug,
\"\"
"
<<
endl
<<
"#pwr_plc
_plc
, , noload, norun, , , debug,
\"\"
"
<<
endl
<<
"#pwr_alim, , noload, norun, , 5, debug,
\"\"
"
<<
endl
<<
"#pwr_emon, , noload, norun, , 10, debug,
\"\"
"
<<
endl
<<
"#pwr_tmon, , noload, norun, , 5, debug,
\"\"
"
<<
endl
<<
...
...
@@ -3021,22 +3058,36 @@ pwr_tStatus lfu_check_appl_file( char *nodename, int bus_number)
return
LFU__SUCCESS
;
}
pwr_tStatus
lfu_check_opt_file
(
char
*
nodename
,
int
bus_number
,
pwr_mOpSys
opsys
)
pwr_tStatus
lfu_check_opt_file
(
ldh_tSesContext
ldhses
,
char
*
nodename
,
int
bus_number
,
pwr_mOpSys
opsys
)
{
pwr_tFileName
fname
;
pwr_tTime
t
;
char
dir
[
80
];
pwr_tFileName
dir
;
pwr_tObjName
name
;
int
size
;
pwr_tStatus
sts
;
pwr_tOid
oid
;
sprintf
(
dir
,
"$pwrp_root/%s/exe/"
,
cdh_OpSysToStr
(
opsys
));
sprintf
(
fname
,
load_cNameOpt
,
dir
,
nodename
,
bus_number
);
for
(
sts
=
ldh_GetClassList
(
ldhses
,
pwr_cClass_PlcProcess
,
&
oid
);
ODD
(
sts
);
sts
=
ldh_GetNextObject
(
ldhses
,
oid
,
&
oid
))
{
sts
=
ldh_ObjidToName
(
ldhses
,
oid
,
ldh_eName_Object
,
name
,
sizeof
(
name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sprintf
(
fname
,
load_cNameOpt
,
dir
,
nodename
,
bus_number
,
cdh_Low
(
name
));
dcli_translate_filename
(
fname
,
fname
);
if
(
ODD
(
dcli_file_time
(
fname
,
&
t
)))
return
LFU__SUCCESS
;
continue
;
strcat
(
fname
,
"_template"
);
if
(
ODD
(
dcli_file_time
(
fname
,
&
t
)))
return
LFU__SUCCESS
;
continue
;
// Create a template file
ofstream
fp
(
fname
);
...
...
@@ -3052,12 +3103,13 @@ pwr_tStatus lfu_check_opt_file( char *nodename, int bus_number, pwr_mOpSys opsys
case
pwr_mOpSys_X86_64_MACOS
:
case
pwr_mOpSys_CustomBuild
:
fp
<<
"$pwr_obj/rt_io_user.o -lpwr_rt -lpwr_usbio
_dummy"
<<
endl
;
"$pwr_obj/rt_io_user.o -lpwr_rt -lpwr_pnak_dummy -lpwr_cifx_dummy -lpwr_usb_dummy -lpwr_usbio_dummy -lpwr_nodave
_dummy"
<<
endl
;
break
;
default
:
;
}
fp
.
close
();
}
return
LFU__SUCCESS
;
}
...
...
wb/lib/wb/src/wb_lfu.h
View file @
d1b69caf
...
...
@@ -115,7 +115,8 @@ pwr_tStatus lfu_ReadBootFile( char *filename,
pwr_tVolumeId
**
vollist
,
pwr_tString40
**
volnamelist
,
int
*
volcount
,
char
*
plc_name
);
pwr_tString80
**
plclist
,
int
*
plccount
);
pwr_tStatus
lfu_ReadSysObjectFile
(
char
*
SystemName
,
char
*
SystemGroup
);
...
...
@@ -136,8 +137,9 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol
pwr_tStatus
lfu_ParseDbmsServer
(
char
*
server
,
char
*
user
,
char
*
passw
,
unsigned
int
*
port
,
char
*
host
);
pwr_tStatus
lfu_check_appl_file
(
char
*
nodename
,
int
bus_number
);
pwr_tStatus
lfu_check_opt_file
(
char
*
nodename
,
int
bus_number
,
pwr_mOpSys
opsys
);
pwr_tStatus
lfu_check_appl_file
(
ldh_tSesContext
ldhses
,
char
*
nodename
,
int
bus_number
);
pwr_tStatus
lfu_check_opt_file
(
ldh_tSesContext
ldhses
,
char
*
nodename
,
int
bus_number
,
pwr_mOpSys
opsys
);
#ifdef __cplusplus
}
...
...
wb/lib/wb/src/wb_pkg.cpp
View file @
d1b69caf
...
...
@@ -176,7 +176,8 @@ void wb_pkg::readConfig()
pwr_tVolumeId
*
vollist
;
pwr_tString40
*
volnamelist
;
int
volcount
;
char
plcname
[
80
];
pwr_tString80
*
plclist
;
int
plccount
;
char
systemname
[
80
];
char
systemgroup
[
80
];
pwr_tTime
date
;
...
...
@@ -199,12 +200,12 @@ void wb_pkg::readConfig()
// Read bootfile, get plc and volumes
sts
=
lfu_ReadBootFile
(
fname
,
&
date
,
systemname
,
systemgroup
,
&
vollist
,
&
volnamelist
,
&
volcount
,
plcname
);
systemgroup
,
&
vollist
,
&
volnamelist
,
&
volcount
,
&
plclist
,
&
plccount
);
if
(
EVEN
(
sts
))
throw
wb_error_str
(
"Bootfile is corrupt"
);
// Add plc
if
(
plcname
[
0
]
!=
0
)
{
for
(
int
j
=
0
;
j
<
plccount
;
j
++
)
{
pwr_tFileName
dir
;
if
(
n
.
opsys
()
==
pwr_mOpSys_CustomBuild
&&
...
...
@@ -212,7 +213,7 @@ void wb_pkg::readConfig()
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
n
.
customPlatform
());
else
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
cdh_OpSysToStr
(
n
.
opsys
()));
sprintf
(
fname
,
"%s%s"
,
dir
,
plc
name
);
sprintf
(
fname
,
"%s%s"
,
dir
,
plc
list
[
j
]);
sprintf
(
dir
,
"$pwrp_exe/"
);
pkg_pattern
pplc
(
fname
,
dir
,
'W'
);
n
.
push_back
(
pplc
);
...
...
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