blob: 0b56cc06644975436d74db4e8719a65d26e153a9 [file] [log] [blame]
Philipp Maier4bac3982023-02-03 16:52:42 +01001#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5#include <osmocom/abis/e1_input.h>
6#include <osmocom/trau/trau_pcu_ericsson.h>
7
8struct er_ccu_descr;
9struct e1_conn_pars;
10typedef void (er_ccu_empty) (struct er_ccu_descr *ccu_descr);
11typedef void (er_ccu_rx) (struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits);
12
13struct er_ccu_descr {
14
15 /* E1-line and timeslot (filled in by user) */
16 struct e1_conn_pars *e1_conn_pars;
17
18 /* Callback functions (provided by user) */
19 er_ccu_empty *er_ccu_empty_cb;
20 er_ccu_rx *er_ccu_rx_cb;
21
22 /* I.460 Subslot */
23 struct {
24 struct osmo_i460_schan_desc scd;
25 struct osmo_i460_subchan *schan;
26 struct osmo_fsm_inst *trau_sync_fi;
27 bool ccu_connected;
28 } link;
29
30 /* TRAU Sync state */
31 struct {
32 uint32_t pseq_ccu; /* CCU sequence counter (remote) */
33 uint32_t pseq_pcu; /* PCU sequence counter (local) */
34 uint32_t last_afn_ul; /* Adjusted frame number, uplink */
35 uint32_t last_afn_dl; /* Adjusted frame number, downlink */
36 enum time_adj_val tav; /* Last time adjustment value */
37 bool ul_frame_err; /* True when last uplink TRAU frame was bad */
38 bool ccu_synced; /* True when PCU is in sync with CCU */
39 } sync;
40
41 /* PCU related context */
42 struct {
43 uint8_t trx_no;
44 uint8_t bts_nr;
45 uint8_t ts;
46 } pcu;
47
48
49};