diff options
-rw-r--r-- | src/host/trxcon/sched_trx.c | 13 | ||||
-rw-r--r-- | src/host/trxcon/sched_trx.h | 2 | ||||
-rw-r--r-- | src/host/trxcon/scheduler.h | 2 | ||||
-rw-r--r-- | src/host/trxcon/trxcon.c | 11 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index b7ebfeb2..02da2412 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -75,8 +75,14 @@ static void sched_frame_clck_cb(struct trx_sched *sched) if (llist_empty(&ts->tx_prims)) continue; + /** + * Advance frame number, giving the transceiver more + * time until a burst must be transmitted... + */ + fn = (sched->fn_counter_proc + sched->fn_counter_advance) + % GSM_HYPERFRAME; + /* Get frame from multiframe */ - fn = sched->fn_counter_proc; offset = fn % ts->mf_layout->period; frame = ts->mf_layout->frames + offset; @@ -103,7 +109,7 @@ static void sched_frame_clck_cb(struct trx_sched *sched) } } -int sched_trx_init(struct trx_instance *trx) +int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance) { struct trx_sched *sched; @@ -122,6 +128,9 @@ int sched_trx_init(struct trx_instance *trx) sched = &trx->sched; sched->data = trx; + /* Set frame counter advance */ + sched->fn_counter_advance = fn_advance; + return 0; } diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index 9d038fbe..e1ef9244 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -246,7 +246,7 @@ const struct trx_multiframe *sched_mframe_layout( enum gsm_phys_chan_config config, int tn); /* Scheduler management functions */ -int sched_trx_init(struct trx_instance *trx); +int sched_trx_init(struct trx_instance *trx, uint32_t fn_advance); int sched_trx_reset(struct trx_instance *trx, int reset_clock); int sched_trx_shutdown(struct trx_instance *trx); diff --git a/src/host/trxcon/scheduler.h b/src/host/trxcon/scheduler.h index b025d918..f36c3b2b 100644 --- a/src/host/trxcon/scheduler.h +++ b/src/host/trxcon/scheduler.h @@ -24,6 +24,8 @@ struct trx_sched { struct timeval clock; /*! \brief Count of processed frames */ uint32_t fn_counter_proc; + /*! \brief Local frame counter advance */ + uint32_t fn_counter_advance; /*! \brief Frame counter */ uint32_t fn_counter_lost; /*! \brief Frame callback timer */ diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c index 4a571b9a..07ab1698 100644 --- a/src/host/trxcon/trxcon.c +++ b/src/host/trxcon/trxcon.c @@ -69,6 +69,7 @@ static struct { struct trx_instance *trx; const char *trx_ip; uint16_t trx_base_port; + uint32_t trx_fn_advance; } app_data; void *tall_trx_ctx = NULL; @@ -143,6 +144,7 @@ static void print_help(void) printf(" -d --debug Change debug flags. Default: %s\n", DEBUG_DEFAULT); printf(" -i --trx-ip IP address of host runing TRX (default 127.0.0.1)\n"); printf(" -p --trx-port Base port of TRX instance (default 5700)\n"); + printf(" -f --trx-advance Scheduler clock advance (default 20)\n"); printf(" -s --socket Listening socket for layer23 (default /tmp/osmocom_l2)\n"); printf(" -D --daemonize Run as daemon\n"); } @@ -157,11 +159,12 @@ static void handle_options(int argc, char **argv) {"socket", 1, 0, 's'}, {"trx-ip", 1, 0, 'i'}, {"trx-port", 1, 0, 'p'}, + {"trx-advance", 1, 0, 'f'}, {"daemonize", 0, 0, 'D'}, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "d:i:p:s:Dh", + c = getopt_long(argc, argv, "d:i:p:f:s:Dh", long_options, &option_index); if (c == -1) break; @@ -181,6 +184,9 @@ static void handle_options(int argc, char **argv) case 'p': app_data.trx_base_port = atoi(optarg); break; + case 'f': + app_data.trx_fn_advance = atoi(optarg); + break; case 's': app_data.bind_socket = optarg; break; @@ -198,6 +204,7 @@ static void init_defaults(void) app_data.bind_socket = "/tmp/osmocom_l2"; app_data.trx_ip = "127.0.0.1"; app_data.trx_base_port = 5700; + app_data.trx_fn_advance = 20; app_data.debug_mask = NULL; app_data.daemonize = 0; @@ -263,7 +270,7 @@ int main(int argc, char **argv) app_data.trx->l1l = app_data.l1l; /* Init scheduler */ - rc = sched_trx_init(app_data.trx); + rc = sched_trx_init(app_data.trx, app_data.trx_fn_advance); if (rc) goto exit; |