Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141713
b: refs/heads/master
c: 54e49dd
h: refs/heads/master
i:
  141711: a9b5ff0
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Apr 3, 2009
1 parent e419cfc commit 77d49b2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 248 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d10f46992fb59de804550999806e1e0c0aa335a8
refs/heads/master: 54e49dddd0983a1f4612e1843a2b193940a4e985
5 changes: 1 addition & 4 deletions trunk/drivers/staging/epl/Benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@

#include "global.h"

#if (TARGET_SYSTEM == _NO_OS_) && (DEV_SYSTEM == _DEV_GNU_CF548X_)
#include "common.h"

#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)

// #include <linux/config.h>
#include <linux/kernel.h>
Expand Down
21 changes: 0 additions & 21 deletions trunk/drivers/staging/epl/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,6 @@
#endif

//---------------------------------------------------------------------------
#if (DEV_SYSTEM == _DEV_WIN32_) && defined (TRACE_MSG)

// For WIN32 the macro DEBUG_TRACE0 can be defined as function call TraceLvl()
// or as macro TRACE().
//
// Here the parameter 'lvl' can be used with more than one
// debug-level (using OR).
//
// Example: DEBUG_TRACE1(DEBUG_LVL_30 | DEBUG_LVL_02, "Hello %d", bCount);

#define DEBUG_TRACE0(lvl,str) TraceLvl((lvl),str)
#define DEBUG_TRACE1(lvl,str,p1) TraceLvl((lvl),str,p1)
#define DEBUG_TRACE2(lvl,str,p1,p2) TraceLvl((lvl),str,p1,p2)
#define DEBUG_TRACE3(lvl,str,p1,p2,p3) TraceLvl((lvl),str,p1,p2,p3)
#define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) TraceLvl((lvl),str,p1,p2,p3,p4)
#define DEBUG_GLB_LVL() dwDebugLevel_g

#else

// At microcontrollers we do reduce the memory usage by deleting DEBUG_TRACE-lines
// (compiler does delete the lines).
//
Expand Down Expand Up @@ -643,8 +624,6 @@
#define DEBUG_TRACE3(lvl,str,p1,p2,p3) lvl##_TRACE3(str,p1,p2,p3)
#define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) lvl##_TRACE4(str,p1,p2,p3,p4)

#endif

//---------------------------------------------------------------------------
// The macro DEBUG_DUMP_DATA() can be used with the same debug-levels to dump
// out data bytes. Function DumpData() has to be included.
Expand Down
11 changes: 1 addition & 10 deletions trunk/drivers/staging/epl/EplAmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,7 @@
extern "C" {
#endif

#if (TARGET_SYSTEM == _WIN32_)
#if defined(INLINE_FUNCTION_DEF)
#undef INLINE_FUNCTION
#define INLINE_FUNCTION INLINE_FUNCTION_DEF
#define INLINE_ENABLED TRUE
#define EPL_AMI_INLINED
#include "../EplStack/amix86.c"
#endif

#elif (TARGET_SYSTEM == _LINUX_)
#if (TARGET_SYSTEM == _LINUX_)
#if defined(__m68k__) // it is an big endian machine
#if defined(INLINE_FUNCTION_DEF)
#undef INLINE_FUNCTION
Expand Down
128 changes: 7 additions & 121 deletions trunk/drivers/staging/epl/EplSdoUdpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ typedef struct {
tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
SOCKET m_UdpSocket;

#if (TARGET_SYSTEM == _WIN32_)
HANDLE m_ThreadHandle;
LPCRITICAL_SECTION m_pCriticalSection;
CRITICAL_SECTION m_CriticalSection;

#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
struct completion m_CompletionUdpThread;
int m_ThreadHandle;
int m_iTerminateThread;
Expand All @@ -133,10 +128,7 @@ static tEplSdoUdpInstance SdoUdpInstance_g;
// local function prototypes
//---------------------------------------------------------------------------

#if (TARGET_SYSTEM == _WIN32_)
static DWORD EplSdoUdpThread(LPVOID lpParameter);

#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
static int EplSdoUdpThread(void *pArg_p);
#endif

Expand Down Expand Up @@ -209,12 +201,6 @@ tEplKernel EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
{
tEplKernel Ret;

#if (TARGET_SYSTEM == _WIN32_)
int iError;
WSADATA Wsa;

#endif

// set instance variables to 0
EPL_MEMSET(&SdoUdpInstance_g, 0x00, sizeof(SdoUdpInstance_g));

Expand All @@ -228,20 +214,7 @@ tEplKernel EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
goto Exit;
}

#if (TARGET_SYSTEM == _WIN32_)
// start winsock2 for win32
// windows specific start of socket
iError = WSAStartup(MAKEWORD(2, 0), &Wsa);
if (iError != 0) {
Ret = kEplSdoUdpNoSocket;
goto Exit;
}
// create critical section for acccess of instnace variables
SdoUdpInstance_g.m_pCriticalSection =
&SdoUdpInstance_g.m_CriticalSection;
InitializeCriticalSection(SdoUdpInstance_g.m_pCriticalSection);

#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
init_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
SdoUdpInstance_g.m_iTerminateThread = 0;
#endif
Expand Down Expand Up @@ -277,22 +250,11 @@ tEplKernel EplSdoUdpuDelInstance(void)
{
tEplKernel Ret;

#if (TARGET_SYSTEM == _WIN32_)
BOOL fTermError;
#endif

Ret = kEplSuccessful;

if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started
// close thread
#if (TARGET_SYSTEM == _WIN32_)
fTermError =
TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
if (fTermError == FALSE) {
Ret = kEplSdoUdpThreadError;
goto Exit;
}
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
SdoUdpInstance_g.m_iTerminateThread = 1;
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
Expand All @@ -307,19 +269,6 @@ tEplKernel EplSdoUdpuDelInstance(void)
closesocket(SdoUdpInstance_g.m_UdpSocket);
SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
}
#if (TARGET_SYSTEM == _WIN32_)
// delete critical section
DeleteCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
#endif

#if (TARGET_SYSTEM == _WIN32_)
// for win 32
WSACleanup();
#endif

#if (TARGET_SYSTEM == _WIN32_)
Exit:
#endif
return Ret;
}

Expand All @@ -346,11 +295,6 @@ tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
struct sockaddr_in Addr;
int iError;

#if (TARGET_SYSTEM == _WIN32_)
BOOL fTermError;
unsigned long ulThreadId;
#endif

Ret = kEplSuccessful;

if (uiPort_p == 0) { // set UDP port to default port number
Expand All @@ -363,14 +307,7 @@ tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
if (SdoUdpInstance_g.m_ThreadHandle != 0) { // listen thread was started

// close old thread
#if (TARGET_SYSTEM == _WIN32_)
fTermError =
TerminateThread(SdoUdpInstance_g.m_ThreadHandle, 0);
if (fTermError == FALSE) {
Ret = kEplSdoUdpThreadError;
goto Exit;
}
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
SdoUdpInstance_g.m_iTerminateThread = 1;
/* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
Expand Down Expand Up @@ -412,20 +349,7 @@ tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
goto Exit;
}
// create Listen-Thread
#if (TARGET_SYSTEM == _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;
}
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)

SdoUdpInstance_g.m_ThreadHandle =
kernel_thread(EplSdoUdpThread, &SdoUdpInstance_g, CLONE_KERNEL);
Expand Down Expand Up @@ -552,22 +476,12 @@ tEplKernel EplSdoUdpuSendData(tEplSdoConHdl SdoConHandle_p,

// call sendto
Addr.sin_family = AF_INET;
#if (TARGET_SYSTEM == _WIN32_)
// enter critical section for process function
EnterCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
#endif

Addr.sin_port =
(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_)
// leave critical section for process function
LeaveCriticalSection(SdoUdpInstance_g.m_pCriticalSection);
#endif

iError = sendto(SdoUdpInstance_g.m_UdpSocket, // sockethandle
(const char *)&pSrcData_p->m_le_bMessageType, // data to send
dwDataSize_p, // number of bytes to send
Expand Down Expand Up @@ -647,11 +561,7 @@ tEplKernel EplSdoUdpuDelCon(tEplSdoConHdl SdoConHandle_p)
// State:
//
//---------------------------------------------------------------------------
#if (TARGET_SYSTEM == _WIN32_)
static DWORD EplSdoUdpThread(LPVOID lpParameter)
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
static int EplSdoUdpThread(void *pArg_p)
#endif
{

tEplSdoUdpInstance *pInstance;
Expand All @@ -663,11 +573,7 @@ static int EplSdoUdpThread(void *pArg_p)
unsigned int uiSize;
tEplSdoConHdl SdoConHdl;

#if (TARGET_SYSTEM == _WIN32_)
pInstance = (tEplSdoUdpInstance *) lpParameter;

for (;;)
#elif (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
pInstance = (tEplSdoUdpInstance *) pArg_p;
daemonize("EplSdoUdpThread");
allow_signal(SIGTERM);
Expand All @@ -693,11 +599,6 @@ static int EplSdoUdpThread(void *pArg_p)
// get handle for higher layer
iCount = 0;
iFreeEntry = 0xFFFF;
#if (TARGET_SYSTEM == _WIN32_)
// enter critical section for process function
EnterCriticalSection(SdoUdpInstance_g.
m_pCriticalSection);
#endif
while (iCount < EPL_SDO_MAX_CONNECTION_UDP) {
// check if this connection is already known
if ((pInstance->m_aSdoAbsUdpConnection[iCount].
Expand Down Expand Up @@ -733,11 +634,6 @@ static int EplSdoUdpThread(void *pArg_p)
pInstance->
m_aSdoAbsUdpConnection[iFreeEntry].
m_uiPort = RemoteAddr.sin_port;
#if (TARGET_SYSTEM == _WIN32_)
// leave critical section for process function
LeaveCriticalSection(SdoUdpInstance_g.
m_pCriticalSection);
#endif
// call callback
SdoConHdl = iFreeEntry;
SdoConHdl |= EPL_SDO_UDP_HANDLE;
Expand All @@ -751,23 +647,13 @@ static int EplSdoUdpThread(void *pArg_p)
} else {
EPL_DBGLVL_SDO_TRACE0
("Error in EplSdoUdpThread() no free handle\n");
#if (TARGET_SYSTEM == _WIN32_)
// leave critical section for process function
LeaveCriticalSection(SdoUdpInstance_g.
m_pCriticalSection);
#endif
}

} else {
// known connection
// call callback with correct handle
SdoConHdl = iCount;
SdoConHdl |= EPL_SDO_UDP_HANDLE;
#if (TARGET_SYSTEM == _WIN32_)
// leave critical section for process function
LeaveCriticalSection(SdoUdpInstance_g.
m_pCriticalSection);
#endif
// offset 4 -> start of SDO Sequence header
pInstance->m_fpSdoAsySeqCb(SdoConHdl,
(tEplAsySdoSeq *) &
Expand Down
Loading

0 comments on commit 77d49b2

Please sign in to comment.