support for Ericsson RBS E1 CCU

Ericsson RBS series BTSs do not have a built in PCU. Rather than having
the PCU on board the PCU is co-located to the BSC in those cases. Just
like the MGW the PCU would connect to the CCU (Channel Coding Unit) via
E1 line. The PCU is connected via an unix domain socket (pcu_sock) to
the BSC to receive RACH requests and to control Paging and TBF assignment.

This patch adds all the required functionality to run an Ercisson RBS in
GPRS/EGPRS mode. It supports 16k I.460 E1 subslots and full 64k E1
timeslots (recommended)

Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d
Related: OS#5198
diff --git a/src/ericsson-rbs/er_ccu_descr.h b/src/ericsson-rbs/er_ccu_descr.h
new file mode 100644
index 0000000..0b56cc0
--- /dev/null
+++ b/src/ericsson-rbs/er_ccu_descr.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <osmocom/abis/e1_input.h>
+#include <osmocom/trau/trau_pcu_ericsson.h>
+
+struct er_ccu_descr;
+struct e1_conn_pars;
+typedef void (er_ccu_empty) (struct er_ccu_descr *ccu_descr);
+typedef void (er_ccu_rx) (struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits);
+
+struct er_ccu_descr {
+
+	/* E1-line and timeslot (filled in by user) */
+	struct e1_conn_pars *e1_conn_pars;
+
+	/* Callback functions (provided by user) */
+	er_ccu_empty *er_ccu_empty_cb;
+	er_ccu_rx *er_ccu_rx_cb;
+
+	/* I.460 Subslot */
+	struct {
+		struct osmo_i460_schan_desc scd;
+		struct osmo_i460_subchan *schan;
+		struct osmo_fsm_inst *trau_sync_fi;
+		bool ccu_connected;
+	} link;
+
+	/* TRAU Sync state */
+	struct {
+		uint32_t pseq_ccu; /* CCU sequence counter (remote) */
+		uint32_t pseq_pcu; /* PCU sequence counter (local) */
+		uint32_t last_afn_ul; /* Adjusted frame number, uplink */
+		uint32_t last_afn_dl; /* Adjusted frame number, downlink */
+		enum time_adj_val tav; /* Last time adjustment value */
+		bool ul_frame_err; /* True when last uplink TRAU frame was bad */
+		bool ccu_synced; /* True when PCU is in sync with CCU */
+	} sync;
+
+	/* PCU related context */
+	struct {
+		uint8_t trx_no;
+		uint8_t bts_nr;
+		uint8_t ts;
+	} pcu;
+
+
+};