Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
b38c9521
Commit
b38c9521
authored
Jul 15, 2013
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Powerlink CN server added
parent
8418ca20
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
3856 additions
and
29 deletions
+3856
-29
otherio/exe/rt_powerlink/src/rt_powerlink.c
otherio/exe/rt_powerlink/src/rt_powerlink.c
+6
-0
otherio/exe/rt_powerlink_cn/src/os_templ/hw_templ/makefile
otherio/exe/rt_powerlink_cn/src/os_templ/hw_templ/makefile
+15
-0
otherio/exe/rt_powerlink_cn/src/os_templ/link_rule.mk
otherio/exe/rt_powerlink_cn/src/os_templ/link_rule.mk
+9
-0
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
+135
-0
otherio/exp/powerlink/src/README
otherio/exp/powerlink/src/README
+18
-0
otherio/exp/powerlink/src/objdict.h
otherio/exp/powerlink/src/objdict.h
+2249
-0
otherio/lib/rt/src/os_linux/rt_io_m_epl.h
otherio/lib/rt/src/os_linux/rt_io_m_epl.h
+12
-0
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnserver.c
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnserver.c
+982
-0
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnservermodule.c
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnservermodule.c
+120
-0
otherio/lib/rt/src/os_linux/rt_io_m_epl_mn.c
otherio/lib/rt/src/os_linux/rt_io_m_epl_mn.c
+10
-18
otherio/lib/rt/src/rt_io_otherio.meth
otherio/lib/rt/src/rt_io_otherio.meth
+2
-0
otherio/lib/wb/src/wb_c_epl_mn.cpp
otherio/lib/wb/src/wb_c_epl_mn.cpp
+1
-1
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+273
-4
src/lib/rt/src/rt_io_bus.c
src/lib/rt/src/rt_io_bus.c
+8
-0
src/tools/pwre/src/os_linux/pwre_configure.sh
src/tools/pwre/src/os_linux/pwre_configure.sh
+14
-4
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+2
-2
No files found.
otherio/exe/rt_powerlink/src/rt_powerlink.c
View file @
b38c9521
...
...
@@ -90,6 +90,12 @@ int main()
exit
(
sts
);
}
sts
=
gdh_GetClassList
(
pwr_cClass_Epl_CNServer
,
&
oid
);
if
(
ODD
(
sts
))
{
system
(
"rt_powerlink_cn &"
);
exit
(
0
);
}
// Get Powerlink handler object
sts
=
io_get_plhandler_object
(
&
plhp
,
&
oid
);
if
(
EVEN
(
sts
))
{
...
...
otherio/exe/rt_powerlink_cn/src/os_templ/hw_templ/makefile
0 → 100644
View file @
b38c9521
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
otherio/exe/rt_powerlink_cn/src/os_templ/link_rule.mk
0 → 100644
View file @
b38c9521
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ldxx)
$(explinkflags)
$(domap)
-o
$(export_exe)
\
$(export_obj)
$(pwr_eobj)
/rt_io_user.o
\
$(pwre_conf_libdir)
$(pwre_conf_libpwrrt)
$(pwre_conf_lib)
\
-lpwr_usbio_dummy
-lpwr_usb_dummy
-lpwr_cifx_dummy
-lpwr_nodave_dummy
\
$(pwre_conf_libpwrprofibus)
$(pwre_conf_libpwrpowerlinkcn)
-lpcap
endif
otherio/exe/rt_powerlink_cn/src/rt_powerlink_cn.c
0 → 100644
View file @
b38c9521
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include "pwr.h"
#include "rt_io_msg.h"
#include "rt_pwr_msg.h"
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_errh.h"
#include "rt_aproc.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
// Test for CN build
#include "Epl.h"
tEplKernel
EplApiSetCdcFilename
(
char
*
pszCdcFilename_p
)
{
return
0
;
}
pwr_tStatus
io_get_plhandler_object
(
pwr_sClass_EplHandler
**
o
,
pwr_tObjid
*
roid
)
{
pwr_tStatus
sts
;
pwr_tObjid
oid
;
// Get EplHandler object
sts
=
gdh_GetClassList
(
pwr_cClass_EplHandler
,
&
oid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToPointer
(
oid
,
(
void
*
)
o
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
roid
!=
NULL
)
*
roid
=
oid
;
return
IO__SUCCESS
;
}
int
main
()
{
pwr_tStatus
sts
;
io_tCtx
io_ctx
;
float
ctime
=
1
;
pwr_sClass_EplHandler
*
plhp
;
pwr_tOid
oid
;
struct
timespec
tim1
,
tim2
;
// Make connection to error handler
errh_Init
(
"pwr_powerlink"
,
errh_eAnix_powerlink
);
errh_SetStatus
(
PWR__SRVSTARTUP
);
// Make connection to realtime database
sts
=
gdh_Init
(
"rt_powerlink"
);
if
(
EVEN
(
sts
))
{
errh_Fatal
(
"rt_powerlink aborted, gdh_Init failed
\n
%m"
,
sts
);
errh_SetStatus
(
PWR__SRVTERM
);
exit
(
sts
);
}
// Get Powerlink handler object
sts
=
io_get_plhandler_object
(
&
plhp
,
&
oid
);
if
(
EVEN
(
sts
))
{
errh_SetStatus
(
0
);
errh_Info
(
"rt_powerlink terminated, no EplHandler object found"
);
exit
(
sts
);
}
// Create context and call init functions of all agent,
// rack and cardobjects
sts
=
io_init
(
io_mProcess_Powerlink
,
pwr_cNObjid
,
&
io_ctx
,
1
,
ctime
);
if
(
EVEN
(
sts
))
{
errh_SetStatus
(
PWR__SRVTERM
);
errh_Fatal
(
"rt_powerlink aborted, io_init() failed
\n
%m"
,
sts
);
exit
(
sts
);
}
tim1
.
tv_sec
=
0
;
tim1
.
tv_nsec
=
(
plhp
->
CycleTime
)
*
1000000000L
;
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
errh_SetStatus
(
PWR__SRUN
);
aproc_RegisterObject
(
oid
);
// Call IoAgentRead() IoAgentWrite() IoCardRead() IoCardWrite()
// IoModuleRead() IoModuleWrite() forever
for
(;;)
{
sts
=
io_read
(
io_ctx
);
sts
=
io_write
(
io_ctx
);
nanosleep
(
&
tim1
,
&
tim2
);
aproc_TimeStamp
(
plhp
->
CycleTime
,
5
.
0
);
}
}
otherio/exp/powerlink/src/README
0 → 100644
View file @
b38c9521
Instructions to build openPOWERLINK for Proview:
Define enviroment variable epl to the root of the openPOWERLINK
installation
> export epl=/usr/local/openPOWERLINK-Vx.x.x
Copy otherio/exp/powerlink/src/objdict.h to $epl/ObjDicts/CiA401_CN/.
Create one build directory for MN (build) and one for CN (buildcn)
> mkdir $epl/build
> mkdir $epl/buildcn
Go to $epl/build and build for MN, then go to $epl/buildcn and build for CN.
Execute 'pwre configure' and check powerlink includes and archives are found,
and finally build Proview.
otherio/exp/powerlink/src/objdict.h
0 → 100644
View file @
b38c9521
This source diff could not be displayed because it is too large. You can
view the blob
instead.
otherio/lib/rt/src/os_linux/rt_io_m_epl.h
View file @
b38c9521
...
...
@@ -55,4 +55,16 @@ typedef struct {
struct
timespec
tpe
,
tps
;
}
io_sLocalEpl_CN
;
typedef
struct
{
int
byte_ordering
;
int
float_representation
;
struct
timespec
tpe
,
tps
;
int
input_area_size
;
int
output_area_size
;
void
*
input_area
;
void
*
output_area
;
void
*
tmp_area
;
short
inputResetEnabled
;
}
io_sLocalEpl_CNServer
;
#endif
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnserver.c
0 → 100644
View file @
b38c9521
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "rt_io_base.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
#include "rt_io_rack_read.h"
#include "rt_io_rack_write.h"
#include "rt_io_msg.h"
#include "rt_iom_msg.h"
#include "pwr_otherioclasses.h"
#include "rt_io_m_epl.h"
#include "rt_io_bus.h"
#if defined PWRE_CONF_EPL
#include "Epl.h"
#include <errno.h>
#include <math.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define IP_ADDR 0xc0a86401 // 192.168.100.1
#define SUBNET_MASK 0xFFFFFF00 // 255.255.255.0 "
#define MAIN_THREAD_PRIORITY 20
//---------------------------------------------------------------------------
// module global vars
//---------------------------------------------------------------------------
static
const
char
abMacAddr
[]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
static
unsigned
int
uiCycleLen_g
=
0
;
static
unsigned
int
uiCurCycleLen_g
=
0
;
// process image stuff
static
void
*
AppProcessImageIn_g
;
static
void
*
AppProcessImageOut_g
;
static
tEplApiProcessImageCopyJob
AppProcessImageCopyJob_g
;
/*----------------------------------------------------------------------------*/
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
// This function is the entry point for your object dictionary. It is defined
// in OBJDICT.C by define EPL_OBD_INIT_RAM_NAME. Use this function name to define
// this function prototype here. If you want to use more than one Epl
// instances then the function name of each object dictionary has to differ.
tEplKernel
PUBLIC
EplObdInitRam
(
tEplObdInitParam
MEM
*
pInitParam_p
);
static
tEplKernel
AppCbEvent
(
tEplApiEventType
EventType_p
,
// IN: event type (enum)
tEplApiEventArg
*
pEventArg_p
,
// IN: event argument (union)
io_sAgent
*
pUserArg_p
);
static
tEplKernel
AppCbSync
(
void
);
//---------------------------------------------------------------------------
//
// Function: AppCbEvent
//
// Description: event callback function called by EPL API layer within
// user part (low priority).
//
// Parameters: EventType_p = event type
// pEventArg_p = pointer to union, which describes
// the event in detail
// pUserArg_p = user specific argument
//
// Returns: tEplKernel = error code,
// kEplSuccessful = no error
// kEplReject = reject further processing
// otherwise = post error event to API layer
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel
PUBLIC
AppCbEvent
(
tEplApiEventType
EventType_p
,
// IN: event type (enum)
tEplApiEventArg
*
pEventArg_p
,
// IN: event argument (union)
io_sAgent
*
pUserArg_p
)
{
UINT
uiVarLen
;
tEplKernel
EplRet
=
kEplSuccessful
;
pwr_sClass_Epl_CNServer
*
op
=
(
pwr_sClass_Epl_CNServer
*
)
pUserArg_p
->
op
;
// check if NMT_GS_OFF is reached
switch
(
EventType_p
)
{
case
kEplApiEventNmtStateChange
:
{
op
->
NmtState
=
pEventArg_p
->
m_NmtStateChange
.
m_NewNmtState
;
op
->
Status
=
op
->
NmtState
==
pwr_eEplNmtState_EplNmtCsOperational
?
IOM__EPL_OPER
:
IOM__EPL_NOOPER
;
switch
(
pEventArg_p
->
m_NmtStateChange
.
m_NewNmtState
)
{
case
kEplNmtGsOff
:
{
// NMT state machine was shut down,
// because of user signal (CTRL-C) or critical EPL stack error
// -> also shut down EplApiProcess() and main()
EplRet
=
kEplShutdown
;
errh_Fatal
(
"Event:kEplNmtGsOff originating event = 0x%X (%s)"
,
pEventArg_p
->
m_NmtStateChange
.
m_NmtEvent
,
EplGetNmtEventStr
(
pEventArg_p
->
m_NmtStateChange
.
m_NmtEvent
));
break
;
}
case
kEplNmtGsResetCommunication
:
{
break
;
}
case
kEplNmtGsResetConfiguration
:
{
if
(
uiCycleLen_g
!=
0
)
{
EplRet
=
EplApiWriteLocalObject
(
0x1006
,
0x00
,
&
uiCycleLen_g
,
sizeof
(
uiCycleLen_g
));
uiCurCycleLen_g
=
uiCycleLen_g
;
}
else
{
uiVarLen
=
sizeof
(
uiCurCycleLen_g
);
EplApiReadLocalObject
(
0x1006
,
0x00
,
&
uiCurCycleLen_g
,
&
uiVarLen
);
}
break
;
}
case
kEplNmtCsPreOperational1
:
case
kEplNmtMsPreOperational1
:
{
errh_Info
(
"AppCbEvent(0x%X) originating event = 0x%X (%s)"
,
pEventArg_p
->
m_NmtStateChange
.
m_NewNmtState
,
pEventArg_p
->
m_NmtStateChange
.
m_NmtEvent
,
EplGetNmtEventStr
(
pEventArg_p
->
m_NmtStateChange
.
m_NmtEvent
));
break
;
}
case
kEplNmtCsPreOperational2
:
case
kEplNmtMsPreOperational2
:
{
break
;
}
case
kEplNmtCsReadyToOperate
:
case
kEplNmtMsReadyToOperate
:
{
break
;
}
case
kEplNmtGsInitialising
:
{
break
;
}
case
kEplNmtGsResetApplication
:
{
break
;
}
case
kEplNmtMsNotActive
:
case
kEplNmtCsNotActive
:
{
break
;
}
case
kEplNmtCsOperational
:
case
kEplNmtMsOperational
:
{
break
;
}
case
kEplNmtCsBasicEthernet
:
case
kEplNmtMsBasicEthernet
:
{
break
;
}
default:
{
}
}
break
;
}
case
kEplApiEventCriticalError
:
case
kEplApiEventWarning
:
{
// error or warning occurred within the stack or the application
// on error the API layer stops the NMT state machine
errh_Error
(
"%s(Err/Warn): Source = %s (%02X) EplError = %s (0x%03X)"
,
__func__
,
EplGetEventSourceStr
(
pEventArg_p
->
m_InternalError
.
m_EventSource
),
pEventArg_p
->
m_InternalError
.
m_EventSource
,
EplGetEplKernelStr
(
pEventArg_p
->
m_InternalError
.
m_EplError
),
pEventArg_p
->
m_InternalError
.
m_EplError
);
// check additional argument
switch
(
pEventArg_p
->
m_InternalError
.
m_EventSource
)
{
case
kEplEventSourceEventk
:
case
kEplEventSourceEventu
:
{
// error occurred within event processing
// either in kernel or in user part
errh_Error
(
" OrgSource = %s %02X"
,
EplGetEventSourceStr
(
pEventArg_p
->
m_InternalError
.
m_Arg
.
m_EventSource
),
pEventArg_p
->
m_InternalError
.
m_Arg
.
m_EventSource
);
break
;
}
case
kEplEventSourceDllk
:
{
// error occurred within the data link layer (e.g. interrupt processing)
// the DWORD argument contains the DLL state and the NMT event
errh_Error
(
" val = %X"
,
pEventArg_p
->
m_InternalError
.
m_Arg
.
m_dwArg
);
break
;
}
default:
{
break
;
}
}
break
;
}
case
kEplApiEventHistoryEntry
:
{
// new history entry
errh_Info
(
"%s(HistoryEntry): Type=0x%04X Code=0x%04X (0x%02X %02X %02X %02X %02X %02X %02X %02X)"
,
__func__
,
pEventArg_p
->
m_ErrHistoryEntry
.
m_wEntryType
,
pEventArg_p
->
m_ErrHistoryEntry
.
m_wErrorCode
,
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
0
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
1
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
2
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
3
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
4
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
5
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
6
],
(
WORD
)
pEventArg_p
->
m_ErrHistoryEntry
.
m_abAddInfo
[
7
]);
break
;
}
case
kEplApiEventNode
:
{
switch
(
pEventArg_p
->
m_Node
.
m_NodeEvent
)
{
case
kEplNmtNodeEventCheckConf
:
{
errh_Info
(
"%s(Node=0x%X, CheckConf)"
,
__func__
,
pEventArg_p
->
m_Node
.
m_uiNodeId
);
break
;
}
case
kEplNmtNodeEventUpdateConf
:
{
errh_Info
(
"%s(Node=0x%X, UpdateConf)"
,
__func__
,
pEventArg_p
->
m_Node
.
m_uiNodeId
);
break
;
}
case
kEplNmtNodeEventFound
:
{
break
;
}
case
kEplNmtNodeEventNmtState
:
{
#if 0
io_sRack *rp;
rp = (io_sRack *)pUserArg_p;
((pwr_sClass_Epl_CNServer *)rp->op)->NmtState = pEventArg_p->m_Node.m_NmtState;
((pwr_sClass_Epl_CNServer *)rp->op)->Status = ((pwr_sClass_Epl_CNServer *)rp->op)->NmtState == pwr_eEplNmtState_EplNmtCsOperational ? IOM__EPL_OPER : IOM__EPL_NOOPER;
#endif
switch
(
pEventArg_p
->
m_Node
.
m_NmtState
)
{
case
kEplNmtGsOff
:
case
kEplNmtGsInitialising
:
case
kEplNmtGsResetApplication
:
case
kEplNmtGsResetCommunication
:
case
kEplNmtGsResetConfiguration
:
case
kEplNmtCsNotActive
:
{
break
;
}
case
kEplNmtCsPreOperational1
:
case
kEplNmtCsPreOperational2
:
case
kEplNmtCsReadyToOperate
:
{
break
;
}
case
kEplNmtCsOperational
:
{
break
;
}
case
kEplNmtCsBasicEthernet
:
case
kEplNmtCsStopped
:
default:
{
break
;
}
}
break
;
}
case
kEplNmtNodeEventError
:
{
errh_Error
(
"AppCbEvent (Node=0x%X): Error = %s (0x%.4X)"
,
pEventArg_p
->
m_Node
.
m_uiNodeId
,
EplGetEmergErrCodeStr
(
pEventArg_p
->
m_Node
.
m_wErrorCode
),
pEventArg_p
->
m_Node
.
m_wErrorCode
);
break
;
}
default:
{
break
;
}
}
break
;
}
case
kEplApiEventCfmProgress
:
{
errh_Info
(
"%s(Node=0x%X, CFM-Progress: Object 0x%X/%u, %lu/%lu Bytes"
,
__func__
,
pEventArg_p
->
m_CfmProgress
.
m_uiNodeId
,
pEventArg_p
->
m_CfmProgress
.
m_uiObjectIndex
,
pEventArg_p
->
m_CfmProgress
.
m_uiObjectSubIndex
,
(
ULONG
)
pEventArg_p
->
m_CfmProgress
.
m_dwBytesDownloaded
,
(
ULONG
)
pEventArg_p
->
m_CfmProgress
.
m_dwTotalNumberOfBytes
);
if
((
pEventArg_p
->
m_CfmProgress
.
m_dwSdoAbortCode
!=
0
)
||
(
pEventArg_p
->
m_CfmProgress
.
m_EplError
!=
kEplSuccessful
))
{
errh_Error
(
" -> SDO Abort=0x%lX, Error=0x%X)"
,
(
unsigned
long
)
pEventArg_p
->
m_CfmProgress
.
m_dwSdoAbortCode
,
pEventArg_p
->
m_CfmProgress
.
m_EplError
);
}
else
{
}
break
;
}
case
kEplApiEventCfmResult
:
{
switch
(
pEventArg_p
->
m_CfmResult
.
m_NodeCommand
)
{
case
kEplNmtNodeCommandConfOk
:
{
errh_Info
(
"%s(Node=0x%X, ConfOk)"
,
__func__
,
pEventArg_p
->
m_CfmResult
.
m_uiNodeId
);
break
;
}
case
kEplNmtNodeCommandConfErr
:
{
errh_Info
(
"%s(Node=0x%X, ConfErr)"
,
__func__
,
pEventArg_p
->
m_CfmResult
.
m_uiNodeId
);
break
;
}
case
kEplNmtNodeCommandConfReset
:
{
errh_Info
(
"%s(Node=0x%X, ConfReset)"
,
__func__
,
pEventArg_p
->
m_CfmResult
.
m_uiNodeId
);
break
;
}
case
kEplNmtNodeCommandConfRestored
:
{
errh_Info
(
"%s(Node=0x%X, ConfRestored)"
,
__func__
,
pEventArg_p
->
m_CfmResult
.
m_uiNodeId
);
break
;
}
default:
{
errh_Info
(
"%s(Node=0x%X, CfmResult=0x%X)"
,
__func__
,
pEventArg_p
->
m_CfmResult
.
m_uiNodeId
,
pEventArg_p
->
m_CfmResult
.
m_NodeCommand
);
break
;
}
}
break
;
}
default:
break
;
}
return
EplRet
;
}
//---------------------------------------------------------------------------
//
// Function: AppCbSync
//
// Description: sync event callback function called by event module within
// kernel part (high priority).
// This function sets the outputs, reads the inputs and runs
// the control loop.
//
// Parameters: void
//
// Returns: tEplKernel = error code,
// kEplSuccessful = no error
// otherwise = post error event to API layer
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel
PUBLIC
AppCbSync
(
void
)
{
tEplKernel
EplRet
=
kEplSuccessful
;
EplRet
=
EplApiProcessImageExchange
(
&
AppProcessImageCopyJob_g
);
if
(
EplRet
!=
kEplSuccessful
)
{
return
EplRet
;
}
return
EplRet
;
}
static
pwr_tStatus
IoRackInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sLocalEpl_CNServer
*
local
;
pwr_sClass_Epl_CNServer
*
op
=
(
pwr_sClass_Epl_CNServer
*
)
rp
->
op
;
local
=
(
io_sLocalEpl_CNServer
*
)
calloc
(
1
,
sizeof
(
io_sLocalEpl_CNServer
));
rp
->
Local
=
local
;
local
->
inputResetEnabled
=
0
;
static
tEplApiInitParam
EplApiInitParam
;
tEplKernel
EplRet
=
kEplSuccessful
;
char
*
sHostname
=
malloc
(
1023
);
gethostname
(
sHostname
,
1023
);
if
(
op
->
StallAction
==
pwr_eStallActionEnum_ResetInputs
)
local
->
inputResetEnabled
=
1
;
// Init the I/O area
unsigned
int
input_area_offset
=
0
;
unsigned
int
input_area_chansize
=
0
;
unsigned
int
output_area_offset
=
0
;
unsigned
int
output_area_chansize
=
0
;
io_sCard
*
cp
;
pwr_tCid
cid
;
int
obd_size
;
unsigned
int
obd_entries
;
int
obd_offset
;
int
i
;
if
(
op
->
StallAction
==
pwr_eStallActionEnum_ResetInputs
)
local
->
inputResetEnabled
=
1
;
// Show device offset and size
if
(
rp
->
Class
==
pwr_cClass_Epl_CN
&&
rp
->
op
)
{
((
pwr_sClass_Epl_CN
*
)
rp
->
op
)
->
InputAreaOffset
=
input_area_offset
+
input_area_chansize
;
((
pwr_sClass_Epl_CN
*
)
rp
->
op
)
->
OutputAreaOffset
=
output_area_offset
+
output_area_chansize
;
}
// Get byte ordering
local
->
byte_ordering
=
pwr_eByteOrderingEnum_LittleEndian
;
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
cid
=
cp
->
Class
;
while
(
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
cp
->
Objid
)))
;
if
(
cid
!=
pwr_cClass_Epl_CNServerModule
||
!
cp
->
op
)
continue
;
cp
->
MethodDisabled
=
1
;
// Show module offset and size
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
InputAreaOffset
=
input_area_offset
+
input_area_chansize
;
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
OutputAreaOffset
=
output_area_offset
+
output_area_chansize
;
io_bus_card_init
(
ctx
,
cp
,
&
input_area_offset
,
&
input_area_chansize
,
&
output_area_offset
,
&
output_area_chansize
,
local
->
byte_ordering
,
io_eAlignment_Powerlink
);
// Show module offset and size
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
InputAreaSize
=
input_area_offset
+
input_area_chansize
-
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
InputAreaOffset
;
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
OutputAreaSize
=
output_area_offset
+
output_area_chansize
-
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
OutputAreaOffset
;
if
(
cp
->
next
==
NULL
)
{
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
InputAreaSize
+=
pwr_Align
(
input_area_offset
+
input_area_chansize
,
4
)
-
(
input_area_offset
+
input_area_chansize
);
((
pwr_sClass_Epl_CNServerModule
*
)
cp
->
op
)
->
OutputAreaSize
+=
pwr_Align
(
output_area_offset
+
output_area_chansize
,
4
)
-
(
output_area_offset
+
output_area_chansize
);
}
}
// This is the calculated in- and outputarea size
local
->
input_area_size
=
pwr_Align
(
input_area_offset
+
input_area_chansize
,
4
);
local
->
output_area_size
=
pwr_Align
(
output_area_offset
+
output_area_chansize
,
4
);
// Show agent in- and output area size
op
->
InputAreaSize
=
local
->
input_area_size
;
op
->
OutputAreaSize
=
local
->
output_area_size
;
struct
sched_param
schedParam
;
// adjust process priority
// push nice level in case we have no RTPreempt
if
(
nice
(
-
20
)
==
-
1
)
{
errh_Error
(
"%s() couldn't set nice value! (%s)"
,
__func__
,
strerror
(
errno
));
}
//schedParam.sched_priority = MIN(sched_get_priority_max(SCHED_FIFO),
// sched_get_priority_min(SCHED_FIFO) + op->Priority);
schedParam
.
__sched_priority
=
op
->
Priority
;
if
(
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
schedParam
)
!=
0
)
{
errh_Error
(
"%s() couldn't set thread scheduling parameters! %d"
,
__func__
,
schedParam
.
__sched_priority
);
}
// binds all openPOWERLINK threads to the second CPU core
cpu_set_t
affinity
;
CPU_ZERO
(
&
affinity
);
CPU_SET
(
1
,
&
affinity
);
sched_setaffinity
(
0
,
sizeof
(
cpu_set_t
),
&
affinity
);
// Initialize target specific stuff
EplTgtInit
();
EPL_MEMSET
(
&
EplApiInitParam
,
0
,
sizeof
(
EplApiInitParam
));
EplApiInitParam
.
m_uiSizeOfStruct
=
sizeof
(
EplApiInitParam
);
EplApiInitParam
.
m_pEventUserArg
=
rp
;
// Get devicename from attribute in agent
EplApiInitParam
.
m_HwParam
.
m_pszDevName
=
op
->
Device
;
// Get nodeid from attribute in agent
EplApiInitParam
.
m_uiNodeId
=
op
->
NodeId
;
EplApiInitParam
.
m_dwIpAddress
=
(
0xFFFFFF00
&
IP_ADDR
)
|
EplApiInitParam
.
m_uiNodeId
;
// write 00:00:00:00:00:00 to MAC address, so that the driver uses the real hardware address
EPL_MEMCPY
(
EplApiInitParam
.
m_abMacAddress
,
abMacAddr
,
sizeof
(
EplApiInitParam
.
m_abMacAddress
));
EplApiInitParam
.
m_fAsyncOnly
=
FALSE
;
EplApiInitParam
.
m_dwFeatureFlags
=
-
1
;
// required for error detection
EplApiInitParam
.
m_dwCycleLen
=
0
;
// 5000;
// const
EplApiInitParam
.
m_uiIsochrTxMaxPayload
=
256
;
// const
EplApiInitParam
.
m_uiIsochrRxMaxPayload
=
256
;
// const; only required for IdentRes
EplApiInitParam
.
m_dwPresMaxLatency
=
50000
;
// required for initialisation (+28 bytes)
EplApiInitParam
.
m_uiPreqActPayloadLimit
=
36
;
// required for initialisation of Pres frame (+28 bytes)
EplApiInitParam
.
m_uiPresActPayloadLimit
=
36
;
// const; only required for IdentRes
EplApiInitParam
.
m_dwAsndMaxLatency
=
150000
;
// required for error detection
EplApiInitParam
.
m_uiMultiplCycleCnt
=
0
;
// required to set up max frame size
EplApiInitParam
.
m_uiAsyncMtu
=
1500
;
// required for sync
EplApiInitParam
.
m_uiPrescaler
=
2
;
EplApiInitParam
.
m_dwLossOfFrameTolerance
=
500000
;
EplApiInitParam
.
m_dwAsyncSlotTimeout
=
3000000
;
EplApiInitParam
.
m_dwWaitSocPreq
=
150000
;
// NMT_DeviceType_U32
EplApiInitParam
.
m_dwDeviceType
=
-
1
;
// NMT_IdentityObject_REC.VendorId_U32
EplApiInitParam
.
m_dwVendorId
=
-
1
;
// NMT_IdentityObject_REC.ProductCode_U32
EplApiInitParam
.
m_dwProductCode
=
-
1
;
// NMT_IdentityObject_REC.RevisionNo_U32
EplApiInitParam
.
m_dwRevisionNumber
=
-
1
;
// NMT_IdentityObject_REC.SerialNo_U32
EplApiInitParam
.
m_dwSerialNumber
=
-
1
;
EplApiInitParam
.
m_dwApplicationSwDate
=
0
;
EplApiInitParam
.
m_dwApplicationSwTime
=
0
;
EplApiInitParam
.
m_dwSubnetMask
=
SUBNET_MASK
;
EplApiInitParam
.
m_dwDefaultGateway
=
0
;
EPL_MEMCPY
(
EplApiInitParam
.
m_sHostname
,
sHostname
,
sizeof
(
EplApiInitParam
.
m_sHostname
));
EplApiInitParam
.
m_uiSyncNodeId
=
EPL_C_ADR_SYNC_ON_SOA
;
EplApiInitParam
.
m_fSyncOnPrcNode
=
FALSE
;
// set callback functions
EplApiInitParam
.
m_pfnCbEvent
=
(
tEplApiCbEvent
)
AppCbEvent
;
EplApiInitParam
.
m_pfnObdInitRam
=
EplObdInitRam
;
EplApiInitParam
.
m_pfnCbSync
=
AppCbSync
;
// initialize POWERLINK stack
EplRet
=
EplApiInitialize
(
&
EplApiInitParam
);
if
(
EplRet
!=
kEplSuccessful
)
{
errh_Error
(
"EplApiInitialize() failed (Error:0x%x!"
,
EplRet
);
goto
Exit
;
}
// Allocate memory for the in- and outputareas
if
(
local
->
output_area_size
>
0
)
AppProcessImageIn_g
=
malloc
(
local
->
output_area_size
);
if
(
local
->
input_area_size
>
0
)
{
AppProcessImageOut_g
=
malloc
(
local
->
input_area_size
);
}
// Save pointer to in- and outputareas in THIS agent object
local
->
input_area
=
AppProcessImageOut_g
;
local
->
output_area
=
AppProcessImageIn_g
;
if
(
local
->
inputResetEnabled
&&
local
->
input_area_size
>
0
)
local
->
tmp_area
=
malloc
(
local
->
input_area_size
);
else
local
->
tmp_area
=
local
->
input_area
;
AppProcessImageCopyJob_g
.
m_fNonBlocking
=
FALSE
;
AppProcessImageCopyJob_g
.
m_uiPriority
=
0
;
AppProcessImageCopyJob_g
.
m_In
.
m_pPart
=
AppProcessImageIn_g
;
AppProcessImageCopyJob_g
.
m_In
.
m_uiOffset
=
0
;
AppProcessImageCopyJob_g
.
m_In
.
m_uiSize
=
local
->
output_area_size
;
AppProcessImageCopyJob_g
.
m_Out
.
m_pPart
=
AppProcessImageOut_g
;
AppProcessImageCopyJob_g
.
m_Out
.
m_uiOffset
=
0
;
AppProcessImageCopyJob_g
.
m_Out
.
m_uiSize
=
local
->
input_area_size
;
EplRet
=
EplApiProcessImageAlloc
(
local
->
output_area_size
,
local
->
input_area_size
,
2
,
2
);
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
// Link area values to object dictionary
int
prev_in_offs
=
-
1
;
int
prev_out_offs
=
-
1
;
int
di_subidx
=
0x01
;
int
do_subidx
=
0x01
;
int
ai8_subidx
=
0x01
;
int
ai16_subidx
=
0x01
;
int
ai32_subidx
=
0x01
;
int
ao8_subidx
=
0x01
;
int
ao16_subidx
=
0x01
;
int
ao32_subidx
=
0x01
;
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
io_sChannel
*
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
sop
||
!
chanp
->
size
)
continue
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
{
if
(
chanp
->
offset
==
prev_in_offs
)
break
;
obd_size
=
1
;
obd_entries
=
chanp
->
size
;
obd_offset
=
chanp
->
offset
;
EplRet
=
EplApiProcessImageLinkObject
(
0x6000
,
di_subidx
,
obd_offset
,
FALSE
,
obd_size
,
&
obd_entries
);
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
di_subidx
+=
obd_entries
;
prev_in_offs
=
chanp
->
offset
;
break
;
}
case
pwr_cClass_ChanAi
:
case
pwr_cClass_ChanAit
:
case
pwr_cClass_ChanIi
:
{
if
(
chanp
->
offset
==
prev_in_offs
)
break
;
obd_size
=
chanp
->
size
;
obd_entries
=
1
;
obd_offset
=
chanp
->
offset
;
if
(
chanp
->
size
==
1
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6400
,
ai8_subidx
++
,
obd_offset
,
FALSE
,
obd_size
,
&
obd_entries
);
else
if
(
chanp
->
size
==
2
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6401
,
ai16_subidx
++
,
obd_offset
,
FALSE
,
obd_size
,
&
obd_entries
);
else
if
(
chanp
->
size
==
4
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6402
,
ai32_subidx
++
,
obd_offset
,
FALSE
,
obd_size
,
&
obd_entries
);
else
break
;
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
prev_in_offs
=
chanp
->
offset
;
break
;
}
case
pwr_cClass_ChanDo
:
{
if
(
chanp
->
offset
==
prev_out_offs
)
break
;
obd_size
=
1
;
obd_entries
=
chanp
->
size
;
obd_offset
=
chanp
->
offset
;
EplRet
=
EplApiProcessImageLinkObject
(
0x6200
,
do_subidx
,
obd_offset
,
TRUE
,
obd_size
,
&
obd_entries
);
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
do_subidx
+=
obd_entries
;
prev_out_offs
=
chanp
->
offset
;
break
;
}
case
pwr_cClass_ChanAo
:
case
pwr_cClass_ChanIo
:
{
if
(
chanp
->
offset
==
prev_out_offs
)
break
;
obd_size
=
chanp
->
size
;
obd_entries
=
1
;
obd_offset
=
chanp
->
offset
;
if
(
chanp
->
size
==
1
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6410
,
ao8_subidx
++
,
obd_offset
,
TRUE
,
obd_size
,
&
obd_entries
);
else
if
(
chanp
->
size
==
2
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6411
,
ao16_subidx
++
,
obd_offset
,
TRUE
,
obd_size
,
&
obd_entries
);
else
if
(
chanp
->
size
==
4
)
EplRet
=
EplApiProcessImageLinkObject
(
0x6412
,
ao32_subidx
++
,
obd_offset
,
TRUE
,
obd_size
,
&
obd_entries
);
else
break
;
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
prev_out_offs
=
chanp
->
offset
;
break
;
}
case
pwr_cClass_ChanD
:
{
pwr_sClass_ChanD
*
chan_d
=
(
pwr_sClass_ChanD
*
)
chanp
->
cop
;
if
(
chan_d
->
Type
==
pwr_eDChanTypeEnum_Di
)
{
/* Di type */
if
(
chanp
->
offset
==
prev_in_offs
)
break
;
obd_size
=
1
;
obd_entries
=
chanp
->
size
;
obd_offset
=
chanp
->
offset
;
EplRet
=
EplApiProcessImageLinkObject
(
0x6000
,
di_subidx
,
obd_offset
,
FALSE
,
obd_size
,
&
obd_entries
);
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
di_subidx
+=
obd_entries
;
prev_in_offs
=
chanp
->
offset
;
}
else
{
/* Do type */
if
(
chanp
->
offset
==
prev_out_offs
)
break
;
obd_size
=
1
;
obd_entries
=
chanp
->
size
;
obd_offset
=
chanp
->
offset
;
EplRet
=
EplApiProcessImageLinkObject
(
0x6200
,
do_subidx
,
obd_offset
,
TRUE
,
obd_size
,
&
obd_entries
);
if
(
EplRet
!=
kEplSuccessful
)
{
goto
Exit
;
}
break
;
do_subidx
+=
obd_entries
;
prev_out_offs
=
chanp
->
offset
;
}
break
;
}
case
pwr_cClass_ChanBi
:
case
pwr_cClass_ChanBo
:
case
pwr_cClass_ChanBiBlob
:
case
pwr_cClass_ChanBoBlob
:
{
// TODO
break
;
}
}
}
}
// EplRet = EplApiProcessImageSetup();
// if (EplRet != kEplSuccessful) {
// goto Exit;
// }
// start processing
EplRet
=
EplApiExecNmtCommand
(
kEplNmtEventSwReset
);
if
(
EplRet
!=
kEplSuccessful
)
{
IoRackClose
(
ctx
,
ap
,
rp
);
goto
Exit
;
}
errh_Success
(
"Powerlink init successfull"
);
return
IO__SUCCESS
;
Exit:
errh_Error
(
"IoCardInit: returns 0x%X"
,
EplRet
);
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoRackClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
tEplKernel
EplRet
=
kEplSuccessful
;
io_sLocalEpl_CNServer
*
local
=
(
io_sLocalEpl_CNServer
*
)
rp
->
Local
;
free
(
local
);
// halt the NMT state machine
// so the processing of POWERLINK frames stops
EplRet
=
EplApiExecNmtCommand
(
kEplNmtEventSwitchOff
);
// delete process image
EplRet
=
EplApiProcessImageFree
();
// delete instance for all modules
EplRet
=
EplApiShutdown
();
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoRackRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sLocalEpl_CNServer
*
local
=
(
io_sLocalEpl_CNServer
*
)
rp
->
Local
;
pwr_sClass_Epl_CNServer
*
op
=
(
pwr_sClass_Epl_CNServer
*
)
rp
->
op
;
io_sCard
*
cp
;
pwr_tUInt32
error_count
=
op
->
ErrorCount
;
int
ret
=
IO__SUCCESS
;
// Time now (tps = time when bad state occurred)
clock_gettime
(
CLOCK_REALTIME
,
&
local
->
tpe
);
// Copy Powerlink process image to temp memory (only if stallaction=resetinputs else tmp_area=input_area)
if
(
op
->
StallAction
==
pwr_eStallActionEnum_ResetInputs
)
memcpy
(
local
->
tmp_area
,
local
->
input_area
,
local
->
input_area_size
);
// Save time when bad state occurs
if
(
op
->
NmtState
==
pwr_eEplNmtState_EplNmtCsOperational
)
{
op
->
ErrorCount
=
0
;
(
local
->
tps
).
tv_sec
=
0
;
}
else
if
(
(
local
->
tps
).
tv_sec
==
0
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
local
->
tps
);
}
// If Timeout time has passed and still in bad state, start adding to ErrorCount
if
(
(
local
->
tpe
).
tv_sec
-
(
local
->
tps
).
tv_sec
>=
op
->
Timeout
&&
(
local
->
tps
).
tv_sec
!=
0
)
op
->
ErrorCount
++
;
// Agent error soft limit reached, tell log (once)
if
(
op
->
ErrorCount
>=
op
->
ErrorSoftLimit
&&
error_count
<
op
->
ErrorSoftLimit
)
{
errh_Warning
(
"IO Agent ErrorSoftLimit reached, '%s'"
,
rp
->
Name
);
}
// Agent error hard limit reached, tell log (once)
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
&&
error_count
<
op
->
ErrorHardLimit
)
{
if
(
op
->
StallAction
==
pwr_eStallActionEnum_EmergencyBreak
)
{
errh_Error
(
"IO Agent ErrorHardLimit reached '%s', IO stopped"
,
rp
->
Name
);
}
else
if
(
op
->
StallAction
==
pwr_eStallActionEnum_ResetInputs
)
{
errh_Error
(
"IO Agent ErrorHardLimit reached '%s', IO input area reset"
,
rp
->
Name
);
}
else
errh_Error
(
"IO Agent ErrorHardLimit reached '%s'"
,
rp
->
Name
);
}
// Agent error hard limit reached, take action (always)
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
if
(
op
->
StallAction
==
pwr_eStallActionEnum_EmergencyBreak
)
{
ctx
->
Node
->
EmergBreakTrue
=
1
;
}
else
if
(
op
->
StallAction
==
pwr_eStallActionEnum_ResetInputs
)
{
memset
(
local
->
tmp_area
,
0
,
local
->
input_area_size
);
}
ret
=
IO__ERRDEVICE
;
}
// Update Proview chan-objects with data from Powerlink process image
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
io_bus_card_read
(
ctx
,
rp
,
cp
,
local
->
tmp_area
,
0
,
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
}
return
ret
;
}
static
pwr_tStatus
IoRackWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sLocalEpl_CNServer
*
local
=
(
io_sLocalEpl_CNServer
*
)
rp
->
Local
;
io_sCard
*
cp
;
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
io_bus_card_write
(
ctx
,
cp
,
local
->
output_area
,
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
}
return
IO__SUCCESS
;
}
#else
static
pwr_tStatus
IoRackInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
return
IO__RELEASEBUILD
;}
static
pwr_tStatus
IoRackClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
return
IO__RELEASEBUILD
;}
static
pwr_tStatus
IoRackRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
return
IO__RELEASEBUILD
;}
static
pwr_tStatus
IoRackWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
return
IO__RELEASEBUILD
;}
#endif
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Epl_CNServer
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_BindIoMethod
(
IoRackRead
),
pwr_BindIoMethod
(
IoRackWrite
),
pwr_NullMethod
};
otherio/lib/rt/src/os_linux/rt_io_m_epl_cnservermodule.c
0 → 100644
View file @
b38c9521
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_card_read.h"
#include "rt_io_card_write.h"
#include "rt_io_msg.h"
#include "pwr_otherioclasses.h"
/*----------------------------------------------------------------------------*\
Init method for the Powerlink module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Read method for the Powerlink module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Write method for the Powerlink module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Close method for the Powerlink module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Epl_CNServerModule
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
otherio/lib/rt/src/os_linux/rt_io_m_epl_mn.c
View file @
b38c9521
...
...
@@ -147,15 +147,6 @@ tEplKernel PUBLIC AppCbEvent(
io_sAgent
*
pUserArg_p
);
tEplKernel
PUBLIC
AppCbSync
(
void
);
pwr_tStatus
io_bus_card_init_pl
(
io_tCtx
ctx
,
io_sCard
*
cp
,
unsigned
int
*
input_area_offset
,
unsigned
int
*
input_area_chansize
,
unsigned
int
*
output_area_offset
,
unsigned
int
*
output_area_chansize
,
pwr_tByteOrderingEnum
byte_order
);
/*----------------------------------------------------------------------------*\
Init method for the Powerlink module
...
...
@@ -281,15 +272,16 @@ static pwr_tStatus IoAgentInit (io_tCtx ctx, io_sAgent *ap) {
struct
sched_param
schedParam
;
// adjust process priority
if
(
nice
(
-
20
)
==
-
1
)
// push nice level in case we have no RTPreempt
{
errh_Error
(
"%s() couldn't set nice value! (%s)"
,
__func__
,
strerror
(
errno
));
}
schedParam
.
__sched_priority
=
MAIN_THREAD_PRIORITY
;
if
(
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
schedParam
)
!=
0
)
{
errh_Error
(
"%s() couldn't set thread scheduling parameters! %d"
,
__func__
,
schedParam
.
__sched_priority
);
}
// push nice level in case we have no RTPreempt
if
(
nice
(
-
20
)
==
-
1
)
{
errh_Error
(
"%s() couldn't set nice value! (%s)"
,
__func__
,
strerror
(
errno
));
}
//schedParam.sched_priority = MIN(sched_get_priority_max(SCHED_FIFO),
// sched_get_priority_min(SCHED_FIFO) + op->Priority);
schedParam
.
__sched_priority
=
op
->
Priority
;
if
(
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
schedParam
)
!=
0
)
{
errh_Error
(
"%s() couldn't set thread scheduling parameters! %d"
,
__func__
,
schedParam
.
__sched_priority
);
}
// binds all openPOWERLINK threads to the second CPU core
cpu_set_t
affinity
;
...
...
otherio/lib/rt/src/rt_io_otherio.meth
View file @
b38c9521
...
...
@@ -30,4 +30,6 @@ Nodave_PLC
Nodave_Transaction
Epl_MN
Epl_Module
Epl_CNServer
Epl_CNServerModule
#endif
\ No newline at end of file
otherio/lib/wb/src/wb_c_epl_mn.cpp
View file @
b38c9521
...
...
@@ -61,7 +61,7 @@ static pwr_tStatus Configure (
ldh_sMenuCall
*
ip
)
{
pwr_tCmd
cmd
=
"openCONFIGURATOR"
;
pwr_tCmd
cmd
=
"
export HOME=$pwrp_login;
openCONFIGURATOR"
;
system
(
cmd
);
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
b38c9521
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X5
49
"
Attr NextCix = "_X4
3
"
Attr NextOix = "_X5
85
"
Attr NextCix = "_X4
5
"
Attr NextTix[0] = "_X17"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
...
...
@@ -8866,7 +8866,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object RtBody $ObjBodyDef 1 01-JUL-2013 17:26:15.35
Body SysBody 04-JUL-2013 08:13:20.05
Attr StructName = "Epl_MN"
Attr NextAix = "_X4
7
"
Attr NextAix = "_X4
8
"
EndBody
!/**
! Used to add a short description of the master
...
...
@@ -8935,6 +8935,13 @@ Volume OtherIO $ClassVolume 0.0.250.10
Attr TypeRef = "pwrb:Type-StallActionEnum"
EndBody
EndObject
Object Priority $Attribute 47 05-JUL-2013 12:21:40.90
Body SysBody 05-JUL-2013 12:21:56.73
Attr PgmName = "Priority"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Timeout $Attribute 38 01-JUL-2013 17:26:15.35
Body SysBody 01-JUL-2013 17:26:15.35
Attr PgmName = "Timeout"
...
...
@@ -9116,16 +9123,278 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndObject
EndObject
Object Template Epl_MN 2158198784 01-JAN-1970 01:00:00.00
Body RtBody 0
4-JUL-2013 08:54:52.00
Body RtBody 0
5-JUL-2013 12:22:16.05
Attr CDCfile = "$pwrp_exe/mnobd.cdc"
Attr Device = "eth0"
Attr NodeId = 240
Attr Process = 128
Attr Priority = 20
Attr ErrorSoftLimit = 25
Attr ErrorHardLimit = 50
EndBody
EndObject
EndObject
Object Epl_CNServer $ClassDef 43 08-JUL-2013 10:32:46.08
Body SysBody 08-JUL-2013 10:33:43.41
Attr Editor = 0
Attr Method = 0
Attr Flags = 10320
EndBody
Object RtBody $ObjBodyDef 1 08-JUL-2013 10:33:15.71
Body SysBody 08-JUL-2013 10:35:31.78
Attr StructName = "Epl_CNServer"
Attr NextAix = "_X65"
EndBody
Object Description $Attribute 48 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Description"
Attr Size = 80
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Device $Attribute 50 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Device"
Attr Size = 80
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object NodeId $Attribute 51 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 15:17:29.33
Attr PgmName = "NodeId"
Attr Size = 2
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object Process $Attribute 52 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Process"
Attr Size = 4
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
Object ThreadObject $Attribute 53 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "ThreadObject"
Attr Size = 8
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
Object StallAction $Attribute 54 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "StallAction"
Attr Size = 4
Attr TypeRef = "pwrb:Type-StallActionEnum"
EndBody
EndObject
Object Priority $Attribute 55 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Priority"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object Timeout $Attribute 56 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Timeout"
Attr Size = 2
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object NmtState $Attribute 57 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "NmtState"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "OtherIO:Type-EplNmtState"
EndBody
EndObject
Object Status $Attribute 58 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "Status"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
Object ErrorCount $Attribute 59 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "ErrorCount"
Attr Size = 2
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object ErrorSoftLimit $Attribute 60 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "ErrorSoftLimit"
Attr Size = 2
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object ErrorHardLimit $Attribute 61 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "ErrorHardLimit"
Attr Size = 2
Attr TypeRef = "pwrs:Type-$UInt16"
EndBody
EndObject
Object InputAreaSize $Attribute 62 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "InputAreaSize"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object OutputAreaSize $Attribute 63 08-JUL-2013 10:17:49.38
Body SysBody 08-JUL-2013 10:17:49.38
Attr PgmName = "OutputAreaSize"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 574 08-JUL-2013 10:17:49.38
Object IoRackInit $Method 575 08-JUL-2013 15:30:22.45
Body SysBody 08-JUL-2013 15:29:51.66
Attr MethodName = "Epl_CNServer-IoRackInit"
EndBody
EndObject
Object IoRackClose $Method 576 08-JUL-2013 15:30:30.65
Body SysBody 08-JUL-2013 15:30:00.15
Attr MethodName = "Epl_CNServer-IoRackClose"
EndBody
EndObject
Object IoRackRead $Method 577 08-JUL-2013 15:30:45.85
Body SysBody 08-JUL-2013 15:30:07.91
Attr MethodName = "Epl_CNServer-IoRackRead"
EndBody
EndObject
Object IoRackWrite $Method 578 08-JUL-2013 15:30:54.23
Body SysBody 08-JUL-2013 15:30:15.18
Attr MethodName = "Epl_CNServer-IoRackWrite"
EndBody
EndObject
EndObject
Object Template Epl_CNServer 2158985216 01-JAN-1970 01:00:00.00
Body RtBody 08-JUL-2013 10:37:34.48
Attr Device = "eth0"
Attr Process = 128
Attr Priority = 20
Attr ErrorSoftLimit = 25
Attr ErrorHardLimit = 50
EndBody
EndObject
EndObject
Object Epl_CnServerModule $ClassDef 44 08-JUL-2013 14:47:28.97
Body SysBody 08-JUL-2013 10:33:59.56
Attr Editor = 0
Attr Method = 0
Attr Flags = 18512
EndBody
Object RtBody $ObjBodyDef 1 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:35:44.53
Attr StructName = "Epl_CNServerModule"
Attr NextAix = "_X42"
EndBody
Object Description $Attribute 33 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "Description"
Attr Size = 80
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Specification $Attribute 34 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "Specification"
Attr Size = 80
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object DataSheet $Attribute 35 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "DataSheet"
Attr Size = 160
Attr TypeRef = "pwrs:Type-$URL"
EndBody
EndObject
Object Process $Attribute 36 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "Process"
Attr Size = 4
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
Object ThreadObject $Attribute 37 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "ThreadObject"
Attr Size = 8
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
Object InputAreaOffset $Attribute 38 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "InputAreaOffset"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object InputAreaSize $Attribute 39 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "InputAreaSize"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object OutputAreaOffset $Attribute 40 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "OutputAreaOffset"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object OutputAreaSize $Attribute 41 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:33:59.56
Attr PgmName = "OutputAreaSize"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 580 08-JUL-2013 10:33:59.56
Object IoCardInit $Method 581 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:35:54.02
Attr MethodName = "Epl_CNServerModule-IoCardInit"
EndBody
EndObject
Object IoCardClose $Method 582 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:36:02.20
Attr MethodName = "Epl_CNServerModule-IoCardClose"
EndBody
EndObject
Object IoCardRead $Method 583 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:36:09.91
Attr MethodName = "Epl_CNServerModule-IoCardRead"
EndBody
EndObject
Object IoCardWrite $Method 584 08-JUL-2013 10:33:59.56
Body SysBody 08-JUL-2013 10:36:16.80
Attr MethodName = "Epl_CNServerModule-IoCardWrite"
EndBody
EndObject
EndObject
Object Template Epl_CnServerModule 2159247360 01-JAN-1970 01:00:00.00
Body RtBody 08-JUL-2013 10:37:52.25
Attr Process = 128
EndBody
EndObject
EndObject
Object EplHandler $ClassDef 41 04-JUL-2013 08:14:02.80
Body SysBody 01-JUL-2013 17:26:15.35
Attr Editor = 0
...
...
src/lib/rt/src/rt_io_bus.c
View file @
b38c9521
...
...
@@ -269,6 +269,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
if
(
chan_di
->
Number
==
0
)
{
*
input_area_offset
+=
*
input_area_chansize
;
*
input_area_chansize
=
GetChanSize
(
chan_di
->
Representation
);
chanp
->
size
=
*
input_area_chansize
;
}
if
(
!
chanp
->
sop
)
continue
;
...
...
@@ -278,6 +279,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
chanp
->
offset
=
*
input_area_offset
;
chanp
->
mask
=
1
<<
chan_di
->
Number
;
chanp
->
size
=
*
input_area_chansize
;
if
(
byte_order
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
chan_di
->
Representation
==
pwr_eDataRepEnum_Bit16
)
chanp
->
mask
=
swap16
(
(
unsigned
short
)
chanp
->
mask
);
...
...
@@ -415,6 +417,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
if
(
chan_do
->
Number
==
0
)
{
*
output_area_offset
+=
*
output_area_chansize
;
*
output_area_chansize
=
GetChanSize
(
chan_do
->
Representation
);
chanp
->
size
=
*
output_area_chansize
;
}
if
(
!
chanp
->
sop
)
continue
;
...
...
@@ -424,6 +427,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
chanp
->
offset
=
*
output_area_offset
;
chanp
->
mask
=
1
<<
chan_do
->
Number
;
chanp
->
size
=
*
output_area_chansize
;
if
(
byte_order
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
chan_do
->
Representation
==
pwr_eDataRepEnum_Bit16
)
chanp
->
mask
=
swap16
(
(
unsigned
short
)
chanp
->
mask
);
...
...
@@ -473,6 +477,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
if
(
chan_d
->
Number
==
0
)
{
*
input_area_offset
+=
*
input_area_chansize
;
*
input_area_chansize
=
GetChanSize
(
chan_d
->
Representation
);
chanp
->
size
=
*
input_area_chansize
;
}
if
(
!
chanp
->
sop
)
continue
;
...
...
@@ -482,6 +487,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
chanp
->
offset
=
*
input_area_offset
;
chanp
->
mask
=
1
<<
chan_d
->
Number
;
chanp
->
size
=
*
input_area_chansize
;
if
(
byte_order
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
chan_d
->
Representation
==
pwr_eDataRepEnum_Bit16
)
chanp
->
mask
=
swap16
(
(
unsigned
short
)
chanp
->
mask
);
...
...
@@ -494,6 +500,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
if
(
chan_d
->
Number
==
0
)
{
*
output_area_offset
+=
*
output_area_chansize
;
*
output_area_chansize
=
GetChanSize
(
chan_d
->
Representation
);
chanp
->
size
=
*
output_area_chansize
;
}
if
(
!
chanp
->
sop
)
continue
;
...
...
@@ -503,6 +510,7 @@ pwr_tStatus io_bus_card_init( io_tCtx ctx,
chanp
->
offset
=
*
output_area_offset
;
chanp
->
mask
=
1
<<
chan_d
->
Number
;
chanp
->
size
=
*
output_area_chansize
;
if
(
byte_order
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
chan_d
->
Representation
==
pwr_eDataRepEnum_Bit16
)
chanp
->
mask
=
swap16
(
(
unsigned
short
)
chanp
->
mask
);
...
...
src/tools/pwre/src/os_linux/pwre_configure.sh
View file @
b38c9521
...
...
@@ -142,8 +142,14 @@ pwre_config_check_lib()
fi
if
test
$libfound
-eq
0
;
then
lib_array[
$lib_cnt
]=
$libdir
lib_cnt
=
$((
lib_cnt+1
))
if
test
$4
==
"powerlink"
;
then
lib_path
=
$libdir
elif
test
$4
==
"powerlinkcn"
;
then
lib_path
=
$libdir
else
lib_array[
$lib_cnt
]=
$libdir
lib_cnt
=
$((
lib_cnt+1
))
fi
fi
lib
=
${
file
##/*/lib
}
...
...
@@ -162,7 +168,9 @@ pwre_config_check_lib()
elif
test
$4
==
"libusb"
;
then
conf_lib
=
$conf_lib
" -lusb-1.0"
elif
test
$4
==
"powerlink"
;
then
conf_libpowerlink
=
$conf_libpowerlink
" -l
${
lib
%.*
}
"
conf_libpowerlink
=
$conf_libpowerlink
" -L
$lib_path
-l
${
lib
%.*
}
"
elif
test
$4
==
"powerlinkcn"
;
then
conf_libpowerlinkcn
=
$conf_libpowerlinkcn
" -L
$lib_path
-l
${
lib
%.*
}
"
else
conf_lib
=
$conf_lib
" -l
${
lib
%%.*
}
"
fi
...
...
@@ -433,7 +441,8 @@ else
pwre_config_check_lib libpnioif PNAK lib pnak 1
"/usr/lib/libpnioif.a:/usr/local/lib/libpnioif.a"
pwre_config_check_lib libusb LIBUSB lib libusb 1
"/usr/lib/libusb-1.0.so:/usr/lib/
$hwpl
-linux-
$gnu
/libusb-1.0.so"
pwre_config_check_lib powerlink POWERLINK lib powerlink 1
"
$epl
/build/Examples/X86/Generic/powerlink_user_lib/libpowerlink.a"
pwre_config_check_lib powerlinkcn POWERLINKCN lib powerlinkcn 1
"
$epl
/buildcn/Examples/X86/Generic/powerlink_user_lib/libpowerlink.a"
pwre_config_check_include mq MQ 0
"/usr/local/dmq/include/p_entry.h"
pwre_config_check_include wmq WMQ 1
"/opt/mqm/inc/cmqc.h"
pwre_config_check_include cifx CIFX 1
"/usr/local/include/cifx/cifxlinux.h"
...
...
@@ -465,6 +474,7 @@ else
echo
"export pwre_conf_libpwrotherio=
\"
-lpwr_usbio_dummy -lpwr_usb_dummy -lpwr_cifx_dummy -lpwr_nodave_dummy -lpwr_epl_dummy
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrprofibus=
\"
-lpwr_pnak_dummy
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrpowerlink=
\"
$conf_libpowerlink
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrpowerlinkcn=
\"
$conf_libpowerlinkcn
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrxtt=
\"
-lpwr_xtt -lpwr_ge -lpwr_cow -lpwr_flow -lpwr_glow
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrxttgtk=
\"
-lpwr_xtt_gtk -lpwr_ge_gtk -lpwr_cow_gtk -lpwr_flow_gtk -lpwr_glow_gtk
\"
"
>>
$cfile
echo
"export pwre_conf_libpwrxttmotif=
\"
-lpwr_xtt_motif -lpwr_ge_motif -lpwr_cow_motif -lpwr_flow_motif -lpwr_glow_motif
\"
"
>>
$cfile
...
...
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
b38c9521
...
...
@@ -332,8 +332,8 @@ palette NavigatorPalette
class EPl_Module
menu Server
{
class Epl_Server
class Epl_ServerModule
class Epl_
CN
Server
class Epl_
CN
ServerModule
}
}
menu Profibus
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment