summaryrefslogtreecommitdiffstats
path: root/src/host/layer23
diff options
context:
space:
mode:
authorAndreas.Eversberg2010-07-13 16:12:54 +0200
committerAndreas.Eversberg2010-07-13 16:12:54 +0200
commitf7c137660ac5ada1830c1cacd8f4c1746bb6b8ef (patch)
tree99d16195487359b3553692cadc1ee98b347f2648 /src/host/layer23
parent[layer 1] L1CTL_PARAM_REQ is introduced to change TX power and TA. (diff)
downloadosmocom-f7c137660ac5ada1830c1cacd8f4c1746bb6b8ef.tar.gz
osmocom-f7c137660ac5ada1830c1cacd8f4c1746bb6b8ef.tar.xz
osmocom-f7c137660ac5ada1830c1cacd8f4c1746bb6b8ef.zip
[layer23] Updating l1ctl.c to current L1<->L2 API.
Diffstat (limited to 'src/host/layer23')
-rw-r--r--src/host/layer23/include/osmocom/l1ctl.h15
-rw-r--r--src/host/layer23/src/l1ctl.c65
-rw-r--r--src/host/layer23/src/layer3.c2
-rw-r--r--src/host/layer23/src/rslms.c2
4 files changed, 52 insertions, 32 deletions
diff --git a/src/host/layer23/include/osmocom/l1ctl.h b/src/host/layer23/include/osmocom/l1ctl.h
index e5b91e7..9e76382 100644
--- a/src/host/layer23/include/osmocom/l1ctl.h
+++ b/src/host/layer23/include/osmocom/l1ctl.h
@@ -10,18 +10,21 @@ struct osmocom_ms;
int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg);
/* Transmit L1CTL_DATA_REQ */
-int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
- uint8_t chan_nr, uint8_t link_id);
+int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg, uint8_t chan_nr,
+ uint8_t link_id);
+
+/* Transmit L1CTL_PARAM_REQ */
+int l1ctl_tx_ph_param_req(struct osmocom_ms *ms, uint8_t ta, uint8_t tx_power);
/* Transmit L1CTL_RACH_REQ */
-int tx_ph_rach_req(struct osmocom_ms *ms);
+int tx_ph_rach_req(struct osmocom_ms *ms, uint8_t ra, uint8_t fn51,
+ uint8_t mf_off);
/* Transmit L1CTL_DM_EST_REQ */
int tx_ph_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
- uint8_t chan_nr, uint8_t tsc, uint8_t tx_power);
+ uint8_t chan_nr, uint8_t tsc);
int tx_ph_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
- uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc,
- uint8_t tx_power);
+ uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc);
/* Transmit L1CTL_DM_REL_REQ */
int tx_ph_dm_rel_req(struct osmocom_ms *ms);
diff --git a/src/host/layer23/src/l1ctl.c b/src/host/layer23/src/l1ctl.c
index 8d5e569..5bb375c 100644
--- a/src/host/layer23/src/l1ctl.c
+++ b/src/host/layer23/src/l1ctl.c
@@ -106,19 +106,17 @@ static int rx_l1_fbsb_conf(struct osmocom_ms *ms, struct msgb *msg)
static int rx_l1_rach_conf(struct osmocom_ms *ms, struct msgb *msg)
{
struct l1ctl_info_dl *dl;
- struct osmobb_rach_conf rc;
- if (msgb_l3len(msg) < sizeof(*dl)) {
+ if (msgb_l2len(msg) < sizeof(*dl)) {
LOGP(DL1C, LOGL_ERROR, "RACH CONF: MSG too short %u\n",
msgb_l3len(msg));
+ msgb_free(msg);
return -1;
}
dl = (struct l1ctl_info_dl *) msg->l1h;
- rc.fn = htonl(dl->frame_nr);
- rc.ms = ms;
- dispatch_signal(SS_L1CTL, S_L1CTL_RACH_CONF, &rc);
+ l2_ph_chan_conf(msg, ms, dl);
return 0;
}
@@ -229,8 +227,8 @@ static int rx_ph_data_conf(struct osmocom_ms *ms, struct msgb *msg)
}
/* Transmit L1CTL_DATA_REQ */
-int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
- uint8_t chan_nr, uint8_t link_id)
+int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg, uint8_t chan_nr,
+ uint8_t link_id)
{
struct l1ctl_hdr *l1h;
struct l1ctl_info_ul *l1i_ul;
@@ -260,9 +258,6 @@ int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
l1i_ul->chan_nr = chan_nr;
l1i_ul->link_id = link_id;
- /* FIXME: where to get this from? */
- l1i_ul->tx_power = 0;
-
/* prepend l1 header */
msg->l1h = msgb_push(msg, sizeof(*l1h));
l1h = (struct l1ctl_hdr *) msg->l1h;
@@ -279,6 +274,8 @@ int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
struct msgb *msg;
struct l1ctl_fbsb_req *req;
+ printf("Sync Req\n");
+
msg = osmo_l1_alloc(L1CTL_FBSB_REQ);
if (!msg)
return -1;
@@ -305,6 +302,8 @@ int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode)
struct msgb *msg;
struct l1ctl_ccch_mode_req *req;
+ printf("CCCH Mode Req\n");
+
msg = osmo_l1_alloc(L1CTL_CCCH_MODE_REQ);
if (!msg)
return -1;
@@ -315,29 +314,51 @@ int l1ctl_tx_ccch_mode_req(struct osmocom_ms *ms, uint8_t ccch_mode)
return osmo_send_l1(ms, msg);
}
+/* Transmit L1CTL_PARAM_REQ */
+int l1ctl_tx_ph_param_req(struct osmocom_ms *ms, uint8_t ta, uint8_t tx_power)
+{
+ struct msgb *msg;
+ struct l1ctl_info_ul *ul;
+ struct l1ctl_par_req *req;
+
+ msg = osmo_l1_alloc(L1CTL_PARAM_REQ);
+ if (!msg)
+ return -1;
+
+ DEBUGP(DL1C, "PARAM Req. ta=%d, tx_power=%d\n", ta, tx_power);
+ ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
+ req = (struct l1ctl_par_req *) msgb_put(msg, sizeof(*req));
+ req->tx_power = tx_power;
+ req->ta = ta;
+
+ return osmo_send_l1(ms, msg);
+}
+
/* Transmit L1CTL_RACH_REQ */
-int tx_ph_rach_req(struct osmocom_ms *ms)
+int tx_ph_rach_req(struct osmocom_ms *ms, uint8_t ra, uint8_t fn51,
+ uint8_t mf_off)
{
struct msgb *msg;
struct l1ctl_info_ul *ul;
struct l1ctl_rach_req *req;
- static uint8_t i = 0;
msg = osmo_l1_alloc(L1CTL_RACH_REQ);
if (!msg)
return -1;
- DEBUGP(DL1C, "RACH Req.\n");
+ DEBUGP(DL1C, "RACH Req. fn51=%d, mf_off=%d\n", fn51, mf_off);
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
req = (struct l1ctl_rach_req *) msgb_put(msg, sizeof(*req));
- req->ra = i++;
+ req->ra = ra;
+ req->fn51 = fn51;
+ req->mf_off = mf_off;
return osmo_send_l1(ms, msg);
}
/* Transmit L1CTL_DM_EST_REQ */
int tx_ph_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
- uint8_t chan_nr, uint8_t tsc, uint8_t tx_power)
+ uint8_t chan_nr, uint8_t tsc)
{
struct msgb *msg;
struct l1ctl_info_ul *ul;
@@ -347,13 +368,12 @@ int tx_ph_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
if (!msg)
return -1;
- DEBUGP(DL1C, "Tx Dedic.Mode Est Req (arfcn=%u, chan_nr=0x%02x)\n",
+ printf("Tx Dedic.Mode Est Req (arfcn=%u, chan_nr=0x%02x)\n",
band_arfcn, chan_nr);
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
ul->chan_nr = chan_nr;
ul->link_id = 0;
- ul->tx_power = tx_power;
req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
req->tsc = tsc;
@@ -364,8 +384,7 @@ int tx_ph_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
}
int tx_ph_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
- uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc,
- uint8_t tx_power)
+ uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc)
{
struct msgb *msg;
struct l1ctl_info_ul *ul;
@@ -376,13 +395,12 @@ int tx_ph_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
if (!msg)
return -1;
- DEBUGP(DL1C, "Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
+ printf("Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
"chan_nr=0x%02x)\n", maio, hsn, chan_nr);
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
ul->chan_nr = chan_nr;
ul->link_id = 0;
- ul->tx_power = tx_power;
req = (struct l1ctl_dm_est_req *) msgb_put(msg, sizeof(*req));
req->tsc = tsc;
@@ -406,7 +424,7 @@ int tx_ph_dm_rel_req(struct osmocom_ms *ms)
if (!msg)
return -1;
- DEBUGP(DL1C, "Tx Dedic.Mode Rel Req\n");
+ printf("Tx Dedic.Mode Rel Req\n");
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
@@ -470,7 +488,7 @@ int l1ctl_tx_reset_req(struct osmocom_ms *ms, uint8_t type)
/* Receive L1CTL_RESET_IND */
static int rx_l1_reset(struct osmocom_ms *ms)
{
- printf("Layer1 Reset.\n");
+ printf("Layer1 Reset indication\n");
dispatch_signal(SS_L1CTL, S_L1CTL_RESET, ms);
return 0;
@@ -561,7 +579,6 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
break;
case L1CTL_RACH_CONF:
rc = rx_l1_rach_conf(ms, msg);
- msgb_free(msg);
break;
case L1CTL_CCCH_MODE_CONF:
rc = rx_l1_ccch_mode_conf(ms, msg);
diff --git a/src/host/layer23/src/layer3.c b/src/host/layer23/src/layer3.c
index 978ea10..0680afb 100644
--- a/src/host/layer23/src/layer3.c
+++ b/src/host/layer23/src/layer3.c
@@ -188,7 +188,7 @@ static int gsm48_rx_imm_ass(struct msgb *msg, struct osmocom_ms *ms)
/* request L1 to go to dedicated mode on assigned channel */
tx_ph_dm_est_req_h0(ms, arfcn, ia->chan_desc.chan_nr,
- ia->chan_desc.h0.tsc, 0);
+ ia->chan_desc.h0.tsc);
/* request L2 to establish the SAPI0 connection */
gsm48_tx_loc_upd_req(ms, ia->chan_desc.chan_nr);
diff --git a/src/host/layer23/src/rslms.c b/src/host/layer23/src/rslms.c
index f8e1566..9092078 100644
--- a/src/host/layer23/src/rslms.c
+++ b/src/host/layer23/src/rslms.c
@@ -81,7 +81,7 @@ static int rslms_rx_udata_ind(struct msgb *msg, struct osmocom_ms *ms)
} else if (rllh->chan_nr == RSL_CHAN_BCCH) {
rc = gsm48_rx_bcch(msg, ms);
if (ccch_enabled && (rach_count < 2)) {
- tx_ph_rach_req(ms);
+ tx_ph_rach_req(ms, rach_count, 27, 0);
rach_count++;
}
}