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
054320a3
Commit
054320a3
authored
9 years ago
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IO, Powerlink servers didn't handle runtime terminate event
parent
2c0cd6d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
17 deletions
+108
-17
otherio/exe/rt_powerlink/src/rt_powerlink.c
otherio/exe/rt_powerlink/src/rt_powerlink.c
+54
-8
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
+54
-9
No files found.
otherio/exe/rt_powerlink/src/rt_powerlink.c
View file @
054320a3
...
...
@@ -41,7 +41,10 @@
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_errh.h"
#include "rt_qcom.h"
#include "rt_aproc.h"
#include "rt_ini_event.h"
#include "rt_qcom_msg.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
...
...
@@ -83,8 +86,12 @@ int main (int argc, char **argv)
pwr_sClass_EplHandler
*
plhp
;
pwr_tOid
oid
;
struct
timespec
tim1
,
tim2
;
int
tmo
;
char
mp
[
2000
];
qcom_sGet
get
;
qcom_sQattr
qAttr
;
qcom_sQid
qini
;
qcom_sQid
qid
=
qcom_cNQid
;
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"-m"
)
==
0
)
{
...
...
@@ -101,6 +108,24 @@ int main (int argc, char **argv)
errh_Init
(
"pwr_powerlink"
,
errh_eAnix_powerlink
);
errh_SetStatus
(
PWR__SRVSTARTUP
);
if
(
!
qcom_Init
(
&
sts
,
0
,
"pwr_powerlink"
))
{
errh_Fatal
(
"qcom_Init, %m"
,
sts
);
exit
(
sts
);
}
qAttr
.
type
=
qcom_eQtype_private
;
qAttr
.
quota
=
100
;
if
(
!
qcom_CreateQ
(
&
sts
,
&
qid
,
&
qAttr
,
"events"
))
{
errh_Fatal
(
"qcom_CreateQ, %m"
,
sts
);
exit
(
sts
);
}
qini
=
qcom_cQini
;
if
(
!
qcom_Bind
(
&
sts
,
&
qid
,
&
qini
))
{
errh_Fatal
(
"qcom_Bind(Qini), %m"
,
sts
);
exit
(
-
1
);
}
// Make connection to realtime database
sts
=
gdh_Init
(
"rt_powerlink"
);
if
(
EVEN
(
sts
))
{
...
...
@@ -132,8 +157,7 @@ int main (int argc, char **argv)
exit
(
sts
);
}
tim1
.
tv_sec
=
0
;
tim1
.
tv_nsec
=
(
plhp
->
CycleTime
)
*
1000000000L
;
tmo
=
(
plhp
->
CycleTime
)
*
1000
;
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
errh_SetStatus
(
PWR__SRUN
);
...
...
@@ -142,11 +166,33 @@ int main (int argc, char **argv)
// Call IoAgentRead() IoAgentWrite() IoCardRead() IoCardWrite()
// IoModuleRead() IoModuleWrite() forever
for
(;;)
{
get
.
maxSize
=
sizeof
(
mp
);
get
.
data
=
mp
;
qcom_Get
(
&
sts
,
&
qid
,
&
get
,
tmo
);
if
(
sts
==
QCOM__TMO
||
sts
==
QCOM__QEMPTY
)
{
sts
=
io_read
(
io_ctx
);
sts
=
io_write
(
io_ctx
);
nanosleep
(
&
tim1
,
&
tim2
);
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
sts
=
io_read
(
io_ctx
);
sts
=
io_write
(
io_ctx
);
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
}
else
{
ini_mEvent
new_event
;
qcom_sEvent
*
ep
=
(
qcom_sEvent
*
)
get
.
data
;
new_event
.
m
=
ep
->
mask
;
if
(
new_event
.
b
.
oldPlcStop
)
{
// TODO
}
else
if
(
new_event
.
b
.
swapDone
)
{
// TODO
}
else
if
(
new_event
.
b
.
terminate
)
{
// io_close(io_ctx);
exit
(
0
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
View file @
054320a3
...
...
@@ -42,7 +42,10 @@
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_errh.h"
#include "rt_qcom.h"
#include "rt_aproc.h"
#include "rt_ini_event.h"
#include "rt_qcom_msg.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
...
...
@@ -90,8 +93,12 @@ int main (int argc, char **argv)
pwr_sClass_EplHandler
*
plhp
;
pwr_tOid
oid
;
struct
timespec
tim1
,
tim2
;
int
tmo
;
char
mp
[
2000
];
qcom_sGet
get
;
qcom_sQattr
qAttr
;
qcom_sQid
qini
;
qcom_sQid
qid
=
qcom_cNQid
;
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"-m"
)
==
0
)
{
...
...
@@ -108,6 +115,24 @@ int main (int argc, char **argv)
errh_Init
(
"pwr_powerlink"
,
errh_eAnix_powerlink
);
errh_SetStatus
(
PWR__SRVSTARTUP
);
if
(
!
qcom_Init
(
&
sts
,
0
,
"pwr_powerlink"
))
{
errh_Fatal
(
"qcom_Init, %m"
,
sts
);
exit
(
sts
);
}
qAttr
.
type
=
qcom_eQtype_private
;
qAttr
.
quota
=
100
;
if
(
!
qcom_CreateQ
(
&
sts
,
&
qid
,
&
qAttr
,
"events"
))
{
errh_Fatal
(
"qcom_CreateQ, %m"
,
sts
);
exit
(
sts
);
}
qini
=
qcom_cQini
;
if
(
!
qcom_Bind
(
&
sts
,
&
qid
,
&
qini
))
{
errh_Fatal
(
"qcom_Bind(Qini), %m"
,
sts
);
exit
(
-
1
);
}
// Make connection to realtime database
sts
=
gdh_Init
(
"rt_powerlink"
);
if
(
EVEN
(
sts
))
{
...
...
@@ -133,8 +158,7 @@ int main (int argc, char **argv)
exit
(
sts
);
}
tim1
.
tv_sec
=
0
;
tim1
.
tv_nsec
=
(
plhp
->
CycleTime
)
*
1000000000L
;
tmo
=
(
plhp
->
CycleTime
)
*
1000
;
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
errh_SetStatus
(
PWR__SRUN
);
...
...
@@ -143,11 +167,32 @@ int main (int argc, char **argv)
// Call IoAgentRead() IoAgentWrite() IoCardRead() IoCardWrite()
// IoModuleRead() IoModuleWrite() forever
for
(;;)
{
sts
=
io_read
(
io_ctx
);
sts
=
io_write
(
io_ctx
);
nanosleep
(
&
tim1
,
&
tim2
);
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
get
.
maxSize
=
sizeof
(
mp
);
get
.
data
=
mp
;
qcom_Get
(
&
sts
,
&
qid
,
&
get
,
tmo
);
if
(
sts
==
QCOM__TMO
||
sts
==
QCOM__QEMPTY
)
{
sts
=
io_read
(
io_ctx
);
sts
=
io_write
(
io_ctx
);
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
}
else
{
ini_mEvent
new_event
;
qcom_sEvent
*
ep
=
(
qcom_sEvent
*
)
get
.
data
;
new_event
.
m
=
ep
->
mask
;
if
(
new_event
.
b
.
oldPlcStop
)
{
// TODO
}
else
if
(
new_event
.
b
.
swapDone
)
{
// TODO
}
else
if
(
new_event
.
b
.
terminate
)
{
// io_close(io_ctx);
exit
(
0
);
}
}
}
}
...
...
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