Change in osmo-bts[master]: bts-trx: setup timer once at creation time

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Nov 13 20:10:02 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11766


Change subject: bts-trx: setup timer once at creation time
......................................................................

bts-trx: setup timer once at creation time

Change-Id: I3b6461d0130d25284e673c5efce0b3832c48bbb5
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/main.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
5 files changed, 17 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/66/11766/1

diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index faff3a0..b4ca54f 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -58,6 +58,14 @@
 	[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 77c5936..165f9d8 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -64,6 +64,7 @@
 	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 61610f7..6e4dd8e 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -134,8 +134,7 @@
 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 4bcdfc6..b409d51 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -140,8 +140,6 @@
  * 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 @@
 	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 @@
 	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 b161044..206f5e5 100644
--- a/src/osmo-bts-trx/trx_if.h
+++ b/src/osmo-bts-trx/trx_if.h
@@ -14,6 +14,7 @@
 	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);

-- 
To view, visit https://gerrit.osmocom.org/11766
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b6461d0130d25284e673c5efce0b3832c48bbb5
Gerrit-Change-Number: 11766
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181113/7b3e9779/attachment.html>


More information about the gerrit-log mailing list