annotate osmo-patches/osmo-bts-rtp-bfi.patch @ 209:e80f158333c5

mgw: correct PCMU decoding table
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 May 2023 21:43:02 -0800
parents c76f42e0cd3f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
206
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
1 # This osmo-bts patch is out of date and no longer used. The new patch
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
2 # we currently run with is located on a private feature branch hosted
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
3 # in the official repository:
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
4 #
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
5 # https://cgit.osmocom.org/osmo-bts/log/?h=falconia/rtp_traulike
c76f42e0cd3f osmo-patches/osmo-bts-rtp-bfi.patch: mark as deprecated
Mychaela Falconia <falcon@freecalypso.org>
parents: 176
diff changeset
6
172
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 diff --git a/src/common/l1sap.c b/src/common/l1sap.c
176
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
8 index 8bcd417..42c97c4 100644
172
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 --- a/src/common/l1sap.c
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 +++ b/src/common/l1sap.c
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 @@ -1244,6 +1244,12 @@ static bool rtppayload_is_octet_aligned(const uint8_t *rtp_pl, uint8_t payload_l
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 static bool rtppayload_is_valid(struct gsm_lchan *lchan, struct msgb *resp_msg)
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 + /* Discard Themyscira BFI packets - because we have our own
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 + * TDMA timing, there is no difference for us between receiving
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 + * an explicit BFI packet vs receiving nothing at all. */
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 + if (resp_msg->len == 2 && resp_msg->data[0] == 0xBF)
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 + return false;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 +
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /* Avoid sending bw-efficient AMR to lower layers, most bts models
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 * don't support it. */
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR &&
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 @@ -1574,6 +1580,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 struct gsm_lchan *lchan;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 uint8_t chan_nr;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 uint32_t fn;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 + uint8_t bfi[2];
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 chan_nr = tch_ind->chan_nr;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 fn = tch_ind->fn;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 @@ -1619,13 +1626,19 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /* Only clear the marker bit once we have sent a RTP packet with it */
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 lchan->rtp_tx_marker = false;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 } else {
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 - DEBUGPGT(DRTP, &g_time, "Skipping RTP frame with lost payload (chan_nr=0x%02x)\n",
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 - chan_nr);
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 - if (lchan->abis_ip.osmux.use)
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 - lchan_osmux_skipped_frame(lchan, fn_ms_adj(fn, lchan));
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 - else if (lchan->abis_ip.rtp_socket)
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 - osmo_rtp_skipped_frame(lchan->abis_ip.rtp_socket, fn_ms_adj(fn, lchan));
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 - lchan->rtp_tx_marker = true;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 + /* Themyscira change: send explicit BFI packets instead of
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 + * gaps in the RTP stream. */
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 + bfi[0] = 0xBF;
176
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
46 + bfi[1] = (fn % 104 == 52); /* TAF */
172
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 + if (lchan->abis_ip.osmux.use) {
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 + lchan_osmux_send_frame(lchan, bfi, 2,
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 + fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 + } else if (lchan->abis_ip.rtp_socket) {
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 + osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 + bfi, 2, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 + }
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 + /* clear the marker like in the regular code path */
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 + lchan->rtp_tx_marker = false;
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
60e2d6379fce osmo-patches/osmo-bts-rtp-bfi.patch: checking in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 lchan->tch.last_fn = fn;
176
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
59 diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
60 index 5c99824..e35fc2e 100644
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
61 --- a/src/osmo-bts-sysmo/l1_if.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
62 +++ b/src/osmo-bts-sysmo/l1_if.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
63 @@ -981,6 +981,10 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
64 return rc;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
65 }
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
66
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
67 + /* Themyscira addition: empty RTP "ticks" on FACCH */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
68 + if (data_ind->sapi == GsmL1_Sapi_FacchF)
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
69 + l1if_tch_rx_facch(trx, chan_nr, l1p_msg);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
70 +
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
71 /* fill L1SAP header */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
72 sap_msg = l1sap_msgb_alloc(data_ind->msgUnitParam.u8Size);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
73 l1sap = msgb_l1sap_prim(sap_msg);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
74 diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
75 index 8691eef..5b2da04 100644
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
76 --- a/src/osmo-bts-sysmo/l1_if.h
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
77 +++ b/src/osmo-bts-sysmo/l1_if.h
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
78 @@ -129,6 +129,8 @@ int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
79 const uint8_t *rtp_pl, unsigned int rtp_pl_len, uint32_t fn,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
80 bool use_cache, bool marker);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
81 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
82 +int l1if_tch_rx_facch(struct gsm_bts_trx *trx, uint8_t chan_nr,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
83 + struct msgb *l1p_msg);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
84 int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
85 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
86
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
87 diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
88 index a390c8c..f38d9fe 100644
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
89 --- a/src/osmo-bts-sysmo/tch.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
90 +++ b/src/osmo-bts-sysmo/tch.c
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
91 @@ -131,12 +131,16 @@ static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
92
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
93 cur[0] |= 0xC0;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
94 #endif /* USE_L1_RTP_MODE */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
95 +
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
96 +/* this code is a bogon: osmo_amr_rtp_dec() won't grok EFR RTP format! */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
97 +#if 0
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
98 enum osmo_amr_type ft;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
99 enum osmo_amr_quality bfi;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
100 uint8_t cmr;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
101 int8_t sti, cmi;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
102 osmo_amr_rtp_dec(l1_payload, payload_len, &cmr, &cmi, &ft, &bfi, &sti);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
103 lchan_set_marker(ft == AMR_GSM_EFR_SID, lchan);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
104 +#endif
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
105
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
106 return msg;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
107 }
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
108 @@ -630,6 +634,38 @@ err_payload_match:
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
109 return -EINVAL;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
110 }
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
111
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
112 +/*
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
113 + * The following function is a Themyscira Wireless addition: we want to have
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
114 + * an RTP packet sent out on *every* 20 ms "tick", even during times when
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
115 + * TCH was stolen for FACCH. During FACCH stealing times, it appears that
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
116 + * sysmoBTS PHY sends GsmL1_Sapi_FacchF and no GsmL1_Sapi_TchF, and with
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
117 + * the original code l1if_tch_rx(), the function that feeds "ticks" to the
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
118 + * RTP output mechanism, was never called. Our added l1if_tch_rx_facch()
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
119 + * function sends an empty payload to the upper layers, and we call it
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
120 + * from the GsmL1_Sapi_FacchF code path.
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
121 + */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
122 +int l1if_tch_rx_facch(struct gsm_bts_trx *trx, uint8_t chan_nr,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
123 + struct msgb *l1p_msg)
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
124 +{
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
125 + GsmL1_Prim_t *l1p = msgb_l1prim(l1p_msg);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
126 + GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
127 + struct msgb *rmsg = NULL;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
128 + struct gsm_lchan *lchan = &trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
129 +
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
130 + if (is_recv_only(lchan->abis_ip.speech_mode))
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
131 + return -EAGAIN;
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
132 +
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
133 + LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "chan_nr %d Rx FACCH\n", chan_nr);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
134 + /* Push empty payload to upper layers */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
135 + rmsg = msgb_alloc_headroom(256, 128, "L1P-to-RTP");
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
136 + return add_l1sap_header(trx, rmsg, lchan, chan_nr, data_ind->u32Fn,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
137 + data_ind->measParam.fBer * 10000,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
138 + data_ind->measParam.fLinkQuality * 10,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
139 + 0, /* suppress RSSI like in osmo-bts-trx */
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
140 + data_ind->measParam.i16BurstTiming * 64,
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
141 + 0);
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
142 +}
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
143 +
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
144 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
145 {
f5c4f9a764be osmo-bts-rtp-bfi.patch: updated version
Mychaela Falconia <falcon@freecalypso.org>
parents: 172
diff changeset
146 struct msgb *msg;