aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-09 18:48:01 +0100
committerHarald Welte <laforge@gnumonks.org>2016-01-16 17:49:08 +0100
commit97cb71971a345c7e96502d4000afc468bc3dd3b8 (patch)
tree268dd65bc7551343fa02502eebcd6b1dd6e089b5
parentdd562d84bab5974f7b3505500bc9eced52252904 (diff)
TRX: Don't hard-code 23 bytes, use GSM_MACBLOCK_LEN
-rw-r--r--src/osmo-bts-trx/gsm0503_coding.c14
-rw-r--r--src/osmo-bts-trx/scheduler.c20
2 files changed, 17 insertions, 17 deletions
diff --git a/src/osmo-bts-trx/gsm0503_coding.c b/src/osmo-bts-trx/gsm0503_coding.c
index c56be5a..fde020e 100644
--- a/src/osmo-bts-trx/gsm0503_coding.c
+++ b/src/osmo-bts-trx/gsm0503_coding.c
@@ -772,7 +772,7 @@ coding_efr_fr:
h = 0;
break;
- case 23: /* FACCH */
+ case GSM_MACBLOCK_LEN: /* FACCH */
_xcch_encode_cB(cB, tch_data);
h = 1;
@@ -826,7 +826,7 @@ int tch_hr_decode(uint8_t *tch_data, sbit_t *bursts, int odd,
return -1;
}
- return 23;
+ return GSM_MACBLOCK_LEN;
}
for (i=0; i<4; i++)
@@ -884,7 +884,7 @@ int tch_hr_encode(ubit_t *bursts, uint8_t *tch_data, int len)
&h, i>>1);
break;
- case 23: /* FACCH */
+ case GSM_MACBLOCK_LEN: /* FACCH */
_xcch_encode_cB(cB, tch_data);
h = 1;
@@ -930,7 +930,7 @@ int tch_afs_decode(uint8_t *tch_data, sbit_t *bursts, int codec_mode_req,
return -1;
}
- return 23;
+ return GSM_MACBLOCK_LEN;
}
for (i=0; i<4; i++) {
@@ -1104,7 +1104,7 @@ int tch_afs_encode(ubit_t *bursts, uint8_t *tch_data, int len,
int i;
uint8_t id;
- if (len == 23) { /* FACCH */
+ if (len == GSM_MACBLOCK_LEN) { /* FACCH */
_xcch_encode_cB(cB, tch_data);
h = 1;
@@ -1293,7 +1293,7 @@ int tch_ahs_decode(uint8_t *tch_data, sbit_t *bursts, int odd,
return -1;
}
- return 23;
+ return GSM_MACBLOCK_LEN;
}
for (i=0; i<4; i++)
@@ -1459,7 +1459,7 @@ int tch_ahs_encode(ubit_t *bursts, uint8_t *tch_data, int len,
int i;
uint8_t id;
- if (len == 23) { /* FACCH */
+ if (len == GSM_MACBLOCK_LEN) { /* FACCH */
_xcch_encode_cB(cB, tch_data);
h = 1;
diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c
index bccc183..df91849 100644
--- a/src/osmo-bts-trx/scheduler.c
+++ b/src/osmo-bts-trx/scheduler.c
@@ -666,7 +666,7 @@ no_msg:
got_msg:
/* check validity of message */
- if (msgb_l2len(msg) != 23) {
+ if (msgb_l2len(msg) != GSM_MACBLOCK_LEN) {
LOGP(DL1C, LOGL_FATAL, "Prim not 23 bytes, please FIX! "
"(len=%d)\n", msgb_l2len(msg));
/* free message */
@@ -880,7 +880,7 @@ inval_mode1:
}
/* check validity of message */
- if (msg_facch && msgb_l2len(msg_facch) != 23) {
+ if (msg_facch && msgb_l2len(msg_facch) != GSM_MACBLOCK_LEN) {
LOGP(DL1C, LOGL_FATAL, "Prim not 23 bytes, please FIX! "
"(len=%d)\n", msgb_l2len(msg_facch));
/* free message */
@@ -1241,7 +1241,7 @@ static int rx_data_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
uint8_t *rssi_num = &chan_state->rssi_num;
float *toa_sum = &chan_state->toa_sum;
uint8_t *toa_num = &chan_state->toa_num;
- uint8_t l2[23], l2_len;
+ uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
int n_errors, n_bits_total;
int rc;
@@ -1316,7 +1316,7 @@ static int rx_data_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
trx_chan_desc[chan].name);
l2_len = 0;
} else
- l2_len = 23;
+ l2_len = GSM_MACBLOCK_LEN;
/* Send uplnk measurement information to L2 */
l1if_process_meas_res(l1h->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn,
@@ -1484,7 +1484,7 @@ static int rx_tchf_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
(float)n_errors/(float)n_bits_total);
amr = 2; /* we store tch_data + 2 header bytes */
/* only good speech frames get rtp header */
- if (rc != 23 && rc >= 4) {
+ if (rc != GSM_MACBLOCK_LEN && rc >= 4) {
rc = amr_compose_payload(tch_data,
chan_state->codec[chan_state->ul_cmr],
chan_state->codec[chan_state->ul_ft], 0);
@@ -1515,9 +1515,9 @@ static int rx_tchf_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
}
/* FACCH */
- if (rc == 23) {
+ if (rc == GSM_MACBLOCK_LEN) {
compose_ph_data_ind(l1h, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,
- tch_data + amr, 23, rssi);
+ tch_data + amr, GSM_MACBLOCK_LEN, rssi);
bfi:
if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {
/* indicate bad frame */
@@ -1646,7 +1646,7 @@ static int rx_tchh_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
(float)n_errors/(float)n_bits_total);
amr = 2; /* we store tch_data + 2 two */
/* only good speech frames get rtp header */
- if (rc != 23 && rc >= 4) {
+ if (rc != GSM_MACBLOCK_LEN && rc >= 4) {
rc = amr_compose_payload(tch_data,
chan_state->codec[chan_state->ul_cmr],
chan_state->codec[chan_state->ul_ft], 0);
@@ -1678,11 +1678,11 @@ static int rx_tchh_fn(struct trx_l1h *l1h, uint8_t tn, uint32_t fn,
}
/* FACCH */
- if (rc == 23) {
+ if (rc == GSM_MACBLOCK_LEN) {
chan_state->ul_ongoing_facch = 1;
compose_ph_data_ind(l1h, tn,
(fn + GSM_HYPERFRAME - 10 - ((fn % 26) >= 19)) % GSM_HYPERFRAME, chan,
- tch_data + amr, 23, rssi);
+ tch_data + amr, GSM_MACBLOCK_LEN, rssi);
bfi:
if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {
/* indicate bad frame */