From fcc222823ec08b56e9dfe0547c3448d5b3026ace Mon Sep 17 00:00:00 2001 From: armink Date: Tue, 11 Apr 2017 11:06:33 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E9=83=A8=E5=88=86=E7=9A=84=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE=E5=8F=8A=E5=85=B6=E4=BB=96=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E5=A4=84=E7=90=86=EF=BC=8C=E6=8F=90=E9=AB=98=E5=8F=AF?= =?UTF-8?q?=E9=9D=A0=E6=80=A7=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- APP/inc/rtconfig.h | 2 +- FreeModbus/port/rtt/portserial.c | 2 +- FreeModbus/port/rtt/portserial_m.c | 2 +- FreeModbus/port/rtt/porttimer.c | 2 +- FreeModbus/port/rtt/porttimer_m.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/APP/inc/rtconfig.h b/APP/inc/rtconfig.h index 8cf88c3..03aaf38 100644 --- a/APP/inc/rtconfig.h +++ b/APP/inc/rtconfig.h @@ -25,7 +25,7 @@ #define RT_USING_HOOK /* Using Software Timer */ -/* #define RT_USING_TIMER_SOFT */ +#define RT_USING_TIMER_SOFT #define RT_TIMER_THREAD_PRIO 4 #define RT_TIMER_THREAD_STACK_SIZE 512 #define RT_TIMER_TICK_PER_SECOND 1000 diff --git a/FreeModbus/port/rtt/portserial.c b/FreeModbus/port/rtt/portserial.c index a97841f..6f8e71d 100644 --- a/FreeModbus/port/rtt/portserial.c +++ b/FreeModbus/port/rtt/portserial.c @@ -107,6 +107,7 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, } /* software initialize */ + rt_event_init(&event_serial, "slave event", RT_IPC_FLAG_PRIO); rt_thread_init(&thread_serial_soft_trans_irq, "slave trans", serial_soft_trans_irq, @@ -115,7 +116,6 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, sizeof(serial_soft_trans_irq_stack), 10, 5); rt_thread_startup(&thread_serial_soft_trans_irq); - rt_event_init(&event_serial, "slave event", RT_IPC_FLAG_PRIO); return TRUE; } diff --git a/FreeModbus/port/rtt/portserial_m.c b/FreeModbus/port/rtt/portserial_m.c index 93a4af7..d19750c 100644 --- a/FreeModbus/port/rtt/portserial_m.c +++ b/FreeModbus/port/rtt/portserial_m.c @@ -108,6 +108,7 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, } /* software initialize */ + rt_event_init(&event_serial, "master event", RT_IPC_FLAG_PRIO); rt_thread_init(&thread_serial_soft_trans_irq, "master trans", serial_soft_trans_irq, @@ -116,7 +117,6 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, sizeof(serial_soft_trans_irq_stack), 10, 5); rt_thread_startup(&thread_serial_soft_trans_irq); - rt_event_init(&event_serial, "master event", RT_IPC_FLAG_PRIO); return TRUE; } diff --git a/FreeModbus/port/rtt/porttimer.c b/FreeModbus/port/rtt/porttimer.c index 6f017d8..8c51ad0 100644 --- a/FreeModbus/port/rtt/porttimer.c +++ b/FreeModbus/port/rtt/porttimer.c @@ -37,7 +37,7 @@ BOOL xMBPortTimersInit(USHORT usTim1Timerout50us) rt_timer_init(&timer, "slave timer", timer_timeout_ind, /* bind timeout callback function */ RT_NULL, - (50*usTim1Timerout50us)/(1000*1000/RT_TICK_PER_SECOND), + (50 * usTim1Timerout50us) / (1000 * 1000 / RT_TICK_PER_SECOND) + 1, RT_TIMER_FLAG_ONE_SHOT); /* one shot */ return TRUE; } diff --git a/FreeModbus/port/rtt/porttimer_m.c b/FreeModbus/port/rtt/porttimer_m.c index 00441bf..ebf8000 100644 --- a/FreeModbus/port/rtt/porttimer_m.c +++ b/FreeModbus/port/rtt/porttimer_m.c @@ -46,7 +46,7 @@ BOOL xMBMasterPortTimersInit(USHORT usTimeOut50us) rt_timer_init(&timer, "master timer", timer_timeout_ind, /* bind timeout callback function */ RT_NULL, - (50 * usT35TimeOut50us) / (1000 * 1000 / RT_TICK_PER_SECOND), + (50 * usT35TimeOut50us) / (1000 * 1000 / RT_TICK_PER_SECOND) + 1, RT_TIMER_FLAG_ONE_SHOT); /* one shot */ return TRUE;