aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_l1_if.cpp
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-05-13 16:45:21 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-05-13 16:45:21 +0200
commita004e6a8233695abd417a97d6f81a802b605038a (patch)
tree226ca73caa945b447f2c8fcd7be242a7f9b4f671 /src/pcu_l1_if.cpp
parent783aa4bcb8aab7fbcd1b91ad225018a06e950f50 (diff)
Added timing advance support for up and downlink TBFs
The timing advance of any TBF is stored when it ends. Whenever a new TBF with the same TLLI is created (downlink TBF), the stored TA is recalled. This algorithm assumes that the mobile does not move too fast during transfer. Also the mobile must start a connection in order to get correct initial timing advance. This algorithm does not implement the timing advance procedure as defined in TS 04.60. To implement the standard timing advance procedure, the BTS must decode RACH on certain bursts, the mobile is expected to send them. This requires much more complexity to a transceiver like USRP/UmTRX or Calypso BTS. The algorithm was tested at TA >= 8 and works quite well.
Diffstat (limited to 'src/pcu_l1_if.cpp')
-rw-r--r--src/pcu_l1_if.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index d7f5ec44..923070f1 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -516,6 +516,7 @@ bssgp_failed:
static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
{
struct gprs_rlcmac_tbf *tbf;
+ struct gprs_rlcmac_sba *sba, *sba2;
uint32_t elapsed;
uint8_t fn13 = time_ind->fn % 13;
@@ -531,18 +532,27 @@ static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
/* check for poll timeout */
llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) {
if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
- elapsed = (frame_number - tbf->poll_fn) % 2715648;
- if (elapsed >= 20 && elapsed < 200)
+ elapsed = (frame_number + 2715648 - tbf->poll_fn)
+ % 2715648;
+ if (elapsed >= 20 && elapsed < 2715400)
gprs_rlcmac_poll_timeout(tbf);
}
}
llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) {
if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
- elapsed = (frame_number - tbf->poll_fn) % 2715648;
- if (elapsed >= 20 && elapsed < 200)
+ elapsed = (frame_number + 2715648 - tbf->poll_fn)
+ % 2715648;
+ if (elapsed >= 20 && elapsed < 2715400)
gprs_rlcmac_poll_timeout(tbf);
}
}
+ llist_for_each_entry_safe(sba, sba2, &gprs_rlcmac_sbas, list) {
+ elapsed = (frame_number + 2715648 - sba->fn) % 2715648;
+ if (elapsed >= 20 && elapsed < 2715400) {
+ /* sba will be freed here */
+ gprs_rlcmac_sba_timeout(sba);
+ }
+ }
return 0;
}