1
0
Fork 0

Staging: remove epl driver

This is no longer maintained upstream, and no one cares about it at all,
so delete it.

The fact that it is duplicating an existing network driver also is a
good reason to remove it, it's causing nothing but trouble right now.

Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
wifi-calibration
Greg Kroah-Hartman 2009-07-28 17:05:51 -07:00
parent 51be97961f
commit 0841a555af
105 changed files with 0 additions and 50482 deletions

View File

@ -95,8 +95,6 @@ source "drivers/staging/mimio/Kconfig"
source "drivers/staging/frontier/Kconfig"
source "drivers/staging/epl/Kconfig"
source "drivers/staging/android/Kconfig"
source "drivers/staging/dream/Kconfig"

View File

@ -30,7 +30,6 @@ obj-$(CONFIG_RTL8192SU) += rtl8192su/
obj-$(CONFIG_USB_RSPI) += rspiusb/
obj-$(CONFIG_INPUT_MIMIO) += mimio/
obj-$(CONFIG_TRANZPORT) += frontier/
obj-$(CONFIG_EPL) += epl/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_ANDROID) += dream/
obj-$(CONFIG_DST) += dst/

View File

@ -1,425 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: header file for benchmarking
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: Benchmark.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
2006/08/16 d.k.: start of implementation
****************************************************************************/
#ifndef _BENCHMARK_H_
#define _BENCHMARK_H_
#include "global.h"
#include <linux/kernel.h>
#ifdef CONFIG_COLDFIRE
#include <asm/coldfire.h>
#include <asm/m5485gpio.h>
#define BENCHMARK_SET(x) MCF_GPIO_PODR_PCIBG |= (1 << (x)) // (x+1)
#define BENCHMARK_RESET(x) MCF_GPIO_PODR_PCIBG &= ~(1 << (x)) // (x+1)
#define BENCHMARK_TOGGLE(x) MCF_GPIO_PODR_PCIBR ^= (1 << (x - 5))
#else
#undef BENCHMARK_MODULES
#define BENCHMARK_MODULES 0x00000000
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef BENCHMARK_MODULES
#define BENCHMARK_MODULES 0x00000000
#endif
#define BENCHMARK_MOD_01 0x00000001
#define BENCHMARK_MOD_02 0x00000002
#define BENCHMARK_MOD_03 0x00000004
#define BENCHMARK_MOD_04 0x00000008
#define BENCHMARK_MOD_05 0x00000010
#define BENCHMARK_MOD_06 0x00000020
#define BENCHMARK_MOD_07 0x00000040
#define BENCHMARK_MOD_08 0x00000080
#define BENCHMARK_MOD_09 0x00000100
#define BENCHMARK_MOD_10 0x00000200
#define BENCHMARK_MOD_11 0x00000400
#define BENCHMARK_MOD_12 0x00000800
#define BENCHMARK_MOD_13 0x00001000
#define BENCHMARK_MOD_14 0x00002000
#define BENCHMARK_MOD_15 0x00004000
#define BENCHMARK_MOD_16 0x00008000
#define BENCHMARK_MOD_17 0x00010000
#define BENCHMARK_MOD_18 0x00020000
#define BENCHMARK_MOD_19 0x00040000
#define BENCHMARK_MOD_20 0x00080000
#define BENCHMARK_MOD_21 0x00100000
#define BENCHMARK_MOD_22 0x00200000
#define BENCHMARK_MOD_23 0x00400000
#define BENCHMARK_MOD_24 0x00800000
#define BENCHMARK_MOD_25 0x01000000
#define BENCHMARK_MOD_26 0x02000000
#define BENCHMARK_MOD_27 0x04000000
#define BENCHMARK_MOD_28 0x08000000
#define BENCHMARK_MOD_29 0x10000000
#define BENCHMARK_MOD_30 0x20000000
#define BENCHMARK_MOD_31 0x40000000
#define BENCHMARK_MOD_32 0x80000000
#if (BENCHMARK_MODULES & BENCHMARK_MOD_01)
#define BENCHMARK_MOD_01_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_01_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_01_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_01_SET(x)
#define BENCHMARK_MOD_01_RESET(x)
#define BENCHMARK_MOD_01_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_02)
#define BENCHMARK_MOD_02_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_02_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_02_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_02_SET(x)
#define BENCHMARK_MOD_02_RESET(x)
#define BENCHMARK_MOD_02_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_03)
#define BENCHMARK_MOD_03_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_03_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_03_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_03_SET(x)
#define BENCHMARK_MOD_03_RESET(x)
#define BENCHMARK_MOD_03_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_04)
#define BENCHMARK_MOD_04_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_04_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_04_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_04_SET(x)
#define BENCHMARK_MOD_04_RESET(x)
#define BENCHMARK_MOD_04_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_05)
#define BENCHMARK_MOD_05_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_05_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_05_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_05_SET(x)
#define BENCHMARK_MOD_05_RESET(x)
#define BENCHMARK_MOD_05_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_06)
#define BENCHMARK_MOD_06_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_06_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_06_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_06_SET(x)
#define BENCHMARK_MOD_06_RESET(x)
#define BENCHMARK_MOD_06_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_07)
#define BENCHMARK_MOD_07_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_07_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_07_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_07_SET(x)
#define BENCHMARK_MOD_07_RESET(x)
#define BENCHMARK_MOD_07_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_08)
#define BENCHMARK_MOD_08_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_08_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_08_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_08_SET(x)
#define BENCHMARK_MOD_08_RESET(x)
#define BENCHMARK_MOD_08_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_09)
#define BENCHMARK_MOD_09_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_09_RESET(x) BENCHMARK_RESET(x)
#define BENCHMARK_MOD_09_TOGGLE(x) BENCHMARK_TOGGLE(x)
#else
#define BENCHMARK_MOD_09_SET(x)
#define BENCHMARK_MOD_09_RESET(x)
#define BENCHMARK_MOD_09_TOGGLE(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_10)
#define BENCHMARK_MOD_10_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_10_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_10_SET(x)
#define BENCHMARK_MOD_10_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_11)
#define BENCHMARK_MOD_11_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_11_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_11_SET(x)
#define BENCHMARK_MOD_11_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_12)
#define BENCHMARK_MOD_12_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_12_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_12_SET(x)
#define BENCHMARK_MOD_12_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_13)
#define BENCHMARK_MOD_13_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_13_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_13_SET(x)
#define BENCHMARK_MOD_13_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_14)
#define BENCHMARK_MOD_14_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_14_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_14_SET(x)
#define BENCHMARK_MOD_14_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_15)
#define BENCHMARK_MOD_15_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_15_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_15_SET(x)
#define BENCHMARK_MOD_15_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_16)
#define BENCHMARK_MOD_16_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_16_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_16_SET(x)
#define BENCHMARK_MOD_16_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_17)
#define BENCHMARK_MOD_17_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_17_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_17_SET(x)
#define BENCHMARK_MOD_17_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_18)
#define BENCHMARK_MOD_18_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_18_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_18_SET(x)
#define BENCHMARK_MOD_18_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_19)
#define BENCHMARK_MOD_19_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_19_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_19_SET(x)
#define BENCHMARK_MOD_19_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_20)
#define BENCHMARK_MOD_20_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_20_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_20_SET(x)
#define BENCHMARK_MOD_20_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_21)
#define BENCHMARK_MOD_21_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_21_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_21_SET(x)
#define BENCHMARK_MOD_21_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_22)
#define BENCHMARK_MOD_22_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_22_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_22_SET(x)
#define BENCHMARK_MOD_22_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_23)
#define BENCHMARK_MOD_23_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_23_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_23_SET(x)
#define BENCHMARK_MOD_23_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_24)
#define BENCHMARK_MOD_24_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_24_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_24_SET(x)
#define BENCHMARK_MOD_24_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_25)
#define BENCHMARK_MOD_25_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_25_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_25_SET(x)
#define BENCHMARK_MOD_25_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_26)
#define BENCHMARK_MOD_26_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_26_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_26_SET(x)
#define BENCHMARK_MOD_26_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_27)
#define BENCHMARK_MOD_27_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_27_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_27_SET(x)
#define BENCHMARK_MOD_27_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_28)
#define BENCHMARK_MOD_28_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_28_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_28_SET(x)
#define BENCHMARK_MOD_28_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_29)
#define BENCHMARK_MOD_29_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_29_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_29_SET(x)
#define BENCHMARK_MOD_29_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_30)
#define BENCHMARK_MOD_30_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_30_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_30_SET(x)
#define BENCHMARK_MOD_30_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_31)
#define BENCHMARK_MOD_31_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_31_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_31_SET(x)
#define BENCHMARK_MOD_31_RESET(x)
#endif
#if (BENCHMARK_MODULES & BENCHMARK_MOD_32)
#define BENCHMARK_MOD_32_SET(x) BENCHMARK_SET(x)
#define BENCHMARK_MOD_32_RESET(x) BENCHMARK_RESET(x)
#else
#define BENCHMARK_MOD_32_SET(x)
#define BENCHMARK_MOD_32_RESET(x)
#endif
//---------------------------------------------------------------------------
// modul global types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
#endif // _BENCHMARK_H_

View File

@ -1,694 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: Debug interface
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: Debug.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
****************************************************************************/
#ifndef _DEBUG_H_
#define _DEBUG_H_
#include "global.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// global const defines
//---------------------------------------------------------------------------
// These definitions are important for level-debug traces.
// A macro DEBUG_GLB_LVL() defines the current debug-level using following bis.
// If the corresponding bit is set then trace message will be printed out
// (only if NDEBUG is not defined). The upper debug-levels are reserved for
// the debug-levels ALWAYS, ERROR and ASSERT.
#define DEBUG_LVL_01 0x00000001
#define DEBUG_LVL_02 0x00000002
#define DEBUG_LVL_03 0x00000004
#define DEBUG_LVL_04 0x00000008
#define DEBUG_LVL_05 0x00000010
#define DEBUG_LVL_06 0x00000020
#define DEBUG_LVL_07 0x00000040
#define DEBUG_LVL_08 0x00000080
#define DEBUG_LVL_09 0x00000100
#define DEBUG_LVL_10 0x00000200
#define DEBUG_LVL_11 0x00000400
#define DEBUG_LVL_12 0x00000800
#define DEBUG_LVL_13 0x00001000
#define DEBUG_LVL_14 0x00002000
#define DEBUG_LVL_15 0x00004000
#define DEBUG_LVL_16 0x00008000
#define DEBUG_LVL_17 0x00010000
#define DEBUG_LVL_18 0x00020000
#define DEBUG_LVL_19 0x00040000
#define DEBUG_LVL_20 0x00080000
#define DEBUG_LVL_21 0x00100000
#define DEBUG_LVL_22 0x00200000
#define DEBUG_LVL_23 0x00400000
#define DEBUG_LVL_24 0x00800000
#define DEBUG_LVL_25 0x01000000
#define DEBUG_LVL_26 0x02000000
#define DEBUG_LVL_27 0x04000000
#define DEBUG_LVL_28 0x08000000
#define DEBUG_LVL_29 0x10000000
#define DEBUG_LVL_ASSERT 0x20000000
#define DEBUG_LVL_ERROR 0x40000000
#define DEBUG_LVL_ALWAYS 0x80000000
//---------------------------------------------------------------------------
// global types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// global vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// global function prototypes
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// global macros
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// this macro defines a version string
//---------------------------------------------------------------------------
// this macro defines a build info string (e.g. for using in printf())
#define DEBUG_MAKE_BUILD_INFO(prefix,product,prodid,descr,verstr,author) "\n" \
prefix "***************************************************\n" \
prefix "Project: " product ", " prodid "\n" \
prefix "Descript.: " descr "\n" \
prefix "Author: " author "\n" \
prefix "Date: " __DATE__ "\n" \
prefix "Version: " verstr "\n" \
prefix "***************************************************\n\n"
//---------------------------------------------------------------------------
// The default debug-level is: ERROR and ALWAYS.
// You can define an other debug-level in project settings.
#ifndef DEF_DEBUG_LVL
#define DEF_DEBUG_LVL (DEBUG_LVL_ALWAYS | DEBUG_LVL_ERROR)
#endif
#ifndef DEBUG_GLB_LVL
#define DEBUG_GLB_LVL() (DEF_DEBUG_LVL)
#endif
//---------------------------------------------------------------------------
// At microcontrollers we do reduce the memory usage by deleting DEBUG_TRACE-lines
// (compiler does delete the lines).
//
// Here the parameter 'lvl' can only be used with one debug-level.
//
// Example: DEBUG_TRACE1(DEBUG_LVL_ERROR, "error code %d", dwRet);
#if (DEBUG_GLB_LVL() & DEBUG_LVL_ALWAYS)
#define DEBUG_LVL_ALWAYS_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_ALWAYS_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_ALWAYS_TRACE0(str)
#define DEBUG_LVL_ALWAYS_TRACE1(str,p1)
#define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2)
#define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_ERROR)
#define DEBUG_LVL_ERROR_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_ERROR_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_ERROR_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_ERROR_TRACE0(str)
#define DEBUG_LVL_ERROR_TRACE1(str,p1)
#define DEBUG_LVL_ERROR_TRACE2(str,p1,p2)
#define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)
#define DEBUG_LVL_ASSERT_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_ASSERT_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_ASSERT_TRACE0(str)
#define DEBUG_LVL_ASSERT_TRACE1(str,p1)
#define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2)
#define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_29)
#define DEBUG_LVL_29_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_29_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_29_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_29_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_29_TRACE0(str)
#define DEBUG_LVL_29_TRACE1(str,p1)
#define DEBUG_LVL_29_TRACE2(str,p1,p2)
#define DEBUG_LVL_29_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_28)
#define DEBUG_LVL_28_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_28_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_28_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_28_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_28_TRACE0(str)
#define DEBUG_LVL_28_TRACE1(str,p1)
#define DEBUG_LVL_28_TRACE2(str,p1,p2)
#define DEBUG_LVL_28_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_27)
#define DEBUG_LVL_27_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_27_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_27_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_27_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_27_TRACE0(str)
#define DEBUG_LVL_27_TRACE1(str,p1)
#define DEBUG_LVL_27_TRACE2(str,p1,p2)
#define DEBUG_LVL_27_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_26)
#define DEBUG_LVL_26_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_26_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_26_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_26_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_26_TRACE0(str)
#define DEBUG_LVL_26_TRACE1(str,p1)
#define DEBUG_LVL_26_TRACE2(str,p1,p2)
#define DEBUG_LVL_26_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_25)
#define DEBUG_LVL_25_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_25_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_25_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_25_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_25_TRACE0(str)
#define DEBUG_LVL_25_TRACE1(str,p1)
#define DEBUG_LVL_25_TRACE2(str,p1,p2)
#define DEBUG_LVL_25_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_24)
#define DEBUG_LVL_24_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_24_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_24_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_24_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_24_TRACE0(str)
#define DEBUG_LVL_24_TRACE1(str,p1)
#define DEBUG_LVL_24_TRACE2(str,p1,p2)
#define DEBUG_LVL_24_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_23)
#define DEBUG_LVL_23_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_23_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_23_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_23_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_23_TRACE0(str)
#define DEBUG_LVL_23_TRACE1(str,p1)
#define DEBUG_LVL_23_TRACE2(str,p1,p2)
#define DEBUG_LVL_23_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_22)
#define DEBUG_LVL_22_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_22_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_22_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_22_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_22_TRACE0(str)
#define DEBUG_LVL_22_TRACE1(str,p1)
#define DEBUG_LVL_22_TRACE2(str,p1,p2)
#define DEBUG_LVL_22_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_21)
#define DEBUG_LVL_21_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_21_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_21_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_21_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_21_TRACE0(str)
#define DEBUG_LVL_21_TRACE1(str,p1)
#define DEBUG_LVL_21_TRACE2(str,p1,p2)
#define DEBUG_LVL_21_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_20)
#define DEBUG_LVL_20_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_20_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_20_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_20_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_20_TRACE0(str)
#define DEBUG_LVL_20_TRACE1(str,p1)
#define DEBUG_LVL_20_TRACE2(str,p1,p2)
#define DEBUG_LVL_20_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_19)
#define DEBUG_LVL_19_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_19_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_19_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_19_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_19_TRACE0(str)
#define DEBUG_LVL_19_TRACE1(str,p1)
#define DEBUG_LVL_19_TRACE2(str,p1,p2)
#define DEBUG_LVL_19_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_18)
#define DEBUG_LVL_18_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_18_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_18_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_18_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_18_TRACE0(str)
#define DEBUG_LVL_18_TRACE1(str,p1)
#define DEBUG_LVL_18_TRACE2(str,p1,p2)
#define DEBUG_LVL_18_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_17)
#define DEBUG_LVL_17_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_17_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_17_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_17_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_17_TRACE0(str)
#define DEBUG_LVL_17_TRACE1(str,p1)
#define DEBUG_LVL_17_TRACE2(str,p1,p2)
#define DEBUG_LVL_17_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_16)
#define DEBUG_LVL_16_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_16_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_16_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_16_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_16_TRACE0(str)
#define DEBUG_LVL_16_TRACE1(str,p1)
#define DEBUG_LVL_16_TRACE2(str,p1,p2)
#define DEBUG_LVL_16_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_15)
#define DEBUG_LVL_15_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_15_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_15_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_15_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_15_TRACE0(str)
#define DEBUG_LVL_15_TRACE1(str,p1)
#define DEBUG_LVL_15_TRACE2(str,p1,p2)
#define DEBUG_LVL_15_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_14)
#define DEBUG_LVL_14_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_14_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_14_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_14_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_14_TRACE0(str)
#define DEBUG_LVL_14_TRACE1(str,p1)
#define DEBUG_LVL_14_TRACE2(str,p1,p2)
#define DEBUG_LVL_14_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_13)
#define DEBUG_LVL_13_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_13_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_13_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_13_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_13_TRACE0(str)
#define DEBUG_LVL_13_TRACE1(str,p1)
#define DEBUG_LVL_13_TRACE2(str,p1,p2)
#define DEBUG_LVL_13_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_12)
#define DEBUG_LVL_12_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_12_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_12_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_12_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_12_TRACE0(str)
#define DEBUG_LVL_12_TRACE1(str,p1)
#define DEBUG_LVL_12_TRACE2(str,p1,p2)
#define DEBUG_LVL_12_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_11)
#define DEBUG_LVL_11_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_11_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_11_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_11_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_11_TRACE0(str)
#define DEBUG_LVL_11_TRACE1(str,p1)
#define DEBUG_LVL_11_TRACE2(str,p1,p2)
#define DEBUG_LVL_11_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_10)
#define DEBUG_LVL_10_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_10_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_10_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_10_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_10_TRACE0(str)
#define DEBUG_LVL_10_TRACE1(str,p1)
#define DEBUG_LVL_10_TRACE2(str,p1,p2)
#define DEBUG_LVL_10_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_09)
#define DEBUG_LVL_09_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_09_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_09_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_09_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_09_TRACE0(str)
#define DEBUG_LVL_09_TRACE1(str,p1)
#define DEBUG_LVL_09_TRACE2(str,p1,p2)
#define DEBUG_LVL_09_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_08)
#define DEBUG_LVL_08_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_08_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_08_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_08_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_08_TRACE0(str)
#define DEBUG_LVL_08_TRACE1(str,p1)
#define DEBUG_LVL_08_TRACE2(str,p1,p2)
#define DEBUG_LVL_08_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_07)
#define DEBUG_LVL_07_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_07_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_07_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_07_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_07_TRACE0(str)
#define DEBUG_LVL_07_TRACE1(str,p1)
#define DEBUG_LVL_07_TRACE2(str,p1,p2)
#define DEBUG_LVL_07_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_06)
#define DEBUG_LVL_06_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_06_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_06_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_06_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_06_TRACE0(str)
#define DEBUG_LVL_06_TRACE1(str,p1)
#define DEBUG_LVL_06_TRACE2(str,p1,p2)
#define DEBUG_LVL_06_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_05)
#define DEBUG_LVL_05_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_05_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_05_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_05_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_05_TRACE0(str)
#define DEBUG_LVL_05_TRACE1(str,p1)
#define DEBUG_LVL_05_TRACE2(str,p1,p2)
#define DEBUG_LVL_05_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_04)
#define DEBUG_LVL_04_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_04_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_04_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_04_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_04_TRACE0(str)
#define DEBUG_LVL_04_TRACE1(str,p1)
#define DEBUG_LVL_04_TRACE2(str,p1,p2)
#define DEBUG_LVL_04_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_03)
#define DEBUG_LVL_03_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_03_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_03_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_03_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_03_TRACE0(str)
#define DEBUG_LVL_03_TRACE1(str,p1)
#define DEBUG_LVL_03_TRACE2(str,p1,p2)
#define DEBUG_LVL_03_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_02)
#define DEBUG_LVL_02_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_02_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_02_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_02_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_02_TRACE0(str)
#define DEBUG_LVL_02_TRACE1(str,p1)
#define DEBUG_LVL_02_TRACE2(str,p1,p2)
#define DEBUG_LVL_02_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4)
#endif
#if (DEBUG_GLB_LVL() & DEBUG_LVL_01)
#define DEBUG_LVL_01_TRACE0(str) TRACE0(str)
#define DEBUG_LVL_01_TRACE1(str,p1) TRACE1(str,p1)
#define DEBUG_LVL_01_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
#define DEBUG_LVL_01_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
#else
#define DEBUG_LVL_01_TRACE0(str)
#define DEBUG_LVL_01_TRACE1(str,p1)
#define DEBUG_LVL_01_TRACE2(str,p1,p2)
#define DEBUG_LVL_01_TRACE3(str,p1,p2,p3)
#define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4)
#endif
#define DEBUG_TRACE0(lvl,str) lvl##_TRACE0(str)
#define DEBUG_TRACE1(lvl,str,p1) lvl##_TRACE1(str,p1)
#define DEBUG_TRACE2(lvl,str,p1,p2) lvl##_TRACE2(str,p1,p2)
#define DEBUG_TRACE3(lvl,str,p1,p2,p3) lvl##_TRACE3(str,p1,p2,p3)
#define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) lvl##_TRACE4(str,p1,p2,p3,p4)
//---------------------------------------------------------------------------
// The macro DEBUG_DUMP_DATA() can be used with the same debug-levels to dump
// out data bytes. Function DumpData() has to be included.
// NOTE: DUMP_DATA has to be defined in project settings.
#if (!defined (NDEBUG) && defined (DUMP_DATA))
#ifdef __cplusplus
extern "C" {
#endif
void DumpData(char *szStr_p, u8 *pbData_p, u16 wSize_p);
#ifdef __cplusplus
} // von extern "C"
#endif
#define DEBUG_DUMP_DATA(lvl,str,ptr,siz) if ((DEBUG_GLB_LVL() & (lvl))==(lvl)) \
DumpData (str, (u8 *)(ptr), (u16)(siz));
#else
#define DEBUG_DUMP_DATA(lvl,str,ptr,siz)
#endif
//---------------------------------------------------------------------------
// The macro DEBUG_ASSERT() can be used to print out an error string if the
// parametered expresion does not result TRUE.
// NOTE: If DEBUG_KEEP_ASSERT is defined, then DEBUG_ASSERT-line will not be
// deleted from compiler (in release version too).
#if !defined (NDEBUG) || defined (DEBUG_KEEP_ASSERT)
// For microcontrollers process will be stopped using endless loop.
#define DEBUG_ASSERT0(expr,str) if (!(expr )) { \
DEBUG_LVL_ASSERT_TRACE3 ( \
"Assertion failed: line %d file '%s'\n" \
" -> '%s'\n", __LINE__, __FILE__, str); \
while (1); }
#define DEBUG_ASSERT1(expr,str,p1) if (!(expr )) { \
DEBUG_LVL_ASSERT_TRACE4 ( \
"Assertion failed: line %d file '%s'\n" \
" -> '%s'\n" \
" -> 0x%08lX\n", __LINE__, __FILE__, str, (u32) p1); \
while (1); }
#else
#define DEBUG_ASSERT0(expr,str)
#define DEBUG_ASSERT1(expr,str,p1)
#endif
//---------------------------------------------------------------------------
// The macro DEBUG_ONLY() implements code, if NDEBUG is not defined.
#if !defined (DEBUG_ONLY)
#if !defined (NDEBUG)
#define DEBUG_ONLY(expr) expr
#else
#define DEBUG_ONLY(expr)
#endif
#endif
#endif // _DEBUG_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: interface for ethernetdriver
"fast ethernet controller" (FEC)
freescale coldfire MCF528x and compatible FEC
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EdrvFec.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
Dev C++ and GNU-Compiler for m68k
-------------------------------------------------------------------------
Revision History:
2005/08/01 m.b.: start of implementation
****************************************************************************/
#ifndef _EDRVFEC_H_
#define _EDRVFEC_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// do this in config header
#define TARGET_HARDWARE TGTHW_SPLC_CF54
// base addresses
#if ((TARGET_HARDWARE & TGT_CPU_MASK_) == TGT_CPU_5282)
#elif ((TARGET_HARDWARE & TGT_CPU_MASK_) == TGT_CPU_5485)
#else
#error 'ERROR: Target was never implemented!'
#endif
//---------------------------------------------------------------------------
// types
//---------------------------------------------------------------------------
// Rx and Tx buffer descriptor format
typedef struct {
u16 m_wStatus; // control / status --- used by edrv, do not change in application
u16 m_wLength; // transfer length
u8 *m_pbData; // buffer address
} tBufferDescr;
#if ((TARGET_HARDWARE & TGT_CPU_MASK_) == TGT_CPU_5282)
#elif ((TARGET_HARDWARE & TGT_CPU_MASK_) == TGT_CPU_5485)
#endif
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EDRV_FEC_H_

View File

@ -1,89 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: interface for ethernet driver simulation
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EdrvSim.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
Dev C++ and GNU-Compiler for m68k
-------------------------------------------------------------------------
Revision History:
2006/06/15 d.k.: start of implementation
****************************************************************************/
#ifndef _EDRVSIM_H_
#define _EDRVSIM_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
void EdrvRxInterruptHandler(u8 bBufferInFrame_p, u8 * pbEthernetData_p,
u16 wDataLen_p);
#endif // #ifndef _EDRVSIM_H_

View File

@ -1,272 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL API layer
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: Epl.h,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_API_H_
#define _EPL_API_H_
#include "EplInc.h"
#include "EplSdo.h"
#include "EplObd.h"
#include "EplLed.h"
#include "EplEvent.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct {
unsigned int m_uiNodeId;
tEplNmtState m_NmtState;
tEplNmtNodeEvent m_NodeEvent;
u16 m_wErrorCode; // EPL error code if m_NodeEvent == kEplNmtNodeEventError
BOOL m_fMandatory;
} tEplApiEventNode;
typedef struct {
tEplNmtState m_NmtState; // local NMT state
tEplNmtBootEvent m_BootEvent;
u16 m_wErrorCode; // EPL error code if m_BootEvent == kEplNmtBootEventError
} tEplApiEventBoot;
typedef struct {
tEplLedType m_LedType; // type of the LED (e.g. Status or Error)
BOOL m_fOn; // state of the LED (e.g. on or off)
} tEplApiEventLed;
typedef enum {
kEplApiEventNmtStateChange = 0x10, // m_NmtStateChange
// kEplApiEventRequestNmt = 0x11, // m_bNmtCmd
kEplApiEventCriticalError = 0x12, // m_InternalError, Stack halted
kEplApiEventWarning = 0x13, // m_InternalError, Stack running
kEplApiEventNode = 0x20, // m_Node
kEplApiEventBoot = 0x21, // m_Boot
kEplApiEventSdo = 0x62, // m_Sdo
kEplApiEventObdAccess = 0x69, // m_ObdCbParam
kEplApiEventLed = 0x70, // m_Led
} tEplApiEventType;
typedef union {
tEplEventNmtStateChange m_NmtStateChange;
tEplEventError m_InternalError;
tEplSdoComFinished m_Sdo;
tEplObdCbParam m_ObdCbParam;
tEplApiEventNode m_Node;
tEplApiEventBoot m_Boot;
tEplApiEventLed m_Led;
} tEplApiEventArg;
typedef tEplKernel(*tEplApiCbEvent) (tEplApiEventType EventType_p, // IN: event type (enum)
tEplApiEventArg *pEventArg_p, // IN: event argument (union)
void *pUserArg_p);
typedef struct {
unsigned int m_uiSizeOfStruct;
BOOL m_fAsyncOnly; // do not need to register PRes
unsigned int m_uiNodeId; // local node ID
u8 m_abMacAddress[6]; // local MAC address
// 0x1F82: NMT_FeatureFlags_U32
u32 m_dwFeatureFlags;
// Cycle Length (0x1006: NMT_CycleLen_U32) in [us]
u32 m_dwCycleLen; // required for error detection
// 0x1F98: NMT_CycleTiming_REC
// 0x1F98.1: IsochrTxMaxPayload_U16
unsigned int m_uiIsochrTxMaxPayload; // const
// 0x1F98.2: IsochrRxMaxPayload_U16
unsigned int m_uiIsochrRxMaxPayload; // const
// 0x1F98.3: PResMaxLatency_U32
u32 m_dwPresMaxLatency; // const in [ns], only required for IdentRes
// 0x1F98.4: PReqActPayloadLimit_U16
unsigned int m_uiPreqActPayloadLimit; // required for initialisation (+28 bytes)
// 0x1F98.5: PResActPayloadLimit_U16
unsigned int m_uiPresActPayloadLimit; // required for initialisation of Pres frame (+28 bytes)
// 0x1F98.6: ASndMaxLatency_U32
u32 m_dwAsndMaxLatency; // const in [ns], only required for IdentRes
// 0x1F98.7: MultiplCycleCnt_U8
unsigned int m_uiMultiplCycleCnt; // required for error detection
// 0x1F98.8: AsyncMTU_U16
unsigned int m_uiAsyncMtu; // required to set up max frame size
// 0x1F98.9: Prescaler_U16
unsigned int m_uiPrescaler; // required for sync
// $$$ Multiplexed Slot
// 0x1C14: DLL_LossOfFrameTolerance_U32 in [ns]
u32 m_dwLossOfFrameTolerance;
// 0x1F8A: NMT_MNCycleTiming_REC
// 0x1F8A.1: WaitSoCPReq_U32 in [ns]
u32 m_dwWaitSocPreq;
// 0x1F8A.2: AsyncSlotTimeout_U32 in [ns]
u32 m_dwAsyncSlotTimeout;
u32 m_dwDeviceType; // NMT_DeviceType_U32
u32 m_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32
u32 m_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32
u32 m_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32
u32 m_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32
u64 m_qwVendorSpecificExt1;
u32 m_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
u32 m_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
u32 m_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_dwIpAddress;
u32 m_dwSubnetMask;
u32 m_dwDefaultGateway;
u8 m_sHostname[32];
u8 m_abVendorSpecificExt2[48];
char *m_pszDevName; // NMT_ManufactDevName_VS (0x1008/0 local OD)
char *m_pszHwVersion; // NMT_ManufactHwVers_VS (0x1009/0 local OD)
char *m_pszSwVersion; // NMT_ManufactSwVers_VS (0x100A/0 local OD)
tEplApiCbEvent m_pfnCbEvent;
void *m_pEventUserArg;
tEplSyncCb m_pfnCbSync;
} tEplApiInitParam;
typedef struct {
void *m_pImage;
unsigned int m_uiSize;
} tEplApiProcessImage;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
tEplKernel EplApiInitialize(tEplApiInitParam *pInitParam_p);
tEplKernel EplApiShutdown(void);
tEplKernel EplApiReadObject(tEplSdoComConHdl *pSdoComConHdl_p,
unsigned int uiNodeId_p,
unsigned int uiIndex_p,
unsigned int uiSubindex_p,
void *pDstData_le_p,
unsigned int *puiSize_p,
tEplSdoType SdoType_p, void *pUserArg_p);
tEplKernel EplApiWriteObject(tEplSdoComConHdl *pSdoComConHdl_p,
unsigned int uiNodeId_p,
unsigned int uiIndex_p,
unsigned int uiSubindex_p,
void *pSrcData_le_p,
unsigned int uiSize_p,
tEplSdoType SdoType_p, void *pUserArg_p);
tEplKernel EplApiFreeSdoChannel(tEplSdoComConHdl SdoComConHdl_p);
tEplKernel EplApiReadLocalObject(unsigned int uiIndex_p,
unsigned int uiSubindex_p,
void *pDstData_p,
unsigned int *puiSize_p);
tEplKernel EplApiWriteLocalObject(unsigned int uiIndex_p,
unsigned int uiSubindex_p,
void *pSrcData_p,
unsigned int uiSize_p);
tEplKernel EplApiCbObdAccess(tEplObdCbParam *pParam_p);
tEplKernel EplApiLinkObject(unsigned int uiObjIndex_p,
void *pVar_p,
unsigned int *puiVarEntries_p,
tEplObdSize *pEntrySize_p,
unsigned int uiFirstSubindex_p);
tEplKernel EplApiExecNmtCommand(tEplNmtEvent NmtEvent_p);
tEplKernel EplApiProcess(void);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplKernel EplApiMnTriggerStateChange(unsigned int uiNodeId_p,
tEplNmtNodeCommand NodeCommand_p);
#endif
tEplKernel EplApiGetIdentResponse(unsigned int uiNodeId_p,
tEplIdentResponse **ppIdentResponse_p);
// functions for process image will be implemented in separate file
tEplKernel EplApiProcessImageSetup(void);
tEplKernel EplApiProcessImageExchangeIn(tEplApiProcessImage *pPI_p);
tEplKernel EplApiProcessImageExchangeOut(tEplApiProcessImage *pPI_p);
#endif // #ifndef _EPL_API_H_

View File

@ -1,323 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: Definitions for Abstract Memory Interface
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplAmi.h,v $
$Author: D.Krueger $
$Revision: 1.2 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC
-------------------------------------------------------------------------
Revision History:
06.03.2000 -rs
Implementation
16.09.2002 -as
To save code space the functions AmiSetByte and AmiGetByte
are replaced by macros. For targets which assign u8 by
an 16Bit type, the definition of macros must changed to
functions.
23.02.2005 r.d.:
Functions included for extended data types such as UNSIGNED24,
UNSIGNED40, ...
13.06.2006 d.k.:
Extended the interface for EPL with the different functions
for little endian and big endian
****************************************************************************/
#ifndef _EPLAMI_H_
#define _EPLAMI_H_
//---------------------------------------------------------------------------
// types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Prototypen
//---------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
//---------------------------------------------------------------------------
//
// write functions
//
// To save code space the function AmiSetByte is replaced by
// an macro.
// void AmiSetByte (void * pAddr_p, u8 bByteVal_p);
#define AmiSetByteToBe(pAddr_p, bByteVal_p) {*(u8 *)(pAddr_p) = (bByteVal_p);}
#define AmiSetByteToLe(pAddr_p, bByteVal_p) {*(u8 *)(pAddr_p) = (bByteVal_p);}
void AmiSetWordToBe(void *pAddr_p, u16 wWordVal_p);
void AmiSetDwordToBe(void *pAddr_p, u32 dwDwordVal_p);
void AmiSetWordToLe(void *pAddr_p, u16 wWordVal_p);
void AmiSetDwordToLe(void *pAddr_p, u32 dwDwordVal_p);
//---------------------------------------------------------------------------
//
// read functions
//
// To save code space the function AmiGetByte is replaced by
// an macro.
// u8 AmiGetByte (void * pAddr_p);
#define AmiGetByteFromBe(pAddr_p) (*(u8 *)(pAddr_p))
#define AmiGetByteFromLe(pAddr_p) (*(u8 *)(pAddr_p))
u16 AmiGetWordFromBe(void *pAddr_p);
u32 AmiGetDwordFromBe(void *pAddr_p);
u16 AmiGetWordFromLe(void *pAddr_p);
u32 AmiGetDwordFromLe(void *pAddr_p);
//---------------------------------------------------------------------------
//
// Function: AmiSetDword24()
//
// Description: sets a 24 bit value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// dwDwordVal_p = value to set
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetDword24ToBe(void *pAddr_p, u32 dwDwordVal_p);
void AmiSetDword24ToLe(void *pAddr_p, u32 dwDwordVal_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetDword24()
//
// Description: reads a 24 bit value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u32 = read value
//
//---------------------------------------------------------------------------
u32 AmiGetDword24FromBe(void *pAddr_p);
u32 AmiGetDword24FromLe(void *pAddr_p);
//#ifdef USE_VAR64
//---------------------------------------------------------------------------
//
// Function: AmiSetQword40()
//
// Description: sets a 40 bit value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetQword40ToBe(void *pAddr_p, u64 qwQwordVal_p);
void AmiSetQword40ToLe(void *pAddr_p, u64 qwQwordVal_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetQword40()
//
// Description: reads a 40 bit value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
//---------------------------------------------------------------------------
u64 AmiGetQword40FromBe(void *pAddr_p);
u64 AmiGetQword40FromLe(void *pAddr_p);
//---------------------------------------------------------------------------
//
// Function: AmiSetQword48()
//
// Description: sets a 48 bit value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetQword48ToBe(void *pAddr_p, u64 qwQwordVal_p);
void AmiSetQword48ToLe(void *pAddr_p, u64 qwQwordVal_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetQword48()
//
// Description: reads a 48 bit value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
//---------------------------------------------------------------------------
u64 AmiGetQword48FromBe(void *pAddr_p);
u64 AmiGetQword48FromLe(void *pAddr_p);
//---------------------------------------------------------------------------
//
// Function: AmiSetQword56()
//
// Description: sets a 56 bit value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetQword56ToBe(void *pAddr_p, u64 qwQwordVal_p);
void AmiSetQword56ToLe(void *pAddr_p, u64 qwQwordVal_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetQword56()
//
// Description: reads a 56 bit value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
//---------------------------------------------------------------------------
u64 AmiGetQword56FromBe(void *pAddr_p);
u64 AmiGetQword56FromLe(void *pAddr_p);
//---------------------------------------------------------------------------
//
// Function: AmiSetQword64()
//
// Description: sets a 64 bit value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetQword64ToBe(void *pAddr_p, u64 qwQwordVal_p);
void AmiSetQword64ToLe(void *pAddr_p, u64 qwQwordVal_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetQword64()
//
// Description: reads a 64 bit value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: void
//
//---------------------------------------------------------------------------
u64 AmiGetQword64FromBe(void *pAddr_p);
u64 AmiGetQword64FromLe(void *pAddr_p);
//---------------------------------------------------------------------------
//
// Function: AmiSetTimeOfDay()
//
// Description: sets a TIME_OF_DAY (CANopen) value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// pTimeOfDay_p = pointer to struct TIME_OF_DAY
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiSetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p);
//---------------------------------------------------------------------------
//
// Function: AmiGetTimeOfDay()
//
// Description: reads a TIME_OF_DAY (CANopen) value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
// pTimeOfDay_p = pointer to struct TIME_OF_DAY
//
// Return: void
//
//---------------------------------------------------------------------------
void AmiGetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p);
#ifdef __cplusplus
}
#endif
#endif // ifndef _EPLAMI_H_
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL API layer for Linux (kernel and user space)
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplApiLinux.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/08/25 12:17:41 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/10/11 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_API_LINUX_H_
#define _EPL_API_LINUX_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define EPLLIN_DEV_NAME "epl" // used for "/dev" and "/proc" entry
//---------------------------------------------------------------------------
// Commands for <ioctl>
//---------------------------------------------------------------------------
#define EPLLIN_CMD_INITIALIZE 0 // ulArg_p ~ tEplApiInitParam*
#define EPLLIN_CMD_PI_IN 1 // ulArg_p ~ tEplApiProcessImage*
#define EPLLIN_CMD_PI_OUT 2 // ulArg_p ~ tEplApiProcessImage*
#define EPLLIN_CMD_WRITE_OBJECT 3 // ulArg_p ~ tEplLinSdoObject*
#define EPLLIN_CMD_READ_OBJECT 4 // ulArg_p ~ tEplLinSdoObject*
#define EPLLIN_CMD_WRITE_LOCAL_OBJECT 5 // ulArg_p ~ tEplLinLocalObject*
#define EPLLIN_CMD_READ_LOCAL_OBJECT 6 // ulArg_p ~ tEplLinLocalObject*
#define EPLLIN_CMD_FREE_SDO_CHANNEL 7 // ulArg_p ~ tEplSdoComConHdl
#define EPLLIN_CMD_NMT_COMMAND 8 // ulArg_p ~ tEplNmtEvent
#define EPLLIN_CMD_GET_EVENT 9 // ulArg_p ~ tEplLinEvent*
#define EPLLIN_CMD_MN_TRIGGER_STATE_CHANGE 10 // ulArg_p ~ tEplLinNodeCmdObject*
#define EPLLIN_CMD_PI_SETUP 11 // ulArg_p ~ 0
#define EPLLIN_CMD_SHUTDOWN 12 // ulArg_p ~ 0
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct {
unsigned int m_uiEventArgSize;
tEplApiEventArg *m_pEventArg;
tEplApiEventType *m_pEventType;
tEplKernel m_RetCbEvent;
} tEplLinEvent;
typedef struct {
tEplSdoComConHdl m_SdoComConHdl;
BOOL m_fValidSdoComConHdl;
unsigned int m_uiNodeId;
unsigned int m_uiIndex;
unsigned int m_uiSubindex;
void *m_le_pData;
unsigned int m_uiSize;
tEplSdoType m_SdoType;
void *m_pUserArg;
} tEplLinSdoObject;
typedef struct {
unsigned int m_uiIndex;
unsigned int m_uiSubindex;
void *m_pData;
unsigned int m_uiSize;
} tEplLinLocalObject;
typedef struct {
unsigned int m_uiNodeId;
tEplNmtNodeCommand m_NodeCommand;
} tEplLinNodeCmdObject;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_API_LINUX_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,328 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for EPL API module (process image)
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplApiProcessImage.c,v $
$Author: D.Krueger $
$Revision: 1.7 $ $Date: 2008/11/13 17:13:09 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/10/10 d.k.: start of the implementation, version 1.00
****************************************************************************/
#include "Epl.h"
#include <linux/uaccess.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S EplApi */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
typedef struct {
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
u8 m_abProcessImageInput[EPL_API_PROCESS_IMAGE_SIZE_IN];
#endif
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
u8 m_abProcessImageOutput[EPL_API_PROCESS_IMAGE_SIZE_OUT];
#endif
} tEplApiProcessImageInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
static tEplApiProcessImageInstance EplApiProcessImageInstance_g;
#endif
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplApiProcessImageSetup()
//
// Description: sets up static process image
//
// Parameters: (none)
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplApiProcessImageSetup(void)
{
tEplKernel Ret = kEplSuccessful;
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
unsigned int uiVarEntries;
tEplObdSize ObdSize;
#endif
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
ObdSize = 1;
Ret = EplApiLinkObject(0x2000,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
ObdSize = 1;
Ret = EplApiLinkObject(0x2001,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
ObdSize = 2;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
Ret = EplApiLinkObject(0x2010,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
ObdSize = 2;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
Ret = EplApiLinkObject(0x2011,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
ObdSize = 4;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
Ret = EplApiLinkObject(0x2020,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
ObdSize = 4;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
Ret = EplApiLinkObject(0x2021,
EplApiProcessImageInstance_g.
m_abProcessImageInput, &uiVarEntries, &ObdSize,
1);
#endif
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
ObdSize = 1;
Ret = EplApiLinkObject(0x2030,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
ObdSize = 1;
Ret = EplApiLinkObject(0x2031,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
ObdSize = 2;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
Ret = EplApiLinkObject(0x2040,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
ObdSize = 2;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
Ret = EplApiLinkObject(0x2041,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
ObdSize = 4;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
Ret = EplApiLinkObject(0x2050,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
ObdSize = 4;
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
Ret = EplApiLinkObject(0x2051,
EplApiProcessImageInstance_g.
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
1);
#endif
return Ret;
}
//----------------------------------------------------------------------------
// Function: EplApiProcessImageExchangeIn()
//
// Description: replaces passed input process image with the one of EPL stack
//
// Parameters: pPI_p = input process image
//
// Returns: tEplKernel = error code
//
// State:
//----------------------------------------------------------------------------
tEplKernel EplApiProcessImageExchangeIn(tEplApiProcessImage *pPI_p)
{
tEplKernel Ret = kEplSuccessful;
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
copy_to_user(pPI_p->m_pImage,
EplApiProcessImageInstance_g.m_abProcessImageInput,
min(pPI_p->m_uiSize,
sizeof(EplApiProcessImageInstance_g.
m_abProcessImageInput)));
#endif
return Ret;
}
//----------------------------------------------------------------------------
// Function: EplApiProcessImageExchangeOut()
//
// Description: copies passed output process image to EPL stack.
//
// Parameters: pPI_p = output process image
//
// Returns: tEplKernel = error code
//
// State:
//----------------------------------------------------------------------------
tEplKernel EplApiProcessImageExchangeOut(tEplApiProcessImage *pPI_p)
{
tEplKernel Ret = kEplSuccessful;
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
copy_from_user(EplApiProcessImageInstance_g.m_abProcessImageOutput,
pPI_p->m_pImage,
min(pPI_p->m_uiSize,
sizeof(EplApiProcessImageInstance_g.
m_abProcessImageOutput)));
#endif
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
// EOF

View File

@ -1,196 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: configuration file
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplCfg.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
2006/06/06 k.t.: Start of Implementation
****************************************************************************/
#ifndef _EPLCFG_H_
#define _EPLCFG_H_
// =========================================================================
// generic defines which for whole EPL Stack
// =========================================================================
#define EPL_USE_DELETEINST_FUNC TRUE
// needed to support datatypes over 32 bit by global.h
#define USE_VAR64
// EPL_MAX_INSTANCES specifies count of instances of all EPL modules.
// If it is greater than 1 the first parameter of all
// functions is the instance number.
#define EPL_MAX_INSTANCES 1
// This defines the target hardware. Here is encoded wich CPU and wich external
// peripherals are connected. For possible values refere to target.h. If
// necessary value is not available EPL stack has to
// be adapted and tested.
#define TARGET_HARDWARE TGTHW_PC_WRAPP
// use no FIFOs, make direct calls
//#define EPL_NO_FIFO
// use no IPC between user- and kernelspace modules, make direct calls
#define EPL_NO_USER_KERNEL
#ifndef BENCHMARK_MODULES
#define BENCHMARK_MODULES 0 //0xEE800042L
#endif
// Default defug level:
// Only debug traces of these modules will be compiled which flags are set in define DEF_DEBUG_LVL.
#ifndef DEF_DEBUG_LVL
#define DEF_DEBUG_LVL 0xEC000000L
#endif
// EPL_DBGLVL_OBD = 0x00000004L
// * EPL_DBGLVL_ASSERT = 0x20000000L
// * EPL_DBGLVL_ERROR = 0x40000000L
// * EPL_DBGLVL_ALWAYS = 0x80000000L
// EPL_MODULE_INTEGRATION defines all modules which are included in
// EPL application. Please add or delete modules for your application.
#define EPL_MODULE_INTEGRATION EPL_MODULE_OBDK \
| EPL_MODULE_PDOK \
| EPL_MODULE_NMT_MN \
| EPL_MODULE_SDOS \
| EPL_MODULE_SDOC \
| EPL_MODULE_SDO_ASND \
| EPL_MODULE_SDO_UDP \
| EPL_MODULE_NMT_CN \
| EPL_MODULE_NMTU \
| EPL_MODULE_NMTK \
| EPL_MODULE_DLLK \
| EPL_MODULE_DLLU \
| EPL_MODULE_VETH
// | EPL_MODULE_OBDU
// =========================================================================
// EPL ethernet driver (Edrv) specific defines
// =========================================================================
// switch this define to TRUE if Edrv supports fast tx frames
#define EDRV_FAST_TXFRAMES FALSE
//#define EDRV_FAST_TXFRAMES TRUE
// switch this define to TRUE if Edrv supports early receive interrupts
#define EDRV_EARLY_RX_INT FALSE
//#define EDRV_EARLY_RX_INT TRUE
// enables setting of several port pins for benchmarking purposes
#define EDRV_BENCHMARK FALSE
//#define EDRV_BENCHMARK TRUE // MCF_GPIO_PODR_PCIBR
// Call Tx handler (i.e. EplDllCbFrameTransmitted()) already if DMA has finished,
// otherwise call the Tx handler if frame was actually transmitted over ethernet.
#define EDRV_DMA_TX_HANDLER FALSE
//#define EDRV_DMA_TX_HANDLER TRUE
// number of used ethernet controller
//#define EDRV_USED_ETH_CTRL 1
// =========================================================================
// Data Link Layer (DLL) specific defines
// =========================================================================
// switch this define to TRUE if Edrv supports fast tx frames
// and DLL shall pass PRes as ready to Edrv after SoC
#define EPL_DLL_PRES_READY_AFTER_SOC FALSE
//#define EPL_DLL_PRES_READY_AFTER_SOC TRUE
// switch this define to TRUE if Edrv supports fast tx frames
// and DLL shall pass PRes as ready to Edrv after SoA
#define EPL_DLL_PRES_READY_AFTER_SOA FALSE
//#define EPL_DLL_PRES_READY_AFTER_SOA TRUE
// =========================================================================
// OBD specific defines
// =========================================================================
// switch this define to TRUE if Epl should compare object range
// automaticly
#define EPL_OBD_CHECK_OBJECT_RANGE FALSE
//#define EPL_OBD_CHECK_OBJECT_RANGE TRUE
// set this define to TRUE if there are strings or domains in OD, which
// may be changed in object size and/or object data pointer by its object
// callback function (called event kObdEvWrStringDomain)
//#define EPL_OBD_USE_STRING_DOMAIN_IN_RAM FALSE
#define EPL_OBD_USE_STRING_DOMAIN_IN_RAM TRUE
#define EPL_OBD_USE_VARIABLE_SUBINDEX_TAB TRUE
// =========================================================================
// Timer module specific defines
// =========================================================================
// if TRUE it uses the Timer module implementation of EPL user also in EPL kernel
#define EPL_TIMER_USE_USER TRUE
// if TRUE the high resolution timer module will be used
#define EPL_TIMER_USE_HIGHRES TRUE
//#define EPL_TIMER_USE_HIGHRES FALSE
#endif //_EPLCFG_H_

View File

@ -1,355 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL default constants
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDef.h,v $
$Author: D.Krueger $
$Revision: 1.15 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DEF_H_
#define _EPL_DEF_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define EPL_C_ADR_BROADCAST 0xFF // EPL broadcast address
#define EPL_C_ADR_DIAG_DEF_NODE_ID 0xFD // EPL default address of dignostic device
#define EPL_C_ADR_DUMMY_NODE_ID 0xFC // EPL dummy node address
#define EPL_C_ADR_INVALID 0x00 // invalid EPL address
#define EPL_C_ADR_MN_DEF_NODE_ID 0xF0 // EPL default address of MN
#define EPL_C_ADR_RT1_DEF_NODE_ID 0xFE // EPL default address of router type 1
#define EPL_C_DLL_ASND_PRIO_NMTRQST 7 // increased ASnd request priority to be used by NMT Requests
#define EPL_C_DLL_ASND_PRIO_STD 0 // standard ASnd request priority
#define EPL_C_DLL_ETHERTYPE_EPL 0x88AB
#define EPL_C_DLL_ISOCHR_MAX_PAYL 1490 // Byte: maximum size of PReq and PRes payload data, requires C_IP_MAX_MTU
#define EPL_C_DLL_MAX_ASYNC_MTU 1500 // Byte: maximum asynchronous payload in bytes
#define EPL_C_DLL_MAX_PAYL_OFFSET 1499 // Byte: maximum offset of Ethernet frame payload, requires C_IP_MAX_MTU
#define EPL_C_DLL_MAX_RS 7
#define EPL_C_DLL_MIN_ASYNC_MTU 282 // Byte: minimum asynchronous payload in bytes.
#define EPL_C_DLL_MIN_PAYL_OFFSET 45 // Byte: minimum offset of Ethernet frame payload
#define EPL_C_DLL_MULTICAST_ASND 0x01111E000004LL // EPL ASnd multicast MAC address, canonical form
#define EPL_C_DLL_MULTICAST_PRES 0x01111E000002LL // EPL PRes multicast MAC address, canonical form
#define EPL_C_DLL_MULTICAST_SOA 0x01111E000003LL // EPL SoA multicast MAC address, canonical form
#define EPL_C_DLL_MULTICAST_SOC 0x01111E000001LL // EPL Soc multicast MAC address, canonical form
#define EPL_C_DLL_PREOP1_START_CYCLES 10 // number of unassigning SoA frames at start of NMT_MS_PRE_OPERATIONAL_1
#define EPL_C_DLL_T_BITTIME 10 // ns: Transmission time per bit on 100 Mbit/s network
#define EPL_C_DLL_T_EPL_PDO_HEADER 10 // Byte: size of PReq and PRes EPL PDO message header
#define EPL_C_DLL_T_ETH2_WRAPPER 18 // Byte: size of Ethernet type II wrapper consisting of header and checksum
#define EPL_C_DLL_T_IFG 640 // ns: Ethernet Interframe Gap
#define EPL_C_DLL_T_MIN_FRAME 5120 // ns: Size of minimum Ethernet frame (without preamble)
#define EPL_C_DLL_T_PREAMBLE 960 // ns: Size of Ethernet frame preamble
#define EPL_C_DLL_MINSIZE_SOC 36 // minimum size of SoC without padding and CRC
#define EPL_C_DLL_MINSIZE_PREQ 60 // minimum size of PRec without CRC
#define EPL_C_DLL_MINSIZE_PRES 60 // minimum size of PRes without CRC
#define EPL_C_DLL_MINSIZE_SOA 24 // minimum size of SoA without padding and CRC
#define EPL_C_DLL_MINSIZE_IDENTRES 176 // minimum size of IdentResponse without CRC
#define EPL_C_DLL_MINSIZE_STATUSRES 72 // minimum size of StatusResponse without CRC
#define EPL_C_DLL_MINSIZE_NMTCMD 20 // minimum size of NmtCommand without CommandData, padding and CRC
#define EPL_C_DLL_MINSIZE_NMTCMDEXT 52 // minimum size of NmtCommand without padding and CRC
#define EPL_C_DLL_MINSIZE_NMTREQ 20 // minimum size of NmtRequest without CommandData, padding and CRC
#define EPL_C_DLL_MINSIZE_NMTREQEXT 52 // minimum size of NmtRequest without padding and CRC
#define EPL_C_ERR_MONITOR_DELAY 10 // Error monitoring start delay (not used in DS 1.0.0)
#define EPL_C_IP_ADR_INVALID 0x00000000L // invalid IP address (0.0.0.0) used to indicate no change
#define EPL_C_IP_INVALID_MTU 0 // Byte: invalid MTU size used to indicate no change
#define EPL_C_IP_MAX_MTU 1518 // Byte: maximum size in bytes of the IP stack which must be processed.
#define EPL_C_IP_MIN_MTU 300 // Byte: minimum size in bytes of the IP stack which must be processed.
#define EPL_C_NMT_STATE_TOLERANCE 5 // Cycles: maximum reaction time to NMT state commands
#define EPL_C_NMT_STATREQ_CYCLE 5 // sec: StatusRequest cycle time to be applied to AsyncOnly CNs
#define EPL_C_SDO_EPL_PORT 3819
#define EPL_C_DLL_MAX_ASND_SERVICE_IDS 5 // see tEplDllAsndServiceId in EplDll.h
// Default configuration
// ======================
#ifndef EPL_D_PDO_Granularity_U8
#define EPL_D_PDO_Granularity_U8 8 // minimum size of objects to be mapped in bits UNSIGNED8 O O 1 1
#endif
#ifndef EPL_NMT_MAX_NODE_ID
#define EPL_NMT_MAX_NODE_ID 254 // maximum node-ID
#endif
#ifndef EPL_D_NMT_MaxCNNumber_U8
#define EPL_D_NMT_MaxCNNumber_U8 239 // maximum number of supported regular CNs in the Node ID range 1 .. 239 UNSIGNED8 O O 239 239
#endif
// defines for EPL API layer static process image
#ifndef EPL_API_PROCESS_IMAGE_SIZE_IN
#define EPL_API_PROCESS_IMAGE_SIZE_IN 0
#endif
#ifndef EPL_API_PROCESS_IMAGE_SIZE_OUT
#define EPL_API_PROCESS_IMAGE_SIZE_OUT 0
#endif
// configure whether OD access events shall be forwarded
// to user callback function.
// Because of reentrancy for local OD accesses, this has to be disabled
// when application resides in other address space as the stack (e.g. if
// EplApiLinuxUser.c and EplApiLinuxKernel.c are used)
#ifndef EPL_API_OBD_FORWARD_EVENT
#define EPL_API_OBD_FORWARD_EVENT TRUE
#endif
#ifndef EPL_OBD_MAX_STRING_SIZE
#define EPL_OBD_MAX_STRING_SIZE 32 // is used for objects 0x1008/0x1009/0x100A
#endif
#ifndef EPL_OBD_USE_STORE_RESTORE
#define EPL_OBD_USE_STORE_RESTORE FALSE
#endif
#ifndef EPL_OBD_CHECK_OBJECT_RANGE
#define EPL_OBD_CHECK_OBJECT_RANGE TRUE
#endif
#ifndef EPL_OBD_USE_STRING_DOMAIN_IN_RAM
#define EPL_OBD_USE_STRING_DOMAIN_IN_RAM TRUE
#endif
#ifndef EPL_OBD_USE_VARIABLE_SUBINDEX_TAB
#define EPL_OBD_USE_VARIABLE_SUBINDEX_TAB TRUE
#endif
#ifndef EPL_OBD_USE_KERNEL
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) == 0)
#define EPL_OBD_USE_KERNEL TRUE
#else
#define EPL_OBD_USE_KERNEL FALSE
#endif
#endif
#ifndef EPL_OBD_INCLUDE_A000_TO_DEVICE_PART
#define EPL_OBD_INCLUDE_A000_TO_DEVICE_PART FALSE
#endif
#ifndef EPL_VETH_NAME
#define EPL_VETH_NAME "epl" // name of net device in Linux
#endif
/*
#define EPL_D_CFG_ConfigManager_BOOL // Ability of a MN node to perform Configuration Manager functions BOOLEAN O - N -
#define EPL_D_CFM_VerifyConf_BOOL // Support of objects CFM_VerifyConfiguration_REC, CFM_ExpConfDateList_AU32, CFM_ExpConfTimeList_AU32 BOOLEAN O O N N
#define EPL_D_CFM_VerifyConfId_BOOL // Support of objects CFM_VerifyConfiguration_REC.ConfId_U32 and CFM_ExpConfIdList_AU32 BOOLEAN O O N N
#define EPL_D_DLL_CNFeatureIsochr_BOOL // CNs ability to perform isochronous functions BOOLEAN - O - Y
#define EPL_D_DLL_CNFeatureMultiplex_BOOL // nodes ability to perform control of multiplexed isochronous communication BOOLEAN - O - N
#define EPL_D_DLL_FeatureCN_BOOL // nodes ability to perform CN functions BOOLEAN O O Y Y
#define EPL_D_DLL_FeatureMN_BOOL // nodes ability to perform MN functions BOOLEAN M O - N
#define EPL_D_DLL_MNFeatureMultiplex_BOOL // MNs ability to perform control of multiplexed isochronous communication BOOLEAN O - Y -
#define EPL_D_DLL_MNFeaturePResTx_BOOL // MNs ability to transmit PRes BOOLEAN O - Y -
#define EPL_D_NMT_ASndRxMaxPayload_U16 // size of ASnd frame receive buffer UNSIGNED16 M M - -
#define EPL_D_NMT_ASndTxMaxPayload_U16 // size of ASnd frame transmit buffer UNSIGNED16 M M - -
#define EPL_D_NMT_CNASnd2SoC_U32 // minimum delay between end of reception of ASnd and start of reception of SoC UNSIGNED32 - M - -
#define EPL_D_NMT_CNASndMaxLatency_U32 // delay between end of SoA reception and start of ASnd transmission UNSIGNED32 - M - -
#define EPL_D_NMT_CNPResMaxLatency_U32 // delay between end of PReq reception and start of PRes transmission UNSIGNED32 - M - -
#define EPL_D_NMT_CNSoC2PReq_U32 // CN SoC handling maximum time, a subsequent PReq wont be handled before SoC handling was finished UNSIGNED32 - M - -
#define EPL_D_NMT_DeviceType_U32 // Device Type ID UNSIGNED32 M M - -
#define EPL_D_NMT_EPLVers_U8 EPL // Version implemented by the device UNSIGNED8 M M - -
#define EPL_D_NMT_ExtStateCmd_BOOL // abitilty to support Extended NMT State Commands BOOLEAN O O Y Y
#define EPL_D_NMT_InfoSvc_BOOL // ability to support NMT Info Services BOOLEAN O - Y -
#define EPL_D_NMT_InterfaceAddr_Xh_OSTR // Physical Address of Interface No. Xh OCTET_STRING M M - -
#define EPL_D_NMT_InterfaceDescr_Xh_VSTR // Description text of Interface No. Xh VISIBLE_STRINGM M - -
#define EPL_D_NMT_InterfaceMtu_Xh_U32 // MTU of Interface No. Xh UNSIGNED32 M M - -
#define EPL_D_NMT_InterfaceType_Xh_U8 // Type of Interface No. Xh UNSIGNED8 M M - -
#define EPL_D_NMT_IsochrRxMaxPayload_U16 // size of isochronous frame receive buffer UNSIGNED16 M M - -
#define EPL_D_NMT_IsochrTxMaxPayload_U16 // size of isochronous frame transmit buffer UNSIGNED16 M M - -
#define EPL_D_NMT_ManufactDevName_VS // Manufacturer Device Name VISIBLE_STRING O O - -
#define EPL_D_NMT_ManufactHwVers_VS // Manufacturer HW version VISIBLE_STRING O O - -
#define EPL_D_NMT_ManufactSwVers_VS // Manufacturer SW version VISIBLE_STRING O O - -
#define EPL_D_NMT_MaxCNNodeID_U8 // maximum Node ID available for regular CNs the entry provides an upper limit to the NodeID available for cross traffic PDO reception from a regular CN UNSIGNED8 O O 239 239
#define EPL_D_NMT_MaxCNNumber_U8 // maximum number of supported regular CNs in the Node ID range 1 .. 239 UNSIGNED8 O O 239 239
#define EPL_D_NMT_MaxHeartbeats_U8 // number of guard channels UNSIGNED8 O O 254 254
#define EPL_D_NMT_MNASnd2SoC_U32 // minimum delay between end of reception of ASnd and start of transmission of SoC UNSIGNED32 M - - -
#define EPL_D_NMT_MNMultiplCycMax_U8 // maximum number of EPL cycles per multiplexed cycle UNSIGNED8 O - 0 -
#define EPL_D_NMT_MNPRes2PReq_U32 // delay between end of PRes reception and start of PReq transmission UNSIGNED32 M - - -
#define EPL_D_NMT_MNPRes2PRes_U32 // delay between end of reception of PRes from CNn and start of transmission of PRes by MN UNSIGNED32 M - - -
#define EPL_D_NMT_MNPResRx2SoA_U32 // delay between end of reception of PRes from CNn and start of transmission of SoA by MN UNSIGNED32 M - - -
#define EPL_D_NMT_MNPResTx2SoA_U32 // delay between end of PRes transmission by MN and start of transmission of SoA by MN UNSIGNED32 M - - -
#define EPL_D_NMT_MNSoA2ASndTx_U32 // delay between end of transmission of SoA and start of transmission of ASnd by MN UNSIGNED32 M - - -
#define EPL_D_NMT_MNSoC2PReq_U32 // MN minimum delay between end of SoC transmission and start of PReq transmission UNSIGNED32 M - - -
#define EPL_D_NMT_NMTSvcViaUDPIP_BOOL // Ability of a node to perform NMT services via UDP/IP BOOLEAN O - Y -
#define EPL_D_NMT_NodeIDByHW_BOOL // Ability of a node to support NodeID setup by HW BOOLEAN O O Y Y
#define EPL_D_NMT_NodeIDBySW_BOOL // Ability of a node to support NodeID setup by SW BOOLEAN O O N N
#define EPL_D_NMT_ProductCode_U32 // Identity Object Product Code UNSIGNED32 M M - -
#define EPL_D_NMT_RevisionNo_U32 // Identity Object Revision Number UNSIGNED32 M M - -
#define EPL_D_NMT_SerialNo_U32 // Identity Object Serial Number UNSIGNED32 M M - -
#define EPL_D_NMT_SimpleBoot_BOOL // Ability of a MN node to perform Simple Boot Process, if not set Indivual Boot Process shall be proviced BOOLEAN M - - -
#define EPL_D_NMT_VendorID_U32 // Identity Object Vendor ID UNSIGNED32 M M - -
#define EPL_D_NWL_Forward_BOOL // Ability of node to forward datagrams BOOLEAN O O N N
#define EPL_D_NWL_IPSupport_BOOL // Ability of the node cummunicate via IP BOOLEAN - - Y Y
#define EPL_D_PDO_DynamicMapping_BOOL // Ability of a node to perform dynamic PDO mapping BOOLEAN O O Y Y
#define EPL_D_PDO_MaxDescrMem_U32 // maximum cumulative memory consumption of TPDO and RPDO describing objects in byte UNSIGNED32 O O MAX_U32 MAX_U32
#define EPL_D_PDO_RPDOChannels_U8 // number of supported RPDO channels UNSIGNED8 O O 256 256
#define EPL_D_PDO_RPDOMaxMem_U32 // Maximum memory available for RPDO data per EPL cycle in byte UNSIGNED32 O O MAX_U32 MAX_U32
#define EPL_D_PDO_RPDOObjects_U8 // Number of supported mapped objects per RPDO channel UNSIGNED8 O O 254 254
#define EPL_D_PDO_TPDOChannels_U8 // number of supported TPDO channels UNSIGNED8 O - 256 -
#define EPL_D_PDO_TPDOMaxMem_U32 // Maximum memory available for TPDO data per EPL cycle in byte UNSIGNED32 O O MAX_U32 MAX_U32
#define EPL_D_PDO_TPDOObjects_U8 // Number of supported mapped objects per TPDO channel UNSIGNED8 O O 254 254
#define EPL_D_SDO_ViaASnd_BOOL // Ability of a CN to perform SDO transfer by EPL ASnd BOOLEAN - M - -
#define EPL_D_SDO_ViaPDO_BOOL // Ability of a node to perform SDO transfer by PDO BOOLEAN O O N N
#define EPL_D_SDO_ViaUDPIP_BOOL // Ability of a CN to perform SDO transfer by UDP/IP BOOLEAN - M - -
#define EPL_D_SYN_OptimizedSync_BOOL // Ability of node to perform optimized synchronisation BOOLEAN O O N N
*/
// Emergency error codes
// ======================
#define EPL_E_NO_ERROR 0x0000
// 0xFxxx manufacturer specific error codes
#define EPL_E_NMT_NO_IDENT_RES 0xF001
#define EPL_E_NMT_NO_STATUS_RES 0xF002
// 0x816x HW errors
#define EPL_E_DLL_BAD_PHYS_MODE 0x8161
#define EPL_E_DLL_COLLISION 0x8162
#define EPL_E_DLL_COLLISION_TH 0x8163
#define EPL_E_DLL_CRC_TH 0x8164
#define EPL_E_DLL_LOSS_OF_LINK 0x8165
#define EPL_E_DLL_MAC_BUFFER 0x8166
// 0x82xx Protocol errors
#define EPL_E_DLL_ADDRESS_CONFLICT 0x8201
#define EPL_E_DLL_MULTIPLE_MN 0x8202
// 0x821x Frame size errors
#define EPL_E_PDO_SHORT_RX 0x8210
#define EPL_E_PDO_MAP_VERS 0x8211
#define EPL_E_NMT_ASND_MTU_DIF 0x8212
#define EPL_E_NMT_ASND_MTU_LIM 0x8213
#define EPL_E_NMT_ASND_TX_LIM 0x8214
// 0x823x Timing errors
#define EPL_E_NMT_CYCLE_LEN 0x8231
#define EPL_E_DLL_CYCLE_EXCEED 0x8232
#define EPL_E_DLL_CYCLE_EXCEED_TH 0x8233
#define EPL_E_NMT_IDLE_LIM 0x8234
#define EPL_E_DLL_JITTER_TH 0x8235
#define EPL_E_DLL_LATE_PRES_TH 0x8236
#define EPL_E_NMT_PREQ_CN 0x8237
#define EPL_E_NMT_PREQ_LIM 0x8238
#define EPL_E_NMT_PRES_CN 0x8239
#define EPL_E_NMT_PRES_RX_LIM 0x823A
#define EPL_E_NMT_PRES_TX_LIM 0x823B
// 0x824x Frame errors
#define EPL_E_DLL_INVALID_FORMAT 0x8241
#define EPL_E_DLL_LOSS_PREQ_TH 0x8242
#define EPL_E_DLL_LOSS_PRES_TH 0x8243
#define EPL_E_DLL_LOSS_SOA_TH 0x8244
#define EPL_E_DLL_LOSS_SOC_TH 0x8245
// 0x84xx BootUp Errors
#define EPL_E_NMT_BA1 0x8410 // other MN in MsNotActive active
#define EPL_E_NMT_BA1_NO_MN_SUPPORT 0x8411 // MN is not supported
#define EPL_E_NMT_BPO1 0x8420 // mandatory CN was not found or failed in BootStep1
#define EPL_E_NMT_BPO1_GET_IDENT 0x8421 // IdentRes was not received
#define EPL_E_NMT_BPO1_DEVICE_TYPE 0x8422 // wrong device type
#define EPL_E_NMT_BPO1_VENDOR_ID 0x8423 // wrong vendor ID
#define EPL_E_NMT_BPO1_PRODUCT_CODE 0x8424 // wrong product code
#define EPL_E_NMT_BPO1_REVISION_NO 0x8425 // wrong revision number
#define EPL_E_NMT_BPO1_SERIAL_NO 0x8426 // wrong serial number
#define EPL_E_NMT_BPO1_CF_VERIFY 0x8428 // verification of configuration failed
#define EPL_E_NMT_BPO2 0x8430 // mandatory CN failed in BootStep2
#define EPL_E_NMT_BRO 0x8440 // CheckCommunication failed for mandatory CN
#define EPL_E_NMT_WRONG_STATE 0x8480 // mandatory CN has wrong NMT state
// Defines for object 0x1F80 NMT_StartUp_U32
// ==========================================
#define EPL_NMTST_STARTALLNODES 0x00000002L // Bit 1
#define EPL_NMTST_NO_AUTOSTART 0x00000004L // Bit 2
#define EPL_NMTST_NO_STARTNODE 0x00000008L // Bit 3
#define EPL_NMTST_RESETALL_MAND_CN 0x00000010L // Bit 4
#define EPL_NMTST_STOPALL_MAND_CN 0x00000040L // Bit 6
#define EPL_NMTST_NO_AUTOPREOP2 0x00000080L // Bit 7
#define EPL_NMTST_NO_AUTOREADYTOOP 0x00000100L // Bit 8
#define EPL_NMTST_EXT_CNIDENTCHECK 0x00000200L // Bit 9
#define EPL_NMTST_SWVERSIONCHECK 0x00000400L // Bit 10
#define EPL_NMTST_CONFCHECK 0x00000800L // Bit 11
#define EPL_NMTST_NO_RETURN_PREOP1 0x00001000L // Bit 12
#define EPL_NMTST_BASICETHERNET 0x00002000L // Bit 13
// Defines for object 0x1F81 NMT_NodeAssignment_AU32
// ==================================================
#define EPL_NODEASSIGN_NODE_EXISTS 0x00000001L // Bit 0
#define EPL_NODEASSIGN_NODE_IS_CN 0x00000002L // Bit 1
#define EPL_NODEASSIGN_START_CN 0x00000004L // Bit 2
#define EPL_NODEASSIGN_MANDATORY_CN 0x00000008L // Bit 3
#define EPL_NODEASSIGN_KEEPALIVE 0x00000010L //currently not used in EPL V2 standard
#define EPL_NODEASSIGN_SWVERSIONCHECK 0x00000020L // Bit 5
#define EPL_NODEASSIGN_SWUPDATE 0x00000040L // Bit 6
#define EPL_NODEASSIGN_ASYNCONLY_NODE 0x00000100L // Bit 8
#define EPL_NODEASSIGN_MULTIPLEXED_CN 0x00000200L // Bit 9
#define EPL_NODEASSIGN_RT1 0x00000400L // Bit 10
#define EPL_NODEASSIGN_RT2 0x00000800L // Bit 11
#define EPL_NODEASSIGN_MN_PRES 0x00001000L // Bit 12
#define EPL_NODEASSIGN_VALID 0x80000000L // Bit 31
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_DEF_H_

View File

@ -1,205 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for DLL module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDll.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/08 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLL_H_
#define _EPL_DLL_H_
#include "EplInc.h"
#include "EplFrame.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef EPL_DLL_MAX_ASND_SERVICE_ID
#define EPL_DLL_MAX_ASND_SERVICE_ID (EPL_C_DLL_MAX_ASND_SERVICE_IDS + 1) // last is kEplDllAsndSdo == 5
#endif
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef enum {
kEplDllAsndNotDefined = 0x00,
kEplDllAsndIdentResponse = 0x01,
kEplDllAsndStatusResponse = 0x02,
kEplDllAsndNmtRequest = 0x03,
kEplDllAsndNmtCommand = 0x04,
kEplDllAsndSdo = 0x05
} tEplDllAsndServiceId;
typedef enum {
kEplDllAsndFilterNone = 0x00,
kEplDllAsndFilterLocal = 0x01, // receive only ASnd frames with local or broadcast node ID
kEplDllAsndFilterAny = 0x02, // receive any ASnd frame
} tEplDllAsndFilter;
typedef enum {
kEplDllReqServiceNo = 0x00,
kEplDllReqServiceIdent = 0x01,
kEplDllReqServiceStatus = 0x02,
kEplDllReqServiceNmtRequest = 0x03,
kEplDllReqServiceUnspecified = 0xFF,
} tEplDllReqServiceId;
typedef enum {
kEplDllAsyncReqPrioNmt = 0x07, // PRIO_NMT_REQUEST
kEplDllAsyncReqPrio6 = 0x06,
kEplDllAsyncReqPrio5 = 0x05,
kEplDllAsyncReqPrio4 = 0x04,
kEplDllAsyncReqPrioGeneric = 0x03, // PRIO_GENERIC_REQUEST
kEplDllAsyncReqPrio2 = 0x02, // till WSP 0.1.3: PRIO_ABOVE_GENERIC
kEplDllAsyncReqPrio1 = 0x01, // till WSP 0.1.3: PRIO_BELOW_GENERIC
kEplDllAsyncReqPrio0 = 0x00, // till WSP 0.1.3: PRIO_GENERIC_REQUEST
} tEplDllAsyncReqPriority;
typedef struct {
unsigned int m_uiFrameSize;
tEplFrame *m_pFrame;
tEplNetTime m_NetTime;
} tEplFrameInfo;
typedef struct {
unsigned int m_uiSizeOfStruct;
BOOL m_fAsyncOnly; // do not need to register PRes-Frame
unsigned int m_uiNodeId; // local node ID
// 0x1F82: NMT_FeatureFlags_U32
u32 m_dwFeatureFlags;
// Cycle Length (0x1006: NMT_CycleLen_U32) in [us]
u32 m_dwCycleLen; // required for error detection
// 0x1F98: NMT_CycleTiming_REC
// 0x1F98.1: IsochrTxMaxPayload_U16
unsigned int m_uiIsochrTxMaxPayload; // const
// 0x1F98.2: IsochrRxMaxPayload_U16
unsigned int m_uiIsochrRxMaxPayload; // const
// 0x1F98.3: PResMaxLatency_U32
u32 m_dwPresMaxLatency; // const in [ns], only required for IdentRes
// 0x1F98.4: PReqActPayloadLimit_U16
unsigned int m_uiPreqActPayloadLimit; // required for initialisation (+24 bytes)
// 0x1F98.5: PResActPayloadLimit_U16
unsigned int m_uiPresActPayloadLimit; // required for initialisation of Pres frame (+24 bytes)
// 0x1F98.6: ASndMaxLatency_U32
u32 m_dwAsndMaxLatency; // const in [ns], only required for IdentRes
// 0x1F98.7: MultiplCycleCnt_U8
unsigned int m_uiMultiplCycleCnt; // required for error detection
// 0x1F98.8: AsyncMTU_U16
unsigned int m_uiAsyncMtu; // required to set up max frame size
// $$$ 0x1F98.9: Prescaler_U16
// $$$ Multiplexed Slot
// 0x1C14: DLL_LossOfFrameTolerance_U32 in [ns]
u32 m_dwLossOfFrameTolerance;
// 0x1F8A: NMT_MNCycleTiming_REC
// 0x1F8A.1: WaitSoCPReq_U32 in [ns]
u32 m_dwWaitSocPreq;
// 0x1F8A.2: AsyncSlotTimeout_U32 in [ns]
u32 m_dwAsyncSlotTimeout;
} tEplDllConfigParam;
typedef struct {
unsigned int m_uiSizeOfStruct;
u32 m_dwDeviceType; // NMT_DeviceType_U32
u32 m_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32
u32 m_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32
u32 m_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32
u32 m_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32
u64 m_qwVendorSpecificExt1;
u32 m_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
u32 m_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
u32 m_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_dwIpAddress;
u32 m_dwSubnetMask;
u32 m_dwDefaultGateway;
u8 m_sHostname[32];
u8 m_abVendorSpecificExt2[48];
} tEplDllIdentParam;
typedef struct {
unsigned int m_uiNodeId;
u16 m_wPreqPayloadLimit; // object 0x1F8B: NMT_MNPReqPayloadLimitList_AU16
u16 m_wPresPayloadLimit; // object 0x1F8D: NMT_PResPayloadLimitList_AU16
u32 m_dwPresTimeout; // object 0x1F92: NMT_MNCNPResTimeout_AU32
} tEplDllNodeInfo;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_DLL_H_

View File

@ -1,123 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for DLL Communication Abstraction Layer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDllCal.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLLCAL_H_
#define _EPL_DLLCAL_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
/*#ifndef EPL_DLLCAL_BUFFER_ID_RX
#define EPL_DLLCAL_BUFFER_ID_RX "EplSblDllCalRx"
#endif
#ifndef EPL_DLLCAL_BUFFER_SIZE_RX
#define EPL_DLLCAL_BUFFER_SIZE_RX 32767
#endif
*/
#ifndef EPL_DLLCAL_BUFFER_ID_TX_NMT
#define EPL_DLLCAL_BUFFER_ID_TX_NMT "EplSblDllCalTxNmt"
#endif
#ifndef EPL_DLLCAL_BUFFER_SIZE_TX_NMT
#define EPL_DLLCAL_BUFFER_SIZE_TX_NMT 32767
#endif
#ifndef EPL_DLLCAL_BUFFER_ID_TX_GEN
#define EPL_DLLCAL_BUFFER_ID_TX_GEN "EplSblDllCalTxGen"
#endif
#ifndef EPL_DLLCAL_BUFFER_SIZE_TX_GEN
#define EPL_DLLCAL_BUFFER_SIZE_TX_GEN 32767
#endif
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct {
tEplDllAsndServiceId m_ServiceId;
tEplDllAsndFilter m_Filter;
} tEplDllCalAsndServiceIdFilter;
typedef struct {
tEplDllReqServiceId m_Service;
unsigned int m_uiNodeId;
u8 m_bSoaFlag1;
} tEplDllCalIssueRequest;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_DLLKCAL_H_

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,529 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for DLL Communication Abstraction Layer module in EPL user part
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDlluCal.c,v $
$Author: D.Krueger $
$Revision: 1.7 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 d.k.: start of the implementation, version 1.00
****************************************************************************/
#include "user/EplDlluCal.h"
#include "user/EplEventu.h"
#include "EplDllCal.h"
// include only if direct call between user- and kernelspace is enabled
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
#include "kernel/EplDllkCal.h"
#endif
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S EplDlluCal */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
tEplDlluCbAsnd m_apfnDlluCbAsnd[EPL_DLL_MAX_ASND_SERVICE_ID];
} tEplDlluCalInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
// if no dynamic memory allocation shall be used
// define structures statically
static tEplDlluCalInstance EplDlluCalInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId
ServiceId_p,
tEplDllAsndFilter Filter_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplDlluCalAddInstance()
//
// Description: add and initialize new instance of DLL CAL module
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalAddInstance(void)
{
tEplKernel Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof(EplDlluCalInstance_g));
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalDelInstance()
//
// Description: deletes an instance of DLL CAL module
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalDelInstance(void)
{
tEplKernel Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof(EplDlluCalInstance_g));
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalProcess
//
// Description: process the passed asynch frame
//
// Parameters: pEvent_p = event containing frame to be processed
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalProcess(tEplEvent * pEvent_p)
{
tEplKernel Ret = kEplSuccessful;
tEplMsgType MsgType;
unsigned int uiAsndServiceId;
tEplFrameInfo FrameInfo;
if (pEvent_p->m_EventType == kEplEventTypeAsndRx) {
FrameInfo.m_pFrame = (tEplFrame *) pEvent_p->m_pArg;
FrameInfo.m_uiFrameSize = pEvent_p->m_uiSize;
// extract NetTime
FrameInfo.m_NetTime = pEvent_p->m_NetTime;
MsgType =
(tEplMsgType) AmiGetByteFromLe(&FrameInfo.m_pFrame->
m_le_bMessageType);
if (MsgType != kEplMsgTypeAsnd) {
Ret = kEplInvalidOperation;
goto Exit;
}
uiAsndServiceId =
(unsigned int)AmiGetByteFromLe(&FrameInfo.m_pFrame->m_Data.
m_Asnd.m_le_bServiceId);
if (uiAsndServiceId < EPL_DLL_MAX_ASND_SERVICE_ID) { // ASnd service ID is valid
if (EplDlluCalInstance_g.m_apfnDlluCbAsnd[uiAsndServiceId] != NULL) { // handler was registered
Ret =
EplDlluCalInstance_g.
m_apfnDlluCbAsnd[uiAsndServiceId]
(&FrameInfo);
}
}
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalRegAsndService()
//
// Description: registers the specified handler for the specified
// AsndServiceId with the specified node ID filter.
//
// Parameters: ServiceId_p = ASnd Service ID
// pfnDlluCbAsnd_p = callback function
// Filter_p = node ID filter
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalRegAsndService(tEplDllAsndServiceId ServiceId_p,
tEplDlluCbAsnd pfnDlluCbAsnd_p,
tEplDllAsndFilter Filter_p)
{
tEplKernel Ret = kEplSuccessful;
if (ServiceId_p < tabentries(EplDlluCalInstance_g.m_apfnDlluCbAsnd)) {
// memorize function pointer
EplDlluCalInstance_g.m_apfnDlluCbAsnd[ServiceId_p] =
pfnDlluCbAsnd_p;
if (pfnDlluCbAsnd_p == NULL) { // close filter
Filter_p = kEplDllAsndFilterNone;
}
// set filter in DLL module in kernel part
Ret = EplDlluCalSetAsndServiceIdFilter(ServiceId_p, Filter_p);
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalAsyncSend()
//
// Description: sends the frame with the specified priority.
//
// Parameters: pFrameInfo_p = frame
// m_uiFrameSize does not include the
// ethernet header (14 bytes)
// Priority_p = priority
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalAsyncSend(tEplFrameInfo * pFrameInfo_p,
tEplDllAsyncReqPriority Priority_p)
{
tEplKernel Ret = kEplSuccessful;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
pFrameInfo_p->m_uiFrameSize += 14; // add size of ethernet header
Ret = EplDllkCalAsyncSend(pFrameInfo_p, Priority_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
//---------------------------------------------------------------------------
//
// Function: EplDlluCalIssueRequest()
//
// Description: issues a StatusRequest or a IdentRequest to the specified node.
//
// Parameters: Service_p = request service ID
// uiNodeId_p = node ID
// bSoaFlag1_p = flag1 for this node (transmit in SoA and PReq)
// If 0xFF this flag is ignored.
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalIssueRequest(tEplDllReqServiceId Service_p,
unsigned int uiNodeId_p, u8 bSoaFlag1_p)
{
tEplKernel Ret = kEplSuccessful;
// add node to appropriate request queue
switch (Service_p) {
case kEplDllReqServiceIdent:
case kEplDllReqServiceStatus:
{
tEplEvent Event;
tEplDllCalIssueRequest IssueReq;
Event.m_EventSink = kEplEventSinkDllkCal;
Event.m_EventType = kEplEventTypeDllkIssueReq;
IssueReq.m_Service = Service_p;
IssueReq.m_uiNodeId = uiNodeId_p;
IssueReq.m_bSoaFlag1 = bSoaFlag1_p;
Event.m_pArg = &IssueReq;
Event.m_uiSize = sizeof(IssueReq);
Ret = EplEventuPost(&Event);
break;
}
default:
{
Ret = kEplDllInvalidParam;
goto Exit;
}
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalAddNode()
//
// Description: adds the specified node to the isochronous phase.
//
// Parameters: pNodeInfo_p = pointer of node info structure
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalAddNode(tEplDllNodeInfo * pNodeInfo_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkDllkCal;
Event.m_EventType = kEplEventTypeDllkAddNode;
Event.m_pArg = pNodeInfo_p;
Event.m_uiSize = sizeof(tEplDllNodeInfo);
Ret = EplEventuPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalDeleteNode()
//
// Description: removes the specified node from the isochronous phase.
//
// Parameters: uiNodeId_p = node ID
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalDeleteNode(unsigned int uiNodeId_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkDllkCal;
Event.m_EventType = kEplEventTypeDllkDelNode;
Event.m_pArg = &uiNodeId_p;
Event.m_uiSize = sizeof(uiNodeId_p);
Ret = EplEventuPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplDlluCalSoftDeleteNode()
//
// Description: removes the specified node softly from the isochronous phase.
//
// Parameters: uiNodeId_p = node ID
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplDlluCalSoftDeleteNode(unsigned int uiNodeId_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkDllkCal;
Event.m_EventType = kEplEventTypeDllkSoftDelNode;
Event.m_pArg = &uiNodeId_p;
Event.m_uiSize = sizeof(uiNodeId_p);
Ret = EplEventuPost(&Event);
return Ret;
}
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplDlluCalSetAsndServiceIdFilter()
//
// Description: forwards call to EplDllkSetAsndServiceIdFilter() in kernel part
//
// Parameters: ServiceId_p = ASnd Service ID
// Filter_p = node ID filter
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId
ServiceId_p,
tEplDllAsndFilter Filter_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
tEplDllCalAsndServiceIdFilter ServFilter;
Event.m_EventSink = kEplEventSinkDllkCal;
Event.m_EventType = kEplEventTypeDllkServFilter;
ServFilter.m_ServiceId = ServiceId_p;
ServFilter.m_Filter = Filter_p;
Event.m_pArg = &ServFilter;
Event.m_uiSize = sizeof(ServFilter);
Ret = EplEventuPost(&Event);
return Ret;
}
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
// EOF

View File

@ -1,294 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: definitions for all EPL-function return codes
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplErrDef.h,v $
$Author: D.Krueger $
$Revision: 1.9 $ $Date: 2008/06/23 14:56:33 $
$State: Exp $
Build Environment:
all
-------------------------------------------------------------------------
Revision History:
2005/12/05 -as: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_ERRORDEF_H_
#define _EPL_ERRORDEF_H_
//---------------------------------------------------------------------------
// return codes
//---------------------------------------------------------------------------
typedef enum {
// area for generic errors 0x0000 - 0x000F
kEplSuccessful = 0x0000, // no error/successful run
kEplIllegalInstance = 0x0001, // the called Instanz does not exist
kEplInvalidInstanceParam = 0x0002, //
kEplNoFreeInstance = 0x0003, // XxxAddInstance was called but no free instance is available
kEplWrongSignature = 0x0004, // wrong signature while writing to object 0x1010 or 0x1011
kEplInvalidOperation = 0x0005, // operation not allowed in this situation
kEplInvalidNodeId = 0x0007, // invalid NodeId was specified
kEplNoResource = 0x0008, // resource could not be created (Windows, PxROS, ...)
kEplShutdown = 0x0009, // stack is shutting down
kEplReject = 0x000A, // reject the subsequent command
// area for EDRV module 0x0010 - 0x001F
// kEplEdrvNoFrame = 0x0010, // no CAN message was received
// kEplEdrvMsgHigh = 0x0011, // CAN message with high priority was received
// kEplEdrvMsgLow = 0x0012, // CAN message with low priority was received
kEplEdrvInitError = 0x0013, // initialisation error
kEplEdrvNoFreeBufEntry = 0x0014, // no free entry in internal buffer table for Tx frames
kEplEdrvBufNotExisting = 0x0015, // specified Tx buffer does not exist
// kEplEdrvNoFreeChannel = 0x0014, // CAN controller has not a free channel
// kEplEdrvTxBuffHighOverrun = 0x0015, // buffer for high priority CAN transmit messages has overrun
// kEplEdrvTxBuffLowOverrun = 0x0016, // buffer for low priority CAN transmit messages has overrun
// kEplEdrvIllegalBdi = 0x0017, // unsupported baudrate within baudrate table
// kEplEdrvBusy = 0x0018, // remote frame can not be updated because no bus contact or CAN
// transmission is activ
// kEplEdrvInvalidDriverType = 0x0019, // (PC: Windows or Linux) invalid driver type
// kEplEdrvDriverNotFound = 0x001A, // (PC: Windows or Linux) driver (DLL) could not be found
// kEplEdrvInvalidBaseAddress = 0x001B, // (PC: Windows or Linux) driver could not found the CAN controller
// kEplEdrvInvalidParam = 0x001C, // invalid param in function call
// area for COB module 0x0020 - 0x002F
/* kEplCobNoFreeEntry = 0x0020, // no free entry in RX- or TX-COB table
kEplCobAlreadyExist = 0x0021, // COB-ID already exists in RX- resp. TX-COB table
*/
kEplDllIllegalHdl = 0x0022, // illegal handle for a TxFrame was passed
kEplDllCbAsyncRegistered = 0x0023, // handler for non-EPL frames was already registered before
// kEplDllAsyncRxBufferFull = 0x0024, // receive buffer for asynchronous frames is full
kEplDllAsyncTxBufferEmpty = 0x0025, // transmit buffer for asynchronous frames is empty
kEplDllAsyncTxBufferFull = 0x0026, // transmit buffer for asynchronous frames is full
kEplDllNoNodeInfo = 0x0027, // MN: too less space in the internal node info structure
kEplDllInvalidParam = 0x0028, // invalid parameters passed to function
kEplDllTxBufNotReady = 0x002E, // TxBuffer (e.g. for PReq) is not ready yet
kEplDllTxFrameInvalid = 0x002F, // TxFrame (e.g. for PReq) is invalid or does not exist
/* kEplCobIllegalCanId = 0x0023, // COB-ID is not allowed (like 0x000 is reserved for NMT, ...)
kEplCobInvalidCanId = 0x0024, // COB-ID is switched off
kEplCobCdrvStateSet = 0x0025, // at least one bit of CAN driver state is set
kEplCobNoFreeEntryHighBuf = 0x0026, // no free entry in high priotity RX- or TX-COB table
kEplCobOwnId = 0x0027, // COB-ID already exists in own module which calls CobDefine() or CobCheck()
*/
// area for OBD module 0x0030 - 0x003F
kEplObdIllegalPart = 0x0030, // unknown OD part
kEplObdIndexNotExist = 0x0031, // object index does not exist in OD
kEplObdSubindexNotExist = 0x0032, // subindex does not exist in object index
kEplObdReadViolation = 0x0033, // read access to a write-only object
kEplObdWriteViolation = 0x0034, // write access to a read-only object
kEplObdAccessViolation = 0x0035, // access not allowed
kEplObdUnknownObjectType = 0x0036, // object type not defined/known
kEplObdVarEntryNotExist = 0x0037, // object does not contain VarEntry structure
kEplObdValueTooLow = 0x0038, // value to write to an object is too low
kEplObdValueTooHigh = 0x0039, // value to write to an object is too high
kEplObdValueLengthError = 0x003A, // value to write is to long or to short
// kEplObdIllegalFloat = 0x003B, // illegal float variable
// kEplObdWrongOdBuilderKey = 0x003F, // OD was generated with demo version of tool ODBuilder
// area for NMT module 0x0040 - 0x004F
kEplNmtUnknownCommand = 0x0040, // unknown NMT command
kEplNmtInvalidFramePointer = 0x0041, // pointer to the frame is not valid
kEplNmtInvalidEvent = 0x0042, // invalid event send to NMT-modul
kEplNmtInvalidState = 0x0043, // unknown state in NMT-State-Maschine
kEplNmtInvalidParam = 0x0044, // invalid parameters specified
// area for SDO/UDP module 0x0050 - 0x005F
kEplSdoUdpMissCb = 0x0050, // missing callback-function pointer during inti of
// module
kEplSdoUdpNoSocket = 0x0051, // error during init of socket
kEplSdoUdpSocketError = 0x0052, // error during usage of socket
kEplSdoUdpThreadError = 0x0053, // error during start of listen thread
kEplSdoUdpNoFreeHandle = 0x0054, // no free connection handle for Udp
kEplSdoUdpSendError = 0x0055, // Error during send of frame
kEplSdoUdpInvalidHdl = 0x0056, // the connection handle is invalid
// area for SDO Sequence layer module 0x0060 - 0x006F
kEplSdoSeqMissCb = 0x0060, // no callback-function assign
kEplSdoSeqNoFreeHandle = 0x0061, // no free handle for connection
kEplSdoSeqInvalidHdl = 0x0062, // invalid handle in SDO sequence layer
kEplSdoSeqUnsupportedProt = 0x0063, // unsupported Protocol selected
kEplSdoSeqNoFreeHistory = 0x0064, // no free entry in history
kEplSdoSeqFrameSizeError = 0x0065, // the size of the frames is not correct
kEplSdoSeqRequestAckNeeded = 0x0066, // indeicates that the history buffer is full
// and a ack request is needed
kEplSdoSeqInvalidFrame = 0x0067, // frame not valid
kEplSdoSeqConnectionBusy = 0x0068, // connection is busy -> retry later
kEplSdoSeqInvalidEvent = 0x0069, // invalid event received
// area for SDO Command Layer Module 0x0070 - 0x007F
kEplSdoComUnsupportedProt = 0x0070, // unsupported Protocol selected
kEplSdoComNoFreeHandle = 0x0071, // no free handle for connection
kEplSdoComInvalidServiceType = 0x0072, // invalid SDO service type specified
kEplSdoComInvalidHandle = 0x0073, // handle invalid
kEplSdoComInvalidSendType = 0x0074, // the stated to of frame to send is
// not possible
kEplSdoComNotResponsible = 0x0075, // internal error: command layer handle is
// not responsible for this event from sequence layer
kEplSdoComHandleExists = 0x0076, // handle to same node already exists
kEplSdoComHandleBusy = 0x0077, // transfer via this handle is already running
kEplSdoComInvalidParam = 0x0078, // invalid parameters passed to function
// area for EPL Event-Modul 0x0080 - 0x008F
kEplEventUnknownSink = 0x0080, // unknown sink for event
kEplEventPostError = 0x0081, // error during post of event
// area for EPL Timer Modul 0x0090 - 0x009F
kEplTimerInvalidHandle = 0x0090, // invalid handle for timer
kEplTimerNoTimerCreated = 0x0091, // no timer was created caused by
// an error
// area for EPL SDO/Asnd Module 0x00A0 - 0x0AF
kEplSdoAsndInvalidNodeId = 0x00A0, //0 node id is invalid
kEplSdoAsndNoFreeHandle = 0x00A1, // no free handle for connection
kEplSdoAsndInvalidHandle = 0x00A2, // handle for connection is invalid
// area for PDO module 0x00B0 - 0x00BF
kEplPdoNotExist = 0x00B0, // selected PDO does not exist
kEplPdoLengthExceeded = 0x00B1, // length of PDO mapping exceedes 64 bis
kEplPdoGranularityMismatch = 0x00B2, // configured PDO granularity is not equal to supported granularity
kEplPdoInitError = 0x00B3, // error during initialisation of PDO module
kEplPdoErrorPdoEncode = 0x00B4, // error during encoding a PDO
kEplPdoErrorPdoDecode = 0x00B5, // error during decoding a PDO
kEplPdoErrorSend = 0x00B6, // error during sending a PDO
kEplPdoErrorSyncWin = 0x00B7, // the SYNC window runs out during sending SYNC-PDOs
kEplPdoErrorMapp = 0x00B8, // invalid PDO mapping
kEplPdoVarNotFound = 0x00B9, // variable was not found in function PdoSignalVar()
kEplPdoErrorEmcyPdoLen = 0x00BA, // the length of a received PDO is unequal to the expected value
kEplPdoWriteConstObject = 0x00BB, // constant object can not be written
// (only TxType, Inhibit-, Event Time for CANopen Kit)
// area for LSS slave module
/* kEplLsssResetNode = 0x0080, // NMT command "reset node" has to be processed after LSS configuration
// new of NodeId
kEplLsssInvalidNodeId = 0x0081, // no valid NodeId is configured -> wait until it is configured with
// LSS service before calling CcmConnectToNet()
*/
// area for emergency consumer module 0x0090 - 0x009F
/* kEplEmccNoFreeProducerEntry = 0x0090, // no free entry to add a Emergency Producer
kEplEmccNodeIdNotExist = 0x0091, // selected NodeId was never added
kEplEmccNodeIdInvalid = 0x0092, // selected NodeId is outside of range (0x01 until 0x7F)
kEplEmccNodeIdExist = 0x0093, // selected NodeId already exist
*/
// area for dynamic OD 0x00A0 - 0x00AF
/* kEplDynNoMemory = 0x00A0, // no memory available
kEplDynInvalidConfig = 0x00A1, // invalid configuration in segment container
*/
// area for hertbeat consumer module 0x00B0 - 0x00BF
/* kEplHbcEntryNotExist = 0x00B0, // Heartbeat Producer node not configured
kEplHbcEntryAlreadyExist = 0x00B1, // NodeId was already defined in heartbeat consumer table (object 0x1016)
*/
// Configuration manager module 0x00C0 - 0x00CF
kEplCfgMaConfigError = 0x00C0, // error in configuration manager
kEplCfgMaSdocTimeOutError = 0x00C1, // error in configuration manager, Sdo timeout
kEplCfgMaInvalidDcf = 0x00C2, // configration file not valid
kEplCfgMaUnsupportedDcf = 0x00C3, // unsupported Dcf format
kEplCfgMaConfigWithErrors = 0x00C4, // configuration finished with errors
kEplCfgMaNoFreeConfig = 0x00C5, // no free configuration entry
kEplCfgMaNoConfigData = 0x00C6, // no configuration data present
kEplCfgMaUnsuppDatatypeDcf = 0x00C7, // unsupported datatype found in dcf
// -> this entry was not configured
// area for LSS master module 0x00D0 - 0x00DF
/* kEplLssmIllegalMode = 0x00D0, // illegal LSS mode (operation / configuration)
kEplLssmIllegalState = 0x00D1, // function was called in illegal state of LSS master
kEplLssmBusy = 0x00D2, // LSS process is busy with an previous service
kEplLssmIllegalCmd = 0x00D3, // illegal command code was set for function LssmInquireIdentity()
kEplLssmTimeout = 0x00D4, // LSS slave did not answer a LSS service
kEplLssmErrorInConfirm = 0x00D5, // LSS slave replied an error code for a LSS service
*/
// area for CCM modules 0x00E0 - 0xEF
/* kEplCcmStoreUnvalidState = 0x00E0, // memory device not available due device state
kEplCcmStoreHwError = 0x00E1, // hw error due device access
*/
// area for SRDO module 0x0100 - 0x011F
/* kEplSrdoNotExist = 0x0100, // selected SRDO does not exist
kEplSrdoGranularityMismatch = 0x0101, // configured SRDO granularity is not equal to supported granularity
kEplSrdoCfgTimingError = 0x0102, // configuration is not ok (Timing)
kEplSrdoCfgIdError = 0x0103, // configuration is not ok (CobIds)
kEplSrdoCfgCrcError = 0x0104, // configuration is not ok (CRC)
kEplSrdoNmtError = 0x0105, // an action was tried in a wrong NMT state
kEplSrdoInvalidCfg = 0x0106, // an action was tried with an invald SRDO configuration
kEplSrdoInvalid = 0x0107, // an action was tried with an invald SRDO
kEplSrdoRxTxConflict = 0x0108, // an transmission was tried with an receive SRDO (or the other way)
kEplSrdoIllegalCanId = 0x0109, // the CanId is invalid
kEplSrdoCanIdAlreadyInUse = 0x010A, // the CanId is already in use
kEplSrdoNotInOrder = 0x010B, // the two messages of a SRDO are not in order
kEplSrdoSctTimeout = 0x010C, // timeout of SCT
kEplSrdoSrvtTimeout = 0x010D, // timeout of SRVT
kEplSrdoCanIdNotValid = 0x010E, // one of received CAN-IDs are not equal to configured one
kEplSrdoDlcNotValid = 0x010F, // one of received CAN-DLC are not equal to configured one
kEplSrdoErrorMapp = 0x0110, // wrong values in mapping found
kEplSrdoDataError = 0x0111, // data of CAN messages are not invers
kEplSrdoLengthExceeded = 0x0112, // length of SRDO mapping exceedes 64 bit per CAN-message
kEplSrdoNotHandledInApp = 0x0113, // the SRDO error was not handled in AppSrdoError()
kEplSrdoOverrun = 0x0114 // a RxSRDO was received but the pevious one was not else processed
*/
kEplApiTaskDeferred = 0x0140, // EPL performs task in background and informs the application (or vice-versa), when it is finished
kEplApiInvalidParam = 0x0142, // passed invalid parameters to a function (e.g. invalid node id)
// area untill 0x07FF is reserved
// area for user application from 0x0800 to 0x7FFF
} tEplKernel;
#endif
//EOF
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

View File

@ -1,810 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for error handler module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplErrorHandlerk.c,v $
$Author: D.Krueger $
$Revision: 1.9 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/10/02 d.k.: start of the implementation
****************************************************************************/
#include "kernel/EplErrorHandlerk.h"
#include "EplNmt.h"
#include "kernel/EplEventk.h"
#include "kernel/EplObdk.h" // function prototyps of the EplOBD-Modul
#include "kernel/EplDllk.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) == 0)
#error "EPL ErrorHandler module needs EPL module OBDK!"
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
u32 m_dwCumulativeCnt; // subindex 1
u32 m_dwThresholdCnt; // subindex 2
u32 m_dwThreshold; // subindex 3
} tEplErrorHandlerkErrorCounter;
typedef struct {
tEplErrorHandlerkErrorCounter m_CnLossSoc; // object 0x1C0B
tEplErrorHandlerkErrorCounter m_CnLossPreq; // object 0x1C0D
tEplErrorHandlerkErrorCounter m_CnCrcErr; // object 0x1C0F
unsigned long m_ulDllErrorEvents;
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplErrorHandlerkErrorCounter m_MnCrcErr; // object 0x1C00
tEplErrorHandlerkErrorCounter m_MnCycTimeExceed; // object 0x1C02
u32 m_adwMnCnLossPresCumCnt[254]; // object 0x1C07
u32 m_adwMnCnLossPresThrCnt[254]; // object 0x1C08
u32 m_adwMnCnLossPresThreshold[254]; // object 0x1C09
BOOL m_afMnCnLossPresEvent[254];
#endif
} tEplErrorHandlerkInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplErrorHandlerkInstance EplErrorHandlerkInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplKernel EplErrorHandlerkLinkErrorCounter(tEplErrorHandlerkErrorCounter
* pErrorCounter_p,
unsigned int uiIndex_p);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
static tEplKernel EplErrorHandlerkLinkArray(u32 * pdwValue_p,
unsigned int uiValueCount_p,
unsigned int uiIndex_p);
#endif
/***************************************************************************/
/* */
/* */
/* C L A S S <Epl-Kernelspace-Error-Handler> */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkInit
//
// Description: function initialize the first instance
//
//
//
// Parameters:
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplErrorHandlerkInit(void)
{
tEplKernel Ret;
Ret = EplErrorHandlerkAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkAddInstance
//
// Description: function add one more instance
//
//
//
// Parameters:
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplErrorHandlerkAddInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// reset only event variable,
// all other instance members are reset by OD or may keep their current value
// d.k.: this is necessary for the cumulative counters, which shall not be reset
EplErrorHandlerkInstance_g.m_ulDllErrorEvents = 0;
// link counters to OD
// $$$ d.k. if OD resides in userspace, fetch pointer to shared memory,
// which shall have the same structure as the instance (needs to be declared globally).
// Other idea: error counter shall belong to the process image
// (reset of counters by SDO write are a little bit tricky).
Ret =
EplErrorHandlerkLinkErrorCounter(&EplErrorHandlerkInstance_g.
m_CnLossSoc, 0x1C0B);
if (Ret != kEplSuccessful) {
goto Exit;
}
Ret =
EplErrorHandlerkLinkErrorCounter(&EplErrorHandlerkInstance_g.
m_CnLossPreq, 0x1C0D);
// ignore return code, because object 0x1C0D is conditional
Ret =
EplErrorHandlerkLinkErrorCounter(&EplErrorHandlerkInstance_g.
m_CnCrcErr, 0x1C0F);
if (Ret != kEplSuccessful) {
goto Exit;
}
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
Ret =
EplErrorHandlerkLinkErrorCounter(&EplErrorHandlerkInstance_g.
m_MnCrcErr, 0x1C00);
if (Ret != kEplSuccessful) {
goto Exit;
}
Ret =
EplErrorHandlerkLinkErrorCounter(&EplErrorHandlerkInstance_g.
m_MnCycTimeExceed, 0x1C02);
if (Ret != kEplSuccessful) {
goto Exit;
}
Ret =
EplErrorHandlerkLinkArray(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresCumCnt,
tabentries(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresCumCnt),
0x1C07);
if (Ret != kEplSuccessful) {
goto Exit;
}
Ret =
EplErrorHandlerkLinkArray(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThrCnt,
tabentries(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThrCnt),
0x1C08);
if (Ret != kEplSuccessful) {
goto Exit;
}
Ret =
EplErrorHandlerkLinkArray(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThreshold,
tabentries(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThreshold),
0x1C09);
if (Ret != kEplSuccessful) {
goto Exit;
}
#endif
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkDelInstance
//
// Description: function delete instance an free the bufferstructure
//
//
//
// Parameters:
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplErrorHandlerkDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkProcess
//
// Description: processes error events from DLL
//
//
//
// Parameters: pEvent_p = pointer to event-structur from buffer
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplErrorHandlerkProcess(tEplEvent *pEvent_p)
{
tEplKernel Ret;
unsigned long ulDllErrorEvents;
tEplEvent Event;
tEplNmtEvent NmtEvent;
Ret = kEplSuccessful;
// check m_EventType
switch (pEvent_p->m_EventType) {
case kEplEventTypeDllError:
{
tEplErrorHandlerkEvent *pErrHandlerEvent =
(tEplErrorHandlerkEvent *) pEvent_p->m_pArg;
ulDllErrorEvents = pErrHandlerEvent->m_ulDllErrorEvents;
// check the several error events
if ((EplErrorHandlerkInstance_g.m_CnLossSoc.
m_dwThreshold > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_CN_LOSS_SOC) != 0)) { // loss of SoC event occured
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.m_CnLossSoc.
m_dwCumulativeCnt++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.m_CnLossSoc.
m_dwThresholdCnt += 8;
if (EplErrorHandlerkInstance_g.m_CnLossSoc.m_dwThresholdCnt >= EplErrorHandlerkInstance_g.m_CnLossSoc.m_dwThreshold) { // threshold is reached
// $$$ d.k.: generate error history entry E_DLL_LOSS_SOC_TH
// post event to NMT state machine
NmtEvent = kEplNmtEventNmtCycleError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
EplErrorHandlerkInstance_g.m_ulDllErrorEvents |=
EPL_DLL_ERR_CN_LOSS_SOC;
}
if ((EplErrorHandlerkInstance_g.m_CnLossPreq.
m_dwThreshold > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_CN_LOSS_PREQ) != 0)) { // loss of PReq event occured
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.m_CnLossPreq.
m_dwCumulativeCnt++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.m_CnLossPreq.
m_dwThresholdCnt += 8;
if (EplErrorHandlerkInstance_g.m_CnLossPreq.m_dwThresholdCnt >= EplErrorHandlerkInstance_g.m_CnLossPreq.m_dwThreshold) { // threshold is reached
// $$$ d.k.: generate error history entry E_DLL_LOSS_PREQ_TH
// post event to NMT state machine
NmtEvent = kEplNmtEventNmtCycleError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
}
if ((EplErrorHandlerkInstance_g.m_CnLossPreq.
m_dwThresholdCnt > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_CN_RECVD_PREQ) != 0)) { // PReq correctly received
// decrement threshold counter by 1
EplErrorHandlerkInstance_g.m_CnLossPreq.
m_dwThresholdCnt--;
}
if ((EplErrorHandlerkInstance_g.m_CnCrcErr.
m_dwThreshold > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_CN_CRC) != 0)) { // CRC error event occured
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.m_CnCrcErr.
m_dwCumulativeCnt++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.m_CnCrcErr.
m_dwThresholdCnt += 8;
if (EplErrorHandlerkInstance_g.m_CnCrcErr.m_dwThresholdCnt >= EplErrorHandlerkInstance_g.m_CnCrcErr.m_dwThreshold) { // threshold is reached
// $$$ d.k.: generate error history entry E_DLL_CRC_TH
// post event to NMT state machine
NmtEvent = kEplNmtEventNmtCycleError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
EplErrorHandlerkInstance_g.m_ulDllErrorEvents |=
EPL_DLL_ERR_CN_CRC;
}
if ((ulDllErrorEvents & EPL_DLL_ERR_INVALID_FORMAT) != 0) { // invalid format error occured (only direct reaction)
// $$$ d.k.: generate error history entry E_DLL_INVALID_FORMAT
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
if (pErrHandlerEvent->m_NmtState >= kEplNmtMsNotActive) { // MN is active
if (pErrHandlerEvent->m_uiNodeId != 0) {
tEplHeartbeatEvent
HeartbeatEvent;
// remove node from isochronous phase
Ret =
EplDllkDeleteNode
(pErrHandlerEvent->
m_uiNodeId);
// inform NmtMnu module about state change, which shall send NMT command ResetNode to this CN
HeartbeatEvent.m_uiNodeId =
pErrHandlerEvent->
m_uiNodeId;
HeartbeatEvent.m_NmtState =
kEplNmtCsNotActive;
HeartbeatEvent.m_wErrorCode =
EPL_E_DLL_INVALID_FORMAT;
Event.m_EventSink =
kEplEventSinkNmtMnu;
Event.m_EventType =
kEplEventTypeHeartbeat;
Event.m_uiSize =
sizeof(HeartbeatEvent);
Event.m_pArg = &HeartbeatEvent;
Ret = EplEventkPost(&Event);
}
// $$$ and else should lead to InternComError
} else
#endif
{ // CN is active
// post event to NMT state machine
NmtEvent = kEplNmtEventInternComError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
}
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
if ((EplErrorHandlerkInstance_g.m_MnCrcErr.
m_dwThreshold > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_MN_CRC) != 0)) { // CRC error event occured
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.m_MnCrcErr.
m_dwCumulativeCnt++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.m_MnCrcErr.
m_dwThresholdCnt += 8;
if (EplErrorHandlerkInstance_g.m_MnCrcErr.m_dwThresholdCnt >= EplErrorHandlerkInstance_g.m_MnCrcErr.m_dwThreshold) { // threshold is reached
// $$$ d.k.: generate error history entry E_DLL_CRC_TH
// post event to NMT state machine
NmtEvent = kEplNmtEventNmtCycleError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
EplErrorHandlerkInstance_g.m_ulDllErrorEvents |=
EPL_DLL_ERR_MN_CRC;
}
if ((EplErrorHandlerkInstance_g.m_MnCycTimeExceed.
m_dwThreshold > 0)
&& ((ulDllErrorEvents & EPL_DLL_ERR_MN_CYCTIMEEXCEED) != 0)) { // cycle time exceeded event occured
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.m_MnCycTimeExceed.
m_dwCumulativeCnt++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.m_MnCycTimeExceed.
m_dwThresholdCnt += 8;
if (EplErrorHandlerkInstance_g.m_MnCycTimeExceed.m_dwThresholdCnt >= EplErrorHandlerkInstance_g.m_MnCycTimeExceed.m_dwThreshold) { // threshold is reached
// $$$ d.k.: generate error history entry E_DLL_CYCLE_EXCEED_TH
// post event to NMT state machine
NmtEvent = kEplNmtEventNmtCycleError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_EventType =
kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplEventkPost(&Event);
}
// $$$ d.k.: else generate error history entry E_DLL_CYCLE_EXCEED
EplErrorHandlerkInstance_g.m_ulDllErrorEvents |=
EPL_DLL_ERR_MN_CYCTIMEEXCEED;
}
if ((ulDllErrorEvents & EPL_DLL_ERR_MN_CN_LOSS_PRES) != 0) { // CN loss PRes event occured
unsigned int uiNodeId;
uiNodeId = pErrHandlerEvent->m_uiNodeId - 1;
if ((uiNodeId <
tabentries(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresCumCnt))
&& (EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThreshold[uiNodeId] >
0)) {
// increment cumulative counter by 1
EplErrorHandlerkInstance_g.
m_adwMnCnLossPresCumCnt[uiNodeId]++;
// increment threshold counter by 8
EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThrCnt[uiNodeId] +=
8;
if (EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThrCnt[uiNodeId]
>= EplErrorHandlerkInstance_g.m_adwMnCnLossPresThreshold[uiNodeId]) { // threshold is reached
tEplHeartbeatEvent
HeartbeatEvent;
// $$$ d.k.: generate error history entry E_DLL_LOSS_PRES_TH
// remove node from isochronous phase
Ret =
EplDllkDeleteNode
(pErrHandlerEvent->
m_uiNodeId);
// inform NmtMnu module about state change, which shall send NMT command ResetNode to this CN
HeartbeatEvent.m_uiNodeId =
pErrHandlerEvent->
m_uiNodeId;
HeartbeatEvent.m_NmtState =
kEplNmtCsNotActive;
HeartbeatEvent.m_wErrorCode =
EPL_E_DLL_LOSS_PRES_TH;
Event.m_EventSink =
kEplEventSinkNmtMnu;
Event.m_EventType =
kEplEventTypeHeartbeat;
Event.m_uiSize =
sizeof(HeartbeatEvent);
Event.m_pArg = &HeartbeatEvent;
Ret = EplEventkPost(&Event);
}
EplErrorHandlerkInstance_g.
m_afMnCnLossPresEvent[uiNodeId] =
TRUE;
}
}
#endif
break;
}
// NMT event
case kEplEventTypeNmtEvent:
{
if ((*(tEplNmtEvent *) pEvent_p->m_pArg) == kEplNmtEventDllCeSoa) { // SoA event of CN -> decrement threshold counters
if ((EplErrorHandlerkInstance_g.m_ulDllErrorEvents & EPL_DLL_ERR_CN_LOSS_SOC) == 0) { // decrement loss of SoC threshold counter, because it didn't occur last cycle
if (EplErrorHandlerkInstance_g.
m_CnLossSoc.m_dwThresholdCnt > 0) {
EplErrorHandlerkInstance_g.
m_CnLossSoc.
m_dwThresholdCnt--;
}
}
if ((EplErrorHandlerkInstance_g.m_ulDllErrorEvents & EPL_DLL_ERR_CN_CRC) == 0) { // decrement CRC threshold counter, because it didn't occur last cycle
if (EplErrorHandlerkInstance_g.
m_CnCrcErr.m_dwThresholdCnt > 0) {
EplErrorHandlerkInstance_g.
m_CnCrcErr.
m_dwThresholdCnt--;
}
}
}
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
else if ((*(tEplNmtEvent *) pEvent_p->m_pArg) == kEplNmtEventDllMeSoaSent) { // SoA event of MN -> decrement threshold counters
tEplDllkNodeInfo *pIntNodeInfo;
unsigned int uiNodeId;
Ret = EplDllkGetFirstNodeInfo(&pIntNodeInfo);
if (Ret != kEplSuccessful) {
break;
}
// iterate through node info structure list
while (pIntNodeInfo != NULL) {
uiNodeId = pIntNodeInfo->m_uiNodeId - 1;
if (uiNodeId <
tabentries
(EplErrorHandlerkInstance_g.
m_adwMnCnLossPresCumCnt)) {
if (EplErrorHandlerkInstance_g.
m_afMnCnLossPresEvent
[uiNodeId] == FALSE) {
if (EplErrorHandlerkInstance_g.m_adwMnCnLossPresThrCnt[uiNodeId] > 0) {
EplErrorHandlerkInstance_g.
m_adwMnCnLossPresThrCnt
[uiNodeId]--;
}
} else {
EplErrorHandlerkInstance_g.
m_afMnCnLossPresEvent
[uiNodeId] = FALSE;
}
}
pIntNodeInfo =
pIntNodeInfo->m_pNextNodeInfo;
}
if ((EplErrorHandlerkInstance_g.m_ulDllErrorEvents & EPL_DLL_ERR_MN_CRC) == 0) { // decrement CRC threshold counter, because it didn't occur last cycle
if (EplErrorHandlerkInstance_g.
m_MnCrcErr.m_dwThresholdCnt > 0) {
EplErrorHandlerkInstance_g.
m_MnCrcErr.
m_dwThresholdCnt--;
}
}
if ((EplErrorHandlerkInstance_g.m_ulDllErrorEvents & EPL_DLL_ERR_MN_CYCTIMEEXCEED) == 0) { // decrement cycle exceed threshold counter, because it didn't occur last cycle
if (EplErrorHandlerkInstance_g.
m_MnCycTimeExceed.m_dwThresholdCnt >
0) {
EplErrorHandlerkInstance_g.
m_MnCycTimeExceed.
m_dwThresholdCnt--;
}
}
}
#endif
// reset error events
EplErrorHandlerkInstance_g.m_ulDllErrorEvents = 0L;
break;
}
// unknown type
default:
{
}
} // end of switch(pEvent_p->m_EventType)
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkLinkErrorCounter
//
// Description: link specified error counter structure to OD entry
//
// Parameters: pErrorCounter_p = pointer to error counter structure
// uiIndex_p = OD index
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplErrorHandlerkLinkErrorCounter(tEplErrorHandlerkErrorCounter
* pErrorCounter_p,
unsigned int uiIndex_p)
{
tEplKernel Ret = kEplSuccessful;
tEplVarParam VarParam;
VarParam.m_pData = &pErrorCounter_p->m_dwCumulativeCnt;
VarParam.m_Size = sizeof(u32);
VarParam.m_uiIndex = uiIndex_p;
VarParam.m_uiSubindex = 0x01;
VarParam.m_ValidFlag = kVarValidAll;
Ret = EplObdDefineVar(&VarParam);
if (Ret != kEplSuccessful) {
goto Exit;
}
VarParam.m_pData = &pErrorCounter_p->m_dwThresholdCnt;
VarParam.m_Size = sizeof(u32);
VarParam.m_uiIndex = uiIndex_p;
VarParam.m_uiSubindex = 0x02;
VarParam.m_ValidFlag = kVarValidAll;
Ret = EplObdDefineVar(&VarParam);
if (Ret != kEplSuccessful) {
goto Exit;
}
VarParam.m_pData = &pErrorCounter_p->m_dwThreshold;
VarParam.m_Size = sizeof(u32);
VarParam.m_uiIndex = uiIndex_p;
VarParam.m_uiSubindex = 0x03;
VarParam.m_ValidFlag = kVarValidAll;
Ret = EplObdDefineVar(&VarParam);
if (Ret != kEplSuccessful) {
goto Exit;
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplErrorHandlerkLinkErrorCounter
//
// Description: link specified error counter structure to OD entry
//
// Parameters: pErrorCounter_p = pointer to error counter structure
// uiIndex_p = OD index
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
static tEplKernel EplErrorHandlerkLinkArray(u32 * pdwValue_p,
unsigned int uiValueCount_p,
unsigned int uiIndex_p)
{
tEplKernel Ret = kEplSuccessful;
tEplVarParam VarParam;
tEplObdSize EntrySize;
u8 bIndexEntries;
EntrySize = (tEplObdSize) sizeof(bIndexEntries);
Ret = EplObdReadEntry(uiIndex_p,
0x00, (void *)&bIndexEntries, &EntrySize);
if ((Ret != kEplSuccessful) || (bIndexEntries == 0x00)) {
// Object doesn't exist or invalid entry number
Ret = kEplObdIndexNotExist;
goto Exit;
}
if (bIndexEntries < uiValueCount_p) {
uiValueCount_p = bIndexEntries;
}
VarParam.m_Size = sizeof(u32);
VarParam.m_uiIndex = uiIndex_p;
VarParam.m_ValidFlag = kVarValidAll;
for (VarParam.m_uiSubindex = 0x01;
VarParam.m_uiSubindex <= uiValueCount_p; VarParam.m_uiSubindex++) {
VarParam.m_pData = pdwValue_p;
Ret = EplObdDefineVar(&VarParam);
if (Ret != kEplSuccessful) {
goto Exit;
}
pdwValue_p++;
}
Exit:
return Ret;
}
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
// EOF

View File

@ -1,279 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for event module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplEvent.h,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/12 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_EVENT_H_
#define _EPL_EVENT_H_
#include "EplInc.h"
#include "EplNmt.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// name and size of event queues
#define EPL_EVENT_NAME_SHB_KERNEL_TO_USER "ShbKernelToUser"
#ifndef EPL_EVENT_SIZE_SHB_KERNEL_TO_USER
#define EPL_EVENT_SIZE_SHB_KERNEL_TO_USER 32768 // 32 kByte
#endif
#define EPL_EVENT_NAME_SHB_USER_TO_KERNEL "ShbUserToKernel"
#ifndef EPL_EVENT_SIZE_SHB_USER_TO_KERNEL
#define EPL_EVENT_SIZE_SHB_USER_TO_KERNEL 32768 // 32 kByte
#endif
// max size of event argument
#ifndef EPL_MAX_EVENT_ARG_SIZE
#define EPL_MAX_EVENT_ARG_SIZE 256 // because of PDO
#endif
#define EPL_DLL_ERR_MN_CRC 0x00000001L // object 0x1C00
#define EPL_DLL_ERR_MN_COLLISION 0x00000002L // object 0x1C01
#define EPL_DLL_ERR_MN_CYCTIMEEXCEED 0x00000004L // object 0x1C02
#define EPL_DLL_ERR_MN_LOSS_LINK 0x00000008L // object 0x1C03
#define EPL_DLL_ERR_MN_CN_LATE_PRES 0x00000010L // objects 0x1C04-0x1C06
#define EPL_DLL_ERR_MN_CN_LOSS_PRES 0x00000080L // objects 0x1C07-0x1C09
#define EPL_DLL_ERR_CN_COLLISION 0x00000400L // object 0x1C0A
#define EPL_DLL_ERR_CN_LOSS_SOC 0x00000800L // object 0x1C0B
#define EPL_DLL_ERR_CN_LOSS_SOA 0x00001000L // object 0x1C0C
#define EPL_DLL_ERR_CN_LOSS_PREQ 0x00002000L // object 0x1C0D
#define EPL_DLL_ERR_CN_RECVD_PREQ 0x00004000L // decrement object 0x1C0D/2
#define EPL_DLL_ERR_CN_SOC_JITTER 0x00008000L // object 0x1C0E
#define EPL_DLL_ERR_CN_CRC 0x00010000L // object 0x1C0F
#define EPL_DLL_ERR_CN_LOSS_LINK 0x00020000L // object 0x1C10
#define EPL_DLL_ERR_MN_LOSS_STATRES 0x00040000L // objects 0x1C15-0x1C17 (should be operated by NmtMnu module)
#define EPL_DLL_ERR_BAD_PHYS_MODE 0x00080000L // no object
#define EPL_DLL_ERR_MAC_BUFFER 0x00100000L // no object (NMT_GT6)
#define EPL_DLL_ERR_INVALID_FORMAT 0x00200000L // no object (NMT_GT6)
#define EPL_DLL_ERR_ADDRESS_CONFLICT 0x00400000L // no object (remove CN from configuration)
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// EventType determines the argument of the event
typedef enum {
kEplEventTypeNmtEvent = 0x01, // NMT event
// arg is pointer to tEplNmtEvent
kEplEventTypePdoRx = 0x02, // PDO frame received event (PRes/PReq)
// arg is pointer to tEplFrame
kEplEventTypePdoTx = 0x03, // PDO frame transmitted event (PRes/PReq)
// arg is pointer to tEplFrameInfo
kEplEventTypePdoSoa = 0x04, // SoA frame received event (isochronous phase completed)
// arg is pointer to nothing
kEplEventTypeSync = 0x05, // Sync event (e.g. SoC or anticipated SoC)
// arg is pointer to nothing
kEplEventTypeTimer = 0x06, // Timer event
// arg is pointer to tEplTimerEventArg
kEplEventTypeHeartbeat = 0x07, // Heartbeat event
// arg is pointer to tEplHeartbeatEvent
kEplEventTypeDllkCreate = 0x08, // DLL kernel create event
// arg is pointer to the new tEplNmtState
kEplEventTypeDllkDestroy = 0x09, // DLL kernel destroy event
// arg is pointer to the old tEplNmtState
kEplEventTypeDllkFillTx = 0x0A, // DLL kernel fill TxBuffer event
// arg is pointer to tEplDllAsyncReqPriority
kEplEventTypeDllkPresReady = 0x0B, // DLL kernel PRes ready event
// arg is pointer to nothing
kEplEventTypeError = 0x0C, // Error event for API layer
// arg is pointer to tEplEventError
kEplEventTypeNmtStateChange = 0x0D, // indicate change of NMT-State
// arg is pointer to tEplEventNmtStateChange
kEplEventTypeDllError = 0x0E, // DLL error event for Error handler
// arg is pointer to tEplErrorHandlerkEvent
kEplEventTypeAsndRx = 0x0F, // received ASnd frame for DLL user module
// arg is pointer to tEplFrame
kEplEventTypeDllkServFilter = 0x10, // configure ServiceIdFilter
// arg is pointer to tEplDllCalServiceIdFilter
kEplEventTypeDllkIdentity = 0x11, // configure Identity
// arg is pointer to tEplDllIdentParam
kEplEventTypeDllkConfig = 0x12, // configure ConfigParam
// arg is pointer to tEplDllConfigParam
kEplEventTypeDllkIssueReq = 0x13, // issue Ident/Status request
// arg is pointer to tEplDllCalIssueRequest
kEplEventTypeDllkAddNode = 0x14, // add node to isochronous phase
// arg is pointer to tEplDllNodeInfo
kEplEventTypeDllkDelNode = 0x15, // remove node from isochronous phase
// arg is pointer to unsigned int
kEplEventTypeDllkSoftDelNode = 0x16, // remove node softly from isochronous phase
// arg is pointer to unsigned int
kEplEventTypeDllkStartReducedCycle = 0x17, // start reduced EPL cycle on MN
// arg is pointer to nothing
kEplEventTypeNmtMnuNmtCmdSent = 0x18, // NMT command was actually sent
// arg is pointer to tEplFrame
} tEplEventType;
// EventSink determines the consumer of the event
typedef enum {
kEplEventSinkSync = 0x00, // Sync event for application or kernel EPL module
kEplEventSinkNmtk = 0x01, // events for Nmtk module
kEplEventSinkDllk = 0x02, // events for Dllk module
kEplEventSinkDlluCal = 0x03, // events for DlluCal module
kEplEventSinkDllkCal = 0x04, // events for DllkCal module
kEplEventSinkPdok = 0x05, // events for Pdok module
kEplEventSinkNmtu = 0x06, // events for Nmtu module
kEplEventSinkErrk = 0x07, // events for Error handler module
kEplEventSinkErru = 0x08, // events for Error signaling module
kEplEventSinkSdoAsySeq = 0x09, // events for asyncronous SDO Sequence Layer module
kEplEventSinkNmtMnu = 0x0A, // events for NmtMnu module
kEplEventSinkLedu = 0x0B, // events for Ledu module
kEplEventSinkApi = 0x0F, // events for API module
} tEplEventSink;
// EventSource determines the source of an errorevent
typedef enum {
// kernelspace modules
kEplEventSourceDllk = 0x01, // Dllk module
kEplEventSourceNmtk = 0x02, // Nmtk module
kEplEventSourceObdk = 0x03, // Obdk module
kEplEventSourcePdok = 0x04, // Pdok module
kEplEventSourceTimerk = 0x05, // Timerk module
kEplEventSourceEventk = 0x06, // Eventk module
kEplEventSourceSyncCb = 0x07, // sync-Cb
kEplEventSourceErrk = 0x08, // Error handler module
// userspace modules
kEplEventSourceDllu = 0x10, // Dllu module
kEplEventSourceNmtu = 0x11, // Nmtu module
kEplEventSourceNmtCnu = 0x12, // NmtCnu module
kEplEventSourceNmtMnu = 0x13, // NmtMnu module
kEplEventSourceObdu = 0x14, // Obdu module
kEplEventSourceSdoUdp = 0x15, // Sdo/Udp module
kEplEventSourceSdoAsnd = 0x16, // Sdo/Asnd module
kEplEventSourceSdoAsySeq = 0x17, // Sdo asynchronus Sequence Layer module
kEplEventSourceSdoCom = 0x18, // Sdo command layer module
kEplEventSourceTimeru = 0x19, // Timeru module
kEplEventSourceCfgMau = 0x1A, // CfgMau module
kEplEventSourceEventu = 0x1B, // Eventu module
kEplEventSourceEplApi = 0x1C, // Api module
kEplEventSourceLedu = 0x1D, // Ledu module
} tEplEventSource;
// structure of EPL event (element order must not be changed!)
typedef struct {
tEplEventType m_EventType /*:28 */ ; // event type
tEplEventSink m_EventSink /*:4 */ ; // event sink
tEplNetTime m_NetTime; // timestamp
unsigned int m_uiSize; // size of argument
void *m_pArg; // argument of event
} tEplEvent;
// short structure of EPL event without argument and its size (element order must not be changed!)
typedef struct {
tEplEventType m_EventType /*:28 */ ; // event type
tEplEventSink m_EventSink /*:4 */ ; // event sink
tEplNetTime m_NetTime; // timestamp
} tEplEventShort;
typedef struct {
unsigned int m_uiIndex;
unsigned int m_uiSubIndex;
} tEplEventObdError;
// structure for kEplEventTypeError
typedef struct {
tEplEventSource m_EventSource; // module which posted this error event
tEplKernel m_EplError; // EPL error which occured
union {
u8 m_bArg;
u32 m_dwArg;
tEplEventSource m_EventSource; // from Eventk/u module (originating error source)
tEplEventObdError m_ObdError; // from Obd module
// tEplErrHistoryEntry m_HistoryEntry; // from Nmtk/u module
} m_Arg;
} tEplEventError;
// structure for kEplEventTypeDllError
typedef struct {
unsigned long m_ulDllErrorEvents; // EPL_DLL_ERR_*
unsigned int m_uiNodeId;
tEplNmtState m_NmtState;
} tEplErrorHandlerkEvent;
// callback function to get informed about sync event
typedef tEplKernel(*tEplSyncCb) (void);
// callback function for generic events
typedef tEplKernel(*tEplProcessEventCb) (tEplEvent *pEplEvent_p);
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_EVENT_H_

View File

@ -1,853 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for Epl-Kernelspace-Event-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplEventk.c,v $
$Author: D.Krueger $
$Revision: 1.9 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 k.t.: start of the implementation
****************************************************************************/
#include "kernel/EplEventk.h"
#include "kernel/EplNmtk.h"
#include "kernel/EplDllk.h"
#include "kernel/EplDllkCal.h"
#include "kernel/EplErrorHandlerk.h"
#include "Benchmark.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
#include "kernel/EplPdok.h"
#include "kernel/EplPdokCal.h"
#endif
#ifdef EPL_NO_FIFO
#include "user/EplEventu.h"
#else
#include "SharedBuff.h"
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// TracePoint support for realtime-debugging
#ifdef _DBG_TRACE_POINTS_
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p);
void TgtDbgPostTraceValue(u32 dwTraceValue_p);
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
#else
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
#define TGT_DBG_POST_TRACE_VALUE(v)
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
#ifndef EPL_NO_FIFO
tShbInstance m_pShbKernelToUserInstance;
tShbInstance m_pShbUserToKernelInstance;
#else
#endif
tEplSyncCb m_pfnCbSync;
unsigned int m_uiUserToKernelFullCount;
} tEplEventkInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplEventkInstance EplEventkInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
// callback function for incoming events
#ifndef EPL_NO_FIFO
static void EplEventkRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
unsigned long ulDataSize_p);
#endif
/***************************************************************************/
/* */
/* */
/* C L A S S <Epl-Kernelspace-Event> */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplEventkInit
//
// Description: function initializes the first instance
//
// Parameters: pfnCbSync_p = callback-function for sync event
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkInit(tEplSyncCb pfnCbSync_p)
{
tEplKernel Ret;
Ret = EplEventkAddInstance(pfnCbSync_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventkAddInstance
//
// Description: function adds one more instance
//
// Parameters: pfnCbSync_p = callback-function for sync event
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkAddInstance(tEplSyncCb pfnCbSync_p)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
unsigned int fShbNewCreated;
#endif
Ret = kEplSuccessful;
// init instance structure
EplEventkInstance_g.m_uiUserToKernelFullCount = 0;
// save cb-function
EplEventkInstance_g.m_pfnCbSync = pfnCbSync_p;
#ifndef EPL_NO_FIFO
// init shared loop buffer
// kernel -> user
ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
&EplEventkInstance_g.
m_pShbKernelToUserInstance,
&fShbNewCreated);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
// user -> kernel
ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_USER_TO_KERNEL,
EPL_EVENT_NAME_SHB_USER_TO_KERNEL,
&EplEventkInstance_g.
m_pShbUserToKernelInstance,
&fShbNewCreated);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkAddInstance(): ShbCirAllocBuffer(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
// register eventhandler
ShbError =
ShbCirSetSignalHandlerNewData(EplEventkInstance_g.
m_pShbUserToKernelInstance,
EplEventkRxSignalHandlerCb,
kshbPriorityHigh);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkAddInstance(): ShbCirSetSignalHandlerNewData(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
Exit:
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventkDelInstance
//
// Description: function deletes instance and frees the buffers
//
// Parameters: void
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkDelInstance(void)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
#endif
Ret = kEplSuccessful;
#ifndef EPL_NO_FIFO
// set eventhandler to NULL
ShbError =
ShbCirSetSignalHandlerNewData(EplEventkInstance_g.
m_pShbUserToKernelInstance, NULL,
kShbPriorityNormal);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkDelInstance(): ShbCirSetSignalHandlerNewData(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
}
// free buffer User -> Kernel
ShbError =
ShbCirReleaseBuffer(EplEventkInstance_g.m_pShbUserToKernelInstance);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
} else {
EplEventkInstance_g.m_pShbUserToKernelInstance = NULL;
}
// free buffer Kernel -> User
ShbError =
ShbCirReleaseBuffer(EplEventkInstance_g.m_pShbKernelToUserInstance);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
} else {
EplEventkInstance_g.m_pShbKernelToUserInstance = NULL;
}
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventkProcess
//
// Description: Kernelthread that dispatches events in kernel part
//
// Parameters: pEvent_p = pointer to event-structure from buffer
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkProcess(tEplEvent *pEvent_p)
{
tEplKernel Ret;
tEplEventSource EventSource;
Ret = kEplSuccessful;
// error handling if event queue is full
if (EplEventkInstance_g.m_uiUserToKernelFullCount > 0) { // UserToKernel event queue has run out of space -> kEplNmtEventInternComError
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
tEplEvent Event;
tEplNmtEvent NmtEvent;
#endif
#ifndef EPL_NO_FIFO
tShbError ShbError;
#endif
// directly call NMTk process function, because event queue is full
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
NmtEvent = kEplNmtEventInternComError;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_NetTime.m_dwNanoSec = 0;
Event.m_NetTime.m_dwSec = 0;
Event.m_EventType = kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent;
Event.m_uiSize = sizeof(NmtEvent);
Ret = EplNmtkProcess(&Event);
#endif
// NMT state machine changed to reset (i.e. NMT_GS_RESET_COMMUNICATION)
// now, it is safe to reset the counter and empty the event queue
#ifndef EPL_NO_FIFO
ShbError =
ShbCirResetBuffer(EplEventkInstance_g.
m_pShbUserToKernelInstance, 1000, NULL);
#endif
EplEventkInstance_g.m_uiUserToKernelFullCount = 0;
TGT_DBG_SIGNAL_TRACE_POINT(22);
// also discard the current event (it doesn't matter if we lose another event)
goto Exit;
}
// check m_EventSink
switch (pEvent_p->m_EventSink) {
case kEplEventSinkSync:
{
if (EplEventkInstance_g.m_pfnCbSync != NULL) {
Ret = EplEventkInstance_g.m_pfnCbSync();
if (Ret == kEplSuccessful) {
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
// mark TPDOs as valid
Ret = EplPdokCalSetTpdosValid(TRUE);
#endif
} else if ((Ret != kEplReject)
&& (Ret != kEplShutdown)) {
EventSource = kEplEventSourceSyncCb;
// Error event for API layer
EplEventkPostError
(kEplEventSourceEventk, Ret,
sizeof(EventSource), &EventSource);
}
}
break;
}
// NMT-Kernel-Modul
case kEplEventSinkNmtk:
{
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
Ret = EplNmtkProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceNmtk;
// Error event for API layer
EplEventkPostError(kEplEventSourceEventk,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
if ((pEvent_p->m_EventType == kEplEventTypeNmtEvent)
&&
((*((tEplNmtEvent *) pEvent_p->m_pArg) ==
kEplNmtEventDllCeSoa)
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|| (*((tEplNmtEvent *) pEvent_p->m_pArg) ==
kEplNmtEventDllMeSoaSent)
#endif
)) { // forward SoA event to error handler
Ret = EplErrorHandlerkProcess(pEvent_p);
if ((Ret != kEplSuccessful)
&& (Ret != kEplShutdown)) {
EventSource = kEplEventSourceErrk;
// Error event for API layer
EplEventkPostError
(kEplEventSourceEventk, Ret,
sizeof(EventSource), &EventSource);
}
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
// forward SoA event to PDO module
pEvent_p->m_EventType = kEplEventTypePdoSoa;
Ret = EplPdokProcess(pEvent_p);
if ((Ret != kEplSuccessful)
&& (Ret != kEplShutdown)) {
EventSource = kEplEventSourcePdok;
// Error event for API layer
EplEventkPostError
(kEplEventSourceEventk, Ret,
sizeof(EventSource), &EventSource);
}
#endif
}
break;
#endif
}
// events for Dllk module
case kEplEventSinkDllk:
{
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
Ret = EplDllkProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceDllk;
// Error event for API layer
EplEventkPostError(kEplEventSourceEventk,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
break;
}
// events for DllkCal module
case kEplEventSinkDllkCal:
{
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
Ret = EplDllkCalProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceDllk;
// Error event for API layer
EplEventkPostError(kEplEventSourceEventk,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
break;
}
//
case kEplEventSinkPdok:
{
// PDO-Module
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
Ret = EplPdokProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourcePdok;
// Error event for API layer
EplEventkPostError(kEplEventSourceEventk,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
break;
}
// events for Error handler module
case kEplEventSinkErrk:
{
// only call error handler if DLL is present
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
Ret = EplErrorHandlerkProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceErrk;
// Error event for API layer
EplEventkPostError(kEplEventSourceEventk,
Ret,
sizeof(EventSource),
&EventSource);
}
break;
#endif
}
// unknown sink
default:
{
Ret = kEplEventUnknownSink;
}
} // end of switch(pEvent_p->m_EventSink)
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventkPost
//
// Description: post events from kernel part
//
// Parameters: pEvent_p = pointer to event-structure from buffer
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkPost(tEplEvent *pEvent_p)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
tShbCirChunk ShbCirChunk;
unsigned long ulDataSize;
unsigned int fBufferCompleted;
#endif
Ret = kEplSuccessful;
// the event must be posted by using the abBuffer
// it is neede because the Argument must by copied
// to the buffer too and not only the pointer
#ifndef EPL_NO_FIFO
// 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue.
ulDataSize =
sizeof(tEplEvent) +
((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0);
#endif
// decide in which buffer the event have to write
switch (pEvent_p->m_EventSink) {
// kernelspace modules
case kEplEventSinkSync:
case kEplEventSinkNmtk:
case kEplEventSinkDllk:
case kEplEventSinkDllkCal:
case kEplEventSinkPdok:
case kEplEventSinkErrk:
{
#ifndef EPL_NO_FIFO
// post message
BENCHMARK_MOD_27_SET(2);
ShbError =
ShbCirAllocDataBlock(EplEventkInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk, ulDataSize);
switch (ShbError) {
case kShbOk:
break;
case kShbBufferFull:
{
EplEventkInstance_g.
m_uiUserToKernelFullCount++;
Ret = kEplEventPostError;
goto Exit;
}
default:
{
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
}
ShbError =
ShbCirWriteDataChunk(EplEventkInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk, pEvent_p,
sizeof(tEplEvent),
&fBufferCompleted);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
if (fBufferCompleted == FALSE) {
ShbError =
ShbCirWriteDataChunk(EplEventkInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk,
pEvent_p->m_pArg,
(unsigned long)
pEvent_p->m_uiSize,
&fBufferCompleted);
if ((ShbError != kShbOk)
|| (fBufferCompleted == FALSE)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
}
BENCHMARK_MOD_27_RESET(2);
#else
Ret = EplEventkProcess(pEvent_p);
#endif
break;
}
// userspace modules
case kEplEventSinkNmtu:
case kEplEventSinkNmtMnu:
case kEplEventSinkSdoAsySeq:
case kEplEventSinkApi:
case kEplEventSinkDlluCal:
case kEplEventSinkErru:
{
#ifndef EPL_NO_FIFO
// post message
// BENCHMARK_MOD_27_SET(3); // 74 µs until reset
ShbError =
ShbCirAllocDataBlock(EplEventkInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk, ulDataSize);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
ShbError =
ShbCirWriteDataChunk(EplEventkInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk, pEvent_p,
sizeof(tEplEvent),
&fBufferCompleted);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
if (fBufferCompleted == FALSE) {
ShbError =
ShbCirWriteDataChunk(EplEventkInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk,
pEvent_p->m_pArg,
(unsigned long)
pEvent_p->m_uiSize,
&fBufferCompleted);
if ((ShbError != kShbOk)
|| (fBufferCompleted == FALSE)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventkPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
}
// BENCHMARK_MOD_27_RESET(3); // 82 µs until ShbCirGetReadDataSize() in EplEventu
#else
Ret = EplEventuProcess(pEvent_p);
#endif
break;
}
default:
{
Ret = kEplEventUnknownSink;
}
} // end of switch(pEvent_p->m_EventSink)
#ifndef EPL_NO_FIFO
Exit:
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventkPostError
//
// Description: post error event from kernel part to API layer
//
// Parameters: EventSource_p = source-module of the error event
// EplError_p = code of occured error
// ArgSize_p = size of the argument
// pArg_p = pointer to the argument
//
// Returns: tEpKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventkPostError(tEplEventSource EventSource_p,
tEplKernel EplError_p,
unsigned int uiArgSize_p, void *pArg_p)
{
tEplKernel Ret;
u8 abBuffer[EPL_MAX_EVENT_ARG_SIZE];
tEplEventError *pEventError = (tEplEventError *) abBuffer;
tEplEvent EplEvent;
Ret = kEplSuccessful;
// create argument
pEventError->m_EventSource = EventSource_p;
pEventError->m_EplError = EplError_p;
EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
// create event
EplEvent.m_EventType = kEplEventTypeError;
EplEvent.m_EventSink = kEplEventSinkApi;
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
EplEvent.m_uiSize =
(sizeof(EventSource_p) + sizeof(EplError_p) + uiArgSize_p);
EplEvent.m_pArg = &abBuffer[0];
// post errorevent
Ret = EplEventkPost(&EplEvent);
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplEventkRxSignalHandlerCb()
//
// Description: Callback-function for events from user and kernel part
//
// Parameters: pShbRxInstance_p = Instance-pointer of buffer
// ulDataSize_p = size of data
//
// Returns: void
//
// State:
//
//---------------------------------------------------------------------------
#ifndef EPL_NO_FIFO
static void EplEventkRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
unsigned long ulDataSize_p)
{
tEplEvent *pEplEvent;
tShbError ShbError;
//unsigned long ulBlockCount;
//unsigned long ulDataSize;
u8 abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
// d.k.: abDataBuffer contains the complete tEplEvent structure
// and behind this the argument
TGT_DBG_SIGNAL_TRACE_POINT(20);
BENCHMARK_MOD_27_RESET(0);
// copy data from event queue
ShbError = ShbCirReadDataBlock(pShbRxInstance_p,
&abDataBuffer[0],
sizeof(abDataBuffer), &ulDataSize_p);
if (ShbError != kShbOk) {
// error goto exit
goto Exit;
}
// resolve the pointer to the event structure
pEplEvent = (tEplEvent *) abDataBuffer;
// set Datasize
pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent));
if (pEplEvent->m_uiSize > 0) {
// set pointer to argument
pEplEvent->m_pArg = &abDataBuffer[sizeof(tEplEvent)];
} else {
//set pointer to NULL
pEplEvent->m_pArg = NULL;
}
BENCHMARK_MOD_27_SET(0);
// call processfunction
EplEventkProcess(pEplEvent);
Exit:
return;
}
#endif
// EOF

View File

@ -1,813 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for Epl-Userspace-Event-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplEventu.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 k.t.: start of the implementation
****************************************************************************/
#include "user/EplEventu.h"
#include "user/EplNmtu.h"
#include "user/EplNmtMnu.h"
#include "user/EplSdoAsySequ.h"
#include "user/EplDlluCal.h"
#include "user/EplLedu.h"
#include "Benchmark.h"
#ifdef EPL_NO_FIFO
#include "kernel/EplEventk.h"
#else
#include "SharedBuff.h"
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// TracePoint support for realtime-debugging
#ifdef _DBG_TRACE_POINTS_
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p);
void TgtDbgPostTraceValue(u32 dwTraceValue_p);
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
#else
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
#define TGT_DBG_POST_TRACE_VALUE(v)
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
#ifndef EPL_NO_FIFO
tShbInstance m_pShbKernelToUserInstance;
tShbInstance m_pShbUserToKernelInstance;
#endif
tEplProcessEventCb m_pfnApiProcessEventCb;
} tEplEventuInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//#ifndef EPL_NO_FIFO
static tEplEventuInstance EplEventuInstance_g;
//#endif
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
#ifndef EPL_NO_FIFO
// callback function for incomming events
static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
unsigned long ulDataSize_p);
#endif
/***************************************************************************/
/* */
/* */
/* C L A S S <Epl-User-Event> */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplEventuInit
//
// Description: function initialize the first instance
//
//
//
// Parameters: pfnApiProcessEventCb_p = function pointer for API event callback
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p)
{
tEplKernel Ret;
Ret = EplEventuAddInstance(pfnApiProcessEventCb_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventuAddInstance
//
// Description: function add one more instance
//
//
//
// Parameters: pfnApiProcessEventCb_p = function pointer for API event callback
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuAddInstance(tEplProcessEventCb pfnApiProcessEventCb_p)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
unsigned int fShbNewCreated;
#endif
Ret = kEplSuccessful;
// init instance variables
EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p;
#ifndef EPL_NO_FIFO
// init shared loop buffer
// kernel -> user
ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
&EplEventuInstance_g.
m_pShbKernelToUserInstance,
&fShbNewCreated);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
// user -> kernel
ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_USER_TO_KERNEL,
EPL_EVENT_NAME_SHB_USER_TO_KERNEL,
&EplEventuInstance_g.
m_pShbUserToKernelInstance,
&fShbNewCreated);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuAddInstance(): ShbCirAllocBuffer(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
// register eventhandler
ShbError =
ShbCirSetSignalHandlerNewData(EplEventuInstance_g.
m_pShbKernelToUserInstance,
EplEventuRxSignalHandlerCb,
kShbPriorityNormal);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuAddInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
goto Exit;
}
Exit:
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventuDelInstance
//
// Description: function delete instance an free the bufferstructure
//
//
//
// Parameters:
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuDelInstance(void)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
#endif
Ret = kEplSuccessful;
#ifndef EPL_NO_FIFO
// set eventhandler to NULL
ShbError =
ShbCirSetSignalHandlerNewData(EplEventuInstance_g.
m_pShbKernelToUserInstance, NULL,
kShbPriorityNormal);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuDelInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
}
// free buffer User -> Kernel
ShbError =
ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbUserToKernelInstance);
if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
} else {
EplEventuInstance_g.m_pShbUserToKernelInstance = NULL;
}
// free buffer Kernel -> User
ShbError =
ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbKernelToUserInstance);
if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n",
ShbError);
Ret = kEplNoResource;
} else {
EplEventuInstance_g.m_pShbKernelToUserInstance = NULL;
}
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventuProcess
//
// Description: Kernelthread that dispatches events in kernelspace
//
//
//
// Parameters: pEvent_p = pointer to event-structur from buffer
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuProcess(tEplEvent *pEvent_p)
{
tEplKernel Ret;
tEplEventSource EventSource;
Ret = kEplSuccessful;
// check m_EventSink
switch (pEvent_p->m_EventSink) {
// NMT-User-Module
case kEplEventSinkNmtu:
{
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
Ret = EplNmtuProcessEvent(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceNmtu;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
break;
}
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
// NMT-MN-User-Module
case kEplEventSinkNmtMnu:
{
Ret = EplNmtMnuProcessEvent(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceNmtMnu;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
break;
}
#endif
#if ((((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOC)) != 0) \
|| (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOS)) != 0))
// events for asynchronus SDO Sequence Layer
case kEplEventSinkSdoAsySeq:
{
Ret = EplSdoAsySeqProcessEvent(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceSdoAsySeq;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
break;
}
#endif
// LED user part module
case kEplEventSinkLedu:
{
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
Ret = EplLeduProcessEvent(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceLedu;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
#endif
break;
}
// event for EPL api
case kEplEventSinkApi:
{
if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL) {
Ret =
EplEventuInstance_g.
m_pfnApiProcessEventCb(pEvent_p);
if ((Ret != kEplSuccessful)
&& (Ret != kEplShutdown)) {
EventSource = kEplEventSourceEplApi;
// Error event for API layer
EplEventuPostError
(kEplEventSourceEventu, Ret,
sizeof(EventSource), &EventSource);
}
}
break;
}
case kEplEventSinkDlluCal:
{
Ret = EplDlluCalProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
EventSource = kEplEventSourceDllu;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
break;
}
case kEplEventSinkErru:
{
/*
Ret = EplErruProcess(pEvent_p);
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
{
EventSource = kEplEventSourceErru;
// Error event for API layer
EplEventuPostError(kEplEventSourceEventu,
Ret,
sizeof(EventSource),
&EventSource);
}
*/
break;
}
// unknown sink
default:
{
Ret = kEplEventUnknownSink;
}
} // end of switch(pEvent_p->m_EventSink)
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventuPost
//
// Description: post events from userspace
//
//
//
// Parameters: pEvent_p = pointer to event-structur from buffer
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuPost(tEplEvent *pEvent_p)
{
tEplKernel Ret;
#ifndef EPL_NO_FIFO
tShbError ShbError;
tShbCirChunk ShbCirChunk;
unsigned long ulDataSize;
unsigned int fBufferCompleted;
#endif
Ret = kEplSuccessful;
#ifndef EPL_NO_FIFO
// 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue.
ulDataSize =
sizeof(tEplEvent) +
((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0);
#endif
// decide in which buffer the event have to write
switch (pEvent_p->m_EventSink) {
// kernelspace modules
case kEplEventSinkSync:
case kEplEventSinkNmtk:
case kEplEventSinkDllk:
case kEplEventSinkDllkCal:
case kEplEventSinkPdok:
case kEplEventSinkErrk:
{
#ifndef EPL_NO_FIFO
// post message
ShbError =
ShbCirAllocDataBlock(EplEventuInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk, ulDataSize);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
ShbError =
ShbCirWriteDataChunk(EplEventuInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk, pEvent_p,
sizeof(tEplEvent),
&fBufferCompleted);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
if (fBufferCompleted == FALSE) {
ShbError =
ShbCirWriteDataChunk(EplEventuInstance_g.
m_pShbUserToKernelInstance,
&ShbCirChunk,
pEvent_p->m_pArg,
(unsigned long)
pEvent_p->m_uiSize,
&fBufferCompleted);
if ((ShbError != kShbOk)
|| (fBufferCompleted == FALSE)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
}
#else
Ret = EplEventkProcess(pEvent_p);
#endif
break;
}
// userspace modules
case kEplEventSinkNmtMnu:
case kEplEventSinkNmtu:
case kEplEventSinkSdoAsySeq:
case kEplEventSinkApi:
case kEplEventSinkDlluCal:
case kEplEventSinkErru:
case kEplEventSinkLedu:
{
#ifndef EPL_NO_FIFO
// post message
ShbError =
ShbCirAllocDataBlock(EplEventuInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk, ulDataSize);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
ShbError =
ShbCirWriteDataChunk(EplEventuInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk, pEvent_p,
sizeof(tEplEvent),
&fBufferCompleted);
if (ShbError != kShbOk) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
if (fBufferCompleted == FALSE) {
ShbError =
ShbCirWriteDataChunk(EplEventuInstance_g.
m_pShbKernelToUserInstance,
&ShbCirChunk,
pEvent_p->m_pArg,
(unsigned long)
pEvent_p->m_uiSize,
&fBufferCompleted);
if ((ShbError != kShbOk)
|| (fBufferCompleted == FALSE)) {
EPL_DBGLVL_EVENTK_TRACE1
("EplEventuPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n",
ShbError);
Ret = kEplEventPostError;
goto Exit;
}
}
#else
Ret = EplEventuProcess(pEvent_p);
#endif
break;
}
default:
{
Ret = kEplEventUnknownSink;
}
} // end of switch(pEvent_p->m_EventSink)
#ifndef EPL_NO_FIFO
Exit:
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplEventuPostError
//
// Description: post errorevent from userspace
//
//
//
// Parameters: EventSource_p = source-module of the errorevent
// EplError_p = code of occured error
// uiArgSize_p = size of the argument
// pArg_p = pointer to the argument
//
//
// Returns: tEpKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplEventuPostError(tEplEventSource EventSource_p,
tEplKernel EplError_p,
unsigned int uiArgSize_p, void *pArg_p)
{
tEplKernel Ret;
u8 abBuffer[EPL_MAX_EVENT_ARG_SIZE];
tEplEventError *pEventError = (tEplEventError *) abBuffer;
tEplEvent EplEvent;
Ret = kEplSuccessful;
// create argument
pEventError->m_EventSource = EventSource_p;
pEventError->m_EplError = EplError_p;
EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
// create event
EplEvent.m_EventType = kEplEventTypeError;
EplEvent.m_EventSink = kEplEventSinkApi;
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
EplEvent.m_uiSize =
(sizeof(EventSource_p) + sizeof(EplError_p) + uiArgSize_p);
EplEvent.m_pArg = &abBuffer[0];
// post errorevent
Ret = EplEventuPost(&EplEvent);
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplEventuRxSignalHandlerCb()
//
// Description: Callback-function for evets from kernelspace
//
//
//
// Parameters: pShbRxInstance_p = Instance-pointer for buffer
// ulDataSize_p = size of data
//
//
// Returns: void
//
//
// State:
//
//---------------------------------------------------------------------------
#ifndef EPL_NO_FIFO
static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
unsigned long ulDataSize_p)
{
tEplEvent *pEplEvent;
tShbError ShbError;
//unsigned long ulBlockCount;
//unsigned long ulDataSize;
u8 abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
// d.k.: abDataBuffer contains the complete tEplEvent structure
// and behind this the argument
TGT_DBG_SIGNAL_TRACE_POINT(21);
// d.k. not needed because it is already done in SharedBuff
/* do
{
BENCHMARK_MOD_28_SET(1); // 4 µs until reset
// get messagesize
ShbError = ShbCirGetReadDataSize (pShbRxInstance_p, &ulDataSize);
if(ShbError != kShbOk)
{
// error goto exit
goto Exit;
}
BENCHMARK_MOD_28_RESET(1); // 14 µs until set
*/
// copy data from event queue
ShbError = ShbCirReadDataBlock(pShbRxInstance_p,
&abDataBuffer[0],
sizeof(abDataBuffer), &ulDataSize_p);
if (ShbError != kShbOk) {
// error goto exit
goto Exit;
}
// resolve the pointer to the event structure
pEplEvent = (tEplEvent *) abDataBuffer;
// set Datasize
pEplEvent->m_uiSize = (ulDataSize_p - sizeof(tEplEvent));
if (pEplEvent->m_uiSize > 0) {
// set pointer to argument
pEplEvent->m_pArg = &abDataBuffer[sizeof(tEplEvent)];
} else {
//set pointer to NULL
pEplEvent->m_pArg = NULL;
}
BENCHMARK_MOD_28_SET(1);
// call processfunction
EplEventuProcess(pEplEvent);
BENCHMARK_MOD_28_RESET(1);
// read number of left messages to process
// d.k. not needed because it is already done in SharedBuff
/* ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount);
if (ShbError != kShbOk)
{
// error goto exit
goto Exit;
}
} while (ulBlockCount > 0);
*/
Exit:
return;
}
#endif
// EOF

View File

@ -1,344 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL frames
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplFrame.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/06/23 14:56:33 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_FRAME_H_
#define _EPL_FRAME_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// defines for EplFrame.m_wFlag
#define EPL_FRAME_FLAG1_RD 0x01 // ready (PReq, PRes)
#define EPL_FRAME_FLAG1_ER 0x02 // exception reset (error signalling) (SoA)
#define EPL_FRAME_FLAG1_EA 0x04 // exception acknowledge (error signalling) (PReq, SoA)
#define EPL_FRAME_FLAG1_EC 0x08 // exception clear (error signalling) (StatusRes)
#define EPL_FRAME_FLAG1_EN 0x10 // exception new (error signalling) (PRes, StatusRes)
#define EPL_FRAME_FLAG1_MS 0x20 // multiplexed slot (PReq)
#define EPL_FRAME_FLAG1_PS 0x40 // prescaled slot (SoC)
#define EPL_FRAME_FLAG1_MC 0x80 // multiplexed cycle completed (SoC)
#define EPL_FRAME_FLAG2_RS 0x07 // number of pending requests to send (PRes, StatusRes, IdentRes)
#define EPL_FRAME_FLAG2_PR 0x38 // priority of requested asynch. frame (PRes, StatusRes, IdentRes)
#define EPL_FRAME_FLAG2_PR_SHIFT 3 // shift of priority of requested asynch. frame
// error history/status entry types
#define EPL_ERR_ENTRYTYPE_STATUS 0x8000
#define EPL_ERR_ENTRYTYPE_HISTORY 0x0000
#define EPL_ERR_ENTRYTYPE_EMCY 0x4000
#define EPL_ERR_ENTRYTYPE_MODE_ACTIVE 0x1000
#define EPL_ERR_ENTRYTYPE_MODE_CLEARED 0x2000
#define EPL_ERR_ENTRYTYPE_MODE_OCCURRED 0x3000
#define EPL_ERR_ENTRYTYPE_MODE_MASK 0x3000
#define EPL_ERR_ENTRYTYPE_PROF_VENDOR 0x0001
#define EPL_ERR_ENTRYTYPE_PROF_EPL 0x0002
#define EPL_ERR_ENTRYTYPE_PROF_MASK 0x0FFF
// defines for EPL version / PDO version
#define EPL_VERSION_SUB 0x0F // sub version
#define EPL_VERSION_MAIN 0xF0 // main version
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// $$$ d.k.: move this definition to global.h
// byte-align structures
#ifdef _MSC_VER
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error you must byte-align these structures with the appropriate compiler directives
#endif
typedef struct {
// Offset 17
u8 m_le_bRes1; // reserved
// Offset 18
u8 m_le_bFlag1; // Flags: MC, PS
// Offset 19
u8 m_le_bFlag2; // Flags: res
// Offset 20
tEplNetTime m_le_NetTime; // supported if D_NMT_NetTimeIsRealTime_BOOL is set
// Offset 28
u64 m_le_RelativeTime; // in us (supported if D_NMT_RelativeTime_BOOL is set)
} PACK_STRUCT tEplSocFrame;
typedef struct {
// Offset 17
u8 m_le_bRes1; // reserved
// Offset 18
u8 m_le_bFlag1; // Flags: MS, EA, RD
// Offset 19
u8 m_le_bFlag2; // Flags: res
// Offset 20
u8 m_le_bPdoVersion;
// Offset 21
u8 m_le_bRes2; // reserved
// Offset 22
u16 m_le_wSize;
// Offset 24
u8 m_le_abPayload[256 /*D_NMT_IsochrRxMaxPayload_U16 */ ];
} PACK_STRUCT tEplPreqFrame;
typedef struct {
// Offset 17
u8 m_le_bNmtStatus; // NMT state
// Offset 18
u8 m_le_bFlag1; // Flags: MS, EN, RD
// Offset 19
u8 m_le_bFlag2; // Flags: PR, RS
// Offset 20
u8 m_le_bPdoVersion;
// Offset 21
u8 m_le_bRes2; // reserved
// Offset 22
u16 m_le_wSize;
// Offset 24
u8 m_le_abPayload[256 /*D_NMT_IsochrRxMaxPayload_U16
/ D_NMT_IsochrTxMaxPayload_U16 */ ];
} PACK_STRUCT tEplPresFrame;
typedef struct {
// Offset 17
u8 m_le_bNmtStatus; // NMT state
// Offset 18
u8 m_le_bFlag1; // Flags: EA, ER
// Offset 19
u8 m_le_bFlag2; // Flags: res
// Offset 20
u8 m_le_bReqServiceId;
// Offset 21
u8 m_le_bReqServiceTarget;
// Offset 22
u8 m_le_bEplVersion;
} PACK_STRUCT tEplSoaFrame;
typedef struct {
u16 m_wEntryType;
u16 m_wErrorCode;
tEplNetTime m_TimeStamp;
u8 m_abAddInfo[8];
} PACK_STRUCT tEplErrHistoryEntry;
typedef struct {
// Offset 18
u8 m_le_bFlag1; // Flags: EN, EC
u8 m_le_bFlag2; // Flags: PR, RS
u8 m_le_bNmtStatus; // NMT state
u8 m_le_bRes1[3];
u64 m_le_qwStaticError; // static error bit field
tEplErrHistoryEntry m_le_aErrHistoryEntry[14];
} PACK_STRUCT tEplStatusResponse;
typedef struct {
// Offset 18
u8 m_le_bFlag1; // Flags: res
u8 m_le_bFlag2; // Flags: PR, RS
u8 m_le_bNmtStatus; // NMT state
u8 m_le_bIdentRespFlags; // Flags: FW
u8 m_le_bEplProfileVersion;
u8 m_le_bRes1;
u32 m_le_dwFeatureFlags; // NMT_FeatureFlags_U32
u16 m_le_wMtu; // NMT_CycleTiming_REC.AsyncMTU_U16: C_IP_MIN_MTU - C_IP_MAX_MTU
u16 m_le_wPollInSize; // NMT_CycleTiming_REC.PReqActPayload_U16
u16 m_le_wPollOutSize; // NMT_CycleTiming_REC.PResActPayload_U16
u32 m_le_dwResponseTime; // NMT_CycleTiming_REC.PResMaxLatency_U32
u16 m_le_wRes2;
u32 m_le_dwDeviceType; // NMT_DeviceType_U32
u32 m_le_dwVendorId; // NMT_IdentityObject_REC.VendorId_U32
u32 m_le_dwProductCode; // NMT_IdentityObject_REC.ProductCode_U32
u32 m_le_dwRevisionNumber; // NMT_IdentityObject_REC.RevisionNo_U32
u32 m_le_dwSerialNumber; // NMT_IdentityObject_REC.SerialNo_U32
u64 m_le_qwVendorSpecificExt1;
u32 m_le_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
u32 m_le_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
u32 m_le_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_le_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
u32 m_le_dwIpAddress;
u32 m_le_dwSubnetMask;
u32 m_le_dwDefaultGateway;
u8 m_le_sHostname[32];
u8 m_le_abVendorSpecificExt2[48];
} PACK_STRUCT tEplIdentResponse;
typedef struct {
// Offset 18
u8 m_le_bNmtCommandId;
u8 m_le_bRes1;
u8 m_le_abNmtCommandData[32];
} PACK_STRUCT tEplNmtCommandService;
typedef struct {
u8 m_le_bReserved;
u8 m_le_bTransactionId;
u8 m_le_bFlags;
u8 m_le_bCommandId;
u16 m_le_wSegmentSize;
u16 m_le_wReserved;
u8 m_le_abCommandData[8]; // just reserve a minimum number of bytes as a placeholder
} PACK_STRUCT tEplAsySdoCom;
// asynchronous SDO Sequence Header
typedef struct {
u8 m_le_bRecSeqNumCon;
u8 m_le_bSendSeqNumCon;
u8 m_le_abReserved[2];
tEplAsySdoCom m_le_abSdoSeqPayload;
} PACK_STRUCT tEplAsySdoSeq;
typedef struct {
// Offset 18
u8 m_le_bNmtCommandId;
u8 m_le_bTargetNodeId;
u8 m_le_abNmtCommandData[32];
} PACK_STRUCT tEplNmtRequestService;
typedef union {
// Offset 18
tEplStatusResponse m_StatusResponse;
tEplIdentResponse m_IdentResponse;
tEplNmtCommandService m_NmtCommandService;
tEplNmtRequestService m_NmtRequestService;
tEplAsySdoSeq m_SdoSequenceFrame;
u8 m_le_abPayload[256 /*D_NMT_ASndTxMaxPayload_U16
/ D_NMT_ASndRxMaxPayload_U16 */ ];
} tEplAsndPayload;
typedef struct {
// Offset 17
u8 m_le_bServiceId;
// Offset 18
tEplAsndPayload m_Payload;
} PACK_STRUCT tEplAsndFrame;
typedef union {
// Offset 17
tEplSocFrame m_Soc;
tEplPreqFrame m_Preq;
tEplPresFrame m_Pres;
tEplSoaFrame m_Soa;
tEplAsndFrame m_Asnd;
} tEplFrameData;
typedef struct {
// Offset 0
u8 m_be_abDstMac[6]; // MAC address of the addressed nodes
// Offset 6
u8 m_be_abSrcMac[6]; // MAC address of the transmitting node
// Offset 12
u16 m_be_wEtherType; // Ethernet message type (big endian)
// Offset 14
u8 m_le_bMessageType; // EPL message type
// Offset 15
u8 m_le_bDstNodeId; // EPL node ID of the addressed nodes
// Offset 16
u8 m_le_bSrcNodeId; // EPL node ID of the transmitting node
// Offset 17
tEplFrameData m_Data;
} PACK_STRUCT tEplFrame;
// un-byte-align structures
#ifdef _MSC_VER
# pragma pack( pop, packing )
#endif
typedef enum {
kEplMsgTypeNonEpl = 0x00,
kEplMsgTypeSoc = 0x01,
kEplMsgTypePreq = 0x03,
kEplMsgTypePres = 0x04,
kEplMsgTypeSoa = 0x05,
kEplMsgTypeAsnd = 0x06,
} tEplMsgType;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_FRAME_H_

View File

@ -1,486 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for Identu-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplIdentu.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/21 09:00:38 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/11/15 d.k.: start of the implementation
****************************************************************************/
#include "user/EplIdentu.h"
#include "user/EplDlluCal.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S <xxxxx> */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
tEplIdentResponse *m_apIdentResponse[254]; // the IdentResponse are managed dynamically
tEplIdentuCbResponse m_apfnCbResponse[254];
} tEplIdentuInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
static tEplIdentuInstance EplIdentuInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplKernel EplIdentuCbIdentResponse(tEplFrameInfo *pFrameInfo_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplIdentuInit
//
// Description: init first instance of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuInit(void)
{
tEplKernel Ret;
Ret = EplIdentuAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuAddInstance
//
// Description: init other instances of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuAddInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof(EplIdentuInstance_g));
// register IdentResponse callback function
Ret =
EplDlluCalRegAsndService(kEplDllAsndIdentResponse,
EplIdentuCbIdentResponse,
kEplDllAsndFilterAny);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuDelInstance
//
// Description: delete instance
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// deregister IdentResponse callback function
Ret =
EplDlluCalRegAsndService(kEplDllAsndIdentResponse, NULL,
kEplDllAsndFilterNone);
Ret = EplIdentuReset();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuReset
//
// Description: resets this instance
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuReset(void)
{
tEplKernel Ret;
int iIndex;
Ret = kEplSuccessful;
for (iIndex = 0;
iIndex < tabentries(EplIdentuInstance_g.m_apIdentResponse);
iIndex++) {
if (EplIdentuInstance_g.m_apIdentResponse[iIndex] != NULL) { // free memory
EPL_FREE(EplIdentuInstance_g.m_apIdentResponse[iIndex]);
}
}
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof(EplIdentuInstance_g));
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuGetIdentResponse
//
// Description: returns the IdentResponse for the specified node.
//
// Parameters: uiNodeId_p = IN: node ID
// ppIdentResponse_p = OUT: pointer to pointer of IdentResponse
// equals NULL, if no IdentResponse available
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuGetIdentResponse(unsigned int uiNodeId_p,
tEplIdentResponse **ppIdentResponse_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// decrement node ID, because array is zero based
uiNodeId_p--;
if (uiNodeId_p < tabentries(EplIdentuInstance_g.m_apIdentResponse)) {
*ppIdentResponse_p =
EplIdentuInstance_g.m_apIdentResponse[uiNodeId_p];
} else { // invalid node ID specified
*ppIdentResponse_p = NULL;
Ret = kEplInvalidNodeId;
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuRequestIdentResponse
//
// Description: returns the IdentResponse for the specified node.
//
// Parameters: uiNodeId_p = IN: node ID
// pfnCbResponse_p = IN: function pointer to callback function
// which will be called if IdentResponse is received
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplIdentuRequestIdentResponse(unsigned int uiNodeId_p,
tEplIdentuCbResponse pfnCbResponse_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// decrement node ID, because array is zero based
uiNodeId_p--;
if (uiNodeId_p < tabentries(EplIdentuInstance_g.m_apfnCbResponse)) {
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
if (EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL) { // request already issued (maybe by someone else)
Ret = kEplInvalidOperation;
} else {
EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] =
pfnCbResponse_p;
Ret =
EplDlluCalIssueRequest(kEplDllReqServiceIdent,
(uiNodeId_p + 1), 0xFF);
}
#else
Ret = kEplInvalidOperation;
#endif
} else { // invalid node ID specified
Ret = kEplInvalidNodeId;
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplIdentuGetRunningRequests
//
// Description: returns a bit field with the running requests for node-ID 1-32
// just for debugging purposes
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
u32 EplIdentuGetRunningRequests(void)
{
u32 dwReqs = 0;
unsigned int uiIndex;
for (uiIndex = 0; uiIndex < 32; uiIndex++) {
if (EplIdentuInstance_g.m_apfnCbResponse[uiIndex] != NULL) {
dwReqs |= (1 << uiIndex);
}
}
return dwReqs;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplIdentuCbIdentResponse
//
// Description: callback funktion for IdentResponse
//
//
//
// Parameters: pFrameInfo_p = Frame with the IdentResponse
//
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplIdentuCbIdentResponse(tEplFrameInfo *pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
unsigned int uiNodeId;
unsigned int uiIndex;
tEplIdentuCbResponse pfnCbResponse;
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
uiIndex = uiNodeId - 1;
if (uiIndex < tabentries(EplIdentuInstance_g.m_apfnCbResponse)) {
// memorize pointer to callback function
pfnCbResponse = EplIdentuInstance_g.m_apfnCbResponse[uiIndex];
// reset callback function pointer so that caller may issue next request immediately
EplIdentuInstance_g.m_apfnCbResponse[uiIndex] = NULL;
if (pFrameInfo_p->m_uiFrameSize < EPL_C_DLL_MINSIZE_IDENTRES) { // IdentResponse not received or it has invalid size
if (pfnCbResponse == NULL) { // response was not requested
goto Exit;
}
Ret = pfnCbResponse(uiNodeId, NULL);
} else { // IdentResponse received
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL) { // memory for IdentResponse must be allocated
EplIdentuInstance_g.m_apIdentResponse[uiIndex] =
EPL_MALLOC(sizeof(tEplIdentResponse));
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL) { // malloc failed
if (pfnCbResponse == NULL) { // response was not requested
goto Exit;
}
Ret =
pfnCbResponse(uiNodeId,
&pFrameInfo_p->
m_pFrame->m_Data.
m_Asnd.m_Payload.
m_IdentResponse);
goto Exit;
}
}
// copy IdentResponse to instance structure
EPL_MEMCPY(EplIdentuInstance_g.
m_apIdentResponse[uiIndex],
&pFrameInfo_p->m_pFrame->m_Data.m_Asnd.
m_Payload.m_IdentResponse,
sizeof(tEplIdentResponse));
if (pfnCbResponse == NULL) { // response was not requested
goto Exit;
}
Ret =
pfnCbResponse(uiNodeId,
EplIdentuInstance_g.
m_apIdentResponse[uiIndex]);
}
}
Exit:
return Ret;
}
// EOF

View File

@ -1,370 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: basic include file for internal EPL stack modules
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplInc.h,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_INC_H_
#define _EPL_INC_H_
// ============================================================================
// include files
// ============================================================================
#if defined(WIN32) || defined(_WIN32)
#ifdef UNDER_RTSS
// RTX header
#include <windows.h>
#include <process.h>
#include <rtapi.h>
#elif __BORLANDC__
// borland C header
#include <windows.h>
#include <process.h>
#elif WINCE
#include <windows.h>
#else
// MSVC needs to include windows.h at first
// the following defines ar necessary for function prototypes for waitable timers
#define _WIN32_WINDOWS 0x0401
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <process.h>
#endif
#endif
// defines for module integration
// possible other include file needed
// These constants defines modules which can be included in the Epl application.
// Use this constants for define EPL_MODULE_INTEGRATION in file EplCfg.h.
#define EPL_MODULE_OBDK 0x00000001L // OBD kernel part module
#define EPL_MODULE_PDOK 0x00000002L // PDO kernel part module
#define EPL_MODULE_NMT_MN 0x00000004L // NMT MN module
#define EPL_MODULE_SDOS 0x00000008L // SDO Server module
#define EPL_MODULE_SDOC 0x00000010L // SDO Client module
#define EPL_MODULE_SDO_ASND 0x00000020L // SDO over Asnd module
#define EPL_MODULE_SDO_UDP 0x00000040L // SDO over UDP module
#define EPL_MODULE_SDO_PDO 0x00000080L // SDO in PDO module
#define EPL_MODULE_NMT_CN 0x00000100L // NMT CN module
#define EPL_MODULE_NMTU 0x00000200L // NMT user part module
#define EPL_MODULE_NMTK 0x00000400L // NMT kernel part module
#define EPL_MODULE_DLLK 0x00000800L // DLL kernel part module
#define EPL_MODULE_DLLU 0x00001000L // DLL user part module
#define EPL_MODULE_OBDU 0x00002000L // OBD user part module
#define EPL_MODULE_CFGMA 0x00004000L // Configuartioan Manager module
#define EPL_MODULE_VETH 0x00008000L // virtual ethernet driver module
#define EPL_MODULE_PDOU 0x00010000L // PDO user part module
#define EPL_MODULE_LEDU 0x00020000L // LED user part module
#include "EplCfg.h" // EPL configuration file (configuration from application)
#include "global.h" // global definitions
#include "EplDef.h" // EPL configuration file (default configuration)
#include "EplInstDef.h" // defines macros for instance types and table
#include "Debug.h" // debug definitions
#include "EplErrDef.h" // EPL error codes for API funtions
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// IEEE 1588 conformant net time structure
typedef struct {
u32 m_dwSec;
u32 m_dwNanoSec;
} tEplNetTime;
#include "EplTarget.h" // target specific functions and definitions
#include "EplAmi.h"
// -------------------------------------------------------------------------
// macros
// -------------------------------------------------------------------------
#define EPL_SPEC_VERSION 0x20 // ETHERNET Powerlink V. 2.0
#define EPL_STACK_VERSION(ver,rev,rel) ((((u32)(ver)) & 0xFF)|((((u32)(rev))&0xFF)<<8)|(((u32)(rel))<<16))
#define EPL_OBJ1018_VERSION(ver,rev,rel) ((((u32)(ver))<<16) |(((u32)(rev))&0xFFFF))
#define EPL_STRING_VERSION(ver,rev,rel) "V" #ver "." #rev " r" #rel
#include "EplVersion.h"
// defines for EPL FeatureFlags
#define EPL_FEATURE_ISOCHR 0x00000001
#define EPL_FEATURE_SDO_UDP 0x00000002
#define EPL_FEATURE_SDO_ASND 0x00000004
#define EPL_FEATURE_SDO_PDO 0x00000008
#define EPL_FEATURE_NMT_INFO 0x00000010
#define EPL_FEATURE_NMT_EXT 0x00000020
#define EPL_FEATURE_PDO_DYN 0x00000040
#define EPL_FEATURE_NMT_UDP 0x00000080
#define EPL_FEATURE_CFGMA 0x00000100
#define EPL_FEATURE_DLL_MULTIPLEX 0x00000200
#define EPL_FEATURE_NODEID_SW 0x00000400
#define EPL_FEATURE_NMT_BASICETH 0x00000800
#define EPL_FEATURE_RT1 0x00001000
#define EPL_FEATURE_RT2 0x00002000
// generate EPL NMT_FeatureFlags_U32
#ifndef EPL_DEF_FEATURE_ISOCHR
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
#define EPL_DEF_FEATURE_ISOCHR (EPL_FEATURE_ISOCHR)
#else
#define EPL_DEF_FEATURE_ISOCHR 0
#endif
#endif
#ifndef EPL_DEF_FEATURE_SDO_ASND
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
#define EPL_DEF_FEATURE_SDO_ASND (EPL_FEATURE_SDO_ASND)
#else
#define EPL_DEF_FEATURE_SDO_ASND 0
#endif
#endif
#ifndef EPL_DEF_FEATURE_SDO_UDP
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
#define EPL_DEF_FEATURE_SDO_UDP (EPL_FEATURE_SDO_UDP)
#else
#define EPL_DEF_FEATURE_SDO_UDP 0
#endif
#endif
#ifndef EPL_DEF_FEATURE_SDO_PDO
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_PDO)) != 0)
#define EPL_DEF_FEATURE_SDO_PDO (EPL_FEATURE_SDO_PDO)
#else
#define EPL_DEF_FEATURE_SDO_PDO 0
#endif
#endif
#ifndef EPL_DEF_FEATURE_PDO_DYN
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
#define EPL_DEF_FEATURE_PDO_DYN (EPL_FEATURE_PDO_DYN)
#else
#define EPL_DEF_FEATURE_PDO_DYN 0
#endif
#endif
#ifndef EPL_DEF_FEATURE_CFGMA
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_CFGMA)) != 0)
#define EPL_DEF_FEATURE_CFGMA (EPL_FEATURE_CFGMA)
#else
#define EPL_DEF_FEATURE_CFGMA 0
#endif
#endif
#define EPL_DEF_FEATURE_FLAGS (EPL_DEF_FEATURE_ISOCHR \
| EPL_DEF_FEATURE_SDO_ASND \
| EPL_DEF_FEATURE_SDO_UDP \
| EPL_DEF_FEATURE_SDO_PDO \
| EPL_DEF_FEATURE_PDO_DYN \
| EPL_DEF_FEATURE_CFGMA)
#ifndef tabentries
#define tabentries(a) (sizeof(a)/sizeof(*(a)))
#endif
// ============================================================================
// common debug macros
// ============================================================================
// for using macro DEBUG_TRACEx()
//
// Example:
// DEBUG_TRACE1 (EPL_DBGLVL_OBD, "Value is %d\n" , wObjectIndex);
//
// This message only will be printed if:
// - NDEBUG is not defined AND !!!
// - flag 0x00000004L is set in DEF_DEBUG_LVL (can be defined in copcfg.h)
//
// default level is defined in copdef.h
// debug-level and TRACE-macros // standard-level // flags for DEF_DEBUG_LVL
#define EPL_DBGLVL_EDRV DEBUG_LVL_01 // 0x00000001L
#define EPL_DBGLVL_EDRV_TRACE0 DEBUG_LVL_01_TRACE0
#define EPL_DBGLVL_EDRV_TRACE1 DEBUG_LVL_01_TRACE1
#define EPL_DBGLVL_EDRV_TRACE2 DEBUG_LVL_01_TRACE2
#define EPL_DBGLVL_EDRV_TRACE3 DEBUG_LVL_01_TRACE3
#define EPL_DBGLVL_EDRV_TRACE4 DEBUG_LVL_01_TRACE4
#define EPL_DBGLVL_DLL DEBUG_LVL_02 // 0x00000002L
#define EPL_DBGLVL_DLL_TRACE0 DEBUG_LVL_02_TRACE0
#define EPL_DBGLVL_DLL_TRACE1 DEBUG_LVL_02_TRACE1
#define EPL_DBGLVL_DLL_TRACE2 DEBUG_LVL_02_TRACE2
#define EPL_DBGLVL_DLL_TRACE3 DEBUG_LVL_02_TRACE3
#define EPL_DBGLVL_DLL_TRACE4 DEBUG_LVL_02_TRACE4
#define EPL_DBGLVL_OBD DEBUG_LVL_03 // 0x00000004L
#define EPL_DBGLVL_OBD_TRACE0 DEBUG_LVL_03_TRACE0
#define EPL_DBGLVL_OBD_TRACE1 DEBUG_LVL_03_TRACE1
#define EPL_DBGLVL_OBD_TRACE2 DEBUG_LVL_03_TRACE2
#define EPL_DBGLVL_OBD_TRACE3 DEBUG_LVL_03_TRACE3
#define EPL_DBGLVL_OBD_TRACE4 DEBUG_LVL_03_TRACE4
#define EPL_DBGLVL_NMTK DEBUG_LVL_04 // 0x00000008L
#define EPL_DBGLVL_NMTK_TRACE0 DEBUG_LVL_04_TRACE0
#define EPL_DBGLVL_NMTK_TRACE1 DEBUG_LVL_04_TRACE1
#define EPL_DBGLVL_NMTK_TRACE2 DEBUG_LVL_04_TRACE2
#define EPL_DBGLVL_NMTK_TRACE3 DEBUG_LVL_04_TRACE3
#define EPL_DBGLVL_NMTK_TRACE4 DEBUG_LVL_04_TRACE4
#define EPL_DBGLVL_NMTCN DEBUG_LVL_05 // 0x00000010L
#define EPL_DBGLVL_NMTCN_TRACE0 DEBUG_LVL_05_TRACE0
#define EPL_DBGLVL_NMTCN_TRACE1 DEBUG_LVL_05_TRACE1
#define EPL_DBGLVL_NMTCN_TRACE2 DEBUG_LVL_05_TRACE2
#define EPL_DBGLVL_NMTCN_TRACE3 DEBUG_LVL_05_TRACE3
#define EPL_DBGLVL_NMTCN_TRACE4 DEBUG_LVL_05_TRACE4
#define EPL_DBGLVL_NMTU DEBUG_LVL_06 // 0x00000020L
#define EPL_DBGLVL_NMTU_TRACE0 DEBUG_LVL_06_TRACE0
#define EPL_DBGLVL_NMTU_TRACE1 DEBUG_LVL_06_TRACE1
#define EPL_DBGLVL_NMTU_TRACE2 DEBUG_LVL_06_TRACE2
#define EPL_DBGLVL_NMTU_TRACE3 DEBUG_LVL_06_TRACE3
#define EPL_DBGLVL_NMTU_TRACE4 DEBUG_LVL_06_TRACE4
#define EPL_DBGLVL_NMTMN DEBUG_LVL_07 // 0x00000040L
#define EPL_DBGLVL_NMTMN_TRACE0 DEBUG_LVL_07_TRACE0
#define EPL_DBGLVL_NMTMN_TRACE1 DEBUG_LVL_07_TRACE1
#define EPL_DBGLVL_NMTMN_TRACE2 DEBUG_LVL_07_TRACE2
#define EPL_DBGLVL_NMTMN_TRACE3 DEBUG_LVL_07_TRACE3
#define EPL_DBGLVL_NMTMN_TRACE4 DEBUG_LVL_07_TRACE4
//...
#define EPL_DBGLVL_SDO DEBUG_LVL_25 // 0x01000000
#define EPL_DBGLVL_SDO_TRACE0 DEBUG_LVL_25_TRACE0
#define EPL_DBGLVL_SDO_TRACE1 DEBUG_LVL_25_TRACE1
#define EPL_DBGLVL_SDO_TRACE2 DEBUG_LVL_25_TRACE2
#define EPL_DBGLVL_SDO_TRACE3 DEBUG_LVL_25_TRACE3
#define EPL_DBGLVL_SDO_TRACE4 DEBUG_LVL_25_TRACE4
#define EPL_DBGLVL_VETH DEBUG_LVL_26 // 0x02000000
#define EPL_DBGLVL_VETH_TRACE0 DEBUG_LVL_26_TRACE0
#define EPL_DBGLVL_VETH_TRACE1 DEBUG_LVL_26_TRACE1
#define EPL_DBGLVL_VETH_TRACE2 DEBUG_LVL_26_TRACE2
#define EPL_DBGLVL_VETH_TRACE3 DEBUG_LVL_26_TRACE3
#define EPL_DBGLVL_VETH_TRACE4 DEBUG_LVL_26_TRACE4
#define EPL_DBGLVL_EVENTK DEBUG_LVL_27 // 0x04000000
#define EPL_DBGLVL_EVENTK_TRACE0 DEBUG_LVL_27_TRACE0
#define EPL_DBGLVL_EVENTK_TRACE1 DEBUG_LVL_27_TRACE1
#define EPL_DBGLVL_EVENTK_TRACE2 DEBUG_LVL_27_TRACE2
#define EPL_DBGLVL_EVENTK_TRACE3 DEBUG_LVL_27_TRACE3
#define EPL_DBGLVL_EVENTK_TRACE4 DEBUG_LVL_27_TRACE4
#define EPL_DBGLVL_EVENTU DEBUG_LVL_28 // 0x08000000
#define EPL_DBGLVL_EVENTU_TRACE0 DEBUG_LVL_28_TRACE0
#define EPL_DBGLVL_EVENTU_TRACE1 DEBUG_LVL_28_TRACE1
#define EPL_DBGLVL_EVENTU_TRACE2 DEBUG_LVL_28_TRACE2
#define EPL_DBGLVL_EVENTU_TRACE3 DEBUG_LVL_28_TRACE3
#define EPL_DBGLVL_EVENTU_TRACE4 DEBUG_LVL_28_TRACE4
// SharedBuff
#define EPL_DBGLVL_SHB DEBUG_LVL_29 // 0x10000000
#define EPL_DBGLVL_SHB_TRACE0 DEBUG_LVL_29_TRACE0
#define EPL_DBGLVL_SHB_TRACE1 DEBUG_LVL_29_TRACE1
#define EPL_DBGLVL_SHB_TRACE2 DEBUG_LVL_29_TRACE2
#define EPL_DBGLVL_SHB_TRACE3 DEBUG_LVL_29_TRACE3
#define EPL_DBGLVL_SHB_TRACE4 DEBUG_LVL_29_TRACE4
#define EPL_DBGLVL_ASSERT DEBUG_LVL_ASSERT // 0x20000000L
#define EPL_DBGLVL_ASSERT_TRACE0 DEBUG_LVL_ASSERT_TRACE0
#define EPL_DBGLVL_ASSERT_TRACE1 DEBUG_LVL_ASSERT_TRACE1
#define EPL_DBGLVL_ASSERT_TRACE2 DEBUG_LVL_ASSERT_TRACE2
#define EPL_DBGLVL_ASSERT_TRACE3 DEBUG_LVL_ASSERT_TRACE3
#define EPL_DBGLVL_ASSERT_TRACE4 DEBUG_LVL_ASSERT_TRACE4
#define EPL_DBGLVL_ERROR DEBUG_LVL_ERROR // 0x40000000L
#define EPL_DBGLVL_ERROR_TRACE0 DEBUG_LVL_ERROR_TRACE0
#define EPL_DBGLVL_ERROR_TRACE1 DEBUG_LVL_ERROR_TRACE1
#define EPL_DBGLVL_ERROR_TRACE2 DEBUG_LVL_ERROR_TRACE2
#define EPL_DBGLVL_ERROR_TRACE3 DEBUG_LVL_ERROR_TRACE3
#define EPL_DBGLVL_ERROR_TRACE4 DEBUG_LVL_ERROR_TRACE4
#define EPL_DBGLVL_ALWAYS DEBUG_LVL_ALWAYS // 0x80000000L
#define EPL_DBGLVL_ALWAYS_TRACE0 DEBUG_LVL_ALWAYS_TRACE0
#define EPL_DBGLVL_ALWAYS_TRACE1 DEBUG_LVL_ALWAYS_TRACE1
#define EPL_DBGLVL_ALWAYS_TRACE2 DEBUG_LVL_ALWAYS_TRACE2
#define EPL_DBGLVL_ALWAYS_TRACE3 DEBUG_LVL_ALWAYS_TRACE3
#define EPL_DBGLVL_ALWAYS_TRACE4 DEBUG_LVL_ALWAYS_TRACE4
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_INC_H_

View File

@ -1,363 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: definitions for generating instances
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplInstDef.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
r.d.: first implementation
****************************************************************************/
#ifndef _EPLINSTDEF_H_
#define _EPLINSTDEF_H_
#include <linux/kernel.h>
// =========================================================================
// types and macros for generating instances
// =========================================================================
typedef enum {
kStateUnused = 0,
kStateDeleted = 1,
kStateUsed = 0xFF
} tInstState;
//------------------------------------------------------------------------------------------
typedef void *tEplPtrInstance;
typedef u8 tEplInstanceHdl;
// define const for illegale values
#define CCM_ILLINSTANCE NULL
#define CCM_ILLINSTANCE_HDL 0xFF
//------------------------------------------------------------------------------------------
// if more than one instance then use this macros
#if (EPL_MAX_INSTANCES > 1)
//--------------------------------------------------------------------------------------
// macro definition for instance table definition
//--------------------------------------------------------------------------------------
// memory attributes for instance table
#define STATIC // prevent warnings for variables with same name
#define INSTANCE_TYPE_BEGIN typedef struct {
#define INSTANCE_TYPE_END } tEplInstanceInfo;
//--------------------------------------------------------------------------------------
// macro definition for API interface
//--------------------------------------------------------------------------------------
// declaration:
// macros for declaration within function header or prototype of API functions
#define CCM_DECL_INSTANCE_HDL tEplInstanceHdl InstanceHandle
#define CCM_DECL_INSTANCE_HDL_ tEplInstanceHdl InstanceHandle,
// macros for declaration of pointer to instance handle within function header or prototype of API functions
#define CCM_DECL_PTR_INSTANCE_HDL tEplInstanceHdl *pInstanceHandle
#define CCM_DECL_PTR_INSTANCE_HDL_ tEplInstanceHdl *pInstanceHandle,
// macros for declaration instance as lokacl variable within functions
#define CCM_DECL_INSTANCE_PTR_LOCAL tCcmInstanceInfo *pInstance;
#define CCM_DECL_PTR_INSTANCE_HDL_LOCAL tEplInstanceHdl *pInstanceHandle;
// reference:
// macros for reference of instance handle for function parameters
#define CCM_INSTANCE_HDL InstanceHandle
#define CCM_INSTANCE_HDL_ InstanceHandle,
// macros for reference of instance parameter for function parameters
#define CCM_INSTANCE_PARAM(par) par
#define CCM_INSTANCE_PARAM_(par) par,
// macros for reference of instance parameter for writing or reading values
#define CCM_INST_ENTRY (*((tEplPtrInstance)pInstance))
// processing:
// macros for process instance handle
#define CCM_CHECK_INSTANCE_HDL() if (InstanceHandle >= EPL_MAX_INSTANCES) \
{return (kEplIllegalInstance);}
// macros for process pointer to instance handle
#define CCM_CHECK_PTR_INSTANCE_HDL() if (pInstanceHandle == NULL) \
{return (kEplInvalidInstanceParam);}
// This macro returned the handle and pointer to next free instance.
#define CCM_GET_FREE_INSTANCE_AND_HDL() pInstance = CcmGetFreeInstanceAndHandle (pInstanceHandle); \
ASSERT (*pInstanceHandle != CCM_ILLINSTANCE_HDL);
#define CCM_CHECK_INSTANCE_PTR() if (pInstance == CCM_ILLINSTANCE) \
{return (kEplNoFreeInstance);}
#define CCM_GET_INSTANCE_PTR() pInstance = CcmGetInstancePtr (InstanceHandle);
#define CCM_GET_FREE_INSTANCE_PTR() pInstance = GetFreeInstance (); \
ASSERT (pInstance != CCM_ILLINSTANCE);
//--------------------------------------------------------------------------------------
// macro definition for stack interface
//--------------------------------------------------------------------------------------
// macros for declaration within the function header, prototype or local var list
// Declaration of pointers within function paramater list must defined as void *
// pointer.
#define EPL_MCO_DECL_INSTANCE_PTR void *pInstance
#define EPL_MCO_DECL_INSTANCE_PTR_ void *pInstance,
#define EPL_MCO_DECL_INSTANCE_PTR_LOCAL tEplPtrInstance pInstance;
// macros for reference of pointer to instance
// These macros are used for parameter passing to called function.
#define EPL_MCO_INSTANCE_PTR pInstance
#define EPL_MCO_INSTANCE_PTR_ pInstance,
#define EPL_MCO_ADDR_INSTANCE_PTR_ &pInstance,
// macro for access of struct members of one instance
// An access to a member of instance table must be casted by the local
// defined type of instance table.
#define EPL_MCO_INST_ENTRY (*(tEplPtrInstance)pInstance)
#define EPL_MCO_GLB_VAR(var) (((tEplPtrInstance)pInstance)->var)
// macros for process pointer to instance
#define EPL_MCO_GET_INSTANCE_PTR() pInstance = (tEplPtrInstance) GetInstancePtr (InstanceHandle);
#define EPL_MCO_GET_FREE_INSTANCE_PTR() pInstance = (tEplPtrInstance) GetFreeInstance (); \
ASSERT (pInstance != CCM_ILLINSTANCE);
// This macro should be used to check the passed pointer to an public function
#define EPL_MCO_CHECK_INSTANCE_STATE() ASSERT (pInstance != NULL); \
ASSERT (((tEplPtrInstance)pInstance)->m_InstState == kStateUsed);
// macros for declaration of pointer to instance pointer
#define EPL_MCO_DECL_PTR_INSTANCE_PTR void **pInstancePtr
#define EPL_MCO_DECL_PTR_INSTANCE_PTR_ void **pInstancePtr,
// macros for reference of pointer to instance pointer
// These macros are used for parameter passing to called function.
#define EPL_MCO_PTR_INSTANCE_PTR pInstancePtr
#define EPL_MCO_PTR_INSTANCE_PTR_ pInstancePtr,
// macros for process pointer to instance pointer
#define EPL_MCO_CHECK_PTR_INSTANCE_PTR() ASSERT (pInstancePtr != NULL);
#define EPL_MCO_SET_PTR_INSTANCE_PTR() (*pInstancePtr = pInstance);
#define EPL_MCO_INSTANCE_PARAM(a) (a)
#define EPL_MCO_INSTANCE_PARAM_(a) (a),
#define EPL_MCO_INSTANCE_PARAM_IDX_() EPL_MCO_INSTANCE_PARAM_ (EPL_MCO_GLB_VAR (m_bInstIndex))
#define EPL_MCO_INSTANCE_PARAM_IDX() EPL_MCO_INSTANCE_PARAM (EPL_MCO_GLB_VAR (m_bInstIndex))
#define EPL_MCO_WRITE_INSTANCE_STATE(a) EPL_MCO_GLB_VAR (m_InstState) = a;
// this macro deletes all instance entries as unused
#define EPL_MCO_DELETE_INSTANCE_TABLE() \
{ \
tEplInstanceInfo * pInstance = &aEplInstanceTable_g[0]; \
tFastByte InstNumber = 0; \
tFastByte i = EPL_MAX_INSTANCES; \
do { \
pInstance->m_InstState = (u8) kStateUnused; \
pInstance->m_bInstIndex = (u8) InstNumber; \
pInstance++; InstNumber++; i--; \
} while (i != 0); \
}
// definition of functions which has to be defined in each module of CANopen stack
#define EPL_MCO_DEFINE_INSTANCE_FCT() \
static tEplPtrInstance GetInstancePtr (tEplInstanceHdl InstHandle_p); \
static tEplPtrInstance GetFreeInstance (void);
#define EPL_MCO_DECL_INSTANCE_FCT() \
static tEplPtrInstance GetInstancePtr (tEplInstanceHdl InstHandle_p) { \
return &aEplInstanceTable_g[InstHandle_p]; } \
static tEplPtrInstance GetFreeInstance (void) { \
tEplInstanceInfo *pInstance = &aEplInstanceTable_g[0]; \
tFastByte i = EPL_MAX_INSTANCES; \
do { if (pInstance->m_InstState != kStateUsed) { \
return (tEplPtrInstance) pInstance; } \
pInstance++; i--; } \
while (i != 0); \
return CCM_ILLINSTANCE; }
// this macro defines the instance table. Each entry is reserved for an instance of CANopen.
#define EPL_MCO_DECL_INSTANCE_VAR() \
static tEplInstanceInfo aEplInstanceTable_g [EPL_MAX_INSTANCES];
// this macro defines member variables in instance table which are needed in
// all modules of Epl stack
#define EPL_MCO_DECL_INSTANCE_MEMBER() \
STATIC u8 m_InstState; \
STATIC u8 m_bInstIndex;
#define EPL_MCO_INSTANCE_PARAM_IDX_() EPL_MCO_INSTANCE_PARAM_ (EPL_MCO_GLB_VAR (m_bInstIndex))
#define EPL_MCO_INSTANCE_PARAM_IDX() EPL_MCO_INSTANCE_PARAM (EPL_MCO_GLB_VAR (m_bInstIndex))
#else // only one instance is used
// Memory attributes for instance table.
#define STATIC static // prevent warnings for variables with same name
#define INSTANCE_TYPE_BEGIN
#define INSTANCE_TYPE_END
// macros for declaration, initializing and member access for instance handle
// This class of macros are used by API function to inform CCM-modul which
// instance is to be used.
// macros for reference of instance handle
// These macros are used for parameter passing to CANopen API function.
#define CCM_INSTANCE_HDL
#define CCM_INSTANCE_HDL_
#define CCM_DECL_INSTANCE_PTR_LOCAL
// macros for declaration within the function header or prototype
#define CCM_DECL_INSTANCE_HDL void
#define CCM_DECL_INSTANCE_HDL_
// macros for process instance handle
#define CCM_CHECK_INSTANCE_HDL()
// macros for declaration of pointer to instance handle
#define CCM_DECL_PTR_INSTANCE_HDL void
#define CCM_DECL_PTR_INSTANCE_HDL_
// macros for process pointer to instance handle
#define CCM_CHECK_PTR_INSTANCE_HDL()
// This macro returned the handle and pointer to next free instance.
#define CCM_GET_FREE_INSTANCE_AND_HDL()
#define CCM_CHECK_INSTANCE_PTR()
#define CCM_GET_INSTANCE_PTR()
#define CCM_GET_FREE_INSTANCE_PTR()
#define CCM_INSTANCE_PARAM(par)
#define CCM_INSTANCE_PARAM_(par)
#define CCM_INST_ENTRY aCcmInstanceTable_g[0]
// macros for declaration, initializing and member access for instance pointer
// This class of macros are used by CANopen internal function to point to one instance.
// macros for declaration within the function header, prototype or local var list
#define EPL_MCO_DECL_INSTANCE_PTR void
#define EPL_MCO_DECL_INSTANCE_PTR_
#define EPL_MCO_DECL_INSTANCE_PTR_LOCAL
// macros for reference of pointer to instance
// These macros are used for parameter passing to called function.
#define EPL_MCO_INSTANCE_PTR
#define EPL_MCO_INSTANCE_PTR_
#define EPL_MCO_ADDR_INSTANCE_PTR_
// macros for process pointer to instance
#define EPL_MCO_GET_INSTANCE_PTR()
#define EPL_MCO_GET_FREE_INSTANCE_PTR()
// This macro should be used to check the passed pointer to an public function
#define EPL_MCO_CHECK_INSTANCE_STATE()
// macros for declaration of pointer to instance pointer
#define EPL_MCO_DECL_PTR_INSTANCE_PTR void
#define EPL_MCO_DECL_PTR_INSTANCE_PTR_
// macros for reference of pointer to instance pointer
// These macros are used for parameter passing to called function.
#define EPL_MCO_PTR_INSTANCE_PTR
#define EPL_MCO_PTR_INSTANCE_PTR_
// macros for process pointer to instance pointer
#define EPL_MCO_CHECK_PTR_INSTANCE_PTR()
#define EPL_MCO_SET_PTR_INSTANCE_PTR()
#define EPL_MCO_INSTANCE_PARAM(a)
#define EPL_MCO_INSTANCE_PARAM_(a)
#define EPL_MCO_INSTANCE_PARAM_IDX_()
#define EPL_MCO_INSTANCE_PARAM_IDX()
// macro for access of struct members of one instance
#define EPL_MCO_INST_ENTRY aEplInstanceTable_g[0]
#define EPL_MCO_GLB_VAR(var) (var)
#define EPL_MCO_WRITE_INSTANCE_STATE(a)
// this macro deletes all instance entries as unused
#define EPL_MCO_DELETE_INSTANCE_TABLE()
// definition of functions which has to be defined in each module of CANopen stack
#define EPL_MCO_DEFINE_INSTANCE_FCT()
#define EPL_MCO_DECL_INSTANCE_FCT()
// this macro defines the instance table. Each entry is reserved for an instance of CANopen.
#define EPL_MCO_DECL_INSTANCE_VAR()
// this macro defines member variables in instance table which are needed in
// all modules of CANopen stack
#define EPL_MCO_DECL_INSTANCE_MEMBER()
#endif
#endif // _EPLINSTDEF_H_
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

View File

@ -1,92 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for status and error LED
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplLed.h,v $
$Author: D.Krueger $
$Revision: 1.1 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2008/11/17 d.k.: start of the implementation
****************************************************************************/
#ifndef _EPLLED_H_
#define _EPLLED_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef enum {
kEplLedTypeStatus = 0x00,
kEplLedTypeError = 0x01,
} tEplLedType;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPLLED_H_

View File

@ -1,230 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: global include file for EPL-NMT-Modules
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmt.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMT_H_
#define _EPLNMT_H_
#include "EplInc.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// define super-states and masks to identify a super-state
#define EPL_NMT_GS_POWERED 0x0008 // super state
#define EPL_NMT_GS_INITIALISATION 0x0009 // super state
#define EPL_NMT_GS_COMMUNICATING 0x000C // super state
#define EPL_NMT_CS_EPLMODE 0x000D // super state
#define EPL_NMT_MS_EPLMODE 0x000D // super state
#define EPL_NMT_SUPERSTATE_MASK 0x000F // mask to select state
#define EPL_NMT_TYPE_UNDEFINED 0x0000 // type of NMT state is still undefined
#define EPL_NMT_TYPE_CS 0x0100 // CS type of NMT state
#define EPL_NMT_TYPE_MS 0x0200 // MS type of NMT state
#define EPL_NMT_TYPE_MASK 0x0300 // mask to select type of NMT state (i.e. CS or MS)
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// the lower Byte of the NMT-State is encoded
// like the values in the EPL-Standard
// the higher byte is used to encode MN
// (Bit 1 of the higher byte = 1) or CN (Bit 0 of the
// higher byte = 1)
// the super-states are not mentioned in this
// enum because they are no real states
// --> there are masks defined to indentify the
// super-states
typedef enum {
kEplNmtGsOff = 0x0000,
kEplNmtGsInitialising = 0x0019,
kEplNmtGsResetApplication = 0x0029,
kEplNmtGsResetCommunication = 0x0039,
kEplNmtGsResetConfiguration = 0x0079,
kEplNmtCsNotActive = 0x011C,
kEplNmtCsPreOperational1 = 0x011D,
kEplNmtCsStopped = 0x014D,
kEplNmtCsPreOperational2 = 0x015D,
kEplNmtCsReadyToOperate = 0x016D,
kEplNmtCsOperational = 0x01FD,
kEplNmtCsBasicEthernet = 0x011E,
kEplNmtMsNotActive = 0x021C,
kEplNmtMsPreOperational1 = 0x021D,
kEplNmtMsPreOperational2 = 0x025D,
kEplNmtMsReadyToOperate = 0x026D,
kEplNmtMsOperational = 0x02FD,
kEplNmtMsBasicEthernet = 0x021E
} tEplNmtState;
// NMT-events
typedef enum {
// Events from DLL
// Events defined by EPL V2 specification
kEplNmtEventNoEvent = 0x00,
// kEplNmtEventDllMePres = 0x01,
kEplNmtEventDllMePresTimeout = 0x02,
// kEplNmtEventDllMeAsnd = 0x03,
// kEplNmtEventDllMeAsndTimeout = 0x04,
kEplNmtEventDllMeSoaSent = 0x04,
kEplNmtEventDllMeSocTrig = 0x05,
kEplNmtEventDllMeSoaTrig = 0x06,
kEplNmtEventDllCeSoc = 0x07,
kEplNmtEventDllCePreq = 0x08,
kEplNmtEventDllCePres = 0x09,
kEplNmtEventDllCeSoa = 0x0A,
kEplNmtEventDllCeAsnd = 0x0B,
kEplNmtEventDllCeFrameTimeout = 0x0C,
// Events triggered by NMT-Commands
kEplNmtEventSwReset = 0x10, // NMT_GT1, NMT_GT2, NMT_GT8
kEplNmtEventResetNode = 0x11,
kEplNmtEventResetCom = 0x12,
kEplNmtEventResetConfig = 0x13,
kEplNmtEventEnterPreOperational2 = 0x14,
kEplNmtEventEnableReadyToOperate = 0x15,
kEplNmtEventStartNode = 0x16, // NMT_CT7
kEplNmtEventStopNode = 0x17,
// Events triggered by higher layer
kEplNmtEventEnterResetApp = 0x20,
kEplNmtEventEnterResetCom = 0x21,
kEplNmtEventInternComError = 0x22, // NMT_GT6, internal communication error -> enter ResetCommunication
kEplNmtEventEnterResetConfig = 0x23,
kEplNmtEventEnterCsNotActive = 0x24,
kEplNmtEventEnterMsNotActive = 0x25,
kEplNmtEventTimerBasicEthernet = 0x26, // NMT_CT3; timer triggered state change (NotActive -> BasicEth)
kEplNmtEventTimerMsPreOp1 = 0x27, // enter PreOp1 on MN (NotActive -> MsPreOp1)
kEplNmtEventNmtCycleError = 0x28, // NMT_CT11, NMT_MT6; error during cycle -> enter PreOp1
kEplNmtEventTimerMsPreOp2 = 0x29, // enter PreOp2 on MN (MsPreOp1 -> MsPreOp2 if kEplNmtEventAllMandatoryCNIdent)
kEplNmtEventAllMandatoryCNIdent = 0x2A, // enter PreOp2 on MN if kEplNmtEventTimerMsPreOp2
kEplNmtEventEnterReadyToOperate = 0x2B, // application ready for the state ReadyToOp
kEplNmtEventEnterMsOperational = 0x2C, // enter Operational on MN
kEplNmtEventSwitchOff = 0x2D, // enter state Off
kEplNmtEventCriticalError = 0x2E, // enter state Off because of critical error
} tEplNmtEvent;
// type for argument of event kEplEventTypeNmtStateChange
typedef struct {
tEplNmtState m_NewNmtState;
tEplNmtEvent m_NmtEvent;
} tEplEventNmtStateChange;
// structure for kEplEventTypeHeartbeat
typedef struct {
unsigned int m_uiNodeId; // NodeId
tEplNmtState m_NmtState; // NMT state (remember distinguish between MN / CN)
u16 m_wErrorCode; // EPL error code in case of NMT state NotActive
} tEplHeartbeatEvent;
typedef enum {
kEplNmtNodeEventFound = 0x00,
kEplNmtNodeEventUpdateSw = 0x01, // application shall update software on CN
kEplNmtNodeEventCheckConf = 0x02, // application / Configuration Manager shall check and update configuration on CN
kEplNmtNodeEventUpdateConf = 0x03, // application / Configuration Manager shall update configuration on CN (check was done by NmtMn module)
kEplNmtNodeEventVerifyConf = 0x04, // application / Configuration Manager shall verify configuration of CN
kEplNmtNodeEventReadyToStart = 0x05, // issued if EPL_NMTST_NO_STARTNODE set
// application must call EplNmtMnuSendNmtCommand(kEplNmtCmdStartNode) manually
kEplNmtNodeEventNmtState = 0x06,
kEplNmtNodeEventError = 0x07, // NMT error of CN
} tEplNmtNodeEvent;
typedef enum {
kEplNmtNodeCommandBoot = 0x01, // if EPL_NODEASSIGN_START_CN not set it must be issued after kEplNmtNodeEventFound
kEplNmtNodeCommandSwOk = 0x02, // application updated software on CN successfully
kEplNmtNodeCommandSwUpdated = 0x03, // application updated software on CN successfully
kEplNmtNodeCommandConfOk = 0x04, // application / Configuration Manager has updated configuration on CN successfully
kEplNmtNodeCommandConfReset = 0x05, // application / Configuration Manager has updated configuration on CN successfully
// and CN needs ResetConf so that the configuration gets actived
kEplNmtNodeCommandConfErr = 0x06, // application / Configuration Manager failed on updating configuration on CN
kEplNmtNodeCommandStart = 0x07, // if EPL_NMTST_NO_STARTNODE set it must be issued after kEplNmtNodeEventReadyToStart
} tEplNmtNodeCommand;
typedef enum {
kEplNmtBootEventBootStep1Finish = 0x00, // PreOp2 is possible
kEplNmtBootEventBootStep2Finish = 0x01, // ReadyToOp is possible
kEplNmtBootEventCheckComFinish = 0x02, // Operational is possible
kEplNmtBootEventOperational = 0x03, // all mandatory CNs are Operational
kEplNmtBootEventError = 0x04, // boot process halted because of an error
} tEplNmtBootEvent;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPLNMT_H_

View File

@ -1,701 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for NMT-CN-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtCnu.c,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "user/EplNmtCnu.h"
#include "user/EplDlluCal.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
unsigned int m_uiNodeId;
tEplNmtuCheckEventCallback m_pfnCheckEventCb;
} tEplNmtCnuInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplNmtCnuInstance EplNmtCnuInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p);
static BOOL EplNmtCnuNodeIdList(u8 * pbNmtCommandDate_p);
static tEplKernel EplNmtCnuCommandCb(tEplFrameInfo *pFrameInfo_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuInit
//
// Description: init the first instance of the module
//
//
//
// Parameters: uiNodeId_p = NodeId of the local node
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtCnuInit(unsigned int uiNodeId_p)
{
tEplKernel Ret;
Ret = EplNmtCnuAddInstance(uiNodeId_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuAddInstance
//
// Description: init the add new instance of the module
//
//
//
// Parameters: uiNodeId_p = NodeId of the local node
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtCnuAddInstance(unsigned int uiNodeId_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplNmtCnuInstance_g, 0, sizeof(EplNmtCnuInstance_g));
// save nodeid
EplNmtCnuInstance_g.m_uiNodeId = uiNodeId_p;
// register callback-function for NMT-commands
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
EplNmtCnuCommandCb,
kEplDllAsndFilterLocal);
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuDelInstance
//
// Description: delte instance of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtCnuDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
// deregister callback function from DLL
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
NULL, kEplDllAsndFilterNone);
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuSendNmtRequest
//
// Description: Send an NMT-Request to the MN
//
//
//
// Parameters: uiNodeId_p = NodeId of the local node
// NmtCommand_p = requested NMT-Command
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtCnuSendNmtRequest(unsigned int uiNodeId_p,
tEplNmtCommand NmtCommand_p)
{
tEplKernel Ret;
tEplFrameInfo NmtRequestFrameInfo;
tEplFrame NmtRequestFrame;
Ret = kEplSuccessful;
// build frame
EPL_MEMSET(&NmtRequestFrame.m_be_abDstMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abDstMac)); // set by DLL
EPL_MEMSET(&NmtRequestFrame.m_be_abSrcMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abSrcMac)); // set by DLL
AmiSetWordToBe(&NmtRequestFrame.m_be_wEtherType,
EPL_C_DLL_ETHERTYPE_EPL);
AmiSetByteToLe(&NmtRequestFrame.m_le_bDstNodeId, (u8) EPL_C_ADR_MN_DEF_NODE_ID); // node id of the MN
AmiSetByteToLe(&NmtRequestFrame.m_le_bMessageType,
(u8) kEplMsgTypeAsnd);
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_le_bServiceId,
(u8) kEplDllAsndNmtRequest);
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.
m_NmtRequestService.m_le_bNmtCommandId,
(u8) NmtCommand_p);
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.m_le_bTargetNodeId, (u8) uiNodeId_p); // target for the nmt command
EPL_MEMSET(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.
m_le_abNmtCommandData[0], 0x00,
sizeof(NmtRequestFrame.m_Data.m_Asnd.m_Payload.
m_NmtRequestService.m_le_abNmtCommandData));
// build info-structure
NmtRequestFrameInfo.m_NetTime.m_dwNanoSec = 0;
NmtRequestFrameInfo.m_NetTime.m_dwSec = 0;
NmtRequestFrameInfo.m_pFrame = &NmtRequestFrame;
NmtRequestFrameInfo.m_uiFrameSize = EPL_C_DLL_MINSIZE_NMTREQ; // sizeof(NmtRequestFrame);
// send NMT-Request
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
Ret = EplDlluCalAsyncSend(&NmtRequestFrameInfo, // pointer to frameinfo
kEplDllAsyncReqPrioNmt); // priority
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuRegisterStateChangeCb
//
// Description: register Callback-function go get informed about a
// NMT-Change-State-Event
//
//
//
// Parameters: pfnEplNmtStateChangeCb_p = functionpointer
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtCnuRegisterCheckEventCb(tEplNmtuCheckEventCallback pfnEplNmtCheckEventCb_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// save callback-function in modul global var
EplNmtCnuInstance_g.m_pfnCheckEventCb = pfnEplNmtCheckEventCb_p;
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuCommandCb
//
// Description: callback funktion for NMT-Commands
//
//
//
// Parameters: pFrameInfo_p = Frame with the NMT-Commando
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplNmtCnuCommandCb(tEplFrameInfo *pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
tEplNmtCommand NmtCommand;
BOOL fNodeIdInList;
tEplNmtEvent NmtEvent = kEplNmtEventNoEvent;
if (pFrameInfo_p == NULL) {
Ret = kEplNmtInvalidFramePointer;
goto Exit;
}
NmtCommand = EplNmtCnuGetNmtCommand(pFrameInfo_p);
// check NMT-Command
switch (NmtCommand) {
//------------------------------------------------------------------------
// plain NMT state commands
case kEplNmtCmdStartNode:
{ // send NMT-Event to state maschine kEplNmtEventStartNode
NmtEvent = kEplNmtEventStartNode;
break;
}
case kEplNmtCmdStopNode:
{ // send NMT-Event to state maschine kEplNmtEventStopNode
NmtEvent = kEplNmtEventStopNode;
break;
}
case kEplNmtCmdEnterPreOperational2:
{ // send NMT-Event to state maschine kEplNmtEventEnterPreOperational2
NmtEvent = kEplNmtEventEnterPreOperational2;
break;
}
case kEplNmtCmdEnableReadyToOperate:
{ // send NMT-Event to state maschine kEplNmtEventEnableReadyToOperate
NmtEvent = kEplNmtEventEnableReadyToOperate;
break;
}
case kEplNmtCmdResetNode:
{ // send NMT-Event to state maschine kEplNmtEventResetNode
NmtEvent = kEplNmtEventResetNode;
break;
}
case kEplNmtCmdResetCommunication:
{ // send NMT-Event to state maschine kEplNmtEventResetCom
NmtEvent = kEplNmtEventResetCom;
break;
}
case kEplNmtCmdResetConfiguration:
{ // send NMT-Event to state maschine kEplNmtEventResetConfig
NmtEvent = kEplNmtEventResetConfig;
break;
}
case kEplNmtCmdSwReset:
{ // send NMT-Event to state maschine kEplNmtEventSwReset
NmtEvent = kEplNmtEventSwReset;
break;
}
//------------------------------------------------------------------------
// extended NMT state commands
case kEplNmtCmdStartNodeEx:
{
// check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&
(pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]));
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventStartNode;
}
break;
}
case kEplNmtCmdStopNodeEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventStopNode;
}
break;
}
case kEplNmtCmdEnterPreOperational2Ex:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventEnterPreOperational2;
}
break;
}
case kEplNmtCmdEnableReadyToOperateEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventEnableReadyToOperate;
}
break;
}
case kEplNmtCmdResetNodeEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventResetNode;
}
break;
}
case kEplNmtCmdResetCommunicationEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventResetCom;
}
break;
}
case kEplNmtCmdResetConfigurationEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventResetConfig;
}
break;
}
case kEplNmtCmdSwResetEx:
{ // check if own nodeid is in EPL node list
fNodeIdInList =
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.
m_NmtCommandService.
m_le_abNmtCommandData[0]);
if (fNodeIdInList != FALSE) { // own nodeid in list
// send event to process command
NmtEvent = kEplNmtEventSwReset;
}
break;
}
//------------------------------------------------------------------------
// NMT managing commands
// TODO: add functions to process managing command (optional)
case kEplNmtCmdNetHostNameSet:
{
break;
}
case kEplNmtCmdFlushArpEntry:
{
break;
}
//------------------------------------------------------------------------
// NMT info services
// TODO: forward event with infos to the application (optional)
case kEplNmtCmdPublishConfiguredCN:
{
break;
}
case kEplNmtCmdPublishActiveCN:
{
break;
}
case kEplNmtCmdPublishPreOperational1:
{
break;
}
case kEplNmtCmdPublishPreOperational2:
{
break;
}
case kEplNmtCmdPublishReadyToOperate:
{
break;
}
case kEplNmtCmdPublishOperational:
{
break;
}
case kEplNmtCmdPublishStopped:
{
break;
}
case kEplNmtCmdPublishEmergencyNew:
{
break;
}
case kEplNmtCmdPublishTime:
{
break;
}
//-----------------------------------------------------------------------
// error from MN
// -> requested command not supported by MN
case kEplNmtCmdInvalidService:
{
// TODO: errorevent to application
break;
}
//------------------------------------------------------------------------
// default
default:
{
Ret = kEplNmtUnknownCommand;
goto Exit;
}
} // end of switch(NmtCommand)
if (NmtEvent != kEplNmtEventNoEvent) {
if (EplNmtCnuInstance_g.m_pfnCheckEventCb != NULL) {
Ret = EplNmtCnuInstance_g.m_pfnCheckEventCb(NmtEvent);
if (Ret == kEplReject) {
Ret = kEplSuccessful;
goto Exit;
} else if (Ret != kEplSuccessful) {
goto Exit;
}
}
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
Ret = EplNmtuNmtEvent(NmtEvent);
#endif
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuGetNmtCommand()
//
// Description: returns the NMT-Command from the frame
//
//
//
// Parameters: pFrameInfo_p = pointer to the Frame
// with the NMT-Command
//
//
// Returns: tEplNmtCommand = NMT-Command
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p)
{
tEplNmtCommand NmtCommand;
tEplNmtCommandService *pNmtCommandService;
pNmtCommandService =
&pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.
m_NmtCommandService;
NmtCommand =
(tEplNmtCommand) AmiGetByteFromLe(&pNmtCommandService->
m_le_bNmtCommandId);
return NmtCommand;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtCnuNodeIdList()
//
// Description: check if the own nodeid is set in EPL Node List
//
//
//
// Parameters: pbNmtCommandDate_p = pointer to the data of the NMT Command
//
//
// Returns: BOOL = TRUE if nodeid is set in EPL Node List
// FALSE if nodeid not set in EPL Node List
//
//
// State:
//
//---------------------------------------------------------------------------
static BOOL EplNmtCnuNodeIdList(u8 * pbNmtCommandDate_p)
{
BOOL fNodeIdInList;
unsigned int uiByteOffset;
u8 bBitOffset;
u8 bNodeListByte;
// get byte-offset of the own nodeid in NodeIdList
// devide though 8
uiByteOffset = (unsigned int)(EplNmtCnuInstance_g.m_uiNodeId >> 3);
// get bitoffset
bBitOffset = (u8) EplNmtCnuInstance_g.m_uiNodeId % 8;
bNodeListByte = AmiGetByteFromLe(&pbNmtCommandDate_p[uiByteOffset]);
if ((bNodeListByte & bBitOffset) == 0) {
fNodeIdInList = FALSE;
} else {
fNodeIdInList = TRUE;
}
return fNodeIdInList;
}
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
// EOF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,147 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for communication abstraction layer of the
NMT-Kernel-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtkCal.c,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/06/16 -k.t.: start of the implementation
****************************************************************************/
// TODO: init function needed to prepare EplNmtkGetNmtState for
// io-controll-call from EplNmtuCal-Modul
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
// EOF

View File

@ -1,706 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for NMT-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtu.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/10 17:17:42 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "user/EplNmtu.h"
#include "user/EplObdu.h"
#include "user/EplTimeru.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
#include "kernel/EplNmtk.h"
#endif
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
tEplNmtuStateChangeCallback m_pfnNmtChangeCb;
tEplTimerHdl m_TimerHdl;
} tEplNmtuInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplNmtuInstance EplNmtuInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplNmtuInit
//
// Description: init first instance of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuInit(void)
{
tEplKernel Ret;
Ret = EplNmtuAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuAddInstance
//
// Description: init other instances of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuAddInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuDelInstance
//
// Description: delete instance
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
// delete timer
Ret = EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuNmtEvent
//
// Description: sends the NMT-Event to the NMT-State-Maschine
//
//
//
// Parameters: NmtEvent_p = NMT-Event to send
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuNmtEvent(tEplNmtEvent NmtEvent_p)
{
tEplKernel Ret;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkNmtk;
Event.m_NetTime.m_dwNanoSec = 0;
Event.m_NetTime.m_dwSec = 0;
Event.m_EventType = kEplEventTypeNmtEvent;
Event.m_pArg = &NmtEvent_p;
Event.m_uiSize = sizeof(NmtEvent_p);
Ret = EplEventuPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuGetNmtState
//
// Description: returns the actuell NMT-State
//
//
//
// Parameters:
//
//
// Returns: tEplNmtState = NMT-State
//
//
// State:
//
//---------------------------------------------------------------------------
tEplNmtState EplNmtuGetNmtState(void)
{
tEplNmtState NmtState;
// $$$ call function of communication abstraction layer
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
NmtState = EplNmtkGetNmtState();
#else
NmtState = 0;
#endif
return NmtState;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuProcessEvent
//
// Description: processes events from event queue
//
//
//
// Parameters: pEplEvent_p = pointer to event
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuProcessEvent(tEplEvent *pEplEvent_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// process event
switch (pEplEvent_p->m_EventType) {
// state change of NMT-Module
case kEplEventTypeNmtStateChange:
{
tEplEventNmtStateChange *pNmtStateChange;
// delete timer
Ret =
EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
pNmtStateChange =
(tEplEventNmtStateChange *) pEplEvent_p->m_pArg;
// call cb-functions to inform higher layer
if (EplNmtuInstance_g.m_pfnNmtChangeCb != NULL) {
Ret =
EplNmtuInstance_g.
m_pfnNmtChangeCb(*pNmtStateChange);
}
if (Ret == kEplSuccessful) { // everything is OK, so switch to next state if necessary
switch (pNmtStateChange->m_NewNmtState) {
// EPL stack is not running
case kEplNmtGsOff:
break;
// first init of the hardware
case kEplNmtGsInitialising:
{
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterResetApp);
break;
}
// init of the manufacturer-specific profile area and the
// standardised device profile area
case kEplNmtGsResetApplication:
{
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterResetCom);
break;
}
// init of the communication profile area
case kEplNmtGsResetCommunication:
{
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterResetConfig);
break;
}
// build the configuration with infos from OD
case kEplNmtGsResetConfiguration:
{
unsigned int uiNodeId;
// get node ID from OD
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
uiNodeId =
EplObduGetNodeId
(EPL_MCO_PTR_INSTANCE_PTR);
#else
uiNodeId = 0;
#endif
//check node ID if not should be master or slave
if (uiNodeId == EPL_C_ADR_MN_DEF_NODE_ID) { // node shall be MN
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterMsNotActive);
#else
TRACE0
("EplNmtuProcess(): no MN functionality implemented\n");
#endif
} else { // node shall be CN
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterCsNotActive);
}
break;
}
//-----------------------------------------------------------
// CN part of the state machine
// node listens for EPL-Frames and check timeout
case kEplNmtCsNotActive:
{
u32 dwBuffer;
tEplObdSize ObdSize;
tEplTimerArg TimerArg;
// create timer to switch automatically to BasicEthernet if no MN available in network
// read NMT_CNBasicEthernetTimerout_U32 from OD
ObdSize = sizeof(dwBuffer);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
Ret =
EplObduReadEntry
(EPL_MCO_PTR_INSTANCE_PTR_
0x1F99, 0x00, &dwBuffer,
&ObdSize);
#else
Ret = kEplObdIndexNotExist;
#endif
if (Ret != kEplSuccessful) {
break;
}
if (dwBuffer != 0) { // BasicEthernet is enabled
// convert us into ms
dwBuffer =
dwBuffer / 1000;
if (dwBuffer == 0) { // timer was below one ms
// set one ms
dwBuffer = 1;
}
TimerArg.m_EventSink =
kEplEventSinkNmtk;
TimerArg.m_ulArg =
(unsigned long)
kEplNmtEventTimerBasicEthernet;
Ret =
EplTimeruModifyTimerMs
(&EplNmtuInstance_g.
m_TimerHdl,
(unsigned long)
dwBuffer,
TimerArg);
// potential error is forwarded to event queue which generates error event
}
break;
}
// node processes only async frames
case kEplNmtCsPreOperational1:
{
break;
}
// node processes isochronous and asynchronous frames
case kEplNmtCsPreOperational2:
{
Ret =
EplNmtuNmtEvent
(kEplNmtEventEnterReadyToOperate);
break;
}
// node should be configured und application is ready
case kEplNmtCsReadyToOperate:
{
break;
}
// normal work state
case kEplNmtCsOperational:
{
break;
}
// node stopped by MN
// -> only process asynchronous frames
case kEplNmtCsStopped:
{
break;
}
// no EPL cycle
// -> normal ethernet communication
case kEplNmtCsBasicEthernet:
{
break;
}
//-----------------------------------------------------------
// MN part of the state machine
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
// node listens for EPL-Frames and check timeout
case kEplNmtMsNotActive:
{
u32 dwBuffer;
tEplObdSize ObdSize;
tEplTimerArg TimerArg;
// create timer to switch automatically to BasicEthernet/PreOp1 if no other MN active in network
// check NMT_StartUp_U32.Bit13
// read NMT_StartUp_U32 from OD
ObdSize = sizeof(dwBuffer);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
Ret =
EplObduReadEntry
(EPL_MCO_PTR_INSTANCE_PTR_
0x1F80, 0x00, &dwBuffer,
&ObdSize);
#else
Ret = kEplObdIndexNotExist;
#endif
if (Ret != kEplSuccessful) {
break;
}
if ((dwBuffer & EPL_NMTST_BASICETHERNET) == 0) { // NMT_StartUp_U32.Bit13 == 0
// new state PreOperational1
TimerArg.m_ulArg =
(unsigned long)
kEplNmtEventTimerMsPreOp1;
} else { // NMT_StartUp_U32.Bit13 == 1
// new state BasicEthernet
TimerArg.m_ulArg =
(unsigned long)
kEplNmtEventTimerBasicEthernet;
}
// read NMT_BootTime_REC.MNWaitNotAct_U32 from OD
ObdSize = sizeof(dwBuffer);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
Ret =
EplObduReadEntry
(EPL_MCO_PTR_INSTANCE_PTR_
0x1F89, 0x01, &dwBuffer,
&ObdSize);
#else
Ret = kEplObdIndexNotExist;
#endif
if (Ret != kEplSuccessful) {
break;
}
// convert us into ms
dwBuffer = dwBuffer / 1000;
if (dwBuffer == 0) { // timer was below one ms
// set one ms
dwBuffer = 1;
}
TimerArg.m_EventSink =
kEplEventSinkNmtk;
Ret =
EplTimeruModifyTimerMs
(&EplNmtuInstance_g.
m_TimerHdl,
(unsigned long)dwBuffer,
TimerArg);
// potential error is forwarded to event queue which generates error event
break;
}
// node processes only async frames
case kEplNmtMsPreOperational1:
{
u32 dwBuffer = 0;
tEplObdSize ObdSize;
tEplTimerArg TimerArg;
// create timer to switch automatically to PreOp2 if MN identified all mandatory CNs
// read NMT_BootTime_REC.MNWaitPreOp1_U32 from OD
ObdSize = sizeof(dwBuffer);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
Ret =
EplObduReadEntry
(EPL_MCO_PTR_INSTANCE_PTR_
0x1F89, 0x03, &dwBuffer,
&ObdSize);
if (Ret != kEplSuccessful) {
// ignore error, because this timeout is optional
dwBuffer = 0;
}
#endif
if (dwBuffer == 0) { // delay is deactivated
// immediately post timer event
Ret =
EplNmtuNmtEvent
(kEplNmtEventTimerMsPreOp2);
break;
}
// convert us into ms
dwBuffer = dwBuffer / 1000;
if (dwBuffer == 0) { // timer was below one ms
// set one ms
dwBuffer = 1;
}
TimerArg.m_EventSink =
kEplEventSinkNmtk;
TimerArg.m_ulArg =
(unsigned long)
kEplNmtEventTimerMsPreOp2;
Ret =
EplTimeruModifyTimerMs
(&EplNmtuInstance_g.
m_TimerHdl,
(unsigned long)dwBuffer,
TimerArg);
// potential error is forwarded to event queue which generates error event
break;
}
// node processes isochronous and asynchronous frames
case kEplNmtMsPreOperational2:
{
break;
}
// node should be configured und application is ready
case kEplNmtMsReadyToOperate:
{
break;
}
// normal work state
case kEplNmtMsOperational:
{
break;
}
// no EPL cycle
// -> normal ethernet communication
case kEplNmtMsBasicEthernet:
{
break;
}
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
default:
{
TRACE1
("EplNmtuProcess(): unhandled NMT state 0x%X\n",
pNmtStateChange->
m_NewNmtState);
}
}
} else if (Ret == kEplReject) { // application wants to change NMT state itself
// it's OK
Ret = kEplSuccessful;
}
EPL_DBGLVL_NMTU_TRACE0
("EplNmtuProcessEvent(): NMT-State-Maschine announce change of NMT State\n");
break;
}
default:
{
Ret = kEplNmtInvalidEvent;
}
}
//Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplNmtuRegisterStateChangeCb
//
// Description: register Callback-function go get informed about a
// NMT-Change-State-Event
//
//
//
// Parameters: pfnEplNmtStateChangeCb_p = functionpointer
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplNmtuRegisterStateChangeCb(tEplNmtuStateChangeCallback pfnEplNmtStateChangeCb_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// save callback-function in modul global var
EplNmtuInstance_g.m_pfnNmtChangeCb = pfnEplNmtStateChangeCb_p;
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
// EOF

View File

@ -1,158 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for communication abstraction layer of the
NMT-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtuCal.c,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/06/16 -k.t.: start of the implementation
****************************************************************************/
#include "user/EplNmtuCal.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplNmtkCalGetNmtState
//
// Description: return current NMT-State
// -> encapsulate access to kernelspace
//
//
//
// Parameters:
//
//
// Returns: tEplNmtState = current NMT-State
//
//
// State:
//
//---------------------------------------------------------------------------
tEplNmtState EplNmtkCalGetNmtState(void)
{
tEplNmtState NmtState;
// for test direkt call for EplNmtkGetNmtState()
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
NmtState = EplNmtkGetNmtState();
#else
NmtState = 0;
#endif
return NmtState;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
// EOF

File diff suppressed because it is too large Load Diff

View File

@ -1,456 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for api function of EplOBD-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObd.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
Microsoft VC7
-------------------------------------------------------------------------
Revision History:
2006/06/02 k.t.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPLOBD_H_
#define _EPLOBD_H_
#include "EplInc.h"
// ============================================================================
// defines
// ============================================================================
#define EPL_OBD_TABLE_INDEX_END 0xFFFF
// for the usage of BOOLEAN in OD
#define OBD_TRUE 0x01
#define OBD_FALSE 0x00
// default OD index for Node id
#define EPL_OBD_NODE_ID_INDEX 0x1F93
// default subindex for NodeId in OD
#define EPL_OBD_NODE_ID_SUBINDEX 0x01
// default subindex for NodeIDByHW_BOOL
#define EPL_OBD_NODE_ID_HWBOOL_SUBINDEX 0x02
// ============================================================================
// enums
// ============================================================================
// directions for access to object dictionary
typedef enum {
kEplObdDirInit = 0x00, // initialising after power on
kEplObdDirStore = 0x01, // store all object values to non volatile memory
kEplObdDirLoad = 0x02, // load all object values from non volatile memory
kEplObdDirRestore = 0x03, // deletes non volatile memory (restore)
kEplObdDirOBKCheck = 0xFF // reserved
} tEplObdDir;
// commands for store
typedef enum {
kEplObdCommNothing = 0x00,
kEplObdCommOpenWrite = 0x01,
kEplObdCommWriteObj = 0x02,
kEplObdCommCloseWrite = 0x03,
kEplObdCommOpenRead = 0x04,
kEplObdCommReadObj = 0x05,
kEplObdCommCloseRead = 0x06,
kEplObdCommClear = 0x07,
kEplObdCommUnknown = 0xFF
} tEplObdCommand;
//-----------------------------------------------------------------------------------------------------------
// events of object callback function
typedef enum {
// m_pArg points to
// ---------------------
kEplObdEvCheckExist = 0x06, // checking if object does exist (reading and writing) NULL
kEplObdEvPreRead = 0x00, // before reading an object source data buffer in OD
kEplObdEvPostRead = 0x01, // after reading an object destination data buffer from caller
kEplObdEvWrStringDomain = 0x07, // event for changing string/domain data pointer or size struct tEplObdVStringDomain in RAM
kEplObdEvInitWrite = 0x04, // initializes writing an object (checking object size) size of object in OD (tEplObdSize)
kEplObdEvPreWrite = 0x02, // before writing an object source data buffer from caller
kEplObdEvPostWrite = 0x03, // after writing an object destination data buffer in OD
// kEplObdEvAbortSdo = 0x05 // after an abort of an SDO transfer
} tEplObdEvent;
// part of OD (bit oriented)
typedef unsigned int tEplObdPart;
#define kEplObdPartNo 0x00 // nothing
#define kEplObdPartGen 0x01 // part (0x1000 - 0x1FFF)
#define kEplObdPartMan 0x02 // manufacturer part (0x2000 - 0x5FFF)
#define kEplObdPartDev 0x04 // device part (0x6000 - 0x9FFF)
#define kEplObdPartUsr 0x08 // dynamic part e.g. for ICE61131-3
// combinations
#define kEplObdPartApp ( kEplObdPartMan | kEplObdPartDev | kEplObdPartUsr) // manufacturer and device part (0x2000 - 0x9FFF) and user OD
#define kEplObdPartAll (kEplObdPartGen | kEplObdPartMan | kEplObdPartDev | kEplObdPartUsr) // whole OD
//-----------------------------------------------------------------------------------------------------------
// access types for objects
// must be a difine because bit-flags
typedef unsigned int tEplObdAccess;
#define kEplObdAccRead 0x01 // object can be read
#define kEplObdAccWrite 0x02 // object can be written
#define kEplObdAccConst 0x04 // object contains a constant value
#define kEplObdAccPdo 0x08 // object can be mapped in a PDO
#define kEplObdAccArray 0x10 // object contains an array of numerical values
#define kEplObdAccRange 0x20 // object contains lower and upper limit
#define kEplObdAccVar 0x40 // object data is placed in application
#define kEplObdAccStore 0x80 // object data can be stored to non volatile memory
// combinations (not all combinations are required)
#define kEplObdAccR (0 | 0 | 0 | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccW (0 | 0 | 0 | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccRW (0 | 0 | 0 | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccCR (0 | 0 | 0 | 0 | kEplObdAccConst | 0 | kEplObdAccRead)
#define kEplObdAccGR (0 | 0 | kEplObdAccRange | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccGW (0 | 0 | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccGRW (0 | 0 | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccVR (0 | kEplObdAccVar | 0 | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccVW (0 | kEplObdAccVar | 0 | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccVRW (0 | kEplObdAccVar | 0 | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccVPR (0 | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | 0 | kEplObdAccRead)
#define kEplObdAccVPW (0 | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccVPRW (0 | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccVGR (0 | kEplObdAccVar | kEplObdAccRange | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccVGW (0 | kEplObdAccVar | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccVGRW (0 | kEplObdAccVar | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccVGPR (0 | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | 0 | kEplObdAccRead)
#define kEplObdAccVGPW (0 | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccVGPRW (0 | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSR (kEplObdAccStore | 0 | 0 | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSW (kEplObdAccStore | 0 | 0 | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSRW (kEplObdAccStore | 0 | 0 | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSCR (kEplObdAccStore | 0 | 0 | 0 | kEplObdAccConst | 0 | kEplObdAccRead)
#define kEplObdAccSGR (kEplObdAccStore | 0 | kEplObdAccRange | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSGW (kEplObdAccStore | 0 | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSGRW (kEplObdAccStore | 0 | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSVR (kEplObdAccStore | kEplObdAccVar | 0 | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSVW (kEplObdAccStore | kEplObdAccVar | 0 | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSVRW (kEplObdAccStore | kEplObdAccVar | 0 | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSVPR (kEplObdAccStore | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSVPW (kEplObdAccStore | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSVPRW (kEplObdAccStore | kEplObdAccVar | 0 | kEplObdAccPdo | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSVGR (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | 0 | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSVGW (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSVGRW (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | 0 | 0 | kEplObdAccWrite | kEplObdAccRead)
#define kEplObdAccSVGPR (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | 0 | kEplObdAccRead)
#define kEplObdAccSVGPW (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | kEplObdAccWrite | 0 )
#define kEplObdAccSVGPRW (kEplObdAccStore | kEplObdAccVar | kEplObdAccRange | kEplObdAccPdo | 0 | kEplObdAccWrite | kEplObdAccRead)
typedef unsigned int tEplObdSize; // For all objects as objects size are used an unsigned int.
// -------------------------------------------------------------------------
// types for data types defined in DS301
// -------------------------------------------------------------------------
// types of objects in object dictionary
// DS-301 defines these types as u16
typedef enum {
// types which are always supported
kEplObdTypBool = 0x0001,
kEplObdTypInt8 = 0x0002,
kEplObdTypInt16 = 0x0003,
kEplObdTypInt32 = 0x0004,
kEplObdTypUInt8 = 0x0005,
kEplObdTypUInt16 = 0x0006,
kEplObdTypUInt32 = 0x0007,
kEplObdTypReal32 = 0x0008,
kEplObdTypVString = 0x0009,
kEplObdTypOString = 0x000A,
kEplObdTypDomain = 0x000F,
kEplObdTypInt24 = 0x0010,
kEplObdTypUInt24 = 0x0016,
kEplObdTypReal64 = 0x0011,
kEplObdTypInt40 = 0x0012,
kEplObdTypInt48 = 0x0013,
kEplObdTypInt56 = 0x0014,
kEplObdTypInt64 = 0x0015,
kEplObdTypUInt40 = 0x0018,
kEplObdTypUInt48 = 0x0019,
kEplObdTypUInt56 = 0x001A,
kEplObdTypUInt64 = 0x001B,
kEplObdTypTimeOfDay = 0x000C,
kEplObdTypTimeDiff = 0x000D
} tEplObdType;
// other types are not supported in this version
// -------------------------------------------------------------------------
// types for data types defined in DS301
// -------------------------------------------------------------------------
typedef unsigned char tEplObdBoolean; // 0001
typedef signed char tEplObdInteger8; // 0002
typedef signed short int tEplObdInteger16; // 0003
typedef signed long tEplObdInteger32; // 0004
typedef unsigned char tEplObdUnsigned8; // 0005
typedef unsigned short int tEplObdUnsigned16; // 0006
typedef unsigned long tEplObdUnsigned32; // 0007
typedef float tEplObdReal32; // 0008
typedef unsigned char tEplObdDomain; // 000F
typedef signed long tEplObdInteger24; // 0010
typedef unsigned long tEplObdUnsigned24; // 0016
typedef s64 tEplObdInteger40; // 0012
typedef s64 tEplObdInteger48; // 0013
typedef s64 tEplObdInteger56; // 0014
typedef s64 tEplObdInteger64; // 0015
typedef u64 tEplObdUnsigned40; // 0018
typedef u64 tEplObdUnsigned48; // 0019
typedef u64 tEplObdUnsigned56; // 001A
typedef u64 tEplObdUnsigned64; // 001B
typedef double tEplObdReal64; // 0011
typedef tTimeOfDay tEplObdTimeOfDay; // 000C
typedef tTimeOfDay tEplObdTimeDifference; // 000D
// -------------------------------------------------------------------------
// structur for defining a variable
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
typedef enum {
kVarValidSize = 0x01,
kVarValidData = 0x02,
// kVarValidCallback = 0x04,
// kVarValidArg = 0x08,
kVarValidAll = 0x03 // currently only size and data are implemented and used
} tEplVarParamValid;
typedef tEplKernel(*tEplVarCallback) (CCM_DECL_INSTANCE_HDL_ void *pParam_p);
typedef struct {
tEplVarParamValid m_ValidFlag;
unsigned int m_uiIndex;
unsigned int m_uiSubindex;
tEplObdSize m_Size;
void *m_pData;
// tEplVarCallback m_fpCallback;
// void * m_pArg;
} tEplVarParam;
typedef struct {
void *m_pData;
tEplObdSize m_Size;
/*
#if (EPL_PDO_USE_STATIC_MAPPING == FALSE)
tEplVarCallback m_fpCallback;
void * m_pArg;
#endif
*/
} tEplObdVarEntry;
typedef struct {
tEplObdSize m_Size;
u8 *m_pString;
} tEplObdOString; // 000C
typedef struct {
tEplObdSize m_Size;
char *m_pString;
} tEplObdVString; // 000D
typedef struct {
tEplObdSize m_Size;
char *m_pDefString; // $$$ d.k. it is unused, so we could delete it
char *m_pString;
} tEplObdVStringDef;
typedef struct {
tEplObdSize m_Size;
u8 *m_pDefString; // $$$ d.k. it is unused, so we could delete it
u8 *m_pString;
} tEplObdOStringDef;
//r.d. parameter struct for changing object size and/or pointer to data of Strings or Domains
typedef struct {
tEplObdSize m_DownloadSize; // download size from SDO or APP
tEplObdSize m_ObjSize; // current object size from OD - should be changed from callback function
void *m_pData; // current object ptr from OD - should be changed from callback function
} tEplObdVStringDomain; // 000D
// ============================================================================
// types
// ============================================================================
// -------------------------------------------------------------------------
// subindexstruct
// -------------------------------------------------------------------------
// Change not the order for this struct!!!
typedef struct {
unsigned int m_uiSubIndex;
tEplObdType m_Type;
tEplObdAccess m_Access;
void *m_pDefault;
void *m_pCurrent; // points always to RAM
} tEplObdSubEntry;
// r.d.: has always to be because new OBD-Macros for arrays
typedef tEplObdSubEntry *tEplObdSubEntryPtr;
// -------------------------------------------------------------------------
// callback function for objdictionary modul
// -------------------------------------------------------------------------
// parameters for callback function
typedef struct {
tEplObdEvent m_ObdEvent;
unsigned int m_uiIndex;
unsigned int m_uiSubIndex;
void *m_pArg;
u32 m_dwAbortCode;
} tEplObdCbParam;
// define type for callback function: pParam_p points to tEplObdCbParam
typedef tEplKernel(*tEplObdCallback) (CCM_DECL_INSTANCE_HDL_ tEplObdCbParam *pParam_p);
// do not change the order for this struct!!!
typedef struct {
unsigned int m_uiIndex;
tEplObdSubEntryPtr m_pSubIndex;
unsigned int m_uiCount;
tEplObdCallback m_fpCallback; // function is called back if object access
} tEplObdEntry;
// allways pointer
typedef tEplObdEntry *tEplObdEntryPtr;
// -------------------------------------------------------------------------
// structur to initialize OBD module
// -------------------------------------------------------------------------
typedef struct {
tEplObdEntryPtr m_pPart;
tEplObdEntryPtr m_pManufacturerPart;
tEplObdEntryPtr m_pDevicePart;
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
tEplObdEntryPtr m_pUserPart;
#endif
} tEplObdInitParam;
// -------------------------------------------------------------------------
// structur for parameters of STORE RESTORE command
// -------------------------------------------------------------------------
typedef struct {
tEplObdCommand m_bCommand;
tEplObdPart m_bCurrentOdPart;
void *m_pData;
tEplObdSize m_ObjSize;
} tEplObdCbStoreParam;
typedef tEplKernel(*tInitTabEntryCallback) (void *pTabEntry_p, unsigned int uiObjIndex_p);
typedef tEplKernel(*tEplObdStoreLoadObjCallback) (CCM_DECL_INSTANCE_HDL_ tEplObdCbStoreParam *pCbStoreParam_p);
// -------------------------------------------------------------------------
// this stucture is used for parameters for function ObdInitModuleTab()
// -------------------------------------------------------------------------
typedef struct {
unsigned int m_uiLowerObjIndex; // lower limit of ObjIndex
unsigned int m_uiUpperObjIndex; // upper limit of ObjIndex
tInitTabEntryCallback m_fpInitTabEntry; // will be called if ObjIndex was found
void *m_pTabBase; // base address of table
unsigned int m_uiEntrySize; // size of table entry // 25-feb-2005 r.d.: expansion from u8 to u16 necessary for PDO bit mapping
unsigned int m_uiMaxEntries; // max. tabel entries
} tEplObdModulTabParam;
//-------------------------------------------------------------------
// enum for function EplObdSetNodeId
//-------------------------------------------------------------------
typedef enum {
kEplObdNodeIdUnknown = 0x00, // unknown how the node id was set
kEplObdNodeIdSoftware = 0x01, // node id set by software
kEplObdNodeIdHardware = 0x02 // node id set by hardware
} tEplObdNodeIdType;
// ============================================================================
// global variables
// ============================================================================
// ============================================================================
// public functions
// ============================================================================
#endif // #ifndef _EPLOBD_H_

View File

@ -1,354 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for macros of EplOBD-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObdMacro.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/05 k.t.: start of the implementation
-> based on CANopen ObdMacro.h
****************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#if defined (EPL_OBD_DEFINE_MACRO)
//-------------------------------------------------------------------------------------------
#if defined (EPL_OBD_CREATE_ROM_DATA)
// #pragma message ("EPL_OBD_CREATE_ROM_DATA")
#define EPL_OBD_BEGIN() static u32 dwObd_OBK_g = 0x0000;
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC()
#define EPL_OBD_BEGIN_PART_MANUFACTURER()
#define EPL_OBD_BEGIN_PART_DEVICE()
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call)
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static tEplObdUnsigned8 xDef##ind##_0x00_g = (cnt); \
static dtyp xDef##ind##_0x01_g = (def);
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static tEplObdUnsigned8 xDef##ind##_0x00_g = (cnt); \
static dtyp xDef##ind##_0x01_g = (def);
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name) static tEplObdUnsigned8 xDef##ind##_0x00_g = (cnt);
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val) static dtyp xDef##ind##_##sub##_g = val;
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high) static dtyp xDef##ind##_##sub##_g[3] = {val,low,high};
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name)
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val) static char szCur##ind##_##sub##_g[size+1]; \
static tEplObdVStringDef xDef##ind##_##sub##_g = {size, val, szCur##ind##_##sub##_g};
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size) static u8 bCur##ind##_##sub##_g[size]; \
static tEplObdOStringDef xDef##ind##_##sub##_g = {size, ((u8*)""), bCur##ind##_##sub##_g};
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name)
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val) static dtyp xDef##ind##_##sub##_g = val;
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high) static dtyp xDef##ind##_##sub##_g[3] = {val,low,high};
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name)
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_CREATE_RAM_DATA)
// #pragma message ("EPL_OBD_CREATE_RAM_DATA")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC()
#define EPL_OBD_BEGIN_PART_MANUFACTURER()
#define EPL_OBD_BEGIN_PART_DEVICE()
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call)
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static dtyp axCur##ind##_g[cnt];
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static tEplObdVarEntry aVarEntry##ind##_g[cnt];
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name) static tEplObdVarEntry aVarEntry##ind##_g[cnt];
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val) static dtyp xCur##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high) static dtyp xCur##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val) static tEplObdVString xCur##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size) static tEplObdOString xCur##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name) static dtyp xCur##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name) static tEplObdVarEntry VarEntry##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val) static tEplObdVarEntry VarEntry##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high) static tEplObdVarEntry VarEntry##ind##_##sub##_g;
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name) static tEplObdVarEntry VarEntry##ind##_##sub##_g;
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_CREATE_SUBINDEX_TAB)
// #pragma message ("EPL_OBD_CREATE_SUBINDEX_TAB")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC()
#define EPL_OBD_BEGIN_PART_MANUFACTURER()
#define EPL_OBD_BEGIN_PART_DEVICE()
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call) static tEplObdSubEntry aObdSubEntry##ind##Ram_g[cnt]= {
#define EPL_OBD_END_INDEX(ind) EPL_OBD_END_SUBINDEX()};
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static tEplObdSubEntry aObdSubEntry##ind##Ram_g[]= { \
{0, kEplObdTypUInt8, kEplObdAccCR, &xDef##ind##_0x00_g, NULL}, \
{1, typ, (acc)|kEplObdAccArray, &xDef##ind##_0x01_g, &axCur##ind##_g[0]}, \
EPL_OBD_END_SUBINDEX()};
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def) static tEplObdSubEntry aObdSubEntry##ind##Ram_g[]= { \
{0, kEplObdTypUInt8, kEplObdAccCR, &xDef##ind##_0x00_g, NULL}, \
{1, typ, (acc)|kEplObdAccArray|kEplObdAccVar, &xDef##ind##_0x01_g, &aVarEntry##ind##_g[0]}, \
EPL_OBD_END_SUBINDEX()};
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name) static tEplObdSubEntry aObdSubEntry##ind##Ram_g[]= { \
{0, kEplObdTypUInt8, kEplObdAccCR, &xDef##ind##_0x00_g, NULL}, \
{1, typ, (acc)|kEplObdAccArray|kEplObdAccVar, NULL, &aVarEntry##ind##_g[0]}, \
EPL_OBD_END_SUBINDEX()};
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val) {sub,typ, (acc), &xDef##ind##_##sub##_g, &xCur##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high) {sub,typ, (acc)|kEplObdAccRange, &xDef##ind##_##sub##_g[0],&xCur##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name) {sub,typ, (acc), NULL, &xCur##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val) {sub,kEplObdTypVString,(acc)/*|kEplObdAccVar*/, &xDef##ind##_##sub##_g, &xCur##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size) {sub,kEplObdTypOString,(acc)/*|kEplObdAccVar*/, &xDef##ind##_##sub##_g, &xCur##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name) {sub,kEplObdTypDomain, (acc)|kEplObdAccVar, NULL, &VarEntry##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val) {sub,typ, (acc)|kEplObdAccVar, &xDef##ind##_##sub##_g, &VarEntry##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high) {sub,typ, (acc)|kEplObdAccVar|kEplObdAccRange,&xDef##ind##_##sub##_g[0],&VarEntry##ind##_##sub##_g},
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name) {sub,typ, (acc)|kEplObdAccVar, NULL, &VarEntry##ind##_##sub##_g},
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_CREATE_INDEX_TAB)
// #pragma message ("EPL_OBD_CREATE_INDEX_TAB")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC() static tEplObdEntry aObdTab_g[] = {
#define EPL_OBD_BEGIN_PART_MANUFACTURER() static tEplObdEntry aObdTabManufacturer_g[] = {
#define EPL_OBD_BEGIN_PART_DEVICE() static tEplObdEntry aObdTabDevice_g[] = {
#define EPL_OBD_END_PART() {EPL_OBD_TABLE_INDEX_END,(tEplObdSubEntryPtr)&dwObd_OBK_g,0,NULL}};
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call) {ind,(tEplObdSubEntryPtr)&aObdSubEntry##ind##Ram_g[0],cnt,(tEplObdCallback)call},
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def) {ind,(tEplObdSubEntryPtr)&aObdSubEntry##ind##Ram_g[0],(cnt)+1,(tEplObdCallback)call},
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def) {ind,(tEplObdSubEntryPtr)&aObdSubEntry##ind##Ram_g[0],(cnt)+1,(tEplObdCallback)call},
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name) {ind,(tEplObdSubEntryPtr)&aObdSubEntry##ind##Ram_g[0],(cnt)+1,(tEplObdCallback)call},
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val)
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size)
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name)
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name)
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name)
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_CREATE_INIT_FUNCTION)
// #pragma message ("EPL_OBD_CREATE_INIT_FUNCTION")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC() pInitParam->m_pPart = (tEplObdEntryPtr) &aObdTab_g[0];
#define EPL_OBD_BEGIN_PART_MANUFACTURER() pInitParam->m_pManufacturerPart = (tEplObdEntryPtr) &aObdTabManufacturer_g[0];
#define EPL_OBD_BEGIN_PART_DEVICE() pInitParam->m_pDevicePart = (tEplObdEntryPtr) &aObdTabDevice_g[0];
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call)
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def)
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def)
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name)
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val)
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size)
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name)
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name)
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name)
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_CREATE_INIT_SUBINDEX)
// #pragma message ("EPL_OBD_CREATE_INIT_SUBINDEX")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC()
#define EPL_OBD_BEGIN_PART_MANUFACTURER()
#define EPL_OBD_BEGIN_PART_DEVICE()
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call) //CCM_SUBINDEX_RAM_ONLY (EPL_MEMCPY (&aObdSubEntry##ind##Ram_g[0],&aObdSubEntry##ind##Rom_g[0],sizeof(aObdSubEntry##ind##Ram_g)));
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def) //EPL_MEMCPY (&aObdSubEntry##ind##Ram_g[0],&aObdSubEntry##ind##Rom_g[0],sizeof(aObdSubEntry##ind##Ram_g));
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def) //EPL_MEMCPY (&aObdSubEntry##ind##Ram_g[0],&aObdSubEntry##ind##Rom_g[0],sizeof(aObdSubEntry##ind##Ram_g));
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name) //EPL_MEMCPY (&aObdSubEntry##ind##Ram_g[0],&aObdSubEntry##ind##Rom_g[0],sizeof(aObdSubEntry##ind##Ram_g));
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,size,val)
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size)
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name)
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name)
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name)
//-------------------------------------------------------------------------------------------
#else
// #pragma message ("ELSE OF DEFINE")
#define EPL_OBD_BEGIN()
#define EPL_OBD_END()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_PART_GENERIC()
#define EPL_OBD_BEGIN_PART_MANUFACTURER()
#define EPL_OBD_BEGIN_PART_DEVICE()
#define EPL_OBD_END_PART()
//---------------------------------------------------------------------------------------
#define EPL_OBD_BEGIN_INDEX_RAM(ind,cnt,call)
#define EPL_OBD_END_INDEX(ind)
#define EPL_OBD_RAM_INDEX_RAM_ARRAY(ind,cnt,call,typ,acc,dtyp,name,def)
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY(ind,cnt,call,typ,acc,dtyp,name,def)
#define EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(ind,cnt,call,typ,acc,dtyp,name)
//---------------------------------------------------------------------------------------
#define EPL_OBD_SUBINDEX_RAM_VAR(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_VAR_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_VSTRING(ind,sub,acc,name,sizes,val)
#define EPL_OBD_SUBINDEX_RAM_OSTRING(ind,sub,acc,name,size)
#define EPL_OBD_SUBINDEX_RAM_VAR_NOINIT(ind,sub,typ,acc,dtyp,name)
#define EPL_OBD_SUBINDEX_RAM_DOMAIN(ind,sub,acc,name)
#define EPL_OBD_SUBINDEX_RAM_USERDEF(ind,sub,typ,acc,dtyp,name,val)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_RG(ind,sub,typ,acc,dtyp,name,val,low,high)
#define EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT(ind,sub,typ,acc,dtyp,name)
#endif
//-------------------------------------------------------------------------------------------
#elif defined (EPL_OBD_UNDEFINE_MACRO)
// #pragma message ("EPL_OBD_UNDEFINE_MACRO")
#undef EPL_OBD_BEGIN
#undef EPL_OBD_END
//---------------------------------------------------------------------------------------
#undef EPL_OBD_BEGIN_PART_GENERIC
#undef EPL_OBD_BEGIN_PART_MANUFACTURER
#undef EPL_OBD_BEGIN_PART_DEVICE
#undef EPL_OBD_END_PART
//---------------------------------------------------------------------------------------
#undef EPL_OBD_BEGIN_INDEX_RAM
#undef EPL_OBD_END_INDEX
#undef EPL_OBD_RAM_INDEX_RAM_ARRAY
#undef EPL_OBD_RAM_INDEX_RAM_VARARRAY
#undef EPL_OBD_RAM_INDEX_RAM_VARARRAY_NOINIT
//---------------------------------------------------------------------------------------
#undef EPL_OBD_SUBINDEX_RAM_VAR
#undef EPL_OBD_SUBINDEX_RAM_VAR_RG
#undef EPL_OBD_SUBINDEX_RAM_VSTRING
#undef EPL_OBD_SUBINDEX_RAM_OSTRING
#undef EPL_OBD_SUBINDEX_RAM_VAR_NOINIT
#undef EPL_OBD_SUBINDEX_RAM_DOMAIN
#undef EPL_OBD_SUBINDEX_RAM_USERDEF
#undef EPL_OBD_SUBINDEX_RAM_USERDEF_RG
#undef EPL_OBD_SUBINDEX_RAM_USERDEF_NOINIT
#else
#error "nothing defined"
#endif

View File

@ -1,146 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for communication abstraction layer
for the Epl-Obd-Kernelspace-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObdkCal.c,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
// EOF

View File

@ -1,506 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for Epl-Obd-Userspace-module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObdu.c,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "user/EplObdu.h"
#include "user/EplObduCal.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplObduWriteEntry()
//
// Description: Function writes data to an OBD entry. Strings
// are stored with added '\0' character.
//
// Parameters: uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pSrcData_p = Pointer to the data to write
// Size_p = Size of the data in Byte
//
// Return: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduWriteEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p)
{
tEplKernel Ret;
Ret = EplObduCalWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduReadEntry()
//
// Description: The function reads an object entry. The application
// can always read the data even if attrib kEplObdAccRead
// is not set. The attrib is only checked up for SDO transfer.
//
// Parameters: uiIndex_p = Index oof the OD entry to read
// uiSubIndex_p = Subindex to read
// pDstData_p = pointer to the buffer for data
// Offset_p = offset in data for read access
// pSize_p = IN: Size of the buffer
// OUT: number of readed Bytes
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduReadEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p)
{
tEplKernel Ret;
Ret = EplObduCalReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObdAccessOdPart()
//
// Description: restores default values of one part of OD
//
// Parameters: ObdPart_p = od-part to reset
// Direction_p = directory flag for
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduAccessOdPart(tEplObdPart ObdPart_p, tEplObdDir Direction_p)
{
tEplKernel Ret;
Ret = EplObduCalAccessOdPart(ObdPart_p, Direction_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduDefineVar()
//
// Description: defines a variable in OD
//
// Parameters: pEplVarParam_p = varentry
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduDefineVar(tEplVarParam *pVarParam_p)
{
tEplKernel Ret;
Ret = EplObduCalDefineVar(pVarParam_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduGetObjectDataPtr()
//
// Description: It returnes the current data pointer. But if object is an
// constant object it returnes the default pointer.
//
// Parameters: uiIndex_p = Index of the entry
// uiSubindex_p = Subindex of the entry
//
// Return: void * = pointer to object data
//
// State:
//
//---------------------------------------------------------------------------
void *EplObduGetObjectDataPtr(unsigned int uiIndex_p, unsigned int uiSubIndex_p)
{
void *pData;
pData = EplObduCalGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
return pData;
}
//---------------------------------------------------------------------------
//
// Function: EplObduRegisterUserOd()
//
// Description: function registers the user OD
//
// Parameters: pUserOd_p =pointer to user ODd
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
tEplKernel EplObduRegisterUserOd(tEplObdEntryPtr pUserOd_p)
{
tEplKernel Ret;
Ret = EplObduCalRegisterUserOd(pUserOd_p);
return Ret;
}
#endif
//---------------------------------------------------------------------------
//
// Function: EplObduInitVarEntry()
//
// Description: function to initialize VarEntry dependened on object type
//
// Parameters: pVarEntry_p = pointer to var entry structure
// bType_p = object type
// ObdSize_p = size of object data
//
// Returns: none
//
// State:
//
//---------------------------------------------------------------------------
void EplObduInitVarEntry(tEplObdVarEntry *pVarEntry_p, u8 bType_p, tEplObdSize ObdSize_p)
{
EplObduCalInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
}
//---------------------------------------------------------------------------
//
// Function: EplObduGetDataSize()
//
// Description: function to initialize VarEntry dependened on object type
//
// gets the data size of an object
// for string objects it returnes the string length
//
// Parameters: uiIndex_p = Index
// uiSubIndex_p= Subindex
//
// Return: tEplObdSize
//
// State:
//
//---------------------------------------------------------------------------
tEplObdSize EplObduGetDataSize(unsigned int uiIndex_p, unsigned int uiSubIndex_p)
{
tEplObdSize Size;
Size = EplObduCalGetDataSize(uiIndex_p, uiSubIndex_p);
return Size;
}
//---------------------------------------------------------------------------
//
// Function: EplObduGetNodeId()
//
// Description: function returns nodeid from entry 0x1F93
//
//
// Parameters:
//
// Return: unsigned int = Node Id
//
// State:
//
//---------------------------------------------------------------------------
unsigned int EplObduGetNodeId(void)
{
unsigned int uiNodeId;
uiNodeId = EplObduCalGetNodeId();
return uiNodeId;
}
//---------------------------------------------------------------------------
//
// Function: EplObduSetNodeId()
//
// Description: function sets nodeid in entry 0x1F93
//
//
// Parameters: uiNodeId_p = Node Id to set
// NodeIdType_p= Type on which way the Node Id was set
//
// Return: tEplKernel = Errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduSetNodeId(unsigned int uiNodeId_p, tEplObdNodeIdType NodeIdType_p)
{
tEplKernel Ret;
Ret = EplObduCalSetNodeId(uiNodeId_p, NodeIdType_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduGetAccessType()
//
// Description: Function returns accesstype of the entry
//
// Parameters: uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pAccessTyp_p = pointer to buffer to store accesstyp
//
// Return: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduGetAccessType(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
tEplObdAccess *pAccessTyp_p)
{
tEplObdAccess AccessType;
AccessType =
EplObduCalGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
return AccessType;
}
//---------------------------------------------------------------------------
//
// Function: EplObdReaduEntryToLe()
//
// Description: The function reads an object entry from the byteoder
// of the system to the little endian byteorder for numeric values.
// For other types a normal read will be processed. This is usefull for
// the PDO and SDO module. The application
// can always read the data even if attrib kEplObdAccRead
// is not set. The attrib is only checked up for SDO transfer.
//
// Parameters: EPL_MCO_DECL_INSTANCE_PTR_
// uiIndex_p = Index of the OD entry to read
// uiSubIndex_p = Subindex to read
// pDstData_p = pointer to the buffer for data
// Offset_p = offset in data for read access
// pSize_p = IN: Size of the buffer
// OUT: number of readed Bytes
//
// Return: tEplKernel
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduReadEntryToLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p)
{
tEplKernel Ret;
Ret =
EplObduCalReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p,
pSize_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduWriteEntryFromLe()
//
// Description: Function writes data to an OBD entry from a source with
// little endian byteorder to the od with system specuific
// byteorder. Not numeric values will only by copied. Strings
// are stored with added '\0' character.
//
// Parameters: EPL_MCO_DECL_INSTANCE_PTR_
// uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pSrcData_p = Pointer to the data to write
// Size_p = Size of the data in Byte
//
// Return: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduWriteEntryFromLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p,
tEplObdSize Size_p)
{
tEplKernel Ret;
Ret =
EplObduCalWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p,
Size_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduSearchVarEntry()
//
// Description: gets variable from OD
//
// Parameters: uiIndex_p = index of the var entry to search
// uiSubindex_p = subindex of var entry to search
// ppVarEntry_p = pointer to the pointer to the varentry
//
// Return: tEplKernel
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubindex_p,
tEplObdVarEntry **ppVarEntry_p)
{
tEplKernel Ret;
Ret = EplObduCalSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
// EOF

View File

@ -1,543 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for communication abstraction layer
for the Epl-Obd-Userspace-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObduCal.c,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "user/EplObduCal.h"
#include "kernel/EplObdk.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) && (EPL_OBD_USE_KERNEL != FALSE)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplObduCalWriteEntry()
//
// Description: Function encapsulate access of function EplObdWriteEntry
//
// Parameters: uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pSrcData_p = Pointer to the data to write
// Size_p = Size of the data in Byte
//
// Return: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalWriteEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalReadEntry()
//
// Description: Function encapsulate access of function EplObdReadEntry
//
// Parameters: uiIndex_p = Index oof the OD entry to read
// uiSubIndex_p = Subindex to read
// pDstData_p = pointer to the buffer for data
// Offset_p = offset in data for read access
// pSize_p = IN: Size of the buffer
// OUT: number of readed Bytes
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalReadEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p, tEplObdSize *pSize_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalAccessOdPart()
//
// Description: Function encapsulate access of function EplObdAccessOdPart
//
// Parameters: ObdPart_p = od-part to reset
// Direction_p = directory flag for
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalAccessOdPart(tEplObdPart ObdPart_p, tEplObdDir Direction_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdAccessOdPart(ObdPart_p, Direction_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalDefineVar()
//
// Description: Function encapsulate access of function EplObdDefineVar
//
// Parameters: pEplVarParam_p = varentry
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalDefineVar(tEplVarParam *pVarParam_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdDefineVar(pVarParam_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalGetObjectDataPtr()
//
// Description: Function encapsulate access of function EplObdGetObjectDataPtr
//
// Parameters: uiIndex_p = Index of the entry
// uiSubindex_p = Subindex of the entry
//
// Return: void * = pointer to object data
//
// State:
//
//---------------------------------------------------------------------------
void *EplObduCalGetObjectDataPtr(unsigned int uiIndex_p, unsigned int uiSubIndex_p)
{
void *pData;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
pData = EplObdGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
#else
pData = NULL;
#endif
return pData;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalRegisterUserOd()
//
// Description: Function encapsulate access of function EplObdRegisterUserOd
//
// Parameters: pUserOd_p = pointer to user OD
//
// Return: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
tEplKernel EplObduCalRegisterUserOd(tEplObdEntryPtr pUserOd_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdRegisterUserOd(pUserOd_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
#endif
//---------------------------------------------------------------------------
//
// Function: EplObduCalInitVarEntry()
//
// Description: Function encapsulate access of function EplObdInitVarEntry
//
// Parameters: pVarEntry_p = pointer to var entry structure
// bType_p = object type
// ObdSize_p = size of object data
//
// Returns: none
//
// State:
//
//---------------------------------------------------------------------------
void EplObduCalInitVarEntry(tEplObdVarEntry *pVarEntry_p, u8 bType_p,
tEplObdSize ObdSize_p)
{
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
EplObdInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
#endif
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalGetDataSize()
//
// Description: Function encapsulate access of function EplObdGetDataSize
//
// gets the data size of an object
// for string objects it returnes the string length
//
// Parameters: uiIndex_p = Index
// uiSubIndex_p= Subindex
//
// Return: tEplObdSize
//
// State:
//
//---------------------------------------------------------------------------
tEplObdSize EplObduCalGetDataSize(unsigned int uiIndex_p,
unsigned int uiSubIndex_p)
{
tEplObdSize Size;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Size = EplObdGetDataSize(uiIndex_p, uiSubIndex_p);
#else
Size = 0;
#endif
return Size;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalGetNodeId()
//
// Description: Function encapsulate access of function EplObdGetNodeId
//
//
// Parameters:
//
// Return: unsigned int = Node Id
//
// State:
//
//---------------------------------------------------------------------------
unsigned int EplObduCalGetNodeId(void)
{
unsigned int uiNodeId;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
uiNodeId = EplObdGetNodeId();
#else
uiNodeId = 0;
#endif
return uiNodeId;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalSetNodeId()
//
// Description: Function encapsulate access of function EplObdSetNodeId
//
//
// Parameters: uiNodeId_p = Node Id to set
// NodeIdType_p= Type on which way the Node Id was set
//
// Return: tEplKernel = Errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalSetNodeId(unsigned int uiNodeId_p,
tEplObdNodeIdType NodeIdType_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdSetNodeId(uiNodeId_p, NodeIdType_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalGetAccessType()
//
// Description: Function encapsulate access of function EplObdGetAccessType
//
// Parameters: uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pAccessTyp_p = pointer to buffer to store accesstype
//
// Return: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalGetAccessType(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
tEplObdAccess *pAccessTyp_p)
{
tEplObdAccess AccesType;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
AccesType = EplObdGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
#else
AccesType = 0;
#endif
return AccesType;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalReadEntryToLe()
//
// Description: Function encapsulate access of function EplObdReadEntryToLe
//
// Parameters: uiIndex_p = Index of the OD entry to read
// uiSubIndex_p = Subindex to read
// pDstData_p = pointer to the buffer for data
// Offset_p = offset in data for read access
// pSize_p = IN: Size of the buffer
// OUT: number of readed Bytes
//
// Return: tEplKernel
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalReadEntryToLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalWriteEntryFromLe()
//
// Description: Function encapsulate access of function EplObdWriteEntryFromLe
//
// Parameters: uiIndex_p = Index of the OD entry
// uiSubIndex_p = Subindex of the OD Entry
// pSrcData_p = Pointer to the data to write
// Size_p = Size of the data in Byte
//
// Return: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalWriteEntryFromLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret =
EplObdWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplObduCalSearchVarEntry()
//
// Description: gets variable from OD
//
// Parameters: uiIndex_p = index of the var entry to search
// uiSubindex_p = subindex of var entry to search
// ppVarEntry_p = pointer to the pointer to the varentry
//
// Return: tEplKernel
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplObduCalSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubindex_p,
tEplObdVarEntry **ppVarEntry_p)
{
tEplKernel Ret;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
Ret = EplObdSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
#else
Ret = kEplSuccessful;
#endif
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
// EOF

View File

@ -1,117 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for PDO module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdo.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_PDO_H_
#define _EPL_PDO_H_
#include "EplInc.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// invalid PDO-NodeId
#define EPL_PDO_INVALID_NODE_ID 0xFF
// NodeId for PReq RPDO
#define EPL_PDO_PREQ_NODE_ID 0x00
// NodeId for PRes TPDO
#define EPL_PDO_PRES_NODE_ID 0x00
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct {
void *m_pVar;
u16 m_wOffset; // in Bits
u16 m_wSize; // in Bits
BOOL m_fNumeric; // numeric value -> use AMI functions
} tEplPdoMapping;
typedef struct {
unsigned int m_uiSizeOfStruct;
unsigned int m_uiPdoId;
unsigned int m_uiNodeId;
// 0xFF=invalid, RPDO: 0x00=PReq, localNodeId=PRes, remoteNodeId=PRes
// TPDO: 0x00=PRes, MN: CnNodeId=PReq
BOOL m_fTxRx;
u8 m_bMappingVersion;
unsigned int m_uiMaxMappingEntries; // maximum number of mapping entries, i.e. size of m_aPdoMapping
tEplPdoMapping m_aPdoMapping[1];
} tEplPdoParam;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPL_PDO_H_

View File

@ -1,669 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for kernel PDO module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdok.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#include "kernel/EplPdok.h"
#include "kernel/EplPdokCal.h"
#include "kernel/EplEventk.h"
#include "kernel/EplObdk.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) == 0)
#error 'ERROR: Missing DLLk-Modul!'
#endif
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) == 0)
#error 'ERROR: Missing OBDk-Modul!'
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define EPL_PDOK_OBD_IDX_RX_COMM_PARAM 0x1400
#define EPL_PDOK_OBD_IDX_RX_MAPP_PARAM 0x1600
#define EPL_PDOK_OBD_IDX_TX_COMM_PARAM 0x1800
#define EPL_PDOK_OBD_IDX_TX_MAPP_PARAM 0x1A00
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S EplPdok */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplPdokAddInstance()
//
// Description: add and initialize new instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokAddInstance(void)
{
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokDelInstance()
//
// Description: deletes an instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokDelInstance(void)
{
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCbPdoReceived
//
// Description: This function is called by DLL if PRes or PReq frame was
// received. It posts the frame to the event queue.
// It is called in states NMT_CS_READY_TO_OPERATE and NMT_CS_OPERATIONAL.
// The passed PDO needs not to be valid.
//
// Parameters: pFrameInfo_p = pointer to frame info structure
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCbPdoReceived(tEplFrameInfo * pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkPdok;
Event.m_EventType = kEplEventTypePdoRx;
// limit copied data to size of PDO (because from some CNs the frame is larger than necessary)
Event.m_uiSize = AmiGetWordFromLe(&pFrameInfo_p->m_pFrame->m_Data.m_Pres.m_le_wSize) + 24; // pFrameInfo_p->m_uiFrameSize;
Event.m_pArg = pFrameInfo_p->m_pFrame;
Ret = EplEventkPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCbPdoTransmitted
//
// Description: This function is called by DLL if PRes or PReq frame was
// sent. It posts the pointer to the frame to the event queue.
// It is called in NMT_CS_PRE_OPERATIONAL_2,
// NMT_CS_READY_TO_OPERATE and NMT_CS_OPERATIONAL.
//
// Parameters: pFrameInfo_p = pointer to frame info structure
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCbPdoTransmitted(tEplFrameInfo * pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkPdok;
Event.m_EventType = kEplEventTypePdoTx;
Event.m_uiSize = sizeof(tEplFrameInfo);
Event.m_pArg = pFrameInfo_p;
Ret = EplEventkPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCbSoa
//
// Description: This function is called by DLL if SoA frame was
// received resp. sent. It posts this event to the event queue.
//
// Parameters: pFrameInfo_p = pointer to frame info structure
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCbSoa(tEplFrameInfo * pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
tEplEvent Event;
Event.m_EventSink = kEplEventSinkPdok;
Event.m_EventType = kEplEventTypePdoSoa;
Event.m_uiSize = 0;
Event.m_pArg = NULL;
Ret = EplEventkPost(&Event);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokProcess
//
// Description: This function processes all received and transmitted PDOs.
// This function must not be interrupted by any other task
// except ISRs (like the ethernet driver ISR, which may call
// EplPdokCbFrameReceived() or EplPdokCbFrameTransmitted()).
//
// Parameters: pEvent_p = pointer to event structure
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokProcess(tEplEvent * pEvent_p)
{
tEplKernel Ret = kEplSuccessful;
u16 wPdoSize;
u16 wBitOffset;
u16 wBitSize;
u16 wVarSize;
u64 qwObjectMapping;
u8 bMappSubindex;
u8 bObdSubindex;
u16 wObdMappIndex;
u16 wObdCommIndex;
u16 wPdoId;
u8 bObdData;
u8 bObjectCount;
u8 bFrameData;
BOOL fValid;
tEplObdSize ObdSize;
tEplFrame *pFrame;
tEplFrameInfo *pFrameInfo;
unsigned int uiNodeId;
tEplMsgType MsgType;
// 0xFF=invalid, RPDO: 0x00=PReq, localNodeId=PRes, remoteNodeId=PRes
// TPDO: 0x00=PRes, MN: CnNodeId=PReq
switch (pEvent_p->m_EventType) {
case kEplEventTypePdoRx: // RPDO received
pFrame = (tEplFrame *) pEvent_p->m_pArg;
// check if received RPDO is valid
bFrameData =
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
if ((bFrameData & EPL_FRAME_FLAG1_RD) == 0) { // RPDO invalid
goto Exit;
}
// retrieve EPL message type
MsgType = AmiGetByteFromLe(&pFrame->m_le_bMessageType);
if (MsgType == kEplMsgTypePreq) { // RPDO is PReq frame
uiNodeId = EPL_PDO_PREQ_NODE_ID; // 0x00
} else { // RPDO is PRes frame
// retrieve node ID
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bSrcNodeId);
}
// search for appropriate valid RPDO in OD
wObdMappIndex = EPL_PDOK_OBD_IDX_RX_MAPP_PARAM;
for (wObdCommIndex = EPL_PDOK_OBD_IDX_RX_COMM_PARAM;
wObdCommIndex < (EPL_PDOK_OBD_IDX_RX_COMM_PARAM + 0x00FF);
wObdCommIndex++, wObdMappIndex++) {
ObdSize = 1;
// read node ID from OD
Ret =
EplObdReadEntry(wObdCommIndex, 0x01, &bObdData,
&ObdSize);
if ((Ret == kEplObdIndexNotExist)
|| (Ret == kEplObdSubindexNotExist)
|| (Ret == kEplObdIllegalPart)) { // PDO does not exist; last PDO reached
Ret = kEplSuccessful;
goto Exit;
} else if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
if (bObdData != uiNodeId) { // node ID does not equal - wrong PDO, try next PDO in OD
continue;
}
ObdSize = 1;
// read number of mapped objects from OD; this indicates if the PDO is valid
Ret =
EplObdReadEntry(wObdMappIndex, 0x00, &bObjectCount,
&ObdSize);
if ((Ret == kEplObdIndexNotExist)
|| (Ret == kEplObdSubindexNotExist)
|| (Ret == kEplObdIllegalPart)) { // PDO does not exist; last PDO reached
Ret = kEplSuccessful;
goto Exit;
} else if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
if (bObjectCount == 0) { // PDO in OD not valid, try next PDO in OD
continue;
}
ObdSize = 1;
// check PDO mapping version
Ret =
EplObdReadEntry(wObdCommIndex, 0x02, &bObdData,
&ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
// retrieve PDO version from frame
bFrameData =
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.
m_le_bPdoVersion);
if ((bObdData & EPL_VERSION_MAIN) != (bFrameData & EPL_VERSION_MAIN)) { // PDO versions do not match
// $$$ raise PDO error
// termiate processing of this RPDO
goto Exit;
}
// valid RPDO found
// retrieve PDO size
wPdoSize =
AmiGetWordFromLe(&pFrame->m_Data.m_Pres.m_le_wSize);
// process mapping
for (bMappSubindex = 1; bMappSubindex <= bObjectCount;
bMappSubindex++) {
ObdSize = 8; // u64
// read object mapping from OD
Ret =
EplObdReadEntry(wObdMappIndex,
bMappSubindex,
&qwObjectMapping, &ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// check if object mapping entry is valid, i.e. unequal zero, because "empty" entries are allowed
if (qwObjectMapping == 0) { // invalid entry, continue with next entry
continue;
}
// decode object mapping
wObdCommIndex =
(u16) (qwObjectMapping &
0x000000000000FFFFLL);
bObdSubindex =
(u8) ((qwObjectMapping &
0x0000000000FF0000LL) >> 16);
wBitOffset =
(u16) ((qwObjectMapping &
0x0000FFFF00000000LL) >> 32);
wBitSize =
(u16) ((qwObjectMapping &
0xFFFF000000000000LL) >> 48);
// check if object exceeds PDO size
if (((wBitOffset + wBitSize) >> 3) > wPdoSize) { // wrong object mapping; PDO size is too low
// $$$ raise PDO error
// terminate processing of this RPDO
goto Exit;
}
// copy object from RPDO to process/OD variable
ObdSize = wBitSize >> 3;
Ret =
EplObdWriteEntryFromLe(wObdCommIndex,
bObdSubindex,
&pFrame->m_Data.
m_Pres.
m_le_abPayload[(wBitOffset >> 3)], ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
}
// processing finished successfully
goto Exit;
}
break;
case kEplEventTypePdoTx: // TPDO transmitted
pFrameInfo = (tEplFrameInfo *) pEvent_p->m_pArg;
pFrame = pFrameInfo->m_pFrame;
// set TPDO invalid, so that only fully processed TPDOs are sent as valid
bFrameData =
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
AmiSetByteToLe(&pFrame->m_Data.m_Pres.m_le_bFlag1,
(bFrameData & ~EPL_FRAME_FLAG1_RD));
// retrieve EPL message type
MsgType = AmiGetByteFromLe(&pFrame->m_le_bMessageType);
if (MsgType == kEplMsgTypePres) { // TPDO is PRes frame
uiNodeId = EPL_PDO_PRES_NODE_ID; // 0x00
} else { // TPDO is PReq frame
// retrieve node ID
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bDstNodeId);
}
// search for appropriate valid TPDO in OD
wObdMappIndex = EPL_PDOK_OBD_IDX_TX_MAPP_PARAM;
wObdCommIndex = EPL_PDOK_OBD_IDX_TX_COMM_PARAM;
for (wPdoId = 0;; wPdoId++, wObdCommIndex++, wObdMappIndex++) {
ObdSize = 1;
// read node ID from OD
Ret =
EplObdReadEntry(wObdCommIndex, 0x01, &bObdData,
&ObdSize);
if ((Ret == kEplObdIndexNotExist)
|| (Ret == kEplObdSubindexNotExist)
|| (Ret == kEplObdIllegalPart)) { // PDO does not exist; last PDO reached
Ret = kEplSuccessful;
goto Exit;
} else if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
if (bObdData != uiNodeId) { // node ID does not equal - wrong PDO, try next PDO in OD
continue;
}
ObdSize = 1;
// read number of mapped objects from OD; this indicates if the PDO is valid
Ret =
EplObdReadEntry(wObdMappIndex, 0x00, &bObjectCount,
&ObdSize);
if ((Ret == kEplObdIndexNotExist)
|| (Ret == kEplObdSubindexNotExist)
|| (Ret == kEplObdIllegalPart)) { // PDO does not exist; last PDO reached
Ret = kEplSuccessful;
goto Exit;
} else if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
if (bObjectCount == 0) { // PDO in OD not valid, try next PDO in OD
continue;
}
// valid TPDO found
ObdSize = 1;
// get PDO mapping version from OD
Ret =
EplObdReadEntry(wObdCommIndex, 0x02, &bObdData,
&ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// entry read successfully
// set PDO version in frame
AmiSetByteToLe(&pFrame->m_Data.m_Pres.m_le_bPdoVersion,
bObdData);
// calculate PDO size
wPdoSize = 0;
// process mapping
for (bMappSubindex = 1; bMappSubindex <= bObjectCount;
bMappSubindex++) {
ObdSize = 8; // u64
// read object mapping from OD
Ret =
EplObdReadEntry(wObdMappIndex,
bMappSubindex,
&qwObjectMapping, &ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
// check if object mapping entry is valid, i.e. unequal zero, because "empty" entries are allowed
if (qwObjectMapping == 0) { // invalid entry, continue with next entry
continue;
}
// decode object mapping
wObdCommIndex =
(u16) (qwObjectMapping &
0x000000000000FFFFLL);
bObdSubindex =
(u8) ((qwObjectMapping &
0x0000000000FF0000LL) >> 16);
wBitOffset =
(u16) ((qwObjectMapping &
0x0000FFFF00000000LL) >> 32);
wBitSize =
(u16) ((qwObjectMapping &
0xFFFF000000000000LL) >> 48);
// calculate max PDO size
ObdSize = wBitSize >> 3;
wVarSize = (wBitOffset >> 3) + (u16) ObdSize;
if ((unsigned int)(wVarSize + 24) > pFrameInfo->m_uiFrameSize) { // TPDO is too short
// $$$ raise PDO error, set Ret
goto Exit;
}
if (wVarSize > wPdoSize) { // memorize new PDO size
wPdoSize = wVarSize;
}
// copy object from process/OD variable to TPDO
Ret =
EplObdReadEntryToLe(wObdCommIndex,
bObdSubindex,
&pFrame->m_Data.m_Pres.
m_le_abPayload[(wBitOffset >> 3)], &ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
goto Exit;
}
}
// set PDO size in frame
AmiSetWordToLe(&pFrame->m_Data.m_Pres.m_le_wSize,
wPdoSize);
Ret = EplPdokCalAreTpdosValid(&fValid);
if (fValid != FALSE) {
// set TPDO valid
bFrameData =
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.
m_le_bFlag1);
AmiSetByteToLe(&pFrame->m_Data.m_Pres.
m_le_bFlag1,
(bFrameData |
EPL_FRAME_FLAG1_RD));
}
// processing finished successfully
goto Exit;
}
break;
case kEplEventTypePdoSoa: // SoA received
// invalidate TPDOs
Ret = EplPdokCalSetTpdosValid(FALSE);
break;
default:
{
ASSERTMSG(FALSE,
"EplPdokProcess(): unhandled event type!\n");
}
}
Exit:
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
// EOF

View File

@ -1,266 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for kernel PDO Communication Abstraction Layer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdokCal.c,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/27 d.k.: start of the implementation, version 1.00
****************************************************************************/
#include "kernel/EplPdokCal.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S EplPdokCal */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
BOOL m_fTpdosValid;
} tEplPdokCalInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
static tEplPdokCalInstance EplPdokCalInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplPdokCalAddInstance()
//
// Description: add and initialize new instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCalAddInstance(void)
{
EPL_MEMSET(&EplPdokCalInstance_g, 0, sizeof(EplPdokCalInstance_g));
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCalDelInstance()
//
// Description: deletes an instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCalDelInstance(void)
{
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCalSetTpdosValid()
//
// Description: This function sets the validity flag for TPDOs to the
// specified value.
//
// Parameters: fValid_p = validity flag
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCalSetTpdosValid(BOOL fValid_p)
{
tEplKernel Ret = kEplSuccessful;
EplPdokCalInstance_g.m_fTpdosValid = fValid_p;
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplPdokCalAreTpdosValid()
//
// Description: This function returns the validity flag for TPDOs.
//
// Parameters: pfValid_p = OUT: validity flag
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdokCalAreTpdosValid(BOOL * pfValid_p)
{
tEplKernel Ret = kEplSuccessful;
*pfValid_p = EplPdokCalInstance_g.m_fTpdosValid;
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#endif
// EOF

View File

@ -1,565 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for user PDO module
Currently, this module just implements a OD callback function
to check if the PDO configuration is valid.
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdou.c,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#include "EplInc.h"
//#include "user/EplPdouCal.h"
#include "user/EplObdu.h"
#include "user/EplPdou.h"
#include "EplSdoAc.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOU)) != 0)
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) == 0) && (EPL_OBD_USE_KERNEL == FALSE)
#error "EPL PDOu module needs EPL module OBDU or OBDK!"
#endif
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define EPL_PDOU_OBD_IDX_RX_COMM_PARAM 0x1400
#define EPL_PDOU_OBD_IDX_RX_MAPP_PARAM 0x1600
#define EPL_PDOU_OBD_IDX_TX_COMM_PARAM 0x1800
#define EPL_PDOU_OBD_IDX_TX_MAPP_PARAM 0x1A00
#define EPL_PDOU_OBD_IDX_MAPP_PARAM 0x0200
#define EPL_PDOU_OBD_IDX_MASK 0xFF00
#define EPL_PDOU_PDO_ID_MASK 0x00FF
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S EplPdou */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam *pParam_p,
unsigned int uiIndex_p);
static void EplPdouDecodeObjectMapping(u64 qwObjectMapping_p,
unsigned int *puiIndex_p,
unsigned int *puiSubIndex_p,
unsigned int *puiBitOffset_p,
unsigned int *puiBitSize_p);
static tEplKernel EplPdouCheckObjectMapping(u64 qwObjectMapping_p,
tEplObdAccess AccessType_p,
u32 * pdwAbortCode_p,
unsigned int *puiPdoSize_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplPdouAddInstance()
//
// Description: add and initialize new instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdouAddInstance(void)
{
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdouDelInstance()
//
// Description: deletes an instance of EPL stack
//
// Parameters: none
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdouDelInstance(void)
{
return kEplSuccessful;
}
//---------------------------------------------------------------------------
//
// Function: EplPdouCbObdAccess
//
// Description: callback function for OD accesses
//
// Parameters: pParam_p = OBD parameter
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplPdouCbObdAccess(tEplObdCbParam *pParam_p)
{
tEplKernel Ret = kEplSuccessful;
unsigned int uiPdoId;
unsigned int uiIndexType;
tEplObdSize ObdSize;
u8 bObjectCount;
u64 qwObjectMapping;
tEplObdAccess AccessType;
u8 bMappSubindex;
unsigned int uiCurPdoSize;
u16 wMaxPdoSize;
unsigned int uiSubIndex;
// fetch PDO ID
uiPdoId = pParam_p->m_uiIndex & EPL_PDOU_PDO_ID_MASK;
// fetch object index type
uiIndexType = pParam_p->m_uiIndex & EPL_PDOU_OBD_IDX_MASK;
if (pParam_p->m_ObdEvent != kEplObdEvPreWrite) { // read accesses, post write events etc. are OK
pParam_p->m_dwAbortCode = 0;
goto Exit;
}
// check index type
switch (uiIndexType) {
case EPL_PDOU_OBD_IDX_RX_COMM_PARAM:
// RPDO communication parameter accessed
case EPL_PDOU_OBD_IDX_TX_COMM_PARAM:
{ // TPDO communication parameter accessed
Ret = EplPdouCheckPdoValidity(pParam_p,
(EPL_PDOU_OBD_IDX_MAPP_PARAM
| pParam_p->m_uiIndex));
if (Ret != kEplSuccessful) { // PDO is valid or does not exist
goto Exit;
}
goto Exit;
}
case EPL_PDOU_OBD_IDX_RX_MAPP_PARAM:
{ // RPDO mapping parameter accessed
AccessType = kEplObdAccWrite;
break;
}
case EPL_PDOU_OBD_IDX_TX_MAPP_PARAM:
{ // TPDO mapping parameter accessed
AccessType = kEplObdAccRead;
break;
}
default:
{ // this callback function is only for
// PDO mapping and communication parameters
pParam_p->m_dwAbortCode = EPL_SDOAC_GENERAL_ERROR;
goto Exit;
}
}
// RPDO and TPDO mapping parameter accessed
if (pParam_p->m_uiSubIndex == 0) { // object mapping count accessed
// PDO is enabled or disabled
bObjectCount = *((u8 *) pParam_p->m_pArg);
if (bObjectCount == 0) { // PDO shall be disabled
// that is always possible
goto Exit;
}
// PDO shall be enabled
// it should have been disabled for this operation
Ret = EplPdouCheckPdoValidity(pParam_p, pParam_p->m_uiIndex);
if (Ret != kEplSuccessful) { // PDO is valid or does not exist
goto Exit;
}
if (AccessType == kEplObdAccWrite) {
uiSubIndex = 0x04; // PReqActPayloadLimit_U16
} else {
uiSubIndex = 0x05; // PResActPayloadLimit_U16
}
// fetch maximum PDO size from Object 1F98h: NMT_CycleTiming_REC
ObdSize = sizeof(wMaxPdoSize);
Ret =
EplObduReadEntry(0x1F98, uiSubIndex, &wMaxPdoSize,
&ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
pParam_p->m_dwAbortCode = EPL_SDOAC_GENERAL_ERROR;
goto Exit;
}
// check all objectmappings
for (bMappSubindex = 1; bMappSubindex <= bObjectCount;
bMappSubindex++) {
// read object mapping from OD
ObdSize = sizeof(qwObjectMapping); // u64
Ret = EplObduReadEntry(pParam_p->m_uiIndex,
bMappSubindex, &qwObjectMapping,
&ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
pParam_p->m_dwAbortCode =
EPL_SDOAC_GENERAL_ERROR;
goto Exit;
}
// check object mapping
Ret = EplPdouCheckObjectMapping(qwObjectMapping,
AccessType,
&pParam_p->
m_dwAbortCode,
&uiCurPdoSize);
if (Ret != kEplSuccessful) { // illegal object mapping
goto Exit;
}
if (uiCurPdoSize > wMaxPdoSize) { // mapping exceeds object size
pParam_p->m_dwAbortCode =
EPL_SDOAC_GENERAL_ERROR;
Ret = kEplPdoVarNotFound;
}
}
} else { // ObjectMapping
Ret = EplPdouCheckPdoValidity(pParam_p, pParam_p->m_uiIndex);
if (Ret != kEplSuccessful) { // PDO is valid or does not exist
goto Exit;
}
// check existence of object and validity of object length
qwObjectMapping = *((u64 *) pParam_p->m_pArg);
Ret = EplPdouCheckObjectMapping(qwObjectMapping,
AccessType,
&pParam_p->m_dwAbortCode,
&uiCurPdoSize);
}
Exit:
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplPdouCheckPdoValidity
//
// Description: check if PDO is valid
//
// Parameters: pParam_p = OBD parameter
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam *pParam_p,
unsigned int uiIndex_p)
{
tEplKernel Ret = kEplSuccessful;
tEplObdSize ObdSize;
u8 bObjectCount;
ObdSize = 1;
// read number of mapped objects from OD; this indicates if the PDO is valid
Ret = EplObduReadEntry(uiIndex_p, 0x00, &bObjectCount, &ObdSize);
if (Ret != kEplSuccessful) { // other fatal error occured
pParam_p->m_dwAbortCode =
EPL_SDOAC_GEN_INTERNAL_INCOMPATIBILITY;
goto Exit;
}
// entry read successfully
if (bObjectCount != 0) { // PDO in OD is still valid
pParam_p->m_dwAbortCode = EPL_SDOAC_GEN_PARAM_INCOMPATIBILITY;
Ret = kEplPdoNotExist;
goto Exit;
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplPdouDecodeObjectMapping
//
// Description: decodes the given object mapping entry into index, subindex,
// bit offset and bit size.
//
// Parameters: qwObjectMapping_p = object mapping entry
// puiIndex_p = [OUT] pointer to object index
// puiSubIndex_p = [OUT] pointer to subindex
// puiBitOffset_p = [OUT] pointer to bit offset
// puiBitSize_p = [OUT] pointer to bit size
//
// Returns: (void)
//
// State:
//
//---------------------------------------------------------------------------
static void EplPdouDecodeObjectMapping(u64 qwObjectMapping_p,
unsigned int *puiIndex_p,
unsigned int *puiSubIndex_p,
unsigned int *puiBitOffset_p,
unsigned int *puiBitSize_p)
{
*puiIndex_p = (unsigned int)
(qwObjectMapping_p & 0x000000000000FFFFLL);
*puiSubIndex_p = (unsigned int)
((qwObjectMapping_p & 0x0000000000FF0000LL) >> 16);
*puiBitOffset_p = (unsigned int)
((qwObjectMapping_p & 0x0000FFFF00000000LL) >> 32);
*puiBitSize_p = (unsigned int)
((qwObjectMapping_p & 0xFFFF000000000000LL) >> 48);
}
//---------------------------------------------------------------------------
//
// Function: EplPdouCheckObjectMapping
//
// Description: checks the given object mapping entry.
//
// Parameters: qwObjectMapping_p = object mapping entry
// AccessType_p = access type to mapped object:
// write = RPDO and read = TPDO
// puiPdoSize_p = [OUT] pointer to covered PDO size
// (offset + size) in byte;
// 0 if mapping failed
// pdwAbortCode_p = [OUT] pointer to SDO abort code;
// 0 if mapping is possible
//
// Returns: tEplKernel = error code
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplPdouCheckObjectMapping(u64 qwObjectMapping_p,
tEplObdAccess AccessType_p,
u32 * pdwAbortCode_p,
unsigned int *puiPdoSize_p)
{
tEplKernel Ret = kEplSuccessful;
tEplObdSize ObdSize;
unsigned int uiIndex;
unsigned int uiSubIndex;
unsigned int uiBitOffset;
unsigned int uiBitSize;
tEplObdAccess AccessType;
BOOL fNumerical;
if (qwObjectMapping_p == 0) { // discard zero value
*puiPdoSize_p = 0;
goto Exit;
}
// decode object mapping
EplPdouDecodeObjectMapping(qwObjectMapping_p,
&uiIndex,
&uiSubIndex, &uiBitOffset, &uiBitSize);
if ((uiBitOffset & 0x7) != 0x0) { // bit mapping is not supported
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
Ret = kEplPdoGranularityMismatch;
goto Exit;
}
if ((uiBitSize & 0x7) != 0x0) { // bit mapping is not supported
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
Ret = kEplPdoGranularityMismatch;
goto Exit;
}
// check access type
Ret = EplObduGetAccessType(uiIndex, uiSubIndex, &AccessType);
if (Ret != kEplSuccessful) { // entry doesn't exist
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_EXIST;
goto Exit;
}
if ((AccessType & kEplObdAccPdo) == 0) { // object is not mappable
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
Ret = kEplPdoVarNotFound;
goto Exit;
}
if ((AccessType & AccessType_p) == 0) { // object is not writeable (RPDO) or readable (TPDO) respectively
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
Ret = kEplPdoVarNotFound;
goto Exit;
}
ObdSize = EplObduGetDataSize(uiIndex, uiSubIndex);
if (ObdSize < (uiBitSize >> 3)) { // object does not exist or has smaller size
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
Ret = kEplPdoVarNotFound;
}
Ret = EplObduIsNumerical(uiIndex, uiSubIndex, &fNumerical);
if (Ret != kEplSuccessful) { // entry doesn't exist
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_EXIST;
goto Exit;
}
if ((fNumerical != FALSE)
&& ((uiBitSize >> 3) != ObdSize)) {
// object is numerical,
// therefor size has to fit, but it does not.
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
Ret = kEplPdoVarNotFound;
goto Exit;
}
// calucaled needed PDO size
*puiPdoSize_p = (uiBitOffset >> 3) + (uiBitSize >> 3);
Exit:
return Ret;
}
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOU)) != 0)
// EOF

View File

@ -1,241 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for api function of the sdo module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdo.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/26 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "EplFrame.h"
#include "EplSdoAc.h"
#ifndef _EPLSDO_H_
#define _EPLSDO_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// global defines
#ifndef EPL_SDO_MAX_PAYLOAD
#define EPL_SDO_MAX_PAYLOAD 256
#endif
// handle between Protocol Abstraction Layer and asynchronous SDO Sequence Layer
#define EPL_SDO_UDP_HANDLE 0x8000
#define EPL_SDO_ASND_HANDLE 0x4000
#define EPL_SDO_ASY_HANDLE_MASK 0xC000
#define EPL_SDO_ASY_INVALID_HDL 0x3FFF
// handle between SDO Sequence Layer and sdo command layer
#define EPL_SDO_ASY_HANDLE 0x8000
#define EPL_SDO_PDO_HANDLE 0x4000
#define EPL_SDO_SEQ_HANDLE_MASK 0xC000
#define EPL_SDO_SEQ_INVALID_HDL 0x3FFF
#define EPL_ASND_HEADER_SIZE 4
//#define EPL_SEQ_HEADER_SIZE 4
#define EPL_ETHERNET_HEADER_SIZE 14
#define EPL_SEQ_NUM_MASK 0xFC
// size for send buffer and history
#define EPL_MAX_SDO_FRAME_SIZE EPL_C_IP_MIN_MTU
// size for receive frame
// -> needed because SND-Kit sends up to 1518 Byte
// without Sdo-Command: Maximum Segment Size
#define EPL_MAX_SDO_REC_FRAME_SIZE EPL_C_IP_MAX_MTU
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// handle between Protocol Abstraction Layer and asynchronuus SDO Sequence Layer
typedef unsigned int tEplSdoConHdl;
// callback function pointer for Protocol Abstraction Layer to call
// asynchronuus SDO Sequence Layer
typedef tEplKernel(*tEplSequLayerReceiveCb) (tEplSdoConHdl ConHdl_p,
tEplAsySdoSeq *pSdoSeqData_p,
unsigned int uiDataSize_p);
// handle between asynchronuus SDO Sequence Layer and SDO Command layer
typedef unsigned int tEplSdoSeqConHdl;
// callback function pointer for asynchronuus SDO Sequence Layer to call
// SDO Command layer for received data
typedef tEplKernel(* tEplSdoComReceiveCb) (tEplSdoSeqConHdl SdoSeqConHdl_p,
tEplAsySdoCom *pAsySdoCom_p,
unsigned int uiDataSize_p);
// status of connection
typedef enum {
kAsySdoConStateConnected = 0x00,
kAsySdoConStateInitError = 0x01,
kAsySdoConStateConClosed = 0x02,
kAsySdoConStateAckReceived = 0x03,
kAsySdoConStateFrameSended = 0x04,
kAsySdoConStateTimeout = 0x05
} tEplAsySdoConState;
// callback function pointer for asynchronuus SDO Sequence Layer to call
// SDO Command layer for connection status
typedef tEplKernel(* tEplSdoComConCb) (tEplSdoSeqConHdl SdoSeqConHdl_p,
tEplAsySdoConState AsySdoConState_p);
// handle between SDO Command layer and application
typedef unsigned int tEplSdoComConHdl;
// status of connection
typedef enum {
kEplSdoComTransferNotActive = 0x00,
kEplSdoComTransferRunning = 0x01,
kEplSdoComTransferTxAborted = 0x02,
kEplSdoComTransferRxAborted = 0x03,
kEplSdoComTransferFinished = 0x04,
kEplSdoComTransferLowerLayerAbort = 0x05
} tEplSdoComConState;
// SDO Services and Command-Ids from DS 1.0.0 p.152
typedef enum {
kEplSdoServiceNIL = 0x00,
kEplSdoServiceWriteByIndex = 0x01,
kEplSdoServiceReadByIndex = 0x02
//--------------------------------
// the following services are optional and
// not supported now
/*
kEplSdoServiceWriteAllByIndex = 0x03,
kEplSdoServiceReadAllByIndex = 0x04,
kEplSdoServiceWriteByName = 0x05,
kEplSdoServiceReadByName = 0x06,
kEplSdoServiceFileWrite = 0x20,
kEplSdoServiceFileRead = 0x21,
kEplSdoServiceWriteMultiByIndex = 0x31,
kEplSdoServiceReadMultiByIndex = 0x32,
kEplSdoServiceMaxSegSize = 0x70
// 0x80 - 0xFF manufacturer specific
*/
} tEplSdoServiceType;
// describes if read or write access
typedef enum {
kEplSdoAccessTypeRead = 0x00,
kEplSdoAccessTypeWrite = 0x01
} tEplSdoAccessType;
typedef enum {
kEplSdoTypeAuto = 0x00,
kEplSdoTypeUdp = 0x01,
kEplSdoTypeAsnd = 0x02,
kEplSdoTypePdo = 0x03
} tEplSdoType;
typedef enum {
kEplSdoTransAuto = 0x00,
kEplSdoTransExpedited = 0x01,
kEplSdoTransSegmented = 0x02
} tEplSdoTransType;
// structure to inform application about finish of SDO transfer
typedef struct {
tEplSdoComConHdl m_SdoComConHdl;
tEplSdoComConState m_SdoComConState;
u32 m_dwAbortCode;
tEplSdoAccessType m_SdoAccessType;
unsigned int m_uiNodeId; // NodeId of the target
unsigned int m_uiTargetIndex; // index which was accessed
unsigned int m_uiTargetSubIndex; // subindex which was accessed
unsigned int m_uiTransferredByte; // number of bytes transferred
void *m_pUserArg; // user definable argument pointer
} tEplSdoComFinished;
// callback function pointer to inform application about connection
typedef tEplKernel(* tEplSdoFinishedCb) (tEplSdoComFinished *pSdoComFinished_p);
// structure to init SDO transfer to Read or Write by Index
typedef struct {
tEplSdoComConHdl m_SdoComConHdl;
unsigned int m_uiIndex;
unsigned int m_uiSubindex;
void *m_pData;
unsigned int m_uiDataSize;
unsigned int m_uiTimeout; // not used in this version
tEplSdoAccessType m_SdoAccessType;
tEplSdoFinishedCb m_pfnSdoFinishedCb;
void *m_pUserArg; // user definable argument pointer
} tEplSdoComTransParamByIndex;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPLSDO_H_

View File

@ -1,111 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: definitions for SDO Abort codes
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdoAc.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
2006/06/30 k.t.: first implementation
****************************************************************************/
#ifndef _EPLSDOAC_H_
#define _EPLSDOAC_H_
// =========================================================================
// SDO abort codes
// =========================================================================
#define EPL_SDOAC_TIME_OUT 0x05040000L
#define EPL_SDOAC_UNKNOWN_COMMAND_SPECIFIER 0x05040001L
#define EPL_SDOAC_INVALID_BLOCK_SIZE 0x05040002L
#define EPL_SDOAC_INVALID_SEQUENCE_NUMBER 0x05040003L
#define EPL_SDOAC_OUT_OF_MEMORY 0x05040005L
#define EPL_SDOAC_UNSUPPORTED_ACCESS 0x06010000L
#define EPL_SDOAC_READ_TO_WRITE_ONLY_OBJ 0x06010001L
#define EPL_SDOAC_WRITE_TO_READ_ONLY_OBJ 0x06010002L
#define EPL_SDOAC_OBJECT_NOT_EXIST 0x06020000L
#define EPL_SDOAC_OBJECT_NOT_MAPPABLE 0x06040041L
#define EPL_SDOAC_PDO_LENGTH_EXCEEDED 0x06040042L
#define EPL_SDOAC_GEN_PARAM_INCOMPATIBILITY 0x06040043L
#define EPL_SDOAC_INVALID_HEARTBEAT_DEC 0x06040044L
#define EPL_SDOAC_GEN_INTERNAL_INCOMPATIBILITY 0x06040047L
#define EPL_SDOAC_ACCESS_FAILED_DUE_HW_ERROR 0x06060000L
#define EPL_SDOAC_DATA_TYPE_LENGTH_NOT_MATCH 0x06070010L
#define EPL_SDOAC_DATA_TYPE_LENGTH_TOO_HIGH 0x06070012L
#define EPL_SDOAC_DATA_TYPE_LENGTH_TOO_LOW 0x06070013L
#define EPL_SDOAC_SUB_INDEX_NOT_EXIST 0x06090011L
#define EPL_SDOAC_VALUE_RANGE_EXCEEDED 0x06090030L
#define EPL_SDOAC_VALUE_RANGE_TOO_HIGH 0x06090031L
#define EPL_SDOAC_VALUE_RANGE_TOO_LOW 0x06090032L
#define EPL_SDOAC_MAX_VALUE_LESS_MIN_VALUE 0x06090036L
#define EPL_SDOAC_GENERAL_ERROR 0x08000000L
#define EPL_SDOAC_DATA_NOT_TRANSF_OR_STORED 0x08000020L
#define EPL_SDOAC_DATA_NOT_TRANSF_DUE_LOCAL_CONTROL 0x08000021L
#define EPL_SDOAC_DATA_NOT_TRANSF_DUE_DEVICE_STATE 0x08000022L
#define EPL_SDOAC_OBJECT_DICTIONARY_NOT_EXIST 0x08000023L
#define EPL_SDOAC_CONFIG_DATA_EMPTY 0x08000024L
#endif // _EPLSDOAC_H_
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

View File

@ -1,483 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for SDO/Asnd-Protocolabstractionlayer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdoAsndu.c,v $
$Author: D.Krueger $
$Revision: 1.7 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/07/07 k.t.: start of the implementation
****************************************************************************/
#include "user/EplSdoAsndu.h"
#include "user/EplDlluCal.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef EPL_SDO_MAX_CONNECTION_ASND
#define EPL_SDO_MAX_CONNECTION_ASND 5
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
// instance table
typedef struct {
unsigned int m_auiSdoAsndConnection[EPL_SDO_MAX_CONNECTION_ASND];
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
} tEplSdoAsndInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplSdoAsndInstance SdoAsndInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduCb(tEplFrameInfo *pFrameInfo_p);
/***************************************************************************/
/* */
/* */
/* C L A S S <EPL SDO-Asnd Protocolabstraction layer> */
/* */
/* */
/***************************************************************************/
//
// Description: EPL SDO-Asnd Protocolabstraction layer
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduInit
//
// Description: init first instance of the module
//
//
//
// Parameters: pReceiveCb_p = functionpointer to Sdo-Sequence layer
// callback-function
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduInit(tEplSequLayerReceiveCb fpReceiveCb_p)
{
tEplKernel Ret;
Ret = EplSdoAsnduAddInstance(fpReceiveCb_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduAddInstance
//
// Description: init additional instance of the module
//
//
//
// Parameters: pReceiveCb_p = functionpointer to Sdo-Sequence layer
// callback-function
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// init control structure
EPL_MEMSET(&SdoAsndInstance_g, 0x00, sizeof(SdoAsndInstance_g));
// save pointer to callback-function
if (fpReceiveCb_p != NULL) {
SdoAsndInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
} else {
Ret = kEplSdoUdpMissCb;
}
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
EplSdoAsnduCb, kEplDllAsndFilterLocal);
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduDelInstance
//
// Description: del instance of the module
// del socket and del Listen-Thread
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
// deregister callback function from DLL
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
NULL, kEplDllAsndFilterNone);
#endif
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduInitCon
//
// Description: init a new connect
//
//
//
// Parameters: pSdoConHandle_p = pointer for the new connection handle
// uiTargetNodeId_p = NodeId of the target node
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduInitCon(tEplSdoConHdl *pSdoConHandle_p,
unsigned int uiTargetNodeId_p)
{
tEplKernel Ret;
unsigned int uiCount;
unsigned int uiFreeCon;
unsigned int *puiConnection;
Ret = kEplSuccessful;
if ((uiTargetNodeId_p == EPL_C_ADR_INVALID)
|| (uiTargetNodeId_p >= EPL_C_ADR_BROADCAST)) {
Ret = kEplSdoAsndInvalidNodeId;
goto Exit;
}
// get free entry in control structure
uiCount = 0;
uiFreeCon = EPL_SDO_MAX_CONNECTION_ASND;
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[0];
while (uiCount < EPL_SDO_MAX_CONNECTION_ASND) {
if (*puiConnection == uiTargetNodeId_p) { // existing connection to target node found
// save handle for higher layer
*pSdoConHandle_p = (uiCount | EPL_SDO_ASND_HANDLE);
goto Exit;
} else if (*puiConnection == 0) { // free entry-> save target nodeId
uiFreeCon = uiCount;
}
uiCount++;
puiConnection++;
}
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_ASND) {
// no free connection
Ret = kEplSdoAsndNoFreeHandle;
} else {
puiConnection =
&SdoAsndInstance_g.m_auiSdoAsndConnection[uiFreeCon];
*puiConnection = uiTargetNodeId_p;
// save handle for higher layer
*pSdoConHandle_p = (uiFreeCon | EPL_SDO_ASND_HANDLE);
goto Exit;
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduSendData
//
// Description: send data using exisiting connection
//
//
//
// Parameters: SdoConHandle_p = connection handle
// pSrcData_p = pointer to data
// dwDataSize_p = number of databyte
// -> without asnd-header!!!
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduSendData(tEplSdoConHdl SdoConHandle_p,
tEplFrame *pSrcData_p,
u32 dwDataSize_p)
{
tEplKernel Ret;
unsigned int uiArray;
tEplFrameInfo FrameInfo;
Ret = kEplSuccessful;
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
if (uiArray > EPL_SDO_MAX_CONNECTION_ASND) {
Ret = kEplSdoAsndInvalidHandle;
goto Exit;
}
// fillout Asnd header
// own node id not needed -> filled by DLL
// set message type
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, (u8) kEplMsgTypeAsnd); // ASnd == 0x06
// target node id
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId,
(u8) SdoAsndInstance_g.
m_auiSdoAsndConnection[uiArray]);
// set source-nodeid (filled by DLL 0)
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
// calc size
dwDataSize_p += EPL_ASND_HEADER_SIZE;
// send function of DLL
FrameInfo.m_uiFrameSize = dwDataSize_p;
FrameInfo.m_pFrame = pSrcData_p;
EPL_MEMSET(&FrameInfo.m_NetTime, 0x00, sizeof(tEplNetTime));
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
Ret = EplDlluCalAsyncSend(&FrameInfo, kEplDllAsyncReqPrioGeneric);
#endif
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduDelCon
//
// Description: delete connection from intern structure
//
//
//
// Parameters: SdoConHandle_p = connection handle
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduDelCon(tEplSdoConHdl SdoConHandle_p)
{
tEplKernel Ret;
unsigned int uiArray;
Ret = kEplSuccessful;
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
// check parameter
if (uiArray > EPL_SDO_MAX_CONNECTION_ASND) {
Ret = kEplSdoAsndInvalidHandle;
goto Exit;
}
// set target nodeId to 0
SdoAsndInstance_g.m_auiSdoAsndConnection[uiArray] = 0;
Exit:
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplSdoAsnduCb
//
// Description: callback function for SDO ASnd frames
//
//
//
// Parameters: pFrameInfo_p = Frame with SDO payload
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoAsnduCb(tEplFrameInfo *pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
unsigned int uiCount;
unsigned int *puiConnection;
unsigned int uiNodeId;
unsigned int uiFreeEntry = 0xFFFF;
tEplSdoConHdl SdoConHdl;
tEplFrame *pFrame;
pFrame = pFrameInfo_p->m_pFrame;
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bSrcNodeId);
// search corresponding entry in control structure
uiCount = 0;
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[0];
while (uiCount < EPL_SDO_MAX_CONNECTION_ASND) {
if (uiNodeId == *puiConnection) {
break;
} else if ((*puiConnection == 0)
&& (uiFreeEntry == 0xFFFF)) { // free entry
uiFreeEntry = uiCount;
}
uiCount++;
puiConnection++;
}
if (uiCount == EPL_SDO_MAX_CONNECTION_ASND) {
if (uiFreeEntry != 0xFFFF) {
puiConnection =
&SdoAsndInstance_g.
m_auiSdoAsndConnection[uiFreeEntry];
*puiConnection = uiNodeId;
uiCount = uiFreeEntry;
} else {
EPL_DBGLVL_SDO_TRACE0
("EplSdoAsnduCb(): no free handle\n");
goto Exit;
}
}
// if (uiNodeId == *puiConnection)
{ // entry found or created
SdoConHdl = (uiCount | EPL_SDO_ASND_HANDLE);
SdoAsndInstance_g.m_fpSdoAsySeqCb(SdoConHdl,
&pFrame->m_Data.m_Asnd.
m_Payload.m_SdoSequenceFrame,
(pFrameInfo_p->m_uiFrameSize -
18));
}
Exit:
return Ret;
}
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
// EOF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,650 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for SDO/UDP-Protocolabstractionlayer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdoUdpu.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/26 k.t.: start of the implementation
****************************************************************************/
#include "user/EplSdoUdpu.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
#include "SocketLinuxKernel.h"
#include <linux/completion.h>
#include <linux/sched.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef EPL_SDO_MAX_CONNECTION_UDP
#define EPL_SDO_MAX_CONNECTION_UDP 5
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
unsigned long m_ulIpAddr; // in network byte order
unsigned int m_uiPort; // in network byte order
} tEplSdoUdpCon;
// instance table
typedef struct {
tEplSdoUdpCon m_aSdoAbsUdpConnection[EPL_SDO_MAX_CONNECTION_UDP];
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
SOCKET m_UdpSocket;
struct completion m_CompletionUdpThread;
int m_ThreadHandle;
int m_iTerminateThread;
} tEplSdoUdpInstance;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static tEplSdoUdpInstance SdoUdpInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static int EplSdoUdpThread(void *pArg_p);
/***************************************************************************/
/* */
/* */
/* C L A S S <EPL-SDO-UDP-Layer> */
/* */
/* */
/***************************************************************************/
//
// Description: Protocolabstraction layer for UDP
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuInit
//
// Description: init first instance of the module
//
//
//
// Parameters: pReceiveCb_p = functionpointer to Sdo-Sequence layer
// callback-function
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuInit(tEplSequLayerReceiveCb fpReceiveCb_p)
{
tEplKernel Ret;
Ret = EplSdoUdpuAddInstance(fpReceiveCb_p);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuAddInstance
//
// Description: init additional instance of the module
// înit socket and start Listen-Thread
//
//
//
// Parameters: pReceiveCb_p = functionpointer to Sdo-Sequence layer
// callback-function
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
{
tEplKernel Ret;
// set instance variables to 0
EPL_MEMSET(&SdoUdpInstance_g, 0x00, sizeof(SdoUdpInstance_g));
Ret = kEplSuccessful;
// save pointer to callback-function
if (fpReceiveCb_p != NULL) {
SdoUdpInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
} else {
Ret = kEplSdoUdpMissCb;
goto Exit;
}
init_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
SdoUdpInstance_g.m_iTerminateThread = 0;
SdoUdpInstance_g.m_ThreadHandle = 0;
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
Ret = EplSdoUdpuConfig(INADDR_ANY, 0);
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuDelInstance
//
// Description: del instance of the module
// del socket and del Listen-Thread
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started
// close thread
SdoUdpInstance_g.m_iTerminateThread = 1;
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
SdoUdpInstance_g.m_ThreadHandle = 0;
}
if (SdoUdpInstance_g.m_UdpSocket != INVALID_SOCKET) {
// close socket
closesocket(SdoUdpInstance_g.m_UdpSocket);
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuConfig
//
// Description: reconfigurate socket with new IP-Address
// -> needed for NMT ResetConfiguration
//
// Parameters: ulIpAddr_p = IpAddress in platform byte order
// uiPort_p = port number in platform byte order
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
{
tEplKernel Ret;
struct sockaddr_in Addr;
int iError;
Ret = kEplSuccessful;
if (uiPort_p == 0) { // set UDP port to default port number
uiPort_p = EPL_C_SDO_EPL_PORT;
} else if (uiPort_p > 65535) {
Ret = kEplSdoUdpSocketError;
goto Exit;
}
if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started
// close old thread
SdoUdpInstance_g.m_iTerminateThread = 1;
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
SdoUdpInstance_g.m_iTerminateThread = 0;
SdoUdpInstance_g.m_ThreadHandle = 0;
}
if (SdoUdpInstance_g.m_UdpSocket != INVALID_SOCKET) {
// close socket
iError = closesocket(SdoUdpInstance_g.m_UdpSocket);
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
if (iError != 0) {
Ret = kEplSdoUdpSocketError;
goto Exit;
}
}
// create Socket
SdoUdpInstance_g.m_UdpSocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (SdoUdpInstance_g.m_UdpSocket == INVALID_SOCKET) {
Ret = kEplSdoUdpNoSocket;
EPL_DBGLVL_SDO_TRACE0("EplSdoUdpuConfig: socket() failed\n");
goto Exit;
}
// bind socket
Addr.sin_family = AF_INET;
Addr.sin_port = htons((unsigned short)uiPort_p);
Addr.sin_addr.s_addr = htonl(ulIpAddr_p);
iError =
bind(SdoUdpInstance_g.m_UdpSocket, (struct sockaddr *)&Addr,
sizeof(Addr));
if (iError < 0) {
//iError = WSAGetLastError();
EPL_DBGLVL_SDO_TRACE1
("EplSdoUdpuConfig: bind() finished with %i\n", iError);
Ret = kEplSdoUdpNoSocket;
goto Exit;
}
// create Listen-Thread
SdoUdpInstance_g.m_ThreadHandle =
kernel_thread(EplSdoUdpThread, &SdoUdpInstance_g,
CLONE_FS | CLONE_FILES);
if (SdoUdpInstance_g.m_ThreadHandle == 0) {
Ret = kEplSdoUdpThreadError;
goto Exit;
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuInitCon
//
// Description: init a new connect
//
//
//
// Parameters: pSdoConHandle_p = pointer for the new connection handle
// uiTargetNodeId_p = NodeId of the target node
//
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuInitCon(tEplSdoConHdl *pSdoConHandle_p,
unsigned int uiTargetNodeId_p)
{
tEplKernel Ret;
unsigned int uiCount;
unsigned int uiFreeCon;
tEplSdoUdpCon *pSdoUdpCon;
Ret = kEplSuccessful;
// get free entry in control structure
uiCount = 0;
uiFreeCon = EPL_SDO_MAX_CONNECTION_UDP;
pSdoUdpCon = &SdoUdpInstance_g.m_aSdoAbsUdpConnection[0];
while (uiCount < EPL_SDO_MAX_CONNECTION_UDP) {
if ((pSdoUdpCon->m_ulIpAddr & htonl(0xFF)) == htonl(uiTargetNodeId_p)) { // existing connection to target node found
// set handle
*pSdoConHandle_p = (uiCount | EPL_SDO_UDP_HANDLE);
goto Exit;
} else if ((pSdoUdpCon->m_ulIpAddr == 0)
&& (pSdoUdpCon->m_uiPort == 0)) {
uiFreeCon = uiCount;
}
uiCount++;
pSdoUdpCon++;
}
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_UDP) {
// error no free handle
Ret = kEplSdoUdpNoFreeHandle;
} else {
pSdoUdpCon =
&SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiFreeCon];
// save infos for connection
pSdoUdpCon->m_uiPort = htons(EPL_C_SDO_EPL_PORT);
pSdoUdpCon->m_ulIpAddr = htonl(0xC0A86400 | uiTargetNodeId_p); // 192.168.100.uiTargetNodeId_p
// set handle
*pSdoConHandle_p = (uiFreeCon | EPL_SDO_UDP_HANDLE);
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuSendData
//
// Description: send data using exisiting connection
//
//
//
// Parameters: SdoConHandle_p = connection handle
// pSrcData_p = pointer to data
// dwDataSize_p = number of databyte
// -> without asend-header!!!
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuSendData(tEplSdoConHdl SdoConHandle_p,
tEplFrame *pSrcData_p, u32 dwDataSize_p)
{
tEplKernel Ret;
int iError;
unsigned int uiArray;
struct sockaddr_in Addr;
Ret = kEplSuccessful;
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
if (uiArray >= EPL_SDO_MAX_CONNECTION_UDP) {
Ret = kEplSdoUdpInvalidHdl;
goto Exit;
}
//set message type
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, 0x06); // SDO
// target node id (for Udp = 0)
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId, 0x00);
// set source-nodeid (for Udp = 0)
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
// calc size
dwDataSize_p += EPL_ASND_HEADER_SIZE;
// call sendto
Addr.sin_family = AF_INET;
Addr.sin_port =
(unsigned short)SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].
m_uiPort;
Addr.sin_addr.s_addr =
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr;
iError = sendto(SdoUdpInstance_g.m_UdpSocket, // sockethandle
(const char *)&pSrcData_p->m_le_bMessageType, // data to send
dwDataSize_p, // number of bytes to send
0, // flags
(struct sockaddr *)&Addr, // target
sizeof(struct sockaddr_in)); // sizeof targetadress
if (iError < 0) {
EPL_DBGLVL_SDO_TRACE1
("EplSdoUdpuSendData: sendto() finished with %i\n", iError);
Ret = kEplSdoUdpSendError;
goto Exit;
}
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpuDelCon
//
// Description: delete connection from intern structure
//
//
//
// Parameters: SdoConHandle_p = connection handle
//
// Returns: tEplKernel = Errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplSdoUdpuDelCon(tEplSdoConHdl SdoConHandle_p)
{
tEplKernel Ret;
unsigned int uiArray;
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
if (uiArray >= EPL_SDO_MAX_CONNECTION_UDP) {
Ret = kEplSdoUdpInvalidHdl;
goto Exit;
} else {
Ret = kEplSuccessful;
}
// delete connection
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr = 0;
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_uiPort = 0;
Exit:
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplSdoUdpThread
//
// Description: thread check socket for new data
//
//
//
// Parameters: lpParameter = pointer to parameter type tEplSdoUdpThreadPara
//
//
// Returns: u32 = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
static int EplSdoUdpThread(void *pArg_p)
{
tEplSdoUdpInstance *pInstance;
struct sockaddr_in RemoteAddr;
int iError;
int iCount;
int iFreeEntry;
u8 abBuffer[EPL_MAX_SDO_REC_FRAME_SIZE];
unsigned int uiSize;
tEplSdoConHdl SdoConHdl;
pInstance = (tEplSdoUdpInstance *) pArg_p;
daemonize("EplSdoUdpThread");
allow_signal(SIGTERM);
for (; pInstance->m_iTerminateThread == 0;)
{
// wait for data
uiSize = sizeof(struct sockaddr);
iError = recvfrom(pInstance->m_UdpSocket, // Socket
(char *)&abBuffer[0], // buffer for data
sizeof(abBuffer), // size of the buffer
0, // flags
(struct sockaddr *)&RemoteAddr,
(int *)&uiSize);
if (iError == -ERESTARTSYS) {
break;
}
if (iError > 0) {
// get handle for higher layer
iCount = 0;
iFreeEntry = 0xFFFF;
while (iCount < EPL_SDO_MAX_CONNECTION_UDP) {
// check if this connection is already known
if ((pInstance->m_aSdoAbsUdpConnection[iCount].
m_ulIpAddr == RemoteAddr.sin_addr.s_addr)
&& (pInstance->
m_aSdoAbsUdpConnection[iCount].
m_uiPort == RemoteAddr.sin_port)) {
break;
}
if ((pInstance->m_aSdoAbsUdpConnection[iCount].
m_ulIpAddr == 0)
&& (pInstance->
m_aSdoAbsUdpConnection[iCount].
m_uiPort == 0)
&& (iFreeEntry == 0xFFFF))
{
iFreeEntry = iCount;
}
iCount++;
}
if (iCount == EPL_SDO_MAX_CONNECTION_UDP) {
// connection unknown
// see if there is a free handle
if (iFreeEntry != 0xFFFF) {
// save adress infos
pInstance->
m_aSdoAbsUdpConnection[iFreeEntry].
m_ulIpAddr =
RemoteAddr.sin_addr.s_addr;
pInstance->
m_aSdoAbsUdpConnection[iFreeEntry].
m_uiPort = RemoteAddr.sin_port;
// call callback
SdoConHdl = iFreeEntry;
SdoConHdl |= EPL_SDO_UDP_HANDLE;
// offset 4 -> start of SDO Sequence header
pInstance->m_fpSdoAsySeqCb(SdoConHdl,
(tEplAsySdoSeq
*) &
abBuffer[4],
(iError -
4));
} else {
EPL_DBGLVL_SDO_TRACE0
("Error in EplSdoUdpThread() no free handle\n");
}
} else {
// known connection
// call callback with correct handle
SdoConHdl = iCount;
SdoConHdl |= EPL_SDO_UDP_HANDLE;
// offset 4 -> start of SDO Sequence header
pInstance->m_fpSdoAsySeqCb(SdoConHdl,
(tEplAsySdoSeq *) &
abBuffer[4],
(iError - 4));
}
} // end of if(iError!=SOCKET_ERROR)
} // end of for(;;)
complete_and_exit(&SdoUdpInstance_g.m_CompletionUdpThread, 0);
return 0;
}
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
// EOF

View File

@ -1,377 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for Statusu-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplStatusu.c,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/11/15 d.k.: start of the implementation
****************************************************************************/
#include "user/EplStatusu.h"
#include "user/EplDlluCal.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
/***************************************************************************/
/* */
/* */
/* C L A S S <xxxxx> */
/* */
/* */
/***************************************************************************/
//
// Description:
//
//
/***************************************************************************/
//=========================================================================//
// //
// P R I V A T E D E F I N I T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
tEplStatusuCbResponse m_apfnCbResponse[254];
} tEplStatusuInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
static tEplStatusuInstance EplStatusuInstance_g;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static tEplKernel EplStatusuCbStatusResponse(tEplFrameInfo *pFrameInfo_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplStatusuInit
//
// Description: init first instance of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplStatusuInit(void)
{
tEplKernel Ret;
Ret = EplStatusuAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplStatusuAddInstance
//
// Description: init other instances of the module
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplStatusuAddInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof(EplStatusuInstance_g));
// register StatusResponse callback function
Ret =
EplDlluCalRegAsndService(kEplDllAsndStatusResponse,
EplStatusuCbStatusResponse,
kEplDllAsndFilterAny);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplStatusuDelInstance
//
// Description: delete instance
//
//
//
// Parameters:
//
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplStatusuDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// deregister StatusResponse callback function
Ret =
EplDlluCalRegAsndService(kEplDllAsndStatusResponse, NULL,
kEplDllAsndFilterNone);
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplStatusuReset
//
// Description: resets this instance
//
// Parameters:
//
// Returns: tEplKernel = errorcode
//
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplStatusuReset(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// reset instance structure
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof(EplStatusuInstance_g));
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplStatusuRequestStatusResponse
//
// Description: returns the StatusResponse for the specified node.
//
// Parameters: uiNodeId_p = IN: node ID
// pfnCbResponse_p = IN: function pointer to callback function
// which will be called if StatusResponse is received
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplStatusuRequestStatusResponse(unsigned int uiNodeId_p,
tEplStatusuCbResponse pfnCbResponse_p)
{
tEplKernel Ret;
Ret = kEplSuccessful;
// decrement node ID, because array is zero based
uiNodeId_p--;
if (uiNodeId_p < tabentries(EplStatusuInstance_g.m_apfnCbResponse)) {
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
if (EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL) { // request already issued (maybe by someone else)
Ret = kEplInvalidOperation;
} else {
EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] =
pfnCbResponse_p;
Ret =
EplDlluCalIssueRequest(kEplDllReqServiceStatus,
(uiNodeId_p + 1), 0xFF);
}
#else
Ret = kEplInvalidOperation;
#endif
} else { // invalid node ID specified
Ret = kEplInvalidNodeId;
}
return Ret;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplStatusuCbStatusResponse
//
// Description: callback funktion for StatusResponse
//
//
//
// Parameters: pFrameInfo_p = Frame with the StatusResponse
//
//
// Returns: tEplKernel = error code
//
//
// State:
//
//---------------------------------------------------------------------------
static tEplKernel EplStatusuCbStatusResponse(tEplFrameInfo *pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
unsigned int uiNodeId;
unsigned int uiIndex;
tEplStatusuCbResponse pfnCbResponse;
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
uiIndex = uiNodeId - 1;
if (uiIndex < tabentries(EplStatusuInstance_g.m_apfnCbResponse)) {
// memorize pointer to callback function
pfnCbResponse = EplStatusuInstance_g.m_apfnCbResponse[uiIndex];
if (pfnCbResponse == NULL) { // response was not requested
goto Exit;
}
// reset callback function pointer so that caller may issue next request
EplStatusuInstance_g.m_apfnCbResponse[uiIndex] = NULL;
if (pFrameInfo_p->m_uiFrameSize < EPL_C_DLL_MINSIZE_STATUSRES) { // StatusResponse not received or it has invalid size
Ret = pfnCbResponse(uiNodeId, NULL);
} else { // StatusResponse received
Ret =
pfnCbResponse(uiNodeId,
&pFrameInfo_p->m_pFrame->m_Data.
m_Asnd.m_Payload.m_StatusResponse);
}
}
Exit:
return Ret;
}
// EOF

View File

@ -1,140 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for target api function
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplTarget.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2005/12/05 -as: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPLTARGET_H_
#define _EPLTARGET_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// =========================================================================
// macros for memory access (depends on target system)
// =========================================================================
// NOTE:
// The following macros are used to combine standard library definitions. Some
// applications needs to use one common library function (e.g. memcpy()). So
// you can set (or change) it here.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/major.h>
//29.11.2004 f.j. sonst ist memcpy und memset unbekannt
// #include <string.h>
#define EPL_MEMCPY(dst,src,siz) memcpy((void*)(dst),(const void*)(src),(size_t)(siz));
#define EPL_MEMSET(dst,val,siz) memset((void*)(dst),(int)(val),(size_t)(siz));
#define EPL_MALLOC(siz) kmalloc((size_t)(siz), GFP_KERNEL)
#define EPL_FREE(ptr) kfree((void *)ptr)
#ifndef PRINTF0
#define PRINTF TRACE
#define PRINTF0(arg) TRACE0(arg)
#define PRINTF1(arg,p1) TRACE1(arg,p1)
#define PRINTF2(arg,p1,p2) TRACE2(arg,p1,p2)
#define PRINTF3(arg,p1,p2,p3) TRACE3(arg,p1,p2,p3)
#define PRINTF4(arg,p1,p2,p3,p4) TRACE4(arg,p1,p2,p3,p4)
//#define PRINTF printf
//#define PRINTF0(arg) PRINTF(arg)
//#define PRINTF1(arg,p1) PRINTF(arg,p1)
//#define PRINTF2(arg,p1,p2) PRINTF(arg,p1,p2)
//#define PRINTF3(arg,p1,p2,p3) PRINTF(arg,p1,p2,p3)
//#define PRINTF4(arg,p1,p2,p3,p4) PRINTF(arg,p1,p2,p3,p4)
#endif
#define EPL_TGT_INTMASK_ETH 0x0001 // ethernet interrupt
#define EPL_TGT_INTMASK_DMA 0x0002 // DMA interrupt
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
// currently no Timer functions are needed by EPL stack
// so they are not implemented yet
//void TgtTimerInit(void);
//u32 TgtGetTickCount(void);
//void TgtGetNetTime(tEplNetTime * pNetTime_p);
// functions for ethernet driver
tEplKernel TgtInitEthIsr(void);
void TgtFreeEthIsr(void);
void TgtEnableGlobalInterrupt(u8 fEnable_p);
void TgtEnableEthInterrupt0(u8 fEnable_p, unsigned int uiInterruptMask_p);
void TgtEnableEthInterrupt1(u8 fEnable_p, unsigned int uiInterruptMask_p);
#endif // #ifndef _EPLTARGET_H_

View File

@ -1,116 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for Epl Timer-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplTimer.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/07/06 k.t.: start of the implementation
****************************************************************************/
#include "EplInc.h"
#include "EplEvent.h"
#ifndef _EPLTIMER_H_
#define _EPLTIMER_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
// type for timer handle
typedef unsigned long tEplTimerHdl;
typedef struct {
tEplEventSink m_EventSink;
unsigned long m_ulArg; // d.k.: converted to unsigned long because
// it is never accessed as a pointer by the
// timer module and the data the
// pointer points to is not saved in any way.
// It is just a value. The user is responsible
// to store the data statically and convert
// the pointer between address spaces.
} tEplTimerArg;
typedef struct {
tEplTimerHdl m_TimerHdl;
unsigned long m_ulArg; // d.k.: converted to unsigned long because
// it is never accessed as a pointer by the
// timer module and the data the
// pointer points to is not saved in any way.
// It is just a value.
} tEplTimerEventArg;
typedef tEplKernel(* tEplTimerkCallback) (tEplTimerEventArg *pEventArg_p);
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
#endif // #ifndef _EPLTIMER_H_

View File

@ -1,446 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: source file for EPL User Timermodule for Linux kernel module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplTimeruLinuxKernel.c,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/09/12 d.k.: start of the implementation
****************************************************************************/
#include "user/EplTimeru.h"
#include <linux/timer.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
typedef struct {
struct timer_list m_Timer;
tEplTimerArg TimerArgument;
} tEplTimeruData;
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static void EplTimeruCbMs(unsigned long ulParameter_p);
/***************************************************************************/
/* */
/* */
/* C L A S S <Epl Userspace-Timermodule for Linux Kernel> */
/* */
/* */
/***************************************************************************/
//
// Description: Epl Userspace-Timermodule for Linux Kernel
//
//
/***************************************************************************/
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplTimeruInit
//
// Description: function inits first instance
//
// Parameters: void
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruInit(void)
{
tEplKernel Ret;
Ret = EplTimeruAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruAddInstance
//
// Description: function inits additional instance
//
// Parameters: void
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruAddInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruDelInstance
//
// Description: function deletes instance
// -> under Linux nothing to do
// -> no instance table needed
//
// Parameters: void
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruDelInstance(void)
{
tEplKernel Ret;
Ret = kEplSuccessful;
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruSetTimerMs
//
// Description: function creates a timer and returns the corresponding handle
//
// Parameters: pTimerHdl_p = pointer to a buffer to fill in the handle
// ulTime_p = time for timer in ms
// Argument_p = argument for timer
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruSetTimerMs(tEplTimerHdl *pTimerHdl_p,
unsigned long ulTime_p,
tEplTimerArg Argument_p)
{
tEplKernel Ret = kEplSuccessful;
tEplTimeruData *pData;
// check pointer to handle
if (pTimerHdl_p == NULL) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
pData = (tEplTimeruData *) EPL_MALLOC(sizeof(tEplTimeruData));
if (pData == NULL) {
Ret = kEplNoResource;
goto Exit;
}
init_timer(&pData->m_Timer);
pData->m_Timer.function = EplTimeruCbMs;
pData->m_Timer.data = (unsigned long)pData;
pData->m_Timer.expires = jiffies + ulTime_p * HZ / 1000;
EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
add_timer(&pData->m_Timer);
*pTimerHdl_p = (tEplTimerHdl) pData;
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruModifyTimerMs
//
// Description: function changes a timer and returns the corresponding handle
//
// Parameters: pTimerHdl_p = pointer to a buffer to fill in the handle
// ulTime_p = time for timer in ms
// Argument_p = argument for timer
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruModifyTimerMs(tEplTimerHdl *pTimerHdl_p,
unsigned long ulTime_p,
tEplTimerArg Argument_p)
{
tEplKernel Ret = kEplSuccessful;
tEplTimeruData *pData;
// check pointer to handle
if (pTimerHdl_p == NULL) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
// check handle itself, i.e. was the handle initialized before
if (*pTimerHdl_p == 0) {
Ret = EplTimeruSetTimerMs(pTimerHdl_p, ulTime_p, Argument_p);
goto Exit;
}
pData = (tEplTimeruData *) * pTimerHdl_p;
if ((tEplTimeruData *) pData->m_Timer.data != pData) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
mod_timer(&pData->m_Timer, (jiffies + ulTime_p * HZ / 1000));
// copy the TimerArg after the timer is restarted,
// so that a timer occured immediately before mod_timer
// won't use the new TimerArg and
// therefore the old timer cannot be distinguished from the new one.
// But if the new timer is too fast, it may get lost.
EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
// check if timer is really running
if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
// retry starting it
add_timer(&pData->m_Timer);
}
// set handle to pointer of tEplTimeruData
// *pTimerHdl_p = (tEplTimerHdl) pData;
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruDeleteTimer
//
// Description: function deletes a timer
//
// Parameters: pTimerHdl_p = pointer to a buffer to fill in the handle
//
// Returns: tEplKernel = errorcode
//
// State:
//
//---------------------------------------------------------------------------
tEplKernel EplTimeruDeleteTimer(tEplTimerHdl *pTimerHdl_p)
{
tEplKernel Ret = kEplSuccessful;
tEplTimeruData *pData;
// check pointer to handle
if (pTimerHdl_p == NULL) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
// check handle itself, i.e. was the handle initialized before
if (*pTimerHdl_p == 0) {
Ret = kEplSuccessful;
goto Exit;
}
pData = (tEplTimeruData *) * pTimerHdl_p;
if ((tEplTimeruData *) pData->m_Timer.data != pData) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
/* if (del_timer(&pData->m_Timer) == 1)
{
kfree(pData);
}
*/
// try to delete the timer
del_timer(&pData->m_Timer);
// free memory in any case
kfree(pData);
// uninitialize handle
*pTimerHdl_p = 0;
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimeruIsTimerActive
//
// Description: checks if the timer referenced by the handle is currently
// active.
//
// Parameters: TimerHdl_p = handle of the timer to check
//
// Returns: BOOL = TRUE, if active;
// FALSE, otherwise
//
// State:
//
//---------------------------------------------------------------------------
BOOL EplTimeruIsTimerActive(tEplTimerHdl TimerHdl_p)
{
BOOL fActive = FALSE;
tEplTimeruData *pData;
// check handle itself, i.e. was the handle initialized before
if (TimerHdl_p == 0) { // timer was not created yet, so it is not active
goto Exit;
}
pData = (tEplTimeruData *) TimerHdl_p;
if ((tEplTimeruData *) pData->m_Timer.data != pData) { // invalid timer
goto Exit;
}
// check if timer is running
if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
goto Exit;
}
fActive = TRUE;
Exit:
return fActive;
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplTimeruCbMs
//
// Description: function to process timer
//
//
//
// Parameters: lpParameter = pointer to structur of type tEplTimeruData
//
//
// Returns: (none)
//
//
// State:
//
//---------------------------------------------------------------------------
static void EplTimeruCbMs(unsigned long ulParameter_p)
{
tEplKernel Ret = kEplSuccessful;
tEplTimeruData *pData;
tEplEvent EplEvent;
tEplTimerEventArg TimerEventArg;
pData = (tEplTimeruData *) ulParameter_p;
// call event function
TimerEventArg.m_TimerHdl = (tEplTimerHdl) pData;
TimerEventArg.m_ulArg = pData->TimerArgument.m_ulArg;
EplEvent.m_EventSink = pData->TimerArgument.m_EventSink;
EplEvent.m_EventType = kEplEventTypeTimer;
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
EplEvent.m_pArg = &TimerEventArg;
EplEvent.m_uiSize = sizeof(TimerEventArg);
Ret = EplEventuPost(&EplEvent);
// d.k. do not free memory, user has to call EplTimeruDeleteTimer()
//kfree(pData);
}
// EOF

View File

@ -1,98 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: This file defines the EPL version for the stack, as string
and for object 0x1018 within object dictionary.
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplVersion.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
all
-------------------------------------------------------------------------
Revision History:
****************************************************************************/
#ifndef _EPL_VERSION_H_
#define _EPL_VERSION_H_
// NOTE:
// All version macros should contain the same version number. But do not use
// defines instead of the numbers. Because the macro EPL_STRING_VERSION() can not
// convert a define to a string.
//
// Format: maj.min.build
// maj = major version
// min = minor version (will be set to 0 if major version will be incremented)
// build = current build (will be set to 0 if minor version will be incremented)
//
#define DEFINED_STACK_VERSION EPL_STACK_VERSION (1, 3, 0)
#define DEFINED_OBJ1018_VERSION EPL_OBJ1018_VERSION (1, 3, 0)
#define DEFINED_STRING_VERSION EPL_STRING_VERSION (1, 3, 0)
// -----------------------------------------------------------------------------
#define EPL_PRODUCT_NAME "EPL V2"
#define EPL_PRODUCT_VERSION DEFINED_STRING_VERSION
#define EPL_PRODUCT_MANUFACTURER "SYS TEC electronic GmbH"
#define EPL_PRODUCT_KEY "SO-1083"
#define EPL_PRODUCT_DESCRIPTION "openPOWERLINK Protocol Stack Source"
#endif // _EPL_VERSION_H_
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

View File

@ -1,6 +0,0 @@
config EPL
tristate "openPOWERLINK protocol stack"
depends on NET && HIGH_RES_TIMERS && X86
default N
---help---
Enable support for the openPOWERLINK network protocol stack.

View File

@ -1,41 +0,0 @@
obj-$(CONFIG_EPL) += epl.o
epl-objs := \
EplApiGeneric.o \
EplApiLinuxKernel.o \
EplApiProcessImage.o \
EplDllk.o \
EplDllkCal.o \
EplDlluCal.o \
EplErrorHandlerk.o \
EplEventk.o \
EplEventu.o \
EplIdentu.o \
EplNmtCnu.o \
EplNmtk.o \
EplNmtkCal.o \
EplNmtMnu.o \
EplNmtu.o \
EplNmtuCal.o \
EplObd.o \
EplObdkCal.o \
EplObdu.o \
EplObduCal.o \
EplPdok.o \
EplPdokCal.o \
EplPdou.o \
EplSdoAsndu.o \
EplSdoAsySequ.o \
EplSdoComu.o \
EplSdoUdpu.o \
EplStatusu.o \
EplTimeruLinuxKernel.o \
amix86.o \
SharedBuff.o \
ShbIpc-LinuxKernel.o \
TimerHighReskX86.o \
VirtualEthernetLinux.o \
SocketLinuxKernel.o \
proc_fs.o \
demo_main.o \
Edrv8139.o \

File diff suppressed because it is too large Load Diff

View File

@ -1,187 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: Project independend shared buffer (linear + circular)
Description: Declaration of platform independend part for the
shared buffer
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
2006/06/27 -rs: V 1.00 (initial version)
****************************************************************************/
#ifndef _SHAREDBUFF_H_
#define _SHAREDBUFF_H_
//---------------------------------------------------------------------------
// Type definitions
//---------------------------------------------------------------------------
typedef enum {
kShbOk = 0,
kShbNoReadableData = 1,
kShbDataTruncated = 2,
kShbBufferFull = 3,
kShbDataOutsideBufferArea = 4,
kShbBufferAlreadyCompleted = 5,
kShbMemUsedByOtherProcs = 6,
kShbOpenMismatch = 7,
kShbInvalidBufferType = 8,
kShbInvalidArg = 9,
kShbBufferInvalid = 10,
kShbOutOfMem = 11,
kShbAlreadyReseting = 12,
kShbAlreadySignaling = 13,
kShbExceedDataSizeLimit = 14,
} tShbError;
// 2006/08/24 d.k.: Priority for threads (new data, job signaling)
typedef enum {
kShbPriorityLow = 0,
kShbPriorityNormal = 1,
kshbPriorityHigh = 2
} tShbPriority;
typedef struct {
unsigned int m_uiFullBlockSize; // real size of allocated block (incl. alignment fill bytes)
unsigned long m_ulAvailableSize; // still available size for data
unsigned long m_ulWrIndex; // current write index
unsigned int m_fBufferCompleted; // TRUE if allocated block is complete filled with data
} tShbCirChunk;
typedef void *tShbInstance;
typedef void (*tShbCirSigHndlrNewData) (tShbInstance pShbInstance_p,
unsigned long ulDataBlockSize_p);
typedef void (*tShbCirSigHndlrReset) (tShbInstance pShbInstance_p,
unsigned int fTimeOut_p);
//---------------------------------------------------------------------------
// Prototypes
//---------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
tShbError ShbInit(void);
tShbError ShbExit(void);
// Circular Shared Buffer
tShbError ShbCirAllocBuffer(unsigned long ulBufferSize_p,
const char *pszBufferID_p,
tShbInstance * ppShbInstance_p,
unsigned int *pfShbNewCreated_p);
tShbError ShbCirReleaseBuffer(tShbInstance pShbInstance_p);
tShbError ShbCirResetBuffer(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
tShbCirSigHndlrReset
pfnSignalHandlerReset_p);
tShbError ShbCirWriteDataBlock(tShbInstance pShbInstance_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p);
tShbError ShbCirAllocDataBlock(tShbInstance pShbInstance_p,
tShbCirChunk * pShbCirChunk_p,
unsigned long ulDataBufferSize_p);
tShbError ShbCirWriteDataChunk(tShbInstance pShbInstance_p,
tShbCirChunk * pShbCirChunk_p,
const void *pSrcDataChunk_p,
unsigned long ulDataChunkSize_p,
unsigned int *pfBufferCompleted_p);
tShbError ShbCirReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulRdBuffSize_p,
unsigned long *pulDataBlockSize_p);
tShbError ShbCirGetReadDataSize(tShbInstance pShbInstance_p,
unsigned long *pulDataBlockSize_p);
tShbError ShbCirGetReadBlockCount(tShbInstance pShbInstance_p,
unsigned long *pulDataBlockCount_p);
tShbError ShbCirSetSignalHandlerNewData(tShbInstance pShbInstance_p,
tShbCirSigHndlrNewData
pfnShbSignalHandlerNewData_p,
tShbPriority ShbPriority_p);
// Linear Shared Buffer
tShbError ShbLinAllocBuffer(unsigned long ulBufferSize_p,
const char *pszBufferID_p,
tShbInstance * ppShbInstance_p,
unsigned int *pfShbNewCreated_p);
tShbError ShbLinReleaseBuffer(tShbInstance pShbInstance_p);
tShbError ShbLinWriteDataBlock(tShbInstance pShbInstance_p,
unsigned long ulDstBufferOffs_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p);
tShbError ShbLinReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulSrcBufferOffs_p,
unsigned long ulDataBlockSize_p);
#ifndef NDEBUG
tShbError ShbCirTraceBuffer(tShbInstance pShbInstance_p);
tShbError ShbLinTraceBuffer(tShbInstance pShbInstance_p);
tShbError ShbTraceDump(const unsigned char *pabStartAddr_p,
unsigned long ulDataSize_p,
unsigned long ulAddrOffset_p,
const char *pszInfoText_p);
#else
#define ShbCirTraceBuffer(p0)
#define ShbLinTraceBuffer(p0)
#define ShbTraceDump(p0, p1, p2, p3)
#endif
#ifdef __cplusplus
}
#endif
#endif // #ifndef _SHAREDBUFF_H_

View File

@ -1,944 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: Project independend shared buffer (linear + circular)
Description: Implementation of platform specific part for the
shared buffer
(Implementation for Linux KernelSpace)
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
2006/06/28 -rs: V 1.00 (initial version)
****************************************************************************/
#include "global.h"
#include "SharedBuff.h"
#include "ShbIpc.h"
#include "ShbLinuxKernel.h"
#include "Debug.h"
#include <linux/string.h>
#include <linux/module.h>
#include <asm/processor.h>
//#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/completion.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// Configuration
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Constant definitions
//---------------------------------------------------------------------------
#define MAX_LEN_BUFFER_ID 256
#define TIMEOUT_ENTER_ATOMIC 1000 // (ms) for debgging: INFINITE
#define TIMEOUT_TERM_THREAD 1000
#define INFINITE 3600
#define SBI_MAGIC_ID 0x5342492B // magic ID ("SBI+")
#define SBH_MAGIC_ID 0x5342482A // magic ID ("SBH*")
#define INVALID_ID -1
#define TABLE_SIZE 10
//---------------------------------------------------------------------------
// Local types
//---------------------------------------------------------------------------
// This structure is the common header for the shared memory region used
// by all processes attached this shared memory. It includes common
// information to administrate/manage the shared buffer from a couple of
// separated processes (e.g. the refernce counter). This structure is
// located at the start of the shared memory region itself and exists
// consequently only one times per shared memory instance.
typedef struct {
unsigned long m_ulShMemSize;
unsigned long m_ulRefCount;
int m_iBufferId;
// int m_iUserSpaceMem; //0 for userspace mem !=0 kernelspace mem
spinlock_t m_SpinlockBuffAccess;
BOOL m_fNewData;
BOOL m_fJobReady;
wait_queue_head_t m_WaitQueueNewData;
wait_queue_head_t m_WaitQueueJobReady;
#ifndef NDEBUG
unsigned long m_ulOwnerProcID;
#endif
} tShbMemHeader;
// This structure is the "external entry point" from a separate process
// to get access to a shared buffer. This structure includes all platform
// resp. target specific information to administrate/manage the shared
// buffer from a separate process. Every process attached to the shared
// buffer has its own runtime instance of this structure with its individual
// runtime data (e.g. the scope of an event handle is limitted to the
// owner process only). The structure member <m_pShbMemHeader> points
// to the (process specific) start address of the shared memory region
// itself.
typedef struct {
unsigned long m_SbiMagicID; // magic ID ("SBI+")
// void* m_pSharedMem;
int m_tThreadNewDataId;
long m_lThreadNewDataNice; // nice value of the new data thread
int m_tThreadJobReadyId;
unsigned long m_ulFlagsBuffAccess; // d.k. moved from tShbMemHeader, because each
// process needs to store the interrupt flags separately
tSigHndlrNewData m_pfnSigHndlrNewData;
unsigned long m_ulTimeOutJobReady;
tSigHndlrJobReady m_pfnSigHndlrJobReady;
tShbMemHeader *m_pShbMemHeader;
int m_iThreadTermFlag;
struct completion m_CompletionNewData;
/*
struct semaphore *m_pSemBuffAccess;
struct semaphore *m_pSemNewData;
struct semaphore *m_pSemStopSignalingNewData;
struct semaphore *m_pSemJobReady;
*/
#ifndef NDEBUG
unsigned long m_ulThreadIDNewData;
unsigned long m_ulThreadIDJobReady;
#endif
} tShbMemInst;
//---------------------------------------------------------------------------
// Prototypes of internal functions
//---------------------------------------------------------------------------
//tShbMemInst* ShbIpcGetShbMemInst (tShbInstance pShbInstance_p);
//tShbMemHeader* ShbIpcGetShbMemHeader (tShbMemInst* pShbMemInst_p);
//---------------------------------------------------------------------------
// Get pointer to process local information structure
//---------------------------------------------------------------------------
static inline tShbMemInst *ShbIpcGetShbMemInst(tShbInstance pShbInstance_p)
{
tShbMemInst *pShbMemInst;
pShbMemInst = (tShbMemInst *) pShbInstance_p;
return (pShbMemInst);
}
//---------------------------------------------------------------------------
// Get pointer to shared memory header
//---------------------------------------------------------------------------
static inline tShbMemHeader *ShbIpcGetShbMemHeader(tShbMemInst * pShbMemInst_p)
{
tShbMemHeader *pShbMemHeader;
pShbMemHeader = pShbMemInst_p->m_pShbMemHeader;
return (pShbMemHeader);
}
// Get pointer to process local information structure
//#define ShbIpcGetShbMemInst(pShbInstance_p) ((tShbMemInst*)pShbInstance_p)
// Get pointer to shared memory header
//#define ShbIpcGetShbMemHeader(pShbMemInst_p) (pShbMemInst_p->m_pShbMemHeader)
// not inlined internal functions
int ShbIpcThreadSignalNewData(void *pvThreadParam_p);
int ShbIpcThreadSignalJobReady(void *pvThreadParam_p);
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
struct sShbMemTable *psMemTableElementFirst_g;
static void *ShbIpcAllocPrivateMem(unsigned long ulMemSize_p);
static int ShbIpcFindListElement(int iBufferId,
struct sShbMemTable
**ppsReturnMemTableElement);
static void ShbIpcAppendListElement(struct sShbMemTable *sNewMemTableElement);
static void ShbIpcDeleteListElement(int iBufferId);
static void ShbIpcCrc32GenTable(unsigned long aulCrcTable[256]);
static unsigned long ShbIpcCrc32GetCrc(const char *pcString,
unsigned long aulCrcTable[256]);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
// not inlined external functions
//---------------------------------------------------------------------------
// Initialize IPC for Shared Buffer Module
//---------------------------------------------------------------------------
tShbError ShbIpcInit(void)
{
psMemTableElementFirst_g = NULL;
return (kShbOk);
}
//---------------------------------------------------------------------------
// Deinitialize IPC for Shared Buffer Module
//---------------------------------------------------------------------------
tShbError ShbIpcExit(void)
{
return (kShbOk);
}
//---------------------------------------------------------------------------
// Allocate Shared Buffer
//---------------------------------------------------------------------------
tShbError ShbIpcAllocBuffer(unsigned long ulBufferSize_p,
const char *pszBufferID_p,
tShbInstance * ppShbInstance_p,
unsigned int *pfShbNewCreated_p)
{
tShbError ShbError;
int iBufferId = 0;
unsigned long ulCrc32 = 0;
unsigned int uiFirstProcess = 0;
unsigned long ulShMemSize;
tShbMemHeader *pShbMemHeader;
tShbMemInst *pShbMemInst = NULL;
tShbInstance pShbInstance;
unsigned int fShMemNewCreated = FALSE;
void *pSharedMem = NULL;
unsigned long aulCrcTable[256];
struct sShbMemTable *psMemTableElement;
DEBUG_LVL_29_TRACE0("ShbIpcAllocBuffer \n");
ulShMemSize = ulBufferSize_p + sizeof(tShbMemHeader);
//create Buffer ID
ShbIpcCrc32GenTable(aulCrcTable);
ulCrc32 = ShbIpcCrc32GetCrc(pszBufferID_p, aulCrcTable);
iBufferId = ulCrc32;
DEBUG_LVL_29_TRACE2
("ShbIpcAllocBuffer BufferSize:%d sizeof(tShb..):%d\n",
ulBufferSize_p, sizeof(tShbMemHeader));
DEBUG_LVL_29_TRACE2("ShbIpcAllocBuffer BufferId:%d MemSize:%d\n",
iBufferId, ulShMemSize);
//---------------------------------------------------------------
// (1) open an existing or create a new shared memory
//---------------------------------------------------------------
//test if buffer already exists
if (ShbIpcFindListElement(iBufferId, &psMemTableElement) == 0) {
//Buffer already exists
fShMemNewCreated = FALSE;
pSharedMem = psMemTableElement->m_pBuffer;
DEBUG_LVL_29_TRACE1
("ShbIpcAllocBuffer attach Buffer at:%p Id:%d\n",
pSharedMem);
uiFirstProcess = 1;
} else {
//create new Buffer
fShMemNewCreated = TRUE;
uiFirstProcess = 0;
pSharedMem = kmalloc(ulShMemSize, GFP_KERNEL);
DEBUG_LVL_29_TRACE2
("ShbIpcAllocBuffer Create New Buffer at:%p Id:%d\n",
pSharedMem, iBufferId);
if (pSharedMem == NULL) {
//unable to create mem
ShbError = kShbOutOfMem;
goto Exit;
}
DEBUG_LVL_29_TRACE0("ShbIpcAllocBuffer create semas\n");
// append Element to Mem Table
psMemTableElement =
kmalloc(sizeof(struct sShbMemTable), GFP_KERNEL);
psMemTableElement->m_iBufferId = iBufferId;
psMemTableElement->m_pBuffer = pSharedMem;
psMemTableElement->m_psNextMemTableElement = NULL;
ShbIpcAppendListElement(psMemTableElement);
}
DEBUG_LVL_29_TRACE0("ShbIpcAllocBuffer update header\n");
//update header
pShbMemHeader = (tShbMemHeader *) pSharedMem;
DEBUG_LVL_29_TRACE1
("ShbIpcAllocBuffer 0 pShbMemHeader->m_ulShMemSize: %d\n",
pShbMemHeader->m_ulShMemSize);
// allocate a memory block from process specific mempool to save
// process local information to administrate/manage the shared buffer
DEBUG_LVL_29_TRACE0("ShbIpcAllocBuffer alloc private mem\n");
pShbMemInst =
(tShbMemInst *) ShbIpcAllocPrivateMem(sizeof(tShbMemInst));
if (pShbMemInst == NULL) {
ShbError = kShbOutOfMem;
goto Exit;
}
// reset complete header to default values
//pShbMemInst->m_SbiMagicID = SBI_MAGIC_ID;
// pShbMemInst->m_pSharedMem = pSharedMem;
pShbMemInst->m_tThreadNewDataId = INVALID_ID;
pShbMemInst->m_tThreadJobReadyId = INVALID_ID;
pShbMemInst->m_pfnSigHndlrNewData = NULL;
pShbMemInst->m_ulTimeOutJobReady = 0;
pShbMemInst->m_pfnSigHndlrJobReady = NULL;
pShbMemInst->m_pShbMemHeader = pShbMemHeader;
pShbMemInst->m_iThreadTermFlag = 0;
// initialize completion etc.
init_completion(&pShbMemInst->m_CompletionNewData);
ShbError = kShbOk;
if (fShMemNewCreated) {
// this process was the first who wanted to use the shared memory,
// so a new shared memory was created
// -> setup new header information inside the shared memory region
// itself
pShbMemHeader->m_ulShMemSize = ulShMemSize;
pShbMemHeader->m_ulRefCount = 1;
pShbMemHeader->m_iBufferId = iBufferId;
// initialize spinlock
spin_lock_init(&pShbMemHeader->m_SpinlockBuffAccess);
// initialize wait queues
init_waitqueue_head(&pShbMemHeader->m_WaitQueueNewData);
init_waitqueue_head(&pShbMemHeader->m_WaitQueueJobReady);
} else {
// any other process has created the shared memory and this
// process only has to attach to it
// -> check and update existing header information inside the
// shared memory region itself
if (pShbMemHeader->m_ulShMemSize != ulShMemSize) {
ShbError = kShbOpenMismatch;
goto Exit;
}
pShbMemHeader->m_ulRefCount++;
}
Exit:
pShbInstance = (tShbInstance *) pShbMemInst;
*pfShbNewCreated_p = fShMemNewCreated;
*ppShbInstance_p = pShbInstance;
return (ShbError);
}
//---------------------------------------------------------------------------
// Release Shared Buffer
//---------------------------------------------------------------------------
tShbError ShbIpcReleaseBuffer(tShbInstance pShbInstance_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError;
tShbError ShbError2;
DEBUG_LVL_26_TRACE1("ShbIpcReleaseBuffer(%p)\n", pShbInstance_p);
if (pShbInstance_p == NULL) {
return (kShbOk);
}
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
// stop threads in any case, because they are bound to that specific instance
ShbError2 = ShbIpcStopSignalingNewData(pShbInstance_p);
// d.k.: Whats up with JobReady thread?
// Just wake it up, but without setting the semaphore variable
wake_up_interruptible(&pShbMemHeader->m_WaitQueueJobReady);
if (!--pShbMemHeader->m_ulRefCount) {
ShbError = kShbOk;
// delete mem table element
ShbIpcDeleteListElement(pShbMemHeader->m_iBufferId);
// delete shared mem
kfree(pShbMemInst->m_pShbMemHeader);
} else {
ShbError = kShbMemUsedByOtherProcs;
}
//delete privat mem
kfree(pShbMemInst);
return (ShbError);
}
//---------------------------------------------------------------------------
// Enter atomic section for Shared Buffer access
//---------------------------------------------------------------------------
tShbError ShbIpcEnterAtomicSection(tShbInstance pShbInstance_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError = kShbOk;
if (pShbInstance_p == NULL) {
ShbError = kShbInvalidArg;
goto Exit;
}
DEBUG_LVL_29_TRACE0("enter atomic\n");
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
// lock interrupts
spin_lock_irqsave(&pShbMemHeader->m_SpinlockBuffAccess,
pShbMemInst->m_ulFlagsBuffAccess);
Exit:
return ShbError;
}
//---------------------------------------------------------------------------
// Leave atomic section for Shared Buffer access
//---------------------------------------------------------------------------
tShbError ShbIpcLeaveAtomicSection(tShbInstance pShbInstance_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError = kShbOk;
if (pShbInstance_p == NULL) {
ShbError = kShbInvalidArg;
goto Exit;
}
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
// unlock interrupts
spin_unlock_irqrestore(&pShbMemHeader->m_SpinlockBuffAccess,
pShbMemInst->m_ulFlagsBuffAccess);
Exit:
DEBUG_LVL_29_TRACE0("Leave Atomic \n");
return ShbError;
}
//---------------------------------------------------------------------------
// Start signaling of new data (called from reading process)
//---------------------------------------------------------------------------
tShbError ShbIpcStartSignalingNewData(tShbInstance pShbInstance_p,
tSigHndlrNewData pfnSignalHandlerNewData_p,
tShbPriority ShbPriority_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError;
DEBUG_LVL_29_TRACE0("------->ShbIpcStartSignalingNewData\n");
if ((pShbInstance_p == NULL) || (pfnSignalHandlerNewData_p == NULL)) {
return (kShbInvalidArg);
}
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
ShbError = kShbOk;
if ((pShbMemInst->m_tThreadNewDataId != INVALID_ID)
|| (pShbMemInst->m_pfnSigHndlrNewData != NULL)) {
ShbError = kShbAlreadySignaling;
goto Exit;
}
DEBUG_LVL_26_TRACE2
("ShbIpcStartSignalingNewData(%p) m_pfnSigHndlrNewData = %p\n",
pShbInstance_p, pfnSignalHandlerNewData_p);
pShbMemInst->m_pfnSigHndlrNewData = pfnSignalHandlerNewData_p;
pShbMemHeader->m_fNewData = FALSE;
pShbMemInst->m_iThreadTermFlag = 0;
switch (ShbPriority_p) {
case kShbPriorityLow:
pShbMemInst->m_lThreadNewDataNice = -2;
break;
case kShbPriorityNormal:
pShbMemInst->m_lThreadNewDataNice = -9;
break;
case kshbPriorityHigh:
pShbMemInst->m_lThreadNewDataNice = -20;
break;
}
//create thread for signalling new data
pShbMemInst->m_tThreadNewDataId =
kernel_thread(ShbIpcThreadSignalNewData, pShbInstance_p,
CLONE_FS | CLONE_FILES);
Exit:
return ShbError;
}
//---------------------------------------------------------------------------
// Stop signaling of new data (called from reading process)
//---------------------------------------------------------------------------
tShbError ShbIpcStopSignalingNewData(tShbInstance pShbInstance_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError;
DEBUG_LVL_29_TRACE0("------->ShbIpcStopSignalingNewData\n");
if (pShbInstance_p == NULL) {
return (kShbInvalidArg);
}
ShbError = kShbOk;
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
DEBUG_LVL_26_TRACE2
("ShbIpcStopSignalingNewData(%p) pfnSignHndlrNewData=%p\n",
pShbInstance_p, pShbMemInst->m_pfnSigHndlrNewData);
if (pShbMemInst->m_pfnSigHndlrNewData != NULL) { // signal handler was set before
int iErr;
//set termination flag in mem header
pShbMemInst->m_iThreadTermFlag = 1;
// check if thread is still running at all by sending the null-signal to this thread
/* iErr = kill_proc(pShbMemInst->m_tThreadNewDataId, 0, 1); */
iErr = send_sig(0, pShbMemInst->m_tThreadNewDataId, 1);
if (iErr == 0) {
// wake up thread, because it is still running
wake_up_interruptible(&pShbMemHeader->
m_WaitQueueNewData);
//wait for termination of thread
wait_for_completion(&pShbMemInst->m_CompletionNewData);
}
pShbMemInst->m_pfnSigHndlrNewData = NULL;
pShbMemInst->m_tThreadNewDataId = INVALID_ID;
}
return ShbError;
}
//---------------------------------------------------------------------------
// Signal new data (called from writing process)
//---------------------------------------------------------------------------
tShbError ShbIpcSignalNewData(tShbInstance pShbInstance_p)
{
tShbMemHeader *pShbMemHeader;
if (pShbInstance_p == NULL) {
return (kShbInvalidArg);
}
pShbMemHeader =
ShbIpcGetShbMemHeader(ShbIpcGetShbMemInst(pShbInstance_p));
//set semaphore
pShbMemHeader->m_fNewData = TRUE;
DEBUG_LVL_29_TRACE0("ShbIpcSignalNewData set Sem -> New Data\n");
wake_up_interruptible(&pShbMemHeader->m_WaitQueueNewData);
return (kShbOk);
}
//---------------------------------------------------------------------------
// Start signaling for job ready (called from waiting process)
//---------------------------------------------------------------------------
tShbError ShbIpcStartSignalingJobReady(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
tSigHndlrJobReady pfnSignalHandlerJobReady_p)
{
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
tShbError ShbError;
if ((pShbInstance_p == NULL) || (pfnSignalHandlerJobReady_p == NULL)) {
return (kShbInvalidArg);
}
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance_p);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
ShbError = kShbOk;
if ((pShbMemInst->m_tThreadJobReadyId != INVALID_ID)
|| (pShbMemInst->m_pfnSigHndlrJobReady != NULL)) {
ShbError = kShbAlreadySignaling;
goto Exit;
}
pShbMemInst->m_ulTimeOutJobReady = ulTimeOut_p;
pShbMemInst->m_pfnSigHndlrJobReady = pfnSignalHandlerJobReady_p;
pShbMemHeader->m_fJobReady = FALSE;
//create thread for signalling new data
pShbMemInst->m_tThreadJobReadyId =
kernel_thread(ShbIpcThreadSignalJobReady, pShbInstance_p,
CLONE_FS | CLONE_FILES);
Exit:
return ShbError;
}
//---------------------------------------------------------------------------
// Signal job ready (called from executing process)
//---------------------------------------------------------------------------
tShbError ShbIpcSignalJobReady(tShbInstance pShbInstance_p)
{
tShbMemHeader *pShbMemHeader;
DEBUG_LVL_29_TRACE0("ShbIpcSignalJobReady\n");
if (pShbInstance_p == NULL) {
return (kShbInvalidArg);
}
pShbMemHeader =
ShbIpcGetShbMemHeader(ShbIpcGetShbMemInst(pShbInstance_p));
//set semaphore
pShbMemHeader->m_fJobReady = TRUE;
DEBUG_LVL_29_TRACE0("ShbIpcSignalJobReady set Sem -> Job Ready \n");
wake_up_interruptible(&pShbMemHeader->m_WaitQueueJobReady);
return (kShbOk);
}
//---------------------------------------------------------------------------
// Get pointer to common used share memory area
//---------------------------------------------------------------------------
void *ShbIpcGetShMemPtr(tShbInstance pShbInstance_p)
{
tShbMemHeader *pShbMemHeader;
void *pShbShMemPtr;
pShbMemHeader =
ShbIpcGetShbMemHeader(ShbIpcGetShbMemInst(pShbInstance_p));
if (pShbMemHeader != NULL) {
pShbShMemPtr = (u8 *) pShbMemHeader + sizeof(tShbMemHeader);
} else {
pShbShMemPtr = NULL;
}
return (pShbShMemPtr);
}
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
// Get pointer to process local information structure
//---------------------------------------------------------------------------
/*tShbMemInst* ShbIpcGetShbMemInst (
tShbInstance pShbInstance_p)
{
tShbMemInst* pShbMemInst;
pShbMemInst = (tShbMemInst*)pShbInstance_p;
return (pShbMemInst);
}
*/
//---------------------------------------------------------------------------
// Get pointer to shared memory header
//---------------------------------------------------------------------------
/*tShbMemHeader* ShbIpcGetShbMemHeader (
tShbMemInst* pShbMemInst_p)
{
tShbMemHeader* pShbMemHeader;
pShbMemHeader = pShbMemInst_p->m_pShbMemHeader;
return (pShbMemHeader);
}
*/
//---------------------------------------------------------------------------
// Allocate a memory block from process specific mempool
//---------------------------------------------------------------------------
static void *ShbIpcAllocPrivateMem(unsigned long ulMemSize_p)
{
tShbError ShbError;
void *pMem;
DEBUG_LVL_29_TRACE0("ShbIpcAllocPrivateMem \n");
//get private mem
pMem = kmalloc(ulMemSize_p, GFP_KERNEL);
if (pMem == NULL) {
//unable to create mem
ShbError = kShbOutOfMem;
goto Exit;
}
Exit:
return (pMem);
}
//---------------------------------------------------------------------------
// Thread for new data signaling
//---------------------------------------------------------------------------
int ShbIpcThreadSignalNewData(void *pvThreadParam_p)
{
tShbInstance pShbInstance;
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
int iRetVal = -1;
int fCallAgain;
daemonize("ShbND%p", pvThreadParam_p);
allow_signal(SIGTERM);
pShbInstance = (tShbMemInst *) pvThreadParam_p;
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
DEBUG_LVL_26_TRACE1("ShbIpcThreadSignalNewData(%p)\n", pvThreadParam_p);
set_user_nice(current, pShbMemInst->m_lThreadNewDataNice);
// DEBUG_LVL_29_TRACE1("ShbIpcThreadSignalNewData wait for New Data Sem %p\n",pShbMemInst->m_pSemNewData);
do {
iRetVal =
wait_event_interruptible(pShbMemHeader->m_WaitQueueNewData,
(pShbMemInst->m_iThreadTermFlag !=
0)
|| (pShbMemHeader->m_fNewData !=
FALSE));
if (iRetVal != 0) { // signal pending
break;
}
if (pShbMemHeader->m_fNewData != FALSE) {
pShbMemHeader->m_fNewData = FALSE;
do {
fCallAgain =
pShbMemInst->
m_pfnSigHndlrNewData(pShbInstance);
// call scheduler, which will execute any task with higher priority
schedule();
} while (fCallAgain != FALSE);
}
} while (pShbMemInst->m_iThreadTermFlag == 0);
DEBUG_LVL_29_TRACE0("ShbIpcThreadSignalNewData terminated \n");
//set thread completed
complete_and_exit(&pShbMemInst->m_CompletionNewData, 0);
return 0;
}
//---------------------------------------------------------------------------
// Thread for new data Job Ready signaling
//---------------------------------------------------------------------------
int ShbIpcThreadSignalJobReady(void *pvThreadParam_p)
{
tShbInstance pShbInstance;
tShbMemInst *pShbMemInst;
tShbMemHeader *pShbMemHeader;
long lTimeOut;
int iRetVal = -1;
daemonize("ShbJR%p", pvThreadParam_p);
allow_signal(SIGTERM);
pShbInstance = (tShbMemInst *) pvThreadParam_p;
pShbMemInst = ShbIpcGetShbMemInst(pShbInstance);
pShbMemHeader = ShbIpcGetShbMemHeader(pShbMemInst);
DEBUG_LVL_29_TRACE0
("ShbIpcThreadSignalJobReady wait for job ready Sem\n");
if (pShbMemInst->m_ulTimeOutJobReady != 0) {
lTimeOut = (long)pShbMemInst->m_ulTimeOutJobReady;
//wait for job ready semaphore
iRetVal =
wait_event_interruptible_timeout(pShbMemHeader->
m_WaitQueueJobReady,
(pShbMemHeader->
m_fJobReady != FALSE),
lTimeOut);
} else {
//wait for job ready semaphore
iRetVal =
wait_event_interruptible(pShbMemHeader->m_WaitQueueJobReady,
(pShbMemHeader->m_fJobReady !=
FALSE));
}
if (pShbMemInst->m_pfnSigHndlrJobReady != NULL) {
//call Handler
pShbMemInst->m_pfnSigHndlrJobReady(pShbInstance,
!pShbMemHeader->m_fJobReady);
}
pShbMemInst->m_pfnSigHndlrJobReady = NULL;
return 0;
}
//Build the crc table
static void ShbIpcCrc32GenTable(unsigned long aulCrcTable[256])
{
unsigned long ulCrc, ulPoly;
int iIndexI, iIndexJ;
ulPoly = 0xEDB88320L;
for (iIndexI = 0; iIndexI < 256; iIndexI++) {
ulCrc = iIndexI;
for (iIndexJ = 8; iIndexJ > 0; iIndexJ--) {
if (ulCrc & 1) {
ulCrc = (ulCrc >> 1) ^ ulPoly;
} else {
ulCrc >>= 1;
}
}
aulCrcTable[iIndexI] = ulCrc;
}
}
//Calculate the crc value
static unsigned long ShbIpcCrc32GetCrc(const char *pcString,
unsigned long aulCrcTable[256])
{
unsigned long ulCrc;
int iIndex;
ulCrc = 0xFFFFFFFF;
for (iIndex = 0; iIndex < strlen(pcString); iIndex++) {
ulCrc =
((ulCrc >> 8) & 0x00FFFFFF) ^
aulCrcTable[(ulCrc ^ pcString[iIndex]) & 0xFF];
}
return (ulCrc ^ 0xFFFFFFFF);
}
static void ShbIpcAppendListElement(struct sShbMemTable *psNewMemTableElement)
{
struct sShbMemTable *psMemTableElement = psMemTableElementFirst_g;
psNewMemTableElement->m_psNextMemTableElement = NULL;
if (psMemTableElementFirst_g != NULL) { /* sind Elemente vorhanden */
while (psMemTableElement->m_psNextMemTableElement != NULL) { /* suche das letzte Element */
psMemTableElement =
psMemTableElement->m_psNextMemTableElement;
}
psMemTableElement->m_psNextMemTableElement = psNewMemTableElement; /* Haenge das Element hinten an */
} else { /* wenn die liste leer ist, bin ich das erste Element */
psMemTableElementFirst_g = psNewMemTableElement;
}
}
static int ShbIpcFindListElement(int iBufferId,
struct sShbMemTable **ppsReturnMemTableElement)
{
struct sShbMemTable *psMemTableElement = psMemTableElementFirst_g;
while (psMemTableElement != NULL) {
if (psMemTableElement->m_iBufferId == iBufferId) {
//printk("ShbIpcFindListElement Buffer at:%p Id:%d\n",psMemTableElement->m_pBuffer,psMemTableElement->m_iBufferId);
*ppsReturnMemTableElement = psMemTableElement;
//printk("ShbIpcFindListElement Buffer at:%p Id:%d\n",(*ppsReturnMemTableElement)->m_pBuffer,(*ppsReturnMemTableElement)->m_iBufferId);
return 0;
}
psMemTableElement = psMemTableElement->m_psNextMemTableElement;
}
return -1;
}
static void ShbIpcDeleteListElement(int iBufferId)
{
struct sShbMemTable *psMemTableElement = psMemTableElementFirst_g;
struct sShbMemTable *psMemTableElementOld = psMemTableElementFirst_g;
if (psMemTableElement != NULL) {
while ((psMemTableElement != NULL)
&& (psMemTableElement->m_iBufferId != iBufferId)) {
psMemTableElementOld = psMemTableElement;
psMemTableElement =
psMemTableElement->m_psNextMemTableElement;
}
if (psMemTableElement != NULL) {
if (psMemTableElement != psMemTableElementFirst_g) {
psMemTableElementOld->m_psNextMemTableElement =
psMemTableElement->m_psNextMemTableElement;
kfree(psMemTableElement);
} else {
kfree(psMemTableElement);
psMemTableElementFirst_g = NULL;
}
}
}
}

View File

@ -1,99 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: Project independend shared buffer (linear + circular)
Description: Declaration of platform specific part for the
shared buffer
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
2006/06/27 -rs: V 1.00 (initial version)
****************************************************************************/
#ifndef _SHBIPC_H_
#define _SHBIPC_H_
//---------------------------------------------------------------------------
// Type definitions
//---------------------------------------------------------------------------
typedef int (*tSigHndlrNewData) (tShbInstance pShbInstance_p);
typedef void (*tSigHndlrJobReady) (tShbInstance pShbInstance_p,
unsigned int fTimeOut_p);
//---------------------------------------------------------------------------
// Prototypes
//---------------------------------------------------------------------------
tShbError ShbIpcInit(void);
tShbError ShbIpcExit(void);
tShbError ShbIpcAllocBuffer(unsigned long ulBufferSize_p,
const char *pszBufferID_p,
tShbInstance * ppShbInstance_p,
unsigned int *pfShbNewCreated_p);
tShbError ShbIpcReleaseBuffer(tShbInstance pShbInstance_p);
tShbError ShbIpcEnterAtomicSection(tShbInstance pShbInstance_p);
tShbError ShbIpcLeaveAtomicSection(tShbInstance pShbInstance_p);
tShbError ShbIpcStartSignalingNewData(tShbInstance pShbInstance_p,
tSigHndlrNewData
pfnSignalHandlerNewData_p,
tShbPriority ShbPriority_p);
tShbError ShbIpcStopSignalingNewData(tShbInstance pShbInstance_p);
tShbError ShbIpcSignalNewData(tShbInstance pShbInstance_p);
tShbError ShbIpcStartSignalingJobReady(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
tSigHndlrJobReady
pfnSignalHandlerJobReady_p);
tShbError ShbIpcSignalJobReady(tShbInstance pShbInstance_p);
void *ShbIpcGetShMemPtr(tShbInstance pShbInstance_p);
#endif // #ifndef _SHBIPC_H_

View File

@ -1,68 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: Project independend shared buffer (linear + circular)
Description: Declaration of platform specific part for the
shared buffer
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
2006/07/20 -rs: V 1.00 (initial version)
****************************************************************************/
#ifndef _SHBLINUXKERNEL_H_
#define _SHBLINUXKERNEL_H_
struct sShbMemTable {
int m_iBufferId;
void *m_pBuffer;
struct sShbMemTable *m_psNextMemTableElement;
};
extern struct sShbMemTable *psMemTableElementFirst_g;
#endif // _SHBLINUXKERNEL_H_

View File

@ -1,197 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: Wrapper for BSD socket API for Linux kernel
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: SocketLinuxKernel.c,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
Dev C++ and GNU-Compiler for m68k
-------------------------------------------------------------------------
Revision History:
2006/08/25 d.k.: start of implementation
****************************************************************************/
#include <linux/net.h>
#include <linux/in.h>
#include "SocketLinuxKernel.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Kernel Module specific Data Structures
//---------------------------------------------------------------------------
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
SOCKET socket(int af, int type, int protocol)
{
int rc;
SOCKET socket;
rc = sock_create_kern(af, type, protocol, &socket);
if (rc < 0) {
socket = NULL;
goto Exit;
}
Exit:
return socket;
}
int bind(SOCKET socket_p, const struct sockaddr *addr, int addrlen)
{
int rc;
rc = socket_p->ops->bind(socket_p, (struct sockaddr *)addr, addrlen);
return rc;
}
int closesocket(SOCKET socket_p)
{
sock_release(socket_p);
return 0;
}
int recvfrom(SOCKET socket_p, char *buf, int len, int flags,
struct sockaddr *from, int *fromlen)
{
int rc;
struct msghdr msg;
struct kvec iov;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_name = from; // will be struct sock_addr
msg.msg_namelen = *fromlen;
iov.iov_len = len;
iov.iov_base = buf;
rc = kernel_recvmsg(socket_p, &msg, &iov, 1, iov.iov_len, 0);
return rc;
}
int sendto(SOCKET socket_p, const char *buf, int len, int flags,
const struct sockaddr *to, int tolen)
{
int rc;
struct msghdr msg;
struct kvec iov;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_name = (struct sockaddr *)to; // will be struct sock_addr
msg.msg_namelen = tolen;
msg.msg_flags = 0;
iov.iov_len = len;
iov.iov_base = (char *)buf;
rc = kernel_sendmsg(socket_p, &msg, &iov, 1, len);
return rc;
}
// EOF

View File

@ -1,105 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for BSD socket API for Linux kernel
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: SocketLinuxKernel.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/08/25 d.k.: start of the implementation
****************************************************************************/
#ifndef _SOCKETLINUXKERNEL_H_
#define _SOCKETLINUXKERNEL_H_
#include <linux/net.h>
#include <linux/in.h>
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define INVALID_SOCKET 0
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct socket *SOCKET;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
int bind(SOCKET s, const struct sockaddr *addr, int addrlen);
int closesocket(SOCKET s);
int recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from,
int *fromlen);
int sendto(SOCKET s, const char *buf, int len, int flags,
const struct sockaddr *to, int tolen);
SOCKET socket(int af, int type, int protocol);
#endif // #ifndef _SOCKETLINUXKERNEL_H_

View File

@ -1,510 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: target specific implementation of
high resolution timer module for X86 under Linux
The Linux kernel has to be compiled with high resolution
timers enabled. This is done by configuring the kernel
with CONFIG_HIGH_RES_TIMERS enabled.
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: TimerHighReskX86.c,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:38:01 $
$State: Exp $
Build Environment:
GNU
-------------------------------------------------------------------------
Revision History:
****************************************************************************/
#include "EplInc.h"
#include "kernel/EplTimerHighResk.h"
#include "Benchmark.h"
//#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/hrtimer.h>
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#define TIMER_COUNT 2 /* max 15 timers selectable */
#define TIMER_MIN_VAL_SINGLE 5000 /* min 5us */
#define TIMER_MIN_VAL_CYCLE 100000 /* min 100us */
#define PROVE_OVERRUN
// TracePoint support for realtime-debugging
#ifdef _DBG_TRACE_POINTS_
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p);
void TgtDbgPostTraceValue(u32 dwTraceValue_p);
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
#else
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
#define TGT_DBG_POST_TRACE_VALUE(v)
#endif
#define HRT_DBG_POST_TRACE_VALUE(Event_p, uiNodeId_p, wErrorCode_p) \
TGT_DBG_POST_TRACE_VALUE((0xE << 28) | (Event_p << 24) \
| (uiNodeId_p << 16) | wErrorCode_p)
#define TIMERHDL_MASK 0x0FFFFFFF
#define TIMERHDL_SHIFT 28
#define HDL_TO_IDX(Hdl) ((Hdl >> TIMERHDL_SHIFT) - 1)
#define HDL_INIT(Idx) ((Idx + 1) << TIMERHDL_SHIFT)
#define HDL_INC(Hdl) (((Hdl + 1) & TIMERHDL_MASK) \
| (Hdl & ~TIMERHDL_MASK))
//---------------------------------------------------------------------------
// modul global types
//---------------------------------------------------------------------------
typedef struct {
tEplTimerEventArg m_EventArg;
tEplTimerkCallback m_pfnCallback;
struct hrtimer m_Timer;
BOOL m_fContinuously;
unsigned long long m_ullPeriod;
} tEplTimerHighReskTimerInfo;
typedef struct {
tEplTimerHighReskTimerInfo m_aTimerInfo[TIMER_COUNT];
} tEplTimerHighReskInstance;
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
static tEplTimerHighReskInstance EplTimerHighReskInstance_l;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
enum hrtimer_restart EplTimerHighReskCallback(struct hrtimer *pTimer_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskInit()
//
// Description: initializes the high resolution timer module.
//
// Parameters: void
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplTimerHighReskInit(void)
{
tEplKernel Ret;
Ret = EplTimerHighReskAddInstance();
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskAddInstance()
//
// Description: initializes the high resolution timer module.
//
// Parameters: void
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplTimerHighReskAddInstance(void)
{
tEplKernel Ret;
unsigned int uiIndex;
Ret = kEplSuccessful;
EPL_MEMSET(&EplTimerHighReskInstance_l, 0,
sizeof(EplTimerHighReskInstance_l));
/*
* Initialize hrtimer structures for all usable timers.
*/
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++) {
tEplTimerHighReskTimerInfo *pTimerInfo;
struct hrtimer *pTimer;
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
pTimer = &pTimerInfo->m_Timer;
hrtimer_init(pTimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
pTimer->function = EplTimerHighReskCallback;
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskDelInstance()
//
// Description: shuts down the high resolution timer module.
//
// Parameters: void
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplTimerHighReskDelInstance(void)
{
tEplTimerHighReskTimerInfo *pTimerInfo;
tEplKernel Ret;
unsigned int uiIndex;
Ret = kEplSuccessful;
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++) {
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
pTimerInfo->m_pfnCallback = NULL;
pTimerInfo->m_EventArg.m_TimerHdl = 0;
/*
* In this case we can not just try to cancel the timer.
* We actually have to wait until its callback function
* has returned.
*/
hrtimer_cancel(&pTimerInfo->m_Timer);
}
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskModifyTimerNs()
//
// Description: modifies the timeout of the timer with the specified handle.
// If the handle the pointer points to is zero, the timer must
// be created first.
// If it is not possible to stop the old timer,
// this function always assures that the old timer does not
// trigger the callback function with the same handle as the new
// timer. That means the callback function must check the passed
// handle with the one returned by this function. If these are
// unequal, the call can be discarded.
//
// Parameters: pTimerHdl_p = pointer to timer handle
// ullTimeNs_p = relative timeout in [ns]
// pfnCallback_p = callback function, which is called mutual
// exclusive with the Edrv callback functions
// (Rx and Tx).
// ulArgument_p = user-specific argument
// fContinuously_p = if TRUE, callback function will be called
// continuously;
// otherwise, it is a oneshot timer.
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplTimerHighReskModifyTimerNs(tEplTimerHdl *pTimerHdl_p,
unsigned long long ullTimeNs_p,
tEplTimerkCallback pfnCallback_p,
unsigned long ulArgument_p,
BOOL fContinuously_p)
{
tEplKernel Ret;
unsigned int uiIndex;
tEplTimerHighReskTimerInfo *pTimerInfo;
ktime_t RelTime;
Ret = kEplSuccessful;
// check pointer to handle
if (pTimerHdl_p == NULL) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
if (*pTimerHdl_p == 0) { // no timer created yet
// search free timer info structure
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
for (uiIndex = 0; uiIndex < TIMER_COUNT;
uiIndex++, pTimerInfo++) {
if (pTimerInfo->m_EventArg.m_TimerHdl == 0) { // free structure found
break;
}
}
if (uiIndex >= TIMER_COUNT) { // no free structure found
Ret = kEplTimerNoTimerCreated;
goto Exit;
}
pTimerInfo->m_EventArg.m_TimerHdl = HDL_INIT(uiIndex);
} else {
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
if (uiIndex >= TIMER_COUNT) { // invalid handle
Ret = kEplTimerInvalidHandle;
goto Exit;
}
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
}
/*
* increment timer handle
* (if timer expires right after this statement, the user
* would detect an unknown timer handle and discard it)
*/
pTimerInfo->m_EventArg.m_TimerHdl =
HDL_INC(pTimerInfo->m_EventArg.m_TimerHdl);
*pTimerHdl_p = pTimerInfo->m_EventArg.m_TimerHdl;
// reject too small time values
if ((fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_CYCLE))
|| (!fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_SINGLE))) {
Ret = kEplTimerNoTimerCreated;
goto Exit;
}
pTimerInfo->m_EventArg.m_ulArg = ulArgument_p;
pTimerInfo->m_pfnCallback = pfnCallback_p;
pTimerInfo->m_fContinuously = fContinuously_p;
pTimerInfo->m_ullPeriod = ullTimeNs_p;
/*
* HRTIMER_MODE_REL does not influence general handling of this timer.
* It only sets relative mode for this start operation.
* -> Expire time is calculated by: Now + RelTime
* hrtimer_start also skips pending timer events.
* The state HRTIMER_STATE_CALLBACK is ignored.
* We have to cope with that in our callback function.
*/
RelTime = ktime_add_ns(ktime_set(0, 0), ullTimeNs_p);
hrtimer_start(&pTimerInfo->m_Timer, RelTime, HRTIMER_MODE_REL);
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskDeleteTimer()
//
// Description: deletes the timer with the specified handle. Afterward the
// handle is set to zero.
//
// Parameters: pTimerHdl_p = pointer to timer handle
//
// Return: tEplKernel = error code
//
// State: not tested
//
//---------------------------------------------------------------------------
tEplKernel EplTimerHighReskDeleteTimer(tEplTimerHdl *pTimerHdl_p)
{
tEplKernel Ret = kEplSuccessful;
unsigned int uiIndex;
tEplTimerHighReskTimerInfo *pTimerInfo;
// check pointer to handle
if (pTimerHdl_p == NULL) {
Ret = kEplTimerInvalidHandle;
goto Exit;
}
if (*pTimerHdl_p == 0) { // no timer created yet
goto Exit;
} else {
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
if (uiIndex >= TIMER_COUNT) { // invalid handle
Ret = kEplTimerInvalidHandle;
goto Exit;
}
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
if (pTimerInfo->m_EventArg.m_TimerHdl != *pTimerHdl_p) { // invalid handle
goto Exit;
}
}
*pTimerHdl_p = 0;
pTimerInfo->m_EventArg.m_TimerHdl = 0;
pTimerInfo->m_pfnCallback = NULL;
/*
* Three return cases of hrtimer_try_to_cancel have to be tracked:
* 1 - timer has been removed
* 0 - timer was not active
* We need not do anything. hrtimer timers just consist of
* a hrtimer struct, which we might enqueue in the hrtimers
* event list by calling hrtimer_start().
* If a timer is not enqueued, it is not present in hrtimers.
* -1 - callback function is running
* In this case we have to ensure that the timer is not
* continuously restarted. This has been done by clearing
* its handle.
*/
hrtimer_try_to_cancel(&pTimerInfo->m_Timer);
Exit:
return Ret;
}
//---------------------------------------------------------------------------
//
// Function: EplTimerHighReskCallback()
//
// Description: Callback function commonly used for all timers.
//
// Parameters: pTimer_p = pointer to hrtimer
//
// Return:
//
// State: not tested
//
//---------------------------------------------------------------------------
enum hrtimer_restart EplTimerHighReskCallback(struct hrtimer *pTimer_p)
{
unsigned int uiIndex;
tEplTimerHighReskTimerInfo *pTimerInfo;
tEplTimerHdl OrgTimerHdl;
enum hrtimer_restart Ret;
BENCHMARK_MOD_24_SET(4);
Ret = HRTIMER_NORESTART;
pTimerInfo =
container_of(pTimer_p, tEplTimerHighReskTimerInfo, m_Timer);
uiIndex = HDL_TO_IDX(pTimerInfo->m_EventArg.m_TimerHdl);
if (uiIndex >= TIMER_COUNT) { // invalid handle
goto Exit;
}
/*
* We store the timer handle before calling the callback function
* as the timer can be modified inside it.
*/
OrgTimerHdl = pTimerInfo->m_EventArg.m_TimerHdl;
if (pTimerInfo->m_pfnCallback != NULL) {
pTimerInfo->m_pfnCallback(&pTimerInfo->m_EventArg);
}
if (pTimerInfo->m_fContinuously) {
ktime_t Interval;
#ifdef PROVE_OVERRUN
ktime_t Now;
unsigned long Overruns;
#endif
if (OrgTimerHdl != pTimerInfo->m_EventArg.m_TimerHdl) {
/* modified timer has already been restarted */
goto Exit;
}
#ifdef PROVE_OVERRUN
Now = ktime_get();
Interval =
ktime_add_ns(ktime_set(0, 0), pTimerInfo->m_ullPeriod);
Overruns = hrtimer_forward(pTimer_p, Now, Interval);
if (Overruns > 1) {
printk
("EplTimerHighResk: Continuous timer (handle 0x%lX) had to skip %lu interval(s)!\n",
pTimerInfo->m_EventArg.m_TimerHdl, Overruns - 1);
}
#else
pTimer_p->expires = ktime_add_ns(pTimer_p->expires,
pTimerInfo->m_ullPeriod);
#endif
Ret = HRTIMER_RESTART;
}
Exit:
BENCHMARK_MOD_24_RESET(4);
return Ret;
}

View File

@ -1,348 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: Virtual Ethernet Driver for Linux
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: VirtualEthernetLinux.c,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/11/20 17:06:51 $
$State: Exp $
Build Environment:
-------------------------------------------------------------------------
Revision History:
2006/06/12 -ar: start of the implementation, version 1.00
2006/09/18 d.k.: integration into EPL DLLk module
ToDo:
void netif_carrier_off(struct net_device *dev);
void netif_carrier_on(struct net_device *dev);
****************************************************************************/
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/if_arp.h>
#include <net/arp.h>
#include <net/protocol.h>
#include <net/pkt_sched.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/mm.h>
#include <linux/types.h>
#include <linux/skbuff.h> /* for struct sk_buff */
#include "kernel/VirtualEthernet.h"
#include "kernel/EplDllkCal.h"
#include "kernel/EplDllk.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef EPL_VETH_TX_TIMEOUT
//#define EPL_VETH_TX_TIMEOUT (2*HZ)
#define EPL_VETH_TX_TIMEOUT 0 // d.k.: we use no timeout
#endif
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static struct net_device *pVEthNetDevice_g = NULL;
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static int VEthOpen(struct net_device *pNetDevice_p);
static int VEthClose(struct net_device *pNetDevice_p);
static int VEthXmit(struct sk_buff *pSkb_p, struct net_device *pNetDevice_p);
static struct net_device_stats *VEthGetStats(struct net_device *pNetDevice_p);
static void VEthTimeout(struct net_device *pNetDevice_p);
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
static int VEthOpen(struct net_device *pNetDevice_p)
{
tEplKernel Ret = kEplSuccessful;
//open the device
// struct net_device_stats* pStats = netdev_priv(pNetDevice_p);
//start the interface queue for the network subsystem
netif_start_queue(pNetDevice_p);
// register callback function in DLL
Ret = EplDllkRegAsyncHandler(VEthRecvFrame);
EPL_DBGLVL_VETH_TRACE1
("VEthOpen: EplDllkRegAsyncHandler returned 0x%02X\n", Ret);
return 0;
}
static int VEthClose(struct net_device *pNetDevice_p)
{
tEplKernel Ret = kEplSuccessful;
EPL_DBGLVL_VETH_TRACE0("VEthClose\n");
Ret = EplDllkDeregAsyncHandler(VEthRecvFrame);
//stop the interface queue for the network subsystem
netif_stop_queue(pNetDevice_p);
return 0;
}
static int VEthXmit(struct sk_buff *pSkb_p, struct net_device *pNetDevice_p)
{
tEplKernel Ret = kEplSuccessful;
tEplFrameInfo FrameInfo;
//transmit function
struct net_device_stats *pStats = netdev_priv(pNetDevice_p);
//save timestemp
pNetDevice_p->trans_start = jiffies;
FrameInfo.m_pFrame = (tEplFrame *) pSkb_p->data;
FrameInfo.m_uiFrameSize = pSkb_p->len;
//call send fkt on DLL
Ret = EplDllkCalAsyncSend(&FrameInfo, kEplDllAsyncReqPrioGeneric);
if (Ret != kEplSuccessful) {
EPL_DBGLVL_VETH_TRACE1
("VEthXmit: EplDllkCalAsyncSend returned 0x%02X\n", Ret);
netif_stop_queue(pNetDevice_p);
goto Exit;
} else {
EPL_DBGLVL_VETH_TRACE0("VEthXmit: frame passed to DLL\n");
dev_kfree_skb(pSkb_p);
//set stats for the device
pStats->tx_packets++;
pStats->tx_bytes += FrameInfo.m_uiFrameSize;
}
Exit:
return NETDEV_TX_OK;
}
static struct net_device_stats *VEthGetStats(struct net_device *pNetDevice_p)
{
EPL_DBGLVL_VETH_TRACE0("VEthGetStats\n");
return netdev_priv(pNetDevice_p);
}
static void VEthTimeout(struct net_device *pNetDevice_p)
{
EPL_DBGLVL_VETH_TRACE0("VEthTimeout(\n");
// $$$ d.k.: move to extra function, which is called by DLL when new space is available in TxFifo
if (netif_queue_stopped(pNetDevice_p)) {
netif_wake_queue(pNetDevice_p);
}
}
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p)
{
tEplKernel Ret = kEplSuccessful;
struct net_device *pNetDevice = pVEthNetDevice_g;
struct net_device_stats *pStats = netdev_priv(pNetDevice);
struct sk_buff *pSkb;
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: FrameSize=%u\n",
pFrameInfo_p->m_uiFrameSize);
pSkb = dev_alloc_skb(pFrameInfo_p->m_uiFrameSize + 2);
if (pSkb == NULL) {
pStats->rx_dropped++;
goto Exit;
}
pSkb->dev = pNetDevice;
skb_reserve(pSkb, 2);
memcpy((void *)skb_put(pSkb, pFrameInfo_p->m_uiFrameSize),
pFrameInfo_p->m_pFrame, pFrameInfo_p->m_uiFrameSize);
pSkb->protocol = eth_type_trans(pSkb, pNetDevice);
pSkb->ip_summed = CHECKSUM_UNNECESSARY;
// call netif_rx with skb
netif_rx(pSkb);
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: SrcMAC=0x%llx\n",
AmiGetQword48FromBe(pFrameInfo_p->m_pFrame->
m_be_abSrcMac));
// update receive statistics
pStats->rx_packets++;
pStats->rx_bytes += pFrameInfo_p->m_uiFrameSize;
Exit:
return Ret;
}
static const struct net_device_ops epl_netdev_ops = {
.ndo_open = VEthOpen,
.ndo_stop = VEthClose,
.ndo_get_stats = VEthGetStats,
.ndo_start_xmit = VEthXmit,
.ndo_tx_timeout = VEthTimeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
tEplKernel VEthAddInstance(tEplDllkInitParam *pInitParam_p)
{
tEplKernel Ret = kEplSuccessful;
// allocate net device structure with priv pointing to stats structure
pVEthNetDevice_g =
alloc_netdev(sizeof(struct net_device_stats), EPL_VETH_NAME,
ether_setup);
// pVEthNetDevice_g = alloc_etherdev(sizeof (struct net_device_stats));
if (pVEthNetDevice_g == NULL) {
Ret = kEplNoResource;
goto Exit;
}
pVEthNetDevice_g->netdev_ops = &epl_netdev_ops;
pVEthNetDevice_g->watchdog_timeo = EPL_VETH_TX_TIMEOUT;
pVEthNetDevice_g->destructor = free_netdev;
// copy own MAC address to net device structure
memcpy(pVEthNetDevice_g->dev_addr, pInitParam_p->m_be_abSrcMac, 6);
//register VEth to the network subsystem
if (register_netdev(pVEthNetDevice_g)) {
EPL_DBGLVL_VETH_TRACE0
("VEthAddInstance: Could not register VEth...\n");
} else {
EPL_DBGLVL_VETH_TRACE0
("VEthAddInstance: Register VEth successfull...\n");
}
Exit:
return Ret;
}
tEplKernel VEthDelInstance(void)
{
tEplKernel Ret = kEplSuccessful;
if (pVEthNetDevice_g != NULL) {
//unregister VEth from the network subsystem
unregister_netdev(pVEthNetDevice_g);
// destructor was set to free_netdev,
// so we do not need to call free_netdev here
pVEthNetDevice_g = NULL;
}
return Ret;
}
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)

View File

@ -1,861 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: Abstract Memory Interface for x86 compatible
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: amix86.c,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
...
-------------------------------------------------------------------------
Revision History:
r.s.: first implemetation
2006-06-13 d.k.: duplicate functions for little endian and big endian
****************************************************************************/
//#include "global.h"
//#include "EplAmi.h"
#include "EplInc.h"
//---------------------------------------------------------------------------
// typedef
//---------------------------------------------------------------------------
typedef struct {
u16 m_wWord;
} twStruct;
typedef struct {
u32 m_dwDword;
} tdwStruct;
typedef struct {
u64 m_qwQword;
} tqwStruct;
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function: AmiSetXXXToBe()
//
// Description: writes the specified value to the absolute address in
// big endian
//
// Parameters: pAddr_p = absolute address
// xXXXVal_p = value
//
// Returns: (none)
//
// State:
//
//---------------------------------------------------------------------------
//------------< write u8 in big endian >--------------------------
/*
void AmiSetByteToBe (void *pAddr_p, u8 bByteVal_p)
{
*(u8 *)pAddr_p = bByteVal_p;
}
*/
//------------< write u16 in big endian >--------------------------
void AmiSetWordToBe(void * pAddr_p, u16 wWordVal_p)
{
twStruct *pwStruct;
twStruct wValue;
wValue.m_wWord = (u16) ((wWordVal_p & 0x00FF) << 8); //LSB to MSB
wValue.m_wWord |= (u16) ((wWordVal_p & 0xFF00) >> 8); //MSB to LSB
pwStruct = (twStruct *) pAddr_p;
pwStruct->m_wWord = wValue.m_wWord;
}
//------------< write u32 in big endian >-------------------------
void AmiSetDwordToBe(void *pAddr_p, u32 dwDwordVal_p)
{
tdwStruct *pdwStruct;
tdwStruct dwValue;
dwValue.m_dwDword = ((dwDwordVal_p & 0x000000FF) << 24); //LSB to MSB
dwValue.m_dwDword |= ((dwDwordVal_p & 0x0000FF00) << 8);
dwValue.m_dwDword |= ((dwDwordVal_p & 0x00FF0000) >> 8);
dwValue.m_dwDword |= ((dwDwordVal_p & 0xFF000000) >> 24); //MSB to LSB
pdwStruct = (tdwStruct *) pAddr_p;
pdwStruct->m_dwDword = dwValue.m_dwDword;
}
//---------------------------------------------------------------------------
//
// Function: AmiSetXXXToLe()
//
// Description: writes the specified value to the absolute address in
// little endian
//
// Parameters: pAddr_p = absolute address
// xXXXVal_p = value
//
// Returns: (none)
//
// State:
//
//---------------------------------------------------------------------------
//------------< write u8 in little endian >--------------------------
/*
void AmiSetByteToLe (void *pAddr_p, u8 bByteVal_p)
{
*(u8 *)pAddr_p = bByteVal_p;
}
*/
//------------< write u16 in little endian >--------------------------
void AmiSetWordToLe(void *pAddr_p, u16 wWordVal_p)
{
twStruct *pwStruct;
pwStruct = (twStruct *) pAddr_p;
pwStruct->m_wWord = wWordVal_p;
}
//------------< write u32 in little endian >-------------------------
void AmiSetDwordToLe(void *pAddr_p, u32 dwDwordVal_p)
{
tdwStruct *pdwStruct;
pdwStruct = (tdwStruct *) pAddr_p;
pdwStruct->m_dwDword = dwDwordVal_p;
}
//---------------------------------------------------------------------------
//
// Function: AmiGetXXXFromBe()
//
// Description: reads the specified value from the absolute address in
// big endian
//
// Parameters: pAddr_p = absolute address
//
// Returns: XXX = value
//
// State:
//
//---------------------------------------------------------------------------
//------------< read u8 in big endian >---------------------------
/*
u8 AmiGetByteFromBe (void *pAddr_p)
{
return ( *(u8 *)pAddr_p );
}
*/
//------------< read u16 in big endian >---------------------------
u16 AmiGetWordFromBe(void *pAddr_p)
{
twStruct *pwStruct;
twStruct wValue;
pwStruct = (twStruct *) pAddr_p;
wValue.m_wWord = (u16) ((pwStruct->m_wWord & 0x00FF) << 8); //LSB to MSB
wValue.m_wWord |= (u16) ((pwStruct->m_wWord & 0xFF00) >> 8); //MSB to LSB
return (wValue.m_wWord);
}
//------------< read u32 in big endian >--------------------------
u32 AmiGetDwordFromBe(void *pAddr_p)
{
tdwStruct *pdwStruct;
tdwStruct dwValue;
pdwStruct = (tdwStruct *) pAddr_p;
dwValue.m_dwDword = ((pdwStruct->m_dwDword & 0x000000FF) << 24); //LSB to MSB
dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0x0000FF00) << 8);
dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0x00FF0000) >> 8);
dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0xFF000000) >> 24); //MSB to LSB
return (dwValue.m_dwDword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetXXXFromLe()
//
// Description: reads the specified value from the absolute address in
// little endian
//
// Parameters: pAddr_p = absolute address
//
// Returns: XXX = value
//
// State:
//
//---------------------------------------------------------------------------
//------------< read u8 in little endian >---------------------------
/*
u8 AmiGetByteFromLe (void *pAddr_p)
{
return ( *(u8 *)pAddr_p );
}
*/
//------------< read u16 in little endian >---------------------------
u16 AmiGetWordFromLe(void *pAddr_p)
{
twStruct *pwStruct;
pwStruct = (twStruct *) pAddr_p;
return (pwStruct->m_wWord);
}
//------------< read u32 in little endian >--------------------------
u32 AmiGetDwordFromLe(void *pAddr_p)
{
tdwStruct *pdwStruct;
pdwStruct = (tdwStruct *) pAddr_p;
return (pdwStruct->m_dwDword);
}
//---------------------------------------------------------------------------
//
// Function: AmiSetDword24ToBe()
//
// Description: sets a 24 bit value to a buffer in big endian
//
// Parameters: pAddr_p = pointer to destination buffer
// dwDwordVal_p = value to set
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetDword24ToBe(void *pAddr_p, u32 dwDwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & dwDwordVal_p)[2];
((u8 *) pAddr_p)[1] = ((u8 *) & dwDwordVal_p)[1];
((u8 *) pAddr_p)[2] = ((u8 *) & dwDwordVal_p)[0];
}
//---------------------------------------------------------------------------
//
// Function: AmiSetDword24ToLe()
//
// Description: sets a 24 bit value to a buffer in little endian
//
// Parameters: pAddr_p = pointer to destination buffer
// dwDwordVal_p = value to set
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetDword24ToLe(void *pAddr_p, u32 dwDwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & dwDwordVal_p)[0];
((u8 *) pAddr_p)[1] = ((u8 *) & dwDwordVal_p)[1];
((u8 *) pAddr_p)[2] = ((u8 *) & dwDwordVal_p)[2];
}
//---------------------------------------------------------------------------
//
// Function: AmiGetDword24FromBe()
//
// Description: reads a 24 bit value from a buffer in big endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u32 = read value
//
// State: not tested
//
//---------------------------------------------------------------------------
u32 AmiGetDword24FromBe(void *pAddr_p)
{
tdwStruct dwStruct;
dwStruct.m_dwDword = AmiGetDwordFromBe(pAddr_p);
dwStruct.m_dwDword >>= 8;
return (dwStruct.m_dwDword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetDword24FromLe()
//
// Description: reads a 24 bit value from a buffer in little endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u32 = read value
//
// State: not tested
//
//---------------------------------------------------------------------------
u32 AmiGetDword24FromLe(void *pAddr_p)
{
tdwStruct dwStruct;
dwStruct.m_dwDword = AmiGetDwordFromLe(pAddr_p);
dwStruct.m_dwDword &= 0x00FFFFFF;
return (dwStruct.m_dwDword);
}
//#ifdef USE_VAR64
//---------------------------------------------------------------------------
//
// Function: AmiSetQword64ToBe()
//
// Description: sets a 64 bit value to a buffer in big endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword64ToBe(void *pAddr_p, u64 qwQwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[7];
((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[6];
((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[5];
((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[4];
((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[3];
((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[2];
((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[1];
((u8 *) pAddr_p)[7] = ((u8 *) & qwQwordVal_p)[0];
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword64ToLe()
//
// Description: sets a 64 bit value to a buffer in little endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword64ToLe(void *pAddr_p, u64 qwQwordVal_p)
{
u64 *pqwDst;
pqwDst = (u64 *) pAddr_p;
*pqwDst = qwQwordVal_p;
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword64FromBe()
//
// Description: reads a 64 bit value from a buffer in big endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword64FromBe(void *pAddr_p)
{
tqwStruct qwStruct;
((u8 *) & qwStruct.m_qwQword)[0] = ((u8 *) pAddr_p)[7];
((u8 *) & qwStruct.m_qwQword)[1] = ((u8 *) pAddr_p)[6];
((u8 *) & qwStruct.m_qwQword)[2] = ((u8 *) pAddr_p)[5];
((u8 *) & qwStruct.m_qwQword)[3] = ((u8 *) pAddr_p)[4];
((u8 *) & qwStruct.m_qwQword)[4] = ((u8 *) pAddr_p)[3];
((u8 *) & qwStruct.m_qwQword)[5] = ((u8 *) pAddr_p)[2];
((u8 *) & qwStruct.m_qwQword)[6] = ((u8 *) pAddr_p)[1];
((u8 *) & qwStruct.m_qwQword)[7] = ((u8 *) pAddr_p)[0];
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword64FromLe()
//
// Description: reads a 64 bit value from a buffer in little endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword64FromLe(void *pAddr_p)
{
tqwStruct *pqwStruct;
tqwStruct qwStruct;
pqwStruct = (tqwStruct *) pAddr_p;
qwStruct.m_qwQword = pqwStruct->m_qwQword;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword40ToBe()
//
// Description: sets a 40 bit value to a buffer in big endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword40ToBe(void *pAddr_p, u64 qwQwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[4];
((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[3];
((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[2];
((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[1];
((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[0];
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword40ToLe()
//
// Description: sets a 40 bit value to a buffer in little endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword40ToLe(void *pAddr_p, u64 qwQwordVal_p)
{
((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[4];
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword40FromBe()
//
// Description: reads a 40 bit value from a buffer in big endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword40FromBe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
qwStruct.m_qwQword >>= 24;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword40FromLe()
//
// Description: reads a 40 bit value from a buffer in little endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword40FromLe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
qwStruct.m_qwQword &= 0x000000FFFFFFFFFFLL;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword48ToBe()
//
// Description: sets a 48 bit value to a buffer in big endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword48ToBe(void *pAddr_p, u64 qwQwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[5];
((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[4];
((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[3];
((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[2];
((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[1];
((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[0];
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword48ToLe()
//
// Description: sets a 48 bit value to a buffer in little endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword48ToLe(void *pAddr_p, u64 qwQwordVal_p)
{
((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
((u16 *) pAddr_p)[2] = ((u16 *) & qwQwordVal_p)[2];
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword48FromBe()
//
// Description: reads a 48 bit value from a buffer in big endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword48FromBe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
qwStruct.m_qwQword >>= 16;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword48FromLe()
//
// Description: reads a 48 bit value from a buffer in little endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword48FromLe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
qwStruct.m_qwQword &= 0x0000FFFFFFFFFFFFLL;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword56ToBe()
//
// Description: sets a 56 bit value to a buffer in big endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword56ToBe(void *pAddr_p, u64 qwQwordVal_p)
{
((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[6];
((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[5];
((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[4];
((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[3];
((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[2];
((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[1];
((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[0];
}
//---------------------------------------------------------------------------
//
// Function: AmiSetQword56ToLe()
//
// Description: sets a 56 bit value to a buffer in little endian
//
// Parameters: pAddr_p = pointer to destination buffer
// qwQwordVal_p = quadruple word value
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetQword56ToLe(void *pAddr_p, u64 qwQwordVal_p)
{
((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
((u16 *) pAddr_p)[2] = ((u16 *) & qwQwordVal_p)[2];
((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[6];
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword56FromBe()
//
// Description: reads a 56 bit value from a buffer in big endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword56FromBe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
qwStruct.m_qwQword >>= 8;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetQword56FromLe()
//
// Description: reads a 56 bit value from a buffer in little endian
//
// Parameters: pAddr_p = pointer to source buffer
//
// Return: u64
//
// State: not tested
//
//---------------------------------------------------------------------------
u64 AmiGetQword56FromLe(void *pAddr_p)
{
tqwStruct qwStruct;
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
qwStruct.m_qwQword &= 0x00FFFFFFFFFFFFFFLL;
return (qwStruct.m_qwQword);
}
//---------------------------------------------------------------------------
//
// Function: AmiSetTimeOfDay()
//
// Description: sets a TIME_OF_DAY (CANopen) value to a buffer
//
// Parameters: pAddr_p = pointer to destination buffer
// pTimeOfDay_p = pointer to struct TIME_OF_DAY
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiSetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p)
{
AmiSetDwordToLe(((u8 *) pAddr_p), pTimeOfDay_p->m_dwMs & 0x0FFFFFFF);
AmiSetWordToLe(((u8 *) pAddr_p) + 4, pTimeOfDay_p->m_wDays);
}
//---------------------------------------------------------------------------
//
// Function: AmiGetTimeOfDay()
//
// Description: reads a TIME_OF_DAY (CANopen) value from a buffer
//
// Parameters: pAddr_p = pointer to source buffer
// pTimeOfDay_p = pointer to struct TIME_OF_DAY
//
// Return: void
//
// State: not tested
//
//---------------------------------------------------------------------------
void AmiGetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p)
{
pTimeOfDay_p->m_dwMs = AmiGetDwordFromLe(((u8 *) pAddr_p)) & 0x0FFFFFFF;
pTimeOfDay_p->m_wDays = AmiGetWordFromLe(((u8 *) pAddr_p) + 4);
}
// EOF
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).

View File

@ -1,947 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: demoapplication for EPL MN (with SDO over UDP)
under Linux on X86 with RTL8139 Ethernet controller
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: demo_main.c,v $
$Author: D.Krueger $
$Revision: 1.10 $ $Date: 2008/11/19 18:11:43 $
$State: Exp $
Build Environment:
GCC
-------------------------------------------------------------------------
Revision History:
2006/09/01 d.k.: start of implementation
****************************************************************************/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/major.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include "Epl.h"
#include "proc_fs.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
// Metainformation
MODULE_LICENSE("Dual BSD/GPL");
#ifdef MODULE_AUTHOR
MODULE_AUTHOR("Daniel.Krueger@SYSTEC-electronic.com");
MODULE_DESCRIPTION("EPL MN demo");
#endif
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// TracePoint support for realtime-debugging
#ifdef _DBG_TRACE_POINTS_
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p);
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
#else
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
#endif
#define NODEID 0xF0 //=> MN
#define CYCLE_LEN 5000 // [us]
#define IP_ADDR 0xc0a86401 // 192.168.100.1
#define SUBNET_MASK 0xFFFFFF00 // 255.255.255.0
#define HOSTNAME "SYS TEC electronic EPL Stack "
#define IF_ETH EPL_VETH_NAME
// LIGHT EFFECT
#define DEFAULT_MAX_CYCLE_COUNT 20 // 6 is very fast
#define APP_DEFAULT_MODE 0x01
#define APP_LED_COUNT 5 // number of LEDs in one row
#define APP_LED_MASK ((1 << APP_LED_COUNT) - 1)
#define APP_DOUBLE_LED_MASK ((1 << (APP_LED_COUNT * 2)) - 1)
#define APP_MODE_COUNT 5
#define APP_MODE_MASK ((1 << APP_MODE_COUNT) - 1)
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// modul globale vars
//---------------------------------------------------------------------------
static const u8 abMacAddr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static u8 bVarIn1_l;
static u8 bVarOut1_l;
static u8 bVarOut1Old_l;
static u8 bModeSelect_l; // state of the pushbuttons to select the mode
static u8 bSpeedSelect_l; // state of the pushbuttons to increase/decrease the speed
static u8 bSpeedSelectOld_l; // old state of the pushbuttons
static u32 dwLeds_l; // current state of all LEDs
static u8 bLedsRow1_l; // current state of the LEDs in row 1
static u8 bLedsRow2_l; // current state of the LEDs in row 2
static u8 abSelect_l[3]; // pushbuttons from CNs
static u32 dwMode_l; // current mode
static int iCurCycleCount_l; // current cycle count
static int iMaxCycleCount_l; // maximum cycle count (i.e. number of cycles until next light movement step)
static int iToggle; // indicates the light movement direction
//static u8 abDomain_l[3000];
static wait_queue_head_t WaitQueueShutdown_g; // wait queue for tEplNmtEventSwitchOff
static atomic_t AtomicShutdown_g = ATOMIC_INIT(FALSE);
static u32 dw_le_CycleLen_g;
static uint uiNodeId_g = EPL_C_ADR_INVALID;
module_param_named(nodeid, uiNodeId_g, uint, 0);
static uint uiCycleLen_g = CYCLE_LEN;
module_param_named(cyclelen, uiCycleLen_g, uint, 0);
//---------------------------------------------------------------------------
// 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 EplObdInitRam(tEplObdInitParam *pInitParam_p);
tEplKernel AppCbEvent(tEplApiEventType EventType_p, // IN: event type (enum)
tEplApiEventArg *pEventArg_p, // IN: event argument (union)
void *pUserArg_p);
tEplKernel AppCbSync(void);
//---------------------------------------------------------------------------
// Kernel Module specific Data Structures
//---------------------------------------------------------------------------
//module_init(EplLinInit);
//module_exit(EplLinExit);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// Function:
//
// Description:
//
//
//
// Parameters:
//
//
// Returns:
//
//
// State:
//
//---------------------------------------------------------------------------
#if 0
static int __init EplLinInit(void)
{
tEplKernel EplRet;
int iRet;
static tEplApiInitParam EplApiInitParam = { 0 };
char *sHostname = HOSTNAME;
char *argv[4], *envp[3];
char sBuffer[16];
unsigned int uiVarEntries;
tEplObdSize ObdSize;
atomic_set(&AtomicShutdown_g, TRUE);
// get node ID from insmod command line
EplApiInitParam.m_uiNodeId = uiNodeId_g;
if (EplApiInitParam.m_uiNodeId == EPL_C_ADR_INVALID) { // invalid node ID set
// set default node ID
EplApiInitParam.m_uiNodeId = NODEID;
}
uiNodeId_g = EplApiInitParam.m_uiNodeId;
// calculate IP address
EplApiInitParam.m_dwIpAddress =
(0xFFFFFF00 & IP_ADDR) | EplApiInitParam.m_uiNodeId;
EplApiInitParam.m_fAsyncOnly = FALSE;
EplApiInitParam.m_uiSizeOfStruct = sizeof(EplApiInitParam);
EPL_MEMCPY(EplApiInitParam.m_abMacAddress, abMacAddr,
sizeof(EplApiInitParam.m_abMacAddress));
// EplApiInitParam.m_abMacAddress[5] = (u8) EplApiInitParam.m_uiNodeId;
EplApiInitParam.m_dwFeatureFlags = -1;
EplApiInitParam.m_dwCycleLen = uiCycleLen_g; // required for error detection
EplApiInitParam.m_uiIsochrTxMaxPayload = 100; // const
EplApiInitParam.m_uiIsochrRxMaxPayload = 100; // const
EplApiInitParam.m_dwPresMaxLatency = 50000; // const; only required for IdentRes
EplApiInitParam.m_uiPreqActPayloadLimit = 36; // required for initialisation (+28 bytes)
EplApiInitParam.m_uiPresActPayloadLimit = 36; // required for initialisation of Pres frame (+28 bytes)
EplApiInitParam.m_dwAsndMaxLatency = 150000; // const; only required for IdentRes
EplApiInitParam.m_uiMultiplCycleCnt = 0; // required for error detection
EplApiInitParam.m_uiAsyncMtu = 1500; // required to set up max frame size
EplApiInitParam.m_uiPrescaler = 2; // required for sync
EplApiInitParam.m_dwLossOfFrameTolerance = 500000;
EplApiInitParam.m_dwAsyncSlotTimeout = 3000000;
EplApiInitParam.m_dwWaitSocPreq = 150000;
EplApiInitParam.m_dwDeviceType = -1; // NMT_DeviceType_U32
EplApiInitParam.m_dwVendorId = -1; // NMT_IdentityObject_REC.VendorId_U32
EplApiInitParam.m_dwProductCode = -1; // NMT_IdentityObject_REC.ProductCode_U32
EplApiInitParam.m_dwRevisionNumber = -1; // NMT_IdentityObject_REC.RevisionNo_U32
EplApiInitParam.m_dwSerialNumber = -1; // NMT_IdentityObject_REC.SerialNo_U32
EplApiInitParam.m_dwSubnetMask = SUBNET_MASK;
EplApiInitParam.m_dwDefaultGateway = 0;
EPL_MEMCPY(EplApiInitParam.m_sHostname, sHostname,
sizeof(EplApiInitParam.m_sHostname));
// currently unset parameters left at default value 0
//EplApiInitParam.m_qwVendorSpecificExt1;
//EplApiInitParam.m_dwVerifyConfigurationDate; // CFM_VerifyConfiguration_REC.ConfDate_U32
//EplApiInitParam.m_dwVerifyConfigurationTime; // CFM_VerifyConfiguration_REC.ConfTime_U32
//EplApiInitParam.m_dwApplicationSwDate; // PDL_LocVerApplSw_REC.ApplSwDate_U32 on programmable device or date portion of NMT_ManufactSwVers_VS on non-programmable device
//EplApiInitParam.m_dwApplicationSwTime; // PDL_LocVerApplSw_REC.ApplSwTime_U32 on programmable device or time portion of NMT_ManufactSwVers_VS on non-programmable device
//EplApiInitParam.m_abVendorSpecificExt2[48];
// set callback functions
EplApiInitParam.m_pfnCbEvent = AppCbEvent;
EplApiInitParam.m_pfnCbSync = AppCbSync;
printk
("\n\n Hello, I'm a simple POWERLINK node running as %s!\n (build: %s / %s)\n\n",
(uiNodeId_g ==
EPL_C_ADR_MN_DEF_NODE_ID ? "Managing Node" : "Controlled Node"),
__DATE__, __TIME__);
// initialize the Linux a wait queue for shutdown of this module
init_waitqueue_head(&WaitQueueShutdown_g);
// initialize the procfs device
EplRet = EplLinProcInit();
if (EplRet != kEplSuccessful) {
goto Exit;
}
// initialize POWERLINK stack
EplRet = EplApiInitialize(&EplApiInitParam);
if (EplRet != kEplSuccessful) {
goto Exit;
}
// link process variables used by CN to object dictionary
ObdSize = sizeof(bVarIn1_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x6000, &bVarIn1_l, &uiVarEntries, &ObdSize, 0x01);
if (EplRet != kEplSuccessful) {
goto Exit;
}
ObdSize = sizeof(bVarOut1_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x6200, &bVarOut1_l, &uiVarEntries, &ObdSize,
0x01);
if (EplRet != kEplSuccessful) {
goto Exit;
}
// link process variables used by MN to object dictionary
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
ObdSize = sizeof(bLedsRow1_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x2000, &bLedsRow1_l, &uiVarEntries, &ObdSize,
0x01);
if (EplRet != kEplSuccessful) {
goto Exit;
}
ObdSize = sizeof(bLedsRow2_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x2000, &bLedsRow2_l, &uiVarEntries, &ObdSize,
0x02);
if (EplRet != kEplSuccessful) {
goto Exit;
}
ObdSize = sizeof(bSpeedSelect_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x2000, &bSpeedSelect_l, &uiVarEntries, &ObdSize,
0x03);
if (EplRet != kEplSuccessful) {
goto Exit;
}
ObdSize = sizeof(bSpeedSelectOld_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x2000, &bSpeedSelectOld_l, &uiVarEntries,
&ObdSize, 0x04);
if (EplRet != kEplSuccessful) {
goto Exit;
}
ObdSize = sizeof(abSelect_l[0]);
uiVarEntries = sizeof(abSelect_l);
EplRet =
EplApiLinkObject(0x2200, &abSelect_l[0], &uiVarEntries, &ObdSize,
0x01);
if (EplRet != kEplSuccessful) {
goto Exit;
}
#endif
// link a DOMAIN to object 0x6100, but do not exit, if it is missing
ObdSize = sizeof(abDomain_l);
uiVarEntries = 1;
EplRet =
EplApiLinkObject(0x6100, &abDomain_l, &uiVarEntries, &ObdSize,
0x00);
if (EplRet != kEplSuccessful) {
printk("EplApiLinkObject(0x6100): returns 0x%X\n", EplRet);
}
// reset old process variables
bVarOut1Old_l = 0;
bSpeedSelectOld_l = 0;
dwMode_l = APP_DEFAULT_MODE;
iMaxCycleCount_l = DEFAULT_MAX_CYCLE_COUNT;
// configure IP address of virtual network interface
// for TCP/IP communication over the POWERLINK network
sprintf(sBuffer, "%u.%u.%u.%u",
(EplApiInitParam.m_dwIpAddress >> 24),
((EplApiInitParam.m_dwIpAddress >> 16) & 0xFF),
((EplApiInitParam.m_dwIpAddress >> 8) & 0xFF),
(EplApiInitParam.m_dwIpAddress & 0xFF));
/* set up a minimal environment */
iRet = 0;
envp[iRet++] = "HOME=/";
envp[iRet++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
envp[iRet] = NULL;
/* set up the argument list */
iRet = 0;
argv[iRet++] = "/sbin/ifconfig";
argv[iRet++] = IF_ETH;
argv[iRet++] = sBuffer;
argv[iRet] = NULL;
/* call ifconfig to configure the virtual network interface */
iRet = call_usermodehelper(argv[0], argv, envp, 1);
printk("ifconfig %s %s returned %d\n", argv[1], argv[2], iRet);
// start the NMT state machine
EplRet = EplApiExecNmtCommand(kEplNmtEventSwReset);
atomic_set(&AtomicShutdown_g, FALSE);
Exit:
printk("EplLinInit(): returns 0x%X\n", EplRet);
return EplRet;
}
static void __exit EplLinExit(void)
{
tEplKernel EplRet;
// halt the NMT state machine
// so the processing of POWERLINK frames stops
EplRet = EplApiExecNmtCommand(kEplNmtEventSwitchOff);
// wait until NMT state machine is shut down
wait_event_interruptible(WaitQueueShutdown_g,
(atomic_read(&AtomicShutdown_g) == TRUE));
/* if ((iErr != 0) || (atomic_read(&AtomicShutdown_g) == EVENT_STATE_IOCTL))
{ // waiting was interrupted by signal or application called wrong function
EplRet = kEplShutdown;
}*/
// delete instance for all modules
EplRet = EplApiShutdown();
printk("EplApiShutdown(): 0x%X\n", EplRet);
// deinitialize proc fs
EplRet = EplLinProcFree();
printk("EplLinProcFree(): 0x%X\n", EplRet);
}
#endif
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
// //
//=========================================================================//
//---------------------------------------------------------------------------
//
// 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 AppCbEvent(tEplApiEventType EventType_p, // IN: event type (enum)
tEplApiEventArg *pEventArg_p, // IN: event argument (union)
void *pUserArg_p)
{
tEplKernel EplRet = kEplSuccessful;
// check if NMT_GS_OFF is reached
switch (EventType_p) {
case kEplApiEventNmtStateChange:
{
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;
printk
("AppCbEvent(kEplNmtGsOff) originating event = 0x%X\n",
pEventArg_p->m_NmtStateChange.
m_NmtEvent);
// wake up EplLinExit()
atomic_set(&AtomicShutdown_g, TRUE);
wake_up_interruptible
(&WaitQueueShutdown_g);
break;
}
case kEplNmtGsResetCommunication:
{
u32 dwBuffer;
// configure OD for MN in state ResetComm after reseting the OD
// TODO: setup your own network configuration here
dwBuffer = (EPL_NODEASSIGN_NODE_IS_CN | EPL_NODEASSIGN_NODE_EXISTS); // 0x00000003L
EplRet =
EplApiWriteLocalObject(0x1F81, 0x01,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x02,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x03,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x04,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x05,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x06,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x07,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x08,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x20,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0xFE,
&dwBuffer,
4);
EplRet =
EplApiWriteLocalObject(0x1F81, 0x6E,
&dwBuffer,
4);
// dwBuffer |= EPL_NODEASSIGN_MANDATORY_CN; // 0x0000000BL
// EplRet = EplApiWriteLocalObject(0x1F81, 0x6E, &dwBuffer, 4);
dwBuffer = (EPL_NODEASSIGN_MN_PRES | EPL_NODEASSIGN_NODE_EXISTS); // 0x00010001L
EplRet =
EplApiWriteLocalObject(0x1F81, 0xF0,
&dwBuffer,
4);
// continue
}
case kEplNmtGsResetConfiguration:
{
unsigned int uiSize;
// fetch object 0x1006 NMT_CycleLen_U32 from local OD (in little endian byte order)
// for configuration of remote CN
uiSize = 4;
EplRet =
EplApiReadObject(NULL, 0, 0x1006,
0x00,
&dw_le_CycleLen_g,
&uiSize,
kEplSdoTypeAsnd,
NULL);
if (EplRet != kEplSuccessful) { // local OD access failed
break;
}
// continue
}
case kEplNmtMsPreOperational1:
{
printk
("AppCbEvent(0x%X) originating event = 0x%X\n",
pEventArg_p->m_NmtStateChange.
m_NewNmtState,
pEventArg_p->m_NmtStateChange.
m_NmtEvent);
// continue
}
case kEplNmtGsInitialising:
case kEplNmtGsResetApplication:
case kEplNmtMsNotActive:
case kEplNmtCsNotActive:
case kEplNmtCsPreOperational1:
{
break;
}
case kEplNmtCsOperational:
case kEplNmtMsOperational:
{
break;
}
default:
{
break;
}
}
/*
switch (pEventArg_p->m_NmtStateChange.m_NmtEvent)
{
case kEplNmtEventSwReset:
case kEplNmtEventResetNode:
case kEplNmtEventResetCom:
case kEplNmtEventResetConfig:
case kEplNmtEventInternComError:
case kEplNmtEventNmtCycleError:
{
printk("AppCbEvent(0x%X) originating event = 0x%X\n",
pEventArg_p->m_NmtStateChange.m_NewNmtState,
pEventArg_p->m_NmtStateChange.m_NmtEvent);
break;
}
default:
{
break;
}
}
*/
break;
}
case kEplApiEventCriticalError:
case kEplApiEventWarning:
{ // error or warning occured within the stack or the application
// on error the API layer stops the NMT state machine
printk
("AppCbEvent(Err/Warn): Source=%02X EplError=0x%03X",
pEventArg_p->m_InternalError.m_EventSource,
pEventArg_p->m_InternalError.m_EplError);
// check additional argument
switch (pEventArg_p->m_InternalError.m_EventSource) {
case kEplEventSourceEventk:
case kEplEventSourceEventu:
{ // error occured within event processing
// either in kernel or in user part
printk(" OrgSource=%02X\n",
pEventArg_p->m_InternalError.
m_Arg.m_EventSource);
break;
}
case kEplEventSourceDllk:
{ // error occured within the data link layer (e.g. interrupt processing)
// the u32 argument contains the DLL state and the NMT event
printk(" val=%X\n",
pEventArg_p->m_InternalError.
m_Arg.m_dwArg);
break;
}
default:
{
printk("\n");
break;
}
}
break;
}
case kEplApiEventNode:
{
// printk("AppCbEvent(Node): Source=%02X EplError=0x%03X", pEventArg_p->m_InternalError.m_EventSource, pEventArg_p->m_InternalError.m_EplError);
// check additional argument
switch (pEventArg_p->m_Node.m_NodeEvent) {
case kEplNmtNodeEventCheckConf:
{
tEplSdoComConHdl SdoComConHdl;
// update object 0x1006 on CN
EplRet =
EplApiWriteObject(&SdoComConHdl,
pEventArg_p->
m_Node.m_uiNodeId,
0x1006, 0x00,
&dw_le_CycleLen_g,
4,
kEplSdoTypeAsnd,
NULL);
if (EplRet == kEplApiTaskDeferred) { // SDO transfer started
EplRet = kEplReject;
} else if (EplRet == kEplSuccessful) { // local OD access (should not occur)
printk
("AppCbEvent(Node) write to local OD\n");
} else { // error occured
TGT_DBG_SIGNAL_TRACE_POINT(1);
EplRet =
EplApiFreeSdoChannel
(SdoComConHdl);
SdoComConHdl = 0;
EplRet =
EplApiWriteObject
(&SdoComConHdl,
pEventArg_p->m_Node.
m_uiNodeId, 0x1006, 0x00,
&dw_le_CycleLen_g, 4,
kEplSdoTypeAsnd, NULL);
if (EplRet == kEplApiTaskDeferred) { // SDO transfer started
EplRet = kEplReject;
} else {
printk
("AppCbEvent(Node): EplApiWriteObject() returned 0x%02X\n",
EplRet);
}
}
break;
}
default:
{
break;
}
}
break;
}
case kEplApiEventSdo:
{ // SDO transfer finished
EplRet =
EplApiFreeSdoChannel(pEventArg_p->m_Sdo.
m_SdoComConHdl);
if (EplRet != kEplSuccessful) {
break;
}
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
if (pEventArg_p->m_Sdo.m_SdoComConState == kEplSdoComTransferFinished) { // continue boot-up of CN with NMT command Reset Configuration
EplRet =
EplApiMnTriggerStateChange(pEventArg_p->
m_Sdo.m_uiNodeId,
kEplNmtNodeCommandConfReset);
} else { // indicate configuration error CN
EplRet =
EplApiMnTriggerStateChange(pEventArg_p->
m_Sdo.m_uiNodeId,
kEplNmtNodeCommandConfErr);
}
#endif
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 AppCbSync(void)
{
tEplKernel EplRet = kEplSuccessful;
if (bVarOut1Old_l != bVarOut1_l) { // output variable has changed
bVarOut1Old_l = bVarOut1_l;
// set LEDs
// printk("bVarIn = 0x%02X bVarOut = 0x%02X\n", (u16) bVarIn_l, (u16) bVarOut_l);
}
if (uiNodeId_g != EPL_C_ADR_MN_DEF_NODE_ID) {
bVarIn1_l++;
}
if (uiNodeId_g == EPL_C_ADR_MN_DEF_NODE_ID) { // we are the master and must run the control loop
// collect inputs from CNs and own input
bSpeedSelect_l = (bVarIn1_l | abSelect_l[0]) & 0x07;
bModeSelect_l = abSelect_l[1] | abSelect_l[2];
if ((bModeSelect_l & APP_MODE_MASK) != 0) {
dwMode_l = bModeSelect_l & APP_MODE_MASK;
}
iCurCycleCount_l--;
if (iCurCycleCount_l <= 0) {
if ((dwMode_l & 0x01) != 0) { // fill-up
if (iToggle) {
if ((dwLeds_l & APP_DOUBLE_LED_MASK) ==
0x00) {
dwLeds_l = 0x01;
} else {
dwLeds_l <<= 1;
dwLeds_l++;
if (dwLeds_l >=
APP_DOUBLE_LED_MASK) {
iToggle = 0;
}
}
} else {
dwLeds_l <<= 1;
if ((dwLeds_l & APP_DOUBLE_LED_MASK) ==
0x00) {
iToggle = 1;
}
}
bLedsRow1_l =
(unsigned char)(dwLeds_l & APP_LED_MASK);
bLedsRow2_l =
(unsigned char)((dwLeds_l >> APP_LED_COUNT)
& APP_LED_MASK);
}
else if ((dwMode_l & 0x02) != 0) { // running light forward
dwLeds_l <<= 1;
if ((dwLeds_l > APP_DOUBLE_LED_MASK)
|| (dwLeds_l == 0x00000000L)) {
dwLeds_l = 0x01;
}
bLedsRow1_l =
(unsigned char)(dwLeds_l & APP_LED_MASK);
bLedsRow2_l =
(unsigned char)((dwLeds_l >> APP_LED_COUNT)
& APP_LED_MASK);
}
else if ((dwMode_l & 0x04) != 0) { // running light backward
dwLeds_l >>= 1;
if ((dwLeds_l > APP_DOUBLE_LED_MASK)
|| (dwLeds_l == 0x00000000L)) {
dwLeds_l = 1 << (APP_LED_COUNT * 2);
}
bLedsRow1_l =
(unsigned char)(dwLeds_l & APP_LED_MASK);
bLedsRow2_l =
(unsigned char)((dwLeds_l >> APP_LED_COUNT)
& APP_LED_MASK);
}
else if ((dwMode_l & 0x08) != 0) { // Knightrider
if (bLedsRow1_l == 0x00) {
bLedsRow1_l = 0x01;
iToggle = 1;
} else if (iToggle) {
bLedsRow1_l <<= 1;
if (bLedsRow1_l >=
(1 << (APP_LED_COUNT - 1))) {
iToggle = 0;
}
} else {
bLedsRow1_l >>= 1;
if (bLedsRow1_l <= 0x01) {
iToggle = 1;
}
}
bLedsRow2_l = bLedsRow1_l;
}
else if ((dwMode_l & 0x10) != 0) { // Knightrider
if ((bLedsRow1_l == 0x00)
|| (bLedsRow2_l == 0x00)
|| ((bLedsRow2_l & ~APP_LED_MASK) != 0)) {
bLedsRow1_l = 0x01;
bLedsRow2_l =
(1 << (APP_LED_COUNT - 1));
iToggle = 1;
} else if (iToggle) {
bLedsRow1_l <<= 1;
bLedsRow2_l >>= 1;
if (bLedsRow1_l >=
(1 << (APP_LED_COUNT - 1))) {
iToggle = 0;
}
} else {
bLedsRow1_l >>= 1;
bLedsRow2_l <<= 1;
if (bLedsRow1_l <= 0x01) {
iToggle = 1;
}
}
}
// set own output
bVarOut1_l = bLedsRow1_l;
// bVarOut1_l = (bLedsRow1_l & 0x03) | (bLedsRow2_l << 2);
// restart cycle counter
iCurCycleCount_l = iMaxCycleCount_l;
}
if (bSpeedSelectOld_l == 0) {
if ((bSpeedSelect_l & 0x01) != 0) {
if (iMaxCycleCount_l < 200) {
iMaxCycleCount_l++;
}
bSpeedSelectOld_l = bSpeedSelect_l;
} else if ((bSpeedSelect_l & 0x02) != 0) {
if (iMaxCycleCount_l > 1) {
iMaxCycleCount_l--;
}
bSpeedSelectOld_l = bSpeedSelect_l;
} else if ((bSpeedSelect_l & 0x04) != 0) {
iMaxCycleCount_l = DEFAULT_MAX_CYCLE_COUNT;
bSpeedSelectOld_l = bSpeedSelect_l;
}
} else if (bSpeedSelect_l == 0) {
bSpeedSelectOld_l = 0;
}
}
TGT_DBG_SIGNAL_TRACE_POINT(1);
return EplRet;
}
// EOF

View File

@ -1,167 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: interface for ethernetdriver
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: edrv.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
Dev C++ and GNU-Compiler for m68k
-------------------------------------------------------------------------
Revision History:
2005/08/01 m.b.: start of implementation
****************************************************************************/
#ifndef _EDRV_H_
#define _EDRV_H_
#include "EplInc.h"
#include "EplFrame.h"
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
// --------------------------------------------------------------------------
#define MAX_ETH_DATA_SIZE 1500
#define MIN_ETH_DATA_SIZE 46
#define ETH_HDR_OFFSET 0 // Ethernet header at the top of the frame
#define ETH_HDR_SIZE 14 // size of Ethernet header
#define MIN_ETH_SIZE (MIN_ETH_DATA_SIZE + ETH_HDR_SIZE) // without CRC
#define ETH_CRC_SIZE 4 // size of Ethernet CRC, i.e. FCS
//---------------------------------------------------------------------------
// types
//---------------------------------------------------------------------------
// position of a buffer in an ethernet-frame
typedef enum {
kEdrvBufferFirstInFrame = 0x01, // first data buffer in an ethernet frame
kEdrvBufferMiddleInFrame = 0x02, // a middle data buffer in an ethernet frame
kEdrvBufferLastInFrame = 0x04 // last data buffer in an ethernet frame
} tEdrvBufferInFrame;
// format of a tx-buffer
typedef struct _tEdrvTxBuffer {
tEplMsgType m_EplMsgType; // IN: type of EPL message, set by calling function
unsigned int m_uiTxMsgLen; // IN: length of message to be send (set for each transmit call)
// ----------------------
unsigned int m_uiBufferNumber; // OUT: number of the buffer, set by ethernetdriver
u8 *m_pbBuffer; // OUT: pointer to the buffer, set by ethernetdriver
tEplNetTime m_NetTime; // OUT: Timestamp of end of transmission, set by ethernetdriver
// ----------------------
unsigned int m_uiMaxBufferLen; // IN/OUT: maximum length of the buffer
} tEdrvTxBuffer;
// format of a rx-buffer
typedef struct _tEdrvRxBuffer {
tEdrvBufferInFrame m_BufferInFrame; // OUT position of received buffer in an ethernet-frame
unsigned int m_uiRxMsgLen; // OUT: length of received buffer (without CRC)
u8 *m_pbBuffer; // OUT: pointer to the buffer, set by ethernetdriver
tEplNetTime m_NetTime; // OUT: Timestamp of end of receiption
} tEdrvRxBuffer;
//typedef void (*tEdrvRxHandler) (u8 bBufferInFrame_p, tBufferDescr * pbBuffer_p);
//typedef void (*tEdrvRxHandler) (u8 bBufferInFrame_p, u8 * pbEthernetData_p, u16 wDataLen_p);
typedef void (*tEdrvRxHandler) (tEdrvRxBuffer * pRxBuffer_p);
typedef void (*tEdrvTxHandler) (tEdrvTxBuffer * pTxBuffer_p);
// format of init structure
typedef struct {
u8 m_abMyMacAddr[6]; // the own MAC address
// u8 m_bNoOfRxBuffDescr; // number of entries in rx bufferdescriptor table
// tBufferDescr * m_pRxBuffDescrTable; // rx bufferdescriptor table
// u16 m_wRxBufferSize; // size of the whole rx buffer
tEdrvRxHandler m_pfnRxHandler;
tEdrvTxHandler m_pfnTxHandler;
} tEdrvInitParam;
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
tEplKernel EdrvInit(tEdrvInitParam * pEdrvInitParam_p);
tEplKernel EdrvShutdown(void);
tEplKernel EdrvDefineRxMacAddrEntry(u8 * pbMacAddr_p);
tEplKernel EdrvUndefineRxMacAddrEntry(u8 * pbMacAddr_p);
//tEplKernel EdrvDefineUnicastEntry (u8 * pbUCEntry_p);
//tEplKernel EdrvUndfineUnicastEntry (u8 * pbUCEntry_p);
tEplKernel EdrvAllocTxMsgBuffer(tEdrvTxBuffer * pBuffer_p);
tEplKernel EdrvReleaseTxMsgBuffer(tEdrvTxBuffer * pBuffer_p);
//tEplKernel EdrvWriteMsg (tBufferDescr * pbBuffer_p);
tEplKernel EdrvSendTxMsg(tEdrvTxBuffer * pBuffer_p);
tEplKernel EdrvTxMsgReady(tEdrvTxBuffer * pBuffer_p);
tEplKernel EdrvTxMsgStart(tEdrvTxBuffer * pBuffer_p);
//tEplKernel EdrvReadMsg (void);
// interrupt handler called by target specific interrupt handler
void EdrvInterruptHandler(void);
#endif // #ifndef _EDRV_H_

View File

@ -1,144 +0,0 @@
/****************************************************************************
global project definition file
12.06.1998 -rs
11.02.2002 r.d. Erweiterungen, Ergaenzungen
20.08.2002 SYS TEC electronic -as
Definition Schluesselwort 'GENERIC'
fuer das Erzeugen von Generic Pointer
28.08.2002 r.d. erweiterter SYS TEC Debug Code
16.09.2002 r.d. komplette Uebersetzung in Englisch
11.04.2003 f.j. Ergaenzung fuer Mitsubishi NC30 Compiler
17.06.2003 -rs Definition von Basistypen in <#ifndef _WINDEF_> gesetzt
16.04.2004 r.d. Ergaenzung fuer Borland C++ Builder
30.08.2004 -rs TRACE5 eingefügt
23.12.2005 d.k. Definitions for IAR compiler
$Id: global.h,v 1.6 2008/11/07 13:55:56 D.Krueger Exp $
****************************************************************************/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#define TRACE printk
// --- logic types ---
#ifndef BOOL
#define BOOL unsigned char
#endif
// --- alias types ---
#ifndef TRUE
#define TRUE 0xFF
#endif
#ifndef FALSE
#define FALSE 0x00
#endif
#ifndef _TIME_OF_DAY_DEFINED_
typedef struct {
unsigned long int m_dwMs;
unsigned short int m_wDays;
} tTimeOfDay;
#define _TIME_OF_DAY_DEFINED_
#endif
//---------------------------------------------------------------------------
// Definition von TRACE
//---------------------------------------------------------------------------
#ifndef NDEBUG
#ifndef TRACE0
#define TRACE0(p0) TRACE(p0)
#endif
#ifndef TRACE1
#define TRACE1(p0, p1) TRACE(p0, p1)
#endif
#ifndef TRACE2
#define TRACE2(p0, p1, p2) TRACE(p0, p1, p2)
#endif
#ifndef TRACE3
#define TRACE3(p0, p1, p2, p3) TRACE(p0, p1, p2, p3)
#endif
#ifndef TRACE4
#define TRACE4(p0, p1, p2, p3, p4) TRACE(p0, p1, p2, p3, p4)
#endif
#ifndef TRACE5
#define TRACE5(p0, p1, p2, p3, p4, p5) TRACE(p0, p1, p2, p3, p4, p5)
#endif
#ifndef TRACE6
#define TRACE6(p0, p1, p2, p3, p4, p5, p6) TRACE(p0, p1, p2, p3, p4, p5, p6)
#endif
#else
#ifndef TRACE0
#define TRACE0(p0)
#endif
#ifndef TRACE1
#define TRACE1(p0, p1)
#endif
#ifndef TRACE2
#define TRACE2(p0, p1, p2)
#endif
#ifndef TRACE3
#define TRACE3(p0, p1, p2, p3)
#endif
#ifndef TRACE4
#define TRACE4(p0, p1, p2, p3, p4)
#endif
#ifndef TRACE5
#define TRACE5(p0, p1, p2, p3, p4, p5)
#endif
#ifndef TRACE6
#define TRACE6(p0, p1, p2, p3, p4, p5, p6)
#endif
#endif
//---------------------------------------------------------------------------
// definition of ASSERT
//---------------------------------------------------------------------------
#ifndef ASSERT
#define ASSERT(p)
#endif
//---------------------------------------------------------------------------
// SYS TEC extensions
//---------------------------------------------------------------------------
// This macro doesn't print out C-file and line number of the failed assertion
// but a string, which exactly names the mistake.
#ifndef NDEBUG
#define ASSERTMSG(expr,string) if (!(expr)) {\
PRINTF0 ("Assertion failed: " string );\
while (1);}
#else
#define ASSERTMSG(expr,string)
#endif
//---------------------------------------------------------------------------
#endif // #ifndef _GLOBAL_H_
// Please keep an empty line at the end of this file.

View File

@ -1,153 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernelspace DLL module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDllk.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/08 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLLK_H_
#define _EPL_DLLK_H_
#include "../EplDll.h"
#include "../EplEvent.h"
typedef tEplKernel(*tEplDllkCbAsync) (tEplFrameInfo * pFrameInfo_p);
typedef struct {
u8 m_be_abSrcMac[6];
} tEplDllkInitParam;
// forward declaration
struct _tEdrvTxBuffer;
struct _tEplDllkNodeInfo {
struct _tEplDllkNodeInfo *m_pNextNodeInfo;
struct _tEdrvTxBuffer *m_pPreqTxBuffer;
unsigned int m_uiNodeId;
u32 m_dwPresTimeout;
unsigned long m_ulDllErrorEvents;
tEplNmtState m_NmtState;
u16 m_wPresPayloadLimit;
u8 m_be_abMacAddr[6];
u8 m_bSoaFlag1;
BOOL m_fSoftDelete; // delete node after error and ignore error
};
typedef struct _tEplDllkNodeInfo tEplDllkNodeInfo;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
tEplKernel EplDllkAddInstance(tEplDllkInitParam * pInitParam_p);
tEplKernel EplDllkDelInstance(void);
// called before NMT_GS_COMMUNICATING will be entered to configure fixed parameters
tEplKernel EplDllkConfig(tEplDllConfigParam * pDllConfigParam_p);
// set identity of local node (may be at any time, e.g. in case of hostname change)
tEplKernel EplDllkSetIdentity(tEplDllIdentParam * pDllIdentParam_p);
// process internal events and do work that cannot be done in interrupt-context
tEplKernel EplDllkProcess(tEplEvent * pEvent_p);
// registers handler for non-EPL frames
tEplKernel EplDllkRegAsyncHandler(tEplDllkCbAsync pfnDllkCbAsync_p);
// deregisters handler for non-EPL frames
tEplKernel EplDllkDeregAsyncHandler(tEplDllkCbAsync pfnDllkCbAsync_p);
// register C_DLL_MULTICAST_ASND in ethernet driver if any AsndServiceId is registered
tEplKernel EplDllkSetAsndServiceIdFilter(tEplDllAsndServiceId ServiceId_p,
tEplDllAsndFilter Filter_p);
// creates the buffer for a Tx frame and registers it to the ethernet driver
tEplKernel EplDllkCreateTxFrame(unsigned int *puiHandle_p,
tEplFrame ** ppFrame_p,
unsigned int *puiFrameSize_p,
tEplMsgType MsgType_p,
tEplDllAsndServiceId ServiceId_p);
tEplKernel EplDllkDeleteTxFrame(unsigned int uiHandle_p);
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplKernel EplDllkAddNode(tEplDllNodeInfo * pNodeInfo_p);
tEplKernel EplDllkDeleteNode(unsigned int uiNodeId_p);
tEplKernel EplDllkSoftDeleteNode(unsigned int uiNodeId_p);
tEplKernel EplDllkSetFlag1OfNode(unsigned int uiNodeId_p, u8 bSoaFlag1_p);
tEplKernel EplDllkGetFirstNodeInfo(tEplDllkNodeInfo ** ppNodeInfo_p);
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
#endif // #ifndef _EPL_DLLK_H_

View File

@ -1,129 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernelspace DLL Communication Abstraction Layer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDllkCal.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/11/13 17:13:09 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/13 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLLKCAL_H_
#define _EPL_DLLKCAL_H_
#include "../EplDll.h"
#include "../EplEvent.h"
typedef struct {
unsigned long m_ulCurTxFrameCountGen;
unsigned long m_ulCurTxFrameCountNmt;
unsigned long m_ulCurRxFrameCount;
unsigned long m_ulMaxTxFrameCountGen;
unsigned long m_ulMaxTxFrameCountNmt;
unsigned long m_ulMaxRxFrameCount;
} tEplDllkCalStatistics;
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
tEplKernel EplDllkCalAddInstance(void);
tEplKernel EplDllkCalDelInstance(void);
tEplKernel EplDllkCalAsyncGetTxCount(tEplDllAsyncReqPriority * pPriority_p,
unsigned int *puiCount_p);
tEplKernel EplDllkCalAsyncGetTxFrame(void *pFrame_p,
unsigned int *puiFrameSize_p,
tEplDllAsyncReqPriority Priority_p);
// only frames with registered AsndServiceIds are passed to CAL
tEplKernel EplDllkCalAsyncFrameReceived(tEplFrameInfo * pFrameInfo_p);
tEplKernel EplDllkCalAsyncSend(tEplFrameInfo * pFrameInfo_p,
tEplDllAsyncReqPriority Priority_p);
tEplKernel EplDllkCalAsyncClearBuffer(void);
tEplKernel EplDllkCalGetStatistics(tEplDllkCalStatistics ** ppStatistics);
tEplKernel EplDllkCalProcess(tEplEvent * pEvent_p);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplKernel EplDllkCalAsyncClearQueues(void);
tEplKernel EplDllkCalIssueRequest(tEplDllReqServiceId Service_p,
unsigned int uiNodeId_p, u8 bSoaFlag1_p);
tEplKernel EplDllkCalAsyncGetSoaRequest(tEplDllReqServiceId * pReqServiceId_p,
unsigned int *puiNodeId_p);
tEplKernel EplDllkCalAsyncSetPendingRequests(unsigned int uiNodeId_p,
tEplDllAsyncReqPriority
AsyncReqPrio_p,
unsigned int uiCount_p);
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
#endif // #ifndef _EPL_DLLKCAL_H_

View File

@ -1,88 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernel error handler module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplErrorHandlerk.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/10/02 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_ERRORHANDLERK_H_
#define _EPL_ERRORHANDLERK_H_
#include "../EplEvent.h"
// init function
tEplKernel EplErrorHandlerkInit(void);
// add instance
tEplKernel EplErrorHandlerkAddInstance(void);
// delete instance
tEplKernel EplErrorHandlerkDelInstance(void);
// processes error events
tEplKernel EplErrorHandlerkProcess(tEplEvent *pEvent_p);
#endif // #ifndef _EPL_ERRORHANDLERK_H_

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernel event module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplEventk.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/12 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_EVENTK_H_
#define _EPL_EVENTK_H_
#include "../EplEvent.h"
// init function
tEplKernel EplEventkInit(tEplSyncCb fpSyncCb);
// add instance
tEplKernel EplEventkAddInstance(tEplSyncCb fpSyncCb);
// delete instance
tEplKernel EplEventkDelInstance(void);
// Kernelthread that dispatches events in kernelspace
tEplKernel EplEventkProcess(tEplEvent *pEvent_p);
// post events from kernelspace
tEplKernel EplEventkPost(tEplEvent *pEvent_p);
// post errorevents from kernelspace
tEplKernel EplEventkPostError(tEplEventSource EventSource_p,
tEplKernel EplError_p,
unsigned int uiArgSize_p, void *pArg_p);
#endif // #ifndef _EPL_EVENTK_H_

View File

@ -1,90 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for NMT-Kernelspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtk.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMTK_H_
#define _EPLNMTK_H_
#include "../EplNmt.h"
#include "EplEventk.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
tEplKernel EplNmtkInit(EPL_MCO_DECL_PTR_INSTANCE_PTR);
tEplKernel EplNmtkAddInstance(EPL_MCO_DECL_PTR_INSTANCE_PTR);
tEplKernel EplNmtkDelInstance(EPL_MCO_DECL_PTR_INSTANCE_PTR);
tEplKernel EplNmtkProcess(EPL_MCO_DECL_PTR_INSTANCE_PTR_ tEplEvent *pEvent_p);
tEplNmtState EplNmtkGetNmtState(EPL_MCO_DECL_PTR_INSTANCE_PTR);
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
#endif // #ifndef _EPLNMTK_H_

View File

@ -1,156 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for Epl-Obd-Kernel-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObdk.h,v $
$Author: D.Krueger $
$Revision: 1.8 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLOBDK_H_
#define _EPLOBDK_H_
#include "../EplObd.h"
extern u8 abEplObdTrashObject_g[8];
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
// ---------------------------------------------------------------------
tEplKernel EplObdInit(EPL_MCO_DECL_PTR_INSTANCE_PTR_ tEplObdInitParam *pInitParam_p);
// ---------------------------------------------------------------------
tEplKernel EplObdAddInstance(EPL_MCO_DECL_PTR_INSTANCE_PTR_ tEplObdInitParam *pInitParam_p);
// ---------------------------------------------------------------------
tEplKernel EplObdDeleteInstance(EPL_MCO_DECL_INSTANCE_PTR);
// ---------------------------------------------------------------------
tEplKernel EplObdWriteEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p);
// ---------------------------------------------------------------------
tEplKernel EplObdReadEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p, tEplObdSize *pSize_p);
// ---------------------------------------------------------------------
tEplKernel EplObdSetStoreLoadObjCallback(EPL_MCO_DECL_INSTANCE_PTR_ tEplObdStoreLoadObjCallback fpCallback_p);
// ---------------------------------------------------------------------
tEplKernel EplObdAccessOdPart(EPL_MCO_DECL_INSTANCE_PTR_ tEplObdPart ObdPart_p,
tEplObdDir Direction_p);
// ---------------------------------------------------------------------
tEplKernel EplObdDefineVar(EPL_MCO_DECL_INSTANCE_PTR_ tEplVarParam *pVarParam_p);
// ---------------------------------------------------------------------
void *EplObdGetObjectDataPtr(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p);
// ---------------------------------------------------------------------
tEplKernel EplObdRegisterUserOd(EPL_MCO_DECL_INSTANCE_PTR_ tEplObdEntryPtr pUserOd_p);
// ---------------------------------------------------------------------
void EplObdInitVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ tEplObdVarEntry *pVarEntry_p,
tEplObdType Type_p, tEplObdSize ObdSize_p);
// ---------------------------------------------------------------------
tEplObdSize EplObdGetDataSize(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p);
// ---------------------------------------------------------------------
unsigned int EplObdGetNodeId(EPL_MCO_DECL_INSTANCE_PTR);
// ---------------------------------------------------------------------
tEplKernel EplObdSetNodeId(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiNodeId_p,
tEplObdNodeIdType NodeIdType_p);
// ---------------------------------------------------------------------
tEplKernel EplObdIsNumerical(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p, BOOL *pfEntryNumerical);
// ---------------------------------------------------------------------
tEplKernel EplObdWriteEntryFromLe(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p,
tEplObdSize Size_p);
// ---------------------------------------------------------------------
tEplKernel EplObdReadEntryToLe(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p);
// ---------------------------------------------------------------------
tEplKernel EplObdGetAccessType(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
tEplObdAccess *pAccessTyp_p);
// ---------------------------------------------------------------------
tEplKernel EplObdSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubindex_p,
tEplObdVarEntry **ppVarEntry_p);
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
#endif // #ifndef _EPLOBDK_H_

View File

@ -1,98 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernel PDO module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdok.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/06/23 14:56:33 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_PDOK_H_
#define _EPL_PDOK_H_
#include "../EplPdo.h"
#include "../EplEvent.h"
#include "../EplDll.h"
// process events from queue (PDOs/frames and SoA for synchronization)
tEplKernel EplPdokProcess(tEplEvent * pEvent_p);
// copies RPDO to event queue for processing
// is called by DLL in NMT_CS_READY_TO_OPERATE and NMT_CS_OPERATIONAL
// PDO needs not to be valid
tEplKernel EplPdokCbPdoReceived(tEplFrameInfo * pFrameInfo_p);
// posts pointer and size of TPDO to event queue
// is called by DLL in NMT_CS_PRE_OPERATIONAL_2,
// NMT_CS_READY_TO_OPERATE and NMT_CS_OPERATIONAL
tEplKernel EplPdokCbPdoTransmitted(tEplFrameInfo * pFrameInfo_p);
// posts SoA event to queue
tEplKernel EplPdokCbSoa(tEplFrameInfo * pFrameInfo_p);
tEplKernel EplPdokAddInstance(void);
tEplKernel EplPdokDelInstance(void);
#endif // #ifndef _EPL_PDOK_H_

View File

@ -1,86 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernel PDO Communication Abstraction Layer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdokCal.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/26 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_PDOKCAL_H_
#define _EPL_PDOKCAL_H_
#include "../EplInc.h"
tEplKernel EplPdokCalAddInstance(void);
tEplKernel EplPdokCalDelInstance(void);
// sets flag for validity of TPDOs in shared memory
tEplKernel EplPdokCalSetTpdosValid(BOOL fValid_p);
// gets flag for validity of TPDOs from shared memory
tEplKernel EplPdokCalAreTpdosValid(BOOL * pfValid_p);
#endif // #ifndef _EPL_PDOKCAL_H_

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL high resolution Timermodule
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplTimerHighResk.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/09/29 d.k.: start of the implementation
****************************************************************************/
#ifndef _EPLTIMERHIGHRESK_H_
#define _EPLTIMERHIGHRESK_H_
#include "../EplTimer.h"
tEplKernel EplTimerHighReskInit(void);
tEplKernel EplTimerHighReskAddInstance(void);
tEplKernel EplTimerHighReskDelInstance(void);
tEplKernel EplTimerHighReskSetTimerNs(tEplTimerHdl *pTimerHdl_p,
unsigned long long ullTimeNs_p,
tEplTimerkCallback pfnCallback_p,
unsigned long ulArgument_p,
BOOL fContinuously_p);
tEplKernel EplTimerHighReskModifyTimerNs(tEplTimerHdl *pTimerHdl_p,
unsigned long long ullTimeNs_p,
tEplTimerkCallback pfnCallback_p,
unsigned long ulArgument_p,
BOOL fContinuously_p);
tEplKernel EplTimerHighReskDeleteTimer(tEplTimerHdl *pTimerHdl_p);
#endif // #ifndef _EPLTIMERHIGHRESK_H_

View File

@ -1,108 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for EPL Kernel-Timermodule
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplTimerk.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/07/06 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLTIMERK_H_
#define _EPLTIMERK_H_
#include "../EplTimer.h"
#include "../user/EplEventu.h"
#if EPL_TIMER_USE_USER != FALSE
#include "../user/EplTimeru.h"
#endif
#if EPL_TIMER_USE_USER != FALSE
#define EplTimerkInit EplTimeruInit
#define EplTimerkAddInstance EplTimeruAddInstance
#define EplTimerkDelInstance EplTimeruDelInstance
#define EplTimerkSetTimerMs EplTimeruSetTimerMs
#define EplTimerkModifyTimerMs EplTimeruModifyTimerMs
#define EplTimerkDeleteTimer EplTimeruDeleteTimer
#endif
#if EPL_TIMER_USE_USER == FALSE
tEplKernel EplTimerkInit(void);
tEplKernel EplTimerkAddInstance(void);
tEplKernel EplTimerkDelInstance(void);
tEplKernel EplTimerkSetTimerMs(tEplTimerHdl *pTimerHdl_p,
unsigned long ulTime_p,
tEplTimerArg Argument_p);
tEplKernel EplTimerkModifyTimerMs(tEplTimerHdl *pTimerHdl_p,
unsigned long ulTime_p,
tEplTimerArg Argument_p);
tEplKernel EplTimerkDeleteTimer(tEplTimerHdl *pTimerHdl_p);
#endif
#endif // #ifndef _EPLTIMERK_H_

View File

@ -1,84 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for virtual ethernet driver module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: VirtualEthernet.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
KEIL uVision 2
-------------------------------------------------------------------------
Revision History:
2006/09/19 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_VETH_H_
#define _EPL_VETH_H_
#include "EplDllk.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
tEplKernel VEthAddInstance(tEplDllkInitParam *pInitParam_p);
tEplKernel VEthDelInstance(void);
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
#endif // #ifndef _EPL_VETH_H_

View File

@ -1,410 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: proc fs entry with diagnostic information under Linux
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: proc_fs.c,v $
$Author: D.Krueger $
$Revision: 1.13 $ $Date: 2008/11/07 13:55:56 $
$State: Exp $
Build Environment:
GNU
-------------------------------------------------------------------------
Revision History:
2006/07/31 d.k.: start of implementation
****************************************************************************/
#include "kernel/EplNmtk.h"
#include "user/EplNmtu.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
#include "user/EplNmtMnu.h"
#endif
#include "kernel/EplDllkCal.h"
//#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/major.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#ifdef CONFIG_COLDFIRE
#include <asm/coldfire.h>
#include "fec.h"
#endif
#include "proc_fs.h"
/***************************************************************************/
/* */
/* */
/* G L O B A L D E F I N I T I O N S */
/* */
/* */
/***************************************************************************/
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
#ifndef EPL_PROC_DEV_NAME
#define EPL_PROC_DEV_NAME "epl"
#endif
#ifndef DBG_TRACE_POINTS
#define DBG_TRACE_POINTS 23 // # of supported debug trace points
#endif
#ifndef DBG_TRACE_VALUES
#define DBG_TRACE_VALUES 24 // # of supported debug trace values (size of circular buffer)
#endif
//---------------------------------------------------------------------------
// modul global types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// local vars
//---------------------------------------------------------------------------
#ifdef _DBG_TRACE_POINTS_
atomic_t aatmDbgTracePoint_l[DBG_TRACE_POINTS];
u32 adwDbgTraceValue_l[DBG_TRACE_VALUES];
u32 dwDbgTraceValueOld_l;
unsigned int uiDbgTraceValuePos_l;
spinlock_t spinlockDbgTraceValue_l;
unsigned long ulDbTraceValueFlags_l;
#endif
//---------------------------------------------------------------------------
// local function prototypes
//---------------------------------------------------------------------------
static int EplLinProcRead(char *pcBuffer_p, char **ppcStart_p, off_t Offset_p,
int nBufferSize_p, int *pEof_p, void *pData_p);
static int EplLinProcWrite(struct file *file, const char __user * buffer,
unsigned long count, void *data);
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p);
void TgtDbgPostTraceValue(u32 dwTraceValue_p);
extern u32 EplIdentuGetRunningRequests(void);
//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//
tEplKernel EplLinProcInit(void)
{
struct proc_dir_entry *pProcDirEntry;
pProcDirEntry = create_proc_entry(EPL_PROC_DEV_NAME, S_IRUGO, NULL);
if (pProcDirEntry != NULL) {
pProcDirEntry->read_proc = EplLinProcRead;
pProcDirEntry->write_proc = EplLinProcWrite;
pProcDirEntry->data = NULL; // device number or something else
} else {
return kEplNoResource;
}
#ifdef _DBG_TRACE_POINTS_
// initialize spinlock and circular buffer position
spin_lock_init(&spinlockDbgTraceValue_l);
uiDbgTraceValuePos_l = 0;
dwDbgTraceValueOld_l = 0;
#endif
return kEplSuccessful;
}
tEplKernel EplLinProcFree(void)
{
remove_proc_entry(EPL_PROC_DEV_NAME, NULL);
return kEplSuccessful;
}
//---------------------------------------------------------------------------
// Target specific event signaling (FEC Tx-/Rx-Interrupt, used by Edrv)
//---------------------------------------------------------------------------
#ifdef _DBG_TRACE_POINTS_
void TgtDbgSignalTracePoint(u8 bTracePointNumber_p)
{
if (bTracePointNumber_p >=
ARRAY_SIZE(aatmDbgTracePoint_l)) {
goto Exit;
}
atomic_inc(&aatmDbgTracePoint_l[bTracePointNumber_p]);
Exit:
return;
}
void TgtDbgPostTraceValue(u32 dwTraceValue_p)
{
spin_lock_irqsave(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
if (dwDbgTraceValueOld_l != dwTraceValue_p) {
adwDbgTraceValue_l[uiDbgTraceValuePos_l] = dwTraceValue_p;
uiDbgTraceValuePos_l =
(uiDbgTraceValuePos_l + 1) % DBG_TRACE_VALUES;
dwDbgTraceValueOld_l = dwTraceValue_p;
}
spin_unlock_irqrestore(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
return;
}
#endif
//---------------------------------------------------------------------------
// Read function for PROC-FS read access
//---------------------------------------------------------------------------
static int EplLinProcRead(char *pcBuffer_p,
char **ppcStart_p,
off_t Offset_p,
int nBufferSize_p, int *pEof_p, void *pData_p)
{
int nSize;
int Eof;
tEplDllkCalStatistics *pDllkCalStats;
nSize = 0;
Eof = 0;
// count calls of this function
#ifdef _DBG_TRACE_POINTS_
TgtDbgSignalTracePoint(0);
#endif
//---------------------------------------------------------------
// generate static information
//---------------------------------------------------------------
// ---- Driver information ----
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"%s %s (c) 2006 %s\n",
EPL_PRODUCT_NAME, EPL_PRODUCT_VERSION,
EPL_PRODUCT_MANUFACTURER);
//---------------------------------------------------------------
// generate process information
//---------------------------------------------------------------
// ---- EPL state ----
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"NMT state: 0x%04X\n",
(u16) EplNmtkGetNmtState());
EplDllkCalGetStatistics(&pDllkCalStats);
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"CurAsyncTxGen=%lu CurAsyncTxNmt=%lu CurAsyncRx=%lu\nMaxAsyncTxGen=%lu MaxAsyncTxNmt=%lu MaxAsyncRx=%lu\n",
pDllkCalStats->m_ulCurTxFrameCountGen,
pDllkCalStats->m_ulCurTxFrameCountNmt,
pDllkCalStats->m_ulCurRxFrameCount,
pDllkCalStats->m_ulMaxTxFrameCountGen,
pDllkCalStats->m_ulMaxTxFrameCountNmt,
pDllkCalStats->m_ulMaxRxFrameCount);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
// fetch running IdentRequests
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"running IdentRequests: 0x%08X\n",
EplIdentuGetRunningRequests());
// fetch state of NmtMnu module
{
unsigned int uiMandatorySlaveCount;
unsigned int uiSignalSlaveCount;
u16 wFlags;
EplNmtMnuGetDiagnosticInfo(&uiMandatorySlaveCount,
&uiSignalSlaveCount, &wFlags);
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"MN MandSlaveCount: %u SigSlaveCount: %u Flags: 0x%X\n",
uiMandatorySlaveCount, uiSignalSlaveCount,
wFlags);
}
#endif
// ---- FEC state ----
#ifdef CONFIG_COLDFIRE
{
// Receive the base address
unsigned long base_addr;
#if (EDRV_USED_ETH_CTRL == 0)
// Set the base address of FEC0
base_addr = FEC_BASE_ADDR_FEC0;
#else
// Set the base address of FEC1
base_addr = FEC_BASE_ADDR_FEC1;
#endif
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"FEC_ECR = 0x%08X FEC_EIR = 0x%08X FEC_EIMR = 0x%08X\nFEC_TCR = 0x%08X FECTFSR = 0x%08X FECRFSR = 0x%08X\n",
FEC_ECR(base_addr), FEC_EIR(base_addr),
FEC_EIMR(base_addr), FEC_TCR(base_addr),
FEC_FECTFSR(base_addr),
FEC_FECRFSR(base_addr));
}
#endif
// ---- DBG: TracePoints ----
#ifdef _DBG_TRACE_POINTS_
{
int nNum;
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"DbgTracePoints:\n");
for (nNum = 0;
nNum < ARRAY_SIZE(aatmDbgTracePoint_l);
nNum++) {
nSize +=
snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
" TracePoint[%2d]: %d\n", (int)nNum,
atomic_read(&aatmDbgTracePoint_l[nNum]));
}
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"DbgTraceValues:\n");
for (nNum = 0; nNum < DBG_TRACE_VALUES; nNum++) {
if (nNum == uiDbgTraceValuePos_l) { // next value will be stored at that position
nSize +=
snprintf(pcBuffer_p + nSize,
nBufferSize_p - nSize, "*%08lX",
adwDbgTraceValue_l[nNum]);
} else {
nSize +=
snprintf(pcBuffer_p + nSize,
nBufferSize_p - nSize, " %08lX",
adwDbgTraceValue_l[nNum]);
}
if ((nNum & 0x00000007) == 0x00000007) { // 8 values printed -> end of line reached
nSize +=
snprintf(pcBuffer_p + nSize,
nBufferSize_p - nSize, "\n");
}
}
if ((nNum & 0x00000007) != 0x00000007) { // number of values printed is not a multiple of 8 -> print new line
nSize +=
snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
"\n");
}
}
#endif
Eof = 1;
goto Exit;
Exit:
*pEof_p = Eof;
return (nSize);
}
//---------------------------------------------------------------------------
// Write function for PROC-FS write access
//---------------------------------------------------------------------------
static int EplLinProcWrite(struct file *file, const char __user * buffer,
unsigned long count, void *data)
{
char abBuffer[count + 1];
int iErr;
int iVal = 0;
tEplNmtEvent NmtEvent;
if (count > 0) {
iErr = copy_from_user(abBuffer, buffer, count);
if (iErr != 0) {
return count;
}
abBuffer[count] = '\0';
iErr = sscanf(abBuffer, "%i", &iVal);
}
if ((iVal <= 0) || (iVal > 0x2F)) {
NmtEvent = kEplNmtEventSwReset;
} else {
NmtEvent = (tEplNmtEvent) iVal;
}
// execute specified NMT command on write access of /proc/epl
EplNmtuNmtEvent(NmtEvent);
return count;
}

View File

@ -1,89 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: interface for proc fs entry under Linux
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: proc_fs.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:33 $
$State: Exp $
Build Environment:
GNU
-------------------------------------------------------------------------
Revision History:
2006/07/31 d.k.: start of implementation
****************************************************************************/
#ifndef _EPLPROCFS_H_
#define _EPLPROCFS_H_
//---------------------------------------------------------------------------
// const defines
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// types
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// function prototypes
//---------------------------------------------------------------------------
tEplKernel EplLinProcInit(void);
tEplKernel EplLinProcFree(void);
#endif // #ifndef _EPLPROCFS_H_

View File

@ -1,276 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for Epl Configuration Manager Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplCfgMau.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
VC7
-------------------------------------------------------------------------
Revision History:
2006/07/14 k.t.: start of the implementation
-> based on CANopen CfgMa-Modul (CANopen version 5.34)
****************************************************************************/
#ifndef _EPLCFGMA_H_
#define _EPLCFGMA_H_
#include "../EplInc.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_CFGMA)) != 0)
#include "EplObdu.h"
#include "EplSdoComu.h"
//define max number of timeouts for configuration of 1 device
#define EPL_CFGMA_MAX_TIMEOUT 3
//callbackfunction, called if configuration is finished
typedef void (* tfpEplCfgMaCb)(unsigned int uiNodeId_p,
tEplKernel Errorstate_p);
//State for configuartion manager Statemachine
typedef enum {
// general states
kEplCfgMaIdle = 0x0000, // Configurationsprocess
// is idle
kEplCfgMaWaitForSdocEvent = 0x0001, // wait until the last
// SDOC is finisched
kEplCfgMaSkipMappingSub0 = 0x0002, // write Sub0 of mapping
// parameter with 0
kEplCfgMaFinished = 0x0004 // configuartion is finished
} tEplCfgState;
typedef enum {
kEplCfgMaDcfTypSystecSeg = 0x00,
kEplCfgMaDcfTypConDcf = 0x01,
kEplCfgMaDcfTypDcf = 0x02, // not supported
kEplCfgMaDcfTypXdc = 0x03 // not supported
} tEplCfgMaDcfTyp;
typedef enum {
kEplCfgMaCommon = 0, // all other index
kEplCfgMaPdoComm = 1, // communication index
kEplCfgMaPdoMapp = 2, // mapping index
kEplCfgMaPdoCommAfterMapp = 3, // write PDO Cob-Id after mapping subindex 0(set PDO valid)
} tEplCfgMaIndexType;
//bitcoded answer about the last sdo transfer saved in m_SdocState
// also used to singal start of the State Maschine
typedef enum {
kEplCfgMaSdocBusy = 0x00, // SDOC activ
kEplCfgMaSdocReady = 0x01, // SDOC finished
kEplCfgMaSdocTimeout = 0x02, // SDOC Timeout
kEplCfgMaSdocAbortReceived = 0x04, // SDOC Abort, see Abortcode
kEplCfgMaSdocStart = 0x08 // start State Mschine
} tEplSdocState;
//internal structure (instancetable for modul configuration manager)
typedef struct {
tEplCfgState m_CfgState; // state of the configuration state maschine
tEplSdoComConHdl m_SdoComConHdl; // handle for sdo connection
u32 m_dwLastAbortCode;
unsigned int m_uiLastIndex; // last index of configuration, to compair with actual index
u8 *m_pbConcise; // Ptr to concise DCF
u8 *m_pbActualIndex; // Ptr to actual index in the DCF segment
tfpEplCfgMaCb m_pfnCfgMaCb; // Ptr to CfgMa Callback, is call if configuration finished
tEplKernel m_EplKernelError; // errorcode
u32 m_dwNumValueCopy; // numeric values are copied in this variable
unsigned int m_uiPdoNodeId; // buffer for PDO node id
u8 m_bNrOfMappedObject; // number of mapped objects
unsigned int m_uiNodeId; // Epl node addresse
tEplSdocState m_SdocState; // bitcoded state of the SDO transfer
unsigned int m_uiLastSubIndex; // last subindex of configuration
BOOL m_fOneTranferOk; // atleased one transfer was successful
u8 m_bEventFlag; // for Eventsignaling to the State Maschine
u32 m_dwCntObjectInDcf; // number of Objects in DCF
tEplCfgMaIndexType m_SkipCfg; // TRUE if a adsitional Configurationprocess
// have to insert e.g. PDO-mapping
u16 m_wTimeOutCnt; // Timeout Counter, break configuration is
// m_wTimeOutCnt == CFGMA_MAX_TIMEOUT
} tEplCfgMaNode;
//---------------------------------------------------------------------------
// Function: EplCfgMaInit()
//
// Description: Function creates first instance of Configuration Manager
//
// Parameters:
//
// Returns: tEplKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaInit(void);
//---------------------------------------------------------------------------
// Function: EplCfgMaAddInstance()
//
// Description: Function creates additional instance of Configuration Manager
//
// Parameters:
//
// Returns: tEplKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaAddInstance(void);
//---------------------------------------------------------------------------
// Function: EplCfgMaDelInstance()
//
// Description: Function delete instance of Configuration Manager
//
// Parameters:
//
// Returns: tEplKernel = error code
//---------------------------------------------------------------------------
tEplKernel plCfgMaDelInstance(void);
//---------------------------------------------------------------------------
// Function: EplCfgMaStartConfig()
//
// Description: Function starts the configuration process
// initialization the statemachine for CfgMa- process
//
// Parameters: uiNodeId_p = NodeId of the node to configure
// pbConcise_p = pointer to DCF
// fpCfgMaCb_p = pointer to callback function (should not be NULL)
// SizeOfConcise_p = size of DCF in u8 -> for future use
// DcfType_p = type of the DCF
//
// Returns: tCopKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaStartConfig(unsigned int uiNodeId_p,
u8 * pbConcise_p,
tfpEplCfgMaCb fpCfgMaCb_p,
tEplObdSize SizeOfConcise_p,
tEplCfgMaDcfTyp DcfType_p);
//---------------------------------------------------------------------------
// Function: CfgMaStartConfigurationNode()
//
// Description: Function started the configuration process
// with the DCF from according OD-entry Subindex == bNodeId_p
//
// Parameters: uiNodeId_p = NodeId of the node to configure
// fpCfgMaCb_p = pointer to callback function (should not be NULL)
// DcfType_p = type of the DCF
//
// Returns: tCopKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaStartConfigNode(unsigned int uiNodeId_p,
tfpEplCfgMaCb fpCfgMaCb_p,
tEplCfgMaDcfTyp DcfType_p);
//---------------------------------------------------------------------------
// Function: EplCfgMaStartConfigNodeDcf()
//
// Description: Function starts the configuration process
// and links the configuration data to the OD
//
// Parameters: uiNodeId_p = NodeId of the node to configure
// pbConcise_p = pointer to DCF
// fpCfgMaCb_p = pointer to callback function (should not be NULL)
// SizeOfConcise_p = size of DCF in u8 -> for future use
// DcfType_p = type of the DCF
//
// Returns: tCopKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaStartConfigNodeDcf(unsigned int uiNodeId_p,
u8 * pbConcise_p,
tfpEplCfgMaCb fpCfgMaCb_p,
tEplObdSize SizeOfConcise_p,
tEplCfgMaDcfTyp DcfType_p);
//---------------------------------------------------------------------------
// Function: EplCfgMaLinkDcf()
//
// Description: Function links the configuration data to the OD
//
// Parameters: uiNodeId_p = NodeId of the node to configure
// pbConcise_p = pointer to DCF
// SizeOfConcise_p = size of DCF in u8 -> for future use
// DcfType_p = type of the DCF
//
// Returns: tCopKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaLinkDcf(unsigned int uiNodeId_p,
u8 * pbConcise_p,
tEplObdSize SizeOfConcise_p,
tEplCfgMaDcfTyp DcfType_p);
//---------------------------------------------------------------------------
// Function: EplCfgMaCheckDcf()
//
// Description: Function check if there is allready a configuration file linked
// to the OD (type is given by DcfType_p)
//
// Parameters: uiNodeId_p = NodeId
// DcfType_p = type of the DCF
//
// Returns: tCopKernel = error code
//---------------------------------------------------------------------------
tEplKernel EplCfgMaCheckDcf(unsigned int uiNodeId_p, tEplCfgMaDcfTyp DcfType_p);
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_CFGMA)) != 0)
#endif // _EPLCFGMA_H_
// EOF

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for userspace DLL module for asynchronous communication
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDllu.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLLU_H_
#define _EPL_DLLU_H_
#include "../EplDll.h"
typedef tEplKernel(* tEplDlluCbAsnd) (tEplFrameInfo * pFrameInfo_p);
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
tEplKernel EplDlluAddInstance(void);
tEplKernel EplDlluDelInstance(void);
tEplKernel EplDlluRegAsndService(tEplDllAsndServiceId ServiceId_p,
tEplDlluCbAsnd pfnDlluCbAsnd_p,
tEplDllAsndFilter Filter_p);
tEplKernel EplDlluAsyncSend(tEplFrameInfo * pFrameInfo_p,
tEplDllAsyncReqPriority Priority_p);
// processes asynch frames
tEplKernel EplDlluProcess(tEplFrameInfo * pFrameInfo_p);
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
#endif // #ifndef _EPL_DLLU_H_

View File

@ -1,106 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for DLL Communication Abstraction Layer module in EPL user part
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplDlluCal.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/20 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_DLLUCAL_H_
#define _EPL_DLLUCAL_H_
#include "../EplDll.h"
#include "../EplEvent.h"
typedef tEplKernel(* tEplDlluCbAsnd) (tEplFrameInfo * pFrameInfo_p);
tEplKernel EplDlluCalAddInstance(void);
tEplKernel EplDlluCalDelInstance(void);
tEplKernel EplDlluCalRegAsndService(tEplDllAsndServiceId ServiceId_p,
tEplDlluCbAsnd pfnDlluCbAsnd_p,
tEplDllAsndFilter Filter_p);
tEplKernel EplDlluCalAsyncSend(tEplFrameInfo * pFrameInfo,
tEplDllAsyncReqPriority Priority_p);
tEplKernel EplDlluCalProcess(tEplEvent * pEvent_p);
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplKernel EplDlluCalAddNode(tEplDllNodeInfo * pNodeInfo_p);
tEplKernel EplDlluCalDeleteNode(unsigned int uiNodeId_p);
tEplKernel EplDlluCalSoftDeleteNode(unsigned int uiNodeId_p);
tEplKernel EplDlluCalIssueRequest(tEplDllReqServiceId Service_p,
unsigned int uiNodeId_p, u8 bSoaFlag1_p);
#endif
#endif // #ifndef _EPL_DLLUCAL_H_

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for kernel event module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplEventu.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/12 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_EVENTU_H_
#define _EPL_EVENTU_H_
#include "../EplEvent.h"
// init function
tEplKernel EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p);
// add instance
tEplKernel EplEventuAddInstance(tEplProcessEventCb pfnApiProcessEventCb_p);
// delete instance
tEplKernel EplEventuDelInstance(void);
// Task that dispatches events in userspace
tEplKernel EplEventuProcess(tEplEvent * pEvent_p);
// post events from userspace
tEplKernel EplEventuPost(tEplEvent * pEvent_p);
// post errorevents from userspace
tEplKernel EplEventuPostError(tEplEventSource EventSource_p,
tEplKernel EplError_p,
unsigned int uiArgSize_p, void *pArg_p);
#endif // #ifndef _EPL_EVENTU_H_

View File

@ -1,94 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for Identu-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplIdentu.h,v $
$Author: D.Krueger $
$Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/11/15 d.k.: start of the implementation
****************************************************************************/
#ifndef _EPLIDENTU_H_
#define _EPLIDENTU_H_
#include "../EplDll.h"
typedef tEplKernel(* tEplIdentuCbResponse) (unsigned int uiNodeId_p,
tEplIdentResponse *
pIdentResponse_p);
tEplKernel EplIdentuInit(void);
tEplKernel EplIdentuAddInstance(void);
tEplKernel EplIdentuDelInstance(void);
tEplKernel EplIdentuReset(void);
tEplKernel EplIdentuGetIdentResponse(unsigned int uiNodeId_p,
tEplIdentResponse **ppIdentResponse_p);
tEplKernel EplIdentuRequestIdentResponse(unsigned int uiNodeId_p,
tEplIdentuCbResponse pfnCbResponse_p);
#endif // #ifndef _EPLIDENTU_H_

View File

@ -1,95 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for status and error LED user part module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplLedu.h,v $
$Author: D.Krueger $
$Revision: 1.1 $ $Date: 2008/11/17 16:40:39 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2008/11/17 d.k.: start of the implementation
****************************************************************************/
#ifndef _EPLLEDU_H_
#define _EPLLEDU_H_
#include "../EplLed.h"
#include "../EplNmt.h"
#include "EplEventu.h"
typedef tEplKernel(* tEplLeduStateChangeCallback) (tEplLedType LedType_p,
BOOL fOn_p);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
tEplKernel EplLeduInit(tEplLeduStateChangeCallback pfnCbStateChange_p);
tEplKernel EplLeduAddInstance(tEplLeduStateChangeCallback pfnCbStateChange_p);
tEplKernel EplLeduDelInstance(void);
tEplKernel EplLeduCbNmtStateChange(tEplEventNmtStateChange NmtStateChange_p);
tEplKernel EplLeduProcessEvent(tEplEvent * pEplEvent_p);
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
#endif // #ifndef _EPLLEDU_H_

View File

@ -1,92 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for NMT-CN-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtCnu.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMTCNU_H_
#define _EPLNMTCNU_H_
#include "EplNmtu.h"
#include "../EplDll.h"
#include "../EplFrame.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
tEplKernel EplNmtCnuInit(unsigned int uiNodeId_p);
tEplKernel EplNmtCnuAddInstance(unsigned int uiNodeId_p);
tEplKernel EplNmtCnuDelInstance(void);
tEplKernel EplNmtCnuSendNmtRequest(unsigned int uiNodeId_p, tEplNmtCommand NmtCommand_p);
tEplKernel EplNmtCnuRegisterCheckEventCb(tEplNmtuCheckEventCallback pfnEplNmtCheckEventCb_p);
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
#endif // #ifndef _EPLNMTCNU_H_

View File

@ -1,117 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for NMT-MN-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtMnu.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMTMNU_H_
#define _EPLNMTMNU_H_
#include "EplNmtu.h"
typedef tEplKernel(* tEplNmtMnuCbNodeEvent) (unsigned int uiNodeId_p,
tEplNmtNodeEvent NodeEvent_p,
tEplNmtState NmtState_p,
u16 wErrorCode_p,
BOOL fMandatory_p);
typedef tEplKernel(* tEplNmtMnuCbBootEvent) (tEplNmtBootEvent BootEvent_p,
tEplNmtState NmtState_p,
u16 wErrorCode_p);
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
tEplKernel EplNmtMnuInit(tEplNmtMnuCbNodeEvent pfnCbNodeEvent_p,
tEplNmtMnuCbBootEvent pfnCbBootEvent_p);
tEplKernel EplNmtMnuAddInstance(tEplNmtMnuCbNodeEvent pfnCbNodeEvent_p,
tEplNmtMnuCbBootEvent pfnCbBootEvent_p);
tEplKernel EplNmtMnuDelInstance(void);
tEplKernel EplNmtMnuProcessEvent(tEplEvent *pEvent_p);
tEplKernel EplNmtMnuSendNmtCommand(unsigned int uiNodeId_p,
tEplNmtCommand NmtCommand_p);
tEplKernel EplNmtMnuTriggerStateChange(unsigned int uiNodeId_p,
tEplNmtNodeCommand NodeCommand_p);
tEplKernel EplNmtMnuCbNmtStateChange(tEplEventNmtStateChange
NmtStateChange_p);
tEplKernel EplNmtMnuCbCheckEvent(tEplNmtEvent NmtEvent_p);
tEplKernel EplNmtMnuGetDiagnosticInfo(unsigned int
*puiMandatorySlaveCount_p,
unsigned int
*puiSignalSlaveCount_p,
u16 * pwFlags_p);
#endif
#endif // #ifndef _EPLNMTMNU_H_

View File

@ -1,139 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for NMT-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtu.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/09 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMTU_H_
#define _EPLNMTU_H_
#include "../EplNmt.h"
#include "EplEventu.h"
// nmt commands
typedef enum {
// requestable ASnd ServiceIds 0x01..0x1F
kEplNmtCmdIdentResponse = 0x01,
kEplNmtCmdStatusResponse = 0x02,
// plain NMT state commands 0x20..0x3F
kEplNmtCmdStartNode = 0x21,
kEplNmtCmdStopNode = 0x22,
kEplNmtCmdEnterPreOperational2 = 0x23,
kEplNmtCmdEnableReadyToOperate = 0x24,
kEplNmtCmdResetNode = 0x28,
kEplNmtCmdResetCommunication = 0x29,
kEplNmtCmdResetConfiguration = 0x2A,
kEplNmtCmdSwReset = 0x2B,
// extended NMT state commands 0x40..0x5F
kEplNmtCmdStartNodeEx = 0x41,
kEplNmtCmdStopNodeEx = 0x42,
kEplNmtCmdEnterPreOperational2Ex = 0x43,
kEplNmtCmdEnableReadyToOperateEx = 0x44,
kEplNmtCmdResetNodeEx = 0x48,
kEplNmtCmdResetCommunicationEx = 0x49,
kEplNmtCmdResetConfigurationEx = 0x4A,
kEplNmtCmdSwResetEx = 0x4B,
// NMT managing commands 0x60..0x7F
kEplNmtCmdNetHostNameSet = 0x62,
kEplNmtCmdFlushArpEntry = 0x63,
// NMT info services 0x80..0xBF
kEplNmtCmdPublishConfiguredCN = 0x80,
kEplNmtCmdPublishActiveCN = 0x90,
kEplNmtCmdPublishPreOperational1 = 0x91,
kEplNmtCmdPublishPreOperational2 = 0x92,
kEplNmtCmdPublishReadyToOperate = 0x93,
kEplNmtCmdPublishOperational = 0x94,
kEplNmtCmdPublishStopped = 0x95,
kEplNmtCmdPublishEmergencyNew = 0xA0,
kEplNmtCmdPublishTime = 0xB0,
kEplNmtCmdInvalidService = 0xFF
} tEplNmtCommand;
typedef tEplKernel(* tEplNmtuStateChangeCallback) (tEplEventNmtStateChange NmtStateChange_p);
typedef tEplKernel(* tEplNmtuCheckEventCallback) (tEplNmtEvent NmtEvent_p);
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
tEplKernel EplNmtuInit(void);
tEplKernel EplNmtuAddInstance(void);
tEplKernel EplNmtuDelInstance(void);
tEplKernel EplNmtuNmtEvent(tEplNmtEvent NmtEvent_p);
tEplNmtState EplNmtuGetNmtState(void);
tEplKernel EplNmtuProcessEvent(tEplEvent *pEplEvent_p);
tEplKernel EplNmtuRegisterStateChangeCb(tEplNmtuStateChangeCallback pfnEplNmtStateChangeCb_p);
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
#endif // #ifndef _EPLNMTU_H_

View File

@ -1,80 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for communication abstraction layer of the
NMT-Userspace-Module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplNmtuCal.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/16 -k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLNMTUCAL_H_
#define _EPLNMTUCAL_H_
#include "EplNmtu.h"
#include "../kernel/EplNmtk.h"
tEplNmtState EplNmtkCalGetNmtState(void);
#endif // #ifndef _EPLNMTUCAL_H_

View File

@ -1,169 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for Epl-Obd-Userspace-module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObdu.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLOBDU_H_
#define _EPLOBDU_H_
#include "../EplObd.h"
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
#if EPL_OBD_USE_KERNEL != FALSE
#error "EPL OBDu module enabled, but OBD_USE_KERNEL == TRUE"
#endif
tEplKernel EplObduWriteEntry(unsigned int uiIndex_p, unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p);
// ---------------------------------------------------------------------
tEplKernel EplObduReadEntry(unsigned int uiIndex_p, unsigned int uiSubIndex_p,
void *pDstData_p, tEplObdSize *pSize_p);
// ---------------------------------------------------------------------
tEplKernel EplObduAccessOdPart(tEplObdPart ObdPart_p, tEplObdDir Direction_p);
// ---------------------------------------------------------------------
tEplKernel EplObduDefineVar(tEplVarParam *pVarParam_p);
// ---------------------------------------------------------------------
void *EplObduGetObjectDataPtr(unsigned int uiIndex_p, unsigned int uiSubIndex_p);
// ---------------------------------------------------------------------
tEplKernel EplObduRegisterUserOd(tEplObdEntryPtr pUserOd_p);
// ---------------------------------------------------------------------
void EplObduInitVarEntry(tEplObdVarEntry *pVarEntry_p, u8 bType_p,
tEplObdSize ObdSize_p);
// ---------------------------------------------------------------------
tEplObdSize EplObduGetDataSize(unsigned int uiIndex_p,
unsigned int uiSubIndex_p);
// ---------------------------------------------------------------------
unsigned int EplObduGetNodeId(void);
// ---------------------------------------------------------------------
tEplKernel EplObduSetNodeId(unsigned int uiNodeId_p,
tEplObdNodeIdType NodeIdType_p);
// ---------------------------------------------------------------------
tEplKernel EplObduGetAccessType(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
tEplObdAccess *pAccessTyp_p);
// ---------------------------------------------------------------------
tEplKernel EplObduReadEntryToLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p, tEplObdSize *pSize_p);
// ---------------------------------------------------------------------
tEplKernel EplObduWriteEntryFromLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p, tEplObdSize Size_p);
// ---------------------------------------------------------------------
tEplKernel EplObduSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubindex_p,
tEplObdVarEntry **ppVarEntry_p);
#elif EPL_OBD_USE_KERNEL != FALSE
#include "../kernel/EplObdk.h"
#define EplObduWriteEntry EplObdWriteEntry
#define EplObduReadEntry EplObdReadEntry
#define EplObduAccessOdPart EplObdAccessOdPart
#define EplObduDefineVar EplObdDefineVar
#define EplObduGetObjectDataPtr EplObdGetObjectDataPtr
#define EplObduRegisterUserOd EplObdRegisterUserOd
#define EplObduInitVarEntry EplObdInitVarEntry
#define EplObduGetDataSize EplObdGetDataSize
#define EplObduGetNodeId EplObdGetNodeId
#define EplObduSetNodeId EplObdSetNodeId
#define EplObduGetAccessType EplObdGetAccessType
#define EplObduReadEntryToLe EplObdReadEntryToLe
#define EplObduWriteEntryFromLe EplObdWriteEntryFromLe
#define EplObduSearchVarEntry EplObdSearchVarEntry
#define EplObduIsNumerical EplObdIsNumerical
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
#endif // #ifndef _EPLOBDU_H_

View File

@ -1,126 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for communication abstraction layer
for the Epl-Obd-Userspace-Modul
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplObduCal.h,v $
$Author: D.Krueger $
$Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/06/19 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLOBDUCAL_H_
#define _EPLOBDUCAL_H_
#include "../EplObd.h"
tEplKernel EplObduCalWriteEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p,
tEplObdSize Size_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalReadEntry(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalAccessOdPart(tEplObdPart ObdPart_p,
tEplObdDir Direction_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalDefineVar(tEplVarParam *pVarParam_p);
//---------------------------------------------------------------------------
void *EplObduCalGetObjectDataPtr(unsigned int uiIndex_p,
unsigned int uiSubIndex_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalRegisterUserOd(tEplObdEntryPtr pUserOd_p);
//---------------------------------------------------------------------------
void EplObduCalInitVarEntry(tEplObdVarEntry *pVarEntry_p,
u8 bType_p, tEplObdSize ObdSize_p);
//---------------------------------------------------------------------------
tEplObdSize EplObduCalGetDataSize(unsigned int uiIndex_p,
unsigned int uiSubIndex_p);
//---------------------------------------------------------------------------
unsigned int EplObduCalGetNodeId(void);
//---------------------------------------------------------------------------
tEplKernel EplObduCalSetNodeId(unsigned int uiNodeId_p,
tEplObdNodeIdType NodeIdType_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalGetAccessType(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
tEplObdAccess *pAccessTyp_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalReadEntryToLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pDstData_p,
tEplObdSize *pSize_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalWriteEntryFromLe(unsigned int uiIndex_p,
unsigned int uiSubIndex_p,
void *pSrcData_p,
tEplObdSize Size_p);
//---------------------------------------------------------------------------
tEplKernel EplObduCalSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
unsigned int uiSubindex_p,
tEplObdVarEntry **ppVarEntry_p);
#endif // #ifndef _EPLOBDUCAL_H_

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for userspace PDO module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplPdou.h,v $
$Author: D.Krueger $
$Revision: 1.5 $ $Date: 2008/11/19 17:14:38 $
$State: Exp $
Build Environment:
-------------------------------------------------------------------------
Revision History:
2006/05/22 d.k.: start of the implementation, version 1.00
****************************************************************************/
#ifndef _EPL_PDOU_H_
#define _EPL_PDOU_H_
#include "../EplPdo.h"
tEplKernel EplPdouAddInstance(void);
tEplKernel EplPdouDelInstance(void);
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOU)) != 0)
tEplKernel EplPdouCbObdAccess(tEplObdCbParam *pParam_p);
#else
#define EplPdouCbObdAccess NULL
#endif
// returns error if bPdoId_p is already valid
/*
tEplKernel EplPdouSetMapping(
u8 bPdoId_p, BOOL fTxRx_p, u8 bNodeId, u8 bMappingVersion,
tEplPdoMapping * pMapping_p, u8 bMaxEntries_p);
tEplKernel EplPdouGetMapping(
u8 bPdoId_p, BOOL fTxRx_p, u8 * pbNodeId, u8 * pbMappingVersion,
tEplPdoMapping * pMapping_p, u8 * pbMaxEntries_p);
*/
#endif // #ifndef _EPL_PDOU_H_

View File

@ -1,96 +0,0 @@
/****************************************************************************
(c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
www.systec-electronic.com
Project: openPOWERLINK
Description: include file for SDO/Asnd-Protocolabstractionlayer module
License:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of SYSTEC electronic GmbH nor the names of its
contributors may be used to endorse or promote products derived
from this software without prior written permission. For written
permission, please contact info@systec-electronic.com.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Severability Clause:
If a provision of this License is or becomes illegal, invalid or
unenforceable in any jurisdiction, that shall not affect:
1. the validity or enforceability in that jurisdiction of any other
provision of this License; or
2. the validity or enforceability in other jurisdictions of that or
any other provision of this License.
-------------------------------------------------------------------------
$RCSfile: EplSdoAsndu.h,v $
$Author: D.Krueger $
$Revision: 1.6 $ $Date: 2008/10/17 15:32:32 $
$State: Exp $
Build Environment:
GCC V3.4
-------------------------------------------------------------------------
Revision History:
2006/07/07 k.t.: start of the implementation
****************************************************************************/
#ifndef _EPLSDOASNDU_H_
#define _EPLSDOASNDU_H_
#include "../EplSdo.h"
#include "../EplDll.h"
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
tEplKernel EplSdoAsnduInit(tEplSequLayerReceiveCb fpReceiveCb_p);
tEplKernel EplSdoAsnduAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p);
tEplKernel EplSdoAsnduDelInstance(void);
tEplKernel EplSdoAsnduInitCon(tEplSdoConHdl *pSdoConHandle_p,
unsigned int uiTargetNodeId_p);
tEplKernel EplSdoAsnduSendData(tEplSdoConHdl SdoConHandle_p,
tEplFrame *pSrcData_p,
u32 dwDataSize_p);
tEplKernel EplSdoAsnduDelCon(tEplSdoConHdl SdoConHandle_p);
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
#endif // #ifndef _EPLSDOASNDU_H_

Some files were not shown because too many files have changed in this diff Show More