Updated the MS/TP Capture tool, and cleaned up the net.h defines.

This commit is contained in:
skarg
2008-08-02 16:23:29 +00:00
parent 6328b51cbc
commit 10e74470a5
3 changed files with 9 additions and 5 deletions
+1
View File
@@ -37,6 +37,7 @@ SRCS = main.c \
${BACNET_PORT_DIR}/rs485.c \
${BACNET_SOURCE_DIR}/mstp.c \
${BACNET_SOURCE_DIR}/mstptext.c \
${BACNET_SOURCE_DIR}/debug.c \
${BACNET_SOURCE_DIR}/indtext.c \
${BACNET_SOURCE_DIR}/crc.c
+6 -3
View File
@@ -69,15 +69,16 @@ static inline int sem_timedwait(sem_t *sem,
const struct timespec *abs_timeout)
{
struct timeval tp;
DWORD wait_status = 0;
DWORD dwMilliseconds = (abs_timeout->tv_sec * 1000) +
(abs_timeout->tv_nsec / 1000);
gettimeofday(&tp,NULL);
if (abs_timeout->tv_sec >= tp.tv_sec) {
dwMilliseconds = (abs_timeout->tv_sec - tp.tv_sec) * 1000;
if (abs_timeout->tv_usec >= tp.tv_usec) {
if (abs_timeout->tv_nsec >= (tp.tv_usec*1000)) {
dwMilliseconds +=
((abs_timeout->tv_usec - tp.tv_usec) / 1000);
((abs_timeout->tv_nsec - (tp.tv_usec*1000)) / (1000*1000));
}
} else {
dwMilliseconds = 0;
@@ -90,7 +91,7 @@ static inline int sem_timedwait(sem_t *sem,
return -1;
}
static inline int sem_init(sem_t *sem, int pshared, unsigned int value);
static inline int sem_init(sem_t *sem, int pshared, unsigned int value)
{
(void)pshared;
*sem = CreateSemaphore(
@@ -111,6 +112,8 @@ static inline int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
(rqtp->tv_nsec / 1000);
Sleep(dwMilliseconds);
return 0;
}
#endif
+2 -2
View File
@@ -61,7 +61,7 @@
#if PRINT_ENABLED
#undef PRINT_ENABLED_RECEIVE
#undef PRINT_ENABLED_RECEIVE_DATA
#undef PRINT_ENABLED_RECEIVE_ERRORS
#define PRINT_ENABLED_RECEIVE_ERRORS
#undef PRINT_ENABLED_MASTER
#endif
@@ -464,7 +464,7 @@ void MSTP_Receive_Frame_FSM(
if (mstp_port->SilenceTimer() > Tframe_abort) {
/* indicate that an error has occurred during the reception of a frame */
mstp_port->ReceivedInvalidFrame = true;
printf_receive_error("MSTP: Rx Data: SilenceTimer %d > %d\n",
printf_receive_error("MSTP: Rx Data: SilenceTimer %dms > %dms\n",
mstp_port->SilenceTimer(), Tframe_abort);
/* wait for the start of the next frame. */
mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE;}