diff options
Diffstat (limited to 'src/host/trxcon/src/sched_lchan_tchf.c')
-rw-r--r-- | src/host/trxcon/src/sched_lchan_tchf.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index 691ad5a5..a4aa80cb 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -75,9 +75,16 @@ int rx_tchf_fn(struct l1sched_lchan_state *lchan, LOGP_LCHAND(lchan, LOGL_DEBUG, "Traffic received: fn=%u bid=%u\n", bi->fn, bi->bid); - /* Align to the first burst of a block */ - if (*mask == 0x00 && bi->bid != 0) - return 0; + if (bi->bid == 0) { + /* Shift the burst buffer by 4 bursts leftwards */ + memcpy(&bursts_p[0], &bursts_p[464], 464); + memset(&bursts_p[464], 0, 464); + *mask = *mask << 4; + } else { + /* Align to the first burst of a block */ + if (*mask == 0x00) + return 0; + } /* Update mask */ *mask |= (1 << bi->bid); @@ -108,9 +115,6 @@ int rx_tchf_fn(struct l1sched_lchan_state *lchan, } - /* Keep the mask updated */ - *mask = *mask << 4; - switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* FR */ @@ -157,9 +161,6 @@ int rx_tchf_fn(struct l1sched_lchan_state *lchan, return -EINVAL; } - /* Shift buffer by 4 bursts for interleaving */ - memcpy(bursts_p, bursts_p + 464, 464); - /* Check decoding result */ if (rc < 4) { LOGP_LCHAND(lchan, LOGL_ERROR, @@ -227,8 +228,10 @@ int tx_tchf_fn(struct l1sched_lchan_state *lchan, if (br->bid > 0) goto send_burst; - /* Shift buffer by 4 bursts back for interleaving */ - memcpy(bursts_p, bursts_p + 464, 464); + /* Shift the burst buffer by 4 bursts leftwards for interleaving */ + memcpy(&bursts_p[0], &bursts_p[464], 464); + memset(&bursts_p[464], 0, 464); + *mask = *mask << 4; /* populate the buffer with bursts */ switch (lchan->tch_mode) { @@ -332,12 +335,9 @@ send_burst: LOGP_LCHAND(lchan, LOGL_DEBUG, "Scheduled fn=%u burst=%u\n", br->fn, br->bid); /* If we have sent the last (4/4) burst */ - if (*mask == 0x0f) { + if ((*mask & 0x0f) == 0x0f) { /* Confirm data / traffic sending (pass ownership of the prim) */ l1sched_lchan_emit_data_cnf(lchan, br->fn); - - /* Reset mask */ - *mask = 0x00; } return 0; |