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
c06174f7
Commit
c06174f7
authored
Aug 23, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc, serveral processes, handling of error log and process status (refs #96)
parent
a27a2074
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
14114 additions
and
308 deletions
+14114
-308
src/exp/inc/src/pwr_class.h
src/exp/inc/src/pwr_class.h
+5
-5
src/exp/rt/src/rt_plc_process.c
src/exp/rt/src/rt_plc_process.c
+61
-45
src/lib/rt/src/rt_c_node.c
src/lib/rt/src/rt_c_node.c
+22
-1
src/lib/rt/src/rt_errh.c
src/lib/rt/src/rt_errh.c
+11
-0
src/lib/rt/src/rt_errh.h
src/lib/rt/src/rt_errh.h
+43
-20
src/lib/rt/src/rt_plc.h
src/lib/rt/src/rt_plc.h
+2
-0
src/wbl/pwrs/src/pwrs_c_node.wb_load
src/wbl/pwrs/src/pwrs_c_node.wb_load
+5
-5
xtt/exp/ge/src/pwr_c_node.pwg
xtt/exp/ge/src/pwr_c_node.pwg
+232
-232
xtt/exp/ge/src/pwr_c_node_plc.pwg
xtt/exp/ge/src/pwr_c_node_plc.pwg
+13733
-0
No files found.
src/exp/inc/src/pwr_class.h
View file @
c06174f7
...
...
@@ -1072,11 +1072,11 @@ struct pwr_s_Node {
pwr_tDeltaTime
RestartStallTime
pwr_dAlignLW
;
pwr_tTime
SystemTime
pwr_dAlignLW
;
pwr_tNetStatus
SystemStatus
pwr_dAlignW
;
pwr_tStatus
ProcStatus
[
6
0
]
pwr_dAlignW
;
pwr_tStatus
ProcMsgSeverity
[
6
0
]
pwr_dAlignW
;
pwr_tString80
ProcMessage
[
6
0
]
pwr_dAlignW
;
pwr_tOid
ProcObject
[
6
0
]
pwr_dAlignW
;
pwr_tTime
ProcTimeStamp
[
6
0
]
pwr_dAlignLW
;
pwr_tStatus
ProcStatus
[
8
0
]
pwr_dAlignW
;
pwr_tStatus
ProcMsgSeverity
[
8
0
]
pwr_dAlignW
;
pwr_tString80
ProcMessage
[
8
0
]
pwr_dAlignW
;
pwr_tOid
ProcObject
[
8
0
]
pwr_dAlignW
;
pwr_tTime
ProcTimeStamp
[
8
0
]
pwr_dAlignLW
;
pwr_tBoolean
EmergBreakTrue
pwr_dAlignW
;
pwr_tUInt32
EmergBreakSelect
pwr_dAlignW
;
};
...
...
src/exp/rt/src/rt_plc_process.c
View file @
c06174f7
...
...
@@ -178,7 +178,12 @@ int main (
i = 1/0;
printf("%d\n", i);
*/
pp
=
init_process
();
pp
=
init_process
(
argv
[
0
]);
if
(
!
pp
)
{
errh_Fatal
(
"Plc process terminated"
);
errh_SetStatus
(
PWR__SRVTERM
);
exit
(
sts
);
}
qcom_WaitAnd
(
&
sts
,
&
pp
->
eventQ
,
&
qcom_cQini
,
ini_mEvent_newPlcInit
,
qcom_cTmoEternal
);
...
...
@@ -255,10 +260,18 @@ int main (
}
static
plc_sProcess
*
init_process
()
init_process
(
char
*
name
)
{
plc_sProcess
*
pp
;
pwr_tStatus
sts
=
PLC__SUCCESS
;
pwr_tObjid
pp_oid
;
int
found
;
char
busidstr
[
10
];
char
pp_name
[
80
];
pwr_tObjName
oname
;
int
busid
;
char
*
s
;
int
idx
;
#if 0
thread_SetPrio(NULL, 15);
...
...
@@ -280,6 +293,50 @@ init_process ()
exit
(
sts
);
}
/* Get PlcProcess object */
busid
=
qcom_MyBus
(
&
sts
);
if
(
EVEN
(
sts
))
return
0
;
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
,
""
);
}
idx
=
0
;
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
0
;
if
(
cdh_NoCaseStrcmp
(
pp_name
,
oname
)
==
0
)
{
found
=
1
;
break
;
}
idx
++
;
}
if
(
!
found
)
{
errh_Error
(
"PlcProcess object not found, %s"
,
pp_name
);
return
0
;
}
pp
->
index
=
idx
;
pp
->
oid
=
pp_oid
;
if
(
errh_eAnix_plc1
+
pp
->
index
<
errh_eAnix__
)
errh_SetAnix
(
errh_eAnix_plc1
+
pp
->
index
);
errh_SetName
(
pp_name
);
sts
=
gdh_ObjidToPointer
(
pp_oid
,
(
void
*
)
&
pp
->
PlcProcess
);
if
(
EVEN
(
sts
))
return
0
;
#if defined OS_VMS
qdb
->
thread_lock
.
isThreaded
=
1
;
qdb
->
thread_lock
.
cond_signal
=
thread_CondSignal
;
...
...
@@ -311,19 +368,12 @@ init_plc (
{
pwr_tStatus
sts
=
PLC__SUCCESS
;
pwr_tObjid
oid
;
pwr_tObjid
pp_oid
;
pwr_tObjid
io_oid
;
pwr_tObjid
thread_oid
;
int
sec
;
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
))
{
...
...
@@ -334,40 +384,6 @@ init_plc (
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
pp
->
Node
);
if
(
EVEN
(
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
;
...
...
@@ -387,7 +403,7 @@ init_plc (
#endif
i
=
0
;
sts
=
gdh_GetChild
(
pp
_
oid
,
&
thread_oid
);
sts
=
gdh_GetChild
(
pp
->
oid
,
&
thread_oid
);
while
(
ODD
(
sts
))
{
sts
=
gdh_GetObjectClass
(
thread_oid
,
&
cid
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -400,7 +416,7 @@ init_plc (
for
(
;
i
>
sizeof
(
pp
->
PlcProcess
->
PlcThreadObjects
)
/
sizeof
(
pp
->
PlcProcess
->
PlcThreadObjects
[
0
]);
i
++
)
pp
->
PlcProcess
->
PlcThreadObjects
[
i
]
=
pwr_cNObjid
;
aproc_RegisterObject
(
pp
_
oid
);
aproc_RegisterObject
(
pp
->
oid
);
sts
=
gdh_GetClassList
(
pwr_cClass_IOHandler
,
&
io_oid
);
if
(
EVEN
(
sts
))
{
...
...
src/lib/rt/src/rt_c_node.c
View file @
c06174f7
...
...
@@ -63,12 +63,15 @@ pwrs_Node_Exec (
pwr_tDeltaTime
diff
;
errh_eSeverity
severity
;
errh_eSeverity
system_severity
;
errh_eSeverity
plc_severity
;
int
new_idx
=
-
1
;
static
int
supervise
[
6
0
]
=
{
static
int
supervise
[
8
0
]
=
{
0
,
0
,
0
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
static
int
reboot_done
=
0
;
...
...
@@ -107,7 +110,25 @@ pwrs_Node_Exec (
else
reboot_done
=
0
;
/* Calculate plc status */
new_idx
=
-
1
;
plc_severity
=
errh_Severity
(
np
->
ProcStatus
[
errh_eAnix_plc
-
1
]);
for
(
i
=
errh_eAnix_plc1
-
1
;
i
<
errh_eAnix_plc1
-
1
+
errh_cAnix_PlcSize
;
i
++
)
{
severity
=
errh_Severity
(
np
->
ProcStatus
[
i
]);
if
(
np
->
ProcStatus
[
i
]
!=
0
&&
EVEN
(
np
->
ProcStatus
[
i
]))
{
if
(
severity
>=
plc_severity
)
{
new_idx
=
i
;
plc_severity
=
severity
;
}
}
}
if
(
new_idx
!=
-
1
)
np
->
ProcStatus
[
errh_eAnix_plc
-
1
]
=
np
->
ProcStatus
[
new_idx
];
else
if
(
EVEN
(
np
->
ProcStatus
[
errh_eAnix_plc
-
1
]))
np
->
ProcStatus
[
errh_eAnix_plc
-
1
]
=
PWR__SRUN
;
/* Calculate system status and check timestamp */
new_idx
=
-
1
;
system_severity
=
errh_Severity
(
np
->
SystemStatus
);
time_GetTime
(
&
current_time
);
for
(
i
=
0
;
i
<
sizeof
(
np
->
ProcStatus
)
/
sizeof
(
np
->
ProcStatus
[
0
]);
i
++
)
{
...
...
src/lib/rt/src/rt_errh.c
View file @
c06174f7
...
...
@@ -248,6 +248,17 @@ errh_SetAnix(
errh_anix
=
anix
;
}
/**
* @brief Set application name for the process.
*/
void
errh_SetName
(
char
*
name
)
{
set_name
(
name
);
}
/* Check if a given messagenumber exists,
return string representation if valid. */
...
...
src/lib/rt/src/rt_errh.h
View file @
c06174f7
...
...
@@ -93,6 +93,7 @@ typedef enum {
#define errh_cAnix_SrvSize 40
#define errh_cAnix_PlcSize 20
/**
* Application index
...
...
@@ -122,26 +123,47 @@ typedef enum {
errh_eAnix_post
=
21
,
errh_eAnix_report
=
22
,
errh_eAnix_sevhistmon
=
23
,
errh_eAnix_appl1
=
41
,
errh_eAnix_appl2
=
42
,
errh_eAnix_appl3
=
43
,
errh_eAnix_appl4
=
44
,
errh_eAnix_appl5
=
45
,
errh_eAnix_appl6
=
46
,
errh_eAnix_appl7
=
47
,
errh_eAnix_appl8
=
48
,
errh_eAnix_appl9
=
49
,
errh_eAnix_appl10
=
50
,
errh_eAnix_appl11
=
51
,
errh_eAnix_appl12
=
52
,
errh_eAnix_appl13
=
53
,
errh_eAnix_appl14
=
54
,
errh_eAnix_appl15
=
55
,
errh_eAnix_appl16
=
56
,
errh_eAnix_appl17
=
57
,
errh_eAnix_appl18
=
58
,
errh_eAnix_appl19
=
59
,
errh_eAnix_appl20
=
50
errh_eAnix_plc1
=
41
,
errh_eAnix_plc2
=
42
,
errh_eAnix_plc3
=
43
,
errh_eAnix_plc4
=
44
,
errh_eAnix_plc5
=
45
,
errh_eAnix_plc6
=
46
,
errh_eAnix_plc7
=
47
,
errh_eAnix_plc8
=
48
,
errh_eAnix_plc9
=
49
,
errh_eAnix_plc10
=
50
,
errh_eAnix_plc11
=
51
,
errh_eAnix_plc12
=
52
,
errh_eAnix_plc13
=
53
,
errh_eAnix_plc14
=
54
,
errh_eAnix_plc15
=
55
,
errh_eAnix_plc16
=
56
,
errh_eAnix_plc17
=
57
,
errh_eAnix_plc18
=
58
,
errh_eAnix_plc19
=
59
,
errh_eAnix_plc20
=
60
,
errh_eAnix_appl1
=
61
,
errh_eAnix_appl2
=
62
,
errh_eAnix_appl3
=
63
,
errh_eAnix_appl4
=
64
,
errh_eAnix_appl5
=
65
,
errh_eAnix_appl6
=
66
,
errh_eAnix_appl7
=
67
,
errh_eAnix_appl8
=
68
,
errh_eAnix_appl9
=
69
,
errh_eAnix_appl10
=
70
,
errh_eAnix_appl11
=
71
,
errh_eAnix_appl12
=
72
,
errh_eAnix_appl13
=
73
,
errh_eAnix_appl14
=
74
,
errh_eAnix_appl15
=
75
,
errh_eAnix_appl16
=
76
,
errh_eAnix_appl17
=
77
,
errh_eAnix_appl18
=
78
,
errh_eAnix_appl19
=
79
,
errh_eAnix_appl20
=
80
,
errh_eAnix__
=
81
}
errh_eAnix
;
/**
...
...
@@ -193,6 +215,7 @@ void errh_CErrLog (pwr_tStatus sts, ...);
char
*
errh_Message
(
char
*
string
,
char
severity
,
char
*
msg
,
...);
errh_eAnix
errh_Anix
();
void
errh_SetAnix
(
errh_eAnix
anix
);
void
errh_SetName
(
char
*
name
);
errh_eSeverity
errh_Severity
(
pwr_tStatus
);
/** @} */
...
...
src/lib/rt/src/rt_plc.h
View file @
c06174f7
...
...
@@ -189,6 +189,8 @@ struct plc_sProcess {
pwr_sClass_PlcProcess
*
PlcProcess
;
pwr_tFullName
nodeName
;
qcom_sQid
eventQ
;
pwr_tOid
oid
;
int
index
;
thread_sMutex
io_copy_mutex
;
plc_sArea
base
;
};
...
...
src/wbl/pwrs/src/pwrs_c_node.wb_load
View file @
c06174f7
...
...
@@ -204,7 +204,7 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
6
0
Attr Elements =
8
0
EndBody
EndObject
!/**
...
...
@@ -216,7 +216,7 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
6
0
Attr Elements =
8
0
EndBody
EndObject
!/**
...
...
@@ -228,7 +228,7 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
6
0
Attr Elements =
8
0
EndBody
EndObject
!/**
...
...
@@ -240,7 +240,7 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
6
0
Attr Elements =
8
0
EndBody
EndObject
!/**
...
...
@@ -252,7 +252,7 @@ SObject pwrs:Class
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
6
0
Attr Elements =
8
0
EndBody
EndObject
!/**
...
...
xtt/exp/ge/src/pwr_c_node.pwg
View file @
c06174f7
This diff is collapsed.
Click to expand it.
xtt/exp/ge/src/pwr_c_node_plc.pwg
0 → 100644
View file @
c06174f7
This diff is collapsed.
Click to expand it.
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