Commit 900f76ce authored by Marcus Nordenberg's avatar Marcus Nordenberg

Properly propagate emergency break to Profinet

parent 63a51915
...@@ -64,12 +64,11 @@ ...@@ -64,12 +64,11 @@
#include "rt_io_pnak_locals.h" #include "rt_io_pnak_locals.h"
#include "rt_pn_iface.h" #include "rt_pn_iface.h"
// static int count;
static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap); static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap);
static pwr_tStatus IoAgentRead(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 IoAgentWrite(io_tCtx ctx, io_sAgent* ap);
static pwr_tStatus IoAgentClose(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 Init method for the Pb_profiboard agent
...@@ -345,6 +344,21 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap) ...@@ -345,6 +344,21 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
return sts; 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. 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) ...@@ -352,4 +366,4 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
pwr_dExport pwr_BindIoMethods(PnControllerSoftingPNAK) pwr_dExport pwr_BindIoMethods(PnControllerSoftingPNAK)
= { pwr_BindIoMethod(IoAgentInit), pwr_BindIoMethod(IoAgentRead), = { pwr_BindIoMethod(IoAgentInit), pwr_BindIoMethod(IoAgentRead),
pwr_BindIoMethod(IoAgentWrite), pwr_BindIoMethod(IoAgentClose), 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