Commit e44b37b0 authored by Christoffer Ackelman's avatar Christoffer Ackelman

WARNING! This almost certainly broke the build on some OS/HW.

Please do not simply revert everything if it doesn't compile.
Fix the problem with #ifdef OS_LINUX #endif clauses instead.

I merged all "OS-specific" buildscripts and makefiles. Now you only have
to modify 1 file instead of 6 (1 per OS) when you change the build system.

The difference between Unix-derived operating systems is really
not big enough to jusify 6 versions of every script and makefile.
We don't need 71500 lines of "copy-paste" code to handle those small differences.
parent 2ec0a40f
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.gif $(co_source)
vpath %.gif $(hw_source):$(os_source):$(co_source)
source_dirs := $(hw_source) $(os_source) $(co_source)
source_dirs := $(co_source)
gif_sources := $(sort \
$(foreach file, \
......@@ -50,7 +43,7 @@ $(doc_dir)/en_us/orm/%.gif : %.gif
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
@ $(cp) $(cpflags) $(source) $(doc_dir)/help
$(doc_dir)/en_us/orm/%.html : ../../%.html
$(doc_dir)/en_us/orm/%.html : %.html
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
......@@ -82,7 +75,3 @@ $(clean_gif) : clean_%.gif : %.gif
$(clean_html) : clean_%.html : %.html
@ $(rm) $(rmflags) $(doc_dir)/orm/$*.html
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.gif $(co_source)
vpath %.png $(co_source)
vpath %.gif $(hw_source):$(os_source):$(co_source)
vpath %.png $(hw_source):$(os_source):$(co_source)
source_dirs := $(hw_source) $(os_source) $(co_source)
source_dirs := $(co_source)
gif_sources := $(sort \
$(foreach file, \
......@@ -68,7 +61,7 @@ $(doc_dir)/en_us/orm/%.png : %.png
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
@ $(cp) $(cpflags) $(source) $(doc_dir)/help
$(doc_dir)/en_us/orm/%.html : ../../%.html
$(doc_dir)/en_us/orm/%.html : %.html
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
......@@ -103,7 +96,3 @@ $(clean_png) : clean_%.png : %.png
$(clean_html) : clean_%.html : %.html
@ $(rm) $(rmflags) $(doc_dir)/orm/$*.html
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
copy : $(doc_dir)/sv_se/orm/rt_plc_bcomp_c.html \
$(doc_dir)/en_us/orm/rt_plc_bcomp_c.html
$(doc_dir)/sv_se/orm/rt_plc_bcomp_c.html : ../../rt_plc_bcomp.c
@ echo "Generating html files for rt_plc_bcomp sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/rt_plc_bcomp_c.html : ../../rt_plc_bcomp.c
@ echo "Generating html files for rt_plc_bcomp en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
exe : $(doc_dir)/sv_se/orm/pwr_basecomponentclasses_h.html \
$(doc_dir)/en_us/orm/pwr_basecomponentclasses_h.html \
$(doc_dir)/sv_se/orm/pwr_basecomponentclasses_hpp.html \
$(doc_dir)/en_us/orm/pwr_basecomponentclasses_hpp.html
$(doc_dir)/sv_se/orm/pwr_basecomponentclasses_h.html : $(inc_dir)/pwr_basecomponentclasses.h
@ echo "Generating html files for struct sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/pwr_basecomponentclasses_h.html : $(inc_dir)/pwr_basecomponentclasses.h
@ echo "Generating html files for struct en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
$(doc_dir)/sv_se/orm/pwr_basecomponentclasses_hpp.html : $(inc_dir)/pwr_basecomponentclasses.hpp
@ echo "Generating html files for struct sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/pwr_basecomponentclasses_hpp.html : $(inc_dir)/pwr_basecomponentclasses.hpp
@ echo "Generating html files for struct en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
......@@ -47,7 +47,7 @@ else
fi
# Setup pwre
export pwre_bin=$root/src/tools/pwre/src/os_linux
export pwre_bin=$root/src/tools/pwre/src
export pwre_env_db=$root/pwre_db
source $pwre_bin/pwre_function
......
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
dirs : $(app_package_dir)/$(comp_name)$(dir_ext)
......@@ -16,9 +8,5 @@ $(app_package_dir)/$(comp_name)$(dir_ext) :
@ echo "Create directory " $(app_package_dir)/$(comp_name)$(dir_ext)
@ $(mkdir) -p $(mkdirflags) $(app_package_dir)/$(comp_name)$(dir_ext)
-include ../../special.mk
-include ../special.mk
-include special.mk
-include special.mk
......@@ -2,21 +2,12 @@ include $(pwre_dir_symbols)
extern_java_sources :=
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
#
# Copy Gdh from rt_client
#
assets_dirs_fonts := ../../../fonts
assets_dirs_fonts := ../fonts
assets_fonts_sources := $(sort \
$(foreach file, \
......@@ -44,12 +35,8 @@ $(app_assets_dir)/fonts$(dir_ext) :
@ echo "Create directory " $(app_assets_dir)/fonts$(dir_ext)
@ $(mkdir) -p $(mkdirflags) $(app_assets_dir)/fonts$(dir_ext)
$(app_assets_dir)/fonts/%.ttf : ../../../../assets/fonts/%.ttf
$(app_assets_dir)/fonts/%.ttf : ../../assets/fonts/%.ttf
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
init: pwrxtt_build_init
......@@ -18,19 +10,14 @@ exe: pwrxtt_build_exe
pwrxtt_build_init :
@ echo "Build PwrXtt init"
@ $(pwre_sroot)/aapp/bld/src/.$(pwre_os)/.$(pwre_hw)/pwrxtt_build.sh init
@ $(pwre_sroot)/aapp/bld/src/pwrxtt_build.sh init
pwrxtt_build_copy :
@ echo "Build PwrXtt copy"
@ $(pwre_sroot)/aapp/bld/src/.$(pwre_os)/.$(pwre_hw)/pwrxtt_build.sh copy
@ $(pwre_sroot)/aapp/bld/src/pwrxtt_build.sh copy
pwrxtt_build_exe :
@ echo "Build PwrXtt exe"
@ $(pwre_sroot)/aapp/bld/src/.$(pwre_os)/.$(pwre_hw)/pwrxtt_build.sh exe
@ $(pwre_sroot)/aapp/bld/src/pwrxtt_build.sh exe
-include ../../special.mk
-include ../special.mk
-include special.mk
#!/bin/bash
#
appname=PwrXtt
#
echo "Executing build.sh..." $PWRE_CONF_ANDROID
if [ ! "$PWRE_CONF_ANDROID" = "1" ]; then
echo "Android not installed"
exit
fi
if [ $1 = "copy" ]; then
if [ ! -e $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname ]; then
android create project \
--target 1 \
--name $appname \
--path $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname \
--activity MainActivity \
--package jpwr.pwrxtt
rm $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname/src/jpwr/pwrxtt/MainActivity.java
rm $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname/AndroidManifest.xml
rm -r $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname/res
fi
fi
if [ $1 = "copy" ]; then
source $pwre_bin/pwre_function
pwre build aapp manifest src
pwre build aapp pwrxtt src
pwre build aapp rt src
pwre build aapp jopg src
pwre build aapp app src
pwre build aapp res src
pwre build aapp assets src
fi
if [ $1 = "exe" ]; then
android update project \
--name $appname \
--target 1 \
--path $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname
cp /usr/local/android-sdk-linux/extras/android/support/v4/android-support-v4.jar \
$pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname/libs/.
cd $pwre_broot/$pwre_os/$pwre_hw/bld/aapp/$appname
if [ -z "$pwre_keystore" ]; then
echo "pwre_keystore not defined, build debug application"
ant release
else
echo "Keystore used: $pwre_keystore"
ant release -Dkey.store=$pwre_keystore -Dkey.alias=pwrkey
fi
fi
......@@ -97,15 +97,7 @@ extern_java_sources := \
Graph.java,\
GrowFrameApplIfc.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
dirs : $(app_package_dir)/$(comp_name)$(dir_ext)
......@@ -113,10 +105,4 @@ $(app_package_dir)/$(comp_name)$(dir_ext) :
@ echo "Create directory " $(app_package_dir)/$(comp_name)$(dir_ext)
@ $(mkdir) -p $(mkdirflags) $(app_package_dir)/$(comp_name)$(dir_ext)
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
local_objects := \
$(release_root)/bld/$(type_name)/$(appname)/AndroidManifest.xml \
......@@ -17,21 +9,16 @@ local_objects := \
copy: $(local_objects)
$(release_root)/bld/$(type_name)/$(appname)/AndroidManifest.xml : ../../AndroidManifest.xml
$(release_root)/bld/$(type_name)/$(appname)/AndroidManifest.xml : AndroidManifest.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(release_root)/bld/$(type_name)/$(appname)/.project : ../../project
$(release_root)/bld/$(type_name)/$(appname)/.project : project
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(release_root)/bld/$(type_name)/$(appname)/.classpath : ../../classpath
$(release_root)/bld/$(type_name)/$(appname)/.classpath : classpath
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
dirs : $(app_package_dir)/$(comp_name)$(dir_ext)
......@@ -17,8 +8,4 @@ $(app_package_dir)/$(comp_name)$(dir_ext) :
@ echo "Create directory " $(app_package_dir)/$(comp_name)$(dir_ext)
@ $(mkdir) -p $(mkdirflags) $(app_package_dir)/$(comp_name)$(dir_ext)
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -2,30 +2,21 @@ include $(pwre_dir_symbols)
extern_java_sources :=
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
#
# Copy Gdh from rt_client
#
res_dirs_drawable := ../../../drawable
res_dirs_drawable_hdpi := ../../../drawable-hdpi
res_dirs_drawable_ldpi := ../../../drawable-ldpi
res_dirs_drawable_mdpi := ../../../drawable-mdpi
res_dirs_drawable_xhdpi := ../../../drawable-xhdpi
res_dirs_layout := ../../../layout
res_dirs_menu := ../../../menu
res_dirs_values := ../../../values
res_dirs_values_v11 := ../../../values-v11
res_dirs_values_v14 := ../../../values-v14
res_dirs_drawable := ../drawable
res_dirs_drawable_hdpi := ../drawable-hdpi
res_dirs_drawable_ldpi := ../drawable-ldpi
res_dirs_drawable_mdpi := ../drawable-mdpi
res_dirs_drawable_xhdpi := ../drawable-xhdpi
res_dirs_layout := ../layout
res_dirs_menu := ../menu
res_dirs_values := ../values
res_dirs_values_v11 := ../values-v11
res_dirs_values_v14 := ../values-v14
res_drawable_sources := $(sort \
$(foreach file, \
......@@ -195,48 +186,44 @@ $(app_res_dir)/values-v14$(dir_ext) :
@ echo "Create directory " $(app_res_dir)/values-v14$(dir_ext)
@ $(mkdir) -p $(mkdirflags) $(app_res_dir)/values-v14$(dir_ext)
$(app_res_dir)/drawable/%.png : ../../../../res/drawable/%.png
$(app_res_dir)/drawable/%.png : ../../res/drawable/%.png
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/drawable-hdpi/%.png : ../../../../res/drawable-hdpi/%.png
$(app_res_dir)/drawable-hdpi/%.png : ../../res/drawable-hdpi/%.png
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/drawable-ldpi/%.png : ../../../../res/drawable-ldpi/%.png
$(app_res_dir)/drawable-ldpi/%.png : ../../res/drawable-ldpi/%.png
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/drawable-mdpi/%.png : ../../../../res/drawable-mdpi/%.png
$(app_res_dir)/drawable-mdpi/%.png : ../../res/drawable-mdpi/%.png
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/drawable-xhdpi/%.png : ../../../../res/drawable-xhdpi/%.png
$(app_res_dir)/drawable-xhdpi/%.png : ../../res/drawable-xhdpi/%.png
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/layout/%.xml : ../../../../res/layout/%.xml
$(app_res_dir)/layout/%.xml : ../../res/layout/%.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/menu/%.xml : ../../../../res/menu/%.xml
$(app_res_dir)/menu/%.xml : ../../res/menu/%.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/values/%.xml : ../../../../res/values/%.xml
$(app_res_dir)/values/%.xml : ../../res/values/%.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/values-v11/%.xml : ../../../../res/values-v11/%.xml
$(app_res_dir)/values-v11/%.xml : ../../res/values-v11/%.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(app_res_dir)/values-v14/%.xml : ../../../../res/values-v14/%.xml
$(app_res_dir)/values-v14/%.xml : ../../res/values-v14/%.xml
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -33,17 +33,7 @@ extern_java_sources := \
PwrtStatus.java,\
Sub.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
#
# Copy Gdh from rt_client
......@@ -66,8 +56,4 @@ $(app_package_dir)/$(comp_name)/Gdh.java : $(pwre_sroot)/jpwr/rt_client/src/Gdh.
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
-include ../../special.mk
-include ../special.mk
-include special.mk
all:
gcc -DHW_X86 -DOS_LINUX \
-I/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/inc -o rt_io_ssab.o \
-c rt_io_ssab.c
gcc -DHW_X86 -DOS_LINUX \
-I/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/inc -o rt_rtt.o \
-c rt_rtt.c
gcc -DHW_X86 -DOS_LINUX \
-I/usr/local/jdk1.2.2/include \
-I/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/inc -o Qcom.o \
-I/usr/local/jdk1.2.2/include/linux \
-I/usr/local/src/posix1b \
-c Qcom.c
gcc -DHW_X86 -DOS_LINUX \
-I/usr/local/jdk1.2.2/include \
-I/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/inc -o Gdh.o \
-I/usr/local/jdk1.2.2/include/linux \
-I/usr/local/src/posix1b \
-c Gdh.c
g++ -shared -DHW_X86 -DOS_LINUX \
-L/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/lib \
-L/usr/X11R6/lib \
-I/usr/local/jdk1.2.2/include \
-I/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/inc \
-I/usr/local/jdk1.2.2/include/linux \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/co/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/msg_dummy/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/rt/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/flow/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/glow/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/bld/lib/ge/*.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/obj/rt_io_user.o \
/proview/x3-2a/rls_dbg/os_linux/hw_x86/exp/obj/dtt_rttsys.o \
rt_io_ssab.o rt_rtt.o Qcom.o\
Gdh.o -o libgdh.so -lm -lpthread -lposix1b -lpwr_dtt \
-lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lSM -lICE
test:
gcc test.c -o test -ljavagdh
libr:
gcc -shared -DHW_X86 -DOS_LINUX -L/proview/linux_dbg/os_linux/hw_x86/exp/lib -I/usr/local/jdk/include -I/proview/linux_dbg/os_linux/hw_x86/exp/inc -I/usr/local/jdk/include/linux /proview/linux_dbg/os_linux/hw_x86/bld/lib/co/*.o /proview/linux_dbg/os_linux/hw_x86/bld/lib/msg_dummy/*.o /proview/linux_dbg/os_linux/hw_x86/bld/lib/rt/*.o /usr/local/src/proview/bld_dbg/os_linux/hw_x86/exp/obj/rt_io_user.o ssabio.c rtt.c JavaPwrImp.c -o libjavagdh.so -lm -lpthread -lposix1b -lpwr_dtt
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -95,16 +95,6 @@ local_java_sources := \
# JopSliderbackground1.java \
# JopValve.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -160,18 +160,8 @@ local_java_sources := \
JopOp.java \
JopSessionRep.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
exe : $(doc_dir)/en_us/jprm/index.html
......@@ -180,5 +170,3 @@ $(doc_dir)/en_us/jprm/index.html :
@ echo "Generating javadoc for rt, jop and jopg"
@ if [ ! -e $(doc_dir)/en_us/jprm ]; then mkdir $(doc_dir)/en_us/jprm; fi
@ javadoc -Xdoclint:none -d $(doc_dir)/en_us/jprm $(pwre_sroot)/jpwr/rt/src/*.java $(pwre_sroot)/jpwr/jop/src/*.java $(pwre_sroot)/jpwr/jopg/src/*.java
# makefile -- <short description>
#
# PROVIEW/R
# Copyright (C) 1996 by Comator Process AB.
#
# <Description>.
#
vpath %.java $(hw_source):$(os_source):$(co_source)
source_dirs = $(hw_source) $(os_source) $(co_source)
jop_classes := \
$(bld_dir)/Ge.class
export_jop := \
$(jop_classes)
clean_jop := $(patsubst %.class,clean_%.class,$(export_jop))
.PHONY : all init copy lib exe clean realclean\
$(clean_jop)
all : init copy
init :
copy :
lib : $(export_jop)
exe :
clean :
realclean : clean $(clean_jop)
......@@ -45,19 +45,6 @@ local_java_sources := \
JopcDisksup.java, \
JopcSsab_safetyswitch.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -99,19 +99,6 @@ local_java_sources := \
GrowFrameApplIfc.java,\
GrowFrame.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
......@@ -53,16 +53,6 @@ local_java_sources = \
HistServer.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
local_java_sources = \
Gdh.java
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
-include special.mk
include $(pwre_dir_symbols)
local_java_sources = \
Gdh.java
#-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
#ifeq ($($(type_name)_generic_mk),)
# -include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
#endif
#ifeq ($($(type_name)_generic_mk),)
# include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
#endif
-include ../../special.mk
-include ../special.mk
-include special.mk
# special.mk -- special makefile for rt_client
#
# To build library pwr_rt_client.
# This is a parsitic library that steals everything from jpwr/rt, except
# the Gdh class.
# When compiling Gdh.java it is placed in jpwr/rt and everything in jpwr/rt
# is then copied into pwr_rt_client.jar. The new Gdh.class is then deleted.
#
ifndef jpwr_generic_mk
jpwr_generic_mk := 1
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
endif
vpath %.java $(hw_source):$(os_source):$(co_source)
vpath %.gif $(hw_source):$(os_source):$(co_source)
#VPATH = $(hw_source):$(os_source):$(co_source)
source_dirs = $(hw_source) $(os_source) $(co_source)
java_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/*.java) \
), $(notdir $(file)) \
) \
)
gif_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/*.gif) \
), $(notdir $(file)) \
) \
)
jpwr_name := pwr_$(comp_name)
export_lib := $(lib_dir)/$(jpwr_name).jar
java_classes := $(addsuffix .class, $(basename $(local_java_sources)))
gif_objects := $(addprefix $(bld_dir)/, $(gif_sources))
java_objects := $(addprefix $(bld_dir)/, $(java_classes))
objects := $(gif_objects) $(java_objects)
source_dependencies := $(notdir $(basename $(sources)))
source_dependencies := $(addprefix $(bld_dir)/, $(source_dependencies))
source_dependencies := $(addsuffix $(d_ext), $(source_dependencies))
.PHONY : all init copy lib exe clean realclean \
dirs clean_includes \
clean_bld clean_dirs clean_lib
# dirs $(clean_h_includes) $(clean_hpp_includes)
all : init copy lib exe
init : dirs
copy :
lib : $(export_lib)
exe :
dirs : $(bld_dir)$(dir_ext)
$(bld_dir)$(dir_ext) :
@ $(mkdir) $(mkdirflags) $(basename $@)/
clean : clean_bld clean_lib
realclean : clean clean_includes clean_dirs
clean_bld :
@ echo "Cleaning build directory"
@ $(rm) $(rmflags) $(bld_dir)/*
clean_dirs :
@ echo "Removing build directory"
@ $(rm) -r $(rmflags) $(bld_dir)
clean_lib :
@ echo "Removing archive $(notdir $(export_lib))"
@ $(rm) $(rmflags) $(export_lib)
clean_includes : $(clean_h_includes) $(clean_hpp_includes)
$(clean_h_includes) : clean_%.h : %.h
@ echo "Removing h-includes"
@ $(rm) $(rmflags) $(inc_dir)/$*.h
$(clean_hpp_includes) : clean_%.hpp : %.hpp
@ echo "Removing hpp-includes"
@ $(rm) $(rmflags) $(inc_dir)/$*.hpp
$(export_lib) : $(objects)
@ echo "Building archive $(notdir $(export_lib)) special"
@ if [ -e $(export_lib) ]; then \
$(rm) $(export_lib); \
fi
jar cfm $(export_lib) ../../manifest.stub
@ cd $(pwre_broot)/$(pwre_target)/bld; \
jar uf $(export_lib) jpwr/rt/*.class; \
rm jpwr/rt/Gdh.class;
#-include $(source_dependencies)
endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
copy : $(doc_dir)/sv_se/orm/misc_plc_c.html \
$(doc_dir)/en_us/orm/misc_plc_c.html
$(doc_dir)/sv_se/orm/misc_plc_c.html : ../../misc_plc.c
$(doc_dir)/sv_se/orm/misc_plc_c.html : misc_plc.c
@ echo "Generating html files for misc_plc sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/misc_plc_c.html : ../../misc_plc.c
$(doc_dir)/en_us/orm/misc_plc_c.html : misc_plc.c
@ echo "Generating html files for misc_plc en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
copy : $(doc_dir)/sv_se/orm/nmps_plc_c.html \
$(doc_dir)/en_us/orm/nmps_plc_c.html \
$(doc_dir)/sv_se/orm/nmps_plc_display_c.html \
$(doc_dir)/en_us/orm/nmps_plc_display_c.html \
$(doc_dir)/sv_se/orm/nmps_plc_runtime_c.html \
$(doc_dir)/en_us/orm/nmps_plc_runtime_c.html \
$(doc_dir)/sv_se/orm/nmps_plc_macro_h.html \
$(doc_dir)/en_us/orm/nmps_plc_macro_h.html \
$(doc_dir)/sv_se/orm/nmps_plc_c.html : ../../nmps_plc.c
@ echo "Generating html files for nmps_plc sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/nmps_plc_c.html : ../../nmps_plc.c
@ echo "Generating html files for nmps_plc en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
$(doc_dir)/sv_se/orm/nmps_plc_display_c.html : ../../nmps_plc_display.c
@ echo "Generating html files for nmps_plc_display sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/nmps_plc_display_c.html : ../../nmps_plc_display.c
@ echo "Generating html files for nmps_plc_display en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
$(doc_dir)/sv_se/orm/nmps_plc_runtime_c.html : ../../nmps_plc_runtime.c
@ echo "Generating html files for nmps_plc_runtime sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/nmps_plc_runtime_c.html : ../../nmps_plc_runtime.c
@ echo "Generating html files for nmps_plc_runtime en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
$(doc_dir)/sv_se/orm/nmps_plc_macro_h.html : ../../nmps_plc_macro.h
@ echo "Generating html files for nmps_plc_macro sv_se..."
@ $(co_convert) -c -d $(doc_dir)/sv_se/orm "$(source)"
$(doc_dir)/en_us/orm/nmps_plc_macro_h.html : ../../nmps_plc_macro.h
@ echo "Generating html files for nmps_plc_macro en_us..."
@ $(co_convert) -c -d $(doc_dir)/en_us/orm "$(source)"
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
export_cpp = $(bld_dir)/stdsoap2.o
export_h = $(inc_dir)/stdsoap2.h $(inc_dir)/Service.nsmap
......@@ -14,11 +14,10 @@ lib : $(export_lib) export_lib_local
export_lib_local : $(export_cpp) $(export_h)
@ $(ar) -r $(export_lib) $(export_cpp)
$(bld_dir)/stdsoap2.o : stdsoap2.cpp
$(bld_dir)/stdsoap2.o : ../../stdsoap2.cpp
$(inc_dir)/stdsoap2.h : ../../stdsoap2.h
$(inc_dir)/stdsoap2.h : stdsoap2.h
$(inc_dir)/Service.nsmap : ../../Service.nsmap
$(inc_dir)/Service.nsmap : Service.nsmap
@ echo "Export $(source)"
@ $(cp) $(cpflags) $(source) $(target)
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
-include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.gif $(co_source)
vpath %.png $(co_source)
vpath %.gif $(hw_source):$(os_source):$(co_source)
vpath %.png $(hw_source):$(os_source):$(co_source)
source_dirs := $(hw_source) $(os_source) $(co_source)
source_dirs := $(co_source)
gif_sources := $(sort \
$(foreach file, \
......@@ -68,7 +61,7 @@ $(doc_dir)/en_us/orm/%.png : %.png
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
@ $(cp) $(cpflags) $(source) $(doc_dir)/help
$(doc_dir)/en_us/orm/%.html : ../../%.html
$(doc_dir)/en_us/orm/%.html : %.html
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
@ $(cp) $(cpflags) $(source) $(doc_dir)/sv_se/orm
......@@ -103,7 +96,3 @@ $(clean_png) : clean_%.png : %.png
$(clean_html) : clean_%.html : %.html
@ $(rm) $(rmflags) $(doc_dir)/orm/$*.html
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.sh $(hw_source):$(os_source):$(co_source)
vpath %.pwr_com $(hw_source):$(os_source):$(co_source)
vpath %.sh $(co_source)
vpath %.pwr_com $(co_source)
source_dirs = $(hw_source) $(os_source) $(co_source)
source_dirs := $(co_source)
sh_sources := $(sort \
$(foreach file, \
......@@ -77,5 +71,3 @@ $(clean_sh) : clean_%.sh : %.sh
$(clean_pwr_com) : clean_%.pwr_com : %.pwr_com
@ rm $(exe_dir)/$*.pwr_com
include $(pwre_dir_symbols)
ifndef variables_mk
include $(pwre_croot)/src/tools/bld/src/variables.mk
endif
ifndef rules_mk
include $(pwre_croot)/src/tools/bld/src/rules.mk
endif
.PHONY : all init copy lib exe clean realclean\
$(clean_c)
all : init copy lib | silent
init : silent
copy : $(inc_dir)/objdict.h | silent
lib : silent
exe : silent
clean :
realclean : clean $(clean_obj)
silent :
@ :
.SUFFIXES:
$(inc_dir)/objdict.h : objdict.h
@ echo "Copying objdict.h"
@ $(cp) $(cpflags) $(source) $(target)
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
include $(pwre_croot)/src/tools/bld/src/variables.mk
endif
ifndef variables_mk
include $(pwre_croot)/src/tools/bld/src/$(os_name)/variables.mk
endif
ifndef rules_mk
-include $(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
include $(pwre_croot)/src/tools/bld/src/rules.mk
endif
ifndef rules_mk
include $(pwre_croot)/src/tools/bld/src/$(os_name)/rules.mk
endif
.PHONY : all init copy lib exe clean realclean\
$(clean_c)
......@@ -42,24 +34,18 @@ silent :
# @ echo "Copying libusbio.a"
# @ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/libusbio.h : ../../libusbio.h
$(inc_dir)/libusbio.h : libusbio.h
@ echo "Copying libusbio.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/openSocket.h : ../../openSocket.h
$(inc_dir)/openSocket.h : openSocket.h
@ echo "Copying openSocket.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/setport.h : ../../setport.h
$(inc_dir)/setport.h : setport.h
@ echo "Copying setport.h"
@ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/pwr_arduino_uno.ino : ../../pwr_arduino_uno.ino
$(inc_dir)/pwr_arduino_uno.ino : pwr_arduino_uno.ino
@ echo "Copying pwr_arduino_uno.ino"
@ $(cp) $(cpflags) $(source) $(target)
include $(pwre_dir_symbols)
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/rules.mk
include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.xdd $(hw_source):$(os_source):$(co_source)
vpath %.xdd $(co_source)
source_dirs = $(hw_source) $(os_source) $(co_source)
source_dirs := $(co_source)
xdd_sources := $(sort \
$(foreach file, \
......@@ -57,5 +51,3 @@ $(export_xdd) : $(exe_dir)/%.xdd : %.xdd
$(clean_xdd) : clean_%.xdd : %.xdd
@ rm $(exe_dir)/$*.xdd
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_pb_profiboard.c -- io methods for the profibus master object
The PbMaster object serves as agent for one Profibus DP bus
The board we use is Profiboard from Softing
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "co_cdh.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_locals.h"
#include "rt_io_agent_init.h"
static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap);
static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap);
static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap);
static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap);
/*----------------------------------------------------------------------------*\
Init method for the mb_master agent
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
{
io_sAgentLocal* local;
/* Allocate area for local data structure */
ap->Local = calloc(1, sizeof(io_sAgentLocal));
if (!ap->Local) {
errh_Error("ERROR config Modbus Master %s - %s", ap->Name, "calloc");
return IO__ERRINIDEVICE;
}
local = ap->Local;
local->initialized = TRUE;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus Master agent
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
{
io_sAgentLocal* local;
io_sRackLocal* local_rack;
pwr_tUInt16 sts;
io_sRack* rp;
pwr_tCid cid;
pwr_sClass_Modbus_TCP_Slave* sp;
local = (io_sAgentLocal*)ap->Local;
/* Do configuration check and initialize modules. */
rp = ap->racklist;
while (rp) {
cid = rp->Class;
while (ODD(gdh_GetSuperClass(cid, &cid, rp->Objid)))
;
switch (cid) {
case pwr_cClass_Modbus_TCP_Slave:
sp = (pwr_sClass_Modbus_TCP_Slave*)rp->op;
local_rack = rp->Local;
/* Start receving old data so the input buffer is flushed */
if (sp->Status == MB__NORMAL) {
sts = mb_recv_data(local_rack, rp, sp);
}
/* Request new data */
if (sp->Status == MB__NORMAL && sp->DisableSlave != 1) {
sts = mb_send_data(local_rack, rp, sp, mb_mSendMask_ReadReq);
}
break;
} /* End - switch ... */
rp = rp->next;
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb_Profiboard agent
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_Master) = { pwr_BindIoMethod(IoAgentInit),
pwr_BindIoMethod(IoAgentRead), pwr_BindIoMethod(IoAgentWrite),
pwr_BindIoMethod(IoAgentClose), pwr_NullMethod };
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
pwr_sClass_Modbus_Module* op;
int i;
op = (pwr_sClass_Modbus_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
pwr_sClass_Modbus_Module* op;
pwr_sClass_Modbus_TCP_Slave* slave;
op = (pwr_sClass_Modbus_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave*)rp->op;
if (op->ScanInterval > 1) {
local->has_read_method = 1;
if (local->interval_cnt != 0) {
local->interval_cnt++;
if (local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
pwr_sClass_Modbus_Module* op;
pwr_sClass_Modbus_TCP_Slave* slave;
op = (pwr_sClass_Modbus_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave*)rp->op;
if (op->ScanInterval > 1) {
if (!local->has_read_method) {
if (local->interval_cnt != 0) {
local->interval_cnt++;
if (local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
} else if (local->interval_cnt != 1)
return IO__SUCCESS;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian,
pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_Module) = { pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardRead), pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocal* local;
pwr_sClass_Modbus_ModuleReadWrite* op;
int i;
op = (pwr_sClass_Modbus_ModuleReadWrite*)cp->op;
local = (io_sCardLocal*)cp->Local;
for (i = 0; i < IO_MAXCHAN; i++) {
local->msg[0].scancount[i] = 0;
local->msg[1].scancount[i] = 0;
}
op->Read.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
op->Write.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocal* local;
pwr_sClass_Modbus_ModuleReadWrite* op;
pwr_sClass_Modbus_TCP_Slave* slave;
op = (pwr_sClass_Modbus_ModuleReadWrite*)cp->op;
local = (io_sCardLocal*)cp->Local;
slave = (pwr_sClass_Modbus_TCP_Slave*)rp->op;
if (op->Read.ScanInterval > 1) {
local->msg[0].has_read_method = 1;
if (local->msg[0].interval_cnt != 0) {
local->msg[0].interval_cnt++;
if (local->msg[0].interval_cnt >= op->Read.ScanInterval)
local->msg[0].interval_cnt = 0;
return IO__SUCCESS;
}
local->msg[0].interval_cnt++;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocal* local;
pwr_sClass_Modbus_ModuleReadWrite* op;
pwr_sClass_Modbus_TCP_Slave* slave;
op = (pwr_sClass_Modbus_ModuleReadWrite*)cp->op;
local = (io_sCardLocal*)cp->Local;
slave = (pwr_sClass_Modbus_TCP_Slave*)rp->op;
if (op->Write.ScanInterval > 1) {
if (!local->msg[1].has_read_method) {
if (local->msg[1].interval_cnt != 0) {
local->msg[1].interval_cnt++;
if (local->msg[1].interval_cnt >= op->Write.ScanInterval)
local->msg[1].interval_cnt = 0;
return IO__SUCCESS;
}
local->msg[1].interval_cnt++;
} else if (local->msg[1].interval_cnt != 1)
return IO__SUCCESS;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian,
pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_ModuleReadWrite)
= { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };
This diff is collapsed.
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
pwr_sClass_Modbus_RTU_Module* op;
int i;
op = (pwr_sClass_Modbus_RTU_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus RTU module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
io_sRackLocal* local_rack = (io_sRackLocal*)rp->Local;
pwr_sClass_Modbus_RTU_Module* op;
pwr_sClass_Modbus_RTU_Slave* slave;
op = (pwr_sClass_Modbus_RTU_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
slave = (pwr_sClass_Modbus_RTU_Slave*)rp->op;
if (op->ScanInterval > 1) {
local->has_read_method = 1;
if (local->interval_cnt != 0) {
local->interval_cnt++;
if (local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
if (slave->Status == MB__NORMAL || local_rack->reset_inputs) {
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_RTU_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus RTU module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sCardLocalMsg* local;
pwr_sClass_Modbus_RTU_Module* op;
pwr_sClass_Modbus_RTU_Slave* slave;
op = (pwr_sClass_Modbus_RTU_Module*)cp->op;
local = ((io_sCardLocal*)cp->Local)->msg;
slave = (pwr_sClass_Modbus_RTU_Slave*)rp->op;
if (op->ScanInterval > 1) {
if (!local->has_read_method) {
if (local->interval_cnt != 0) {
local->interval_cnt++;
if (local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
} else if (local->interval_cnt != 1)
return IO__SUCCESS;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian,
pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_RTU_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_Module)
= { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };
This diff is collapsed.
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <unistd.h>
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
#include "co_time.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
pwr_sClass_Modbus_RTU_ServerModule* op;
int i;
op = (pwr_sClass_Modbus_RTU_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus RTU server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
io_sServerLocal* local_server;
pwr_sClass_Modbus_RTU_ServerModule* op;
pwr_sClass_Modbus_RTU_Server* server;
op = (pwr_sClass_Modbus_RTU_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
server = (pwr_sClass_Modbus_RTU_Server*)rp->op;
local_server = (io_sServerLocal*)rp->Local;
if (server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock(&local_server->mutex);
io_bus_card_read(ctx, rp, cp, local->input_area, NULL,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock(&local_server->mutex);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus RTU server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
io_sServerLocal* local_server;
pwr_sClass_Modbus_RTU_ServerModule* op;
pwr_sClass_Modbus_RTU_Server* server;
op = (pwr_sClass_Modbus_RTU_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
server = (pwr_sClass_Modbus_RTU_Server*)rp->op;
local_server = (io_sServerLocal*)rp->Local;
if (server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock(&local_server->mutex);
io_bus_card_write(ctx, cp, local->output_area,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock(&local_server->mutex);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_ServerModule)
= { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_mb_rtu_slave.c -- io methods for a Modbus RTU slave */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "co_cdh.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
io_sCardLocal* local_card;
io_sCard* cardp;
io_sRackLocal* local;
int no_di;
int no_do;
pwr_sClass_Modbus_RTU_Slave* op;
char name[196];
pwr_tStatus sts;
pwr_tCid cid;
io_sChannel* chanp;
int i;
sts = gdh_ObjidToName(rp->Objid, (char*)&name, sizeof(name), cdh_mNName);
errh_Info("Init of Modbus TCP Slave and Modules %s", name);
op = (pwr_sClass_Modbus_RTU_Slave*)rp->op;
rp->Local = calloc(1, sizeof(io_sRackLocal));
local = rp->Local;
op->Status = MB__NORMAL;
/* Do configuration check and initialize modules. */
cardp = rp->cardlist;
unsigned int prev_input_area_offset = 0;
unsigned int prev_output_area_offset = 0;
unsigned int input_area_offset = 0;
unsigned int output_area_offset = 0;
unsigned int input_area_chansize = 0;
unsigned int output_area_chansize = 0;
while (cardp) {
local_card = calloc(1, sizeof(*local_card));
cid = cardp->Class;
/* Find the super class */
while (ODD(gdh_GetSuperClass(cid, &cid, cardp->Objid)))
;
switch (cid) {
case pwr_cClass_Modbus_RTU_Module: {
pwr_sClass_Modbus_RTU_Module* modulep;
cardp->Local = local_card;
no_di = 0;
no_do = 0;
local_card->msg[0].input_area
= (void*)&(op->Inputs) + input_area_offset + input_area_chansize;
local_card->msg[0].output_area
= (void*)&(op->Outputs) + output_area_offset + output_area_chansize;
modulep = (pwr_sClass_Modbus_RTU_Module*)cardp->op;
modulep->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
io_bus_card_init(ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
pwr_eByteOrderingEnum_BigEndian);
/* Count number of di and do */
for (i = 0; i < cardp->ChanListSize; i++) {
chanp = &cardp->chanlist[i];
switch (chanp->ChanClass) {
case pwr_cClass_ChanDi:
no_di++;
break;
case pwr_cClass_ChanDo:
no_do++;
break;
}
}
local_card->msg[0].input_size
= input_area_offset + input_area_chansize - prev_input_area_offset;
local_card->msg[0].output_size
= output_area_offset + output_area_chansize - prev_output_area_offset;
local_card->msg[0].no_di = no_di;
local_card->msg[0].no_do = no_do;
break;
}
} /* End - switch ... */
prev_input_area_offset = input_area_offset + input_area_chansize;
prev_output_area_offset = output_area_offset + output_area_chansize;
cardp = cardp->next;
}
local->input_size = input_area_offset + input_area_chansize;
local->output_size = output_area_offset + output_area_chansize;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackRead(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackWrite(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackClose(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_Slave)
= { pwr_BindIoMethod(IoRackInit), pwr_BindIoMethod(IoRackRead),
pwr_BindIoMethod(IoRackWrite), pwr_BindIoMethod(IoRackClose),
pwr_NullMethod };
This diff is collapsed.
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_locals.h"
#include "co_time.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
pwr_sClass_Modbus_TCP_ServerModule* op;
int i;
op = (pwr_sClass_Modbus_TCP_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus TCP module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
io_sServerLocal* local_server;
pwr_sClass_Modbus_TCP_ServerModule* op;
pwr_sClass_Modbus_TCP_Server* server;
op = (pwr_sClass_Modbus_TCP_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
server = (pwr_sClass_Modbus_TCP_Server*)rp->op;
local_server = (io_sServerLocal*)rp->Local;
if (server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock(&local_server->mutex);
io_bus_card_read(ctx, rp, cp, local->input_area, NULL,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock(&local_server->mutex);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite(
io_tCtx ctx, io_sAgent* ap, io_sRack* rp, io_sCard* cp)
{
io_sServerModuleLocal* local;
io_sServerLocal* local_server;
pwr_sClass_Modbus_TCP_ServerModule* op;
pwr_sClass_Modbus_TCP_Server* server;
op = (pwr_sClass_Modbus_TCP_ServerModule*)cp->op;
local = (io_sServerModuleLocal*)cp->Local;
server = (pwr_sClass_Modbus_TCP_Server*)rp->op;
local_server = (io_sServerLocal*)rp->Local;
if (server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock(&local_server->mutex);
io_bus_card_write(ctx, cp, local->output_area,
pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock(&local_server->mutex);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_TCP_ServerModule)
= { pwr_BindIoMethod(IoCardInit), pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite), pwr_NullMethod };
This diff is collapsed.
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_motioncontrol_usbio.c -- I/O methods for class MotionControl_USBIO.
*/
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
#include "rt_io_msg.h"
#include "libusbio.h"
#include "rt_io_m_motioncontrol_usb.h"
static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
io_sLocalUSB* local;
int status;
int i;
unsigned int snum;
int found;
io_sCard* cp;
pwr_sClass_MotionControl_USB* op = (pwr_sClass_MotionControl_USB*)rp->op;
local = (io_sLocalUSB*)calloc(1, sizeof(io_sLocalUSB));
rp->Local = local;
for (i = 0; i < (int)sizeof(local->USB_Handle); i++) {
status = USBIO_Open(&local->USB_Handle[i]);
if (status) {
if (i == 0)
op->Status = status;
break;
}
/* Check is this card is configured */
status = USBIO_GetSerialNr(&local->USB_Handle[i], &snum);
if (!status) {
found = 0;
for (cp = rp->cardlist; cp; cp = cp->next) {
if (((pwr_sClass_MotionControl_USBIO*)cp->op)->Super.Address == snum) {
local->snum[i] = snum;
found = 1;
break;
}
}
if (!found) {
errh_Info("USBIO Serial number %d not configured", snum);
op->Status = USBIO_Close(&local->USB_Handle[i]);
i--;
continue;
}
} else
errh_Error("USBIO Serial number error '%s'", rp->Name);
}
errh_Info("Init of USBIO rack '%s'", rp->Name);
return IO__SUCCESS;
}
static pwr_tStatus IoRackClose(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
io_sLocalUSB* local = rp->Local;
pwr_sClass_MotionControl_USB* op = (pwr_sClass_MotionControl_USB*)rp->op;
int i;
for (i = 0; i < (int)sizeof(local->USB_Handle); i++) {
if (local->USB_Handle[i])
USBIO_Close(&local->USB_Handle[i]);
else
break;
}
op->Status = 0;
return IO__SUCCESS;
}
/* Every method should be registred here. */
pwr_dExport pwr_BindIoMethods(MotionControl_USB)
= { pwr_BindIoMethod(IoRackInit), pwr_BindIoMethod(IoRackClose),
pwr_NullMethod };
/* ra_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
#ifndef ra_io_m_motioncontrol_usb_h
#define ra_io_m_motioncontrol_usb_h
#define USB_MAX_CARDS 50
typedef struct {
int USB_Handle[USB_MAX_CARDS];
unsigned int snum[USB_MAX_CARDS];
} io_sLocalUSB;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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