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
d823d79f
Commit
d823d79f
authored
Jul 09, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc core program added
parent
23fbab40
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
67 deletions
+179
-67
src/exe/rt_ini/src/ini.c
src/exe/rt_ini/src/ini.c
+57
-44
src/exe/rt_plc_core/src/os_templ/hw_templ/makefile
src/exe/rt_plc_core/src/os_templ/hw_templ/makefile
+15
-0
src/exe/rt_plc_core/src/os_templ/link_rule.mk
src/exe/rt_plc_core/src/os_templ/link_rule.mk
+10
-0
src/exe/rt_plc_core/src/rt_plc_core.c
src/exe/rt_plc_core/src/rt_plc_core.c
+52
-0
src/exp/rt/src/rt_plc_process.c
src/exp/rt/src/rt_plc_process.c
+44
-23
src/lib/rt/src/rt_plc.h
src/lib/rt/src/rt_plc.h
+1
-0
No files found.
src/exe/rt_ini/src/ini.c
View file @
d823d79f
...
...
@@ -2135,59 +2135,72 @@ ini_ProcTable (
pp
->
proc
.
flags
.
b
.
system
=
1
;
#endif
plc_idx
=
0
;
cp
->
plc_sigmask
=
0
;
for
(
lsts
=
gdh_GetClassList
(
pwr_cClass_PlcProcess
,
&
oid
);
ODD
(
lsts
);
lsts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
pwr_sClass_PlcProcess
*
plc
;
pwr_tObjName
ppname
;
pwr_tObjName
name
;
char
p_name
[
80
];
int
i
;
char
busidstr
[
10
];
int
found
;
char
idstr
[
80
];
if
(
!
cp
->
plcfile_cnt
)
{
plc_idx
=
0
;
pp
=
ini_ProcInsert
(
sts
,
cp
,
"pwr_plc"
,
"pwr_plc_%d"
,
0
,
1
,
"rt_plc_core"
,
cPrio_plc_init
,
0
,
pwr_cClass_PlcProcess
,
""
,
0
);
pp
->
flags
.
b
.
plc
=
1
;
cp
->
plc
=
pp
;
pp
->
proc
.
flags
.
b
.
user
=
1
;
pp
->
proc
.
flags
.
b
.
k_mode
=
1
;
pp
->
proc
.
k_size
=
30
;
cp
->
plc_sigmask
|=
ini_mEvent_plc1
<<
plc_idx
;
plc_idx
++
;
}
else
{
plc_idx
=
0
;
cp
->
plc_sigmask
=
0
;
for
(
lsts
=
gdh_GetClassList
(
pwr_cClass_PlcProcess
,
&
oid
);
ODD
(
lsts
);
lsts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
pwr_sClass_PlcProcess
*
plc
;
pwr_tObjName
ppname
;
pwr_tObjName
name
;
char
p_name
[
80
];
int
i
;
char
busidstr
[
10
];
int
found
;
char
idstr
[
80
];
*
sts
=
gdh_ObjidToName
(
oid
,
ppname
,
sizeof
(
ppname
),
cdh_mName_object
);
if
(
EVEN
(
*
sts
))
break
;
*
sts
=
gdh_ObjidToName
(
oid
,
ppname
,
sizeof
(
ppname
),
cdh_mName_object
);
if
(
EVEN
(
*
sts
))
break
;
*
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
plc
);
if
(
EVEN
(
*
sts
))
break
;
*
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
&
plc
);
if
(
EVEN
(
*
sts
))
break
;
sprintf
(
busidstr
,
"_%04d_"
,
cp
->
busid
);
sprintf
(
busidstr
,
"_%04d_"
,
cp
->
busid
);
found
=
0
;
for
(
i
=
0
;
i
<
cp
->
plcfile_cnt
;
i
++
)
{
s
=
strstr
(
cp
->
plcfile
[
i
].
name
,
busidstr
);
if
(
s
)
{
strncpy
(
name
,
s
+
6
,
sizeof
(
name
));
if
(
(
s
=
strchr
(
name
,
'.'
)))
*
s
=
0
;
found
=
0
;
for
(
i
=
0
;
i
<
cp
->
plcfile_cnt
;
i
++
)
{
s
=
strstr
(
cp
->
plcfile
[
i
].
name
,
busidstr
);
if
(
s
)
{
strncpy
(
name
,
s
+
6
,
sizeof
(
name
));
if
(
(
s
=
strchr
(
name
,
'.'
)))
*
s
=
0
;
if
(
cdh_NoCaseStrcmp
(
ppname
,
name
)
==
0
)
{
found
=
1
;
break
;
}
if
(
cdh_NoCaseStrcmp
(
ppname
,
name
)
==
0
)
{
found
=
1
;
break
;
}
}
}
if
(
!
found
)
{
plc_idx
++
;
continue
;
}
}
if
(
!
found
)
{
// cp->PlcProcess = plc;
snprintf
(
idstr
,
sizeof
(
idstr
),
"pwr_plc_%s"
,
name
);
snprintf
(
p_name
,
sizeof
(
p_name
),
"pwr_plc_%s_%%d_%d"
,
name
,
plc
->
ChgCount
++
%
10
);
pp
=
ini_ProcInsert
(
sts
,
cp
,
idstr
,
p_name
,
1
,
1
,
cp
->
plcfile
[
i
].
name
,
cPrio_plc_init
,
plc
->
StartWithDebug
,
0
,
""
,
plc
);
pp
->
flags
.
b
.
plc
=
1
;
cp
->
plc
=
pp
;
pp
->
proc
.
flags
.
b
.
user
=
1
;
pp
->
proc
.
flags
.
b
.
k_mode
=
1
;
pp
->
proc
.
k_size
=
30
;
cp
->
plc_sigmask
|=
ini_mEvent_plc1
<<
plc_idx
;
plc_idx
++
;
continue
;
}
// cp->PlcProcess = plc;
snprintf
(
idstr
,
sizeof
(
idstr
),
"pwr_plc_%s"
,
name
);
snprintf
(
p_name
,
sizeof
(
p_name
),
"pwr_plc_%s_%%d_%d"
,
name
,
plc
->
ChgCount
++
%
10
);
pp
=
ini_ProcInsert
(
sts
,
cp
,
idstr
,
p_name
,
1
,
1
,
cp
->
plcfile
[
i
].
name
,
cPrio_plc_init
,
plc
->
StartWithDebug
,
0
,
""
,
plc
);
pp
->
flags
.
b
.
plc
=
1
;
cp
->
plc
=
pp
;
pp
->
proc
.
flags
.
b
.
user
=
1
;
pp
->
proc
.
flags
.
b
.
k_mode
=
1
;
pp
->
proc
.
k_size
=
30
;
cp
->
plc_sigmask
|=
ini_mEvent_plc1
<<
plc_idx
;
plc_idx
++
;
}
for
(
...
...
src/exe/rt_plc_core/src/os_templ/hw_templ/makefile
0 → 100644
View file @
d823d79f
include
$(pwre_dir_symbols)
-include
$(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
src/exe/rt_plc_core/src/os_templ/link_rule.mk
0 → 100644
View file @
d823d79f
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ldxx)
$(linkflags)
$(domap)
-o
$(export_exe)
\
$(pwr_obj)
/rt_plc_process.o
\
$(export_obj)
$(objects)
$(rt_msg_objs)
\
$(pwr_obj)
/rt_io_user.o
\
$(pwre_conf_libdir)
$(pwre_conf_libpwrrt)
$(pwre_conf_lib)
endif
src/exe/rt_plc_core/src/rt_plc_core.c
0 → 100644
View file @
d823d79f
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 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.
*/
/* rt_plc_template.c --
A template plc program used when no PlcPgm is configured. */
#include "rt_plc.h"
#include "rt_plc_proc.h"
void
plc_templ_init
(
int
DirectLink
,
plc_sThread
*
tp
)
{}
void
plc_templ_exec
(
int
DirectLink
,
plc_sThread
*
tp
)
{}
struct
plc_proctbl
plc_templ
=
{{
0
,
0
},
plc_templ_init
,
plc_templ_exec
};
struct
plc_proctbl
*
plc_proctbllist
[]
=
{
&
plc_templ
,
(
void
*
)
0
};
src/exp/rt/src/rt_plc_process.c
View file @
d823d79f
...
...
@@ -294,34 +294,46 @@ init_process ( char *name)
exit
(
sts
);
}
if
(
strstr
(
name
,
"rt_plc_core"
)
!=
0
)
pp
->
is_core
=
1
;
/* Get PlcProcess object */
busid
=
qcom_MyBus
(
&
sts
);
if
(
EVEN
(
sts
))
return
0
;
if
(
!
pp
->
is_core
)
{
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
,
""
);
}
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
;
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
++
;
}
}
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
)
{
sts
=
gdh_GetClassList
(
pwr_cClass_PlcProcess
,
&
pp_oid
);
if
(
ODD
(
sts
))
{
found
=
1
;
break
;
idx
=
0
;
}
idx
++
;
}
if
(
!
found
)
{
errh_Error
(
"PlcProcess object not found, %s"
,
pp_name
);
...
...
@@ -705,7 +717,16 @@ create_thread (
pwr_tStatus
sts
;
long
int
phase
;
tp
->
aref
.
Objid
=
ptp
->
thread
;
if
(
!
pp
->
is_core
)
tp
->
aref
.
Objid
=
ptp
->
thread
;
else
{
sts
=
gdh_GetClassList
(
pwr_cClass_PlcThread
,
&
tp
->
aref
.
Objid
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"Can't find PlcThread object, %m"
,
sts
);
return
;
}
ptp
->
thread
=
tp
->
aref
.
Objid
;
}
tp
->
init
=
ptp
->
init
;
tp
->
exec
=
ptp
->
exec
;
tp
->
first_scan
=
1
;
...
...
src/lib/rt/src/rt_plc.h
View file @
d823d79f
...
...
@@ -200,6 +200,7 @@ struct plc_sProcess {
unsigned
int
sigmask
;
thread_sMutex
io_copy_mutex
;
plc_sArea
base
;
int
is_core
;
};
#if defined OS_LYNX || defined OS_LINUX
...
...
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