summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte2010-03-27 05:32:10 +0100
committerHarald Welte2010-03-27 05:32:32 +0100
commitace2b08244058560bb155eaf9512603056a0f109 (patch)
tree8f7bf96b740cda1b030a8b8fd7d88bb43167a0e3
parentsercomm: ESCAPE every NUL (0x00) byte in the data stream (diff)
downloadosmocom-ace2b08244058560bb155eaf9512603056a0f109.tar.gz
osmocom-ace2b08244058560bb155eaf9512603056a0f109.tar.xz
osmocom-ace2b08244058560bb155eaf9512603056a0f109.zip
add L1CTL ECHO REQUEST code
-rw-r--r--include/l1a_l23_interface.h2
-rw-r--r--src/host/layer23/include/osmocom/l1ctl.h2
-rw-r--r--src/host/layer23/src/l1ctl.c54
3 files changed, 40 insertions, 18 deletions
diff --git a/include/l1a_l23_interface.h b/include/l1a_l23_interface.h
index 03f80a5..64ede92 100644
--- a/include/l1a_l23_interface.h
+++ b/include/l1a_l23_interface.h
@@ -32,6 +32,8 @@
#define L1CTL_DATA_REQ 7
#define L1CTL_RESET 8
#define L1CTL_PM_REQ 9 /* power measurement */
+#define L1CTL_ECHO_REQ 10
+#define L1CTL_ECHO_RESP 11
/*
* NOTE: struct size. We do add manual padding out of the believe
diff --git a/src/host/layer23/include/osmocom/l1ctl.h b/src/host/layer23/include/osmocom/l1ctl.h
index 0d5cba6..e4e76c0 100644
--- a/src/host/layer23/include/osmocom/l1ctl.h
+++ b/src/host/layer23/include/osmocom/l1ctl.h
@@ -19,6 +19,8 @@ int tx_ph_rach_req(struct osmocom_ms *ms);
/* Transmit L1CTL_DM_EST_REQ */
int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr);
+int l1ctl_tx_echo_req(struct osmocom_ms *ms, unsigned int len);
+
extern int osmo_send_l1(struct osmocom_ms *ms, struct msgb *msg);
diff --git a/src/host/layer23/src/l1ctl.c b/src/host/layer23/src/l1ctl.c
index 2e6e8e0..97009cb 100644
--- a/src/host/layer23/src/l1ctl.c
+++ b/src/host/layer23/src/l1ctl.c
@@ -212,23 +212,6 @@ int tx_ph_data_req(struct osmocom_ms *ms, struct msgb *msg,
return osmo_send_l1(ms, msg);
}
-/* Receive L1CTL_RESET */
-static int rx_l1_reset(struct osmocom_ms *ms)
-{
- struct msgb *msg;
- struct l1ctl_sync_new_ccch_req *req;
-
- msg = osmo_l1_alloc(L1CTL_NEW_CCCH_REQ);
- if (!msg)
- return -1;
-
- LOGP(DL1C, LOGL_INFO, "Layer1 Reset.\n");
- req = (struct l1ctl_sync_new_ccch_req *) msgb_put(msg, sizeof(*req));
- req->band_arfcn = osmo_make_band_arfcn(ms);
-
- return osmo_send_l1(ms, msg);
-}
-
/* Transmit L1CTL_RACH_REQ */
int tx_ph_rach_req(struct osmocom_ms *ms)
{
@@ -272,6 +255,41 @@ int tx_ph_dm_est_req(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr
return osmo_send_l1(ms, msg);
}
+int l1ctl_tx_echo_req(struct osmocom_ms *ms, unsigned int len)
+{
+ struct msgb *msg;
+ uint8_t *data;
+ unsigned int i;
+
+ msg = osmo_l1_alloc(L1CTL_ECHO_REQ);
+ if (!msg)
+ return -1;
+
+ data = msgb_put(msg, len);
+ for (i = 0; i < len; i++)
+ data[i] = i % 8;
+
+ return osmo_send_l1(ms, msg);
+}
+
+/* Receive L1CTL_RESET */
+static int rx_l1_reset(struct osmocom_ms *ms)
+{
+ struct msgb *msg;
+ struct l1ctl_sync_new_ccch_req *req;
+
+ msg = osmo_l1_alloc(L1CTL_NEW_CCCH_REQ);
+ if (!msg)
+ return -1;
+
+ LOGP(DL1C, LOGL_INFO, "Layer1 Reset.\n");
+ req = (struct l1ctl_sync_new_ccch_req *) msgb_put(msg, sizeof(*req));
+ req->band_arfcn = osmo_make_band_arfcn(ms);
+
+ return osmo_send_l1(ms, msg);
+}
+
+
/* Receive incoming data from L1 using L1CTL format */
int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
{
@@ -285,7 +303,7 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
return -1;
}
- l1h = (struct l1ctl_info_dl *) msg->l1h;
+ l1h = (struct l1ctl_hdr *) msg->l1h;
/* move the l1 header pointer to point _BEHIND_ l1ctl_hdr,
as the l1ctl header is of no interest to subsequent code */