Commit d823d79f authored by Claes Sjofors's avatar Claes Sjofors

Plc core program added

parent 23fbab40
......@@ -2135,6 +2135,18 @@ ini_ProcTable (
pp->proc.flags.b.system = 1;
#endif
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);
......@@ -2189,6 +2201,7 @@ ini_ProcTable (
cp->plc_sigmask |= ini_mEvent_plc1 << plc_idx;
plc_idx++;
}
}
for (
*sts = gdh_GetClassList(pwr_eClass_Appl, &oid);
......
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
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
/*
* 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
};
......@@ -294,7 +294,11 @@ init_process ( char *name)
exit(sts);
}
if ( strstr( name, "rt_plc_core") != 0)
pp->is_core = 1;
/* Get PlcProcess object */
if ( !pp->is_core) {
busid = qcom_MyBus( &sts);
if ( EVEN(sts)) return 0;
......@@ -323,6 +327,14 @@ init_process ( char *name)
}
idx++;
}
}
else {
sts = gdh_GetClassList(pwr_cClass_PlcProcess, &pp_oid);
if ( ODD(sts)) {
found = 1;
idx = 0;
}
}
if (!found) {
errh_Error("PlcProcess object not found, %s", pp_name);
return 0;
......@@ -705,7 +717,16 @@ create_thread (
pwr_tStatus sts;
long int phase;
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;
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment