From 4d5427f949bd0539c0506b0a751eac190637f1a2 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Thu, 27 Aug 2020 03:48:08 +0000 Subject: [PATCH] minor comments about the delay.. --- CCDebugger.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CCDebugger.c b/CCDebugger.c index 12ebed2..f15af81 100644 --- a/CCDebugger.c +++ b/CCDebugger.c @@ -176,6 +176,7 @@ uint8_t cc_error() */ struct timespec tp={0,0}; static int cc_delay_mult=80; +/* delay d * .4 us */ void cc_delay( unsigned int d ) { volatile unsigned int i = cc_delay_mult*d; @@ -193,6 +194,10 @@ void cc_setmult(int mult) /* provas konsideri la rapidecon de la procesoro */ void cc_delay_calibrate( ) { +#if 1 + /* The ioctl overhead on FreeBSD far exceeds min timing */ + cc_delay_mult = 0; +#else long time0=micros(); cc_delay(200); cc_delay(200); @@ -200,7 +205,11 @@ void cc_delay_calibrate( ) cc_delay(200); cc_delay(200); long time1=micros(); + /* make 1000 delay units == 400us */ cc_delay_mult=cc_delay_mult*400/(time1-time0); + printf("time0: %ld, time1: %ld, time1-time0: %ld\n", time0, time1, time1 - time0); + printf("dmul: %d\n", cc_delay_mult); +#endif } /**