diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-06-01 22:54:15 +0700 |
---|---|---|
committer | laforge <laforge@gnumonks.org> | 2019-06-08 10:09:42 +0000 |
commit | 01c539284e85c5d907300e45548d497cca27217b (patch) | |
tree | 6acad2cf7d42282bccda8566eb55255d65eb3bc3 /include | |
parent | 2dec9fff1cc78dd70e23a752acb9e9d002527be7 (diff) |
common/scheduler.c: refactor description of TRXC_* lchans
Let's avoid fancy alignment in the description of logical channels
for the benefits of having better readability, the ability to add
more comments and fields without making it look ugly.
Get rid of value-string array 'trx_chan_type_names', since each
logical channel has its name defined in 'trx_chan_desc'.
Get rid of field 'chan' of 'trx_lchan_desc' structure since it's
not used anywhere, and not actually needed because the position
of each lchan description is defined by its TRXC_* type.
Replace both 'pdch' and 'auto_active' fields with more generic
bitmask field called 'flags', and define the following flags:
- TRX_CHAN_FLAG_AUTO_ACTIVE,
- TRX_CHAN_FLAG_PDCH.
Use RSL channel mode #defines from libosmogsm instead of having
hard-coded numbers. This increases readability.
As a bonus, let's add a human readable description to each lchan
definition, so it can be printed in the VTY some day.
Change-Id: I9d5d49ec569f133d37b8164b22607d4700474315
Backported from: I2fc61e1cdca4690a34e2861b9ee3b7c64ea64843
I7ab4958801b3422973b67ff0452b90afa8a3f501
Diffstat (limited to 'include')
-rw-r--r-- | include/osmo-bts/scheduler.h | 11 | ||||
-rw-r--r-- | include/osmo-bts/scheduler_backend.h | 14 |
2 files changed, 15 insertions, 10 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index 2906c6eb..c8623079 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -5,6 +5,15 @@ #include <osmo-bts/gsm_data.h> +/* Whether a logical channel must be activated automatically */ +#define TRX_CHAN_FLAG_AUTO_ACTIVE (1 << 0) +/* Whether a logical channel belongs to PDCH (packet switched data) */ +#define TRX_CHAN_FLAG_PDCH (1 << 1) + +/* FIXME: we should actually activate 'auto-active' channels */ +#define TRX_CHAN_IS_ACTIVE(state, chan) \ + (trx_chan_desc[chan].flags & TRX_CHAN_FLAG_AUTO_ACTIVE || (state)->active) + /* These types define the different channels on a multiframe. * Each channel has queues and can be activated individually. */ @@ -51,8 +60,6 @@ enum trx_chan_type { _TRX_CHAN_MAX }; -extern const struct value_string trx_chan_type_names[]; - #define GSM_BURST_LEN 148 #define GPRS_BURST_LEN GSM_BURST_LEN #define EGPRS_BURST_LEN 444 diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index dbd93195..505f4d70 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -19,24 +19,22 @@ typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn, int8_t rssi, int16_t toa256); struct trx_chan_desc { - /*! \brief Is this on a PDCH (PS) ? */ - int pdch; - /*! \brief TRX Channel Type */ - enum trx_chan_type chan; + /*! \brief Human-readable name */ + const char *name; + /*! \brief Human-readable description */ + const char *desc; /*! \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; - /*! \brief is this channel automatically active at start? */ - int auto_active; + /*! \brief channel flags, see TRX_CHAN_FLAG_* */ + uint8_t flags; }; extern const struct trx_chan_desc trx_chan_desc[_TRX_CHAN_MAX]; |