aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/trx_if.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-13 19:31:50 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-11-20 10:37:58 +0100
commit9d17840f83fa0c460098fc5b142d2f8b767fa501 (patch)
treef9a0bd5150450da78f8ae4055e73afd24150cb53 /src/osmo-bts-trx/trx_if.c
parentfc2ff394e0a1b2325bdadaa0699bf8e8d0c716bb (diff)
bts-trx: setup timer once at creation time
The setup is only needed once, so no need to set it every time we want to schedule it. Furthermore, it will ease new code introduced in follow-up patches, which will schedule this timer under some circumstances without need to send a message at the same time (because re-try of a cmd after a delay is wanted). This commit adds an alloc function and an init function to keep different parts of the code decoupled and avoid exposing more implementation details between them (like exposing the trx_if timer). Change-Id: I3b6461d0130d25284e673c5efce0b3832c48bbb5
Diffstat (limited to 'src/osmo-bts-trx/trx_if.c')
-rw-r--r--src/osmo-bts-trx/trx_if.c10
1 files changed, 6 insertions, 4 deletions
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