summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-23 23:55:20 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-23 23:55:20 +0200
commit3538c38835b9120d7cf062fa533f7657768bf0d3 (patch)
tree5d1193b58c7c086fcda1a6c5127291439a70a11b /src/host/layer23/include
parent5d65fcba6caf949c910dd86e43e7d1bef3b219d2 (diff)
further decouple lapdm code from osmocom_ms and l1ctl
we introduce a new primitive layer betwen PH and DL, enabling the use of the LAPDm code in applications that are not based on L1CTL
Diffstat (limited to 'src/host/layer23/include')
-rw-r--r--src/host/layer23/include/osmocom/bb/common/l1ctl.h4
-rw-r--r--src/host/layer23/include/osmocom/bb/common/lapdm.h57
2 files changed, 54 insertions, 7 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index 7eb0c8cb..1703d26c 100644
--- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h
+++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
@@ -62,4 +62,8 @@ int l1ctl_tx_pm_req_range(struct osmocom_ms *ms, uint16_t arfcn_from,
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);
+
#endif
diff --git a/src/host/layer23/include/osmocom/bb/common/lapdm.h b/src/host/layer23/include/osmocom/bb/common/lapdm.h
index 7f39920d..b9669725 100644
--- a/src/host/layer23/include/osmocom/bb/common/lapdm.h
+++ b/src/host/layer23/include/osmocom/bb/common/lapdm.h
@@ -5,6 +5,52 @@
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/prim.h>
+
+/* primitive related sutff */
+
+enum osmo_ph_prim {
+ PRIM_PH_DATA, /* PH-DATA */
+ PRIM_PH_RACH, /* PH-RANDOM_ACCESS */
+ PRIM_PH_CONN, /* PH-CONNECT */
+ PRIM_PH_EMPTY_FRAME, /* PH-EMPTY_FRAME */
+ PRIM_PH_RTS, /* PH-RTS */
+};
+
+/* for PH-RANDOM_ACCESS.req */
+struct ph_rach_req_param {
+ uint8_t ra;
+ uint8_t ta;
+ uint8_t tx_power;
+ uint8_t is_combined_ccch;
+ uint16_t offset;
+};
+
+/* for PH-RANDOM_ACCESS.ind */
+struct ph_rach_ind_param {
+ uint8_t ra;
+ uint32_t fn;
+};
+
+/* for PH-[UNIT]DATA.{req,ind} */
+struct ph_data_param {
+ uint8_t link_id;
+ uint8_t chan_nr;
+};
+
+struct ph_conn_ind_param {
+ uint32_t fn;
+};
+
+struct osmo_phsap_prim {
+ struct osmo_prim_hdr oph;
+ union {
+ struct ph_data_param data;
+ struct ph_rach_req_param rach_req;
+ struct ph_rach_ind_param rach_ind;
+ struct ph_conn_ind_param conn_ind;
+ } u;
+};
enum lapdm_state {
LAPDm_STATE_NULL = 0,
@@ -70,7 +116,7 @@ struct lapdm_entity {
void *l1_ctx; /* context for layer1 instance */
void *l3_ctx; /* context for layer3 instance */
- lapdm_cb_t l1_cb; /* callback for sending stuff to L1 */
+ osmo_prim_cb l1_prim_cb;
lapdm_cb_t l3_cb; /* callback for sending stuff to L3 */
struct lapdm_channel *lapdm_ch;
@@ -96,15 +142,12 @@ void lapdm_entity_exit(struct lapdm_entity *le);
void lapdm_channel_exit(struct lapdm_channel *lc);
/* input into layer2 (from layer 1) */
-int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, uint8_t chan_nr, uint8_t link_id);
-int l2_ph_data_conf(struct msgb *msg, struct lapdm_entity *le);
-
-/* L1 confirms channel request */
-int l2_ph_chan_conf(struct msgb *msg, struct osmocom_ms *ms, uint32_t frame_nr);
+int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le);
/* input into layer2 (from layer 3) */
int lapdm_rslms_recvmsg(struct msgb *msg, struct lapdm_channel *lc);
-int osmol2_register_handler(struct osmocom_ms *ms, lapdm_cb_t cb);
+void lapdm_channel_set_l3(struct lapdm_channel *lc, lapdm_cb_t cb, void *ctx);
+void lapdm_channel_set_l1(struct lapdm_channel *lc, osmo_prim_cb cb, void *ctx);
#endif /* _OSMOCOM_LAPDM_H */