summaryrefslogtreecommitdiff
path: root/cesar/bsu/ntb
diff options
context:
space:
mode:
authorlaranjeiro2010-06-22 13:07:23 +0000
committerlaranjeiro2010-06-22 13:07:23 +0000
commit0f30c4c3c8acc54976de0fa21ebf661cd8018fc5 (patch)
treef5984984aea8a436158fcc358673fd82ab27d89b /cesar/bsu/ntb
parent30bc47ef4c95e40fd3543359f7b3f5a1d9535629 (diff)
cesar/bsu/ntb: fix ntb offset tick to be computed in u32. closes #1682
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7250 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/ntb')
-rw-r--r--cesar/bsu/ntb/src/ntb.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/cesar/bsu/ntb/src/ntb.c b/cesar/bsu/ntb/src/ntb.c
index d6b96166e5..bc61fe96d7 100644
--- a/cesar/bsu/ntb/src/ntb.c
+++ b/cesar/bsu/ntb/src/ntb.c
@@ -62,24 +62,21 @@ bsu_ntb_frequency_error (bsu_ntb_sync_t *ctx, double freq_err, u32 bts,
* \param preamble_sysdate the system date preamble corresponding to the
* last beacon received.
*/
-static s32
+static u32
bsu_ntb_offset (bsu_ntb_sync_t *ctx, phy_t *phy, double freq_error,
u32 bts, u32 preamble_stadate, u32 preamble_sysdate)
{
- s32 offset;
+ u32 offset;
dbg_assert (ctx);
- dbg_assert (phy);
- /* Get the delay in system ticks. */
- ctx->delay_systck = phy_sysdate () - preamble_sysdate;
- dbg_assert ((s32) ctx->delay_systck >= 0);
+ offset = bts - preamble_stadate;
if (ctx->init)
{
- double part2 = ((ctx->fe * ctx->delay_systck)
- - (freq_error * ctx->delay_systck));
- offset = bts - preamble_stadate + part2;
+ /* Get the delay in system ticks. */
+ ctx->delay_systck = phy_sysdate () - preamble_sysdate;
+ dbg_assert ((s32) ctx->delay_systck >= 0);
+ offset += ((ctx->fe * ctx->delay_systck)
+ - (freq_error * ctx->delay_systck));
}
- else
- offset = bts - preamble_stadate;
return offset;
}