summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2011-07-17 09:36:49 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2011-07-17 09:36:49 +0200
commit87c597abf6ec605ea152a75e5f13d194955cad28 (patch)
tree0bf7fb306695849913e97df9617eaa4fda483ff6 /src
parent065b6e35a35e290450f3a7e2958c11cd4fd25131 (diff)
[layer23] Adding neighbour cell measurement to L1CTL interface.
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/common/l1ctl.h3
-rw-r--r--src/host/layer23/include/osmocom/bb/common/osmocom_data.h7
-rw-r--r--src/host/layer23/src/common/l1ctl.c43
3 files changed, 53 insertions, 0 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index 1703d26c..faa12d5b 100644
--- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h
+++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
@@ -66,4 +66,7 @@ int l1ctl_tx_sim_req(struct osmocom_ms *ms, uint8_t *data, uint16_t length);
/* LAPDm wants to send a PH-* primitive to the physical layer (L1) */
int l1ctl_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
+/* Transmit L1CTL_NEIGH_PM_REQ */
+int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn);
+
#endif
diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
index de25af58..6af5ca49 100644
--- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
+++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
@@ -76,6 +76,7 @@ enum osmobb_l1ctl_sig {
S_L1CTL_CCCH_MODE_CONF,
S_L1CTL_TCH_MODE_CONF,
S_L1CTL_LOSS_IND,
+ S_L1CTL_NEIGH_PM_IND,
};
enum osmobb_global_sig {
@@ -104,4 +105,10 @@ struct osmobb_tch_mode_conf {
uint8_t tch_mode;
};
+struct osmobb_neigh_pm_ind {
+ struct osmocom_ms *ms;
+ uint16_t band_arfcn;
+ uint8_t rx_lev;
+};
+
#endif
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index 867f5c53..bd7c67ed 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -732,6 +732,45 @@ static int rx_l1_tch_mode_conf(struct osmocom_ms *ms, struct msgb *msg)
return 0;
}
+/* Transmit L1CTL_NEIGH_PM_REQ */
+int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn)
+{
+ struct msgb *msg;
+ struct l1ctl_neigh_pm_req *pm_req;
+ int i;
+
+ msg = osmo_l1_alloc(L1CTL_NEIGH_PM_REQ);
+ if (!msg)
+ return -1;
+
+ LOGP(DL1C, LOGL_INFO, "Tx NEIGH PM Req (num %u)\n", num);
+ pm_req = (struct l1ctl_neigh_pm_req *) msgb_put(msg, sizeof(*pm_req));
+ pm_req->n = num;
+ for (i = 0; i < num; i++)
+ pm_req->band_arfcn[i] = htons(*arfcn++);
+
+ return osmo_send_l1(ms, msg);
+}
+
+/* Receive L1CTL_NEIGH_PM_IND */
+static int rx_l1_neigh_pm_ind(struct osmocom_ms *ms, struct msgb *msg)
+{
+ struct l1ctl_neigh_pm_ind *pm_ind;
+
+ for (pm_ind = (struct l1ctl_neigh_pm_ind *) msg->l1h;
+ (uint8_t *) pm_ind < msg->tail; pm_ind++) {
+ struct osmobb_neigh_pm_ind mi;
+ DEBUGP(DL1C, "NEIGH_PM IND: ARFCN: %4u RxLev: %3d %3d\n",
+ ntohs(pm_ind->band_arfcn), pm_ind->pm[0],
+ pm_ind->pm[1]);
+ mi.band_arfcn = ntohs(pm_ind->band_arfcn);
+ mi.rx_lev = pm_ind->pm[0];
+ mi.ms = ms;
+ osmo_signal_dispatch(SS_L1CTL, S_L1CTL_NEIGH_PM_IND, &mi);
+ }
+ return 0;
+}
+
/* Receive incoming data from L1 using L1CTL format */
int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
{
@@ -788,6 +827,10 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
case L1CTL_SIM_CONF:
rc = rx_l1_sim_conf(ms, msg);
break;
+ case L1CTL_NEIGH_PM_IND:
+ rc = rx_l1_neigh_pm_ind(ms, msg);
+ msgb_free(msg);
+ break;
default:
LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", l1h->msg_type);
msgb_free(msg);