diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2016-08-09 20:15:09 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-08-30 07:35:47 +0000 |
commit | 9faaf4ecf01322189808901398e06d7e4f14560d (patch) | |
tree | c16f8b3e4cdc6f6779340fd4cf9e73393f9bdf4e /src | |
parent | 3b2e5de3aea8652969e7bbd1e3c04206dce51330 (diff) |
cosmetic: common ts_is_pdch()
Have one common ts_is_pdch(), placed in lchan.c, since this file is pretty
empty and pretty close to ts. Publish in gsm_data.h.
Remove the if-style implementation from l1sap.c, and instead implement in a
switch statement.
This prepares for upcoming ts_is_pdch() usage in ph_data_req() for sysmo and
lc15.
Change-Id: Ib78d663fdbac5a1d7053f1b9d543649b66da00e2
Diffstat (limited to 'src')
-rw-r--r-- | src/common/l1sap.c | 11 | ||||
-rw-r--r-- | src/common/lchan.c | 16 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c index f7df2180..7c30c9b9 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -294,17 +294,6 @@ static int gsmtap_ph_rach(struct osmo_phsap_prim *l1sap, uint8_t *chan_type, return 0; } -static bool ts_is_pdch(const struct gsm_bts_trx_ts *ts) -{ - return ts->pchan == GSM_PCHAN_PDCH - || (ts->pchan == GSM_PCHAN_TCH_F_PDCH - && (ts->flags & TS_F_PDCH_ACTIVE) - && !(ts->flags & TS_F_PDCH_PENDING_MASK)) - || (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH - && ts->dyn.pchan_want == ts->dyn.pchan_is - && ts->dyn.pchan_is == GSM_PCHAN_PDCH); -} - static int to_gsmtap(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap) { uint8_t *data; diff --git a/src/common/lchan.c b/src/common/lchan.c index fbc26364..9e98166d 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -31,3 +31,19 @@ void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state) gsm_lchans_name(state)); lchan->state = state; } + +bool ts_is_pdch(const struct gsm_bts_trx_ts *ts) +{ + switch (ts->pchan) { + case GSM_PCHAN_PDCH: + return true; + case GSM_PCHAN_TCH_F_PDCH: + return (ts->flags & TS_F_PDCH_ACTIVE) + && !(ts->flags & TS_F_PDCH_PENDING_MASK); + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + return ts->dyn.pchan_is == GSM_PCHAN_PDCH + && ts->dyn.pchan_want == ts->dyn.pchan_is; + default: + return false; + } +} |