diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-06-13 09:39:56 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2014-01-21 15:54:27 +0100 |
commit | 5da3a2155d8f9a677321e15229a624599ecd18f1 (patch) | |
tree | b1016ab92803c2e9b799223b91bcbb1132cf4c23 | |
parent | c232e753718eceaf06e003ebe8561e2f1c127d8b (diff) |
handover: Use enums to indicate the state instead of magic numbers
-rw-r--r-- | include/osmo-bts/handover.h | 6 | ||||
-rw-r--r-- | src/common/handover.c | 4 | ||||
-rw-r--r-- | src/common/l1sap.c | 2 | ||||
-rw-r--r-- | src/common/rsl.c | 5 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 3 |
5 files changed, 14 insertions, 6 deletions
diff --git a/include/osmo-bts/handover.h b/include/osmo-bts/handover.h index 6d857744..b08f0657 100644 --- a/include/osmo-bts/handover.h +++ b/include/osmo-bts/handover.h @@ -1,6 +1,12 @@ #ifndef HANDOVER_H #define HANDOVER_H +enum { + HANDOVER_NONE = 0, + HANDOVER_ENABLED, + HANDOVER_WAIT_FRAME, +}; + void handover_rach(struct gsm_bts_trx *trx, uint8_t chan_nr, struct gsm_lchan *lchan, uint8_t ra, uint8_t acc_delay); void handover_frame(struct gsm_lchan *lchan); diff --git a/src/common/handover.c b/src/common/handover.c index ce0f0220..e1b8138a 100644 --- a/src/common/handover.c +++ b/src/common/handover.c @@ -112,7 +112,7 @@ void handover_rach(struct gsm_bts_trx *trx, uint8_t chan_nr, lchan->rqd_ta = acc_delay; /* Stop handover detection, wait for valid frame */ - lchan->ho.active = 2; + lchan->ho.active = HANDOVER_WAIT_FRAME; l1sap_chan_modify(trx, chan_nr); /* Send HANDover DETect to BSC */ @@ -141,6 +141,6 @@ void handover_frame(struct gsm_lchan *lchan) osmo_timer_del(&lchan->ho.t3105); /* Handover process is done */ - lchan->ho.active = 0; + lchan->ho.active = HANDOVER_NONE; } diff --git a/src/common/l1sap.c b/src/common/l1sap.c index ea47cbc2..91e42914 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -703,7 +703,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx, } /* report first valid received frame to handover process */ - if (lchan->ho.active == 2) + if (lchan->ho.active == HANDOVER_WAIT_FRAME) handover_frame(lchan); if (L1SAP_IS_LINK_SACCH(link_id)) { diff --git a/src/common/rsl.c b/src/common/rsl.c index 87db2984..cf98dab8 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -45,6 +45,7 @@ #include <osmo-bts/measurement.h> #include <osmo-bts/pcu_if.h> #include <osmo-bts/l1sap.h> +#include <osmo-bts/handover.h> //#define FAKE_CIPH_MODE_COMPL @@ -740,7 +741,7 @@ static int rsl_rx_chan_activ(struct msgb *msg) if ((type == RSL_ACT_INTER_ASYNC || type == RSL_ACT_INTER_SYNC) && TLVP_PRESENT(&tp, RSL_IE_HANDO_REF)) { - lchan->ho.active = 1; + lchan->ho.active = HANDOVER_ENABLED; lchan->ho.ref = *TLVP_VAL(&tp, RSL_IE_HANDO_REF); } @@ -837,7 +838,7 @@ static int rsl_rx_rf_chan_rel(struct gsm_lchan *lchan, uint8_t chan_nr) lchan->rel_act_kind = LCHAN_REL_ACT_RSL; /* deactivate handover RACH detection and timer */ - lchan->ho.active = 0; + lchan->ho.active = HANDOVER_NONE; osmo_timer_del(&lchan->ho.t3105); l1sap_chan_rel(lchan->ts->trx, chan_nr); diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index f5f623c1..b73abd46 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -33,6 +33,7 @@ #include <osmo-bts/rsl.h> #include <osmo-bts/l1sap.h> #include <osmo-bts/amr.h> +#include <osmo-bts/handover.h> #include "l1_if.h" #include "trx_if.h" @@ -501,7 +502,7 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap) lchan->tch.amr_mr.mode[2].mode, lchan->tch.amr_mr.mode[3].mode, amr_get_initial_mode(lchan), - (lchan->ho.active == 1)); + (lchan->ho.active == HANDOVER_ENABLED)); /* init lapdm */ lchan_init_lapdm(lchan); /* set lchan active */ |