Added sleep and removed debug print from mstpcap. Tested under Linux. Needs tested under Windows.
This commit is contained in:
@@ -137,6 +137,17 @@ static void dlmstp_millisecond_timer(
|
||||
INCREMENT_AND_LIMIT_UINT16(SilenceTime);
|
||||
}
|
||||
|
||||
#if !defined (_WIN32)
|
||||
void Sleep(unsigned long milliseconds)
|
||||
{
|
||||
struct timespec timeOut, remains;
|
||||
|
||||
timeOut.tv_sec = milliseconds/1000;
|
||||
timeOut.tv_nsec = (milliseconds - (timeOut.tv_sec * 1000)) * 10000000;
|
||||
nanosleep(&timeOut, &remains);
|
||||
}
|
||||
|
||||
|
||||
void *milliseconds_task(
|
||||
void *pArg)
|
||||
{
|
||||
@@ -152,6 +163,7 @@ void *milliseconds_task(
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void receiver_packet_put(
|
||||
volatile struct mstp_port_struct_t * mstp_port)
|
||||
@@ -245,8 +257,9 @@ void *reciever_task(
|
||||
} else if (mstp_port->ReceivedInvalidFrame) {
|
||||
mstp_port->ReceivedInvalidFrame = false;
|
||||
receiver_packet_put(mstp_port);
|
||||
} else {
|
||||
Sleep(1);
|
||||
}
|
||||
printf("Receiving Task\n");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -276,7 +289,10 @@ static void milliseconds_task_win32(
|
||||
{
|
||||
(void) SetThreadPriority(GetCurrentThread(),
|
||||
THREAD_PRIORITY_TIME_CRITICAL);
|
||||
milliseconds_task(pArg);
|
||||
for (;;) {
|
||||
Sleep(1);
|
||||
dlmstp_millisecond_timer();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user