# HG changeset patch # User Mychaela Falconia # Date 1514701953 0 # Node ID f8ad9dcadde056b8b9ee2e85eb0751e39deb32eb # Parent 44795dbadbaef6bbf0cdf672aea267210d258d5c RV timing: better RVF_MS_TO_TICKS() formula diff -r 44795dbadbae -r f8ad9dcadde0 src/cs/riviera/rvf/rvf_target.h --- a/src/cs/riviera/rvf/rvf_target.h Sat Dec 30 06:10:48 2017 +0000 +++ b/src/cs/riviera/rvf/rvf_target.h Sun Dec 31 06:32:33 2017 +0000 @@ -126,6 +126,20 @@ #define RVF_SECS_TO_TICKS(_x) (((_x) * 1000) / 50) #define RVF_TICKS_TO_MS(_x) ((_x) * 50) #else +#if 1 /* new FreeCalypso code */ +/* + * In the present GSM firmware, the Nucleus tick is the TDMA frame, + * and the duration of one TDMA frame by definition equals 60/13 ms. + * Hence we use the natural factors of 13 and 60 instead of TI's + * 200 and 923 (computed to fit the rounded 4.615 ms value), + * and get not only better accuracy, but also a greater maximum + * time value: 330382 s (just under 4 days) instead of the old maximum + * of 21474 s (just under 6 h). + */ +#define RVF_MS_TO_TICKS(_x) ((((_x) * 13) + 30) / 60) +#define RVF_SECS_TO_TICKS(_x) ((((_x) * 13000) + 30) / 60) +/* RVF_TICKS_TO_MS() macro was unused and is being removed */ +#else /* old code from TI */ /* * To avoid floating point computation, the tick duration 4.615 ms can be * resolved to the fraction : 923/200. @@ -139,5 +153,6 @@ #define RVF_SECS_TO_TICKS(_x) ((((_x) * 1000 * 200) + 462) / 923) #define RVF_TICKS_TO_MS(_x) ((((_x) * 923) + 100) / 200) #endif +#endif #endif /* _RVF_TARGET_H */