summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-08-28 03:40:14 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-10-03 18:43:08 +0700
commit2fbf4d1c67e80715c7cc8d82053b72d31b75fc41 (patch)
tree40d25e8fb7f42fdd32a8e681b607d9a2da61bc9e
parent3ceba3476d6156d965686972f1b24daca3c7286f (diff)
mobile/voice.c: abstract gsm_send_voice() from MNCC
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/voice.h8
-rw-r--r--src/host/layer23/src/mobile/gsm48_cc.c2
-rw-r--r--src/host/layer23/src/mobile/voice.c17
3 files changed, 22 insertions, 5 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/voice.h b/src/host/layer23/include/osmocom/bb/mobile/voice.h
index b9817f8a..689361c3 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/voice.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/voice.h
@@ -1,4 +1,10 @@
#pragma once
+#include <osmocom/core/msgb.h>
+
+#include <osmocom/bb/common/osmocom_data.h>
+#include <osmocom/bb/mobile/mncc.h>
+
int gsm_voice_init(struct osmocom_ms *ms);
-int gsm_send_voice(struct osmocom_ms *ms, struct gsm_data_frame *data);
+int gsm_send_voice(struct osmocom_ms *ms, struct msgb *msg);
+int gsm_send_voice_mncc(struct osmocom_ms *ms, struct gsm_data_frame *frame);
diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c
index f1e81098..28576d29 100644
--- a/src/host/layer23/src/mobile/gsm48_cc.c
+++ b/src/host/layer23/src/mobile/gsm48_cc.c
@@ -1970,7 +1970,7 @@ int mncc_tx_to_cc(void *inst, int msg_type, void *arg)
switch (msg_type) {
case GSM_TCHF_FRAME:
- return gsm_send_voice(ms, arg);
+ return gsm_send_voice_mncc(ms, arg);
case MNCC_LCHAN_MODIFY:
return 0;
case MNCC_FRAME_RECV:
diff --git a/src/host/layer23/src/mobile/voice.c b/src/host/layer23/src/mobile/voice.c
index b7678337..76c116cd 100644
--- a/src/host/layer23/src/mobile/voice.c
+++ b/src/host/layer23/src/mobile/voice.c
@@ -53,7 +53,18 @@ static int gsm_recv_voice(struct osmocom_ms *ms, struct msgb *msg)
/*
* send voice
*/
-int gsm_send_voice(struct osmocom_ms *ms, struct gsm_data_frame *data)
+int gsm_send_voice(struct osmocom_ms *ms, struct msgb *msg)
+{
+ /**
+ * Nothing to do for now...
+ * TODO: compose l1ctl_traffic_ind header here
+ */
+
+ /* Forward to RR */
+ return gsm48_rr_tx_voice(ms, msg);
+}
+
+int gsm_send_voice_mncc(struct osmocom_ms *ms, struct gsm_data_frame *frame)
{
struct msgb *nmsg;
@@ -61,9 +72,9 @@ int gsm_send_voice(struct osmocom_ms *ms, struct gsm_data_frame *data)
if (!nmsg)
return -ENOMEM;
nmsg->l2h = msgb_put(nmsg, 33);
- memcpy(nmsg->l2h, data->data, 33);
+ memcpy(nmsg->l2h, frame->data, 33);
- return gsm48_rr_tx_voice(ms, nmsg);
+ return gsm_send_voice(ms, nmsg);
}
/*