Commit 64978059 authored by Marcus Nordenberg's avatar Marcus Nordenberg

Merge branch 'profinet-safety-fix'

parents 63a51915 900f76ce
......@@ -64,12 +64,11 @@
#include "rt_io_pnak_locals.h"
#include "rt_pn_iface.h"
// static int count;
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);
static pwr_tStatus IoAgentSwap(io_tCtx ctx, io_sAgent* ap);
/*----------------------------------------------------------------------------*\
Init method for the Pb_profiboard agent
......@@ -345,6 +344,21 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
return sts;
}
static pwr_tStatus IoAgentSwap(io_tCtx ctx, io_sAgent* ap, io_eEvent event)
{
switch (event) {
case io_eEvent_EmergencyBreak:
case io_eEvent_IoCommEmergencyBreak:
errh_Fatal("Emergency break detected shutting down profinet");
IoAgentClose(ctx, ap);
break;
default:
break;
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
......@@ -352,4 +366,4 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
pwr_dExport pwr_BindIoMethods(PnControllerSoftingPNAK)
= { pwr_BindIoMethod(IoAgentInit), pwr_BindIoMethod(IoAgentRead),
pwr_BindIoMethod(IoAgentWrite), pwr_BindIoMethod(IoAgentClose),
pwr_NullMethod };
pwr_BindIoMethod(IoAgentSwap), pwr_NullMethod };
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