aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/tch.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-10 15:02:41 +0200
committerMax <msuraev@sysmocom.de>2016-06-10 15:02:41 +0200
commitf43d24598d5c8769ed94d86e57e7deec8075c93c (patch)
treefc57e0638020d81a7360aa57b62b3448273f4923 /src/common/tch.c
parent9966ec6459d0e8c704f7eca010ba50c3f5953f36 (diff)
Move to common/ TCH code for adding l1sap header
Move code common for both sysmoBTS and LC15 to common/tch.c to make sure fix from ef30f50d5d6d5f863fc147d05ccdceb89284934e is applied to both. Change-Id: I18124f529d3546467a266c04f394150e5466c0c0
Diffstat (limited to 'src/common/tch.c')
-rw-r--r--src/common/tch.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/tch.c b/src/common/tch.c
index d31b04ef..03db563c 100644
--- a/src/common/tch.c
+++ b/src/common/tch.c
@@ -20,12 +20,34 @@
*/
#include <osmo-bts/gsm_data.h>
+#include <osmo-bts/logging.h>
+#include <osmo-bts/l1sap.h>
extern struct msgb *l1p_msgb_alloc(void);
extern uint8_t *get_payload_addr(struct msgb *msg);
extern void set_payload_type(struct msgb *msg, struct gsm_lchan *lchan);
extern void set_payload_size(struct msgb *msg, uint8_t size);
+int add_l1sap_header(struct gsm_lchan *lchan, struct msgb *rmsg,
+ struct gsm_bts_trx *trx, uint8_t chan_nr, uint32_t fn)
+{
+ struct osmo_phsap_prim *l1sap;
+
+ LOGP(DL1C, LOGL_DEBUG, "%s Rx -> RTP: %s\n",
+ gsm_lchan_name(lchan), osmo_hexdump(rmsg->data, rmsg->len));
+
+ rmsg->l2h = rmsg->data;
+ msgb_push(rmsg, sizeof(*l1sap));
+ rmsg->l1h = rmsg->data;
+ l1sap = msgb_l1sap_prim(rmsg);
+ osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_TCH, PRIM_OP_INDICATION,
+ rmsg);
+ l1sap->u.tch.chan_nr = chan_nr;
+ l1sap->u.tch.fn = fn;
+
+ return l1sap_up(trx, l1sap);
+}
+
struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan)
{
struct msgb *msg;