FreeCalypso > hg > fc-magnetite
changeset 365:f8ad9dcadde0
RV timing: better RVF_MS_TO_TICKS() formula
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 31 Dec 2017 06:32:33 +0000 |
parents | 44795dbadbae |
children | 042be096c669 |
files | src/cs/riviera/rvf/rvf_target.h |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 */