diff options
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 8 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-trx/main.c | 3 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 10 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.h | 1 |
5 files changed, 17 insertions, 6 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index faff3a00..b4ca54f0 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -58,6 +58,14 @@ static const uint8_t transceiver_chan_types[_GSM_PCHAN_MAX] = { [GSM_PCHAN_UNKNOWN] = 0, }; +struct trx_l1h *trx_l1h_alloc(void *tall_ctx, struct phy_instance *pinst) +{ + struct trx_l1h *l1h; + l1h = talloc_zero(tall_ctx, struct trx_l1h); + l1h->phy_inst = pinst; + trx_if_init(l1h); + return l1h; +} static void check_transceiver_availability_trx(struct trx_l1h *l1h, int avail) { diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 77c5936c..165f9d81 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -64,6 +64,7 @@ struct trx_l1h { struct l1sched_trx l1s; }; +struct trx_l1h *trx_l1h_alloc(void *tall_ctx, struct phy_instance *pinst); int check_transceiver_availability(struct gsm_bts *bts, int avail); int l1if_provision_transceiver_trx(struct trx_l1h *l1h); int l1if_provision_transceiver(struct gsm_bts *bts); diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c index 98f460eb..9529190e 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -139,8 +139,7 @@ void bts_model_phy_link_set_defaults(struct phy_link *plink) void bts_model_phy_instance_set_defaults(struct phy_instance *pinst) { struct trx_l1h *l1h; - l1h = talloc_zero(tall_bts_ctx, struct trx_l1h); - l1h->phy_inst = pinst; + l1h = trx_l1h_alloc(tall_bts_ctx, pinst); pinst->u.osmotrx.hdl = l1h; l1h->config.power_oml = 1; diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 4bcdfc69..b409d517 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -140,8 +140,6 @@ static int trx_clk_read_cb(struct osmo_fd *ofd, unsigned int what) * TRX ctrl socket */ -static void trx_ctrl_timer_cb(void *data); - /* send first ctrl message and start timer */ static void trx_ctrl_send(struct trx_l1h *l1h) { @@ -162,8 +160,6 @@ static void trx_ctrl_send(struct trx_l1h *l1h) send(l1h->trx_ofd_ctrl.fd, buf, len+1, 0); /* start timer */ - l1h->trx_ctrl_timer.cb = trx_ctrl_timer_cb; - l1h->trx_ctrl_timer.data = l1h; osmo_timer_schedule(&l1h->trx_ctrl_timer, 2, 0); } @@ -184,6 +180,12 @@ static void trx_ctrl_timer_cb(void *data) trx_ctrl_send(l1h); } +void trx_if_init(struct trx_l1h *l1h) +{ + l1h->trx_ctrl_timer.cb = trx_ctrl_timer_cb; + l1h->trx_ctrl_timer.data = l1h; +} + /*! Send a new TRX control command. * \param[inout] l1h TRX Layer1 handle to which to send command * \param[in] criticial diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h index b1610441..206f5e54 100644 --- a/src/osmo-bts-trx/trx_if.h +++ b/src/osmo-bts-trx/trx_if.h @@ -14,6 +14,7 @@ struct trx_ctrl_msg { int critical; }; +void trx_if_init(struct trx_l1h *l1h); int trx_if_cmd_poweroff(struct trx_l1h *l1h); int trx_if_cmd_poweron(struct trx_l1h *l1h); int trx_if_cmd_settsc(struct trx_l1h *l1h, uint8_t tsc); |