|
@@ -176,6 +176,7 @@ uint8_t cc_error() |
|
|
*/ |
|
|
*/ |
|
|
struct timespec tp={0,0}; |
|
|
struct timespec tp={0,0}; |
|
|
static int cc_delay_mult=80; |
|
|
static int cc_delay_mult=80; |
|
|
|
|
|
/* delay d * .4 us */ |
|
|
void cc_delay( unsigned int d ) |
|
|
void cc_delay( unsigned int d ) |
|
|
{ |
|
|
{ |
|
|
volatile unsigned int i = cc_delay_mult*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 */ |
|
|
/* provas konsideri la rapidecon de la procesoro */ |
|
|
void cc_delay_calibrate( ) |
|
|
void cc_delay_calibrate( ) |
|
|
{ |
|
|
{ |
|
|
|
|
|
#if 1 |
|
|
|
|
|
/* The ioctl overhead on FreeBSD far exceeds min timing */ |
|
|
|
|
|
cc_delay_mult = 0; |
|
|
|
|
|
#else |
|
|
long time0=micros(); |
|
|
long time0=micros(); |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
@@ -200,7 +205,11 @@ void cc_delay_calibrate( ) |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
|
cc_delay(200); |
|
|
long time1=micros(); |
|
|
long time1=micros(); |
|
|
|
|
|
/* make 1000 delay units == 400us */ |
|
|
cc_delay_mult=cc_delay_mult*400/(time1-time0); |
|
|
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 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|