This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

right value for delay in cyg_hal_plf_serial_getc_timeout?


Hi,

I have problem with loading files via serial using ymodem protocol.

Debuging this problem, I see that
cyg_hal_plf_serial_getc_timeout uses
CYGACC_CALL_IF_DELAY_US(100),
this timeout is too big for baudrate 115200,
chaging timeout in such way(see the patch in the end of message) fixed problem for me.

But may be there is some reason to have delay so big,
may be better to choose timeout depend on baudrate?

diff --git a/packages/hal/arm/at91/var/current/src/hal_diag.c b/packages/hal/arm/at91/var/current/src/hal_diag.c
index 3ded648..ed96451 100644
--- a/packages/hal/arm/at91/var/current/src/hal_diag.c
+++ b/packages/hal/arm/at91/var/current/src/hal_diag.c
@@ -178,14 +178,14 @@ cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch)
     cyg_bool res;
     CYGARC_HAL_SAVE_GP();

-    delay_count = chan->msec_timeout * 10; // delay in .1 ms steps
+    delay_count = chan->msec_timeout * 50; // delay in .02 ms steps

     for(;;) {
         res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch);
         if (res || 0 == delay_count--)
             break;

-        CYGACC_CALL_IF_DELAY_US(100);
+        CYGACC_CALL_IF_DELAY_US(20);
     }

     CYGARC_HAL_RESTORE_GP();
-- 
1.5.6.4


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]