Staging: epl: run Lindent on *.c files
It's a start, still a mess... 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>
This commit is contained in:
parent
e0ca059588
commit
833dfbe746
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,6 @@
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -100,7 +99,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -114,7 +112,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -130,36 +127,33 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
|
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
BYTE m_abProcessImageInput[EPL_API_PROCESS_IMAGE_SIZE_IN];
|
||||||
BYTE m_abProcessImageInput[EPL_API_PROCESS_IMAGE_SIZE_IN];
|
#endif
|
||||||
#endif
|
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
BYTE m_abProcessImageOutput[EPL_API_PROCESS_IMAGE_SIZE_OUT];
|
||||||
BYTE m_abProcessImageOutput[EPL_API_PROCESS_IMAGE_SIZE_OUT];
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
} tEplApiProcessImageInstance;
|
} tEplApiProcessImageInstance;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplApiProcessImageInstance EplApiProcessImageInstance_g;
|
static tEplApiProcessImageInstance EplApiProcessImageInstance_g;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
// //
|
// //
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplApiProcessImageSetup()
|
// Function: EplApiProcessImageSetup()
|
||||||
|
@ -177,125 +171,101 @@ static tEplApiProcessImageInstance EplApiProcessImageInstance_g;
|
||||||
|
|
||||||
tEplKernel PUBLIC EplApiProcessImageSetup(void)
|
tEplKernel PUBLIC EplApiProcessImageSetup(void)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
|
#if ((EPL_API_PROCESS_IMAGE_SIZE_IN > 0) || (EPL_API_PROCESS_IMAGE_SIZE_OUT > 0))
|
||||||
unsigned int uiVarEntries;
|
unsigned int uiVarEntries;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
|
||||||
ObdSize = 1;
|
ObdSize = 1;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2000,
|
||||||
0x2000,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN;
|
||||||
ObdSize = 1;
|
ObdSize = 1;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2001,
|
||||||
0x2001,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 2;
|
ObdSize = 2;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2010,
|
||||||
0x2010,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 2;
|
ObdSize = 2;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2011,
|
||||||
0x2011,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 4;
|
ObdSize = 4;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2020,
|
||||||
0x2020,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 4;
|
ObdSize = 4;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_IN / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2021,
|
||||||
0x2021,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
m_abProcessImageInput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
|
||||||
ObdSize = 1;
|
ObdSize = 1;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2030,
|
||||||
0x2030,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT;
|
||||||
ObdSize = 1;
|
ObdSize = 1;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2031,
|
||||||
0x2031,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 2;
|
ObdSize = 2;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2040,
|
||||||
0x2040,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 2;
|
ObdSize = 2;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2041,
|
||||||
0x2041,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 4;
|
ObdSize = 4;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2050,
|
||||||
0x2050,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
|
|
||||||
ObdSize = 4;
|
ObdSize = 4;
|
||||||
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
uiVarEntries = EPL_API_PROCESS_IMAGE_SIZE_OUT / ObdSize;
|
||||||
Ret = EplApiLinkObject(
|
Ret = EplApiLinkObject(0x2051,
|
||||||
0x2051,
|
EplApiProcessImageInstance_g.
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput, &uiVarEntries, &ObdSize,
|
||||||
&uiVarEntries,
|
1);
|
||||||
&ObdSize,
|
|
||||||
1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -310,26 +280,29 @@ tEplObdSize ObdSize;
|
||||||
// State:
|
// State:
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplApiProcessImageExchangeIn(tEplApiProcessImage* pPI_p)
|
tEplKernel PUBLIC EplApiProcessImageExchangeIn(tEplApiProcessImage * pPI_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
#if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
|
||||||
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
copy_to_user(pPI_p->m_pImage,
|
copy_to_user(pPI_p->m_pImage,
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
||||||
min(pPI_p->m_uiSize, sizeof (EplApiProcessImageInstance_g.m_abProcessImageInput)));
|
min(pPI_p->m_uiSize,
|
||||||
#else
|
sizeof(EplApiProcessImageInstance_g.
|
||||||
EPL_MEMCPY(pPI_p->m_pImage,
|
m_abProcessImageInput)));
|
||||||
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
#else
|
||||||
min(pPI_p->m_uiSize, sizeof (EplApiProcessImageInstance_g.m_abProcessImageInput)));
|
EPL_MEMCPY(pPI_p->m_pImage,
|
||||||
#endif
|
EplApiProcessImageInstance_g.m_abProcessImageInput,
|
||||||
|
min(pPI_p->m_uiSize,
|
||||||
|
sizeof(EplApiProcessImageInstance_g.
|
||||||
|
m_abProcessImageInput)));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Function: EplApiProcessImageExchangeOut()
|
// Function: EplApiProcessImageExchangeOut()
|
||||||
//
|
//
|
||||||
|
@ -342,33 +315,33 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
// State:
|
// State:
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplApiProcessImageExchangeOut(tEplApiProcessImage* pPI_p)
|
tEplKernel PUBLIC EplApiProcessImageExchangeOut(tEplApiProcessImage * pPI_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
#if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
|
||||||
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
copy_from_user(EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
copy_from_user(EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
||||||
pPI_p->m_pImage,
|
pPI_p->m_pImage,
|
||||||
min(pPI_p->m_uiSize, sizeof (EplApiProcessImageInstance_g.m_abProcessImageOutput)));
|
min(pPI_p->m_uiSize,
|
||||||
#else
|
sizeof(EplApiProcessImageInstance_g.
|
||||||
EPL_MEMCPY(EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
m_abProcessImageOutput)));
|
||||||
pPI_p->m_pImage,
|
#else
|
||||||
min(pPI_p->m_uiSize, sizeof (EplApiProcessImageInstance_g.m_abProcessImageOutput)));
|
EPL_MEMCPY(EplApiProcessImageInstance_g.m_abProcessImageOutput,
|
||||||
#endif
|
pPI_p->m_pImage,
|
||||||
|
min(pPI_p->m_uiSize,
|
||||||
|
sizeof(EplApiProcessImageInstance_g.
|
||||||
|
m_abProcessImageOutput)));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
// //
|
// //
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -78,7 +78,6 @@
|
||||||
#include "kernel/EplDllkCal.h"
|
#include "kernel/EplDllkCal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -105,7 +104,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -119,7 +117,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -134,9 +131,8 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplDlluCbAsnd m_apfnDlluCbAsnd[EPL_DLL_MAX_ASND_SERVICE_ID];
|
||||||
tEplDlluCbAsnd m_apfnDlluCbAsnd[EPL_DLL_MAX_ASND_SERVICE_ID];
|
|
||||||
|
|
||||||
} tEplDlluCalInstance;
|
} tEplDlluCalInstance;
|
||||||
|
|
||||||
|
@ -146,13 +142,15 @@ typedef struct
|
||||||
|
|
||||||
// if no dynamic memory allocation shall be used
|
// if no dynamic memory allocation shall be used
|
||||||
// define structures statically
|
// define structures statically
|
||||||
static tEplDlluCalInstance EplDlluCalInstance_g;
|
static tEplDlluCalInstance EplDlluCalInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId ServiceId_p, tEplDllAsndFilter Filter_p);
|
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId
|
||||||
|
ServiceId_p,
|
||||||
|
tEplDllAsndFilter Filter_p);
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
|
@ -177,12 +175,12 @@ static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId ServiceI
|
||||||
|
|
||||||
tEplKernel EplDlluCalAddInstance()
|
tEplKernel EplDlluCalAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof (EplDlluCalInstance_g));
|
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof(EplDlluCalInstance_g));
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -202,15 +200,14 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
tEplKernel EplDlluCalDelInstance()
|
tEplKernel EplDlluCalDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof (EplDlluCalInstance_g));
|
EPL_MEMSET(&EplDlluCalInstance_g, 0, sizeof(EplDlluCalInstance_g));
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplDlluCalProcess
|
// Function: EplDlluCalProcess
|
||||||
|
@ -228,37 +225,40 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
tEplKernel EplDlluCalProcess(tEplEvent * pEvent_p)
|
tEplKernel EplDlluCalProcess(tEplEvent * pEvent_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplMsgType MsgType;
|
tEplMsgType MsgType;
|
||||||
unsigned int uiAsndServiceId;
|
unsigned int uiAsndServiceId;
|
||||||
tEplFrameInfo FrameInfo;
|
tEplFrameInfo FrameInfo;
|
||||||
|
|
||||||
if (pEvent_p->m_EventType == kEplEventTypeAsndRx)
|
if (pEvent_p->m_EventType == kEplEventTypeAsndRx) {
|
||||||
{
|
FrameInfo.m_pFrame = (tEplFrame *) pEvent_p->m_pArg;
|
||||||
FrameInfo.m_pFrame = (tEplFrame*) pEvent_p->m_pArg;
|
FrameInfo.m_uiFrameSize = pEvent_p->m_uiSize;
|
||||||
FrameInfo.m_uiFrameSize = pEvent_p->m_uiSize;
|
// extract NetTime
|
||||||
// extract NetTime
|
FrameInfo.m_NetTime = pEvent_p->m_NetTime;
|
||||||
FrameInfo.m_NetTime = pEvent_p->m_NetTime;
|
|
||||||
|
|
||||||
MsgType = (tEplMsgType)AmiGetByteFromLe(&FrameInfo.m_pFrame->m_le_bMessageType);
|
MsgType =
|
||||||
if (MsgType != kEplMsgTypeAsnd)
|
(tEplMsgType) AmiGetByteFromLe(&FrameInfo.m_pFrame->
|
||||||
{
|
m_le_bMessageType);
|
||||||
Ret = kEplInvalidOperation;
|
if (MsgType != kEplMsgTypeAsnd) {
|
||||||
goto Exit;
|
Ret = kEplInvalidOperation;
|
||||||
}
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
uiAsndServiceId = (unsigned int) AmiGetByteFromLe(&FrameInfo.m_pFrame->m_Data.m_Asnd.m_le_bServiceId);
|
uiAsndServiceId =
|
||||||
if (uiAsndServiceId < EPL_DLL_MAX_ASND_SERVICE_ID)
|
(unsigned int)AmiGetByteFromLe(&FrameInfo.m_pFrame->m_Data.
|
||||||
{ // ASnd service ID is valid
|
m_Asnd.m_le_bServiceId);
|
||||||
if (EplDlluCalInstance_g.m_apfnDlluCbAsnd[uiAsndServiceId] != NULL)
|
if (uiAsndServiceId < EPL_DLL_MAX_ASND_SERVICE_ID) { // ASnd service ID is valid
|
||||||
{ // handler was registered
|
if (EplDlluCalInstance_g.m_apfnDlluCbAsnd[uiAsndServiceId] != NULL) { // handler was registered
|
||||||
Ret = EplDlluCalInstance_g.m_apfnDlluCbAsnd[uiAsndServiceId](&FrameInfo);
|
Ret =
|
||||||
}
|
EplDlluCalInstance_g.
|
||||||
}
|
m_apfnDlluCbAsnd[uiAsndServiceId]
|
||||||
}
|
(&FrameInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -279,26 +279,26 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel EplDlluCalRegAsndService(tEplDllAsndServiceId ServiceId_p, tEplDlluCbAsnd pfnDlluCbAsnd_p, tEplDllAsndFilter Filter_p)
|
tEplKernel EplDlluCalRegAsndService(tEplDllAsndServiceId ServiceId_p,
|
||||||
|
tEplDlluCbAsnd pfnDlluCbAsnd_p,
|
||||||
|
tEplDllAsndFilter Filter_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
if (ServiceId_p < tabentries (EplDlluCalInstance_g.m_apfnDlluCbAsnd))
|
if (ServiceId_p < tabentries(EplDlluCalInstance_g.m_apfnDlluCbAsnd)) {
|
||||||
{
|
// memorize function pointer
|
||||||
// memorize function pointer
|
EplDlluCalInstance_g.m_apfnDlluCbAsnd[ServiceId_p] =
|
||||||
EplDlluCalInstance_g.m_apfnDlluCbAsnd[ServiceId_p] = pfnDlluCbAsnd_p;
|
pfnDlluCbAsnd_p;
|
||||||
|
|
||||||
if (pfnDlluCbAsnd_p == NULL)
|
if (pfnDlluCbAsnd_p == NULL) { // close filter
|
||||||
{ // close filter
|
Filter_p = kEplDllAsndFilterNone;
|
||||||
Filter_p = kEplDllAsndFilterNone;
|
}
|
||||||
}
|
// set filter in DLL module in kernel part
|
||||||
|
Ret = EplDlluCalSetAsndServiceIdFilter(ServiceId_p, Filter_p);
|
||||||
|
|
||||||
// set filter in DLL module in kernel part
|
}
|
||||||
Ret = EplDlluCalSetAsndServiceIdFilter(ServiceId_p, Filter_p);
|
|
||||||
|
|
||||||
}
|
return Ret;
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -319,21 +319,21 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel EplDlluCalAsyncSend(tEplFrameInfo * pFrameInfo_p, tEplDllAsyncReqPriority Priority_p)
|
tEplKernel EplDlluCalAsyncSend(tEplFrameInfo * pFrameInfo_p,
|
||||||
|
tEplDllAsyncReqPriority Priority_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0)
|
||||||
pFrameInfo_p->m_uiFrameSize += 14; // add size of ethernet header
|
pFrameInfo_p->m_uiFrameSize += 14; // add size of ethernet header
|
||||||
Ret = EplDllkCalAsyncSend(pFrameInfo_p, Priority_p);
|
Ret = EplDllkCalAsyncSend(pFrameInfo_p, Priority_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -354,43 +354,42 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel EplDlluCalIssueRequest(tEplDllReqServiceId Service_p, unsigned int uiNodeId_p, BYTE bSoaFlag1_p)
|
tEplKernel EplDlluCalIssueRequest(tEplDllReqServiceId Service_p,
|
||||||
|
unsigned int uiNodeId_p, BYTE bSoaFlag1_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
// add node to appropriate request queue
|
// add node to appropriate request queue
|
||||||
switch (Service_p)
|
switch (Service_p) {
|
||||||
{
|
case kEplDllReqServiceIdent:
|
||||||
case kEplDllReqServiceIdent:
|
case kEplDllReqServiceStatus:
|
||||||
case kEplDllReqServiceStatus:
|
{
|
||||||
{
|
tEplEvent Event;
|
||||||
tEplEvent Event;
|
tEplDllCalIssueRequest IssueReq;
|
||||||
tEplDllCalIssueRequest IssueReq;
|
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkDllkCal;
|
Event.m_EventSink = kEplEventSinkDllkCal;
|
||||||
Event.m_EventType = kEplEventTypeDllkIssueReq;
|
Event.m_EventType = kEplEventTypeDllkIssueReq;
|
||||||
IssueReq.m_Service = Service_p;
|
IssueReq.m_Service = Service_p;
|
||||||
IssueReq.m_uiNodeId = uiNodeId_p;
|
IssueReq.m_uiNodeId = uiNodeId_p;
|
||||||
IssueReq.m_bSoaFlag1 = bSoaFlag1_p;
|
IssueReq.m_bSoaFlag1 = bSoaFlag1_p;
|
||||||
Event.m_pArg = &IssueReq;
|
Event.m_pArg = &IssueReq;
|
||||||
Event.m_uiSize = sizeof (IssueReq);
|
Event.m_uiSize = sizeof(IssueReq);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Ret = kEplDllInvalidParam;
|
Ret = kEplDllInvalidParam;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplDlluCalAddNode()
|
// Function: EplDlluCalAddNode()
|
||||||
|
@ -408,20 +407,19 @@ Exit:
|
||||||
|
|
||||||
tEplKernel EplDlluCalAddNode(tEplDllNodeInfo * pNodeInfo_p)
|
tEplKernel EplDlluCalAddNode(tEplDllNodeInfo * pNodeInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkDllkCal;
|
Event.m_EventSink = kEplEventSinkDllkCal;
|
||||||
Event.m_EventType = kEplEventTypeDllkAddNode;
|
Event.m_EventType = kEplEventTypeDllkAddNode;
|
||||||
Event.m_pArg = pNodeInfo_p;
|
Event.m_pArg = pNodeInfo_p;
|
||||||
Event.m_uiSize = sizeof (tEplDllNodeInfo);
|
Event.m_uiSize = sizeof(tEplDllNodeInfo);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplDlluCalDeleteNode()
|
// Function: EplDlluCalDeleteNode()
|
||||||
|
@ -439,20 +437,19 @@ tEplEvent Event;
|
||||||
|
|
||||||
tEplKernel EplDlluCalDeleteNode(unsigned int uiNodeId_p)
|
tEplKernel EplDlluCalDeleteNode(unsigned int uiNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkDllkCal;
|
Event.m_EventSink = kEplEventSinkDllkCal;
|
||||||
Event.m_EventType = kEplEventTypeDllkDelNode;
|
Event.m_EventType = kEplEventTypeDllkDelNode;
|
||||||
Event.m_pArg = &uiNodeId_p;
|
Event.m_pArg = &uiNodeId_p;
|
||||||
Event.m_uiSize = sizeof (uiNodeId_p);
|
Event.m_uiSize = sizeof(uiNodeId_p);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplDlluCalSoftDeleteNode()
|
// Function: EplDlluCalSoftDeleteNode()
|
||||||
|
@ -470,23 +467,21 @@ tEplEvent Event;
|
||||||
|
|
||||||
tEplKernel EplDlluCalSoftDeleteNode(unsigned int uiNodeId_p)
|
tEplKernel EplDlluCalSoftDeleteNode(unsigned int uiNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkDllkCal;
|
Event.m_EventSink = kEplEventSinkDllkCal;
|
||||||
Event.m_EventType = kEplEventTypeDllkSoftDelNode;
|
Event.m_EventType = kEplEventTypeDllkSoftDelNode;
|
||||||
Event.m_pArg = &uiNodeId_p;
|
Event.m_pArg = &uiNodeId_p;
|
||||||
Event.m_uiSize = sizeof (uiNodeId_p);
|
Event.m_uiSize = sizeof(uiNodeId_p);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#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 //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -509,26 +504,26 @@ tEplEvent Event;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId ServiceId_p, tEplDllAsndFilter Filter_p)
|
static tEplKernel EplDlluCalSetAsndServiceIdFilter(tEplDllAsndServiceId
|
||||||
|
ServiceId_p,
|
||||||
|
tEplDllAsndFilter Filter_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
tEplDllCalAsndServiceIdFilter ServFilter;
|
tEplDllCalAsndServiceIdFilter ServFilter;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkDllkCal;
|
Event.m_EventSink = kEplEventSinkDllkCal;
|
||||||
Event.m_EventType = kEplEventTypeDllkServFilter;
|
Event.m_EventType = kEplEventTypeDllkServFilter;
|
||||||
ServFilter.m_ServiceId = ServiceId_p;
|
ServFilter.m_ServiceId = ServiceId_p;
|
||||||
ServFilter.m_Filter = Filter_p;
|
ServFilter.m_Filter = Filter_p;
|
||||||
Event.m_pArg = &ServFilter;
|
Event.m_pArg = &ServFilter;
|
||||||
Event.m_uiSize = sizeof (ServFilter);
|
Event.m_uiSize = sizeof(ServFilter);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -77,9 +77,9 @@
|
||||||
#include "Benchmark.h"
|
#include "Benchmark.h"
|
||||||
|
|
||||||
#ifdef EPL_NO_FIFO
|
#ifdef EPL_NO_FIFO
|
||||||
#include "kernel/EplEventk.h"
|
#include "kernel/EplEventk.h"
|
||||||
#else
|
#else
|
||||||
#include "SharedBuff.h"
|
#include "SharedBuff.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -96,28 +96,27 @@
|
||||||
|
|
||||||
// TracePoint support for realtime-debugging
|
// TracePoint support for realtime-debugging
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
void PUBLIC TgtDbgSignalTracePoint (BYTE bTracePointNumber_p);
|
void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p);
|
||||||
void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p);
|
void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p);
|
||||||
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
|
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
|
||||||
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
|
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
|
||||||
#else
|
#else
|
||||||
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
|
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
|
||||||
#define TGT_DBG_POST_TRACE_VALUE(v)
|
#define TGT_DBG_POST_TRACE_VALUE(v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
tShbInstance m_pShbKernelToUserInstance;
|
tShbInstance m_pShbKernelToUserInstance;
|
||||||
tShbInstance m_pShbUserToKernelInstance;
|
tShbInstance m_pShbUserToKernelInstance;
|
||||||
#endif
|
#endif
|
||||||
tEplProcessEventCb m_pfnApiProcessEventCb;
|
tEplProcessEventCb m_pfnApiProcessEventCb;
|
||||||
|
|
||||||
}tEplEventuInstance;
|
} tEplEventuInstance;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
|
@ -133,9 +132,8 @@ static tEplEventuInstance EplEventuInstance_g;
|
||||||
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// callback function for incomming events
|
// callback function for incomming events
|
||||||
static void EplEventuRxSignalHandlerCb (
|
static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
|
||||||
tShbInstance pShbRxInstance_p,
|
unsigned long ulDataSize_p);
|
||||||
unsigned long ulDataSize_p);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -176,17 +174,14 @@ static void EplEventuRxSignalHandlerCb (
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p)
|
tEplKernel PUBLIC EplEventuInit(tEplProcessEventCb pfnApiProcessEventCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
|
Ret = EplEventuAddInstance(pfnApiProcessEventCb_p);
|
||||||
|
|
||||||
Ret = EplEventuAddInstance(pfnApiProcessEventCb_p);
|
return Ret;
|
||||||
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplEventuAddInstance
|
// Function: EplEventuAddInstance
|
||||||
|
@ -204,62 +199,67 @@ return Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuAddInstance(tEplProcessEventCb pfnApiProcessEventCb_p)
|
tEplKernel PUBLIC EplEventuAddInstance(tEplProcessEventCb
|
||||||
|
pfnApiProcessEventCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
tShbError ShbError;
|
tShbError ShbError;
|
||||||
unsigned int fShbNewCreated;
|
unsigned int fShbNewCreated;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
|
// init instance variables
|
||||||
// init instance variables
|
EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p;
|
||||||
EplEventuInstance_g.m_pfnApiProcessEventCb = pfnApiProcessEventCb_p;
|
|
||||||
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// init shared loop buffer
|
// init shared loop buffer
|
||||||
// kernel -> user
|
// kernel -> user
|
||||||
ShbError = ShbCirAllocBuffer (EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
|
ShbError = ShbCirAllocBuffer(EPL_EVENT_SIZE_SHB_KERNEL_TO_USER,
|
||||||
EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
|
EPL_EVENT_NAME_SHB_KERNEL_TO_USER,
|
||||||
&EplEventuInstance_g.m_pShbKernelToUserInstance,
|
&EplEventuInstance_g.
|
||||||
&fShbNewCreated);
|
m_pShbKernelToUserInstance,
|
||||||
if(ShbError != kShbOk)
|
&fShbNewCreated);
|
||||||
{
|
if (ShbError != kShbOk) {
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n", ShbError);
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
Ret = kEplNoResource;
|
("EplEventuAddInstance(): ShbCirAllocBuffer(K2U) -> 0x%X\n",
|
||||||
goto Exit;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// user -> kernel
|
Exit:
|
||||||
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
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,51 +282,52 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuDelInstance()
|
tEplKernel PUBLIC EplEventuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
tShbError ShbError;
|
tShbError ShbError;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// set eventhandler to NULL
|
// set eventhandler to NULL
|
||||||
ShbError = ShbCirSetSignalHandlerNewData (EplEventuInstance_g.m_pShbKernelToUserInstance,
|
ShbError =
|
||||||
NULL,
|
ShbCirSetSignalHandlerNewData(EplEventuInstance_g.
|
||||||
kShbPriorityNormal);
|
m_pShbKernelToUserInstance, NULL,
|
||||||
if(ShbError != kShbOk)
|
kShbPriorityNormal);
|
||||||
{
|
if (ShbError != kShbOk) {
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuDelInstance(): ShbCirSetSignalHandlerNewData(K2U) -> 0x%X\n", ShbError);
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
Ret = kEplNoResource;
|
("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 User -> Kernel
|
// free buffer Kernel -> User
|
||||||
ShbError = ShbCirReleaseBuffer (EplEventuInstance_g.m_pShbUserToKernelInstance);
|
ShbError =
|
||||||
if((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs))
|
ShbCirReleaseBuffer(EplEventuInstance_g.m_pShbKernelToUserInstance);
|
||||||
{
|
if ((ShbError != kShbOk) && (ShbError != kShbMemUsedByOtherProcs)) {
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuDelInstance(): ShbCirReleaseBuffer(U2K) -> 0x%X\n", ShbError);
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
Ret = kEplNoResource;
|
("EplEventuDelInstance(): ShbCirReleaseBuffer(K2U) -> 0x%X\n",
|
||||||
}
|
ShbError);
|
||||||
else
|
Ret = kEplNoResource;
|
||||||
{
|
} else {
|
||||||
EplEventuInstance_g.m_pShbUserToKernelInstance = NULL;
|
EplEventuInstance_g.m_pShbKernelToUserInstance = 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
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,159 +348,153 @@ return Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuProcess(tEplEvent* pEvent_p)
|
tEplKernel PUBLIC EplEventuProcess(tEplEvent * pEvent_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
tEplEventSource EventSource;
|
tEplEventSource EventSource;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check m_EventSink
|
// check m_EventSink
|
||||||
switch(pEvent_p->m_EventSink)
|
switch (pEvent_p->m_EventSink) {
|
||||||
{
|
// NMT-User-Module
|
||||||
// NMT-User-Module
|
case kEplEventSinkNmtu:
|
||||||
case kEplEventSinkNmtu:
|
{
|
||||||
{
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
||||||
Ret = EplNmtuProcessEvent(pEvent_p);
|
Ret = EplNmtuProcessEvent(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
|
||||||
{
|
EventSource = kEplEventSourceNmtu;
|
||||||
EventSource = kEplEventSourceNmtu;
|
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
// NMT-MN-User-Module
|
// NMT-MN-User-Module
|
||||||
case kEplEventSinkNmtMnu:
|
case kEplEventSinkNmtMnu:
|
||||||
{
|
{
|
||||||
Ret = EplNmtMnuProcessEvent(pEvent_p);
|
Ret = EplNmtMnuProcessEvent(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
|
||||||
{
|
EventSource = kEplEventSourceNmtMnu;
|
||||||
EventSource = kEplEventSourceNmtMnu;
|
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOC)) != 0) \
|
#if ((((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOC)) != 0) \
|
||||||
|| (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOS)) != 0))
|
|| (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDOS)) != 0))
|
||||||
// events for asynchronus SDO Sequence Layer
|
// events for asynchronus SDO Sequence Layer
|
||||||
case kEplEventSinkSdoAsySeq:
|
case kEplEventSinkSdoAsySeq:
|
||||||
{
|
{
|
||||||
Ret = EplSdoAsySeqProcessEvent(pEvent_p);
|
Ret = EplSdoAsySeqProcessEvent(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
|
||||||
{
|
EventSource = kEplEventSourceSdoAsySeq;
|
||||||
EventSource = kEplEventSourceSdoAsySeq;
|
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// LED user part module
|
// LED user part module
|
||||||
case kEplEventSinkLedu:
|
case kEplEventSinkLedu:
|
||||||
{
|
{
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_LEDU)) != 0)
|
||||||
Ret = EplLeduProcessEvent(pEvent_p);
|
Ret = EplLeduProcessEvent(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
|
||||||
{
|
EventSource = kEplEventSourceLedu;
|
||||||
EventSource = kEplEventSourceLedu;
|
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// event for EPL api
|
// event for EPL api
|
||||||
case kEplEventSinkApi:
|
case kEplEventSinkApi:
|
||||||
{
|
{
|
||||||
if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL)
|
if (EplEventuInstance_g.m_pfnApiProcessEventCb != NULL) {
|
||||||
{
|
Ret =
|
||||||
Ret = EplEventuInstance_g.m_pfnApiProcessEventCb(pEvent_p);
|
EplEventuInstance_g.
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
m_pfnApiProcessEventCb(pEvent_p);
|
||||||
{
|
if ((Ret != kEplSuccessful)
|
||||||
EventSource = kEplEventSourceEplApi;
|
&& (Ret != kEplShutdown)) {
|
||||||
|
EventSource = kEplEventSourceEplApi;
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError
|
||||||
Ret,
|
(kEplEventSourceEventu, Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource), &EventSource);
|
||||||
&EventSource);
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplEventSinkDlluCal:
|
case kEplEventSinkDlluCal:
|
||||||
{
|
{
|
||||||
Ret = EplDlluCalProcess(pEvent_p);
|
Ret = EplDlluCalProcess(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown)) {
|
||||||
{
|
EventSource = kEplEventSourceDllu;
|
||||||
EventSource = kEplEventSourceDllu;
|
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplEventSinkErru:
|
case kEplEventSinkErru:
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Ret = EplErruProcess(pEvent_p);
|
Ret = EplErruProcess(pEvent_p);
|
||||||
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
if ((Ret != kEplSuccessful) && (Ret != kEplShutdown))
|
||||||
{
|
{
|
||||||
EventSource = kEplEventSourceErru;
|
EventSource = kEplEventSourceErru;
|
||||||
|
|
||||||
// Error event for API layer
|
// Error event for API layer
|
||||||
EplEventuPostError(kEplEventSourceEventu,
|
EplEventuPostError(kEplEventSourceEventu,
|
||||||
Ret,
|
Ret,
|
||||||
sizeof(EventSource),
|
sizeof(EventSource),
|
||||||
&EventSource);
|
&EventSource);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unknown sink
|
// unknown sink
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Ret = kEplEventUnknownSink;
|
Ret = kEplEventUnknownSink;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of switch(pEvent_p->m_EventSink)
|
} // end of switch(pEvent_p->m_EventSink)
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,143 +517,158 @@ tEplEventSource EventSource;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuPost(tEplEvent * pEvent_p)
|
tEplKernel PUBLIC EplEventuPost(tEplEvent * pEvent_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
tShbError ShbError;
|
tShbError ShbError;
|
||||||
tShbCirChunk ShbCirChunk;
|
tShbCirChunk ShbCirChunk;
|
||||||
unsigned long ulDataSize;
|
unsigned long ulDataSize;
|
||||||
unsigned int fBufferCompleted;
|
unsigned int fBufferCompleted;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// 2006/08/03 d.k.: Event and argument are posted as separate chunks to the event queue.
|
// 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);
|
ulDataSize =
|
||||||
|
sizeof(tEplEvent) +
|
||||||
|
((pEvent_p->m_pArg != NULL) ? pEvent_p->m_uiSize : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// decide in which buffer the event have to write
|
// decide in which buffer the event have to write
|
||||||
switch(pEvent_p->m_EventSink)
|
switch (pEvent_p->m_EventSink) {
|
||||||
{
|
// kernelspace modules
|
||||||
// kernelspace modules
|
case kEplEventSinkSync:
|
||||||
case kEplEventSinkSync:
|
case kEplEventSinkNmtk:
|
||||||
case kEplEventSinkNmtk:
|
case kEplEventSinkDllk:
|
||||||
case kEplEventSinkDllk:
|
case kEplEventSinkDllkCal:
|
||||||
case kEplEventSinkDllkCal:
|
case kEplEventSinkPdok:
|
||||||
case kEplEventSinkPdok:
|
case kEplEventSinkErrk:
|
||||||
case kEplEventSinkErrk:
|
{
|
||||||
{
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// post message
|
// post message
|
||||||
ShbError = ShbCirAllocDataBlock (EplEventuInstance_g.m_pShbUserToKernelInstance,
|
ShbError =
|
||||||
&ShbCirChunk,
|
ShbCirAllocDataBlock(EplEventuInstance_g.
|
||||||
ulDataSize);
|
m_pShbUserToKernelInstance,
|
||||||
if (ShbError != kShbOk)
|
&ShbCirChunk, ulDataSize);
|
||||||
{
|
if (ShbError != kShbOk) {
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n", ShbError);
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
Ret = kEplEventPostError;
|
("EplEventuPost(): ShbCirAllocDataBlock(U2K) -> 0x%X\n",
|
||||||
goto Exit;
|
ShbError);
|
||||||
}
|
Ret = kEplEventPostError;
|
||||||
ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbUserToKernelInstance,
|
goto Exit;
|
||||||
&ShbCirChunk,
|
}
|
||||||
pEvent_p,
|
ShbError =
|
||||||
sizeof (tEplEvent),
|
ShbCirWriteDataChunk(EplEventuInstance_g.
|
||||||
&fBufferCompleted);
|
m_pShbUserToKernelInstance,
|
||||||
if (ShbError != kShbOk)
|
&ShbCirChunk, pEvent_p,
|
||||||
{
|
sizeof(tEplEvent),
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n", ShbError);
|
&fBufferCompleted);
|
||||||
Ret = kEplEventPostError;
|
if (ShbError != kShbOk) {
|
||||||
goto Exit;
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
}
|
("EplEventuPost(): ShbCirWriteDataChunk(U2K) -> 0x%X\n",
|
||||||
if (fBufferCompleted == FALSE)
|
ShbError);
|
||||||
{
|
Ret = kEplEventPostError;
|
||||||
ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbUserToKernelInstance,
|
goto Exit;
|
||||||
&ShbCirChunk,
|
}
|
||||||
pEvent_p->m_pArg,
|
if (fBufferCompleted == FALSE) {
|
||||||
(unsigned long) pEvent_p->m_uiSize,
|
ShbError =
|
||||||
&fBufferCompleted);
|
ShbCirWriteDataChunk(EplEventuInstance_g.
|
||||||
if ((ShbError != kShbOk) || (fBufferCompleted == FALSE))
|
m_pShbUserToKernelInstance,
|
||||||
{
|
&ShbCirChunk,
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk2(U2K) -> 0x%X\n", ShbError);
|
pEvent_p->m_pArg,
|
||||||
Ret = kEplEventPostError;
|
(unsigned long)
|
||||||
goto Exit;
|
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
|
#else
|
||||||
Ret = EplEventkProcess(pEvent_p);
|
Ret = EplEventkProcess(pEvent_p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// userspace modules
|
// userspace modules
|
||||||
case kEplEventSinkNmtMnu:
|
case kEplEventSinkNmtMnu:
|
||||||
case kEplEventSinkNmtu:
|
case kEplEventSinkNmtu:
|
||||||
case kEplEventSinkSdoAsySeq:
|
case kEplEventSinkSdoAsySeq:
|
||||||
case kEplEventSinkApi:
|
case kEplEventSinkApi:
|
||||||
case kEplEventSinkDlluCal:
|
case kEplEventSinkDlluCal:
|
||||||
case kEplEventSinkErru:
|
case kEplEventSinkErru:
|
||||||
case kEplEventSinkLedu:
|
case kEplEventSinkLedu:
|
||||||
{
|
{
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
// post message
|
// post message
|
||||||
ShbError = ShbCirAllocDataBlock (EplEventuInstance_g.m_pShbKernelToUserInstance,
|
ShbError =
|
||||||
&ShbCirChunk,
|
ShbCirAllocDataBlock(EplEventuInstance_g.
|
||||||
ulDataSize);
|
m_pShbKernelToUserInstance,
|
||||||
if(ShbError != kShbOk)
|
&ShbCirChunk, ulDataSize);
|
||||||
{
|
if (ShbError != kShbOk) {
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n", ShbError);
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
Ret = kEplEventPostError;
|
("EplEventuPost(): ShbCirAllocDataBlock(K2U) -> 0x%X\n",
|
||||||
goto Exit;
|
ShbError);
|
||||||
}
|
Ret = kEplEventPostError;
|
||||||
ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbKernelToUserInstance,
|
goto Exit;
|
||||||
&ShbCirChunk,
|
}
|
||||||
pEvent_p,
|
ShbError =
|
||||||
sizeof (tEplEvent),
|
ShbCirWriteDataChunk(EplEventuInstance_g.
|
||||||
&fBufferCompleted);
|
m_pShbKernelToUserInstance,
|
||||||
if(ShbError != kShbOk)
|
&ShbCirChunk, pEvent_p,
|
||||||
{
|
sizeof(tEplEvent),
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n", ShbError);
|
&fBufferCompleted);
|
||||||
Ret = kEplEventPostError;
|
if (ShbError != kShbOk) {
|
||||||
goto Exit;
|
EPL_DBGLVL_EVENTK_TRACE1
|
||||||
}
|
("EplEventuPost(): ShbCirWriteDataChunk(K2U) -> 0x%X\n",
|
||||||
if (fBufferCompleted == FALSE)
|
ShbError);
|
||||||
{
|
Ret = kEplEventPostError;
|
||||||
ShbError = ShbCirWriteDataChunk (EplEventuInstance_g.m_pShbKernelToUserInstance,
|
goto Exit;
|
||||||
&ShbCirChunk,
|
}
|
||||||
pEvent_p->m_pArg,
|
if (fBufferCompleted == FALSE) {
|
||||||
(unsigned long) pEvent_p->m_uiSize,
|
ShbError =
|
||||||
&fBufferCompleted);
|
ShbCirWriteDataChunk(EplEventuInstance_g.
|
||||||
if ((ShbError != kShbOk) || (fBufferCompleted == FALSE))
|
m_pShbKernelToUserInstance,
|
||||||
{
|
&ShbCirChunk,
|
||||||
EPL_DBGLVL_EVENTK_TRACE1("EplEventuPost(): ShbCirWriteDataChunk2(K2U) -> 0x%X\n", ShbError);
|
pEvent_p->m_pArg,
|
||||||
Ret = kEplEventPostError;
|
(unsigned long)
|
||||||
goto Exit;
|
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
|
#else
|
||||||
Ret = EplEventuProcess(pEvent_p);
|
Ret = EplEventuProcess(pEvent_p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Ret = kEplEventUnknownSink;
|
Ret = kEplEventUnknownSink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // end of switch(pEvent_p->m_EventSink)
|
||||||
}// end of switch(pEvent_p->m_EventSink)
|
|
||||||
|
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
Exit:
|
Exit:
|
||||||
#endif
|
#endif
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplEventuPostError
|
// Function: EplEventuPostError
|
||||||
|
@ -680,36 +690,35 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplEventuPostError(tEplEventSource EventSource_p,
|
tEplKernel PUBLIC EplEventuPostError(tEplEventSource EventSource_p,
|
||||||
tEplKernel EplError_p,
|
tEplKernel EplError_p,
|
||||||
unsigned int uiArgSize_p,
|
unsigned int uiArgSize_p, void *pArg_p)
|
||||||
void* pArg_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
BYTE abBuffer[EPL_MAX_EVENT_ARG_SIZE];
|
BYTE abBuffer[EPL_MAX_EVENT_ARG_SIZE];
|
||||||
tEplEventError* pEventError = (tEplEventError*) abBuffer;
|
tEplEventError *pEventError = (tEplEventError *) abBuffer;
|
||||||
tEplEvent EplEvent;
|
tEplEvent EplEvent;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// create argument
|
// create argument
|
||||||
pEventError->m_EventSource = EventSource_p;
|
pEventError->m_EventSource = EventSource_p;
|
||||||
pEventError->m_EplError = EplError_p;
|
pEventError->m_EplError = EplError_p;
|
||||||
EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
|
EPL_MEMCPY(&pEventError->m_Arg, pArg_p, uiArgSize_p);
|
||||||
|
|
||||||
// create event
|
// create event
|
||||||
EplEvent.m_EventType = kEplEventTypeError;
|
EplEvent.m_EventType = kEplEventTypeError;
|
||||||
EplEvent.m_EventSink = kEplEventSinkApi;
|
EplEvent.m_EventSink = kEplEventSinkApi;
|
||||||
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
|
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(EplEvent.m_NetTime));
|
||||||
EplEvent.m_uiSize = (sizeof(EventSource_p)+ sizeof(EplError_p)+ uiArgSize_p);
|
EplEvent.m_uiSize =
|
||||||
EplEvent.m_pArg = &abBuffer[0];
|
(sizeof(EventSource_p) + sizeof(EplError_p) + uiArgSize_p);
|
||||||
|
EplEvent.m_pArg = &abBuffer[0];
|
||||||
|
|
||||||
// post errorevent
|
// post errorevent
|
||||||
Ret = EplEventuPost(&EplEvent);
|
Ret = EplEventuPost(&EplEvent);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -735,19 +744,18 @@ tEplEvent EplEvent;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#ifndef EPL_NO_FIFO
|
#ifndef EPL_NO_FIFO
|
||||||
static void EplEventuRxSignalHandlerCb (
|
static void EplEventuRxSignalHandlerCb(tShbInstance pShbRxInstance_p,
|
||||||
tShbInstance pShbRxInstance_p,
|
unsigned long ulDataSize_p)
|
||||||
unsigned long ulDataSize_p)
|
|
||||||
{
|
{
|
||||||
tEplEvent *pEplEvent;
|
tEplEvent *pEplEvent;
|
||||||
tShbError ShbError;
|
tShbError ShbError;
|
||||||
//unsigned long ulBlockCount;
|
//unsigned long ulBlockCount;
|
||||||
//unsigned long ulDataSize;
|
//unsigned long ulDataSize;
|
||||||
BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
|
BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
|
||||||
// d.k.: abDataBuffer contains the complete tEplEvent structure
|
// d.k.: abDataBuffer contains the complete tEplEvent structure
|
||||||
// and behind this the argument
|
// and behind this the argument
|
||||||
|
|
||||||
TGT_DBG_SIGNAL_TRACE_POINT(21);
|
TGT_DBG_SIGNAL_TRACE_POINT(21);
|
||||||
|
|
||||||
// d.k. not needed because it is already done in SharedBuff
|
// d.k. not needed because it is already done in SharedBuff
|
||||||
/* do
|
/* do
|
||||||
|
@ -763,38 +771,32 @@ BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
|
||||||
|
|
||||||
BENCHMARK_MOD_28_RESET(1); // 14 µs until set
|
BENCHMARK_MOD_28_RESET(1); // 14 µs until set
|
||||||
*/
|
*/
|
||||||
// copy data from event queue
|
// copy data from event queue
|
||||||
ShbError = ShbCirReadDataBlock (pShbRxInstance_p,
|
ShbError = ShbCirReadDataBlock(pShbRxInstance_p,
|
||||||
&abDataBuffer[0],
|
&abDataBuffer[0],
|
||||||
sizeof(abDataBuffer),
|
sizeof(abDataBuffer), &ulDataSize_p);
|
||||||
&ulDataSize_p);
|
if (ShbError != kShbOk) {
|
||||||
if(ShbError != kShbOk)
|
// error goto exit
|
||||||
{
|
goto Exit;
|
||||||
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
// resolve the pointer to the event structure
|
BENCHMARK_MOD_28_SET(1);
|
||||||
pEplEvent = (tEplEvent *) abDataBuffer;
|
// call processfunction
|
||||||
// set Datasize
|
EplEventuProcess(pEplEvent);
|
||||||
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);
|
BENCHMARK_MOD_28_RESET(1);
|
||||||
// call processfunction
|
// read number of left messages to process
|
||||||
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
|
// d.k. not needed because it is already done in SharedBuff
|
||||||
/* ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount);
|
/* ShbError = ShbCirGetReadBlockCount (pShbRxInstance_p, &ulBlockCount);
|
||||||
if (ShbError != kShbOk)
|
if (ShbError != kShbOk)
|
||||||
|
@ -804,10 +806,9 @@ BYTE abDataBuffer[sizeof(tEplEvent) + EPL_MAX_EVENT_ARG_SIZE];
|
||||||
}
|
}
|
||||||
} while (ulBlockCount > 0);
|
} while (ulBlockCount > 0);
|
||||||
*/
|
*/
|
||||||
Exit:
|
Exit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -124,10 +122,9 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplIdentResponse *m_apIdentResponse[254]; // the IdentResponse are managed dynamically
|
||||||
tEplIdentResponse* m_apIdentResponse[254]; // the IdentResponse are managed dynamically
|
tEplIdentuCbResponse m_apfnCbResponse[254];
|
||||||
tEplIdentuCbResponse m_apfnCbResponse[254];
|
|
||||||
|
|
||||||
} tEplIdentuInstance;
|
} tEplIdentuInstance;
|
||||||
|
|
||||||
|
@ -135,7 +132,7 @@ typedef struct
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplIdentuInstance EplIdentuInstance_g;
|
static tEplIdentuInstance EplIdentuInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
|
@ -169,14 +166,13 @@ static tEplKernel PUBLIC EplIdentuCbIdentResponse(tEplFrameInfo * pFrameInfo_p);
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuInit()
|
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplIdentuAddInstance();
|
Ret = EplIdentuAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuAddInstance
|
// Function: EplIdentuAddInstance
|
||||||
|
@ -197,21 +193,23 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuAddInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof (EplIdentuInstance_g));
|
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof(EplIdentuInstance_g));
|
||||||
|
|
||||||
// register IdentResponse callback function
|
// register IdentResponse callback function
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndIdentResponse, EplIdentuCbIdentResponse, kEplDllAsndFilterAny);
|
Ret =
|
||||||
|
EplDlluCalRegAsndService(kEplDllAsndIdentResponse,
|
||||||
|
EplIdentuCbIdentResponse,
|
||||||
|
kEplDllAsndFilterAny);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuDelInstance
|
// Function: EplIdentuDelInstance
|
||||||
|
@ -232,20 +230,21 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuDelInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// deregister IdentResponse callback function
|
// deregister IdentResponse callback function
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndIdentResponse, NULL, kEplDllAsndFilterNone);
|
Ret =
|
||||||
|
EplDlluCalRegAsndService(kEplDllAsndIdentResponse, NULL,
|
||||||
|
kEplDllAsndFilterNone);
|
||||||
|
|
||||||
Ret = EplIdentuReset();
|
Ret = EplIdentuReset();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuReset
|
// Function: EplIdentuReset
|
||||||
|
@ -266,26 +265,25 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuReset()
|
EPLDLLEXPORT tEplKernel PUBLIC EplIdentuReset()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
int iIndex;
|
int iIndex;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
for (iIndex = 0; iIndex < tabentries (EplIdentuInstance_g.m_apIdentResponse); iIndex++)
|
for (iIndex = 0;
|
||||||
{
|
iIndex < tabentries(EplIdentuInstance_g.m_apIdentResponse);
|
||||||
if (EplIdentuInstance_g.m_apIdentResponse[iIndex] != NULL)
|
iIndex++) {
|
||||||
{ // free memory
|
if (EplIdentuInstance_g.m_apIdentResponse[iIndex] != NULL) { // free memory
|
||||||
EPL_FREE(EplIdentuInstance_g.m_apIdentResponse[iIndex]);
|
EPL_FREE(EplIdentuInstance_g.m_apIdentResponse[iIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof (EplIdentuInstance_g));
|
EPL_MEMSET(&EplIdentuInstance_g, 0, sizeof(EplIdentuInstance_g));
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuGetIdentResponse
|
// Function: EplIdentuGetIdentResponse
|
||||||
|
@ -302,31 +300,28 @@ int iIndex;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplIdentuGetIdentResponse(
|
tEplKernel PUBLIC EplIdentuGetIdentResponse(unsigned int uiNodeId_p,
|
||||||
unsigned int uiNodeId_p,
|
tEplIdentResponse **
|
||||||
tEplIdentResponse** ppIdentResponse_p)
|
ppIdentResponse_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// decrement node ID, because array is zero based
|
// decrement node ID, because array is zero based
|
||||||
uiNodeId_p--;
|
uiNodeId_p--;
|
||||||
if (uiNodeId_p < tabentries (EplIdentuInstance_g.m_apIdentResponse))
|
if (uiNodeId_p < tabentries(EplIdentuInstance_g.m_apIdentResponse)) {
|
||||||
{
|
*ppIdentResponse_p =
|
||||||
*ppIdentResponse_p = EplIdentuInstance_g.m_apIdentResponse[uiNodeId_p];
|
EplIdentuInstance_g.m_apIdentResponse[uiNodeId_p];
|
||||||
}
|
} else { // invalid node ID specified
|
||||||
else
|
*ppIdentResponse_p = NULL;
|
||||||
{ // invalid node ID specified
|
Ret = kEplInvalidNodeId;
|
||||||
*ppIdentResponse_p = NULL;
|
}
|
||||||
Ret = kEplInvalidNodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuRequestIdentResponse
|
// Function: EplIdentuRequestIdentResponse
|
||||||
|
@ -343,42 +338,38 @@ tEplKernel Ret;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplIdentuRequestIdentResponse(
|
tEplKernel PUBLIC EplIdentuRequestIdentResponse(unsigned int uiNodeId_p,
|
||||||
unsigned int uiNodeId_p,
|
tEplIdentuCbResponse
|
||||||
tEplIdentuCbResponse pfnCbResponse_p)
|
pfnCbResponse_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// decrement node ID, because array is zero based
|
// decrement node ID, because array is zero based
|
||||||
uiNodeId_p--;
|
uiNodeId_p--;
|
||||||
if (uiNodeId_p < tabentries (EplIdentuInstance_g.m_apfnCbResponse))
|
if (uiNodeId_p < tabentries(EplIdentuInstance_g.m_apfnCbResponse)) {
|
||||||
{
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
if (EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL)
|
if (EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL) { // request already issued (maybe by someone else)
|
||||||
{ // request already issued (maybe by someone else)
|
Ret = kEplInvalidOperation;
|
||||||
Ret = kEplInvalidOperation;
|
} else {
|
||||||
}
|
EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] =
|
||||||
else
|
pfnCbResponse_p;
|
||||||
{
|
Ret =
|
||||||
EplIdentuInstance_g.m_apfnCbResponse[uiNodeId_p] = pfnCbResponse_p;
|
EplDlluCalIssueRequest(kEplDllReqServiceIdent,
|
||||||
Ret = EplDlluCalIssueRequest(kEplDllReqServiceIdent, (uiNodeId_p + 1), 0xFF);
|
(uiNodeId_p + 1), 0xFF);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Ret = kEplInvalidOperation;
|
Ret = kEplInvalidOperation;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else { // invalid node ID specified
|
||||||
else
|
Ret = kEplInvalidNodeId;
|
||||||
{ // invalid node ID specified
|
}
|
||||||
Ret = kEplInvalidNodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplIdentuGetRunningRequests
|
// Function: EplIdentuGetRunningRequests
|
||||||
|
@ -399,21 +390,18 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void)
|
EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void)
|
||||||
{
|
{
|
||||||
DWORD dwReqs = 0;
|
DWORD dwReqs = 0;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
|
|
||||||
for (uiIndex = 0; uiIndex < 32; uiIndex++)
|
for (uiIndex = 0; uiIndex < 32; uiIndex++) {
|
||||||
{
|
if (EplIdentuInstance_g.m_apfnCbResponse[uiIndex] != NULL) {
|
||||||
if (EplIdentuInstance_g.m_apfnCbResponse[uiIndex] != NULL)
|
dwReqs |= (1 << uiIndex);
|
||||||
{
|
}
|
||||||
dwReqs |= (1 << uiIndex);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dwReqs;
|
return dwReqs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -440,58 +428,61 @@ unsigned int uiIndex;
|
||||||
|
|
||||||
static tEplKernel PUBLIC EplIdentuCbIdentResponse(tEplFrameInfo * pFrameInfo_p)
|
static tEplKernel PUBLIC EplIdentuCbIdentResponse(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
tEplIdentuCbResponse pfnCbResponse;
|
tEplIdentuCbResponse pfnCbResponse;
|
||||||
|
|
||||||
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
|
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
|
||||||
|
|
||||||
uiIndex = uiNodeId - 1;
|
uiIndex = uiNodeId - 1;
|
||||||
|
|
||||||
if (uiIndex < tabentries (EplIdentuInstance_g.m_apfnCbResponse))
|
if (uiIndex < tabentries(EplIdentuInstance_g.m_apfnCbResponse)) {
|
||||||
{
|
// memorize pointer to callback function
|
||||||
// memorize pointer to callback function
|
pfnCbResponse = EplIdentuInstance_g.m_apfnCbResponse[uiIndex];
|
||||||
pfnCbResponse = EplIdentuInstance_g.m_apfnCbResponse[uiIndex];
|
// reset callback function pointer so that caller may issue next request immediately
|
||||||
// reset callback function pointer so that caller may issue next request immediately
|
EplIdentuInstance_g.m_apfnCbResponse[uiIndex] = NULL;
|
||||||
EplIdentuInstance_g.m_apfnCbResponse[uiIndex] = NULL;
|
|
||||||
|
|
||||||
if (pFrameInfo_p->m_uiFrameSize < EPL_C_DLL_MINSIZE_IDENTRES)
|
if (pFrameInfo_p->m_uiFrameSize < EPL_C_DLL_MINSIZE_IDENTRES) { // IdentResponse not received or it has invalid size
|
||||||
{ // IdentResponse not received or it has invalid size
|
if (pfnCbResponse == NULL) { // response was not requested
|
||||||
if (pfnCbResponse == NULL)
|
goto Exit;
|
||||||
{ // response was not requested
|
}
|
||||||
goto Exit;
|
Ret = pfnCbResponse(uiNodeId, NULL);
|
||||||
}
|
} else { // IdentResponse received
|
||||||
Ret = pfnCbResponse(uiNodeId, NULL);
|
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL) { // memory for IdentResponse must be allocated
|
||||||
}
|
EplIdentuInstance_g.m_apIdentResponse[uiIndex] =
|
||||||
else
|
EPL_MALLOC(sizeof(tEplIdentResponse));
|
||||||
{ // IdentResponse received
|
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL) { // malloc failed
|
||||||
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL)
|
if (pfnCbResponse == NULL) { // response was not requested
|
||||||
{ // memory for IdentResponse must be allocated
|
goto Exit;
|
||||||
EplIdentuInstance_g.m_apIdentResponse[uiIndex] = EPL_MALLOC(sizeof (tEplIdentResponse));
|
}
|
||||||
if (EplIdentuInstance_g.m_apIdentResponse[uiIndex] == NULL)
|
Ret =
|
||||||
{ // malloc failed
|
pfnCbResponse(uiNodeId,
|
||||||
if (pfnCbResponse == NULL)
|
&pFrameInfo_p->
|
||||||
{ // response was not requested
|
m_pFrame->m_Data.
|
||||||
goto Exit;
|
m_Asnd.m_Payload.
|
||||||
}
|
m_IdentResponse);
|
||||||
Ret = pfnCbResponse(uiNodeId, &pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.m_IdentResponse);
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
}
|
||||||
}
|
// copy IdentResponse to instance structure
|
||||||
// copy IdentResponse to instance structure
|
EPL_MEMCPY(EplIdentuInstance_g.
|
||||||
EPL_MEMCPY(EplIdentuInstance_g.m_apIdentResponse[uiIndex], &pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.m_IdentResponse, sizeof(tEplIdentResponse));
|
m_apIdentResponse[uiIndex],
|
||||||
if (pfnCbResponse == NULL)
|
&pFrameInfo_p->m_pFrame->m_Data.m_Asnd.
|
||||||
{ // response was not requested
|
m_Payload.m_IdentResponse,
|
||||||
goto Exit;
|
sizeof(tEplIdentResponse));
|
||||||
}
|
if (pfnCbResponse == NULL) { // response was not requested
|
||||||
Ret = pfnCbResponse(uiNodeId, EplIdentuInstance_g.m_apIdentResponse[uiIndex]);
|
goto Exit;
|
||||||
}
|
}
|
||||||
}
|
Ret =
|
||||||
|
pfnCbResponse(uiNodeId,
|
||||||
|
EplIdentuInstance_g.
|
||||||
|
m_apIdentResponse[uiIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,9 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
unsigned int m_uiNodeId;
|
||||||
unsigned int m_uiNodeId;
|
tEplNmtuCheckEventCallback m_pfnCheckEventCb;
|
||||||
tEplNmtuCheckEventCallback m_pfnCheckEventCb;
|
|
||||||
|
|
||||||
} tEplNmtCnuInstance;
|
} tEplNmtCnuInstance;
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ typedef struct
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplNmtCnuInstance EplNmtCnuInstance_g;
|
static tEplNmtCnuInstance EplNmtCnuInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
|
@ -109,12 +108,10 @@ static tEplNmtCnuInstance EplNmtCnuInstance_g;
|
||||||
|
|
||||||
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p);
|
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p);
|
||||||
|
|
||||||
static BOOL EplNmtCnuNodeIdList(BYTE* pbNmtCommandDate_p);
|
static BOOL EplNmtCnuNodeIdList(BYTE * pbNmtCommandDate_p);
|
||||||
|
|
||||||
static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p);
|
static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -140,11 +137,11 @@ static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuInit(unsigned int uiNodeId_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuInit(unsigned int uiNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplNmtCnuAddInstance(uiNodeId_p);
|
Ret = EplNmtCnuAddInstance(uiNodeId_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -166,25 +163,24 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuAddInstance(unsigned int uiNodeId_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuAddInstance(unsigned int uiNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplNmtCnuInstance_g, 0, sizeof (EplNmtCnuInstance_g));
|
EPL_MEMSET(&EplNmtCnuInstance_g, 0, sizeof(EplNmtCnuInstance_g));
|
||||||
|
|
||||||
// save nodeid
|
// save nodeid
|
||||||
EplNmtCnuInstance_g.m_uiNodeId = uiNodeId_p;
|
EplNmtCnuInstance_g.m_uiNodeId = uiNodeId_p;
|
||||||
|
|
||||||
// register callback-function for NMT-commands
|
// register callback-function for NMT-commands
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
|
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
|
||||||
EplNmtCnuCommandCb,
|
EplNmtCnuCommandCb,
|
||||||
kEplDllAsndFilterLocal);
|
kEplDllAsndFilterLocal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return Ret;
|
||||||
return Ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,18 +203,17 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuDelInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
// deregister callback function from DLL
|
// deregister callback function from DLL
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
|
Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
|
||||||
NULL,
|
NULL, kEplDllAsndFilterNone);
|
||||||
kEplDllAsndFilterNone);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -239,49 +234,50 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuSendNmtRequest(
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuSendNmtRequest(unsigned int uiNodeId_p,
|
||||||
unsigned int uiNodeId_p,
|
tEplNmtCommand
|
||||||
tEplNmtCommand NmtCommand_p)
|
NmtCommand_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
tEplFrameInfo NmtRequestFrameInfo;
|
tEplFrameInfo NmtRequestFrameInfo;
|
||||||
tEplFrame NmtRequestFrame;
|
tEplFrame NmtRequestFrame;
|
||||||
|
|
||||||
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
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, (BYTE) EPL_C_ADR_MN_DEF_NODE_ID); // node id of the MN
|
||||||
|
AmiSetByteToLe(&NmtRequestFrame.m_le_bMessageType,
|
||||||
|
(BYTE) kEplMsgTypeAsnd);
|
||||||
|
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_le_bServiceId,
|
||||||
|
(BYTE) kEplDllAsndNmtRequest);
|
||||||
|
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.
|
||||||
|
m_NmtRequestService.m_le_bNmtCommandId,
|
||||||
|
(BYTE) NmtCommand_p);
|
||||||
|
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.m_le_bTargetNodeId, (BYTE) 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 frame
|
// build info-structure
|
||||||
EPL_MEMSET(&NmtRequestFrame.m_be_abDstMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abDstMac)); // set by DLL
|
NmtRequestFrameInfo.m_NetTime.m_dwNanoSec = 0;
|
||||||
EPL_MEMSET(&NmtRequestFrame.m_be_abSrcMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abSrcMac)); // set by DLL
|
NmtRequestFrameInfo.m_NetTime.m_dwSec = 0;
|
||||||
AmiSetWordToBe(&NmtRequestFrame.m_be_wEtherType, EPL_C_DLL_ETHERTYPE_EPL);
|
NmtRequestFrameInfo.m_pFrame = &NmtRequestFrame;
|
||||||
AmiSetByteToLe(&NmtRequestFrame.m_le_bDstNodeId, (BYTE) EPL_C_ADR_MN_DEF_NODE_ID); // node id of the MN
|
NmtRequestFrameInfo.m_uiFrameSize = EPL_C_DLL_MINSIZE_NMTREQ; // sizeof(NmtRequestFrame);
|
||||||
AmiSetByteToLe(&NmtRequestFrame.m_le_bMessageType, (BYTE)kEplMsgTypeAsnd);
|
|
||||||
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_le_bServiceId, (BYTE) kEplDllAsndNmtRequest);
|
|
||||||
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.m_le_bNmtCommandId,
|
|
||||||
(BYTE)NmtCommand_p);
|
|
||||||
AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.m_le_bTargetNodeId,
|
|
||||||
(BYTE)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));
|
|
||||||
|
|
||||||
|
// send NMT-Request
|
||||||
|
|
||||||
// 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)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
Ret = EplDlluCalAsyncSend(&NmtRequestFrameInfo, // pointer to frameinfo
|
Ret = EplDlluCalAsyncSend(&NmtRequestFrameInfo, // pointer to frameinfo
|
||||||
kEplDllAsyncReqPrioNmt); // priority
|
kEplDllAsyncReqPrioNmt); // priority
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return Ret;
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplNmtCnuRegisterStateChangeCb
|
// Function: EplNmtCnuRegisterStateChangeCb
|
||||||
|
@ -301,17 +297,18 @@ tEplFrame NmtRequestFrame;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuRegisterCheckEventCb(
|
EPLDLLEXPORT tEplKernel PUBLIC
|
||||||
tEplNmtuCheckEventCallback pfnEplNmtCheckEventCb_p)
|
EplNmtCnuRegisterCheckEventCb(tEplNmtuCheckEventCallback
|
||||||
|
pfnEplNmtCheckEventCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// save callback-function in modul global var
|
// save callback-function in modul global var
|
||||||
EplNmtCnuInstance_g.m_pfnCheckEventCb = pfnEplNmtCheckEventCb_p;
|
EplNmtCnuInstance_g.m_pfnCheckEventCb = pfnEplNmtCheckEventCb_p;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +318,6 @@ tEplKernel Ret;
|
||||||
// //
|
// //
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplNmtCnuCommandCb
|
// Function: EplNmtCnuCommandCb
|
||||||
|
@ -341,273 +337,290 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p)
|
static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplNmtCommand NmtCommand;
|
tEplNmtCommand NmtCommand;
|
||||||
BOOL fNodeIdInList;
|
BOOL fNodeIdInList;
|
||||||
tEplNmtEvent NmtEvent = kEplNmtEventNoEvent;
|
tEplNmtEvent NmtEvent = kEplNmtEventNoEvent;
|
||||||
|
|
||||||
|
if (pFrameInfo_p == NULL) {
|
||||||
|
Ret = kEplNmtInvalidFramePointer;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
if(pFrameInfo_p == NULL)
|
NmtCommand = EplNmtCnuGetNmtCommand(pFrameInfo_p);
|
||||||
{
|
|
||||||
Ret = kEplNmtInvalidFramePointer;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
NmtCommand = EplNmtCnuGetNmtCommand(pFrameInfo_p);
|
// check NMT-Command
|
||||||
|
switch (NmtCommand) {
|
||||||
|
|
||||||
// check NMT-Command
|
//------------------------------------------------------------------------
|
||||||
switch(NmtCommand)
|
// plain NMT state commands
|
||||||
{
|
case kEplNmtCmdStartNode:
|
||||||
|
{ // send NMT-Event to state maschine kEplNmtEventStartNode
|
||||||
|
NmtEvent = kEplNmtEventStartNode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
case kEplNmtCmdStopNode:
|
||||||
// plain NMT state commands
|
{ // send NMT-Event to state maschine kEplNmtEventStopNode
|
||||||
case kEplNmtCmdStartNode:
|
NmtEvent = kEplNmtEventStopNode;
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventStartNode
|
break;
|
||||||
NmtEvent = kEplNmtEventStartNode;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case kEplNmtCmdStopNode:
|
case kEplNmtCmdEnterPreOperational2:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventStopNode
|
{ // send NMT-Event to state maschine kEplNmtEventEnterPreOperational2
|
||||||
NmtEvent = kEplNmtEventStopNode;
|
NmtEvent = kEplNmtEventEnterPreOperational2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdEnterPreOperational2:
|
case kEplNmtCmdEnableReadyToOperate:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventEnterPreOperational2
|
{ // send NMT-Event to state maschine kEplNmtEventEnableReadyToOperate
|
||||||
NmtEvent = kEplNmtEventEnterPreOperational2;
|
NmtEvent = kEplNmtEventEnableReadyToOperate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdEnableReadyToOperate:
|
case kEplNmtCmdResetNode:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventEnableReadyToOperate
|
{ // send NMT-Event to state maschine kEplNmtEventResetNode
|
||||||
NmtEvent = kEplNmtEventEnableReadyToOperate;
|
NmtEvent = kEplNmtEventResetNode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetNode:
|
case kEplNmtCmdResetCommunication:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventResetNode
|
{ // send NMT-Event to state maschine kEplNmtEventResetCom
|
||||||
NmtEvent = kEplNmtEventResetNode;
|
NmtEvent = kEplNmtEventResetCom;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetCommunication:
|
case kEplNmtCmdResetConfiguration:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventResetCom
|
{ // send NMT-Event to state maschine kEplNmtEventResetConfig
|
||||||
NmtEvent = kEplNmtEventResetCom;
|
NmtEvent = kEplNmtEventResetConfig;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetConfiguration:
|
case kEplNmtCmdSwReset:
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventResetConfig
|
{ // send NMT-Event to state maschine kEplNmtEventSwReset
|
||||||
NmtEvent = kEplNmtEventResetConfig;
|
NmtEvent = kEplNmtEventSwReset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdSwReset:
|
//------------------------------------------------------------------------
|
||||||
{ // send NMT-Event to state maschine kEplNmtEventSwReset
|
// extended NMT state commands
|
||||||
NmtEvent = kEplNmtEventSwReset;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
case kEplNmtCmdStartNodeEx:
|
||||||
// extended NMT state commands
|
{
|
||||||
|
// 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 kEplNmtCmdStartNodeEx:
|
case kEplNmtCmdStopNodeEx:
|
||||||
{
|
{ // check if own nodeid is in EPL node list
|
||||||
// check if own nodeid is in EPL node list
|
fNodeIdInList =
|
||||||
fNodeIdInList = EplNmtCnuNodeIdList(&(pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.m_NmtCommandService.m_le_abNmtCommandData[0]));
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
if(fNodeIdInList != FALSE)
|
m_Asnd.m_Payload.
|
||||||
{ // own nodeid in list
|
m_NmtCommandService.
|
||||||
// send event to process command
|
m_le_abNmtCommandData[0]);
|
||||||
NmtEvent = kEplNmtEventStartNode;
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
}
|
// send event to process command
|
||||||
break;
|
NmtEvent = kEplNmtEventStopNode;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdStopNodeEx:
|
case kEplNmtCmdEnterPreOperational2Ex:
|
||||||
{ // check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventStopNode;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventEnterPreOperational2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdEnterPreOperational2Ex:
|
case kEplNmtCmdEnableReadyToOperateEx:
|
||||||
{ // check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventEnterPreOperational2;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventEnableReadyToOperate;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdEnableReadyToOperateEx:
|
case kEplNmtCmdResetNodeEx:
|
||||||
{ // check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventEnableReadyToOperate;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventResetNode;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetNodeEx:
|
case kEplNmtCmdResetCommunicationEx:
|
||||||
{// check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventResetNode;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventResetCom;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetCommunicationEx:
|
case kEplNmtCmdResetConfigurationEx:
|
||||||
{ // check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventResetCom;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventResetConfig;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdResetConfigurationEx:
|
case kEplNmtCmdSwResetEx:
|
||||||
{ // check if own nodeid is in EPL node list
|
{ // 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]);
|
fNodeIdInList =
|
||||||
if(fNodeIdInList != FALSE)
|
EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
{ // own nodeid in list
|
m_Asnd.m_Payload.
|
||||||
// send event to process command
|
m_NmtCommandService.
|
||||||
NmtEvent = kEplNmtEventResetConfig;
|
m_le_abNmtCommandData[0]);
|
||||||
}
|
if (fNodeIdInList != FALSE) { // own nodeid in list
|
||||||
break;
|
// send event to process command
|
||||||
}
|
NmtEvent = kEplNmtEventSwReset;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdSwResetEx:
|
//------------------------------------------------------------------------
|
||||||
{ // check if own nodeid is in EPL node list
|
// NMT managing commands
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// TODO: add functions to process managing command (optional)
|
||||||
// NMT managing commands
|
|
||||||
|
|
||||||
// TODO: add functions to process managing command (optional)
|
case kEplNmtCmdNetHostNameSet:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdNetHostNameSet:
|
case kEplNmtCmdFlushArpEntry:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdFlushArpEntry:
|
//------------------------------------------------------------------------
|
||||||
{
|
// NMT info services
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
// TODO: forward event with infos to the application (optional)
|
||||||
// NMT info services
|
|
||||||
|
|
||||||
// TODO: forward event with infos to the application (optional)
|
case kEplNmtCmdPublishConfiguredCN:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishConfiguredCN:
|
case kEplNmtCmdPublishActiveCN:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishActiveCN:
|
case kEplNmtCmdPublishPreOperational1:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishPreOperational1:
|
case kEplNmtCmdPublishPreOperational2:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishPreOperational2:
|
case kEplNmtCmdPublishReadyToOperate:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishReadyToOperate:
|
case kEplNmtCmdPublishOperational:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishOperational:
|
case kEplNmtCmdPublishStopped:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishStopped:
|
case kEplNmtCmdPublishEmergencyNew:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishEmergencyNew:
|
case kEplNmtCmdPublishTime:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kEplNmtCmdPublishTime:
|
//-----------------------------------------------------------------------
|
||||||
{
|
// error from MN
|
||||||
break;
|
// -> requested command not supported by MN
|
||||||
}
|
case kEplNmtCmdInvalidService:
|
||||||
|
{
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
// TODO: errorevent to application
|
||||||
// error from MN
|
break;
|
||||||
// -> requested command not supported by MN
|
}
|
||||||
case kEplNmtCmdInvalidService:
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO: errorevent to application
|
//------------------------------------------------------------------------
|
||||||
break;
|
// default
|
||||||
}
|
default:
|
||||||
|
{
|
||||||
|
Ret = kEplNmtUnknownCommand;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
} // end of switch(NmtCommand)
|
||||||
// default
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Ret = kEplNmtUnknownCommand;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}// end of switch(NmtCommand)
|
if (NmtEvent != kEplNmtEventNoEvent) {
|
||||||
|
if (EplNmtCnuInstance_g.m_pfnCheckEventCb != NULL) {
|
||||||
if (NmtEvent != kEplNmtEventNoEvent)
|
Ret = EplNmtCnuInstance_g.m_pfnCheckEventCb(NmtEvent);
|
||||||
{
|
if (Ret == kEplReject) {
|
||||||
if (EplNmtCnuInstance_g.m_pfnCheckEventCb != NULL)
|
Ret = kEplSuccessful;
|
||||||
{
|
goto Exit;
|
||||||
Ret = EplNmtCnuInstance_g.m_pfnCheckEventCb(NmtEvent);
|
} else if (Ret != kEplSuccessful) {
|
||||||
if (Ret == kEplReject)
|
goto Exit;
|
||||||
{
|
}
|
||||||
Ret = kEplSuccessful;
|
}
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
else if (Ret != kEplSuccessful)
|
|
||||||
{
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
||||||
Ret = EplNmtuNmtEvent(NmtEvent);
|
Ret = EplNmtuNmtEvent(NmtEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,14 +644,18 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p)
|
static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplNmtCommand NmtCommand;
|
tEplNmtCommand NmtCommand;
|
||||||
tEplNmtCommandService* pNmtCommandService;
|
tEplNmtCommandService *pNmtCommandService;
|
||||||
|
|
||||||
pNmtCommandService = &pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.m_NmtCommandService;
|
pNmtCommandService =
|
||||||
|
&pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.
|
||||||
|
m_NmtCommandService;
|
||||||
|
|
||||||
NmtCommand = (tEplNmtCommand)AmiGetByteFromLe(&pNmtCommandService->m_le_bNmtCommandId);
|
NmtCommand =
|
||||||
|
(tEplNmtCommand) AmiGetByteFromLe(&pNmtCommandService->
|
||||||
|
m_le_bNmtCommandId);
|
||||||
|
|
||||||
return NmtCommand;
|
return NmtCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -659,33 +676,29 @@ tEplNmtCommandService* pNmtCommandService;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static BOOL EplNmtCnuNodeIdList(BYTE* pbNmtCommandDate_p)
|
static BOOL EplNmtCnuNodeIdList(BYTE * pbNmtCommandDate_p)
|
||||||
{
|
{
|
||||||
BOOL fNodeIdInList;
|
BOOL fNodeIdInList;
|
||||||
unsigned int uiByteOffset;
|
unsigned int uiByteOffset;
|
||||||
BYTE bBitOffset;
|
BYTE bBitOffset;
|
||||||
BYTE bNodeListByte;
|
BYTE bNodeListByte;
|
||||||
|
|
||||||
// get byte-offset of the own nodeid in NodeIdList
|
// get byte-offset of the own nodeid in NodeIdList
|
||||||
// devide though 8
|
// devide though 8
|
||||||
uiByteOffset = (unsigned int)(EplNmtCnuInstance_g.m_uiNodeId >> 3);
|
uiByteOffset = (unsigned int)(EplNmtCnuInstance_g.m_uiNodeId >> 3);
|
||||||
// get bitoffset
|
// get bitoffset
|
||||||
bBitOffset = (BYTE) EplNmtCnuInstance_g.m_uiNodeId % 8;
|
bBitOffset = (BYTE) EplNmtCnuInstance_g.m_uiNodeId % 8;
|
||||||
|
|
||||||
bNodeListByte = AmiGetByteFromLe(&pbNmtCommandDate_p[uiByteOffset]);
|
bNodeListByte = AmiGetByteFromLe(&pbNmtCommandDate_p[uiByteOffset]);
|
||||||
if((bNodeListByte & bBitOffset) == 0)
|
if ((bNodeListByte & bBitOffset) == 0) {
|
||||||
{
|
fNodeIdInList = FALSE;
|
||||||
fNodeIdInList = FALSE;
|
} else {
|
||||||
}
|
fNodeIdInList = TRUE;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
fNodeIdInList = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fNodeIdInList;
|
return fNodeIdInList;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
|
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -71,11 +71,9 @@
|
||||||
|
|
||||||
#include "kernel/EplNmtkCal.h"
|
#include "kernel/EplNmtkCal.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: init function needed to prepare EplNmtkGetNmtState for
|
// TODO: init function needed to prepare EplNmtkGetNmtState for
|
||||||
// io-controll-call from EplNmtuCal-Modul
|
// io-controll-call from EplNmtuCal-Modul
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -100,8 +98,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -126,7 +122,6 @@
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -151,7 +146,4 @@
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "EplInc.h"
|
#include "EplInc.h"
|
||||||
#include "user/EplNmtu.h"
|
#include "user/EplNmtu.h"
|
||||||
#include "user/EplObdu.h"
|
#include "user/EplObdu.h"
|
||||||
|
@ -94,10 +93,9 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplNmtuStateChangeCallback m_pfnNmtChangeCb;
|
||||||
tEplNmtuStateChangeCallback m_pfnNmtChangeCb;
|
tEplTimerHdl m_TimerHdl;
|
||||||
tEplTimerHdl m_TimerHdl;
|
|
||||||
|
|
||||||
} tEplNmtuInstance;
|
} tEplNmtuInstance;
|
||||||
|
|
||||||
|
@ -136,11 +134,11 @@ static tEplNmtuInstance EplNmtuInstance_g;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuInit()
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplNmtuAddInstance();
|
Ret = EplNmtuAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -162,13 +160,13 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuAddInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
|
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,16 +189,16 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuDelInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
|
EplNmtuInstance_g.m_pfnNmtChangeCb = NULL;
|
||||||
|
|
||||||
// delete timer
|
// delete timer
|
||||||
Ret = EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
|
Ret = EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,20 +221,19 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuNmtEvent(tEplNmtEvent NmtEvent_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuNmtEvent(tEplNmtEvent NmtEvent_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkNmtk;
|
Event.m_EventSink = kEplEventSinkNmtk;
|
||||||
Event.m_NetTime.m_dwNanoSec = 0;
|
Event.m_NetTime.m_dwNanoSec = 0;
|
||||||
Event.m_NetTime.m_dwSec = 0;
|
Event.m_NetTime.m_dwSec = 0;
|
||||||
Event.m_EventType = kEplEventTypeNmtEvent;
|
Event.m_EventType = kEplEventTypeNmtEvent;
|
||||||
Event.m_pArg = &NmtEvent_p;
|
Event.m_pArg = &NmtEvent_p;
|
||||||
Event.m_uiSize = sizeof(NmtEvent_p);
|
Event.m_uiSize = sizeof(NmtEvent_p);
|
||||||
|
|
||||||
Ret = EplEventuPost(&Event);
|
Ret = EplEventuPost(&Event);
|
||||||
|
|
||||||
|
return Ret;
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -258,16 +255,16 @@ tEplEvent Event;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplNmtState PUBLIC EplNmtuGetNmtState()
|
EPLDLLEXPORT tEplNmtState PUBLIC EplNmtuGetNmtState()
|
||||||
{
|
{
|
||||||
tEplNmtState NmtState;
|
tEplNmtState NmtState;
|
||||||
|
|
||||||
// $$$ call function of communication abstraction layer
|
// $$$ call function of communication abstraction layer
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
|
||||||
NmtState = EplNmtkGetNmtState();
|
NmtState = EplNmtkGetNmtState();
|
||||||
#else
|
#else
|
||||||
NmtState = 0;
|
NmtState = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NmtState;
|
return NmtState;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -287,335 +284,366 @@ tEplNmtState NmtState;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuProcessEvent(
|
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuProcessEvent(tEplEvent * pEplEvent_p)
|
||||||
tEplEvent* pEplEvent_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// process event
|
// process event
|
||||||
switch(pEplEvent_p->m_EventType)
|
switch (pEplEvent_p->m_EventType) {
|
||||||
{
|
// state change of NMT-Module
|
||||||
// state change of NMT-Module
|
case kEplEventTypeNmtStateChange:
|
||||||
case kEplEventTypeNmtStateChange:
|
{
|
||||||
{
|
tEplEventNmtStateChange *pNmtStateChange;
|
||||||
tEplEventNmtStateChange* pNmtStateChange;
|
|
||||||
|
|
||||||
// delete timer
|
// delete timer
|
||||||
Ret = EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
|
Ret =
|
||||||
|
EplTimeruDeleteTimer(&EplNmtuInstance_g.m_TimerHdl);
|
||||||
|
|
||||||
pNmtStateChange = (tEplEventNmtStateChange*)pEplEvent_p->m_pArg;
|
pNmtStateChange =
|
||||||
|
(tEplEventNmtStateChange *) pEplEvent_p->m_pArg;
|
||||||
|
|
||||||
// call cb-functions to inform higher layer
|
// call cb-functions to inform higher layer
|
||||||
if(EplNmtuInstance_g.m_pfnNmtChangeCb != NULL)
|
if (EplNmtuInstance_g.m_pfnNmtChangeCb != NULL) {
|
||||||
{
|
Ret =
|
||||||
Ret = EplNmtuInstance_g.m_pfnNmtChangeCb(*pNmtStateChange);
|
EplNmtuInstance_g.
|
||||||
}
|
m_pfnNmtChangeCb(*pNmtStateChange);
|
||||||
|
}
|
||||||
|
|
||||||
if (Ret == kEplSuccessful)
|
if (Ret == kEplSuccessful) { // everything is OK, so switch to next state if necessary
|
||||||
{ // everything is OK, so switch to next state if necessary
|
switch (pNmtStateChange->m_NewNmtState) {
|
||||||
switch (pNmtStateChange->m_NewNmtState)
|
// EPL stack is not running
|
||||||
{
|
case kEplNmtGsOff:
|
||||||
// EPL stack is not running
|
break;
|
||||||
case kEplNmtGsOff:
|
|
||||||
break;
|
|
||||||
|
|
||||||
// first init of the hardware
|
// first init of the hardware
|
||||||
case kEplNmtGsInitialising:
|
case kEplNmtGsInitialising:
|
||||||
{
|
{
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterResetApp);
|
Ret =
|
||||||
break;
|
EplNmtuNmtEvent
|
||||||
}
|
(kEplNmtEventEnterResetApp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// init of the manufacturer-specific profile area and the
|
// init of the manufacturer-specific profile area and the
|
||||||
// standardised device profile area
|
// standardised device profile area
|
||||||
case kEplNmtGsResetApplication:
|
case kEplNmtGsResetApplication:
|
||||||
{
|
{
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterResetCom);
|
Ret =
|
||||||
break;
|
EplNmtuNmtEvent
|
||||||
}
|
(kEplNmtEventEnterResetCom);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// init of the communication profile area
|
// init of the communication profile area
|
||||||
case kEplNmtGsResetCommunication:
|
case kEplNmtGsResetCommunication:
|
||||||
{
|
{
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterResetConfig);
|
Ret =
|
||||||
break;
|
EplNmtuNmtEvent
|
||||||
}
|
(kEplNmtEventEnterResetConfig);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// build the configuration with infos from OD
|
// build the configuration with infos from OD
|
||||||
case kEplNmtGsResetConfiguration:
|
case kEplNmtGsResetConfiguration:
|
||||||
{
|
{
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
|
|
||||||
// get node ID from OD
|
// get node ID from OD
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
uiNodeId = EplObduGetNodeId(EPL_MCO_PTR_INSTANCE_PTR);
|
uiNodeId =
|
||||||
|
EplObduGetNodeId
|
||||||
|
(EPL_MCO_PTR_INSTANCE_PTR);
|
||||||
#else
|
#else
|
||||||
uiNodeId = 0;
|
uiNodeId = 0;
|
||||||
#endif
|
#endif
|
||||||
//check node ID if not should be master or slave
|
//check node ID if not should be master or slave
|
||||||
if (uiNodeId == EPL_C_ADR_MN_DEF_NODE_ID)
|
if (uiNodeId == EPL_C_ADR_MN_DEF_NODE_ID) { // node shall be MN
|
||||||
{ // node shall be MN
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterMsNotActive);
|
Ret =
|
||||||
|
EplNmtuNmtEvent
|
||||||
|
(kEplNmtEventEnterMsNotActive);
|
||||||
#else
|
#else
|
||||||
TRACE0("EplNmtuProcess(): no MN functionality implemented\n");
|
TRACE0
|
||||||
|
("EplNmtuProcess(): no MN functionality implemented\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
} else { // node shall be CN
|
||||||
else
|
Ret =
|
||||||
{ // node shall be CN
|
EplNmtuNmtEvent
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterCsNotActive);
|
(kEplNmtEventEnterCsNotActive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// CN part of the state machine
|
// CN part of the state machine
|
||||||
|
|
||||||
// node listens for EPL-Frames and check timeout
|
// node listens for EPL-Frames and check timeout
|
||||||
case kEplNmtCsNotActive:
|
case kEplNmtCsNotActive:
|
||||||
{
|
{
|
||||||
DWORD dwBuffer;
|
DWORD dwBuffer;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
tEplTimerArg TimerArg;
|
tEplTimerArg TimerArg;
|
||||||
|
|
||||||
// create timer to switch automatically to BasicEthernet if no MN available in network
|
// create timer to switch automatically to BasicEthernet if no MN available in network
|
||||||
|
|
||||||
// read NMT_CNBasicEthernetTimerout_U32 from OD
|
// read NMT_CNBasicEthernetTimerout_U32 from OD
|
||||||
ObdSize = sizeof(dwBuffer);
|
ObdSize = sizeof(dwBuffer);
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
Ret = EplObduReadEntry(EPL_MCO_PTR_INSTANCE_PTR_
|
Ret =
|
||||||
0x1F99,
|
EplObduReadEntry
|
||||||
0x00,
|
(EPL_MCO_PTR_INSTANCE_PTR_
|
||||||
&dwBuffer,
|
0x1F99, 0x00, &dwBuffer,
|
||||||
&ObdSize);
|
&ObdSize);
|
||||||
#else
|
#else
|
||||||
Ret = kEplObdIndexNotExist;
|
Ret = kEplObdIndexNotExist;
|
||||||
#endif
|
#endif
|
||||||
if(Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) {
|
||||||
{
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (dwBuffer != 0) { // BasicEthernet is enabled
|
||||||
if (dwBuffer != 0)
|
// convert us into ms
|
||||||
{ // BasicEthernet is enabled
|
dwBuffer =
|
||||||
// convert us into ms
|
dwBuffer / 1000;
|
||||||
dwBuffer = dwBuffer / 1000;
|
if (dwBuffer == 0) { // timer was below one ms
|
||||||
if (dwBuffer == 0)
|
// set one ms
|
||||||
{ // timer was below one ms
|
dwBuffer = 1;
|
||||||
// set one ms
|
}
|
||||||
dwBuffer = 1;
|
TimerArg.m_EventSink =
|
||||||
}
|
kEplEventSinkNmtk;
|
||||||
TimerArg.m_EventSink = kEplEventSinkNmtk;
|
TimerArg.m_ulArg =
|
||||||
TimerArg.m_ulArg = (unsigned long) kEplNmtEventTimerBasicEthernet;
|
(unsigned long)
|
||||||
Ret = EplTimeruModifyTimerMs(&EplNmtuInstance_g.m_TimerHdl, (unsigned long) dwBuffer, TimerArg);
|
kEplNmtEventTimerBasicEthernet;
|
||||||
// potential error is forwarded to event queue which generates error event
|
Ret =
|
||||||
}
|
EplTimeruModifyTimerMs
|
||||||
break;
|
(&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
|
// node processes only async frames
|
||||||
case kEplNmtCsPreOperational1:
|
case kEplNmtCsPreOperational1:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// node processes isochronous and asynchronous frames
|
// node processes isochronous and asynchronous frames
|
||||||
case kEplNmtCsPreOperational2:
|
case kEplNmtCsPreOperational2:
|
||||||
{
|
{
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventEnterReadyToOperate);
|
Ret =
|
||||||
break;
|
EplNmtuNmtEvent
|
||||||
}
|
(kEplNmtEventEnterReadyToOperate);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// node should be configured und application is ready
|
// node should be configured und application is ready
|
||||||
case kEplNmtCsReadyToOperate:
|
case kEplNmtCsReadyToOperate:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal work state
|
// normal work state
|
||||||
case kEplNmtCsOperational:
|
case kEplNmtCsOperational:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// node stopped by MN
|
// node stopped by MN
|
||||||
// -> only process asynchronous frames
|
// -> only process asynchronous frames
|
||||||
case kEplNmtCsStopped:
|
case kEplNmtCsStopped:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no EPL cycle
|
// no EPL cycle
|
||||||
// -> normal ethernet communication
|
// -> normal ethernet communication
|
||||||
case kEplNmtCsBasicEthernet:
|
case kEplNmtCsBasicEthernet:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// MN part of the state machine
|
// MN part of the state machine
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
// node listens for EPL-Frames and check timeout
|
// node listens for EPL-Frames and check timeout
|
||||||
case kEplNmtMsNotActive:
|
case kEplNmtMsNotActive:
|
||||||
{
|
{
|
||||||
DWORD dwBuffer;
|
DWORD dwBuffer;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
tEplTimerArg TimerArg;
|
tEplTimerArg TimerArg;
|
||||||
|
|
||||||
// create timer to switch automatically to BasicEthernet/PreOp1 if no other MN active in network
|
// create timer to switch automatically to BasicEthernet/PreOp1 if no other MN active in network
|
||||||
|
|
||||||
// check NMT_StartUp_U32.Bit13
|
// check NMT_StartUp_U32.Bit13
|
||||||
// read NMT_StartUp_U32 from OD
|
// read NMT_StartUp_U32 from OD
|
||||||
ObdSize = sizeof(dwBuffer);
|
ObdSize = sizeof(dwBuffer);
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
Ret = EplObduReadEntry(EPL_MCO_PTR_INSTANCE_PTR_
|
Ret =
|
||||||
0x1F80,
|
EplObduReadEntry
|
||||||
0x00,
|
(EPL_MCO_PTR_INSTANCE_PTR_
|
||||||
&dwBuffer,
|
0x1F80, 0x00, &dwBuffer,
|
||||||
&ObdSize);
|
&ObdSize);
|
||||||
#else
|
#else
|
||||||
Ret = kEplObdIndexNotExist;
|
Ret = kEplObdIndexNotExist;
|
||||||
#endif
|
#endif
|
||||||
if(Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) {
|
||||||
{
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if((dwBuffer & EPL_NMTST_BASICETHERNET) == 0)
|
if ((dwBuffer & EPL_NMTST_BASICETHERNET) == 0) { // NMT_StartUp_U32.Bit13 == 0
|
||||||
{ // NMT_StartUp_U32.Bit13 == 0
|
// new state PreOperational1
|
||||||
// new state PreOperational1
|
TimerArg.m_ulArg =
|
||||||
TimerArg.m_ulArg = (unsigned long) kEplNmtEventTimerMsPreOp1;
|
(unsigned long)
|
||||||
}
|
kEplNmtEventTimerMsPreOp1;
|
||||||
else
|
} else { // NMT_StartUp_U32.Bit13 == 1
|
||||||
{ // NMT_StartUp_U32.Bit13 == 1
|
// new state BasicEthernet
|
||||||
// new state BasicEthernet
|
TimerArg.m_ulArg =
|
||||||
TimerArg.m_ulArg = (unsigned long) kEplNmtEventTimerBasicEthernet;
|
(unsigned long)
|
||||||
}
|
kEplNmtEventTimerBasicEthernet;
|
||||||
|
}
|
||||||
|
|
||||||
// read NMT_BootTime_REC.MNWaitNotAct_U32 from OD
|
// read NMT_BootTime_REC.MNWaitNotAct_U32 from OD
|
||||||
ObdSize = sizeof(dwBuffer);
|
ObdSize = sizeof(dwBuffer);
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
Ret = EplObduReadEntry(EPL_MCO_PTR_INSTANCE_PTR_
|
Ret =
|
||||||
0x1F89,
|
EplObduReadEntry
|
||||||
0x01,
|
(EPL_MCO_PTR_INSTANCE_PTR_
|
||||||
&dwBuffer,
|
0x1F89, 0x01, &dwBuffer,
|
||||||
&ObdSize);
|
&ObdSize);
|
||||||
#else
|
#else
|
||||||
Ret = kEplObdIndexNotExist;
|
Ret = kEplObdIndexNotExist;
|
||||||
#endif
|
#endif
|
||||||
if(Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) {
|
||||||
{
|
break;
|
||||||
break;
|
}
|
||||||
}
|
// convert us into ms
|
||||||
// convert us into ms
|
dwBuffer = dwBuffer / 1000;
|
||||||
dwBuffer = dwBuffer / 1000;
|
if (dwBuffer == 0) { // timer was below one ms
|
||||||
if (dwBuffer == 0)
|
// set one ms
|
||||||
{ // timer was below one ms
|
dwBuffer = 1;
|
||||||
// set one ms
|
}
|
||||||
dwBuffer = 1;
|
TimerArg.m_EventSink =
|
||||||
}
|
kEplEventSinkNmtk;
|
||||||
TimerArg.m_EventSink = kEplEventSinkNmtk;
|
Ret =
|
||||||
Ret = EplTimeruModifyTimerMs(&EplNmtuInstance_g.m_TimerHdl, (unsigned long) dwBuffer, TimerArg);
|
EplTimeruModifyTimerMs
|
||||||
// potential error is forwarded to event queue which generates error event
|
(&EplNmtuInstance_g.
|
||||||
break;
|
m_TimerHdl,
|
||||||
}
|
(unsigned long)dwBuffer,
|
||||||
|
TimerArg);
|
||||||
|
// potential error is forwarded to event queue which generates error event
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// node processes only async frames
|
// node processes only async frames
|
||||||
case kEplNmtMsPreOperational1:
|
case kEplNmtMsPreOperational1:
|
||||||
{
|
{
|
||||||
DWORD dwBuffer = 0;
|
DWORD dwBuffer = 0;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
tEplTimerArg TimerArg;
|
tEplTimerArg TimerArg;
|
||||||
|
|
||||||
// create timer to switch automatically to PreOp2 if MN identified all mandatory CNs
|
// create timer to switch automatically to PreOp2 if MN identified all mandatory CNs
|
||||||
|
|
||||||
// read NMT_BootTime_REC.MNWaitPreOp1_U32 from OD
|
// read NMT_BootTime_REC.MNWaitPreOp1_U32 from OD
|
||||||
ObdSize = sizeof(dwBuffer);
|
ObdSize = sizeof(dwBuffer);
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) || (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
Ret = EplObduReadEntry(EPL_MCO_PTR_INSTANCE_PTR_
|
Ret =
|
||||||
0x1F89,
|
EplObduReadEntry
|
||||||
0x03,
|
(EPL_MCO_PTR_INSTANCE_PTR_
|
||||||
&dwBuffer,
|
0x1F89, 0x03, &dwBuffer,
|
||||||
&ObdSize);
|
&ObdSize);
|
||||||
if(Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) {
|
||||||
{
|
// ignore error, because this timeout is optional
|
||||||
// ignore error, because this timeout is optional
|
dwBuffer = 0;
|
||||||
dwBuffer = 0;
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (dwBuffer == 0)
|
if (dwBuffer == 0) { // delay is deactivated
|
||||||
{ // delay is deactivated
|
// immediately post timer event
|
||||||
// immediately post timer event
|
Ret =
|
||||||
Ret = EplNmtuNmtEvent(kEplNmtEventTimerMsPreOp2);
|
EplNmtuNmtEvent
|
||||||
break;
|
(kEplNmtEventTimerMsPreOp2);
|
||||||
}
|
break;
|
||||||
// convert us into ms
|
}
|
||||||
dwBuffer = dwBuffer / 1000;
|
// convert us into ms
|
||||||
if (dwBuffer == 0)
|
dwBuffer = dwBuffer / 1000;
|
||||||
{ // timer was below one ms
|
if (dwBuffer == 0) { // timer was below one ms
|
||||||
// set one ms
|
// set one ms
|
||||||
dwBuffer = 1;
|
dwBuffer = 1;
|
||||||
}
|
}
|
||||||
TimerArg.m_EventSink = kEplEventSinkNmtk;
|
TimerArg.m_EventSink =
|
||||||
TimerArg.m_ulArg = (unsigned long) kEplNmtEventTimerMsPreOp2;
|
kEplEventSinkNmtk;
|
||||||
Ret = EplTimeruModifyTimerMs(&EplNmtuInstance_g.m_TimerHdl, (unsigned long) dwBuffer, TimerArg);
|
TimerArg.m_ulArg =
|
||||||
// potential error is forwarded to event queue which generates error event
|
(unsigned long)
|
||||||
break;
|
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
|
// node processes isochronous and asynchronous frames
|
||||||
case kEplNmtMsPreOperational2:
|
case kEplNmtMsPreOperational2:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// node should be configured und application is ready
|
// node should be configured und application is ready
|
||||||
case kEplNmtMsReadyToOperate:
|
case kEplNmtMsReadyToOperate:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal work state
|
// normal work state
|
||||||
case kEplNmtMsOperational:
|
case kEplNmtMsOperational:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no EPL cycle
|
// no EPL cycle
|
||||||
// -> normal ethernet communication
|
// -> normal ethernet communication
|
||||||
case kEplNmtMsBasicEthernet:
|
case kEplNmtMsBasicEthernet:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
TRACE1("EplNmtuProcess(): unhandled NMT state 0x%X\n", pNmtStateChange->m_NewNmtState);
|
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
|
} else if (Ret == kEplReject) { // application wants to change NMT state itself
|
||||||
Ret = kEplSuccessful;
|
// it's OK
|
||||||
}
|
Ret = kEplSuccessful;
|
||||||
|
}
|
||||||
|
|
||||||
EPL_DBGLVL_NMTU_TRACE0("EplNmtuProcessEvent(): NMT-State-Maschine announce change of NMT State\n");
|
EPL_DBGLVL_NMTU_TRACE0
|
||||||
break;
|
("EplNmtuProcessEvent(): NMT-State-Maschine announce change of NMT State\n");
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Ret = kEplNmtInvalidEvent;
|
Ret = kEplNmtInvalidEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Exit:
|
//Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -636,17 +664,18 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplNmtuRegisterStateChangeCb(
|
EPLDLLEXPORT tEplKernel PUBLIC
|
||||||
tEplNmtuStateChangeCallback pfnEplNmtStateChangeCb_p)
|
EplNmtuRegisterStateChangeCb(tEplNmtuStateChangeCallback
|
||||||
|
pfnEplNmtStateChangeCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// save callback-function in modul global var
|
// save callback-function in modul global var
|
||||||
EplNmtuInstance_g.m_pfnNmtChangeCb = pfnEplNmtStateChangeCb_p;
|
EplNmtuInstance_g.m_pfnNmtChangeCb = pfnEplNmtStateChangeCb_p;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,6 +705,4 @@ tEplKernel Ret;
|
||||||
|
|
||||||
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -124,14 +121,14 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplNmtState PUBLIC EplNmtkCalGetNmtState()
|
EPLDLLEXPORT tEplNmtState PUBLIC EplNmtkCalGetNmtState()
|
||||||
{
|
{
|
||||||
tEplNmtState NmtState;
|
tEplNmtState NmtState;
|
||||||
// for test direkt call for EplNmtkGetNmtState()
|
// for test direkt call for EplNmtkGetNmtState()
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0)
|
||||||
NmtState = EplNmtkGetNmtState();
|
NmtState = EplNmtkGetNmtState();
|
||||||
#else
|
#else
|
||||||
NmtState = 0;
|
NmtState = 0;
|
||||||
#endif
|
#endif
|
||||||
return NmtState;
|
return NmtState;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
@ -158,7 +155,4 @@ return NmtState;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -96,9 +96,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -123,7 +120,6 @@
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -148,7 +144,4 @@
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -123,19 +121,18 @@
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduWriteEntry (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduWriteEntry(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
void * pSrcData_p,
|
void *pSrcData_p,
|
||||||
tEplObdSize Size_p)
|
tEplObdSize Size_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
Ret = EplObduCalWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplObduReadEntry()
|
// Function: EplObduReadEntry()
|
||||||
|
@ -156,19 +153,18 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduReadEntry (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduReadEntry(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
void * pDstData_p,
|
void *pDstData_p,
|
||||||
tEplObdSize* pSize_p)
|
tEplObdSize * pSize_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
Ret = EplObduCalReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplObdAccessOdPart()
|
// Function: EplObdAccessOdPart()
|
||||||
|
@ -183,14 +179,14 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduAccessOdPart (tEplObdPart ObdPart_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduAccessOdPart(tEplObdPart ObdPart_p,
|
||||||
tEplObdDir Direction_p)
|
tEplObdDir Direction_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalAccessOdPart(ObdPart_p, Direction_p);
|
Ret = EplObduCalAccessOdPart(ObdPart_p, Direction_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -206,13 +202,13 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduDefineVar (tEplVarParam MEM* pVarParam_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduDefineVar(tEplVarParam MEM * pVarParam_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalDefineVar(pVarParam_p);
|
Ret = EplObduCalDefineVar(pVarParam_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -230,14 +226,14 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT void* PUBLIC EplObduGetObjectDataPtr (unsigned int uiIndex_p,
|
EPLDLLEXPORT void *PUBLIC EplObduGetObjectDataPtr(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p)
|
unsigned int uiSubIndex_p)
|
||||||
{
|
{
|
||||||
void* pData;
|
void *pData;
|
||||||
|
|
||||||
pData = EplObduCalGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
|
pData = EplObduCalGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
|
||||||
|
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -254,13 +250,13 @@ void* pData;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
|
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduRegisterUserOd (tEplObdEntryPtr pUserOd_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduRegisterUserOd(tEplObdEntryPtr pUserOd_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalRegisterUserOd(pUserOd_p);
|
Ret = EplObduCalRegisterUserOd(pUserOd_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -279,10 +275,11 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT void PUBLIC EplObduInitVarEntry (tEplObdVarEntry MEM* pVarEntry_p,
|
EPLDLLEXPORT void PUBLIC EplObduInitVarEntry(tEplObdVarEntry MEM * pVarEntry_p,
|
||||||
BYTE bType_p, tEplObdSize ObdSize_p)
|
BYTE bType_p,
|
||||||
|
tEplObdSize ObdSize_p)
|
||||||
{
|
{
|
||||||
EplObduCalInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
|
EplObduCalInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -303,13 +300,13 @@ EPLDLLEXPORT void PUBLIC EplObduInitVarEntry (tEplObdVarEntry MEM* pVarEntry_p,
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplObdSize PUBLIC EplObduGetDataSize(unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplObdSize PUBLIC EplObduGetDataSize(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p)
|
unsigned int uiSubIndex_p)
|
||||||
{
|
{
|
||||||
tEplObdSize Size;
|
tEplObdSize Size;
|
||||||
|
|
||||||
Size = EplObduCalGetDataSize(uiIndex_p, uiSubIndex_p);
|
Size = EplObduCalGetDataSize(uiIndex_p, uiSubIndex_p);
|
||||||
|
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -328,11 +325,11 @@ tEplObdSize Size;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT unsigned int PUBLIC EplObduGetNodeId()
|
EPLDLLEXPORT unsigned int PUBLIC EplObduGetNodeId()
|
||||||
{
|
{
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
|
|
||||||
uiNodeId = EplObduCalGetNodeId();
|
uiNodeId = EplObduCalGetNodeId();
|
||||||
|
|
||||||
return uiNodeId;
|
return uiNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -351,13 +348,13 @@ unsigned int uiNodeId;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduSetNodeId(unsigned int uiNodeId_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduSetNodeId(unsigned int uiNodeId_p,
|
||||||
tEplObdNodeIdType NodeIdType_p)
|
tEplObdNodeIdType NodeIdType_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalSetNodeId(uiNodeId_p, NodeIdType_p);
|
Ret = EplObduCalSetNodeId(uiNodeId_p, NodeIdType_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -377,14 +374,16 @@ tEplKernel Ret;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduGetAccessType(unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduGetAccessType(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
tEplObdAccess* pAccessTyp_p)
|
tEplObdAccess *
|
||||||
|
pAccessTyp_p)
|
||||||
{
|
{
|
||||||
tEplObdAccess AccessType;
|
tEplObdAccess AccessType;
|
||||||
|
|
||||||
AccessType = EplObduCalGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
|
AccessType =
|
||||||
|
EplObduCalGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
|
||||||
|
|
||||||
return AccessType;
|
return AccessType;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -411,16 +410,18 @@ tEplObdAccess AccessType;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduReadEntryToLe (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduReadEntryToLe(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
void * pDstData_p,
|
void *pDstData_p,
|
||||||
tEplObdSize * pSize_p)
|
tEplObdSize * pSize_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
Ret =
|
||||||
|
EplObduCalReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p,
|
||||||
|
pSize_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -444,16 +445,19 @@ return Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduWriteEntryFromLe (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduWriteEntryFromLe(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int
|
||||||
void * pSrcData_p,
|
uiSubIndex_p,
|
||||||
tEplObdSize Size_p)
|
void *pSrcData_p,
|
||||||
|
tEplObdSize Size_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
Ret =
|
||||||
|
EplObduCalWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p,
|
||||||
|
Size_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -471,17 +475,19 @@ return Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduSearchVarEntry (EPL_MCO_DECL_INSTANCE_PTR_
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_
|
||||||
unsigned int uiIndex_p,
|
unsigned int uiIndex_p,
|
||||||
unsigned int uiSubindex_p,
|
unsigned int uiSubindex_p,
|
||||||
tEplObdVarEntry MEM** ppVarEntry_p)
|
tEplObdVarEntry MEM **
|
||||||
|
ppVarEntry_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplObduCalSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
|
Ret = EplObduCalSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -509,4 +515,3 @@ return Ret;
|
||||||
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
|
#endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) && (EPL_OBD_USE_KERNEL != FALSE)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0) && (EPL_OBD_USE_KERNEL != FALSE)
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -99,8 +98,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -124,24 +121,22 @@
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalWriteEntry (
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalWriteEntry(unsigned int uiIndex_p,
|
||||||
unsigned int uiIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
void *pSrcData_p,
|
||||||
void * pSrcData_p,
|
tEplObdSize Size_p)
|
||||||
tEplObdSize Size_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdWriteEntry(uiIndex_p,uiSubIndex_p,pSrcData_p,Size_p);
|
Ret = EplObdWriteEntry(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplObduCalReadEntry()
|
// Function: EplObduCalReadEntry()
|
||||||
|
@ -160,24 +155,22 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalReadEntry (
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalReadEntry(unsigned int uiIndex_p,
|
||||||
unsigned int uiIndex_p,
|
unsigned int uiSubIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
void *pDstData_p,
|
||||||
void * pDstData_p,
|
tEplObdSize * pSize_p)
|
||||||
tEplObdSize *pSize_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
Ret = EplObdReadEntry(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplObduCalAccessOdPart()
|
// Function: EplObduCalAccessOdPart()
|
||||||
|
@ -192,19 +185,18 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalAccessOdPart (
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalAccessOdPart(tEplObdPart ObdPart_p,
|
||||||
tEplObdPart ObdPart_p,
|
tEplObdDir Direction_p)
|
||||||
tEplObdDir Direction_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdAccessOdPart(ObdPart_p, Direction_p);
|
Ret = EplObdAccessOdPart(ObdPart_p, Direction_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -220,17 +212,18 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalDefineVar (tEplVarParam MEM* pVarParam_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalDefineVar(tEplVarParam MEM *
|
||||||
|
pVarParam_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdDefineVar(pVarParam_p);
|
Ret = EplObdDefineVar(pVarParam_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -247,18 +240,18 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT void* PUBLIC EplObduCalGetObjectDataPtr ( unsigned int uiIndex_p,
|
EPLDLLEXPORT void *PUBLIC EplObduCalGetObjectDataPtr(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p)
|
unsigned int uiSubIndex_p)
|
||||||
{
|
{
|
||||||
void* pData;
|
void *pData;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
pData = EplObdGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
|
pData = EplObdGetObjectDataPtr(uiIndex_p, uiSubIndex_p);
|
||||||
#else
|
#else
|
||||||
pData = NULL;
|
pData = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return pData;
|
return pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -275,17 +268,18 @@ void* pData;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
|
#if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE))
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalRegisterUserOd (tEplObdEntryPtr pUserOd_p)
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalRegisterUserOd(tEplObdEntryPtr
|
||||||
|
pUserOd_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdRegisterUserOd(pUserOd_p);
|
Ret = EplObdRegisterUserOd(pUserOd_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -304,15 +298,15 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT void PUBLIC EplObduCalInitVarEntry (tEplObdVarEntry MEM* pVarEntry_p,
|
EPLDLLEXPORT void PUBLIC EplObduCalInitVarEntry(tEplObdVarEntry MEM *
|
||||||
BYTE bType_p, tEplObdSize ObdSize_p)
|
pVarEntry_p, BYTE bType_p,
|
||||||
|
tEplObdSize ObdSize_p)
|
||||||
{
|
{
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
EplObdInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
|
EplObdInitVarEntry(pVarEntry_p, bType_p, ObdSize_p);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplObduCalGetDataSize()
|
// Function: EplObduCalGetDataSize()
|
||||||
|
@ -331,17 +325,17 @@ EPLDLLEXPORT void PUBLIC EplObduCalInitVarEntry (tEplObdVarEntry MEM* pVarEntry_
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplObdSize PUBLIC EplObduCalGetDataSize(unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplObdSize PUBLIC EplObduCalGetDataSize(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p)
|
unsigned int uiSubIndex_p)
|
||||||
{
|
{
|
||||||
tEplObdSize Size;
|
tEplObdSize Size;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Size = EplObdGetDataSize(uiIndex_p, uiSubIndex_p);
|
Size = EplObdGetDataSize(uiIndex_p, uiSubIndex_p);
|
||||||
#else
|
#else
|
||||||
Size = 0;
|
Size = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -360,15 +354,15 @@ tEplObdSize Size;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT unsigned int PUBLIC EplObduCalGetNodeId()
|
EPLDLLEXPORT unsigned int PUBLIC EplObduCalGetNodeId()
|
||||||
{
|
{
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
uiNodeId = EplObdGetNodeId();
|
uiNodeId = EplObdGetNodeId();
|
||||||
#else
|
#else
|
||||||
uiNodeId = 0;
|
uiNodeId = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return uiNodeId;
|
return uiNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -387,17 +381,18 @@ unsigned int uiNodeId;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalSetNodeId(unsigned int uiNodeId_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalSetNodeId(unsigned int uiNodeId_p,
|
||||||
tEplObdNodeIdType NodeIdType_p)
|
tEplObdNodeIdType
|
||||||
|
NodeIdType_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdSetNodeId(uiNodeId_p, NodeIdType_p);
|
Ret = EplObdSetNodeId(uiNodeId_p, NodeIdType_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -417,19 +412,20 @@ tEplKernel Ret;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalGetAccessType(unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalGetAccessType(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int
|
||||||
tEplObdAccess* pAccessTyp_p)
|
uiSubIndex_p,
|
||||||
|
tEplObdAccess *
|
||||||
|
pAccessTyp_p)
|
||||||
{
|
{
|
||||||
tEplObdAccess AccesType;
|
tEplObdAccess AccesType;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
AccesType = EplObdGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
|
AccesType = EplObdGetAccessType(uiIndex_p, uiSubIndex_p, pAccessTyp_p);
|
||||||
#else
|
#else
|
||||||
AccesType = 0;
|
AccesType = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return AccesType;
|
return AccesType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,20 +447,21 @@ return AccesType;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalReadEntryToLe (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalReadEntryToLe(unsigned int uiIndex_p,
|
||||||
unsigned int uiSubIndex_p,
|
unsigned int
|
||||||
void * pDstData_p,
|
uiSubIndex_p,
|
||||||
tEplObdSize * pSize_p)
|
void *pDstData_p,
|
||||||
|
tEplObdSize * pSize_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
Ret = EplObdReadEntryToLe(uiIndex_p, uiSubIndex_p, pDstData_p, pSize_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -484,19 +481,22 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalWriteEntryFromLe (unsigned int uiIndex_p,
|
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalWriteEntryFromLe(unsigned int
|
||||||
unsigned int uiSubIndex_p,
|
uiIndex_p,
|
||||||
void * pSrcData_p,
|
unsigned int
|
||||||
tEplObdSize Size_p)
|
uiSubIndex_p,
|
||||||
|
void *pSrcData_p,
|
||||||
|
tEplObdSize Size_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
Ret =
|
||||||
|
EplObdWriteEntryFromLe(uiIndex_p, uiSubIndex_p, pSrcData_p, Size_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -514,23 +514,21 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplObduCalSearchVarEntry (EPL_MCO_DECL_INSTANCE_PTR_
|
EPLDLLEXPORT tEplKernel PUBLIC
|
||||||
unsigned int uiIndex_p,
|
EplObduCalSearchVarEntry(EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p,
|
||||||
unsigned int uiSubindex_p,
|
unsigned int uiSubindex_p,
|
||||||
tEplObdVarEntry MEM** ppVarEntry_p)
|
tEplObdVarEntry MEM ** ppVarEntry_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) != 0)
|
||||||
Ret = EplObdSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
|
Ret = EplObdSearchVarEntry(uiIndex_p, uiSubindex_p, ppVarEntry_p);
|
||||||
#else
|
#else
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -557,6 +555,4 @@ tEplKernel Ret;
|
||||||
|
|
||||||
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
|
#endif //(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDU)) != 0)
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,13 @@
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) == 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) == 0)
|
||||||
|
|
||||||
#error 'ERROR: Missing DLLk-Modul!'
|
#error 'ERROR: Missing DLLk-Modul!'
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) == 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_OBDK)) == 0)
|
||||||
|
|
||||||
#error 'ERROR: Missing OBDk-Modul!'
|
#error 'ERROR: Missing OBDk-Modul!'
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -120,7 +120,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -134,7 +133,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -153,12 +151,10 @@
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -183,7 +179,7 @@
|
||||||
tEplKernel EplPdokAddInstance(void)
|
tEplKernel EplPdokAddInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -204,10 +200,9 @@ tEplKernel EplPdokAddInstance(void)
|
||||||
tEplKernel EplPdokDelInstance(void)
|
tEplKernel EplPdokDelInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdokCbPdoReceived
|
// Function: EplPdokCbPdoReceived
|
||||||
|
@ -228,27 +223,27 @@ tEplKernel EplPdokDelInstance(void)
|
||||||
|
|
||||||
tEplKernel EplPdokCbPdoReceived(tEplFrameInfo * pFrameInfo_p)
|
tEplKernel EplPdokCbPdoReceived(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
||||||
// reset LED
|
// reset LED
|
||||||
// MCF_GPIO_PODR_PCIBG &= ~PDO_LED; // Level
|
// MCF_GPIO_PODR_PCIBG &= ~PDO_LED; // Level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkPdok;
|
Event.m_EventSink = kEplEventSinkPdok;
|
||||||
Event.m_EventType = kEplEventTypePdoRx;
|
Event.m_EventType = kEplEventTypePdoRx;
|
||||||
// limit copied data to size of PDO (because from some CNs the frame is larger than necessary)
|
// 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_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;
|
Event.m_pArg = pFrameInfo_p->m_pFrame;
|
||||||
Ret = EplEventkPost(&Event);
|
Ret = EplEventkPost(&Event);
|
||||||
|
|
||||||
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
||||||
// set LED
|
// set LED
|
||||||
// MCF_GPIO_PODR_PCIBG |= PDO_LED; // Level
|
// MCF_GPIO_PODR_PCIBG |= PDO_LED; // Level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -271,26 +266,26 @@ tEplEvent Event;
|
||||||
|
|
||||||
tEplKernel EplPdokCbPdoTransmitted(tEplFrameInfo * pFrameInfo_p)
|
tEplKernel EplPdokCbPdoTransmitted(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
||||||
// reset LED
|
// reset LED
|
||||||
MCF_GPIO_PODR_PCIBG &= ~PDO_LED; // Level
|
MCF_GPIO_PODR_PCIBG &= ~PDO_LED; // Level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkPdok;
|
Event.m_EventSink = kEplEventSinkPdok;
|
||||||
Event.m_EventType = kEplEventTypePdoTx;
|
Event.m_EventType = kEplEventTypePdoTx;
|
||||||
Event.m_uiSize = sizeof (tEplFrameInfo);
|
Event.m_uiSize = sizeof(tEplFrameInfo);
|
||||||
Event.m_pArg = pFrameInfo_p;
|
Event.m_pArg = pFrameInfo_p;
|
||||||
Ret = EplEventkPost(&Event);
|
Ret = EplEventkPost(&Event);
|
||||||
|
|
||||||
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
#if (DEV_SYSTEM == _DEV_GNU_CF548X_)
|
||||||
// set LED
|
// set LED
|
||||||
MCF_GPIO_PODR_PCIBG |= PDO_LED; // Level
|
MCF_GPIO_PODR_PCIBG |= PDO_LED; // Level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -311,16 +306,16 @@ tEplEvent Event;
|
||||||
|
|
||||||
tEplKernel EplPdokCbSoa(tEplFrameInfo * pFrameInfo_p)
|
tEplKernel EplPdokCbSoa(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplEvent Event;
|
tEplEvent Event;
|
||||||
|
|
||||||
Event.m_EventSink = kEplEventSinkPdok;
|
Event.m_EventSink = kEplEventSinkPdok;
|
||||||
Event.m_EventType = kEplEventTypePdoSoa;
|
Event.m_EventType = kEplEventTypePdoSoa;
|
||||||
Event.m_uiSize = 0;
|
Event.m_uiSize = 0;
|
||||||
Event.m_pArg = NULL;
|
Event.m_pArg = NULL;
|
||||||
Ret = EplEventkPost(&Event);
|
Ret = EplEventkPost(&Event);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -343,323 +338,331 @@ tEplEvent Event;
|
||||||
|
|
||||||
tEplKernel EplPdokProcess(tEplEvent * pEvent_p)
|
tEplKernel EplPdokProcess(tEplEvent * pEvent_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
WORD wPdoSize;
|
WORD wPdoSize;
|
||||||
WORD wBitOffset;
|
WORD wBitOffset;
|
||||||
WORD wBitSize;
|
WORD wBitSize;
|
||||||
WORD wVarSize;
|
WORD wVarSize;
|
||||||
QWORD qwObjectMapping;
|
QWORD qwObjectMapping;
|
||||||
BYTE bMappSubindex;
|
BYTE bMappSubindex;
|
||||||
BYTE bObdSubindex;
|
BYTE bObdSubindex;
|
||||||
WORD wObdMappIndex;
|
WORD wObdMappIndex;
|
||||||
WORD wObdCommIndex;
|
WORD wObdCommIndex;
|
||||||
WORD wPdoId;
|
WORD wPdoId;
|
||||||
BYTE bObdData;
|
BYTE bObdData;
|
||||||
BYTE bObjectCount;
|
BYTE bObjectCount;
|
||||||
BYTE bFrameData;
|
BYTE bFrameData;
|
||||||
BOOL fValid;
|
BOOL fValid;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
tEplFrame *pFrame;
|
tEplFrame *pFrame;
|
||||||
tEplFrameInfo *pFrameInfo;
|
tEplFrameInfo *pFrameInfo;
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
tEplMsgType MsgType;
|
tEplMsgType MsgType;
|
||||||
|
|
||||||
// 0xFF=invalid, RPDO: 0x00=PReq, localNodeId=PRes, remoteNodeId=PRes
|
// 0xFF=invalid, RPDO: 0x00=PReq, localNodeId=PRes, remoteNodeId=PRes
|
||||||
// TPDO: 0x00=PRes, MN: CnNodeId=PReq
|
// TPDO: 0x00=PRes, MN: CnNodeId=PReq
|
||||||
|
|
||||||
switch (pEvent_p->m_EventType)
|
switch (pEvent_p->m_EventType) {
|
||||||
{
|
case kEplEventTypePdoRx: // RPDO received
|
||||||
case kEplEventTypePdoRx: // RPDO received
|
pFrame = (tEplFrame *) pEvent_p->m_pArg;
|
||||||
pFrame = (tEplFrame *) pEvent_p->m_pArg;
|
|
||||||
|
|
||||||
// check if received RPDO is valid
|
// check if received RPDO is valid
|
||||||
bFrameData = AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
|
bFrameData =
|
||||||
if ((bFrameData & EPL_FRAME_FLAG1_RD) == 0)
|
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
|
||||||
{ // RPDO invalid
|
if ((bFrameData & EPL_FRAME_FLAG1_RD) == 0) { // RPDO invalid
|
||||||
goto Exit;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
// retrieve EPL message type
|
// search for appropriate valid RPDO in OD
|
||||||
MsgType = AmiGetByteFromLe(&pFrame->m_le_bMessageType);
|
wObdMappIndex = EPL_PDOK_OBD_IDX_RX_MAPP_PARAM;
|
||||||
if (MsgType == kEplMsgTypePreq)
|
for (wObdCommIndex = EPL_PDOK_OBD_IDX_RX_COMM_PARAM;
|
||||||
{ // RPDO is PReq frame
|
wObdCommIndex < (EPL_PDOK_OBD_IDX_RX_COMM_PARAM + 0x00FF);
|
||||||
uiNodeId = EPL_PDO_PREQ_NODE_ID; // 0x00
|
wObdCommIndex++, wObdMappIndex++) {
|
||||||
}
|
ObdSize = 1;
|
||||||
else
|
// read node ID from OD
|
||||||
{ // RPDO is PRes frame
|
Ret =
|
||||||
// retrieve node ID
|
EplObdReadEntry(wObdCommIndex, 0x01, &bObdData,
|
||||||
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bSrcNodeId);
|
&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;
|
||||||
|
}
|
||||||
|
|
||||||
// search for appropriate valid RPDO in OD
|
ObdSize = 1;
|
||||||
wObdMappIndex = EPL_PDOK_OBD_IDX_RX_MAPP_PARAM;
|
// check PDO mapping version
|
||||||
for (wObdCommIndex = EPL_PDOK_OBD_IDX_RX_COMM_PARAM;
|
Ret =
|
||||||
wObdCommIndex < (EPL_PDOK_OBD_IDX_RX_COMM_PARAM + 0x00FF);
|
EplObdReadEntry(wObdCommIndex, 0x02, &bObdData,
|
||||||
wObdCommIndex++, wObdMappIndex++)
|
&ObdSize);
|
||||||
{
|
if (Ret != kEplSuccessful) { // other fatal error occured
|
||||||
ObdSize = 1;
|
goto Exit;
|
||||||
// read node ID from OD
|
}
|
||||||
Ret = EplObdReadEntry(wObdCommIndex, 0x01, &bObdData, &ObdSize);
|
// entry read successfully
|
||||||
if ((Ret == kEplObdIndexNotExist)
|
// retrieve PDO version from frame
|
||||||
|| (Ret == kEplObdSubindexNotExist)
|
bFrameData =
|
||||||
|| (Ret == kEplObdIllegalPart))
|
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.
|
||||||
{ // PDO does not exist; last PDO reached
|
m_le_bPdoVersion);
|
||||||
Ret = kEplSuccessful;
|
if ((bObdData & EPL_VERSION_MAIN) != (bFrameData & EPL_VERSION_MAIN)) { // PDO versions do not match
|
||||||
goto Exit;
|
// $$$ raise PDO error
|
||||||
}
|
// termiate processing of this RPDO
|
||||||
else if (Ret != kEplSuccessful)
|
goto Exit;
|
||||||
{ // other fatal error occured
|
}
|
||||||
goto Exit;
|
// valid RPDO found
|
||||||
}
|
|
||||||
// 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;
|
// retrieve PDO size
|
||||||
// check PDO mapping version
|
wPdoSize =
|
||||||
Ret = EplObdReadEntry(wObdCommIndex, 0x02, &bObdData, &ObdSize);
|
AmiGetWordFromLe(&pFrame->m_Data.m_Pres.m_le_wSize);
|
||||||
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
|
// process mapping
|
||||||
|
for (bMappSubindex = 1; bMappSubindex <= bObjectCount;
|
||||||
|
bMappSubindex++) {
|
||||||
|
ObdSize = 8; // QWORD
|
||||||
|
// 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 =
|
||||||
|
(WORD) (qwObjectMapping &
|
||||||
|
0x000000000000FFFFLL);
|
||||||
|
bObdSubindex =
|
||||||
|
(BYTE) ((qwObjectMapping &
|
||||||
|
0x0000000000FF0000LL) >> 16);
|
||||||
|
wBitOffset =
|
||||||
|
(WORD) ((qwObjectMapping &
|
||||||
|
0x0000FFFF00000000LL) >> 32);
|
||||||
|
wBitSize =
|
||||||
|
(WORD) ((qwObjectMapping &
|
||||||
|
0xFFFF000000000000LL) >> 48);
|
||||||
|
|
||||||
// retrieve PDO size
|
// check if object exceeds PDO size
|
||||||
wPdoSize = AmiGetWordFromLe(&pFrame->m_Data.m_Pres.m_le_wSize);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// process mapping
|
}
|
||||||
for (bMappSubindex = 1; bMappSubindex <= bObjectCount; bMappSubindex++)
|
|
||||||
{
|
|
||||||
ObdSize = 8; // QWORD
|
|
||||||
// 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
|
// processing finished successfully
|
||||||
if (qwObjectMapping == 0)
|
goto Exit;
|
||||||
{ // invalid entry, continue with next entry
|
}
|
||||||
continue;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// decode object mapping
|
case kEplEventTypePdoTx: // TPDO transmitted
|
||||||
wObdCommIndex = (WORD) (qwObjectMapping & 0x000000000000FFFFLL);
|
pFrameInfo = (tEplFrameInfo *) pEvent_p->m_pArg;
|
||||||
bObdSubindex = (BYTE) ((qwObjectMapping & 0x0000000000FF0000LL) >> 16);
|
pFrame = pFrameInfo->m_pFrame;
|
||||||
wBitOffset = (WORD) ((qwObjectMapping & 0x0000FFFF00000000LL) >> 32);
|
|
||||||
wBitSize = (WORD) ((qwObjectMapping & 0xFFFF000000000000LL) >> 48);
|
|
||||||
|
|
||||||
// check if object exceeds PDO size
|
// set TPDO invalid, so that only fully processed TPDOs are sent as valid
|
||||||
if (((wBitOffset + wBitSize) >> 3) > wPdoSize)
|
bFrameData =
|
||||||
{ // wrong object mapping; PDO size is too low
|
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
|
||||||
// $$$ raise PDO error
|
AmiSetByteToLe(&pFrame->m_Data.m_Pres.m_le_bFlag1,
|
||||||
// terminate processing of this RPDO
|
(bFrameData & ~EPL_FRAME_FLAG1_RD));
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy object from RPDO to process/OD variable
|
// retrieve EPL message type
|
||||||
ObdSize = wBitSize >> 3;
|
MsgType = AmiGetByteFromLe(&pFrame->m_le_bMessageType);
|
||||||
Ret = EplObdWriteEntryFromLe(wObdCommIndex, bObdSubindex, &pFrame->m_Data.m_Pres.m_le_abPayload[(wBitOffset >> 3)], ObdSize);
|
if (MsgType == kEplMsgTypePres) { // TPDO is PRes frame
|
||||||
if (Ret != kEplSuccessful)
|
uiNodeId = EPL_PDO_PRES_NODE_ID; // 0x00
|
||||||
{ // other fatal error occured
|
} else { // TPDO is PReq frame
|
||||||
goto Exit;
|
// 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
|
||||||
|
|
||||||
// processing finished successfully
|
ObdSize = 1;
|
||||||
goto Exit;
|
// get PDO mapping version from OD
|
||||||
}
|
Ret =
|
||||||
break;
|
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);
|
||||||
|
|
||||||
case kEplEventTypePdoTx: // TPDO transmitted
|
// calculate PDO size
|
||||||
pFrameInfo = (tEplFrameInfo *) pEvent_p->m_pArg;
|
wPdoSize = 0;
|
||||||
pFrame = pFrameInfo->m_pFrame;
|
|
||||||
|
|
||||||
// set TPDO invalid, so that only fully processed TPDOs are sent as valid
|
// process mapping
|
||||||
bFrameData = AmiGetByteFromLe(&pFrame->m_Data.m_Pres.m_le_bFlag1);
|
for (bMappSubindex = 1; bMappSubindex <= bObjectCount;
|
||||||
AmiSetByteToLe(&pFrame->m_Data.m_Pres.m_le_bFlag1, (bFrameData & ~EPL_FRAME_FLAG1_RD));
|
bMappSubindex++) {
|
||||||
|
ObdSize = 8; // QWORD
|
||||||
|
// 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 =
|
||||||
|
(WORD) (qwObjectMapping &
|
||||||
|
0x000000000000FFFFLL);
|
||||||
|
bObdSubindex =
|
||||||
|
(BYTE) ((qwObjectMapping &
|
||||||
|
0x0000000000FF0000LL) >> 16);
|
||||||
|
wBitOffset =
|
||||||
|
(WORD) ((qwObjectMapping &
|
||||||
|
0x0000FFFF00000000LL) >> 32);
|
||||||
|
wBitSize =
|
||||||
|
(WORD) ((qwObjectMapping &
|
||||||
|
0xFFFF000000000000LL) >> 48);
|
||||||
|
|
||||||
// retrieve EPL message type
|
// calculate max PDO size
|
||||||
MsgType = AmiGetByteFromLe(&pFrame->m_le_bMessageType);
|
ObdSize = wBitSize >> 3;
|
||||||
if (MsgType == kEplMsgTypePres)
|
wVarSize = (wBitOffset >> 3) + (WORD) ObdSize;
|
||||||
{ // TPDO is PRes frame
|
if ((unsigned int)(wVarSize + 24) > pFrameInfo->m_uiFrameSize) { // TPDO is too short
|
||||||
uiNodeId = EPL_PDO_PRES_NODE_ID; // 0x00
|
// $$$ raise PDO error, set Ret
|
||||||
}
|
goto Exit;
|
||||||
else
|
}
|
||||||
{ // TPDO is PReq frame
|
if (wVarSize > wPdoSize) { // memorize new PDO size
|
||||||
// retrieve node ID
|
wPdoSize = wVarSize;
|
||||||
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bDstNodeId);
|
}
|
||||||
}
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
// set PDO size in frame
|
||||||
|
AmiSetWordToLe(&pFrame->m_Data.m_Pres.m_le_wSize,
|
||||||
|
wPdoSize);
|
||||||
|
|
||||||
ObdSize = 1;
|
Ret = EplPdokCalAreTpdosValid(&fValid);
|
||||||
// get PDO mapping version from OD
|
if (fValid != FALSE) {
|
||||||
Ret = EplObdReadEntry(wObdCommIndex, 0x02, &bObdData, &ObdSize);
|
// set TPDO valid
|
||||||
if (Ret != kEplSuccessful)
|
bFrameData =
|
||||||
{ // other fatal error occured
|
AmiGetByteFromLe(&pFrame->m_Data.m_Pres.
|
||||||
goto Exit;
|
m_le_bFlag1);
|
||||||
}
|
AmiSetByteToLe(&pFrame->m_Data.m_Pres.
|
||||||
// entry read successfully
|
m_le_bFlag1,
|
||||||
// set PDO version in frame
|
(bFrameData |
|
||||||
AmiSetByteToLe(&pFrame->m_Data.m_Pres.m_le_bPdoVersion, bObdData);
|
EPL_FRAME_FLAG1_RD));
|
||||||
|
}
|
||||||
|
// processing finished successfully
|
||||||
|
|
||||||
// calculate PDO size
|
goto Exit;
|
||||||
wPdoSize = 0;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// process mapping
|
case kEplEventTypePdoSoa: // SoA received
|
||||||
for (bMappSubindex = 1; bMappSubindex <= bObjectCount; bMappSubindex++)
|
|
||||||
{
|
|
||||||
ObdSize = 8; // QWORD
|
|
||||||
// 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
|
// invalidate TPDOs
|
||||||
if (qwObjectMapping == 0)
|
Ret = EplPdokCalSetTpdosValid(FALSE);
|
||||||
{ // invalid entry, continue with next entry
|
break;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// decode object mapping
|
default:
|
||||||
wObdCommIndex = (WORD) (qwObjectMapping & 0x000000000000FFFFLL);
|
{
|
||||||
bObdSubindex = (BYTE) ((qwObjectMapping & 0x0000000000FF0000LL) >> 16);
|
ASSERTMSG(FALSE,
|
||||||
wBitOffset = (WORD) ((qwObjectMapping & 0x0000FFFF00000000LL) >> 32);
|
"EplPdokProcess(): unhandled event type!\n");
|
||||||
wBitSize = (WORD) ((qwObjectMapping & 0xFFFF000000000000LL) >> 48);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// calculate max PDO size
|
Exit:
|
||||||
ObdSize = wBitSize >> 3;
|
return Ret;
|
||||||
wVarSize = (wBitOffset >> 3) + (WORD) 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
@ -689,4 +692,3 @@ Exit:
|
||||||
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
|
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,6 @@
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOK)) != 0)
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -97,7 +96,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -111,7 +109,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -126,9 +123,8 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
BOOL m_fTpdosValid;
|
||||||
BOOL m_fTpdosValid;
|
|
||||||
|
|
||||||
} tEplPdokCalInstance;
|
} tEplPdokCalInstance;
|
||||||
|
|
||||||
|
@ -136,13 +132,12 @@ typedef struct
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplPdokCalInstance EplPdokCalInstance_g;
|
static tEplPdokCalInstance EplPdokCalInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -167,9 +162,9 @@ static tEplPdokCalInstance EplPdokCalInstance_g;
|
||||||
tEplKernel EplPdokCalAddInstance(void)
|
tEplKernel EplPdokCalAddInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
EPL_MEMSET(&EplPdokCalInstance_g, 0, sizeof(EplPdokCalInstance_g));
|
EPL_MEMSET(&EplPdokCalInstance_g, 0, sizeof(EplPdokCalInstance_g));
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -190,10 +185,9 @@ tEplKernel EplPdokCalAddInstance(void)
|
||||||
tEplKernel EplPdokCalDelInstance(void)
|
tEplKernel EplPdokCalDelInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdokCalSetTpdosValid()
|
// Function: EplPdokCalSetTpdosValid()
|
||||||
|
@ -212,11 +206,11 @@ tEplKernel EplPdokCalDelInstance(void)
|
||||||
|
|
||||||
tEplKernel EplPdokCalSetTpdosValid(BOOL fValid_p)
|
tEplKernel EplPdokCalSetTpdosValid(BOOL fValid_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
EplPdokCalInstance_g.m_fTpdosValid = fValid_p;
|
EplPdokCalInstance_g.m_fTpdosValid = fValid_p;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -236,14 +230,13 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
tEplKernel EplPdokCalAreTpdosValid(BOOL * pfValid_p)
|
tEplKernel EplPdokCalAreTpdosValid(BOOL * pfValid_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
*pfValid_p = EplPdokCalInstance_g.m_fTpdosValid;
|
*pfValid_p = EplPdokCalInstance_g.m_fTpdosValid;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -271,4 +264,3 @@ tEplKernel Ret = kEplSuccessful;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
#error "EPL PDOu module needs EPL module OBDU or OBDK!"
|
#error "EPL PDOu module needs EPL module OBDU or OBDK!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -103,7 +102,6 @@
|
||||||
#define EPL_PDOU_OBD_IDX_MASK 0xFF00
|
#define EPL_PDOU_OBD_IDX_MASK 0xFF00
|
||||||
#define EPL_PDOU_PDO_ID_MASK 0x00FF
|
#define EPL_PDOU_PDO_ID_MASK 0x00FF
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -116,7 +114,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -130,7 +127,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -149,25 +145,23 @@
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam MEM* pParam_p, unsigned int uiIndex_p);
|
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam MEM * pParam_p,
|
||||||
|
unsigned int uiIndex_p);
|
||||||
|
|
||||||
static void EplPdouDecodeObjectMapping(QWORD qwObjectMapping_p,
|
static void EplPdouDecodeObjectMapping(QWORD qwObjectMapping_p,
|
||||||
unsigned int* puiIndex_p,
|
unsigned int *puiIndex_p,
|
||||||
unsigned int* puiSubIndex_p,
|
unsigned int *puiSubIndex_p,
|
||||||
unsigned int* puiBitOffset_p,
|
unsigned int *puiBitOffset_p,
|
||||||
unsigned int* puiBitSize_p);
|
unsigned int *puiBitSize_p);
|
||||||
|
|
||||||
static tEplKernel EplPdouCheckObjectMapping(QWORD qwObjectMapping_p,
|
static tEplKernel EplPdouCheckObjectMapping(QWORD qwObjectMapping_p,
|
||||||
tEplObdAccess AccessType_p,
|
tEplObdAccess AccessType_p,
|
||||||
DWORD* pdwAbortCode_p,
|
DWORD * pdwAbortCode_p,
|
||||||
unsigned int* puiPdoSize_p);
|
unsigned int *puiPdoSize_p);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
|
@ -193,10 +187,9 @@ static tEplKernel EplPdouCheckObjectMapping(QWORD qwObjectMapping_p,
|
||||||
tEplKernel EplPdouAddInstance(void)
|
tEplKernel EplPdouAddInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdouDelInstance()
|
// Function: EplPdouDelInstance()
|
||||||
|
@ -215,10 +208,9 @@ tEplKernel EplPdouAddInstance(void)
|
||||||
tEplKernel EplPdouDelInstance(void)
|
tEplKernel EplPdouDelInstance(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdouCbObdAccess
|
// Function: EplPdouCbObdAccess
|
||||||
|
@ -234,170 +226,153 @@ tEplKernel EplPdouDelInstance(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplPdouCbObdAccess(tEplObdCbParam MEM* pParam_p)
|
tEplKernel PUBLIC EplPdouCbObdAccess(tEplObdCbParam MEM * pParam_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
unsigned int uiPdoId;
|
unsigned int uiPdoId;
|
||||||
unsigned int uiIndexType;
|
unsigned int uiIndexType;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
BYTE bObjectCount;
|
BYTE bObjectCount;
|
||||||
QWORD qwObjectMapping;
|
QWORD qwObjectMapping;
|
||||||
tEplObdAccess AccessType;
|
tEplObdAccess AccessType;
|
||||||
BYTE bMappSubindex;
|
BYTE bMappSubindex;
|
||||||
unsigned int uiCurPdoSize;
|
unsigned int uiCurPdoSize;
|
||||||
WORD wMaxPdoSize;
|
WORD wMaxPdoSize;
|
||||||
unsigned int uiSubIndex;
|
unsigned int uiSubIndex;
|
||||||
|
|
||||||
// fetch PDO ID
|
// fetch PDO ID
|
||||||
uiPdoId = pParam_p->m_uiIndex & EPL_PDOU_PDO_ID_MASK;
|
uiPdoId = pParam_p->m_uiIndex & EPL_PDOU_PDO_ID_MASK;
|
||||||
|
|
||||||
// fetch object index type
|
// fetch object index type
|
||||||
uiIndexType = pParam_p->m_uiIndex & EPL_PDOU_OBD_IDX_MASK;
|
uiIndexType = pParam_p->m_uiIndex & EPL_PDOU_OBD_IDX_MASK;
|
||||||
|
|
||||||
if (pParam_p->m_ObdEvent != kEplObdEvPreWrite)
|
if (pParam_p->m_ObdEvent != kEplObdEvPreWrite) { // read accesses, post write events etc. are OK
|
||||||
{ // read accesses, post write events etc. are OK
|
pParam_p->m_dwAbortCode = 0;
|
||||||
pParam_p->m_dwAbortCode = 0;
|
goto Exit;
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
// check index type
|
goto Exit;
|
||||||
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
|
||||||
|
|
||||||
case EPL_PDOU_OBD_IDX_RX_MAPP_PARAM:
|
AccessType = kEplObdAccWrite;
|
||||||
{ // RPDO mapping parameter accessed
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
AccessType = kEplObdAccWrite;
|
case EPL_PDOU_OBD_IDX_TX_MAPP_PARAM:
|
||||||
break;
|
{ // TPDO mapping parameter accessed
|
||||||
}
|
|
||||||
|
|
||||||
case EPL_PDOU_OBD_IDX_TX_MAPP_PARAM:
|
AccessType = kEplObdAccRead;
|
||||||
{ // TPDO mapping parameter accessed
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
AccessType = kEplObdAccRead;
|
default:
|
||||||
break;
|
{ // this callback function is only for
|
||||||
}
|
// PDO mapping and communication parameters
|
||||||
|
pParam_p->m_dwAbortCode = EPL_SDOAC_GENERAL_ERROR;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
// RPDO and TPDO mapping parameter accessed
|
||||||
{ // 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
|
||||||
|
|
||||||
if (pParam_p->m_uiSubIndex == 0)
|
// PDO is enabled or disabled
|
||||||
{ // object mapping count accessed
|
bObjectCount = *((BYTE *) pParam_p->m_pArg);
|
||||||
|
|
||||||
// PDO is enabled or disabled
|
if (bObjectCount == 0) { // PDO shall be disabled
|
||||||
bObjectCount = *((BYTE*) pParam_p->m_pArg);
|
|
||||||
|
|
||||||
if (bObjectCount == 0)
|
// that is always possible
|
||||||
{ // PDO shall be disabled
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// that is always possible
|
if (AccessType == kEplObdAccWrite) {
|
||||||
goto Exit;
|
uiSubIndex = 0x04; // PReqActPayloadLimit_U16
|
||||||
}
|
} else {
|
||||||
|
uiSubIndex = 0x05; // PResActPayloadLimit_U16
|
||||||
|
}
|
||||||
|
|
||||||
// PDO shall be enabled
|
// fetch maximum PDO size from Object 1F98h: NMT_CycleTiming_REC
|
||||||
// it should have been disabled for this operation
|
ObdSize = sizeof(wMaxPdoSize);
|
||||||
Ret = EplPdouCheckPdoValidity(pParam_p, pParam_p->m_uiIndex);
|
Ret =
|
||||||
if (Ret != kEplSuccessful)
|
EplObduReadEntry(0x1F98, uiSubIndex, &wMaxPdoSize,
|
||||||
{ // PDO is valid or does not exist
|
&ObdSize);
|
||||||
goto Exit;
|
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); // QWORD
|
||||||
|
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 (AccessType == kEplObdAccWrite)
|
if (uiCurPdoSize > wMaxPdoSize) { // mapping exceeds object size
|
||||||
{
|
pParam_p->m_dwAbortCode =
|
||||||
uiSubIndex = 0x04; // PReqActPayloadLimit_U16
|
EPL_SDOAC_GENERAL_ERROR;
|
||||||
}
|
Ret = kEplPdoVarNotFound;
|
||||||
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
|
} else { // ObjectMapping
|
||||||
for (bMappSubindex = 1; bMappSubindex <= bObjectCount; bMappSubindex++)
|
Ret = EplPdouCheckPdoValidity(pParam_p, pParam_p->m_uiIndex);
|
||||||
{
|
if (Ret != kEplSuccessful) { // PDO is valid or does not exist
|
||||||
// read object mapping from OD
|
goto Exit;
|
||||||
ObdSize = sizeof (qwObjectMapping); // QWORD
|
}
|
||||||
Ret = EplObduReadEntry(pParam_p->m_uiIndex,
|
// check existence of object and validity of object length
|
||||||
bMappSubindex, &qwObjectMapping, &ObdSize);
|
|
||||||
if (Ret != kEplSuccessful)
|
|
||||||
{ // other fatal error occured
|
|
||||||
pParam_p->m_dwAbortCode = EPL_SDOAC_GENERAL_ERROR;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check object mapping
|
qwObjectMapping = *((QWORD *) pParam_p->m_pArg);
|
||||||
Ret = EplPdouCheckObjectMapping(qwObjectMapping,
|
|
||||||
AccessType,
|
|
||||||
&pParam_p->m_dwAbortCode,
|
|
||||||
&uiCurPdoSize);
|
|
||||||
if (Ret != kEplSuccessful)
|
|
||||||
{ // illegal object mapping
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uiCurPdoSize > wMaxPdoSize)
|
Ret = EplPdouCheckObjectMapping(qwObjectMapping,
|
||||||
{ // mapping exceeds object size
|
AccessType,
|
||||||
pParam_p->m_dwAbortCode = EPL_SDOAC_GENERAL_ERROR;
|
&pParam_p->m_dwAbortCode,
|
||||||
Ret = kEplPdoVarNotFound;
|
&uiCurPdoSize);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
Exit:
|
||||||
|
return Ret;
|
||||||
}
|
|
||||||
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 = *((QWORD*) 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 //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -419,33 +394,32 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam MEM* pParam_p, unsigned int uiIndex_p)
|
static tEplKernel EplPdouCheckPdoValidity(tEplObdCbParam MEM * pParam_p,
|
||||||
|
unsigned int uiIndex_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
BYTE bObjectCount;
|
BYTE bObjectCount;
|
||||||
|
|
||||||
ObdSize = 1;
|
ObdSize = 1;
|
||||||
// read number of mapped objects from OD; this indicates if the PDO is valid
|
// read number of mapped objects from OD; this indicates if the PDO is valid
|
||||||
Ret = EplObduReadEntry(uiIndex_p, 0x00, &bObjectCount, &ObdSize);
|
Ret = EplObduReadEntry(uiIndex_p, 0x00, &bObjectCount, &ObdSize);
|
||||||
if (Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) { // other fatal error occured
|
||||||
{ // other fatal error occured
|
pParam_p->m_dwAbortCode =
|
||||||
pParam_p->m_dwAbortCode = EPL_SDOAC_GEN_INTERNAL_INCOMPATIBILITY;
|
EPL_SDOAC_GEN_INTERNAL_INCOMPATIBILITY;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
// entry read successfully
|
// entry read successfully
|
||||||
if (bObjectCount != 0)
|
if (bObjectCount != 0) { // PDO in OD is still valid
|
||||||
{ // PDO in OD is still valid
|
pParam_p->m_dwAbortCode = EPL_SDOAC_GEN_PARAM_INCOMPATIBILITY;
|
||||||
pParam_p->m_dwAbortCode = EPL_SDOAC_GEN_PARAM_INCOMPATIBILITY;
|
Ret = kEplPdoNotExist;
|
||||||
Ret = kEplPdoNotExist;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdouDecodeObjectMapping
|
// Function: EplPdouDecodeObjectMapping
|
||||||
|
@ -466,26 +440,25 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void EplPdouDecodeObjectMapping(QWORD qwObjectMapping_p,
|
static void EplPdouDecodeObjectMapping(QWORD qwObjectMapping_p,
|
||||||
unsigned int* puiIndex_p,
|
unsigned int *puiIndex_p,
|
||||||
unsigned int* puiSubIndex_p,
|
unsigned int *puiSubIndex_p,
|
||||||
unsigned int* puiBitOffset_p,
|
unsigned int *puiBitOffset_p,
|
||||||
unsigned int* puiBitSize_p)
|
unsigned int *puiBitSize_p)
|
||||||
{
|
{
|
||||||
*puiIndex_p = (unsigned int)
|
*puiIndex_p = (unsigned int)
|
||||||
(qwObjectMapping_p & 0x000000000000FFFFLL);
|
(qwObjectMapping_p & 0x000000000000FFFFLL);
|
||||||
|
|
||||||
*puiSubIndex_p = (unsigned int)
|
*puiSubIndex_p = (unsigned int)
|
||||||
((qwObjectMapping_p & 0x0000000000FF0000LL) >> 16);
|
((qwObjectMapping_p & 0x0000000000FF0000LL) >> 16);
|
||||||
|
|
||||||
*puiBitOffset_p = (unsigned int)
|
*puiBitOffset_p = (unsigned int)
|
||||||
((qwObjectMapping_p & 0x0000FFFF00000000LL) >> 32);
|
((qwObjectMapping_p & 0x0000FFFF00000000LL) >> 32);
|
||||||
|
|
||||||
*puiBitSize_p = (unsigned int)
|
*puiBitSize_p = (unsigned int)
|
||||||
((qwObjectMapping_p & 0xFFFF000000000000LL) >> 48);
|
((qwObjectMapping_p & 0xFFFF000000000000LL) >> 48);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplPdouCheckObjectMapping
|
// Function: EplPdouCheckObjectMapping
|
||||||
|
@ -508,101 +481,85 @@ static void EplPdouDecodeObjectMapping(QWORD qwObjectMapping_p,
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel EplPdouCheckObjectMapping(QWORD qwObjectMapping_p,
|
static tEplKernel EplPdouCheckObjectMapping(QWORD qwObjectMapping_p,
|
||||||
tEplObdAccess AccessType_p,
|
tEplObdAccess AccessType_p,
|
||||||
DWORD* pdwAbortCode_p,
|
DWORD * pdwAbortCode_p,
|
||||||
unsigned int* puiPdoSize_p)
|
unsigned int *puiPdoSize_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplObdSize ObdSize;
|
tEplObdSize ObdSize;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
unsigned int uiSubIndex;
|
unsigned int uiSubIndex;
|
||||||
unsigned int uiBitOffset;
|
unsigned int uiBitOffset;
|
||||||
unsigned int uiBitSize;
|
unsigned int uiBitSize;
|
||||||
tEplObdAccess AccessType;
|
tEplObdAccess AccessType;
|
||||||
BOOL fNumerical;
|
BOOL fNumerical;
|
||||||
|
|
||||||
if (qwObjectMapping_p == 0)
|
if (qwObjectMapping_p == 0) { // discard zero value
|
||||||
{ // discard zero value
|
*puiPdoSize_p = 0;
|
||||||
*puiPdoSize_p = 0;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// decode object mapping
|
||||||
|
EplPdouDecodeObjectMapping(qwObjectMapping_p,
|
||||||
|
&uiIndex,
|
||||||
|
&uiSubIndex, &uiBitOffset, &uiBitSize);
|
||||||
|
|
||||||
// decode object mapping
|
if ((uiBitOffset & 0x7) != 0x0) { // bit mapping is not supported
|
||||||
EplPdouDecodeObjectMapping(qwObjectMapping_p,
|
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
||||||
&uiIndex,
|
Ret = kEplPdoGranularityMismatch;
|
||||||
&uiSubIndex,
|
goto Exit;
|
||||||
&uiBitOffset,
|
}
|
||||||
&uiBitSize);
|
|
||||||
|
|
||||||
if ((uiBitOffset & 0x7) != 0x0)
|
if ((uiBitSize & 0x7) != 0x0) { // bit mapping is not supported
|
||||||
{ // bit mapping is not supported
|
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
||||||
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
Ret = kEplPdoGranularityMismatch;
|
||||||
Ret = kEplPdoGranularityMismatch;
|
goto Exit;
|
||||||
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 ((uiBitSize & 0x7) != 0x0)
|
if ((AccessType & kEplObdAccPdo) == 0) { // object is not mappable
|
||||||
{ // bit mapping is not supported
|
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
|
||||||
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
Ret = kEplPdoVarNotFound;
|
||||||
Ret = kEplPdoGranularityMismatch;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// check access type
|
if ((AccessType & AccessType_p) == 0) { // object is not writeable (RPDO) or readable (TPDO) respectively
|
||||||
Ret = EplObduGetAccessType(uiIndex, uiSubIndex, &AccessType);
|
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
|
||||||
if (Ret != kEplSuccessful)
|
Ret = kEplPdoVarNotFound;
|
||||||
{ // entry doesn't exist
|
goto Exit;
|
||||||
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_EXIST;
|
}
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((AccessType & kEplObdAccPdo) == 0)
|
ObdSize = EplObduGetDataSize(uiIndex, uiSubIndex);
|
||||||
{ // object is not mappable
|
if (ObdSize < (uiBitSize >> 3)) { // object does not exist or has smaller size
|
||||||
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
|
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
||||||
Ret = kEplPdoVarNotFound;
|
Ret = kEplPdoVarNotFound;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((AccessType & AccessType_p) == 0)
|
Ret = EplObduIsNumerical(uiIndex, uiSubIndex, &fNumerical);
|
||||||
{ // object is not writeable (RPDO) or readable (TPDO) respectively
|
if (Ret != kEplSuccessful) { // entry doesn't exist
|
||||||
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_MAPPABLE;
|
*pdwAbortCode_p = EPL_SDOAC_OBJECT_NOT_EXIST;
|
||||||
Ret = kEplPdoVarNotFound;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ObdSize = EplObduGetDataSize(uiIndex, uiSubIndex);
|
if ((fNumerical != FALSE)
|
||||||
if (ObdSize < (uiBitSize >> 3))
|
&& ((uiBitSize >> 3) != ObdSize)) {
|
||||||
{ // object does not exist or has smaller size
|
// object is numerical,
|
||||||
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
// therefor size has to fit, but it does not.
|
||||||
Ret = kEplPdoVarNotFound;
|
*pdwAbortCode_p = EPL_SDOAC_GENERAL_ERROR;
|
||||||
}
|
Ret = kEplPdoVarNotFound;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
// calucaled needed PDO size
|
||||||
|
*puiPdoSize_p = (uiBitOffset >> 3) + (uiBitSize >> 3);
|
||||||
|
|
||||||
Ret = EplObduIsNumerical(uiIndex, uiSubIndex, &fNumerical);
|
Exit:
|
||||||
if (Ret != kEplSuccessful)
|
return Ret;
|
||||||
{ // 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)
|
#endif // #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_PDOU)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,9 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// instance table
|
// instance table
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
unsigned int m_auiSdoAsndConnection[EPL_SDO_MAX_CONNECTION_ASND];
|
||||||
unsigned int m_auiSdoAsndConnection[EPL_SDO_MAX_CONNECTION_ASND];
|
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
|
||||||
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
|
|
||||||
|
|
||||||
|
|
||||||
} tEplSdoAsndInstance;
|
} tEplSdoAsndInstance;
|
||||||
|
|
||||||
|
@ -106,7 +104,7 @@ typedef struct
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplSdoAsndInstance SdoAsndInstance_g;
|
static tEplSdoAsndInstance SdoAsndInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
|
@ -127,8 +125,6 @@ tEplKernel PUBLIC EplSdoAsnduCb(tEplFrameInfo * pFrameInfo_p);
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -155,15 +151,13 @@ tEplKernel PUBLIC EplSdoAsnduCb(tEplFrameInfo * pFrameInfo_p);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduInit(tEplSequLayerReceiveCb fpReceiveCb_p)
|
tEplKernel PUBLIC EplSdoAsnduInit(tEplSequLayerReceiveCb fpReceiveCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
|
Ret = EplSdoAsnduAddInstance(fpReceiveCb_p);
|
||||||
|
|
||||||
Ret = EplSdoAsnduAddInstance(fpReceiveCb_p);
|
return Ret;
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplSdoAsnduAddInstance
|
// Function: EplSdoAsnduAddInstance
|
||||||
|
@ -184,30 +178,26 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
|
tEplKernel PUBLIC EplSdoAsnduAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// init control structure
|
// init control structure
|
||||||
EPL_MEMSET(&SdoAsndInstance_g, 0x00, sizeof(SdoAsndInstance_g));
|
EPL_MEMSET(&SdoAsndInstance_g, 0x00, sizeof(SdoAsndInstance_g));
|
||||||
|
|
||||||
// save pointer to callback-function
|
// save pointer to callback-function
|
||||||
if (fpReceiveCb_p != NULL)
|
if (fpReceiveCb_p != NULL) {
|
||||||
{
|
SdoAsndInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
|
||||||
SdoAsndInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
|
} else {
|
||||||
}
|
Ret = kEplSdoUdpMissCb;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
Ret = kEplSdoUdpMissCb;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
|
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
|
||||||
EplSdoAsnduCb,
|
EplSdoAsnduCb, kEplDllAsndFilterLocal);
|
||||||
kEplDllAsndFilterLocal);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -230,21 +220,19 @@ tEplKernel Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduDelInstance()
|
tEplKernel PUBLIC EplSdoAsnduDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
// deregister callback function from DLL
|
// deregister callback function from DLL
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
|
Ret = EplDlluCalRegAsndService(kEplDllAsndSdo,
|
||||||
NULL,
|
NULL, kEplDllAsndFilterNone);
|
||||||
kEplDllAsndFilterNone);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplSdoAsnduInitCon
|
// Function: EplSdoAsnduInitCon
|
||||||
|
@ -263,61 +251,53 @@ return Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduInitCon(tEplSdoConHdl* pSdoConHandle_p,
|
tEplKernel PUBLIC EplSdoAsnduInitCon(tEplSdoConHdl * pSdoConHandle_p,
|
||||||
unsigned int uiTargetNodeId_p)
|
unsigned int uiTargetNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiCount;
|
unsigned int uiCount;
|
||||||
unsigned int uiFreeCon;
|
unsigned int uiFreeCon;
|
||||||
unsigned int* puiConnection;
|
unsigned int *puiConnection;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
if ((uiTargetNodeId_p == EPL_C_ADR_INVALID)
|
if ((uiTargetNodeId_p == EPL_C_ADR_INVALID)
|
||||||
|| (uiTargetNodeId_p >= EPL_C_ADR_BROADCAST))
|
|| (uiTargetNodeId_p >= EPL_C_ADR_BROADCAST)) {
|
||||||
{
|
Ret = kEplSdoAsndInvalidNodeId;
|
||||||
Ret = kEplSdoAsndInvalidNodeId;
|
goto Exit;
|
||||||
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);
|
||||||
|
|
||||||
// get free entry in control structure
|
goto Exit;
|
||||||
uiCount = 0;
|
} else if (*puiConnection == 0) { // free entry-> save target nodeId
|
||||||
uiFreeCon = EPL_SDO_MAX_CONNECTION_ASND;
|
uiFreeCon = uiCount;
|
||||||
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[0];
|
}
|
||||||
while(uiCount < EPL_SDO_MAX_CONNECTION_ASND)
|
uiCount++;
|
||||||
{
|
puiConnection++;
|
||||||
if (*puiConnection == uiTargetNodeId_p)
|
}
|
||||||
{ // existing connection to target node found
|
|
||||||
// save handle for higher layer
|
|
||||||
*pSdoConHandle_p = (uiCount | EPL_SDO_ASND_HANDLE );
|
|
||||||
|
|
||||||
goto Exit;
|
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_ASND) {
|
||||||
}
|
// no free connection
|
||||||
else if (*puiConnection == 0)
|
Ret = kEplSdoAsndNoFreeHandle;
|
||||||
{ // free entry-> save target nodeId
|
} else {
|
||||||
uiFreeCon = uiCount;
|
puiConnection =
|
||||||
}
|
&SdoAsndInstance_g.m_auiSdoAsndConnection[uiFreeCon];
|
||||||
uiCount++;
|
*puiConnection = uiTargetNodeId_p;
|
||||||
puiConnection++;
|
// save handle for higher layer
|
||||||
}
|
*pSdoConHandle_p = (uiFreeCon | EPL_SDO_ASND_HANDLE);
|
||||||
|
|
||||||
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_ASND)
|
goto Exit;
|
||||||
{
|
}
|
||||||
// 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;
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -339,47 +319,47 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduSendData(tEplSdoConHdl SdoConHandle_p,
|
tEplKernel PUBLIC EplSdoAsnduSendData(tEplSdoConHdl SdoConHandle_p,
|
||||||
tEplFrame * pSrcData_p,
|
tEplFrame * pSrcData_p,
|
||||||
DWORD dwDataSize_p)
|
DWORD dwDataSize_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiArray;
|
unsigned int uiArray;
|
||||||
tEplFrameInfo FrameInfo;
|
tEplFrameInfo FrameInfo;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
||||||
|
|
||||||
if(uiArray > EPL_SDO_MAX_CONNECTION_ASND)
|
if (uiArray > EPL_SDO_MAX_CONNECTION_ASND) {
|
||||||
{
|
Ret = kEplSdoAsndInvalidHandle;
|
||||||
Ret = kEplSdoAsndInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// fillout Asnd header
|
||||||
|
// own node id not needed -> filled by DLL
|
||||||
|
|
||||||
// fillout Asnd header
|
// set message type
|
||||||
// own node id not needed -> filled by DLL
|
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, (BYTE) kEplMsgTypeAsnd); // ASnd == 0x06
|
||||||
|
// target node id
|
||||||
|
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId,
|
||||||
|
(BYTE) SdoAsndInstance_g.
|
||||||
|
m_auiSdoAsndConnection[uiArray]);
|
||||||
|
// set source-nodeid (filled by DLL 0)
|
||||||
|
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
|
||||||
|
|
||||||
// set message type
|
// calc size
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, (BYTE)kEplMsgTypeAsnd); // ASnd == 0x06
|
dwDataSize_p += EPL_ASND_HEADER_SIZE;
|
||||||
// target node id
|
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId, (BYTE) SdoAsndInstance_g.m_auiSdoAsndConnection[uiArray]);
|
|
||||||
// set source-nodeid (filled by DLL 0)
|
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
|
|
||||||
|
|
||||||
// calc size
|
// send function of DLL
|
||||||
dwDataSize_p += EPL_ASND_HEADER_SIZE;
|
FrameInfo.m_uiFrameSize = dwDataSize_p;
|
||||||
|
FrameInfo.m_pFrame = pSrcData_p;
|
||||||
// send function of DLL
|
EPL_MEMSET(&FrameInfo.m_NetTime, 0x00, sizeof(tEplNetTime));
|
||||||
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)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
|
||||||
Ret = EplDlluCalAsyncSend(&FrameInfo,kEplDllAsyncReqPrioGeneric);
|
Ret = EplDlluCalAsyncSend(&FrameInfo, kEplDllAsyncReqPrioGeneric);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,25 +381,22 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduDelCon(tEplSdoConHdl SdoConHandle_p)
|
tEplKernel PUBLIC EplSdoAsnduDelCon(tEplSdoConHdl SdoConHandle_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiArray;
|
unsigned int uiArray;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
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;
|
||||||
|
|
||||||
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
Exit:
|
||||||
// check parameter
|
return Ret;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
@ -447,63 +424,60 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoAsnduCb(tEplFrameInfo * pFrameInfo_p)
|
tEplKernel PUBLIC EplSdoAsnduCb(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
unsigned int uiCount;
|
unsigned int uiCount;
|
||||||
unsigned int* puiConnection;
|
unsigned int *puiConnection;
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
unsigned int uiFreeEntry = 0xFFFF;
|
unsigned int uiFreeEntry = 0xFFFF;
|
||||||
tEplSdoConHdl SdoConHdl;
|
tEplSdoConHdl SdoConHdl;
|
||||||
tEplFrame* pFrame;
|
tEplFrame *pFrame;
|
||||||
|
|
||||||
pFrame = pFrameInfo_p->m_pFrame;
|
pFrame = pFrameInfo_p->m_pFrame;
|
||||||
|
|
||||||
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bSrcNodeId);
|
uiNodeId = AmiGetByteFromLe(&pFrame->m_le_bSrcNodeId);
|
||||||
|
|
||||||
// search corresponding entry in control structure
|
// search corresponding entry in control structure
|
||||||
uiCount = 0;
|
uiCount = 0;
|
||||||
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[0];
|
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[0];
|
||||||
while (uiCount < EPL_SDO_MAX_CONNECTION_ASND)
|
while (uiCount < EPL_SDO_MAX_CONNECTION_ASND) {
|
||||||
{
|
if (uiNodeId == *puiConnection) {
|
||||||
if (uiNodeId == *puiConnection)
|
break;
|
||||||
{
|
} else if ((*puiConnection == 0)
|
||||||
break;
|
&& (uiFreeEntry == 0xFFFF)) { // free entry
|
||||||
}
|
uiFreeEntry = uiCount;
|
||||||
else if ((*puiConnection == 0)
|
}
|
||||||
&& (uiFreeEntry == 0xFFFF))
|
uiCount++;
|
||||||
{ // free entry
|
puiConnection++;
|
||||||
uiFreeEntry = uiCount;
|
}
|
||||||
}
|
|
||||||
uiCount++;
|
|
||||||
puiConnection++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uiCount == EPL_SDO_MAX_CONNECTION_ASND)
|
if (uiCount == EPL_SDO_MAX_CONNECTION_ASND) {
|
||||||
{
|
if (uiFreeEntry != 0xFFFF) {
|
||||||
if (uiFreeEntry != 0xFFFF)
|
puiConnection =
|
||||||
{
|
&SdoAsndInstance_g.
|
||||||
puiConnection = &SdoAsndInstance_g.m_auiSdoAsndConnection[uiFreeEntry];
|
m_auiSdoAsndConnection[uiFreeEntry];
|
||||||
*puiConnection = uiNodeId;
|
*puiConnection = uiNodeId;
|
||||||
uiCount = uiFreeEntry;
|
uiCount = uiFreeEntry;
|
||||||
}
|
} else {
|
||||||
else
|
EPL_DBGLVL_SDO_TRACE0
|
||||||
{
|
("EplSdoAsnduCb(): no free handle\n");
|
||||||
EPL_DBGLVL_SDO_TRACE0("EplSdoAsnduCb(): no free handle\n");
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// if (uiNodeId == *puiConnection)
|
// if (uiNodeId == *puiConnection)
|
||||||
{ // entry found or created
|
{ // entry found or created
|
||||||
SdoConHdl = (uiCount | EPL_SDO_ASND_HANDLE );
|
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));
|
SdoAsndInstance_g.m_fpSdoAsySeqCb(SdoConHdl,
|
||||||
}
|
&pFrame->m_Data.m_Asnd.
|
||||||
|
m_Payload.m_SdoSequenceFrame,
|
||||||
|
(pFrameInfo_p->m_uiFrameSize -
|
||||||
|
18));
|
||||||
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
|
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_ASND)) != 0)
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -68,7 +68,6 @@
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "user/EplSdoUdpu.h"
|
#include "user/EplSdoUdpu.h"
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
|
||||||
|
@ -79,7 +78,6 @@
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -100,29 +98,27 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
unsigned long m_ulIpAddr; // in network byte order
|
||||||
unsigned long m_ulIpAddr; // in network byte order
|
unsigned int m_uiPort; // in network byte order
|
||||||
unsigned int m_uiPort; // in network byte order
|
|
||||||
|
|
||||||
} tEplSdoUdpCon;
|
} tEplSdoUdpCon;
|
||||||
|
|
||||||
// instance table
|
// instance table
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplSdoUdpCon m_aSdoAbsUdpConnection[EPL_SDO_MAX_CONNECTION_UDP];
|
||||||
tEplSdoUdpCon m_aSdoAbsUdpConnection[EPL_SDO_MAX_CONNECTION_UDP];
|
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
|
||||||
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
|
SOCKET m_UdpSocket;
|
||||||
SOCKET m_UdpSocket;
|
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
HANDLE m_ThreadHandle;
|
HANDLE m_ThreadHandle;
|
||||||
LPCRITICAL_SECTION m_pCriticalSection;
|
LPCRITICAL_SECTION m_pCriticalSection;
|
||||||
CRITICAL_SECTION m_CriticalSection;
|
CRITICAL_SECTION m_CriticalSection;
|
||||||
|
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
struct completion m_CompletionUdpThread;
|
struct completion m_CompletionUdpThread;
|
||||||
int m_ThreadHandle;
|
int m_ThreadHandle;
|
||||||
int m_iTerminateThread;
|
int m_iTerminateThread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} tEplSdoUdpInstance;
|
} tEplSdoUdpInstance;
|
||||||
|
@ -131,7 +127,7 @@ typedef struct
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplSdoUdpInstance SdoUdpInstance_g;
|
static tEplSdoUdpInstance SdoUdpInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
|
@ -141,7 +137,7 @@ static tEplSdoUdpInstance SdoUdpInstance_g;
|
||||||
static DWORD PUBLIC EplSdoUdpThread(LPVOID lpParameter);
|
static DWORD PUBLIC EplSdoUdpThread(LPVOID lpParameter);
|
||||||
|
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
static int EplSdoUdpThread(void * pArg_p);
|
static int EplSdoUdpThread(void *pArg_p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -157,8 +153,6 @@ static int EplSdoUdpThread(void * pArg_p);
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -185,12 +179,11 @@ static int EplSdoUdpThread(void * pArg_p);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuInit(tEplSequLayerReceiveCb fpReceiveCb_p)
|
tEplKernel PUBLIC EplSdoUdpuInit(tEplSequLayerReceiveCb fpReceiveCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
|
Ret = EplSdoUdpuAddInstance(fpReceiveCb_p);
|
||||||
|
|
||||||
Ret = EplSdoUdpuAddInstance(fpReceiveCb_p);
|
return Ret;
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -214,59 +207,54 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
|
tEplKernel PUBLIC EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
int iError;
|
int iError;
|
||||||
WSADATA Wsa;
|
WSADATA Wsa;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set instance variables to 0
|
// set instance variables to 0
|
||||||
EPL_MEMSET(&SdoUdpInstance_g, 0x00, sizeof(SdoUdpInstance_g));
|
EPL_MEMSET(&SdoUdpInstance_g, 0x00, sizeof(SdoUdpInstance_g));
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// save pointer to callback-function
|
// save pointer to callback-function
|
||||||
if (fpReceiveCb_p != NULL)
|
if (fpReceiveCb_p != NULL) {
|
||||||
{
|
SdoUdpInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
|
||||||
SdoUdpInstance_g.m_fpSdoAsySeqCb = fpReceiveCb_p;
|
} else {
|
||||||
}
|
Ret = kEplSdoUdpMissCb;
|
||||||
else
|
goto Exit;
|
||||||
{
|
}
|
||||||
Ret = kEplSdoUdpMissCb;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// start winsock2 for win32
|
// start winsock2 for win32
|
||||||
// windows specific start of socket
|
// windows specific start of socket
|
||||||
iError = WSAStartup(MAKEWORD(2,0),&Wsa);
|
iError = WSAStartup(MAKEWORD(2, 0), &Wsa);
|
||||||
if (iError != 0)
|
if (iError != 0) {
|
||||||
{
|
Ret = kEplSdoUdpNoSocket;
|
||||||
Ret = kEplSdoUdpNoSocket;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// create critical section for acccess of instnace variables
|
||||||
|
SdoUdpInstance_g.m_pCriticalSection =
|
||||||
// create critical section for acccess of instnace variables
|
&SdoUdpInstance_g.m_CriticalSection;
|
||||||
SdoUdpInstance_g.m_pCriticalSection = &SdoUdpInstance_g.m_CriticalSection;
|
InitializeCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
||||||
InitializeCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
|
||||||
|
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
init_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
init_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
||||||
SdoUdpInstance_g.m_iTerminateThread = 0;
|
SdoUdpInstance_g.m_iTerminateThread = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SdoUdpInstance_g.m_ThreadHandle = 0;
|
SdoUdpInstance_g.m_ThreadHandle = 0;
|
||||||
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
|
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
|
||||||
|
|
||||||
Ret = EplSdoUdpuConfig(INADDR_ANY, 0);
|
Ret = EplSdoUdpuConfig(INADDR_ANY, 0);
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplSdoUdpuDelInstance
|
// Function: EplSdoUdpuDelInstance
|
||||||
|
@ -287,56 +275,52 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuDelInstance()
|
tEplKernel PUBLIC EplSdoUdpuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
BOOL fTermError;
|
BOOL fTermError;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
if (SdoUdpInstance_g.m_ThreadHandle != 0)
|
if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started
|
||||||
{ // listen thread was started
|
// close thread
|
||||||
// close thread
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
fTermError = TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
|
fTermError =
|
||||||
if(fTermError == FALSE)
|
TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
|
||||||
{
|
if (fTermError == FALSE) {
|
||||||
Ret = kEplSdoUdpThreadError;
|
Ret = kEplSdoUdpThreadError;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
SdoUdpInstance_g.m_iTerminateThread = 1;
|
SdoUdpInstance_g.m_iTerminateThread = 1;
|
||||||
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
|
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
|
||||||
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
|
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
|
||||||
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SdoUdpInstance_g.m_ThreadHandle = 0;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (SdoUdpInstance_g.m_UdpSocket != INVALID_SOCKET) {
|
||||||
|
// close socket
|
||||||
|
closesocket(SdoUdpInstance_g.m_UdpSocket);
|
||||||
|
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
|
||||||
|
}
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// delete critical section
|
// delete critical section
|
||||||
DeleteCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
DeleteCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// for win 32
|
// for win 32
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
Exit:
|
Exit:
|
||||||
#endif
|
#endif
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -356,120 +340,107 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
|
tEplKernel PUBLIC EplSdoUdpuConfig(unsigned long ulIpAddr_p,
|
||||||
|
unsigned int uiPort_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
struct sockaddr_in Addr;
|
struct sockaddr_in Addr;
|
||||||
int iError;
|
int iError;
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
BOOL fTermError;
|
BOOL fTermError;
|
||||||
unsigned long ulThreadId;
|
unsigned long ulThreadId;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
if (uiPort_p == 0)
|
if (uiPort_p == 0) { // set UDP port to default port number
|
||||||
{ // set UDP port to default port number
|
uiPort_p = EPL_C_SDO_EPL_PORT;
|
||||||
uiPort_p = EPL_C_SDO_EPL_PORT;
|
} else if (uiPort_p > 65535) {
|
||||||
}
|
Ret = kEplSdoUdpSocketError;
|
||||||
else if (uiPort_p > 65535)
|
goto Exit;
|
||||||
{
|
}
|
||||||
Ret = kEplSdoUdpSocketError;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SdoUdpInstance_g.m_ThreadHandle != 0)
|
if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started
|
||||||
{ // listen thread was started
|
|
||||||
|
|
||||||
// close old thread
|
// close old thread
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
fTermError = TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
|
fTermError =
|
||||||
if(fTermError == FALSE)
|
TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
|
||||||
{
|
if (fTermError == FALSE) {
|
||||||
Ret = kEplSdoUdpThreadError;
|
Ret = kEplSdoUdpThreadError;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
SdoUdpInstance_g.m_iTerminateThread = 1;
|
SdoUdpInstance_g.m_iTerminateThread = 1;
|
||||||
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
|
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
|
||||||
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
|
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
|
||||||
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
|
||||||
SdoUdpInstance_g.m_iTerminateThread = 0;
|
SdoUdpInstance_g.m_iTerminateThread = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SdoUdpInstance_g.m_ThreadHandle = 0;
|
SdoUdpInstance_g.m_ThreadHandle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SdoUdpInstance_g.m_UdpSocket != INVALID_SOCKET)
|
if (SdoUdpInstance_g.m_UdpSocket != INVALID_SOCKET) {
|
||||||
{
|
// close socket
|
||||||
// close socket
|
iError = closesocket(SdoUdpInstance_g.m_UdpSocket);
|
||||||
iError = closesocket(SdoUdpInstance_g.m_UdpSocket);
|
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
|
||||||
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
|
if (iError != 0) {
|
||||||
if(iError != 0)
|
Ret = kEplSdoUdpSocketError;
|
||||||
{
|
goto Exit;
|
||||||
Ret = kEplSdoUdpSocketError;
|
}
|
||||||
goto Exit;
|
}
|
||||||
}
|
// create Socket
|
||||||
}
|
SdoUdpInstance_g.m_UdpSocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
if (SdoUdpInstance_g.m_UdpSocket == INVALID_SOCKET) {
|
||||||
// create Socket
|
Ret = kEplSdoUdpNoSocket;
|
||||||
SdoUdpInstance_g.m_UdpSocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
EPL_DBGLVL_SDO_TRACE0("EplSdoUdpuConfig: socket() failed\n");
|
||||||
if (SdoUdpInstance_g.m_UdpSocket == INVALID_SOCKET)
|
goto Exit;
|
||||||
{
|
}
|
||||||
Ret = kEplSdoUdpNoSocket;
|
// bind socket
|
||||||
EPL_DBGLVL_SDO_TRACE0("EplSdoUdpuConfig: socket() failed\n");
|
Addr.sin_family = AF_INET;
|
||||||
goto Exit;
|
Addr.sin_port = htons((unsigned short)uiPort_p);
|
||||||
}
|
Addr.sin_addr.s_addr = htonl(ulIpAddr_p);
|
||||||
|
iError =
|
||||||
// bind socket
|
bind(SdoUdpInstance_g.m_UdpSocket, (struct sockaddr *)&Addr,
|
||||||
Addr.sin_family = AF_INET;
|
sizeof(Addr));
|
||||||
Addr.sin_port = htons((unsigned short) uiPort_p);
|
if (iError < 0) {
|
||||||
Addr.sin_addr.s_addr = htonl(ulIpAddr_p);
|
//iError = WSAGetLastError();
|
||||||
iError = bind(SdoUdpInstance_g.m_UdpSocket, (struct sockaddr*)&Addr, sizeof (Addr));
|
EPL_DBGLVL_SDO_TRACE1
|
||||||
if (iError < 0)
|
("EplSdoUdpuConfig: bind() finished with %i\n", iError);
|
||||||
{
|
Ret = kEplSdoUdpNoSocket;
|
||||||
//iError = WSAGetLastError();
|
goto Exit;
|
||||||
EPL_DBGLVL_SDO_TRACE1("EplSdoUdpuConfig: bind() finished with %i\n", iError);
|
}
|
||||||
Ret = kEplSdoUdpNoSocket;
|
// create Listen-Thread
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create Listen-Thread
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// for win32
|
// for win32
|
||||||
|
|
||||||
// create thread
|
|
||||||
SdoUdpInstance_g.m_ThreadHandle = CreateThread(NULL,
|
|
||||||
0,
|
|
||||||
EplSdoUdpThread,
|
|
||||||
&SdoUdpInstance_g,
|
|
||||||
0,
|
|
||||||
&ulThreadId);
|
|
||||||
if(SdoUdpInstance_g.m_ThreadHandle == NULL)
|
|
||||||
{
|
|
||||||
Ret = kEplSdoUdpThreadError;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// create thread
|
||||||
|
SdoUdpInstance_g.m_ThreadHandle = CreateThread(NULL,
|
||||||
|
0,
|
||||||
|
EplSdoUdpThread,
|
||||||
|
&SdoUdpInstance_g,
|
||||||
|
0, &ulThreadId);
|
||||||
|
if (SdoUdpInstance_g.m_ThreadHandle == NULL) {
|
||||||
|
Ret = kEplSdoUdpThreadError;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
|
|
||||||
SdoUdpInstance_g.m_ThreadHandle = kernel_thread(EplSdoUdpThread, &SdoUdpInstance_g, CLONE_KERNEL);
|
SdoUdpInstance_g.m_ThreadHandle =
|
||||||
if(SdoUdpInstance_g.m_ThreadHandle == 0)
|
kernel_thread(EplSdoUdpThread, &SdoUdpInstance_g, CLONE_KERNEL);
|
||||||
{
|
if (SdoUdpInstance_g.m_ThreadHandle == 0) {
|
||||||
Ret = kEplSdoUdpThreadError;
|
Ret = kEplSdoUdpThreadError;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Exit:
|
||||||
Exit:
|
return Ret;
|
||||||
return Ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplSdoUdpuInitCon
|
// Function: EplSdoUdpuInitCon
|
||||||
|
@ -488,57 +459,51 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuInitCon(tEplSdoConHdl* pSdoConHandle_p,
|
tEplKernel PUBLIC EplSdoUdpuInitCon(tEplSdoConHdl * pSdoConHandle_p,
|
||||||
unsigned int uiTargetNodeId_p)
|
unsigned int uiTargetNodeId_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiCount;
|
unsigned int uiCount;
|
||||||
unsigned int uiFreeCon;
|
unsigned int uiFreeCon;
|
||||||
tEplSdoUdpCon* pSdoUdpCon;
|
tEplSdoUdpCon *pSdoUdpCon;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// get free entry in control structure
|
// get free entry in control structure
|
||||||
uiCount = 0;
|
uiCount = 0;
|
||||||
uiFreeCon = EPL_SDO_MAX_CONNECTION_UDP;
|
uiFreeCon = EPL_SDO_MAX_CONNECTION_UDP;
|
||||||
pSdoUdpCon = &SdoUdpInstance_g.m_aSdoAbsUdpConnection[0];
|
pSdoUdpCon = &SdoUdpInstance_g.m_aSdoAbsUdpConnection[0];
|
||||||
while (uiCount < EPL_SDO_MAX_CONNECTION_UDP)
|
while (uiCount < EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
{
|
if ((pSdoUdpCon->m_ulIpAddr & htonl(0xFF)) == htonl(uiTargetNodeId_p)) { // existing connection to target node found
|
||||||
if ((pSdoUdpCon->m_ulIpAddr & htonl(0xFF)) == htonl(uiTargetNodeId_p))
|
// set handle
|
||||||
{ // existing connection to target node found
|
*pSdoConHandle_p = (uiCount | EPL_SDO_UDP_HANDLE);
|
||||||
// set handle
|
|
||||||
*pSdoConHandle_p = (uiCount | EPL_SDO_UDP_HANDLE);
|
|
||||||
|
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
} else if ((pSdoUdpCon->m_ulIpAddr == 0)
|
||||||
else if ((pSdoUdpCon->m_ulIpAddr == 0)
|
&& (pSdoUdpCon->m_uiPort == 0)) {
|
||||||
&& (pSdoUdpCon->m_uiPort == 0))
|
uiFreeCon = uiCount;
|
||||||
{
|
}
|
||||||
uiFreeCon = uiCount;
|
uiCount++;
|
||||||
}
|
pSdoUdpCon++;
|
||||||
uiCount++;
|
}
|
||||||
pSdoUdpCon++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_UDP)
|
if (uiFreeCon == EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
{
|
// error no free handle
|
||||||
// error no free handle
|
Ret = kEplSdoUdpNoFreeHandle;
|
||||||
Ret = kEplSdoUdpNoFreeHandle;
|
} else {
|
||||||
}
|
pSdoUdpCon =
|
||||||
else
|
&SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiFreeCon];
|
||||||
{
|
// save infos for connection
|
||||||
pSdoUdpCon = &SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiFreeCon];
|
pSdoUdpCon->m_uiPort = htons(EPL_C_SDO_EPL_PORT);
|
||||||
// save infos for connection
|
pSdoUdpCon->m_ulIpAddr = htonl(0xC0A86400 | uiTargetNodeId_p); // 192.168.100.uiTargetNodeId_p
|
||||||
pSdoUdpCon->m_uiPort = htons(EPL_C_SDO_EPL_PORT);
|
|
||||||
pSdoUdpCon->m_ulIpAddr = htonl(0xC0A86400 | uiTargetNodeId_p); // 192.168.100.uiTargetNodeId_p
|
|
||||||
|
|
||||||
// set handle
|
// set handle
|
||||||
*pSdoConHandle_p = (uiFreeCon | EPL_SDO_UDP_HANDLE);
|
*pSdoConHandle_p = (uiFreeCon | EPL_SDO_UDP_HANDLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,67 +526,67 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuSendData(tEplSdoConHdl SdoConHandle_p,
|
tEplKernel PUBLIC EplSdoUdpuSendData(tEplSdoConHdl SdoConHandle_p,
|
||||||
tEplFrame * pSrcData_p,
|
tEplFrame * pSrcData_p, DWORD dwDataSize_p)
|
||||||
DWORD dwDataSize_p)
|
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
int iError;
|
int iError;
|
||||||
unsigned int uiArray;
|
unsigned int uiArray;
|
||||||
struct sockaddr_in Addr;
|
struct sockaddr_in Addr;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
||||||
if(uiArray >= EPL_SDO_MAX_CONNECTION_UDP)
|
if (uiArray >= EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
{
|
Ret = kEplSdoUdpInvalidHdl;
|
||||||
Ret = kEplSdoUdpInvalidHdl;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
//set message type
|
||||||
//set message type
|
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, 0x06); // SDO
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bMessageType, 0x06); // SDO
|
// target node id (for Udp = 0)
|
||||||
// target node id (for Udp = 0)
|
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId, 0x00);
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bDstNodeId, 0x00);
|
// set source-nodeid (for Udp = 0)
|
||||||
// set source-nodeid (for Udp = 0)
|
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
|
||||||
AmiSetByteToLe(&pSrcData_p->m_le_bSrcNodeId, 0x00);
|
|
||||||
|
|
||||||
// calc size
|
// calc size
|
||||||
dwDataSize_p += EPL_ASND_HEADER_SIZE;
|
dwDataSize_p += EPL_ASND_HEADER_SIZE;
|
||||||
|
|
||||||
// call sendto
|
// call sendto
|
||||||
Addr.sin_family = AF_INET;
|
Addr.sin_family = AF_INET;
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// enter critical section for process function
|
// enter critical section for process function
|
||||||
EnterCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
EnterCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Addr.sin_port = (unsigned short) SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_uiPort;
|
Addr.sin_port =
|
||||||
Addr.sin_addr.s_addr = SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr;
|
(unsigned short)SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].
|
||||||
|
m_uiPort;
|
||||||
|
Addr.sin_addr.s_addr =
|
||||||
|
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr;
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// leave critical section for process function
|
// leave critical section for process function
|
||||||
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iError = sendto (SdoUdpInstance_g.m_UdpSocket, // sockethandle
|
iError = sendto(SdoUdpInstance_g.m_UdpSocket, // sockethandle
|
||||||
(const char*) &pSrcData_p->m_le_bMessageType, // data to send
|
(const char *)&pSrcData_p->m_le_bMessageType, // data to send
|
||||||
dwDataSize_p, // number of bytes to send
|
dwDataSize_p, // number of bytes to send
|
||||||
0, // flags
|
0, // flags
|
||||||
(struct sockaddr*)&Addr, // target
|
(struct sockaddr *)&Addr, // target
|
||||||
sizeof(struct sockaddr_in)); // sizeof targetadress
|
sizeof(struct sockaddr_in)); // sizeof targetadress
|
||||||
if(iError < 0)
|
if (iError < 0) {
|
||||||
{
|
EPL_DBGLVL_SDO_TRACE1
|
||||||
EPL_DBGLVL_SDO_TRACE1("EplSdoUdpuSendData: sendto() finished with %i\n", iError);
|
("EplSdoUdpuSendData: sendto() finished with %i\n", iError);
|
||||||
Ret = kEplSdoUdpSendError;
|
Ret = kEplSdoUdpSendError;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplSdoUdpuDelCon
|
// Function: EplSdoUdpuDelCon
|
||||||
|
@ -640,29 +605,24 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplSdoUdpuDelCon(tEplSdoConHdl SdoConHandle_p)
|
tEplKernel PUBLIC EplSdoUdpuDelCon(tEplSdoConHdl SdoConHandle_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiArray;
|
unsigned int uiArray;
|
||||||
|
|
||||||
|
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
||||||
|
|
||||||
uiArray = (SdoConHandle_p & ~EPL_SDO_ASY_HANDLE_MASK);
|
if (uiArray >= EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
|
Ret = kEplSdoUdpInvalidHdl;
|
||||||
|
goto Exit;
|
||||||
|
} else {
|
||||||
|
Ret = kEplSuccessful;
|
||||||
|
}
|
||||||
|
|
||||||
if(uiArray >= EPL_SDO_MAX_CONNECTION_UDP)
|
// delete connection
|
||||||
{
|
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr = 0;
|
||||||
Ret = kEplSdoUdpInvalidHdl;
|
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_uiPort = 0;
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Ret = kEplSuccessful;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Exit:
|
||||||
// delete connection
|
return Ret;
|
||||||
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_ulIpAddr = 0;
|
|
||||||
SdoUdpInstance_g.m_aSdoAbsUdpConnection[uiArray].m_uiPort = 0;
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
@ -691,131 +651,140 @@ Exit:
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
static DWORD PUBLIC EplSdoUdpThread(LPVOID lpParameter)
|
static DWORD PUBLIC EplSdoUdpThread(LPVOID lpParameter)
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
static int EplSdoUdpThread(void * pArg_p)
|
static int EplSdoUdpThread(void *pArg_p)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
tEplSdoUdpInstance* pInstance;
|
tEplSdoUdpInstance *pInstance;
|
||||||
struct sockaddr_in RemoteAddr;
|
struct sockaddr_in RemoteAddr;
|
||||||
int iError;
|
int iError;
|
||||||
int iCount;
|
int iCount;
|
||||||
int iFreeEntry;
|
int iFreeEntry;
|
||||||
BYTE abBuffer[EPL_MAX_SDO_REC_FRAME_SIZE];
|
BYTE abBuffer[EPL_MAX_SDO_REC_FRAME_SIZE];
|
||||||
unsigned int uiSize;
|
unsigned int uiSize;
|
||||||
tEplSdoConHdl SdoConHdl;
|
tEplSdoConHdl SdoConHdl;
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
pInstance = (tEplSdoUdpInstance*)lpParameter;
|
pInstance = (tEplSdoUdpInstance *) lpParameter;
|
||||||
|
|
||||||
for (;;)
|
|
||||||
|
|
||||||
|
for (;;)
|
||||||
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
pInstance = (tEplSdoUdpInstance*)pArg_p;
|
pInstance = (tEplSdoUdpInstance *) pArg_p;
|
||||||
daemonize("EplSdoUdpThread");
|
daemonize("EplSdoUdpThread");
|
||||||
allow_signal( SIGTERM );
|
allow_signal(SIGTERM);
|
||||||
|
|
||||||
for (;pInstance->m_iTerminateThread == 0;)
|
for (; pInstance->m_iTerminateThread == 0;)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
// wait for data
|
// wait for data
|
||||||
uiSize = sizeof(struct sockaddr);
|
uiSize = sizeof(struct sockaddr);
|
||||||
iError = recvfrom(pInstance->m_UdpSocket, // Socket
|
iError = recvfrom(pInstance->m_UdpSocket, // Socket
|
||||||
(char *)&abBuffer[0], // buffer for data
|
(char *)&abBuffer[0], // buffer for data
|
||||||
sizeof(abBuffer), // size of the buffer
|
sizeof(abBuffer), // size of the buffer
|
||||||
0, // flags
|
0, // flags
|
||||||
(struct sockaddr*)&RemoteAddr,
|
(struct sockaddr *)&RemoteAddr,
|
||||||
(int*)&uiSize);
|
(int *)&uiSize);
|
||||||
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
if (iError == -ERESTARTSYS)
|
if (iError == -ERESTARTSYS) {
|
||||||
{
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (iError > 0)
|
if (iError > 0) {
|
||||||
{
|
// get handle for higher layer
|
||||||
// get handle for higher layer
|
iCount = 0;
|
||||||
iCount = 0;
|
iFreeEntry = 0xFFFF;
|
||||||
iFreeEntry = 0xFFFF;
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// enter critical section for process function
|
// enter critical section for process function
|
||||||
EnterCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
EnterCriticalSection(SdoUdpInstance_g.
|
||||||
|
m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
while (iCount < EPL_SDO_MAX_CONNECTION_UDP)
|
while (iCount < EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
{
|
// check if this connection is already known
|
||||||
// check if this connection is already known
|
if ((pInstance->m_aSdoAbsUdpConnection[iCount].
|
||||||
if((pInstance->m_aSdoAbsUdpConnection[iCount].m_ulIpAddr == RemoteAddr.sin_addr.s_addr)
|
m_ulIpAddr == RemoteAddr.sin_addr.s_addr)
|
||||||
&& (pInstance->m_aSdoAbsUdpConnection[iCount].m_uiPort == RemoteAddr.sin_port))
|
&& (pInstance->
|
||||||
{
|
m_aSdoAbsUdpConnection[iCount].
|
||||||
break;
|
m_uiPort == RemoteAddr.sin_port)) {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if((pInstance->m_aSdoAbsUdpConnection[iCount].m_ulIpAddr == 0)
|
if ((pInstance->m_aSdoAbsUdpConnection[iCount].
|
||||||
&& (pInstance->m_aSdoAbsUdpConnection[iCount].m_uiPort == 0)
|
m_ulIpAddr == 0)
|
||||||
&& (iFreeEntry == 0xFFFF))
|
&& (pInstance->
|
||||||
|
m_aSdoAbsUdpConnection[iCount].
|
||||||
|
m_uiPort == 0)
|
||||||
|
&& (iFreeEntry == 0xFFFF))
|
||||||
|
{
|
||||||
|
iFreeEntry = iCount;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
iCount++;
|
||||||
iFreeEntry = iCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
iCount++;
|
if (iCount == EPL_SDO_MAX_CONNECTION_UDP) {
|
||||||
}
|
// connection unknown
|
||||||
|
// see if there is a free handle
|
||||||
if (iCount == EPL_SDO_MAX_CONNECTION_UDP)
|
if (iFreeEntry != 0xFFFF) {
|
||||||
{
|
// save adress infos
|
||||||
// connection unknown
|
pInstance->
|
||||||
// see if there is a free handle
|
m_aSdoAbsUdpConnection[iFreeEntry].
|
||||||
if (iFreeEntry != 0xFFFF)
|
m_ulIpAddr =
|
||||||
{
|
RemoteAddr.sin_addr.s_addr;
|
||||||
// save adress infos
|
pInstance->
|
||||||
pInstance->m_aSdoAbsUdpConnection[iFreeEntry].m_ulIpAddr =
|
m_aSdoAbsUdpConnection[iFreeEntry].
|
||||||
RemoteAddr.sin_addr.s_addr;
|
m_uiPort = RemoteAddr.sin_port;
|
||||||
pInstance->m_aSdoAbsUdpConnection[iFreeEntry].m_uiPort =
|
|
||||||
RemoteAddr.sin_port;
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// leave critical section for process function
|
// leave critical section for process function
|
||||||
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
LeaveCriticalSection(SdoUdpInstance_g.
|
||||||
|
m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
// call callback
|
// call callback
|
||||||
SdoConHdl = iFreeEntry;
|
SdoConHdl = iFreeEntry;
|
||||||
SdoConHdl |= EPL_SDO_UDP_HANDLE;
|
SdoConHdl |= EPL_SDO_UDP_HANDLE;
|
||||||
// offset 4 -> start of SDO Sequence header
|
// offset 4 -> start of SDO Sequence header
|
||||||
pInstance->m_fpSdoAsySeqCb(SdoConHdl, (tEplAsySdoSeq*)&abBuffer[4], (iError - 4));
|
pInstance->m_fpSdoAsySeqCb(SdoConHdl,
|
||||||
}
|
(tEplAsySdoSeq
|
||||||
else
|
*) &
|
||||||
{
|
abBuffer[4],
|
||||||
EPL_DBGLVL_SDO_TRACE0("Error in EplSdoUdpThread() no free handle\n");
|
(iError -
|
||||||
|
4));
|
||||||
|
} else {
|
||||||
|
EPL_DBGLVL_SDO_TRACE0
|
||||||
|
("Error in EplSdoUdpThread() no free handle\n");
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// leave critical section for process function
|
// leave critical section for process function
|
||||||
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
LeaveCriticalSection(SdoUdpInstance_g.
|
||||||
|
m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
// known connection
|
||||||
{
|
// call callback with correct handle
|
||||||
// known connection
|
SdoConHdl = iCount;
|
||||||
// call callback with correct handle
|
SdoConHdl |= EPL_SDO_UDP_HANDLE;
|
||||||
SdoConHdl = iCount;
|
|
||||||
SdoConHdl |= EPL_SDO_UDP_HANDLE;
|
|
||||||
#if (TARGET_SYSTEM == _WIN32_)
|
#if (TARGET_SYSTEM == _WIN32_)
|
||||||
// leave critical section for process function
|
// leave critical section for process function
|
||||||
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
|
LeaveCriticalSection(SdoUdpInstance_g.
|
||||||
|
m_pCriticalSection);
|
||||||
#endif
|
#endif
|
||||||
// offset 4 -> start of SDO Sequence header
|
// offset 4 -> start of SDO Sequence header
|
||||||
pInstance->m_fpSdoAsySeqCb(SdoConHdl, (tEplAsySdoSeq*)&abBuffer[4], (iError - 4));
|
pInstance->m_fpSdoAsySeqCb(SdoConHdl,
|
||||||
}
|
(tEplAsySdoSeq *) &
|
||||||
} // end of if(iError!=SOCKET_ERROR)
|
abBuffer[4],
|
||||||
}// end of for(;;)
|
(iError - 4));
|
||||||
|
}
|
||||||
|
} // end of if(iError!=SOCKET_ERROR)
|
||||||
|
} // end of for(;;)
|
||||||
|
|
||||||
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
|
||||||
complete_and_exit(&SdoUdpInstance_g.m_CompletionUdpThread, 0);
|
complete_and_exit(&SdoUdpInstance_g.m_CompletionUdpThread, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
|
#endif // end of #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,6 @@
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
//
|
//
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E D E F I N I T I O N S //
|
// P R I V A T E D E F I N I T I O N S //
|
||||||
|
@ -124,9 +122,8 @@
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplStatusuCbResponse m_apfnCbResponse[254];
|
||||||
tEplStatusuCbResponse m_apfnCbResponse[254];
|
|
||||||
|
|
||||||
} tEplStatusuInstance;
|
} tEplStatusuInstance;
|
||||||
|
|
||||||
|
@ -134,13 +131,14 @@ typedef struct
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplStatusuInstance EplStatusuInstance_g;
|
static tEplStatusuInstance EplStatusuInstance_g;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplKernel PUBLIC EplStatusuCbStatusResponse(tEplFrameInfo * pFrameInfo_p);
|
static tEplKernel PUBLIC EplStatusuCbStatusResponse(tEplFrameInfo *
|
||||||
|
pFrameInfo_p);
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
|
@ -168,14 +166,13 @@ static tEplKernel PUBLIC EplStatusuCbStatusResponse(tEplFrameInfo * pFrameInfo_p
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuInit()
|
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplStatusuAddInstance();
|
Ret = EplStatusuAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplStatusuAddInstance
|
// Function: EplStatusuAddInstance
|
||||||
|
@ -196,21 +193,23 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuAddInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof (EplStatusuInstance_g));
|
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof(EplStatusuInstance_g));
|
||||||
|
|
||||||
// register StatusResponse callback function
|
// register StatusResponse callback function
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndStatusResponse, EplStatusuCbStatusResponse, kEplDllAsndFilterAny);
|
Ret =
|
||||||
|
EplDlluCalRegAsndService(kEplDllAsndStatusResponse,
|
||||||
|
EplStatusuCbStatusResponse,
|
||||||
|
kEplDllAsndFilterAny);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplStatusuDelInstance
|
// Function: EplStatusuDelInstance
|
||||||
|
@ -231,18 +230,19 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuDelInstance()
|
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// deregister StatusResponse callback function
|
// deregister StatusResponse callback function
|
||||||
Ret = EplDlluCalRegAsndService(kEplDllAsndStatusResponse, NULL, kEplDllAsndFilterNone);
|
Ret =
|
||||||
|
EplDlluCalRegAsndService(kEplDllAsndStatusResponse, NULL,
|
||||||
|
kEplDllAsndFilterNone);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplStatusuReset
|
// Function: EplStatusuReset
|
||||||
|
@ -260,18 +260,17 @@ tEplKernel Ret;
|
||||||
|
|
||||||
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuReset()
|
EPLDLLEXPORT tEplKernel PUBLIC EplStatusuReset()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// reset instance structure
|
// reset instance structure
|
||||||
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof (EplStatusuInstance_g));
|
EPL_MEMSET(&EplStatusuInstance_g, 0, sizeof(EplStatusuInstance_g));
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplStatusuRequestStatusResponse
|
// Function: EplStatusuRequestStatusResponse
|
||||||
|
@ -288,42 +287,38 @@ tEplKernel Ret;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplStatusuRequestStatusResponse(
|
tEplKernel PUBLIC EplStatusuRequestStatusResponse(unsigned int uiNodeId_p,
|
||||||
unsigned int uiNodeId_p,
|
tEplStatusuCbResponse
|
||||||
tEplStatusuCbResponse pfnCbResponse_p)
|
pfnCbResponse_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// decrement node ID, because array is zero based
|
// decrement node ID, because array is zero based
|
||||||
uiNodeId_p--;
|
uiNodeId_p--;
|
||||||
if (uiNodeId_p < tabentries (EplStatusuInstance_g.m_apfnCbResponse))
|
if (uiNodeId_p < tabentries(EplStatusuInstance_g.m_apfnCbResponse)) {
|
||||||
{
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
if (EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL)
|
if (EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] != NULL) { // request already issued (maybe by someone else)
|
||||||
{ // request already issued (maybe by someone else)
|
Ret = kEplInvalidOperation;
|
||||||
Ret = kEplInvalidOperation;
|
} else {
|
||||||
}
|
EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] =
|
||||||
else
|
pfnCbResponse_p;
|
||||||
{
|
Ret =
|
||||||
EplStatusuInstance_g.m_apfnCbResponse[uiNodeId_p] = pfnCbResponse_p;
|
EplDlluCalIssueRequest(kEplDllReqServiceStatus,
|
||||||
Ret = EplDlluCalIssueRequest(kEplDllReqServiceStatus, (uiNodeId_p + 1), 0xFF);
|
(uiNodeId_p + 1), 0xFF);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Ret = kEplInvalidOperation;
|
Ret = kEplInvalidOperation;
|
||||||
#endif
|
#endif
|
||||||
}
|
} else { // invalid node ID specified
|
||||||
else
|
Ret = kEplInvalidNodeId;
|
||||||
{ // invalid node ID specified
|
}
|
||||||
Ret = kEplInvalidNodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -347,41 +342,39 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static tEplKernel PUBLIC EplStatusuCbStatusResponse(tEplFrameInfo * pFrameInfo_p)
|
static tEplKernel PUBLIC EplStatusuCbStatusResponse(tEplFrameInfo *
|
||||||
|
pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
unsigned int uiNodeId;
|
unsigned int uiNodeId;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
tEplStatusuCbResponse pfnCbResponse;
|
tEplStatusuCbResponse pfnCbResponse;
|
||||||
|
|
||||||
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
|
uiNodeId = AmiGetByteFromLe(&pFrameInfo_p->m_pFrame->m_le_bSrcNodeId);
|
||||||
|
|
||||||
uiIndex = uiNodeId - 1;
|
uiIndex = uiNodeId - 1;
|
||||||
|
|
||||||
if (uiIndex < tabentries (EplStatusuInstance_g.m_apfnCbResponse))
|
if (uiIndex < tabentries(EplStatusuInstance_g.m_apfnCbResponse)) {
|
||||||
{
|
// memorize pointer to callback function
|
||||||
// memorize pointer to callback function
|
pfnCbResponse = EplStatusuInstance_g.m_apfnCbResponse[uiIndex];
|
||||||
pfnCbResponse = EplStatusuInstance_g.m_apfnCbResponse[uiIndex];
|
if (pfnCbResponse == NULL) { // response was not requested
|
||||||
if (pfnCbResponse == NULL)
|
goto Exit;
|
||||||
{ // response was not requested
|
}
|
||||||
goto Exit;
|
// reset callback function pointer so that caller may issue next request
|
||||||
}
|
EplStatusuInstance_g.m_apfnCbResponse[uiIndex] = NULL;
|
||||||
// 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)
|
if (pFrameInfo_p->m_uiFrameSize < EPL_C_DLL_MINSIZE_STATUSRES) { // StatusResponse not received or it has invalid size
|
||||||
{ // StatusResponse not received or it has invalid size
|
Ret = pfnCbResponse(uiNodeId, NULL);
|
||||||
Ret = pfnCbResponse(uiNodeId, NULL);
|
} else { // StatusResponse received
|
||||||
}
|
Ret =
|
||||||
else
|
pfnCbResponse(uiNodeId,
|
||||||
{ // StatusResponse received
|
&pFrameInfo_p->m_pFrame->m_Data.
|
||||||
Ret = pfnCbResponse(uiNodeId, &pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.m_StatusResponse);
|
m_Asnd.m_Payload.m_StatusResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,9 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
struct timer_list m_Timer;
|
||||||
struct timer_list m_Timer;
|
tEplTimerArg TimerArgument;
|
||||||
tEplTimerArg TimerArgument;
|
|
||||||
|
|
||||||
} tEplTimeruData;
|
} tEplTimeruData;
|
||||||
|
|
||||||
|
@ -137,14 +136,13 @@ static void PUBLIC EplTimeruCbMs(unsigned long ulParameter_p);
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruInit()
|
tEplKernel PUBLIC EplTimeruInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplTimeruAddInstance();
|
Ret = EplTimeruAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruAddInstance
|
// Function: EplTimeruAddInstance
|
||||||
|
@ -161,14 +159,13 @@ tEplKernel Ret;
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruAddInstance()
|
tEplKernel PUBLIC EplTimeruAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruDelInstance
|
// Function: EplTimeruDelInstance
|
||||||
|
@ -187,14 +184,13 @@ tEplKernel Ret;
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruDelInstance()
|
tEplKernel PUBLIC EplTimeruDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruSetTimerMs
|
// Function: EplTimeruSetTimerMs
|
||||||
|
@ -211,43 +207,40 @@ tEplKernel Ret;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplTimeruData* pData;
|
tEplTimeruData *pData;
|
||||||
|
|
||||||
// check pointer to handle
|
// check pointer to handle
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pData = (tEplTimeruData*) EPL_MALLOC(sizeof (tEplTimeruData));
|
pData = (tEplTimeruData *) EPL_MALLOC(sizeof(tEplTimeruData));
|
||||||
if (pData == NULL)
|
if (pData == NULL) {
|
||||||
{
|
Ret = kEplNoResource;
|
||||||
Ret = kEplNoResource;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init_timer(&pData->m_Timer);
|
init_timer(&pData->m_Timer);
|
||||||
pData->m_Timer.function = EplTimeruCbMs;
|
pData->m_Timer.function = EplTimeruCbMs;
|
||||||
pData->m_Timer.data = (unsigned long) pData;
|
pData->m_Timer.data = (unsigned long)pData;
|
||||||
pData->m_Timer.expires = jiffies + ulTime_p * HZ / 1000;
|
pData->m_Timer.expires = jiffies + ulTime_p * HZ / 1000;
|
||||||
|
|
||||||
EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
|
EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
|
||||||
|
|
||||||
add_timer(&pData->m_Timer);
|
add_timer(&pData->m_Timer);
|
||||||
|
|
||||||
*pTimerHdl_p = (tEplTimerHdl) pData;
|
*pTimerHdl_p = (tEplTimerHdl) pData;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruModifyTimerMs
|
// Function: EplTimeruModifyTimerMs
|
||||||
|
@ -264,57 +257,50 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplTimeruData* pData;
|
tEplTimeruData *pData;
|
||||||
|
|
||||||
// check pointer to handle
|
// check pointer to handle
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
// check handle itself, i.e. was the handle initialized before
|
mod_timer(&pData->m_Timer, (jiffies + ulTime_p * HZ / 1000));
|
||||||
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));
|
||||||
|
|
||||||
// copy the TimerArg after the timer is restarted,
|
// check if timer is really running
|
||||||
// so that a timer occured immediately before mod_timer
|
if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
|
||||||
// won't use the new TimerArg and
|
// retry starting it
|
||||||
// therefore the old timer cannot be distinguished from the new one.
|
add_timer(&pData->m_Timer);
|
||||||
// But if the new timer is too fast, it may get lost.
|
}
|
||||||
EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
|
// set handle to pointer of tEplTimeruData
|
||||||
|
|
||||||
// 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;
|
// *pTimerHdl_p = (tEplTimerHdl) pData;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruDeleteTimer
|
// Function: EplTimeruDeleteTimer
|
||||||
|
@ -329,50 +315,45 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl* pTimerHdl_p)
|
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl * pTimerHdl_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplTimeruData* pData;
|
tEplTimeruData *pData;
|
||||||
|
|
||||||
// check pointer to handle
|
// check pointer to handle
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// check handle itself, i.e. was the handle initialized before
|
||||||
|
if (*pTimerHdl_p == 0) {
|
||||||
// check handle itself, i.e. was the handle initialized before
|
Ret = kEplSuccessful;
|
||||||
if (*pTimerHdl_p == 0)
|
goto Exit;
|
||||||
{
|
}
|
||||||
Ret = kEplSuccessful;
|
pData = (tEplTimeruData *) * pTimerHdl_p;
|
||||||
goto Exit;
|
if ((tEplTimeruData *) pData->m_Timer.data != pData) {
|
||||||
}
|
Ret = kEplTimerInvalidHandle;
|
||||||
pData = (tEplTimeruData*) *pTimerHdl_p;
|
goto Exit;
|
||||||
if ((tEplTimeruData*)pData->m_Timer.data != pData)
|
}
|
||||||
{
|
|
||||||
Ret = kEplTimerInvalidHandle;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if (del_timer(&pData->m_Timer) == 1)
|
/* if (del_timer(&pData->m_Timer) == 1)
|
||||||
{
|
{
|
||||||
kfree(pData);
|
kfree(pData);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// try to delete the timer
|
// try to delete the timer
|
||||||
del_timer(&pData->m_Timer);
|
del_timer(&pData->m_Timer);
|
||||||
// free memory in any case
|
// free memory in any case
|
||||||
kfree(pData);
|
kfree(pData);
|
||||||
|
|
||||||
// uninitialize handle
|
// uninitialize handle
|
||||||
*pTimerHdl_p = 0;
|
*pTimerHdl_p = 0;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruIsTimerActive
|
// Function: EplTimeruIsTimerActive
|
||||||
|
@ -391,33 +372,28 @@ Exit:
|
||||||
|
|
||||||
BOOL PUBLIC EplTimeruIsTimerActive(tEplTimerHdl TimerHdl_p)
|
BOOL PUBLIC EplTimeruIsTimerActive(tEplTimerHdl TimerHdl_p)
|
||||||
{
|
{
|
||||||
BOOL fActive = FALSE;
|
BOOL fActive = FALSE;
|
||||||
tEplTimeruData* pData;
|
tEplTimeruData *pData;
|
||||||
|
|
||||||
// check handle itself, i.e. was the handle initialized before
|
// check handle itself, i.e. was the handle initialized before
|
||||||
if (TimerHdl_p == 0)
|
if (TimerHdl_p == 0) { // timer was not created yet, so it is not active
|
||||||
{ // timer was not created yet, so it is not active
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
pData = (tEplTimeruData *) TimerHdl_p;
|
||||||
pData = (tEplTimeruData*) TimerHdl_p;
|
if ((tEplTimeruData *) pData->m_Timer.data != pData) { // invalid timer
|
||||||
if ((tEplTimeruData*)pData->m_Timer.data != pData)
|
goto Exit;
|
||||||
{ // invalid timer
|
}
|
||||||
goto Exit;
|
// check if timer is running
|
||||||
}
|
if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
// check if timer is running
|
fActive = TRUE;
|
||||||
if (timer_pending(&pData->m_Timer) == 0)
|
|
||||||
{ // timer is not running
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
fActive = TRUE;
|
Exit:
|
||||||
|
return fActive;
|
||||||
Exit:
|
|
||||||
return fActive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P R I V A T E F U N C T I O N S //
|
// P R I V A T E F U N C T I O N S //
|
||||||
|
@ -443,30 +419,28 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static void PUBLIC EplTimeruCbMs(unsigned long ulParameter_p)
|
static void PUBLIC EplTimeruCbMs(unsigned long ulParameter_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplTimeruData* pData;
|
tEplTimeruData *pData;
|
||||||
tEplEvent EplEvent;
|
tEplEvent EplEvent;
|
||||||
tEplTimerEventArg TimerEventArg;
|
tEplTimerEventArg TimerEventArg;
|
||||||
|
|
||||||
pData = (tEplTimeruData*) ulParameter_p;
|
pData = (tEplTimeruData *) ulParameter_p;
|
||||||
|
|
||||||
// call event function
|
// call event function
|
||||||
TimerEventArg.m_TimerHdl = (tEplTimerHdl)pData;
|
TimerEventArg.m_TimerHdl = (tEplTimerHdl) pData;
|
||||||
TimerEventArg.m_ulArg = pData->TimerArgument.m_ulArg;
|
TimerEventArg.m_ulArg = pData->TimerArgument.m_ulArg;
|
||||||
|
|
||||||
EplEvent.m_EventSink = pData->TimerArgument.m_EventSink;
|
EplEvent.m_EventSink = pData->TimerArgument.m_EventSink;
|
||||||
EplEvent.m_EventType = kEplEventTypeTimer;
|
EplEvent.m_EventType = kEplEventTypeTimer;
|
||||||
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
|
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
|
||||||
EplEvent.m_pArg = &TimerEventArg;
|
EplEvent.m_pArg = &TimerEventArg;
|
||||||
EplEvent.m_uiSize = sizeof(TimerEventArg);
|
EplEvent.m_uiSize = sizeof(TimerEventArg);
|
||||||
|
|
||||||
Ret = EplEventuPost(&EplEvent);
|
Ret = EplEventuPost(&EplEvent);
|
||||||
|
|
||||||
// d.k. do not free memory, user has to call EplTimeruDeleteTimer()
|
// d.k. do not free memory, user has to call EplTimeruDeleteTimer()
|
||||||
//kfree(pData);
|
//kfree(pData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,11 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruInit()
|
tEplKernel PUBLIC EplTimeruInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplTimeruAddInstance();
|
Ret = EplTimeruAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -158,11 +158,11 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruAddInstance()
|
tEplKernel PUBLIC EplTimeruAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -186,11 +186,11 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruDelInstance()
|
tEplKernel PUBLIC EplTimeruDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -212,27 +212,24 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
// check handle
|
||||||
|
if (pTimerHdl_p == NULL) {
|
||||||
|
Ret = kEplTimerInvalidHandle;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
// check handle
|
Exit:
|
||||||
if(pTimerHdl_p == NULL)
|
return Ret;
|
||||||
{
|
|
||||||
Ret = kEplTimerInvalidHandle;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruModifyTimerMs
|
// Function: EplTimeruModifyTimerMs
|
||||||
|
@ -252,24 +249,22 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check parameter
|
// check parameter
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
Exit:
|
||||||
Exit:
|
return Ret;
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -289,25 +284,22 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl* pTimerHdl_p)
|
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl * pTimerHdl_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check parameter
|
// check parameter
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// set handle invalide
|
||||||
|
*pTimerHdl_p = 0;
|
||||||
|
|
||||||
// set handle invalide
|
Exit:
|
||||||
*pTimerHdl_p = 0;
|
return Ret;
|
||||||
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +309,4 @@ Exit:
|
||||||
// //
|
// //
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -85,24 +85,22 @@
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplTimerArg TimerArgument;
|
||||||
tEplTimerArg TimerArgument;
|
HANDLE DelteHandle;
|
||||||
HANDLE DelteHandle;
|
unsigned long ulTimeout;
|
||||||
unsigned long ulTimeout;
|
|
||||||
|
|
||||||
}tEplTimeruThread;
|
} tEplTimeruThread;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
LPCRITICAL_SECTION m_pCriticalSection;
|
||||||
LPCRITICAL_SECTION m_pCriticalSection;
|
CRITICAL_SECTION m_CriticalSection;
|
||||||
CRITICAL_SECTION m_CriticalSection;
|
} tEplTimeruInstance;
|
||||||
}tEplTimeruInstance;
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
static tEplTimeruInstance EplTimeruInstance_g;
|
static tEplTimeruInstance EplTimeruInstance_g;
|
||||||
static tEplTimeruThread ThreadData_l;
|
static tEplTimeruThread ThreadData_l;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -146,11 +144,11 @@ DWORD PUBLIC EplSdoTimeruThreadms(LPVOID lpParameter);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruInit()
|
tEplKernel PUBLIC EplTimeruInit()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplTimeruAddInstance();
|
Ret = EplTimeruAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -172,18 +170,16 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruAddInstance()
|
tEplKernel PUBLIC EplTimeruAddInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
|
// create critical section
|
||||||
|
EplTimeruInstance_g.m_pCriticalSection =
|
||||||
|
&EplTimeruInstance_g.m_CriticalSection;
|
||||||
|
InitializeCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// create critical section
|
return Ret;
|
||||||
EplTimeruInstance_g.m_pCriticalSection = &EplTimeruInstance_g.m_CriticalSection;
|
|
||||||
InitializeCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -207,11 +203,11 @@ return Ret;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruDelInstance()
|
tEplKernel PUBLIC EplTimeruDelInstance()
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -233,71 +229,60 @@ tEplKernel Ret;
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
HANDLE DeleteHandle;
|
HANDLE DeleteHandle;
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
DWORD ThreadId;
|
DWORD ThreadId;
|
||||||
|
|
||||||
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
// check handle
|
||||||
|
if (pTimerHdl_p == NULL) {
|
||||||
|
Ret = kEplTimerInvalidHandle;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
// enter critical section
|
||||||
|
EnterCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// check handle
|
// first create event to delete timer
|
||||||
if(pTimerHdl_p == NULL)
|
DeleteHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
{
|
if (DeleteHandle == NULL) {
|
||||||
Ret = kEplTimerInvalidHandle;
|
Ret = kEplTimerNoTimerCreated;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
// set handle for caller
|
||||||
|
*pTimerHdl_p = (tEplTimerHdl) DeleteHandle;
|
||||||
|
|
||||||
// enter critical section
|
// fill data for thread
|
||||||
EnterCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
ThreadData_l.DelteHandle = DeleteHandle;
|
||||||
|
EPL_MEMCPY(&ThreadData_l.TimerArgument, &Argument_p,
|
||||||
|
sizeof(tEplTimerArg));
|
||||||
|
ThreadData_l.ulTimeout = ulTime_p;
|
||||||
|
|
||||||
// first create event to delete timer
|
// create thread to create waitable timer and wait for timer
|
||||||
DeleteHandle = CreateEvent(NULL,FALSE,FALSE, NULL);
|
ThreadHandle = CreateThread(NULL,
|
||||||
if(DeleteHandle == NULL)
|
0,
|
||||||
{
|
EplSdoTimeruThreadms,
|
||||||
Ret = kEplTimerNoTimerCreated;
|
&ThreadData_l, 0, &ThreadId);
|
||||||
goto Exit;
|
if (ThreadHandle == NULL) {
|
||||||
}
|
// leave critical section
|
||||||
|
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// set handle for caller
|
// delte handle
|
||||||
*pTimerHdl_p = (tEplTimerHdl)DeleteHandle;
|
CloseHandle(DeleteHandle);
|
||||||
|
|
||||||
|
Ret = kEplTimerNoTimerCreated;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
return Ret;
|
||||||
// fill data for thread
|
|
||||||
ThreadData_l.DelteHandle = DeleteHandle;
|
|
||||||
EPL_MEMCPY(&ThreadData_l.TimerArgument, &Argument_p, sizeof(tEplTimerArg));
|
|
||||||
ThreadData_l.ulTimeout = ulTime_p;
|
|
||||||
|
|
||||||
// create thread to create waitable timer and wait for timer
|
|
||||||
ThreadHandle = CreateThread(NULL,
|
|
||||||
0,
|
|
||||||
EplSdoTimeruThreadms,
|
|
||||||
&ThreadData_l,
|
|
||||||
0,
|
|
||||||
&ThreadId);
|
|
||||||
if(ThreadHandle == NULL)
|
|
||||||
{
|
|
||||||
// leave critical section
|
|
||||||
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
|
||||||
|
|
||||||
// delte handle
|
|
||||||
CloseHandle(DeleteHandle);
|
|
||||||
|
|
||||||
Ret = kEplTimerNoTimerCreated;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimeruModifyTimerMs
|
// Function: EplTimeruModifyTimerMs
|
||||||
|
@ -317,69 +302,64 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long ulTime_p,
|
unsigned long ulTime_p,
|
||||||
tEplTimerArg Argument_p)
|
tEplTimerArg Argument_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
HANDLE DeleteHandle;
|
HANDLE DeleteHandle;
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
DWORD ThreadId;
|
DWORD ThreadId;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check parameter
|
// check parameter
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DeleteHandle = (HANDLE)(*pTimerHdl_p);
|
DeleteHandle = (HANDLE) (*pTimerHdl_p);
|
||||||
|
|
||||||
// set event to end timer task for this timer
|
// set event to end timer task for this timer
|
||||||
SetEvent(DeleteHandle);
|
SetEvent(DeleteHandle);
|
||||||
|
|
||||||
// create new timer
|
// create new timer
|
||||||
// first create event to delete timer
|
// first create event to delete timer
|
||||||
DeleteHandle = CreateEvent(NULL,FALSE,FALSE, NULL);
|
DeleteHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
if(DeleteHandle == NULL)
|
if (DeleteHandle == NULL) {
|
||||||
{
|
Ret = kEplTimerNoTimerCreated;
|
||||||
Ret = kEplTimerNoTimerCreated;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// set handle for caller
|
||||||
|
*pTimerHdl_p = (tEplTimerHdl) DeleteHandle;
|
||||||
|
|
||||||
// set handle for caller
|
// enter critical section
|
||||||
*pTimerHdl_p = (tEplTimerHdl)DeleteHandle;
|
EnterCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// enter critical section
|
// fill data for thread
|
||||||
EnterCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
ThreadData_l.DelteHandle = DeleteHandle;
|
||||||
|
EPL_MEMCPY(&ThreadData_l.TimerArgument, &Argument_p,
|
||||||
|
sizeof(tEplTimerArg));
|
||||||
|
ThreadData_l.ulTimeout = ulTime_p;
|
||||||
|
|
||||||
// fill data for thread
|
// create thread to create waitable timer and wait for timer
|
||||||
ThreadData_l.DelteHandle = DeleteHandle;
|
ThreadHandle = CreateThread(NULL,
|
||||||
EPL_MEMCPY(&ThreadData_l.TimerArgument, &Argument_p, sizeof(tEplTimerArg));
|
0,
|
||||||
ThreadData_l.ulTimeout = ulTime_p;
|
EplSdoTimeruThreadms,
|
||||||
|
&ThreadData_l, 0, &ThreadId);
|
||||||
|
if (ThreadHandle == NULL) {
|
||||||
|
// leave critical section
|
||||||
|
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// create thread to create waitable timer and wait for timer
|
// delte handle
|
||||||
ThreadHandle = CreateThread(NULL,
|
|
||||||
0,
|
|
||||||
EplSdoTimeruThreadms,
|
|
||||||
&ThreadData_l,
|
|
||||||
0,
|
|
||||||
&ThreadId);
|
|
||||||
if(ThreadHandle == NULL)
|
|
||||||
{
|
|
||||||
// leave critical section
|
|
||||||
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
|
||||||
|
|
||||||
// delte handle
|
Ret = kEplTimerNoTimerCreated;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
Ret = kEplTimerNoTimerCreated;
|
Exit:
|
||||||
goto Exit;
|
return Ret;
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -399,31 +379,29 @@ Exit:
|
||||||
// State:
|
// State:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl* pTimerHdl_p)
|
tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl * pTimerHdl_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
HANDLE DeleteHandle;
|
HANDLE DeleteHandle;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check parameter
|
// check parameter
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DeleteHandle = (HANDLE)(*pTimerHdl_p);
|
DeleteHandle = (HANDLE) (*pTimerHdl_p);
|
||||||
|
|
||||||
// set event to end timer task for this timer
|
// set event to end timer task for this timer
|
||||||
SetEvent(DeleteHandle);
|
SetEvent(DeleteHandle);
|
||||||
|
|
||||||
// set handle invalide
|
// set handle invalide
|
||||||
*pTimerHdl_p = 0;
|
*pTimerHdl_p = 0;
|
||||||
|
|
||||||
|
Exit:
|
||||||
Exit:
|
return Ret;
|
||||||
return Ret;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,100 +430,84 @@ Exit:
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
DWORD PUBLIC EplSdoTimeruThreadms(LPVOID lpParameter)
|
DWORD PUBLIC EplSdoTimeruThreadms(LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
tEplTimeruThread* pThreadData;
|
tEplTimeruThread *pThreadData;
|
||||||
HANDLE aHandles[2];
|
HANDLE aHandles[2];
|
||||||
BOOL fReturn;
|
BOOL fReturn;
|
||||||
LARGE_INTEGER TimeoutTime;
|
LARGE_INTEGER TimeoutTime;
|
||||||
unsigned long ulEvent;
|
unsigned long ulEvent;
|
||||||
tEplEvent EplEvent;
|
tEplEvent EplEvent;
|
||||||
tEplTimeruThread ThreadData;
|
tEplTimeruThread ThreadData;
|
||||||
tEplTimerEventArg TimerEventArg;
|
tEplTimerEventArg TimerEventArg;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// get pointer to data
|
// get pointer to data
|
||||||
pThreadData = (tEplTimeruThread*)lpParameter;
|
pThreadData = (tEplTimeruThread *) lpParameter;
|
||||||
// copy thread data
|
// copy thread data
|
||||||
EPL_MEMCPY(&ThreadData, pThreadData, sizeof(ThreadData));
|
EPL_MEMCPY(&ThreadData, pThreadData, sizeof(ThreadData));
|
||||||
pThreadData = &ThreadData;
|
pThreadData = &ThreadData;
|
||||||
|
|
||||||
// leave critical section
|
// leave critical section
|
||||||
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
LeaveCriticalSection(EplTimeruInstance_g.m_pCriticalSection);
|
||||||
|
|
||||||
// create waitable timer
|
// create waitable timer
|
||||||
aHandles[1] = CreateWaitableTimer(NULL,FALSE,NULL);
|
aHandles[1] = CreateWaitableTimer(NULL, FALSE, NULL);
|
||||||
if(aHandles[1] == NULL)
|
if (aHandles[1] == NULL) {
|
||||||
{
|
Ret = kEplTimerNoTimerCreated;
|
||||||
Ret = kEplTimerNoTimerCreated;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
// set timer
|
||||||
|
// set timeout interval -> needed to be negativ
|
||||||
|
// -> because relative timeout
|
||||||
|
// -> multiply by 10000 for 100 ns timebase of function
|
||||||
|
TimeoutTime.QuadPart = (((long long)pThreadData->ulTimeout) * -10000);
|
||||||
|
fReturn = SetWaitableTimer(aHandles[1],
|
||||||
|
&TimeoutTime, 0, NULL, NULL, FALSE);
|
||||||
|
if (fReturn == 0) {
|
||||||
|
Ret = kEplTimerNoTimerCreated;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
// save delte event handle in handle array
|
||||||
|
aHandles[0] = pThreadData->DelteHandle;
|
||||||
|
|
||||||
// set timer
|
// wait for one of the events
|
||||||
// set timeout interval -> needed to be negativ
|
ulEvent = WaitForMultipleObjects(2, &aHandles[0], FALSE, INFINITE);
|
||||||
// -> because relative timeout
|
if (ulEvent == WAIT_OBJECT_0) { // delte event
|
||||||
// -> multiply by 10000 for 100 ns timebase of function
|
|
||||||
TimeoutTime.QuadPart = (((long long)pThreadData->ulTimeout) * -10000);
|
|
||||||
fReturn = SetWaitableTimer(aHandles[1],
|
|
||||||
&TimeoutTime,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
FALSE);
|
|
||||||
if(fReturn == 0)
|
|
||||||
{
|
|
||||||
Ret = kEplTimerNoTimerCreated;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// save delte event handle in handle array
|
// close handels
|
||||||
aHandles[0] = pThreadData->DelteHandle;
|
CloseHandle(aHandles[1]);
|
||||||
|
// terminate thread
|
||||||
|
goto Exit;
|
||||||
|
} else if (ulEvent == (WAIT_OBJECT_0 + 1)) { // timer event
|
||||||
|
// call event function
|
||||||
|
TimerEventArg.m_TimerHdl =
|
||||||
|
(tEplTimerHdl) pThreadData->DelteHandle;
|
||||||
|
TimerEventArg.m_ulArg = pThreadData->TimerArgument.m_ulArg;
|
||||||
|
|
||||||
// wait for one of the events
|
EplEvent.m_EventSink = pThreadData->TimerArgument.m_EventSink;
|
||||||
ulEvent = WaitForMultipleObjects( 2,
|
EplEvent.m_EventType = kEplEventTypeTimer;
|
||||||
&aHandles[0],
|
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
|
||||||
FALSE,
|
EplEvent.m_pArg = &TimerEventArg;
|
||||||
INFINITE);
|
EplEvent.m_uiSize = sizeof(TimerEventArg);
|
||||||
if(ulEvent == WAIT_OBJECT_0)
|
|
||||||
{ // delte event
|
|
||||||
|
|
||||||
// close handels
|
Ret = EplEventuPost(&EplEvent);
|
||||||
CloseHandle(aHandles[1]);
|
|
||||||
// terminate thread
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
else if(ulEvent == (WAIT_OBJECT_0 + 1))
|
|
||||||
{ // timer event
|
|
||||||
// call event function
|
|
||||||
TimerEventArg.m_TimerHdl = (tEplTimerHdl)pThreadData->DelteHandle;
|
|
||||||
TimerEventArg.m_ulArg = pThreadData->TimerArgument.m_ulArg;
|
|
||||||
|
|
||||||
EplEvent.m_EventSink = pThreadData->TimerArgument.m_EventSink;
|
// close handels
|
||||||
EplEvent.m_EventType = kEplEventTypeTimer;
|
CloseHandle(aHandles[1]);
|
||||||
EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
|
// terminate thread
|
||||||
EplEvent.m_pArg = &TimerEventArg;
|
goto Exit;
|
||||||
EplEvent.m_uiSize = sizeof(TimerEventArg);
|
|
||||||
|
|
||||||
Ret = EplEventuPost(&EplEvent);
|
} else { // error
|
||||||
|
ulEvent = GetLastError();
|
||||||
|
TRACE1("Error in WaitForMultipleObjects Errorcode: 0x%x\n",
|
||||||
|
ulEvent);
|
||||||
|
// terminate thread
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
// close handels
|
Exit:
|
||||||
CloseHandle(aHandles[1]);
|
return Ret;
|
||||||
// terminate thread
|
|
||||||
goto Exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // error
|
|
||||||
ulEvent = GetLastError();
|
|
||||||
TRACE1("Error in WaitForMultipleObjects Errorcode: 0x%x\n",ulEvent);
|
|
||||||
// terminate thread
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
|
||||||
return Ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -68,12 +68,10 @@
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <linux/net.h>
|
#include <linux/net.h>
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include "SocketLinuxKernel.h"
|
#include "SocketLinuxKernel.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -82,34 +80,26 @@
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// const defines
|
// const defines
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Kernel Module specific Data Structures
|
// Kernel Module specific Data Structures
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -136,75 +126,72 @@
|
||||||
|
|
||||||
SOCKET socket(int af, int type, int protocol)
|
SOCKET socket(int af, int type, int protocol)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
SOCKET socket;
|
SOCKET socket;
|
||||||
|
|
||||||
rc = sock_create_kern(af, type, protocol, &socket);
|
rc = sock_create_kern(af, type, protocol, &socket);
|
||||||
if (rc < 0)
|
if (rc < 0) {
|
||||||
{
|
socket = NULL;
|
||||||
socket = NULL;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bind(SOCKET socket_p, const struct sockaddr *addr, int addrlen)
|
int bind(SOCKET socket_p, const struct sockaddr *addr, int addrlen)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = socket_p->ops->bind(socket_p,
|
rc = socket_p->ops->bind(socket_p, (struct sockaddr *)addr, addrlen);
|
||||||
(struct sockaddr *)addr,
|
|
||||||
addrlen);
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int closesocket(SOCKET socket_p)
|
int closesocket(SOCKET socket_p)
|
||||||
{
|
{
|
||||||
sock_release(socket_p);
|
sock_release(socket_p);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int recvfrom(SOCKET socket_p, char* buf, int len, int flags, struct sockaddr *from, int * fromlen)
|
int recvfrom(SOCKET socket_p, char *buf, int len, int flags,
|
||||||
|
struct sockaddr *from, int *fromlen)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct kvec iov;
|
struct kvec iov;
|
||||||
|
|
||||||
msg.msg_control = NULL;
|
msg.msg_control = NULL;
|
||||||
msg.msg_controllen = 0;
|
msg.msg_controllen = 0;
|
||||||
msg.msg_name = from; // will be struct sock_addr
|
msg.msg_name = from; // will be struct sock_addr
|
||||||
msg.msg_namelen = *fromlen;
|
msg.msg_namelen = *fromlen;
|
||||||
iov.iov_len = len;
|
iov.iov_len = len;
|
||||||
iov.iov_base = buf;
|
iov.iov_base = buf;
|
||||||
|
|
||||||
rc = kernel_recvmsg(socket_p, &msg, &iov, 1, iov.iov_len, 0);
|
rc = kernel_recvmsg(socket_p, &msg, &iov, 1, iov.iov_len, 0);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sendto(SOCKET socket_p, const char* buf, int len, int flags, const struct sockaddr *to, int tolen)
|
int sendto(SOCKET socket_p, const char *buf, int len, int flags,
|
||||||
|
const struct sockaddr *to, int tolen)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct kvec iov;
|
struct kvec iov;
|
||||||
|
|
||||||
msg.msg_control = NULL;
|
msg.msg_control = NULL;
|
||||||
msg.msg_controllen = 0;
|
msg.msg_controllen = 0;
|
||||||
msg.msg_name = (struct sockaddr *)to; // will be struct sock_addr
|
msg.msg_name = (struct sockaddr *)to; // will be struct sock_addr
|
||||||
msg.msg_namelen = tolen;
|
msg.msg_namelen = tolen;
|
||||||
msg.msg_flags = 0;
|
msg.msg_flags = 0;
|
||||||
iov.iov_len = len;
|
iov.iov_len = len;
|
||||||
iov.iov_base = (char *)buf;
|
iov.iov_base = (char *)buf;
|
||||||
|
|
||||||
rc = kernel_sendmsg(socket_p, &msg, &iov, 1, len);
|
rc = kernel_sendmsg(socket_p, &msg, &iov, 1, len);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
|
|
|
@ -91,27 +91,25 @@
|
||||||
// const defines
|
// const defines
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#define TIMER_COUNT 2 /* max 15 timers selectable */
|
#define TIMER_COUNT 2 /* max 15 timers selectable */
|
||||||
#define TIMER_MIN_VAL_SINGLE 5000 /* min 5us */
|
#define TIMER_MIN_VAL_SINGLE 5000 /* min 5us */
|
||||||
#define TIMER_MIN_VAL_CYCLE 100000 /* min 100us */
|
#define TIMER_MIN_VAL_CYCLE 100000 /* min 100us */
|
||||||
|
|
||||||
#define PROVE_OVERRUN
|
#define PROVE_OVERRUN
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_HIGH_RES_TIMERS
|
#ifndef CONFIG_HIGH_RES_TIMERS
|
||||||
#error "Kernel symbol CONFIG_HIGH_RES_TIMERS is required."
|
#error "Kernel symbol CONFIG_HIGH_RES_TIMERS is required."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// TracePoint support for realtime-debugging
|
// TracePoint support for realtime-debugging
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
void PUBLIC TgtDbgSignalTracePoint (BYTE bTracePointNumber_p);
|
void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p);
|
||||||
void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p);
|
void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p);
|
||||||
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
|
#define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p)
|
||||||
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
|
#define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v)
|
||||||
#else
|
#else
|
||||||
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
|
#define TGT_DBG_SIGNAL_TRACE_POINT(p)
|
||||||
#define TGT_DBG_POST_TRACE_VALUE(v)
|
#define TGT_DBG_POST_TRACE_VALUE(v)
|
||||||
#endif
|
#endif
|
||||||
#define HRT_DBG_POST_TRACE_VALUE(Event_p, uiNodeId_p, wErrorCode_p) \
|
#define HRT_DBG_POST_TRACE_VALUE(Event_p, uiNodeId_p, wErrorCode_p) \
|
||||||
TGT_DBG_POST_TRACE_VALUE((0xE << 28) | (Event_p << 24) \
|
TGT_DBG_POST_TRACE_VALUE((0xE << 28) | (Event_p << 24) \
|
||||||
|
@ -128,19 +126,17 @@
|
||||||
// modul global types
|
// modul global types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplTimerEventArg m_EventArg;
|
||||||
tEplTimerEventArg m_EventArg;
|
tEplTimerkCallback m_pfnCallback;
|
||||||
tEplTimerkCallback m_pfnCallback;
|
struct hrtimer m_Timer;
|
||||||
struct hrtimer m_Timer;
|
BOOL m_fContinuously;
|
||||||
BOOL m_fContinuously;
|
unsigned long long m_ullPeriod;
|
||||||
unsigned long long m_ullPeriod;
|
|
||||||
|
|
||||||
} tEplTimerHighReskTimerInfo;
|
} tEplTimerHighReskTimerInfo;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
tEplTimerHighReskTimerInfo m_aTimerInfo[TIMER_COUNT];
|
||||||
tEplTimerHighReskTimerInfo m_aTimerInfo[TIMER_COUNT];
|
|
||||||
|
|
||||||
} tEplTimerHighReskInstance;
|
} tEplTimerHighReskInstance;
|
||||||
|
|
||||||
|
@ -148,13 +144,13 @@ typedef struct
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static tEplTimerHighReskInstance EplTimerHighReskInstance_l;
|
static tEplTimerHighReskInstance EplTimerHighReskInstance_l;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
enum hrtimer_restart EplTimerHighReskCallback (struct hrtimer* pTimer_p);
|
enum hrtimer_restart EplTimerHighReskCallback(struct hrtimer *pTimer_p);
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
|
@ -162,7 +158,6 @@ enum hrtimer_restart EplTimerHighReskCallback (struct hrtimer* pTimer_p);
|
||||||
// //
|
// //
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskInit()
|
// Function: EplTimerHighReskInit()
|
||||||
|
@ -179,15 +174,14 @@ enum hrtimer_restart EplTimerHighReskCallback (struct hrtimer* pTimer_p);
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimerHighReskInit(void)
|
tEplKernel PUBLIC EplTimerHighReskInit(void)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
|
|
||||||
Ret = EplTimerHighReskAddInstance();
|
Ret = EplTimerHighReskAddInstance();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskAddInstance()
|
// Function: EplTimerHighReskAddInstance()
|
||||||
|
@ -204,45 +198,45 @@ tEplKernel Ret;
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimerHighReskAddInstance(void)
|
tEplKernel PUBLIC EplTimerHighReskAddInstance(void)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
EPL_MEMSET(&EplTimerHighReskInstance_l, 0, sizeof (EplTimerHighReskInstance_l));
|
EPL_MEMSET(&EplTimerHighReskInstance_l, 0,
|
||||||
|
sizeof(EplTimerHighReskInstance_l));
|
||||||
|
|
||||||
#ifndef CONFIG_HIGH_RES_TIMERS
|
#ifndef CONFIG_HIGH_RES_TIMERS
|
||||||
printk("EplTimerHighResk: Kernel symbol CONFIG_HIGH_RES_TIMERS is required.\n");
|
printk
|
||||||
Ret = kEplNoResource;
|
("EplTimerHighResk: Kernel symbol CONFIG_HIGH_RES_TIMERS is required.\n");
|
||||||
return Ret;
|
Ret = kEplNoResource;
|
||||||
|
return Ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize hrtimer structures for all usable timers.
|
* Initialize hrtimer structures for all usable timers.
|
||||||
*/
|
*/
|
||||||
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++)
|
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++) {
|
||||||
{
|
tEplTimerHighReskTimerInfo *pTimerInfo;
|
||||||
tEplTimerHighReskTimerInfo* pTimerInfo;
|
struct hrtimer *pTimer;
|
||||||
struct hrtimer* pTimer;
|
|
||||||
|
|
||||||
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
||||||
pTimer = &pTimerInfo->m_Timer;
|
pTimer = &pTimerInfo->m_Timer;
|
||||||
hrtimer_init(pTimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
|
hrtimer_init(pTimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
|
||||||
|
|
||||||
pTimer->function = EplTimerHighReskCallback;
|
pTimer->function = EplTimerHighReskCallback;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use HRTIMER_CB_SOFTIRQ here.
|
* We use HRTIMER_CB_SOFTIRQ here.
|
||||||
* HRTIMER_CB_IRQSAFE is critical as the callback function
|
* HRTIMER_CB_IRQSAFE is critical as the callback function
|
||||||
* would be called with IRQs disabled.
|
* would be called with IRQs disabled.
|
||||||
*/
|
*/
|
||||||
pTimer->cb_mode = HRTIMER_CB_SOFTIRQ;
|
pTimer->cb_mode = HRTIMER_CB_SOFTIRQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskDelInstance()
|
// Function: EplTimerHighReskDelInstance()
|
||||||
|
@ -259,30 +253,28 @@ unsigned int uiIndex;
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimerHighReskDelInstance(void)
|
tEplKernel PUBLIC EplTimerHighReskDelInstance(void)
|
||||||
{
|
{
|
||||||
tEplTimerHighReskTimerInfo* pTimerInfo;
|
tEplTimerHighReskTimerInfo *pTimerInfo;
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++)
|
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++) {
|
||||||
{
|
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
|
||||||
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
|
pTimerInfo->m_pfnCallback = NULL;
|
||||||
pTimerInfo->m_pfnCallback = NULL;
|
pTimerInfo->m_EventArg.m_TimerHdl = 0;
|
||||||
pTimerInfo->m_EventArg.m_TimerHdl = 0;
|
/*
|
||||||
/*
|
* In this case we can not just try to cancel the timer.
|
||||||
* In this case we can not just try to cancel the timer.
|
* We actually have to wait until its callback function
|
||||||
* We actually have to wait until its callback function
|
* has returned.
|
||||||
* has returned.
|
*/
|
||||||
*/
|
hrtimer_cancel(&pTimerInfo->m_Timer);
|
||||||
hrtimer_cancel(&pTimerInfo->m_Timer);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskModifyTimerNs()
|
// Function: EplTimerHighReskModifyTimerNs()
|
||||||
|
@ -313,96 +305,89 @@ unsigned int uiIndex;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimerHighReskModifyTimerNs(tEplTimerHdl* pTimerHdl_p,
|
tEplKernel PUBLIC EplTimerHighReskModifyTimerNs(tEplTimerHdl * pTimerHdl_p,
|
||||||
unsigned long long ullTimeNs_p,
|
unsigned long long ullTimeNs_p,
|
||||||
tEplTimerkCallback pfnCallback_p,
|
tEplTimerkCallback
|
||||||
unsigned long ulArgument_p,
|
pfnCallback_p,
|
||||||
BOOL fContinuously_p)
|
unsigned long ulArgument_p,
|
||||||
|
BOOL fContinuously_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret;
|
tEplKernel Ret;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
tEplTimerHighReskTimerInfo* pTimerInfo;
|
tEplTimerHighReskTimerInfo *pTimerInfo;
|
||||||
ktime_t RelTime;
|
ktime_t RelTime;
|
||||||
|
|
||||||
Ret = kEplSuccessful;
|
Ret = kEplSuccessful;
|
||||||
|
|
||||||
// check pointer to handle
|
// check pointer to handle
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (*pTimerHdl_p == 0)
|
if (*pTimerHdl_p == 0) { // no timer created yet
|
||||||
{ // no timer created yet
|
|
||||||
|
|
||||||
// search free timer info structure
|
// search free timer info structure
|
||||||
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
|
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[0];
|
||||||
for (uiIndex = 0; uiIndex < TIMER_COUNT; uiIndex++, pTimerInfo++)
|
for (uiIndex = 0; uiIndex < TIMER_COUNT;
|
||||||
{
|
uiIndex++, pTimerInfo++) {
|
||||||
if (pTimerInfo->m_EventArg.m_TimerHdl == 0)
|
if (pTimerInfo->m_EventArg.m_TimerHdl == 0) { // free structure found
|
||||||
{ // free structure found
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (uiIndex >= TIMER_COUNT) { // no free structure found
|
||||||
if (uiIndex >= TIMER_COUNT)
|
Ret = kEplTimerNoTimerCreated;
|
||||||
{ // no free structure found
|
goto Exit;
|
||||||
Ret = kEplTimerNoTimerCreated;
|
}
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
pTimerInfo->m_EventArg.m_TimerHdl = HDL_INIT(uiIndex);
|
pTimerInfo->m_EventArg.m_TimerHdl = HDL_INIT(uiIndex);
|
||||||
}
|
} else {
|
||||||
else
|
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
|
||||||
{
|
if (uiIndex >= TIMER_COUNT) { // invalid handle
|
||||||
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
|
Ret = kEplTimerInvalidHandle;
|
||||||
if (uiIndex >= TIMER_COUNT)
|
goto Exit;
|
||||||
{ // invalid handle
|
}
|
||||||
Ret = kEplTimerInvalidHandle;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* increment timer handle
|
* increment timer handle
|
||||||
* (if timer expires right after this statement, the user
|
* (if timer expires right after this statement, the user
|
||||||
* would detect an unknown timer handle and discard it)
|
* would detect an unknown timer handle and discard it)
|
||||||
*/
|
*/
|
||||||
pTimerInfo->m_EventArg.m_TimerHdl = HDL_INC(pTimerInfo->m_EventArg.m_TimerHdl);
|
pTimerInfo->m_EventArg.m_TimerHdl =
|
||||||
*pTimerHdl_p = pTimerInfo->m_EventArg.m_TimerHdl;
|
HDL_INC(pTimerInfo->m_EventArg.m_TimerHdl);
|
||||||
|
*pTimerHdl_p = pTimerInfo->m_EventArg.m_TimerHdl;
|
||||||
|
|
||||||
// reject too small time values
|
// reject too small time values
|
||||||
if ( (fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_CYCLE))
|
if ((fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_CYCLE))
|
||||||
|| (!fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_SINGLE)) )
|
|| (!fContinuously_p && (ullTimeNs_p < TIMER_MIN_VAL_SINGLE))) {
|
||||||
{
|
Ret = kEplTimerNoTimerCreated;
|
||||||
Ret = kEplTimerNoTimerCreated;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pTimerInfo->m_EventArg.m_ulArg = ulArgument_p;
|
pTimerInfo->m_EventArg.m_ulArg = ulArgument_p;
|
||||||
pTimerInfo->m_pfnCallback = pfnCallback_p;
|
pTimerInfo->m_pfnCallback = pfnCallback_p;
|
||||||
pTimerInfo->m_fContinuously = fContinuously_p;
|
pTimerInfo->m_fContinuously = fContinuously_p;
|
||||||
pTimerInfo->m_ullPeriod = ullTimeNs_p;
|
pTimerInfo->m_ullPeriod = ullTimeNs_p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HRTIMER_MODE_REL does not influence general handling of this timer.
|
* HRTIMER_MODE_REL does not influence general handling of this timer.
|
||||||
* It only sets relative mode for this start operation.
|
* It only sets relative mode for this start operation.
|
||||||
* -> Expire time is calculated by: Now + RelTime
|
* -> Expire time is calculated by: Now + RelTime
|
||||||
* hrtimer_start also skips pending timer events.
|
* hrtimer_start also skips pending timer events.
|
||||||
* The state HRTIMER_STATE_CALLBACK is ignored.
|
* The state HRTIMER_STATE_CALLBACK is ignored.
|
||||||
* We have to cope with that in our callback function.
|
* We have to cope with that in our callback function.
|
||||||
*/
|
*/
|
||||||
RelTime = ktime_add_ns(ktime_set(0,0), ullTimeNs_p);
|
RelTime = ktime_add_ns(ktime_set(0, 0), ullTimeNs_p);
|
||||||
hrtimer_start(&pTimerInfo->m_Timer, RelTime, HRTIMER_MODE_REL);
|
hrtimer_start(&pTimerInfo->m_Timer, RelTime, HRTIMER_MODE_REL);
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskDeleteTimer()
|
// Function: EplTimerHighReskDeleteTimer()
|
||||||
|
@ -418,64 +403,56 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
tEplKernel PUBLIC EplTimerHighReskDeleteTimer(tEplTimerHdl* pTimerHdl_p)
|
tEplKernel PUBLIC EplTimerHighReskDeleteTimer(tEplTimerHdl * pTimerHdl_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
tEplTimerHighReskTimerInfo* pTimerInfo;
|
tEplTimerHighReskTimerInfo *pTimerInfo;
|
||||||
|
|
||||||
// check pointer to handle
|
// check pointer to handle
|
||||||
if(pTimerHdl_p == NULL)
|
if (pTimerHdl_p == NULL) {
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
Ret = kEplTimerInvalidHandle;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (*pTimerHdl_p == 0)
|
if (*pTimerHdl_p == 0) { // no timer created yet
|
||||||
{ // no timer created yet
|
goto Exit;
|
||||||
goto Exit;
|
} else {
|
||||||
}
|
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
|
||||||
else
|
if (uiIndex >= TIMER_COUNT) { // invalid handle
|
||||||
{
|
Ret = kEplTimerInvalidHandle;
|
||||||
uiIndex = HDL_TO_IDX(*pTimerHdl_p);
|
goto Exit;
|
||||||
if (uiIndex >= TIMER_COUNT)
|
}
|
||||||
{ // invalid handle
|
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
||||||
Ret = kEplTimerInvalidHandle;
|
if (pTimerInfo->m_EventArg.m_TimerHdl != *pTimerHdl_p) { // invalid handle
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
pTimerInfo = &EplTimerHighReskInstance_l.m_aTimerInfo[uiIndex];
|
}
|
||||||
if (pTimerInfo->m_EventArg.m_TimerHdl != *pTimerHdl_p)
|
|
||||||
{ // invalid handle
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*pTimerHdl_p = 0;
|
*pTimerHdl_p = 0;
|
||||||
pTimerInfo->m_EventArg.m_TimerHdl = 0;
|
pTimerInfo->m_EventArg.m_TimerHdl = 0;
|
||||||
pTimerInfo->m_pfnCallback = NULL;
|
pTimerInfo->m_pfnCallback = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Three return cases of hrtimer_try_to_cancel have to be tracked:
|
* Three return cases of hrtimer_try_to_cancel have to be tracked:
|
||||||
* 1 - timer has been removed
|
* 1 - timer has been removed
|
||||||
* 0 - timer was not active
|
* 0 - timer was not active
|
||||||
* We need not do anything. hrtimer timers just consist of
|
* We need not do anything. hrtimer timers just consist of
|
||||||
* a hrtimer struct, which we might enqueue in the hrtimers
|
* a hrtimer struct, which we might enqueue in the hrtimers
|
||||||
* event list by calling hrtimer_start().
|
* event list by calling hrtimer_start().
|
||||||
* If a timer is not enqueued, it is not present in hrtimers.
|
* If a timer is not enqueued, it is not present in hrtimers.
|
||||||
* -1 - callback function is running
|
* -1 - callback function is running
|
||||||
* In this case we have to ensure that the timer is not
|
* In this case we have to ensure that the timer is not
|
||||||
* continuously restarted. This has been done by clearing
|
* continuously restarted. This has been done by clearing
|
||||||
* its handle.
|
* its handle.
|
||||||
*/
|
*/
|
||||||
hrtimer_try_to_cancel(&pTimerInfo->m_Timer);
|
hrtimer_try_to_cancel(&pTimerInfo->m_Timer);
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: EplTimerHighReskCallback()
|
// Function: EplTimerHighReskCallback()
|
||||||
|
@ -490,66 +467,63 @@ Exit:
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
enum hrtimer_restart EplTimerHighReskCallback (struct hrtimer* pTimer_p)
|
enum hrtimer_restart EplTimerHighReskCallback(struct hrtimer *pTimer_p)
|
||||||
{
|
{
|
||||||
unsigned int uiIndex;
|
unsigned int uiIndex;
|
||||||
tEplTimerHighReskTimerInfo* pTimerInfo;
|
tEplTimerHighReskTimerInfo *pTimerInfo;
|
||||||
tEplTimerHdl OrgTimerHdl;
|
tEplTimerHdl OrgTimerHdl;
|
||||||
enum hrtimer_restart Ret;
|
enum hrtimer_restart Ret;
|
||||||
|
|
||||||
BENCHMARK_MOD_24_SET(4);
|
BENCHMARK_MOD_24_SET(4);
|
||||||
|
|
||||||
Ret = HRTIMER_NORESTART;
|
Ret = HRTIMER_NORESTART;
|
||||||
pTimerInfo = container_of(pTimer_p, tEplTimerHighReskTimerInfo, m_Timer);
|
pTimerInfo =
|
||||||
uiIndex = HDL_TO_IDX(pTimerInfo->m_EventArg.m_TimerHdl);
|
container_of(pTimer_p, tEplTimerHighReskTimerInfo, m_Timer);
|
||||||
if (uiIndex >= TIMER_COUNT)
|
uiIndex = HDL_TO_IDX(pTimerInfo->m_EventArg.m_TimerHdl);
|
||||||
{ // invalid handle
|
if (uiIndex >= TIMER_COUNT) { // invalid handle
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We store the timer handle before calling the callback function
|
* We store the timer handle before calling the callback function
|
||||||
* as the timer can be modified inside it.
|
* as the timer can be modified inside it.
|
||||||
*/
|
*/
|
||||||
OrgTimerHdl = pTimerInfo->m_EventArg.m_TimerHdl;
|
OrgTimerHdl = pTimerInfo->m_EventArg.m_TimerHdl;
|
||||||
|
|
||||||
if (pTimerInfo->m_pfnCallback != NULL)
|
if (pTimerInfo->m_pfnCallback != NULL) {
|
||||||
{
|
pTimerInfo->m_pfnCallback(&pTimerInfo->m_EventArg);
|
||||||
pTimerInfo->m_pfnCallback(&pTimerInfo->m_EventArg);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pTimerInfo->m_fContinuously)
|
if (pTimerInfo->m_fContinuously) {
|
||||||
{
|
ktime_t Interval;
|
||||||
ktime_t Interval;
|
|
||||||
#ifdef PROVE_OVERRUN
|
#ifdef PROVE_OVERRUN
|
||||||
ktime_t Now;
|
ktime_t Now;
|
||||||
unsigned long Overruns;
|
unsigned long Overruns;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (OrgTimerHdl != pTimerInfo->m_EventArg.m_TimerHdl)
|
if (OrgTimerHdl != pTimerInfo->m_EventArg.m_TimerHdl) {
|
||||||
{
|
/* modified timer has already been restarted */
|
||||||
/* modified timer has already been restarted */
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PROVE_OVERRUN
|
#ifdef PROVE_OVERRUN
|
||||||
Now = ktime_get();
|
Now = ktime_get();
|
||||||
Interval = ktime_add_ns(ktime_set(0,0), pTimerInfo->m_ullPeriod);
|
Interval =
|
||||||
Overruns = hrtimer_forward(pTimer_p, Now, Interval);
|
ktime_add_ns(ktime_set(0, 0), pTimerInfo->m_ullPeriod);
|
||||||
if (Overruns > 1)
|
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);
|
printk
|
||||||
}
|
("EplTimerHighResk: Continuous timer (handle 0x%lX) had to skip %lu interval(s)!\n",
|
||||||
|
pTimerInfo->m_EventArg.m_TimerHdl, Overruns - 1);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
pTimer_p->expires = ktime_add_ns(pTimer_p->expires,
|
pTimer_p->expires = ktime_add_ns(pTimer_p->expires,
|
||||||
pTimerInfo->m_ullPeriod);
|
pTimerInfo->m_ullPeriod);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ret = HRTIMER_RESTART;
|
Ret = HRTIMER_RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
BENCHMARK_MOD_24_RESET(4);
|
BENCHMARK_MOD_24_RESET(4);
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
|
|
||||||
Build Environment:
|
Build Environment:
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
Revision History:
|
Revision History:
|
||||||
|
@ -75,7 +74,6 @@
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
@ -93,13 +91,12 @@
|
||||||
#include <linux/udp.h>
|
#include <linux/udp.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/skbuff.h> /* for struct sk_buff */
|
#include <linux/skbuff.h> /* for struct sk_buff */
|
||||||
|
|
||||||
#include "kernel/VirtualEthernet.h"
|
#include "kernel/VirtualEthernet.h"
|
||||||
#include "kernel/EplDllkCal.h"
|
#include "kernel/EplDllkCal.h"
|
||||||
#include "kernel/EplDllk.h"
|
#include "kernel/EplDllk.h"
|
||||||
|
|
||||||
|
|
||||||
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
|
#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -110,28 +107,24 @@
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// const defines
|
// const defines
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef EPL_VETH_TX_TIMEOUT
|
#ifndef EPL_VETH_TX_TIMEOUT
|
||||||
//#define EPL_VETH_TX_TIMEOUT (2*HZ)
|
//#define EPL_VETH_TX_TIMEOUT (2*HZ)
|
||||||
#define EPL_VETH_TX_TIMEOUT 0 // d.k.: we use no timeout
|
#define EPL_VETH_TX_TIMEOUT 0 // d.k.: we use no timeout
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local types
|
// local types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// modul globale vars
|
// modul globale vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static struct net_device * pVEthNetDevice_g = NULL;
|
static struct net_device *pVEthNetDevice_g = NULL;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// local function prototypes
|
||||||
|
@ -140,11 +133,10 @@ static struct net_device * pVEthNetDevice_g = NULL;
|
||||||
static int VEthOpen(struct net_device *pNetDevice_p);
|
static int VEthOpen(struct net_device *pNetDevice_p);
|
||||||
static int VEthClose(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 int VEthXmit(struct sk_buff *pSkb_p, struct net_device *pNetDevice_p);
|
||||||
static struct net_device_stats* VEthGetStats(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 void VEthTimeout(struct net_device *pNetDevice_p);
|
||||||
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p);
|
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p);
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -171,188 +163,182 @@ static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p);
|
||||||
|
|
||||||
static int VEthOpen(struct net_device *pNetDevice_p)
|
static int VEthOpen(struct net_device *pNetDevice_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
//open the device
|
//open the device
|
||||||
// struct net_device_stats* pStats = (struct net_device_stats*)pNetDevice_p->priv;
|
// struct net_device_stats* pStats = (struct net_device_stats*)pNetDevice_p->priv;
|
||||||
|
|
||||||
//start the interface queue for the network subsystem
|
//start the interface queue for the network subsystem
|
||||||
netif_start_queue(pNetDevice_p);
|
netif_start_queue(pNetDevice_p);
|
||||||
|
|
||||||
// register callback function in DLL
|
// register callback function in DLL
|
||||||
Ret = EplDllkRegAsyncHandler(VEthRecvFrame);
|
Ret = EplDllkRegAsyncHandler(VEthRecvFrame);
|
||||||
|
|
||||||
EPL_DBGLVL_VETH_TRACE1("VEthOpen: EplDllkRegAsyncHandler returned 0x%02X\n", Ret);
|
EPL_DBGLVL_VETH_TRACE1
|
||||||
|
("VEthOpen: EplDllkRegAsyncHandler returned 0x%02X\n", Ret);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int VEthClose(struct net_device *pNetDevice_p)
|
static int VEthClose(struct net_device *pNetDevice_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthClose\n");
|
EPL_DBGLVL_VETH_TRACE0("VEthClose\n");
|
||||||
|
|
||||||
Ret = EplDllkDeregAsyncHandler(VEthRecvFrame);
|
Ret = EplDllkDeregAsyncHandler(VEthRecvFrame);
|
||||||
|
|
||||||
//stop the interface queue for the network subsystem
|
//stop the interface queue for the network subsystem
|
||||||
netif_stop_queue(pNetDevice_p);
|
netif_stop_queue(pNetDevice_p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int VEthXmit(struct sk_buff *pSkb_p, struct net_device *pNetDevice_p)
|
static int VEthXmit(struct sk_buff *pSkb_p, struct net_device *pNetDevice_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
tEplFrameInfo FrameInfo;
|
tEplFrameInfo FrameInfo;
|
||||||
|
|
||||||
//transmit function
|
//transmit function
|
||||||
struct net_device_stats* pStats = (struct net_device_stats*)pNetDevice_p->priv;
|
struct net_device_stats *pStats =
|
||||||
|
(struct net_device_stats *)pNetDevice_p->priv;
|
||||||
|
|
||||||
//save timestemp
|
//save timestemp
|
||||||
pNetDevice_p->trans_start = jiffies;
|
pNetDevice_p->trans_start = jiffies;
|
||||||
|
|
||||||
FrameInfo.m_pFrame = (tEplFrame *)pSkb_p->data;
|
FrameInfo.m_pFrame = (tEplFrame *) pSkb_p->data;
|
||||||
FrameInfo.m_uiFrameSize = pSkb_p->len;
|
FrameInfo.m_uiFrameSize = pSkb_p->len;
|
||||||
|
|
||||||
//call send fkt on DLL
|
//call send fkt on DLL
|
||||||
Ret = EplDllkCalAsyncSend(&FrameInfo, kEplDllAsyncReqPrioGeneric);
|
Ret = EplDllkCalAsyncSend(&FrameInfo, kEplDllAsyncReqPrioGeneric);
|
||||||
if (Ret != kEplSuccessful)
|
if (Ret != kEplSuccessful) {
|
||||||
{
|
EPL_DBGLVL_VETH_TRACE1
|
||||||
EPL_DBGLVL_VETH_TRACE1("VEthXmit: EplDllkCalAsyncSend returned 0x%02X\n", Ret);
|
("VEthXmit: EplDllkCalAsyncSend returned 0x%02X\n", Ret);
|
||||||
netif_stop_queue(pNetDevice_p);
|
netif_stop_queue(pNetDevice_p);
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
} else {
|
||||||
else
|
EPL_DBGLVL_VETH_TRACE0("VEthXmit: frame passed to DLL\n");
|
||||||
{
|
dev_kfree_skb(pSkb_p);
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthXmit: frame passed to DLL\n");
|
|
||||||
dev_kfree_skb(pSkb_p);
|
|
||||||
|
|
||||||
//set stats for the device
|
//set stats for the device
|
||||||
pStats->tx_packets++;
|
pStats->tx_packets++;
|
||||||
pStats->tx_bytes += FrameInfo.m_uiFrameSize;
|
pStats->tx_bytes += FrameInfo.m_uiFrameSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct net_device_stats *VEthGetStats(struct net_device *pNetDevice_p)
|
||||||
static struct net_device_stats* VEthGetStats(struct net_device *pNetDevice_p)
|
|
||||||
{
|
{
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthGetStats\n");
|
EPL_DBGLVL_VETH_TRACE0("VEthGetStats\n");
|
||||||
|
|
||||||
return (struct net_device_stats *)pNetDevice_p->priv;
|
return (struct net_device_stats *)pNetDevice_p->priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void VEthTimeout(struct net_device *pNetDevice_p)
|
static void VEthTimeout(struct net_device *pNetDevice_p)
|
||||||
{
|
{
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthTimeout(\n");
|
EPL_DBGLVL_VETH_TRACE0("VEthTimeout(\n");
|
||||||
|
|
||||||
// $$$ d.k.: move to extra function, which is called by DLL when new space is available in TxFifo
|
// $$$ d.k.: move to extra function, which is called by DLL when new space is available in TxFifo
|
||||||
if (netif_queue_stopped (pNetDevice_p))
|
if (netif_queue_stopped(pNetDevice_p)) {
|
||||||
{
|
netif_wake_queue(pNetDevice_p);
|
||||||
netif_wake_queue (pNetDevice_p);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p)
|
static tEplKernel VEthRecvFrame(tEplFrameInfo * pFrameInfo_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
struct net_device* pNetDevice = pVEthNetDevice_g;
|
struct net_device *pNetDevice = pVEthNetDevice_g;
|
||||||
struct net_device_stats* pStats = (struct net_device_stats*)pNetDevice->priv;
|
struct net_device_stats *pStats =
|
||||||
struct sk_buff *pSkb;
|
(struct net_device_stats *)pNetDevice->priv;
|
||||||
|
struct sk_buff *pSkb;
|
||||||
|
|
||||||
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: FrameSize=%u\n", pFrameInfo_p->m_uiFrameSize);
|
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: FrameSize=%u\n",
|
||||||
|
pFrameInfo_p->m_uiFrameSize);
|
||||||
|
|
||||||
pSkb = dev_alloc_skb(pFrameInfo_p->m_uiFrameSize + 2);
|
pSkb = dev_alloc_skb(pFrameInfo_p->m_uiFrameSize + 2);
|
||||||
if (pSkb == NULL)
|
if (pSkb == NULL) {
|
||||||
{
|
pStats->rx_dropped++;
|
||||||
pStats->rx_dropped++;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
pSkb->dev = pNetDevice;
|
||||||
pSkb->dev = pNetDevice;
|
|
||||||
|
|
||||||
skb_reserve(pSkb, 2);
|
skb_reserve(pSkb, 2);
|
||||||
|
|
||||||
memcpy((void *)skb_put(pSkb, pFrameInfo_p->m_uiFrameSize), pFrameInfo_p->m_pFrame, pFrameInfo_p->m_uiFrameSize);
|
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->protocol = eth_type_trans(pSkb, pNetDevice);
|
||||||
pSkb->ip_summed = CHECKSUM_UNNECESSARY;
|
pSkb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
|
|
||||||
// call netif_rx with skb
|
// call netif_rx with skb
|
||||||
netif_rx(pSkb);
|
netif_rx(pSkb);
|
||||||
|
|
||||||
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: SrcMAC=0x%llx\n", AmiGetQword48FromBe(pFrameInfo_p->m_pFrame->m_be_abSrcMac));
|
EPL_DBGLVL_VETH_TRACE1("VEthRecvFrame: SrcMAC=0x%llx\n",
|
||||||
|
AmiGetQword48FromBe(pFrameInfo_p->m_pFrame->
|
||||||
|
m_be_abSrcMac));
|
||||||
|
|
||||||
// update receive statistics
|
// update receive statistics
|
||||||
pStats->rx_packets++;
|
pStats->rx_packets++;
|
||||||
pStats->rx_bytes += pFrameInfo_p->m_uiFrameSize;
|
pStats->rx_bytes += pFrameInfo_p->m_uiFrameSize;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tEplKernel PUBLIC VEthAddInstance(tEplDllkInitParam * pInitParam_p)
|
tEplKernel PUBLIC VEthAddInstance(tEplDllkInitParam * pInitParam_p)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
// allocate net device structure with priv pointing to stats structure
|
// 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_netdev(sizeof(struct net_device_stats), EPL_VETH_NAME,
|
||||||
|
ether_setup);
|
||||||
// pVEthNetDevice_g = alloc_etherdev(sizeof (struct net_device_stats));
|
// pVEthNetDevice_g = alloc_etherdev(sizeof (struct net_device_stats));
|
||||||
|
|
||||||
if (pVEthNetDevice_g == NULL)
|
if (pVEthNetDevice_g == NULL) {
|
||||||
{
|
Ret = kEplNoResource;
|
||||||
Ret = kEplNoResource;
|
goto Exit;
|
||||||
goto Exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pVEthNetDevice_g->open = VEthOpen;
|
pVEthNetDevice_g->open = VEthOpen;
|
||||||
pVEthNetDevice_g->stop = VEthClose;
|
pVEthNetDevice_g->stop = VEthClose;
|
||||||
pVEthNetDevice_g->get_stats = VEthGetStats;
|
pVEthNetDevice_g->get_stats = VEthGetStats;
|
||||||
pVEthNetDevice_g->hard_start_xmit = VEthXmit;
|
pVEthNetDevice_g->hard_start_xmit = VEthXmit;
|
||||||
pVEthNetDevice_g->tx_timeout = VEthTimeout;
|
pVEthNetDevice_g->tx_timeout = VEthTimeout;
|
||||||
pVEthNetDevice_g->watchdog_timeo = EPL_VETH_TX_TIMEOUT;
|
pVEthNetDevice_g->watchdog_timeo = EPL_VETH_TX_TIMEOUT;
|
||||||
pVEthNetDevice_g->destructor = free_netdev;
|
pVEthNetDevice_g->destructor = free_netdev;
|
||||||
|
|
||||||
// copy own MAC address to net device structure
|
// copy own MAC address to net device structure
|
||||||
memcpy(pVEthNetDevice_g->dev_addr, pInitParam_p->m_be_abSrcMac, 6);
|
memcpy(pVEthNetDevice_g->dev_addr, pInitParam_p->m_be_abSrcMac, 6);
|
||||||
|
|
||||||
//register VEth to the network subsystem
|
//register VEth to the network subsystem
|
||||||
if (register_netdev(pVEthNetDevice_g))
|
if (register_netdev(pVEthNetDevice_g)) {
|
||||||
{
|
EPL_DBGLVL_VETH_TRACE0
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthAddInstance: Could not register VEth...\n");
|
("VEthAddInstance: Could not register VEth...\n");
|
||||||
}
|
} else {
|
||||||
else
|
EPL_DBGLVL_VETH_TRACE0
|
||||||
{
|
("VEthAddInstance: Register VEth successfull...\n");
|
||||||
EPL_DBGLVL_VETH_TRACE0("VEthAddInstance: Register VEth successfull...\n");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tEplKernel PUBLIC VEthDelInstance(void)
|
tEplKernel PUBLIC VEthDelInstance(void)
|
||||||
{
|
{
|
||||||
tEplKernel Ret = kEplSuccessful;
|
tEplKernel Ret = kEplSuccessful;
|
||||||
|
|
||||||
if (pVEthNetDevice_g != NULL)
|
if (pVEthNetDevice_g != NULL) {
|
||||||
{
|
//unregister VEth from the network subsystem
|
||||||
//unregister VEth from the network subsystem
|
unregister_netdev(pVEthNetDevice_g);
|
||||||
unregister_netdev(pVEthNetDevice_g);
|
// destructor was set to free_netdev,
|
||||||
// destructor was set to free_netdev,
|
// so we do not need to call free_netdev here
|
||||||
// so we do not need to call free_netdev here
|
pVEthNetDevice_g = NULL;
|
||||||
pVEthNetDevice_g = NULL;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
|
#endif // (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_VETH)) != 0)
|
||||||
|
|
|
@ -80,25 +80,21 @@
|
||||||
// typedef
|
// typedef
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
WORD m_wWord;
|
||||||
WORD m_wWord;
|
|
||||||
|
|
||||||
} twStruct;
|
} twStruct;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
DWORD m_dwDword;
|
||||||
DWORD m_dwDword;
|
|
||||||
|
|
||||||
} tdwStruct;
|
} tdwStruct;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
QWORD m_qwQword;
|
||||||
QWORD m_qwQword;
|
|
||||||
|
|
||||||
} tqwStruct;
|
} tqwStruct;
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -131,46 +127,39 @@ void PUBLIC AmiSetByteToBe (void FAR* pAddr_p, BYTE bByteVal_p)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< write WORD in big endian >--------------------------
|
//------------< write WORD in big endian >--------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetWordToBe (void FAR* pAddr_p, WORD wWordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetWordToBe(void FAR * pAddr_p, WORD wWordVal_p)
|
||||||
{
|
{
|
||||||
twStruct FAR* pwStruct;
|
twStruct FAR *pwStruct;
|
||||||
twStruct wValue;
|
twStruct wValue;
|
||||||
|
|
||||||
wValue.m_wWord = (WORD)((wWordVal_p & 0x00FF) << 8); //LSB to MSB
|
wValue.m_wWord = (WORD) ((wWordVal_p & 0x00FF) << 8); //LSB to MSB
|
||||||
wValue.m_wWord |= (WORD)((wWordVal_p & 0xFF00) >> 8); //MSB to LSB
|
wValue.m_wWord |= (WORD) ((wWordVal_p & 0xFF00) >> 8); //MSB to LSB
|
||||||
|
|
||||||
pwStruct = (twStruct FAR*)pAddr_p;
|
pwStruct = (twStruct FAR *) pAddr_p;
|
||||||
pwStruct->m_wWord = wValue.m_wWord;
|
pwStruct->m_wWord = wValue.m_wWord;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< write DWORD in big endian >-------------------------
|
//------------< write DWORD in big endian >-------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetDwordToBe (void FAR* pAddr_p, DWORD dwDwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetDwordToBe(void FAR * pAddr_p,
|
||||||
|
DWORD dwDwordVal_p)
|
||||||
{
|
{
|
||||||
tdwStruct FAR* pdwStruct;
|
tdwStruct FAR *pdwStruct;
|
||||||
tdwStruct dwValue;
|
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
|
||||||
|
|
||||||
dwValue.m_dwDword = ((dwDwordVal_p & 0x000000FF)<<24); //LSB to MSB
|
pdwStruct = (tdwStruct FAR *) pAddr_p;
|
||||||
dwValue.m_dwDword|= ((dwDwordVal_p & 0x0000FF00)<<8);
|
pdwStruct->m_dwDword = dwValue.m_dwDword;
|
||||||
dwValue.m_dwDword|= ((dwDwordVal_p & 0x00FF0000)>>8 );
|
|
||||||
dwValue.m_dwDword|= ((dwDwordVal_p & 0xFF000000)>>24); //MSB to LSB
|
|
||||||
|
|
||||||
pdwStruct = (tdwStruct FAR*)pAddr_p;
|
|
||||||
pdwStruct->m_dwDword = dwValue.m_dwDword;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetXXXToLe()
|
// Function: AmiSetXXXToLe()
|
||||||
|
@ -197,35 +186,29 @@ void PUBLIC AmiSetByteToLe (void FAR* pAddr_p, BYTE bByteVal_p)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< write WORD in little endian >--------------------------
|
//------------< write WORD in little endian >--------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetWordToLe (void FAR* pAddr_p, WORD wWordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetWordToLe(void FAR * pAddr_p, WORD wWordVal_p)
|
||||||
{
|
{
|
||||||
twStruct FAR* pwStruct;
|
twStruct FAR *pwStruct;
|
||||||
|
|
||||||
pwStruct = (twStruct FAR*)pAddr_p;
|
pwStruct = (twStruct FAR *) pAddr_p;
|
||||||
pwStruct->m_wWord = wWordVal_p;
|
pwStruct->m_wWord = wWordVal_p;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< write DWORD in little endian >-------------------------
|
//------------< write DWORD in little endian >-------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetDwordToLe (void FAR* pAddr_p, DWORD dwDwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetDwordToLe(void FAR * pAddr_p,
|
||||||
|
DWORD dwDwordVal_p)
|
||||||
{
|
{
|
||||||
tdwStruct FAR* pdwStruct;
|
tdwStruct FAR *pdwStruct;
|
||||||
|
|
||||||
pdwStruct = (tdwStruct FAR*)pAddr_p;
|
pdwStruct = (tdwStruct FAR *) pAddr_p;
|
||||||
pdwStruct->m_dwDword = dwDwordVal_p;
|
pdwStruct->m_dwDword = dwDwordVal_p;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetXXXFromBe()
|
// Function: AmiGetXXXFromBe()
|
||||||
|
@ -251,46 +234,40 @@ BYTE PUBLIC AmiGetByteFromBe (void FAR* pAddr_p)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< read WORD in big endian >---------------------------
|
//------------< read WORD in big endian >---------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION WORD PUBLIC AmiGetWordFromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION WORD PUBLIC AmiGetWordFromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
twStruct FAR* pwStruct;
|
twStruct FAR *pwStruct;
|
||||||
twStruct wValue;
|
twStruct wValue;
|
||||||
|
|
||||||
pwStruct = (twStruct FAR*)pAddr_p;
|
pwStruct = (twStruct FAR *) pAddr_p;
|
||||||
|
|
||||||
wValue.m_wWord = (WORD)((pwStruct->m_wWord & 0x00FF) << 8); //LSB to MSB
|
wValue.m_wWord = (WORD) ((pwStruct->m_wWord & 0x00FF) << 8); //LSB to MSB
|
||||||
wValue.m_wWord |= (WORD)((pwStruct->m_wWord & 0xFF00) >> 8); //MSB to LSB
|
wValue.m_wWord |= (WORD) ((pwStruct->m_wWord & 0xFF00) >> 8); //MSB to LSB
|
||||||
|
|
||||||
return ( wValue.m_wWord );
|
return (wValue.m_wWord);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< read DWORD in big endian >--------------------------
|
//------------< read DWORD in big endian >--------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION DWORD PUBLIC AmiGetDwordFromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION DWORD PUBLIC AmiGetDwordFromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
tdwStruct FAR* pdwStruct;
|
tdwStruct FAR *pdwStruct;
|
||||||
tdwStruct dwValue;
|
tdwStruct dwValue;
|
||||||
|
|
||||||
pdwStruct = (tdwStruct FAR*)pAddr_p;
|
pdwStruct = (tdwStruct FAR *) pAddr_p;
|
||||||
|
|
||||||
dwValue.m_dwDword = ((pdwStruct->m_dwDword & 0x000000FF)<<24); //LSB to MSB
|
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 & 0x0000FF00) << 8);
|
||||||
dwValue.m_dwDword|= ((pdwStruct->m_dwDword & 0x00FF0000)>>8 );
|
dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0x00FF0000) >> 8);
|
||||||
dwValue.m_dwDword|= ((pdwStruct->m_dwDword & 0xFF000000)>>24); //MSB to LSB
|
dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0xFF000000) >> 24); //MSB to LSB
|
||||||
|
|
||||||
return ( dwValue.m_dwDword );
|
return (dwValue.m_dwDword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetXXXFromLe()
|
// Function: AmiGetXXXFromLe()
|
||||||
|
@ -316,34 +293,28 @@ BYTE PUBLIC AmiGetByteFromLe (void FAR* pAddr_p)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< read WORD in little endian >---------------------------
|
//------------< read WORD in little endian >---------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION WORD PUBLIC AmiGetWordFromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION WORD PUBLIC AmiGetWordFromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
twStruct FAR* pwStruct;
|
twStruct FAR *pwStruct;
|
||||||
|
|
||||||
pwStruct = (twStruct FAR*)pAddr_p;
|
pwStruct = (twStruct FAR *) pAddr_p;
|
||||||
return ( pwStruct->m_wWord );
|
return (pwStruct->m_wWord);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------< read DWORD in little endian >--------------------------
|
//------------< read DWORD in little endian >--------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION DWORD PUBLIC AmiGetDwordFromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION DWORD PUBLIC AmiGetDwordFromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
tdwStruct FAR* pdwStruct;
|
tdwStruct FAR *pdwStruct;
|
||||||
|
|
||||||
pdwStruct = (tdwStruct FAR*)pAddr_p;
|
pdwStruct = (tdwStruct FAR *) pAddr_p;
|
||||||
return ( pdwStruct->m_dwDword );
|
return (pdwStruct->m_dwDword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetDword24ToBe()
|
// Function: AmiSetDword24ToBe()
|
||||||
|
@ -359,16 +330,16 @@ tdwStruct FAR* pdwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetDword24ToBe (void FAR* pAddr_p, DWORD dwDwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetDword24ToBe(void FAR * pAddr_p,
|
||||||
|
DWORD dwDwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &dwDwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & dwDwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &dwDwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & dwDwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &dwDwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & dwDwordVal_p)[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetDword24ToLe()
|
// Function: AmiSetDword24ToLe()
|
||||||
|
@ -384,16 +355,16 @@ INLINE_FUNCTION void PUBLIC AmiSetDword24ToBe (void FAR* pAddr_p, DWORD dwDwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetDword24ToLe (void FAR* pAddr_p, DWORD dwDwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetDword24ToLe(void FAR * pAddr_p,
|
||||||
|
DWORD dwDwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &dwDwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & dwDwordVal_p)[0];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &dwDwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & dwDwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &dwDwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & dwDwordVal_p)[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetDword24FromBe()
|
// Function: AmiGetDword24FromBe()
|
||||||
|
@ -408,19 +379,18 @@ INLINE_FUNCTION void PUBLIC AmiSetDword24ToLe (void FAR* pAddr_p, DWORD dwDwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION DWORD PUBLIC AmiGetDword24FromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION DWORD PUBLIC AmiGetDword24FromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tdwStruct dwStruct;
|
tdwStruct dwStruct;
|
||||||
|
|
||||||
dwStruct.m_dwDword = AmiGetDwordFromBe (pAddr_p);
|
dwStruct.m_dwDword = AmiGetDwordFromBe(pAddr_p);
|
||||||
dwStruct.m_dwDword >>= 8;
|
dwStruct.m_dwDword >>= 8;
|
||||||
|
|
||||||
return ( dwStruct.m_dwDword );
|
return (dwStruct.m_dwDword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetDword24FromLe()
|
// Function: AmiGetDword24FromLe()
|
||||||
|
@ -435,19 +405,18 @@ tdwStruct dwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION DWORD PUBLIC AmiGetDword24FromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION DWORD PUBLIC AmiGetDword24FromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tdwStruct dwStruct;
|
tdwStruct dwStruct;
|
||||||
|
|
||||||
dwStruct.m_dwDword = AmiGetDwordFromLe (pAddr_p);
|
dwStruct.m_dwDword = AmiGetDwordFromLe(pAddr_p);
|
||||||
dwStruct.m_dwDword &= 0x00FFFFFF;
|
dwStruct.m_dwDword &= 0x00FFFFFF;
|
||||||
|
|
||||||
return ( dwStruct.m_dwDword );
|
return (dwStruct.m_dwDword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//#ifdef USE_VAR64
|
//#ifdef USE_VAR64
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -465,21 +434,21 @@ tdwStruct dwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword64ToBe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword64ToBe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &qwQwordVal_p)[7];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & qwQwordVal_p)[7];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &qwQwordVal_p)[6];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & qwQwordVal_p)[6];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &qwQwordVal_p)[5];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & qwQwordVal_p)[5];
|
||||||
((BYTE FAR*) pAddr_p)[3] = ((BYTE FAR*) &qwQwordVal_p)[4];
|
((BYTE FAR *) pAddr_p)[3] = ((BYTE FAR *) & qwQwordVal_p)[4];
|
||||||
((BYTE FAR*) pAddr_p)[4] = ((BYTE FAR*) &qwQwordVal_p)[3];
|
((BYTE FAR *) pAddr_p)[4] = ((BYTE FAR *) & qwQwordVal_p)[3];
|
||||||
((BYTE FAR*) pAddr_p)[5] = ((BYTE FAR*) &qwQwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[5] = ((BYTE FAR *) & qwQwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[6] = ((BYTE FAR*) &qwQwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[6] = ((BYTE FAR *) & qwQwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[7] = ((BYTE FAR*) &qwQwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[7] = ((BYTE FAR *) & qwQwordVal_p)[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword64ToLe()
|
// Function: AmiSetQword64ToLe()
|
||||||
|
@ -495,17 +464,17 @@ INLINE_FUNCTION void PUBLIC AmiSetQword64ToBe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword64ToLe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword64ToLe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
QWORD FAR* pqwDst;
|
QWORD FAR *pqwDst;
|
||||||
|
|
||||||
pqwDst = (QWORD FAR*) pAddr_p;
|
pqwDst = (QWORD FAR *) pAddr_p;
|
||||||
*pqwDst = qwQwordVal_p;
|
*pqwDst = qwQwordVal_p;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword64FromBe()
|
// Function: AmiGetQword64FromBe()
|
||||||
|
@ -520,25 +489,24 @@ QWORD FAR* pqwDst;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword64FromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword64FromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[0] = ((BYTE FAR*) pAddr_p)[7];
|
((BYTE FAR *) & qwStruct.m_qwQword)[0] = ((BYTE FAR *) pAddr_p)[7];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[1] = ((BYTE FAR*) pAddr_p)[6];
|
((BYTE FAR *) & qwStruct.m_qwQword)[1] = ((BYTE FAR *) pAddr_p)[6];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[2] = ((BYTE FAR*) pAddr_p)[5];
|
((BYTE FAR *) & qwStruct.m_qwQword)[2] = ((BYTE FAR *) pAddr_p)[5];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[3] = ((BYTE FAR*) pAddr_p)[4];
|
((BYTE FAR *) & qwStruct.m_qwQword)[3] = ((BYTE FAR *) pAddr_p)[4];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[4] = ((BYTE FAR*) pAddr_p)[3];
|
((BYTE FAR *) & qwStruct.m_qwQword)[4] = ((BYTE FAR *) pAddr_p)[3];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[5] = ((BYTE FAR*) pAddr_p)[2];
|
((BYTE FAR *) & qwStruct.m_qwQword)[5] = ((BYTE FAR *) pAddr_p)[2];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[6] = ((BYTE FAR*) pAddr_p)[1];
|
((BYTE FAR *) & qwStruct.m_qwQword)[6] = ((BYTE FAR *) pAddr_p)[1];
|
||||||
((BYTE FAR*) &qwStruct.m_qwQword)[7] = ((BYTE FAR*) pAddr_p)[0];
|
((BYTE FAR *) & qwStruct.m_qwQword)[7] = ((BYTE FAR *) pAddr_p)[0];
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword64FromLe()
|
// Function: AmiGetQword64FromLe()
|
||||||
|
@ -553,20 +521,19 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword64FromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword64FromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct FAR* pqwStruct;
|
tqwStruct FAR *pqwStruct;
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
pqwStruct = (tqwStruct FAR*) pAddr_p;
|
pqwStruct = (tqwStruct FAR *) pAddr_p;
|
||||||
qwStruct.m_qwQword = pqwStruct->m_qwQword;
|
qwStruct.m_qwQword = pqwStruct->m_qwQword;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword40ToBe()
|
// Function: AmiSetQword40ToBe()
|
||||||
|
@ -582,18 +549,18 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword40ToBe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword40ToBe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &qwQwordVal_p)[4];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & qwQwordVal_p)[4];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &qwQwordVal_p)[3];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & qwQwordVal_p)[3];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &qwQwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & qwQwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[3] = ((BYTE FAR*) &qwQwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[3] = ((BYTE FAR *) & qwQwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[4] = ((BYTE FAR*) &qwQwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[4] = ((BYTE FAR *) & qwQwordVal_p)[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword40ToLe()
|
// Function: AmiSetQword40ToLe()
|
||||||
|
@ -609,15 +576,15 @@ INLINE_FUNCTION void PUBLIC AmiSetQword40ToBe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword40ToLe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword40ToLe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((DWORD FAR*) pAddr_p)[0] = ((DWORD FAR*) &qwQwordVal_p)[0];
|
((DWORD FAR *) pAddr_p)[0] = ((DWORD FAR *) & qwQwordVal_p)[0];
|
||||||
((BYTE FAR*) pAddr_p)[4] = ((BYTE FAR*) &qwQwordVal_p)[4];
|
((BYTE FAR *) pAddr_p)[4] = ((BYTE FAR *) & qwQwordVal_p)[4];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword40FromBe()
|
// Function: AmiGetQword40FromBe()
|
||||||
|
@ -632,19 +599,18 @@ INLINE_FUNCTION void PUBLIC AmiSetQword40ToLe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword40FromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword40FromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromBe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
|
||||||
qwStruct.m_qwQword >>= 24;
|
qwStruct.m_qwQword >>= 24;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword40FromLe()
|
// Function: AmiGetQword40FromLe()
|
||||||
|
@ -659,19 +625,18 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword40FromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword40FromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromLe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
|
||||||
qwStruct.m_qwQword &= 0x000000FFFFFFFFFFLL;
|
qwStruct.m_qwQword &= 0x000000FFFFFFFFFFLL;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword48ToBe()
|
// Function: AmiSetQword48ToBe()
|
||||||
|
@ -687,19 +652,19 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword48ToBe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword48ToBe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &qwQwordVal_p)[5];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & qwQwordVal_p)[5];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &qwQwordVal_p)[4];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & qwQwordVal_p)[4];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &qwQwordVal_p)[3];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & qwQwordVal_p)[3];
|
||||||
((BYTE FAR*) pAddr_p)[3] = ((BYTE FAR*) &qwQwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[3] = ((BYTE FAR *) & qwQwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[4] = ((BYTE FAR*) &qwQwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[4] = ((BYTE FAR *) & qwQwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[5] = ((BYTE FAR*) &qwQwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[5] = ((BYTE FAR *) & qwQwordVal_p)[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword48ToLe()
|
// Function: AmiSetQword48ToLe()
|
||||||
|
@ -715,15 +680,15 @@ INLINE_FUNCTION void PUBLIC AmiSetQword48ToBe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword48ToLe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword48ToLe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((DWORD FAR*) pAddr_p)[0] = ((DWORD FAR*) &qwQwordVal_p)[0];
|
((DWORD FAR *) pAddr_p)[0] = ((DWORD FAR *) & qwQwordVal_p)[0];
|
||||||
((WORD FAR*) pAddr_p)[2] = ((WORD FAR*) &qwQwordVal_p)[2];
|
((WORD FAR *) pAddr_p)[2] = ((WORD FAR *) & qwQwordVal_p)[2];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword48FromBe()
|
// Function: AmiGetQword48FromBe()
|
||||||
|
@ -738,19 +703,18 @@ INLINE_FUNCTION void PUBLIC AmiSetQword48ToLe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword48FromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword48FromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromBe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
|
||||||
qwStruct.m_qwQword >>= 16;
|
qwStruct.m_qwQword >>= 16;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword48FromLe()
|
// Function: AmiGetQword48FromLe()
|
||||||
|
@ -765,19 +729,18 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword48FromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword48FromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromLe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
|
||||||
qwStruct.m_qwQword &= 0x0000FFFFFFFFFFFFLL;
|
qwStruct.m_qwQword &= 0x0000FFFFFFFFFFFFLL;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword56ToBe()
|
// Function: AmiSetQword56ToBe()
|
||||||
|
@ -793,20 +756,20 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword56ToBe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword56ToBe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((BYTE FAR*) pAddr_p)[0] = ((BYTE FAR*) &qwQwordVal_p)[6];
|
((BYTE FAR *) pAddr_p)[0] = ((BYTE FAR *) & qwQwordVal_p)[6];
|
||||||
((BYTE FAR*) pAddr_p)[1] = ((BYTE FAR*) &qwQwordVal_p)[5];
|
((BYTE FAR *) pAddr_p)[1] = ((BYTE FAR *) & qwQwordVal_p)[5];
|
||||||
((BYTE FAR*) pAddr_p)[2] = ((BYTE FAR*) &qwQwordVal_p)[4];
|
((BYTE FAR *) pAddr_p)[2] = ((BYTE FAR *) & qwQwordVal_p)[4];
|
||||||
((BYTE FAR*) pAddr_p)[3] = ((BYTE FAR*) &qwQwordVal_p)[3];
|
((BYTE FAR *) pAddr_p)[3] = ((BYTE FAR *) & qwQwordVal_p)[3];
|
||||||
((BYTE FAR*) pAddr_p)[4] = ((BYTE FAR*) &qwQwordVal_p)[2];
|
((BYTE FAR *) pAddr_p)[4] = ((BYTE FAR *) & qwQwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[5] = ((BYTE FAR*) &qwQwordVal_p)[1];
|
((BYTE FAR *) pAddr_p)[5] = ((BYTE FAR *) & qwQwordVal_p)[1];
|
||||||
((BYTE FAR*) pAddr_p)[6] = ((BYTE FAR*) &qwQwordVal_p)[0];
|
((BYTE FAR *) pAddr_p)[6] = ((BYTE FAR *) & qwQwordVal_p)[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetQword56ToLe()
|
// Function: AmiSetQword56ToLe()
|
||||||
|
@ -822,16 +785,16 @@ INLINE_FUNCTION void PUBLIC AmiSetQword56ToBe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetQword56ToLe (void FAR* pAddr_p, QWORD qwQwordVal_p)
|
INLINE_FUNCTION void PUBLIC AmiSetQword56ToLe(void FAR * pAddr_p,
|
||||||
|
QWORD qwQwordVal_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
((DWORD FAR*) pAddr_p)[0] = ((DWORD FAR*) &qwQwordVal_p)[0];
|
((DWORD FAR *) pAddr_p)[0] = ((DWORD FAR *) & qwQwordVal_p)[0];
|
||||||
((WORD FAR*) pAddr_p)[2] = ((WORD FAR*) &qwQwordVal_p)[2];
|
((WORD FAR *) pAddr_p)[2] = ((WORD FAR *) & qwQwordVal_p)[2];
|
||||||
((BYTE FAR*) pAddr_p)[6] = ((BYTE FAR*) &qwQwordVal_p)[6];
|
((BYTE FAR *) pAddr_p)[6] = ((BYTE FAR *) & qwQwordVal_p)[6];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword56FromBe()
|
// Function: AmiGetQword56FromBe()
|
||||||
|
@ -846,19 +809,18 @@ INLINE_FUNCTION void PUBLIC AmiSetQword56ToLe (void FAR* pAddr_p, QWORD qwQwordV
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword56FromBe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword56FromBe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromBe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
|
||||||
qwStruct.m_qwQword >>= 8;
|
qwStruct.m_qwQword >>= 8;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetQword56FromLe()
|
// Function: AmiGetQword56FromLe()
|
||||||
|
@ -873,19 +835,18 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION QWORD PUBLIC AmiGetQword56FromLe (void FAR* pAddr_p)
|
INLINE_FUNCTION QWORD PUBLIC AmiGetQword56FromLe(void FAR * pAddr_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
tqwStruct qwStruct;
|
tqwStruct qwStruct;
|
||||||
|
|
||||||
qwStruct.m_qwQword = AmiGetQword64FromLe (pAddr_p);
|
qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
|
||||||
qwStruct.m_qwQword &= 0x00FFFFFFFFFFFFFFLL;
|
qwStruct.m_qwQword &= 0x00FFFFFFFFFFFFFFLL;
|
||||||
|
|
||||||
return ( qwStruct.m_qwQword );
|
return (qwStruct.m_qwQword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiSetTimeOfDay()
|
// Function: AmiSetTimeOfDay()
|
||||||
|
@ -901,15 +862,16 @@ tqwStruct qwStruct;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiSetTimeOfDay (void FAR* pAddr_p, tTimeOfDay FAR* pTimeOfDay_p)
|
INLINE_FUNCTION void PUBLIC AmiSetTimeOfDay(void FAR * pAddr_p,
|
||||||
|
tTimeOfDay FAR * pTimeOfDay_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
AmiSetDwordToLe (((BYTE FAR*) pAddr_p), pTimeOfDay_p->m_dwMs & 0x0FFFFFFF);
|
AmiSetDwordToLe(((BYTE FAR *) pAddr_p),
|
||||||
AmiSetWordToLe (((BYTE FAR*) pAddr_p) + 4, pTimeOfDay_p->m_wDays);
|
pTimeOfDay_p->m_dwMs & 0x0FFFFFFF);
|
||||||
|
AmiSetWordToLe(((BYTE FAR *) pAddr_p) + 4, pTimeOfDay_p->m_wDays);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Function: AmiGetTimeOfDay()
|
// Function: AmiGetTimeOfDay()
|
||||||
|
@ -925,21 +887,19 @@ INLINE_FUNCTION void PUBLIC AmiSetTimeOfDay (void FAR* pAddr_p, tTimeOfDay FAR*
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
INLINE_FUNCTION void PUBLIC AmiGetTimeOfDay (void FAR* pAddr_p, tTimeOfDay FAR* pTimeOfDay_p)
|
INLINE_FUNCTION void PUBLIC AmiGetTimeOfDay(void FAR * pAddr_p,
|
||||||
|
tTimeOfDay FAR * pTimeOfDay_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
pTimeOfDay_p->m_dwMs = AmiGetDwordFromLe (((BYTE FAR*) pAddr_p)) & 0x0FFFFFFF;
|
pTimeOfDay_p->m_dwMs =
|
||||||
pTimeOfDay_p->m_wDays = AmiGetWordFromLe (((BYTE FAR*) pAddr_p) + 4);
|
AmiGetDwordFromLe(((BYTE FAR *) pAddr_p)) & 0x0FFFFFFF;
|
||||||
|
pTimeOfDay_p->m_wDays = AmiGetWordFromLe(((BYTE FAR *) pAddr_p) + 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
||||||
// Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
|
// 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).
|
// 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
|
@ -91,11 +91,10 @@
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
#ifdef CONFIG_COLDFIRE
|
#ifdef CONFIG_COLDFIRE
|
||||||
#include <asm/coldfire.h>
|
#include <asm/coldfire.h>
|
||||||
#include "fec.h"
|
#include "fec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
|
@ -113,45 +112,44 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DBG_TRACE_POINTS
|
#ifndef DBG_TRACE_POINTS
|
||||||
#define DBG_TRACE_POINTS 23 // # of supported debug trace points
|
#define DBG_TRACE_POINTS 23 // # of supported debug trace points
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DBG_TRACE_VALUES
|
#ifndef DBG_TRACE_VALUES
|
||||||
#define DBG_TRACE_VALUES 24 // # of supported debug trace values (size of circular buffer)
|
#define DBG_TRACE_VALUES 24 // # of supported debug trace values (size of circular buffer)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// modul global types
|
// modul global types
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local vars
|
// local vars
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
atomic_t aatmDbgTracePoint_l[DBG_TRACE_POINTS];
|
atomic_t aatmDbgTracePoint_l[DBG_TRACE_POINTS];
|
||||||
DWORD adwDbgTraceValue_l[DBG_TRACE_VALUES];
|
DWORD adwDbgTraceValue_l[DBG_TRACE_VALUES];
|
||||||
DWORD dwDbgTraceValueOld_l;
|
DWORD dwDbgTraceValueOld_l;
|
||||||
unsigned int uiDbgTraceValuePos_l;
|
unsigned int uiDbgTraceValuePos_l;
|
||||||
spinlock_t spinlockDbgTraceValue_l;
|
spinlock_t spinlockDbgTraceValue_l;
|
||||||
unsigned long ulDbTraceValueFlags_l;
|
unsigned long ulDbTraceValueFlags_l;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// local function prototypes
|
// 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 EplLinProcRead(char *pcBuffer_p, char **ppcStart_p, off_t Offset_p,
|
||||||
static int EplLinProcWrite(struct file *file, const char __user *buffer, unsigned long count, void *data);
|
int nBufferSize_p, int *pEof_p, void *pData_p);
|
||||||
|
static int EplLinProcWrite(struct file *file, const char __user * buffer,
|
||||||
void PUBLIC TgtDbgSignalTracePoint (BYTE bTracePointNumber_p);
|
unsigned long count, void *data);
|
||||||
void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p);
|
|
||||||
|
|
||||||
|
void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p);
|
||||||
|
void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p);
|
||||||
|
|
||||||
EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void);
|
EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void);
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================//
|
//=========================================================================//
|
||||||
// //
|
// //
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -160,35 +158,32 @@ EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void);
|
||||||
|
|
||||||
tEplKernel EplLinProcInit(void)
|
tEplKernel EplLinProcInit(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry* pProcDirEntry;
|
struct proc_dir_entry *pProcDirEntry;
|
||||||
pProcDirEntry = create_proc_entry (EPL_PROC_DEV_NAME, S_IRUGO, NULL);
|
pProcDirEntry = create_proc_entry(EPL_PROC_DEV_NAME, S_IRUGO, NULL);
|
||||||
if (pProcDirEntry != NULL)
|
if (pProcDirEntry != NULL) {
|
||||||
{
|
pProcDirEntry->read_proc = EplLinProcRead;
|
||||||
pProcDirEntry->read_proc = EplLinProcRead;
|
pProcDirEntry->write_proc = EplLinProcWrite;
|
||||||
pProcDirEntry->write_proc = EplLinProcWrite;
|
pProcDirEntry->data = NULL; // device number or something else
|
||||||
pProcDirEntry->data = NULL; // device number or something else
|
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
return kEplNoResource;
|
||||||
{
|
}
|
||||||
return kEplNoResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
// initialize spinlock and circular buffer position
|
// initialize spinlock and circular buffer position
|
||||||
spin_lock_init(&spinlockDbgTraceValue_l);
|
spin_lock_init(&spinlockDbgTraceValue_l);
|
||||||
uiDbgTraceValuePos_l = 0;
|
uiDbgTraceValuePos_l = 0;
|
||||||
dwDbgTraceValueOld_l = 0;
|
dwDbgTraceValueOld_l = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
tEplKernel EplLinProcFree(void)
|
tEplKernel EplLinProcFree(void)
|
||||||
{
|
{
|
||||||
remove_proc_entry (EPL_PROC_DEV_NAME, NULL);
|
remove_proc_entry(EPL_PROC_DEV_NAME, NULL);
|
||||||
|
|
||||||
return kEplSuccessful;
|
return kEplSuccessful;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -196,225 +191,219 @@ tEplKernel EplLinProcFree(void)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
void PUBLIC TgtDbgSignalTracePoint (
|
void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p)
|
||||||
BYTE bTracePointNumber_p)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (bTracePointNumber_p >= (sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0])))
|
if (bTracePointNumber_p >=
|
||||||
{
|
(sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0]))) {
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atomic_inc(&aatmDbgTracePoint_l[bTracePointNumber_p]);
|
||||||
|
|
||||||
atomic_inc (&aatmDbgTracePoint_l[bTracePointNumber_p]);
|
Exit:
|
||||||
|
|
||||||
Exit:
|
return;
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p)
|
void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p)
|
||||||
{
|
{
|
||||||
|
|
||||||
spin_lock_irqsave(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
|
spin_lock_irqsave(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
|
||||||
if (dwDbgTraceValueOld_l != dwTraceValue_p)
|
if (dwDbgTraceValueOld_l != dwTraceValue_p) {
|
||||||
{
|
adwDbgTraceValue_l[uiDbgTraceValuePos_l] = dwTraceValue_p;
|
||||||
adwDbgTraceValue_l[uiDbgTraceValuePos_l] = dwTraceValue_p;
|
uiDbgTraceValuePos_l =
|
||||||
uiDbgTraceValuePos_l = (uiDbgTraceValuePos_l + 1) % DBG_TRACE_VALUES;
|
(uiDbgTraceValuePos_l + 1) % DBG_TRACE_VALUES;
|
||||||
dwDbgTraceValueOld_l = dwTraceValue_p;
|
dwDbgTraceValueOld_l = dwTraceValue_p;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
|
spin_unlock_irqrestore(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Read function for PROC-FS read access
|
// Read function for PROC-FS read access
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static int EplLinProcRead (
|
static int EplLinProcRead(char *pcBuffer_p,
|
||||||
char* pcBuffer_p,
|
char **ppcStart_p,
|
||||||
char** ppcStart_p,
|
off_t Offset_p,
|
||||||
off_t Offset_p,
|
int nBufferSize_p, int *pEof_p, void *pData_p)
|
||||||
int nBufferSize_p,
|
|
||||||
int* pEof_p,
|
|
||||||
void* pData_p)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int nSize;
|
int nSize;
|
||||||
int Eof;
|
int Eof;
|
||||||
tEplDllkCalStatistics* pDllkCalStats;
|
tEplDllkCalStatistics *pDllkCalStats;
|
||||||
|
|
||||||
nSize = 0;
|
nSize = 0;
|
||||||
Eof = 0;
|
Eof = 0;
|
||||||
|
|
||||||
// count calls of this function
|
// count calls of this function
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
TgtDbgSignalTracePoint(0);
|
TgtDbgSignalTracePoint(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// generate static information
|
// generate static information
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
// ---- Driver information ----
|
// ---- Driver information ----
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
"%s %s (c) 2006 %s\n",
|
"%s %s (c) 2006 %s\n",
|
||||||
EPL_PRODUCT_NAME, EPL_PRODUCT_VERSION, EPL_PRODUCT_MANUFACTURER);
|
EPL_PRODUCT_NAME, EPL_PRODUCT_VERSION,
|
||||||
|
EPL_PRODUCT_MANUFACTURER);
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// generate process information
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
// ---- EPL state ----
|
||||||
// generate process information
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
//---------------------------------------------------------------
|
"NMT state: 0x%04X\n",
|
||||||
|
(WORD) EplNmtkGetNmtState());
|
||||||
|
|
||||||
// ---- EPL state ----
|
EplDllkCalGetStatistics(&pDllkCalStats);
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
|
||||||
"NMT state: 0x%04X\n",
|
|
||||||
(WORD) EplNmtkGetNmtState());
|
|
||||||
|
|
||||||
EplDllkCalGetStatistics(&pDllkCalStats);
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
|
"CurAsyncTxGen=%lu CurAsyncTxNmt=%lu CurAsyncRx=%lu\nMaxAsyncTxGen=%lu MaxAsyncTxNmt=%lu MaxAsyncRx=%lu\n",
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
pDllkCalStats->m_ulCurTxFrameCountGen,
|
||||||
"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);
|
pDllkCalStats->m_ulCurTxFrameCountNmt,
|
||||||
|
pDllkCalStats->m_ulCurRxFrameCount,
|
||||||
|
pDllkCalStats->m_ulMaxTxFrameCountGen,
|
||||||
|
pDllkCalStats->m_ulMaxTxFrameCountNmt,
|
||||||
|
pDllkCalStats->m_ulMaxRxFrameCount);
|
||||||
|
|
||||||
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
#if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0)
|
||||||
// fetch running IdentRequests
|
// fetch running IdentRequests
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
"running IdentRequests: 0x%08lX\n",
|
"running IdentRequests: 0x%08lX\n",
|
||||||
EplIdentuGetRunningRequests());
|
EplIdentuGetRunningRequests());
|
||||||
|
|
||||||
// fetch state of NmtMnu module
|
// fetch state of NmtMnu module
|
||||||
{
|
{
|
||||||
unsigned int uiMandatorySlaveCount;
|
unsigned int uiMandatorySlaveCount;
|
||||||
unsigned int uiSignalSlaveCount;
|
unsigned int uiSignalSlaveCount;
|
||||||
WORD wFlags;
|
WORD wFlags;
|
||||||
|
|
||||||
EplNmtMnuGetDiagnosticInfo(&uiMandatorySlaveCount,
|
EplNmtMnuGetDiagnosticInfo(&uiMandatorySlaveCount,
|
||||||
&uiSignalSlaveCount,
|
&uiSignalSlaveCount, &wFlags);
|
||||||
&wFlags);
|
|
||||||
|
|
||||||
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
|
"MN MandSlaveCount: %u SigSlaveCount: %u Flags: 0x%X\n",
|
||||||
|
uiMandatorySlaveCount, uiSignalSlaveCount,
|
||||||
|
wFlags);
|
||||||
|
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
}
|
||||||
"MN MandSlaveCount: %u SigSlaveCount: %u Flags: 0x%X\n",
|
|
||||||
uiMandatorySlaveCount, uiSignalSlaveCount, wFlags);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ---- FEC state ----
|
// ---- FEC state ----
|
||||||
#ifdef CONFIG_COLDFIRE
|
#ifdef CONFIG_COLDFIRE
|
||||||
{
|
{
|
||||||
// Receive the base address
|
// Receive the base address
|
||||||
unsigned long base_addr;
|
unsigned long base_addr;
|
||||||
#if (EDRV_USED_ETH_CTRL == 0)
|
#if (EDRV_USED_ETH_CTRL == 0)
|
||||||
// Set the base address of FEC0
|
// Set the base address of FEC0
|
||||||
base_addr = FEC_BASE_ADDR_FEC0;
|
base_addr = FEC_BASE_ADDR_FEC0;
|
||||||
#else
|
#else
|
||||||
// Set the base address of FEC1
|
// Set the base address of FEC1
|
||||||
base_addr = FEC_BASE_ADDR_FEC1;
|
base_addr = FEC_BASE_ADDR_FEC1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
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 = 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));
|
FEC_ECR(base_addr), FEC_EIR(base_addr),
|
||||||
}
|
FEC_EIMR(base_addr), FEC_TCR(base_addr),
|
||||||
#endif
|
FEC_FECTFSR(base_addr),
|
||||||
|
FEC_FECRFSR(base_addr));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---- DBG: TracePoints ----
|
||||||
|
#ifdef _DBG_TRACE_POINTS_
|
||||||
|
{
|
||||||
|
int nNum;
|
||||||
|
|
||||||
// ---- DBG: TracePoints ----
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
#ifdef _DBG_TRACE_POINTS_
|
"DbgTracePoints:\n");
|
||||||
{
|
for (nNum = 0;
|
||||||
int nNum;
|
nNum < (sizeof(aatmDbgTracePoint_l) / sizeof(atomic_t));
|
||||||
|
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,
|
nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize,
|
||||||
"DbgTracePoints:\n");
|
"DbgTraceValues:\n");
|
||||||
for (nNum=0; nNum<(sizeof(aatmDbgTracePoint_l)/sizeof(atomic_t)); nNum++)
|
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,
|
nSize +=
|
||||||
" TracePoint[%2d]: %d\n", (int)nNum,
|
snprintf(pcBuffer_p + nSize,
|
||||||
atomic_read(&aatmDbgTracePoint_l[nNum]));
|
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
|
||||||
|
|
||||||
nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize,
|
Eof = 1;
|
||||||
"DbgTraceValues:\n");
|
goto Exit;
|
||||||
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
|
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
|
||||||
Eof = 1;
|
*pEof_p = Eof;
|
||||||
goto Exit;
|
|
||||||
|
|
||||||
|
return (nSize);
|
||||||
Exit:
|
|
||||||
|
|
||||||
*pEof_p = Eof;
|
|
||||||
|
|
||||||
return (nSize);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Write function for PROC-FS write access
|
// Write function for PROC-FS write access
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static int EplLinProcWrite(struct file *file, const char __user *buffer, unsigned long count, void *data)
|
static int EplLinProcWrite(struct file *file, const char __user * buffer,
|
||||||
|
unsigned long count, void *data)
|
||||||
{
|
{
|
||||||
char abBuffer[count + 1];
|
char abBuffer[count + 1];
|
||||||
int iErr;
|
int iErr;
|
||||||
int iVal = 0;
|
int iVal = 0;
|
||||||
tEplNmtEvent NmtEvent;
|
tEplNmtEvent NmtEvent;
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0) {
|
||||||
{
|
iErr = copy_from_user(abBuffer, buffer, count);
|
||||||
iErr = copy_from_user(abBuffer, buffer, count);
|
if (iErr != 0) {
|
||||||
if (iErr != 0)
|
return count;
|
||||||
{
|
}
|
||||||
return count;
|
abBuffer[count] = '\0';
|
||||||
}
|
|
||||||
abBuffer[count] = '\0';
|
|
||||||
|
|
||||||
iErr = sscanf(abBuffer, "%i", &iVal);
|
iErr = sscanf(abBuffer, "%i", &iVal);
|
||||||
}
|
}
|
||||||
if ((iVal <= 0) || (iVal > 0x2F))
|
if ((iVal <= 0) || (iVal > 0x2F)) {
|
||||||
{
|
NmtEvent = kEplNmtEventSwReset;
|
||||||
NmtEvent = kEplNmtEventSwReset;
|
} else {
|
||||||
}
|
NmtEvent = (tEplNmtEvent) iVal;
|
||||||
else
|
}
|
||||||
{
|
// execute specified NMT command on write access of /proc/epl
|
||||||
NmtEvent = (tEplNmtEvent) iVal;
|
EplNmtuNmtEvent(NmtEvent);
|
||||||
}
|
|
||||||
// execute specified NMT command on write access of /proc/epl
|
|
||||||
EplNmtuNmtEvent(NmtEvent);
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue