aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc/timeslot_fsm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmocom/bsc/timeslot_fsm.h')
-rw-r--r--include/osmocom/bsc/timeslot_fsm.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/osmocom/bsc/timeslot_fsm.h b/include/osmocom/bsc/timeslot_fsm.h
new file mode 100644
index 0000000..7ca9009
--- /dev/null
+++ b/include/osmocom/bsc/timeslot_fsm.h
@@ -0,0 +1,50 @@
+/* osmo-bsc API to manage timeslot status: init and switch of dynamic PDCH. */
+#pragma once
+
+#include <osmocom/bsc/gsm_data.h>
+
+/* This macro automatically includes a final \n, if omitted. */
+#define LOG_TS(ts, level, fmt, args...) do { \
+ if (ts->fi) \
+ LOGPFSML(ts->fi, level, "%s%s%s" fmt "%s", \
+ ts->pchan_is != ts->pchan_from_config ? "(pchan_is=" : "", \
+ ts->pchan_is != ts->pchan_from_config ? gsm_pchan_name(ts->pchan_is) : "", \
+ ts->pchan_is != ts->pchan_from_config ? ") " : "", \
+## args, \
+ (!fmt || !*fmt || fmt[strlen(fmt)-1] != '\n') ? "\n" : ""); \
+ else \
+ LOGP(DRSL, level, "%s" fmt "%s", \
+ gsm_ts_name(ts), \
+ ## args, \
+ (!fmt || !*fmt || fmt[strlen(fmt)-1] != '\n') ? "\n" : ""); \
+ } while(0)
+
+enum ts_fsm_state {
+ TS_ST_NOT_INITIALIZED,
+ TS_ST_UNUSED,
+ TS_ST_WAIT_PDCH_ACT,
+ TS_ST_PDCH,
+ TS_ST_WAIT_PDCH_DEACT,
+ TS_ST_IN_USE,
+ TS_ST_BORKEN,
+};
+
+enum ts_fsm_event {
+ TS_EV_OML_READY,
+ TS_EV_OML_DOWN,
+ TS_EV_RSL_READY,
+ TS_EV_RSL_DOWN,
+ TS_EV_LCHAN_REQUESTED,
+ TS_EV_LCHAN_UNUSED,
+ TS_EV_PDCH_ACT_ACK,
+ TS_EV_PDCH_ACT_NACK,
+ TS_EV_PDCH_DEACT_ACK,
+ TS_EV_PDCH_DEACT_NACK,
+};
+
+void ts_fsm_alloc(struct gsm_bts_trx_ts *ts);
+
+bool ts_is_capable_of_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pchan);
+bool ts_is_lchan_waiting_for_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config *target_pchan);
+bool ts_is_pchan_switching(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config *target_pchan);
+bool ts_usable_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan);