[FIX] Don't change priority of ksoftirq on kernels >=3.6

Beginning with 3.6.1-rt1 the RTpreempt kernel provides split softirq locks.
This replaces split softirq from 2.6 RT kernels.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Disable procfs entry of Linux kernel module

because it doesn't work anymore on newer kernel releases.
The function create_proc_entry has been killed in kernel V3.10. There may
exist further changes of procfs interface too.

The openPOWERLINK procfs implementation needs adaption. Until that has been
done, the procfs entry is disabled.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Fix wrong assignment of node ID in EplDllkPResChainingDisable()

The function EplDllkPResChainingDisable() assigned the node ID to
the m_abFilterMask field of the filter descriptor rather than the
m_abFilterValue field.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Don't crash on PRes reception with high node-IDs

CN running 1.8.4 crashed\hung with other higher node-IDs in the network.
This was due to null pointer dereference error in sharedbuffer thread,
because EPL_NMT_MAX_NODE_ID is 0 on simple CN implementations.
Fix the PresForwarding implementation to avoid memory-corruption.

Fix is based on work by John <chidrupaya.sr@kalycito.com>.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Pdou: Mixed up m_abPdoIdToChannelIdTx and m_abPdoIdToChannelIdRx

Use m_abPdoIdToChannelIdTx instead of m_abPdoIdToChannelIdRx when it's
about the TPDOs.

Currently, this fix is only a cosmetic change, because both arrays have the
very same size in those cases. But in the future this might change and we
will have some very mysterious bugs.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Reimplement handling of PRes in transition DLL_CT4

in state DLL_CS_WAIT_SOC as specified in EPSG 301.

This covers the following situations on CN implementations:
1. Just one SoC from MN is lost, because of EMI for example. So the next
   cycle starts with a PRes instead of SoC.
2. Multiple SoCs and the frames in between were lost, because of short
   cable disconnect for example (but frame timeout didn't occur yet). So
   the next cycle which is received by MN starts with a PRes.
3. A late PRes from another CN is received (PRes between SoA and SoC). On
   this CN this is handled as a loss of SoC, but the next SoC isn't
   actually lost. There is just a wrong PRes on the network.

The latter situation might be the reason why the PRes case has been
commented since the early versions of this stack. Why should one CN care
about mistakes of another CN? The answer is that the POWERLINK network
shall provide a deterministic real-time communication and errors must not
remain undetected.

Futhermore, with this fix we indirectly catch the case that an
openPOWERLINK MN (without further hardware support like frame timestamps)
cannot detect late PRes after the SoA. Now another CN would increment its
Loss-of-SoC error counter and force it to go back to PreOp1 when the
threshold is exceeded. For the user the root cause of this error is a
little bit hard to detect, but the error is unveiled (if there are at least
too CNs in the network).

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Cfm: Fix kEplApiSdoBusyIntern after CN reset command

The intermediate state InternalAbort must be left, when SDO connection is
closed after node reset or IdentResponse. Otherwise it remains in this
state and the application isn't allowed anymore to perform SDO transfers
to this CN.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Fix compiler warning about unhandled case

kEplMsgTypeAInv shall lead to error until Multiple ASnd is implemented on
MN side.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Fix compiler warning about different pointer types

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Dllk: Remove needless semicolon

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] Cfmu: Fix compiler warning about signed/unsigned compare

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] ProcessImage: Use proper ref counters for Linux kernel

This fixes a long standing kernel crash that happened when user space
application (e.g. console or Qt demo) is terminated via CTRL-C.

In case of CTRL-C the wait_for_completion_interruptible() call inside
EplApiProcessImageExchange() exited and the completion structure is freed.
Later EplApiProcessImageFree() accesses this structure with
EplApiProcessImageSignalCompletion() again, because the copy job is still
in the queue. The write access to already freed memory crashed the kernel.

This is solved now by using reference counters (see kref.h) for the
internal completion structure. So this structure is freed after both
EplApiProcessImageSignalCompletion() and EplApiProcessImageExchange() have
finished their job.

Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
[FIX] ioctl in EplApiShutdown() need to wait for NMT_GS_OFF

The device /dev/epl is not correctly closed by EplApiShutdown()
when it is in EPL_STATE_RUNNING state.
The ioctl need to wait for EPL_STATE_SHUTDOWN state.

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[Fix] Linux Powerlink user lib: add INSTALL target

If only the userspace stack is build there is nothing to install.
So make install fail since there is no rule to make target "install"

Just install libpowerlink.a in this case.

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] EdrvCyclic: Fix compiler warning

EdrvCyclic.c: In function ‘EdrvCyclicProcessTxBufferList’:
EdrvCyclic.c:784:25: attention : unused variable ‘bFirstPacket’ [-Wunused-variable]

bFirstPacket is only used if EDRV_USE_TTTX != FALSE

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] EplApiGeneric: fix compiler warning

EplApiGeneric.c:229:1: attention : function declaration isn’t a prototype [-Wstrict-prototypes]
 static tEplKernel PUBLIC EplApiUpdateSdoConfig();
 ^
EplApiGeneric.c:2554:26: attention : function declaration isn’t a prototype [-Wstrict-prototypes]
 static tEplKernel PUBLIC EplApiUpdateSdoConfig()

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] EplEventk: remove unused variable

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] EplDllkCal: remove unused variable

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] EplNmtMnu: fix compiler warning

Initialize uiNodeId_tmp to non-existent nodeId.

EplNmtMnu.c: In function 'EplNmtMnuProcessEvent':
EplNmtMnu.c:1921:12: warning: 'uiNodeId_tmp' may be used uninitialized in this function [-Wuninitialized]
EplNmtMnu.c:1523:33: note: 'uiNodeId_tmp' was declared here

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
[FIX] ShbIpc-LinuxPthreads: fix compiler warning

ShbIpc-LinuxPthreads.c: In function 'ShbIpcStartSignalingNewData':
ShbIpc-LinuxPthreads.c:585:25: warning: variable 'pShbMemHeader' set but not used [-Wunused-but-set-variable]
ShbIpc-LinuxPthreads.c: In function 'ShbIpcStartSignalingJobReady':
ShbIpc-LinuxPthreads.c:764:21: warning: variable 'pShbMemHeader' set but not used [-Wunused-but-set-variable]
SharedBuff/ShbIpc-LinuxPthreads.c: In function 'ShbIpcSignalJobReady':
ShbIpc-LinuxPthreads.c:821:25: warning: variable 'pShbMemInst' set but not used [-Wunused-but-set-variable]

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>