summaryrefslogtreecommitdiff
path: root/cesar/bsu/ntb/ntb.h
blob: ed0205d1f4f629d7ec62247fb5077416ca3771b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef bsu_ntb_ntb_h
#define bsu_ntb_ntb_h
/* Cesar project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    bsu/ntb/ntb.h
 * \brief   NTB clock synchronization.
 * \ingroup bsu
 */
#include "bsu/ntb/ntb_sync.h"
#include "mac/common/config.h"
#include "hal/phy/phy.h"

#define BSU_NTB_CLK_SYNC_WEIGHT_K_DEFAULT 6

#define BSU_NTB_CLK_SYNC_NB_STABLE_DEFAULT 4

BEGIN_DECLS

/*
 * Synchronize local clock to be as close as possible to estimated value
 * of the NTB clock reference.
 * \param  ctx  the module context data.
 * \param  beacon_bts  beacon time stamp
 * \param  beacon_sta_ltmr  STA local time captured when receiving beacon
 * \param  weight_k  the coefficient weight to use to smooth the NTB clock
 */
void
bsu_ntb_clk_sync (bsu_ntb_sync_t * ctx, u32 beacon_bts, u32 beacon_sys_ltmr,
                  u32 beacon_sta_ltmr, uint weight_k);

/**
 * Configure the clock frequency.
 * \param  ctx  the module context data.
 * \param  mac_config  the mac config object.
 * \param  phy  the phy context.
 */
void
bsu_ntb_clock_configure (bsu_ntb_sync_t *ctx, mac_config_t *mac_config,
                         phy_t *phy);

END_DECLS

#endif /* bsu_ntb_ntb_h */