aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/bts.h8
-rw-r--r--src/osmo-bsc/bts.c13
-rw-r--r--src/osmo-bsc/bts_trx.c7
3 files changed, 28 insertions, 0 deletions
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 7d070af2e..aef0e0384 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -178,7 +178,15 @@ struct gsm_bts_model {
const char *name;
bool started;
+ /* start the model itself */
int (*start)(struct gsm_network *net);
+
+ /* initialize a single BTS for this model */
+ int (*bts_init)(struct gsm_bts *bts);
+
+ /* initialize a single TRX for this model */
+ int (*trx_init)(struct gsm_bts_trx *trx);
+
int (*oml_rcvmsg)(struct msgb *msg);
char * (*oml_status)(const struct gsm_bts *bts);
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 747e8b7cc..39122ae03 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -503,6 +503,19 @@ int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
model->started = true;
}
+ if (model->bts_init) {
+ int rc = model->bts_init(bts);
+ if (rc < 0)
+ return rc;
+ }
+
+ /* handle those TRX which are already allocated at the time we set the type */
+ if (model->trx_init) {
+ struct gsm_bts_trx *trx;
+ llist_for_each_entry(trx, &bts->trx_list, list)
+ model->trx_init(trx);
+ }
+
switch (bts->type) {
case GSM_BTS_TYPE_OSMOBTS:
/* Enable dynamic Uplink power control by default */
diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c
index 0e5223874..6d98929b5 100644
--- a/src/osmo-bsc/bts_trx.c
+++ b/src/osmo-bsc/bts_trx.c
@@ -120,6 +120,13 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
if (trx->nr != 0)
trx->nominal_power = bts->c0->nominal_power;
+ if (bts->model && bts->model->trx_init) {
+ if (bts->model->trx_init(trx) < 0) {
+ talloc_free(trx);
+ return NULL;
+ }
+ }
+
llist_add_tail(&trx->list, &bts->trx_list);
return trx;