diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Makefile.am | 4 | ||||
-rw-r--r-- | src/common/scheduler.c (renamed from src/osmo-bts-trx/scheduler.c) | 5 | ||||
-rw-r--r-- | src/osmo-bts-trx/Makefile.am | 6 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.h | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/main.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler.h | 175 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler_backend.h | 82 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler_trx.c | 4 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_vty.c | 2 |
11 files changed, 15 insertions, 271 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am index e577eba..fea205c 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -2,10 +2,12 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOTRAU_CFLAGS) LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOTRAU_LIBS) -noinst_LIBRARIES = libbts.a +noinst_LIBRARIES = libbts.a libl1sched.a libbts_a_SOURCES = gsm_data_shared.c sysinfo.c logging.c abis.c oml.c bts.c \ rsl.c vty.c paging.c measurement.c amr.c lchan.c \ load_indication.c pcu_sock.c handover.c msg_utils.c \ load_indication.c pcu_sock.c handover.c msg_utils.c \ tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \ l1sap.c cbch.c power_control.c main.c + +libl1sched_a_SOURCES = scheduler.c diff --git a/src/osmo-bts-trx/scheduler.c b/src/common/scheduler.c index dee46ed..64d89ac 100644 --- a/src/osmo-bts-trx/scheduler.c +++ b/src/common/scheduler.c @@ -35,9 +35,8 @@ #include <osmo-bts/logging.h> #include <osmo-bts/rsl.h> #include <osmo-bts/l1sap.h> - -#include "scheduler.h" -#include "scheduler_backend.h" +#include <osmo-bts/scheduler.h> +#include <osmo-bts/scheduler_backend.h> extern void *tall_bts_ctx; diff --git a/src/osmo-bts-trx/Makefile.am b/src/osmo-bts-trx/Makefile.am index 1644af6..0c0d281 100644 --- a/src/osmo-bts-trx/Makefile.am +++ b/src/osmo-bts-trx/Makefile.am @@ -2,10 +2,10 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(ORTP_CFLAGS) LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) $(ORTP_LIBS) -EXTRA_DIST = trx_if.h l1_if.h scheduler.h scheduler_backend.h gsm0503_parity.h gsm0503_conv.h gsm0503_interleaving.h gsm0503_mapping.h gsm0503_coding.h gsm0503_tables.h loops.h amr.h +EXTRA_DIST = trx_if.h l1_if.h gsm0503_parity.h gsm0503_conv.h gsm0503_interleaving.h gsm0503_mapping.h gsm0503_coding.h gsm0503_tables.h loops.h amr.h bin_PROGRAMS = osmobts-trx -osmobts_trx_SOURCES = main.c trx_if.c l1_if.c scheduler.c scheduler_trx.c trx_vty.c gsm0503_parity.c gsm0503_conv.c gsm0503_interleaving.c gsm0503_mapping.c gsm0503_coding.c gsm0503_tables.c loops.c amr.c -osmobts_trx_LDADD = $(top_builddir)/src/common/libbts.a $(LDADD) +osmobts_trx_SOURCES = main.c trx_if.c l1_if.c scheduler_trx.c trx_vty.c gsm0503_parity.c gsm0503_conv.c gsm0503_interleaving.c gsm0503_mapping.c gsm0503_coding.c gsm0503_tables.c loops.c amr.c +osmobts_trx_LDADD = $(top_builddir)/src/common/libbts.a $(top_builddir)/src/common/libl1sched.a $(LDADD) diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 70a5c59..edd4b7b 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -36,10 +36,10 @@ #include <osmo-bts/bts_model.h> #include <osmo-bts/amr.h> #include <osmo-bts/abis.h> +#include <osmo-bts/scheduler.h> #include "l1_if.h" #include "trx_if.h" -#include "scheduler.h" static const uint8_t transceiver_chan_types[_GSM_PCHAN_MAX] = { diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h index 6dec273..f492687 100644 --- a/src/osmo-bts-trx/l1_if.h +++ b/src/osmo-bts-trx/l1_if.h @@ -1,7 +1,7 @@ #ifndef L1_IF_H_TRX #define L1_IF_H_TRX -#include "scheduler.h" +#include <osmo-bts/scheduler.h> struct trx_config { uint8_t poweron; /* poweron(1) or poweroff(0) */ diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c index 6c2dabf..aa6987c 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -53,10 +53,10 @@ #include <osmo-bts/pcu_if.h> #include <osmo-bts/l1sap.h> #include <osmo-bts/control_if.h> +#include <osmo-bts/scheduler.h> #include "l1_if.h" #include "trx_if.h" -#include "scheduler.h" int bts_model_init(struct gsm_bts *bts) { diff --git a/src/osmo-bts-trx/scheduler.h b/src/osmo-bts-trx/scheduler.h deleted file mode 100644 index 13ef051..0000000 --- a/src/osmo-bts-trx/scheduler.h +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef TRX_SCHEDULER_H -#define TRX_SCHEDULER_H - -/* 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 l1sched_chan_state { - /* scheduler */ - uint8_t active; /* Channel is active */ - 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 */ - - /* RSSI / TOA */ - uint8_t rssi_num; /* number of RSSI values */ - float rssi_sum; /* sum of RSSI values */ - uint8_t toa_num; /* number of TOA values */ - float toa_sum; /* sum of TOA values */ - - /* loss detection */ - uint8_t lost; /* (SACCH) loss detection */ - - /* mode */ - uint8_t rsl_cmode, tch_mode; /* mode for TCH channels */ - - /* AMR */ - uint8_t codec[4]; /* 4 possible codecs for amr */ - int codecs; /* number of possible codecs */ - float ber_sum; /* sum of bit error rates */ - int ber_num; /* number of bit error rates */ - uint8_t ul_ft; /* current uplink FT index */ - uint8_t dl_ft; /* current downlink FT index */ - uint8_t ul_cmr; /* current uplink CMR index */ - uint8_t dl_cmr; /* current downlink CMR index */ - uint8_t amr_loop; /* if AMR loop is enabled */ - - /* TCH/H */ - uint8_t dl_ongoing_facch; /* FACCH/H on downlink */ - uint8_t ul_ongoing_facch; /* FACCH/H on uplink */ - - /* encryption */ - int ul_encr_algo; /* A5/x encry algo downlink */ - int dl_encr_algo; /* A5/x encry algo uplink */ - int ul_encr_key_len; - int dl_encr_key_len; - uint8_t ul_encr_key[MAX_A5_KEY_LEN]; - uint8_t dl_encr_key[MAX_A5_KEY_LEN]; - - /* measurements */ - struct { - uint8_t clock; /* cyclic clock counter */ - int8_t rssi[32]; /* last RSSI values */ - int rssi_count; /* received RSSI values */ - int rssi_valid_count; /* number of stored value */ - int rssi_got_burst; /* any burst received so far */ - float toa_sum; /* sum of TOA values */ - int toa_num; /* number of TOA value */ - } meas; - - /* handover */ - uint8_t ho_rach_detect; /* if rach detection is on */ -}; - -struct l1sched_ts { - uint8_t mf_index; /* selected multiframe index */ - uint32_t mf_last_fn; /* last received frame number */ - uint8_t mf_period; /* period of multiframe */ - const struct trx_sched_frame *mf_frames; /* pointer to frame layout */ - - struct llist_head dl_prims; /* Queue primitves for TX */ - - /* Channel states for all logical channels */ - struct l1sched_chan_state chan_state[_TRX_CHAN_MAX]; -}; - -struct l1sched_trx { - struct gsm_bts_trx *trx; - struct l1sched_ts ts[TRX_NR_TS]; -}; - -struct l1sched_ts *l1sched_trx_get_ts(struct l1sched_trx *l1t, uint8_t tn); - -/*! \brief how many frame numbers in advance we should send bursts to PHY */ -extern uint32_t trx_clock_advance; -/*! \brief advance RTS.ind to L2 by that many clocks */ -extern uint32_t trx_rts_advance; -/*! \brief last frame number as received from PHY */ -extern uint32_t transceiver_last_fn; - - -/*! \brief Initialize the scheudler data structures */ -int trx_sched_init(struct l1sched_trx *l1t); - -/*! \brief De-initialize the scheudler data structures */ -void trx_sched_exit(struct l1sched_trx *l1t); - -/*! \brief Handle a PH-DATA.req from L2 down to L1 */ -int trx_sched_ph_data_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap); - -/*! \brief Handle a PH-TCH.req from L2 down to L1 */ -int trx_sched_tch_req(struct l1sched_trx *l1t, struct osmo_phsap_prim *l1sap); - -/*! \brief PHY informs us of new (current) GSM freme nunmber */ -int trx_sched_clock(struct gsm_bts *bts, uint32_t fn); - -/*! \brief handle an UL burst received by PHY */ -int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - sbit_t *bits, int8_t rssi, float toa); - -/*! \brief set multiframe scheduler to given physical channel config */ -int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn, - enum gsm_phys_chan_config pchan); - -/*! \brief set all matching logical channels active/inactive */ -int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_id, - int active); - -/*! \brief set mode of all matching logical channels to given mode(s) */ -int trx_sched_set_mode(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t rsl_cmode, - uint8_t tch_mode, int codecs, uint8_t codec0, uint8_t codec1, - uint8_t codec2, uint8_t codec3, uint8_t initial_codec, - uint8_t handover); - -/*! \brief set ciphering on given logical channels */ -int trx_sched_set_cipher(struct l1sched_trx *l1t, uint8_t chan_nr, int downlink, - int algo, uint8_t *key, int key_len); - -/* \brief close all logical channels and reset timeslots */ -void trx_sched_reset(struct l1sched_trx *l1t); - -#endif /* TRX_SCHEDULER_H */ diff --git a/src/osmo-bts-trx/scheduler_backend.h b/src/osmo-bts-trx/scheduler_backend.h deleted file mode 100644 index 9f663cd..0000000 --- a/src/osmo-bts-trx/scheduler_backend.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -typedef int trx_sched_rts_func(struct l1sched_trx *l1t, uint8_t tn, - uint32_t fn, enum trx_chan_type chan); - -typedef ubit_t *trx_sched_dl_func(struct l1sched_trx *l1t, uint8_t tn, - uint32_t fn, enum trx_chan_type chan, - uint8_t bid); - -typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn, - uint32_t fn, enum trx_chan_type chan, - uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); - -struct trx_chan_desc { - /*! \brief Is this on a PDCH (PS) ? */ - int pdch; - /*! \brief TRX Channel Type */ - enum trx_chan_type chan; - /*! \brief Channel Number (like in RSL) */ - uint8_t chan_nr; - /*! \brief Link ID (like in RSL) */ - uint8_t link_id; - /*! \brief Human-readable name */ - const char *name; - /*! \brief function to call when we want to generate RTS.req to L2 */ - trx_sched_rts_func *rts_fn; - /*! \brief function to call when DATA.req received from L2 */ - trx_sched_dl_func *dl_fn; - /*! \brief function to call when burst received from PHY */ - trx_sched_ul_func *ul_fn; - /*! \breif is this channel automatically active at start? */ - int auto_active; -}; -extern const struct trx_chan_desc trx_chan_desc[_TRX_CHAN_MAX]; - -extern const ubit_t _sched_tsc[8][26]; -const ubit_t _sched_fcch_burst[148]; -const ubit_t _sched_sch_train[64]; - -struct msgb *_sched_dequeue_prim(struct l1sched_trx *l1t, int8_t tn, uint32_t fn, - enum trx_chan_type chan); - -int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi); - -int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len); - -ubit_t *tx_idle_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_fcch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_sch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -ubit_t *tx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid); -int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); -int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); -int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); -int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); -int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t bid, sbit_t *bits, int8_t rssi, - float toa); - -const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn); -int _sched_rts(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn); -void _sched_act_rach_det(struct l1sched_trx *l1t, uint8_t tn, uint8_t ss, int activate); diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 5629a64..ac9212b 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -38,10 +38,10 @@ #include <osmo-bts/rsl.h> #include <osmo-bts/l1sap.h> #include <osmo-bts/amr.h> +#include <osmo-bts/scheduler.h> +#include <osmo-bts/scheduler_backend.h> #include "l1_if.h" -#include "scheduler.h" -#include "scheduler_backend.h" #include "gsm0503_coding.h" #include "trx_if.h" #include "loops.h" diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index c9cfaef..dbe6f68 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -36,10 +36,10 @@ #include <osmo-bts/logging.h> #include <osmo-bts/bts.h> +#include <osmo-bts/scheduler.h> #include "l1_if.h" #include "trx_if.h" -#include "scheduler.h" /* enable to print RSSI level graph */ //#define TOA_RSSI_DEBUG diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c index 5da0c21..a4a7909 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -39,9 +39,9 @@ #include <osmo-bts/gsm_data.h> #include <osmo-bts/logging.h> #include <osmo-bts/vty.h> +#include <osmo-bts/scheduler.h> #include "l1_if.h" -#include "scheduler.h" #include "trx_if.h" #include "loops.h" |