aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/l1_if.h
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-02-05 11:45:28 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2014-04-06 08:56:58 +0200
commitb469ff54b3102d81128a65c0c05d5ad480b5b1c3 (patch)
treed1cfc043e854fa20ea34c7d60d6d123061852c57 /src/osmo-bts-trx/l1_if.h
parente844e387ae888e5be5569530382767081ce07b3c (diff)
Introduce osmobts-trx, a layer 1 implementation for OpenBTS tranceivers
The code is quite complete, TCH and PDCH channels are not yet tested.
Diffstat (limited to 'src/osmo-bts-trx/l1_if.h')
-rw-r--r--src/osmo-bts-trx/l1_if.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
new file mode 100644
index 00000000..7e0f3688
--- /dev/null
+++ b/src/osmo-bts-trx/l1_if.h
@@ -0,0 +1,121 @@
+#ifndef L1_IF_H_TRX
+#define L1_IF_H_TRX
+
+/* These types define the different channels on a multiframe.
+ * Each channel has queues and can be activated individually.
+ */
+enum trx_chan_type {
+ TRXC_IDLE = 0,
+ TRXC_FCCH,
+ TRXC_SCH,
+ TRXC_BCCH,
+ TRXC_RACH,
+ TRXC_CCCH,
+ TRXC_TCHF,
+ TRXC_TCHH_0,
+ TRXC_TCHH_1,
+ TRXC_SDCCH4_0,
+ TRXC_SDCCH4_1,
+ TRXC_SDCCH4_2,
+ TRXC_SDCCH4_3,
+ TRXC_SDCCH8_0,
+ TRXC_SDCCH8_1,
+ TRXC_SDCCH8_2,
+ TRXC_SDCCH8_3,
+ TRXC_SDCCH8_4,
+ TRXC_SDCCH8_5,
+ TRXC_SDCCH8_6,
+ TRXC_SDCCH8_7,
+ TRXC_SACCHTF,
+ TRXC_SACCHTH_0,
+ TRXC_SACCHTH_1,
+ TRXC_SACCH4_0,
+ TRXC_SACCH4_1,
+ TRXC_SACCH4_2,
+ TRXC_SACCH4_3,
+ TRXC_SACCH8_0,
+ TRXC_SACCH8_1,
+ TRXC_SACCH8_2,
+ TRXC_SACCH8_3,
+ TRXC_SACCH8_4,
+ TRXC_SACCH8_5,
+ TRXC_SACCH8_6,
+ TRXC_SACCH8_7,
+ TRXC_PDTCH,
+ TRXC_PTCCH,
+ _TRX_CHAN_MAX
+};
+
+/* States each channel on a multiframe */
+struct trx_chan_state {
+ uint8_t dl_active; /* Channel is active for TX */
+ uint8_t ul_active; /* Channel is active for RX */
+ ubit_t *dl_bursts; /* burst buffer for TX */
+ sbit_t *ul_bursts; /* burst buffer for RX */
+ uint32_t ul_first_fn; /* fn of first burst */
+ uint8_t ul_mask; /* mask of received bursts */
+ uint8_t sacch_lost; /* SACCH loss detection */
+};
+
+struct trx_config {
+ uint8_t poweron; /* poweron(1) or poweroff(0) */
+ int poweron_sent;
+
+ int arfcn_valid;
+ uint16_t arfcn;
+ int arfcn_sent;
+
+ int tsc_valid;
+ uint8_t tsc;
+ int tsc_sent;
+
+ int bsic_valid;
+ uint8_t bsic;
+ int bsic_sent;
+
+ int rxgain_valid;
+ int rxgain;
+ int rxgain_sent;
+
+ int power_valid;
+ int power;
+ int power_sent;
+
+ int maxdly_valid;
+ int maxdly;
+ int maxdly_sent;
+
+ uint8_t slotmask;
+
+ int slottype_valid[8];
+ uint8_t slottype[8];
+ int slottype_sent[8];
+};
+
+struct trx_l1h {
+ struct llist_head trx_ctrl_list;
+
+ struct gsm_bts_trx *trx;
+
+ struct osmo_fd trx_ofd_ctrl;
+ struct osmo_timer_list trx_ctrl_timer;
+ struct osmo_fd trx_ofd_data;
+
+ /* tranceiver config */
+ struct trx_config config;
+
+ uint8_t mf_index[8]; /* selected multiframe index */
+
+ /* Channel states for all channels on all timeslots */
+ struct trx_chan_state chan_states[8][_TRX_CHAN_MAX];
+ struct llist_head dl_prims[8]; /* Queue primitves for TX */
+};
+
+struct trx_l1h *l1if_open(struct gsm_bts_trx *trx);
+void l1if_close(struct trx_l1h *l1h);
+void l1if_reset(struct trx_l1h *l1h);
+int l1if_provision_tranceiver_trx(struct trx_l1h *l1h);
+int l1if_provision_tranceiver(struct gsm_bts *bts);
+int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn);
+
+#endif /* L1_IF_H_TRX */