bts: Move the frame_number into the BTS sructure

The current_frame is an attribute of the BTS. Move it from the
pcu_l1_if.cpp into the BTS. As the next step we can trigger
actions depending on the change of the frame.
This commit is contained in:
Holger Hans Peter Freyther 2013-10-17 19:59:56 +02:00
parent b6acfdaa24
commit 9b30c7f46e
5 changed files with 30 additions and 16 deletions

View File

@ -39,7 +39,13 @@ struct gprs_rlcmac_bts *bts_main_data()
}
BTS::BTS()
: m_cur_fn(0)
{
memset(&m_bts, 0, sizeof(m_bts));
m_bts.bts = this;
}
void BTS::set_current_frame_number(int fn)
{
m_cur_fn = fn;
}

View File

@ -106,9 +106,19 @@ public:
struct gprs_rlcmac_bts *bts_data();
/** TODO: change the number to unsigned */
void set_current_frame_number(int frame_number);
int current_frame_number() const;
private:
int m_cur_fn;
struct gprs_rlcmac_bts m_bts;
};
inline int BTS::current_frame_number() const
{
return m_cur_fn;
}
#endif
#ifdef __cplusplus

View File

@ -33,9 +33,21 @@ static int *nearest_p;
#include <limits.h>
#include <gsm_timer.h>
#include <pcu_l1_if.h>
#include <bts.h>
static struct rb_root timer_root = RB_ROOT;
/*
* TODO: make this depend on the BTS. This means that
* all time functions schedule based on the BTS they
* are scheduled on.
*/
static int get_current_fn()
{
return BTS::main_bts()->current_frame_number();
}
static void __add_gsm_timer(struct osmo_gsm_timer_list *timer)
{
struct rb_node **new_node = &(timer_root.rb_node);

View File

@ -50,19 +50,6 @@ int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn,
extern void *tall_pcu_ctx;
// Variable for storage current FN.
int frame_number;
int get_current_fn()
{
return frame_number;
}
void set_current_fn(int fn)
{
frame_number = fn;
}
/*
* PCU messages
*/
@ -512,6 +499,7 @@ static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
struct gprs_rlcmac_sba *sba, *sba2;
uint32_t elapsed;
uint8_t fn13 = time_ind->fn % 13;
int frame_number = time_ind->fn;
/* omit frame numbers not starting at a MAC block */
if (fn13 != 0 && fn13 != 4 && fn13 != 8)
@ -520,7 +508,7 @@ static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
// LOGP(DL1IF, LOGL_DEBUG, "Time indication received: %d\n",
// time_ind->fn % 52);
set_current_fn(time_ind->fn);
BTS::main_bts()->set_current_frame_number(time_ind->fn);
/* check for poll timeout */
llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) {

View File

@ -32,8 +32,6 @@ extern "C" {
#ifdef __cplusplus
}
int get_current_fn();
void pcu_l1if_tx_pdtch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,
uint32_t fn, uint8_t block_nr);
void pcu_l1if_tx_ptcch(msgb *msg, uint8_t trx, uint8_t ts, uint16_t arfcn,