diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2010-06-09 13:38:56 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2010-06-09 13:40:36 +0200 |
commit | 4f585491b995e4244f85c1ebf10d93443b6ec3fe (patch) | |
tree | 5a9ba0f92a0c9cd18deca38ed92f4f57e4758ed3 | |
parent | dd19527cd2dc49e34973fdefa24acb2d9939e2c1 (diff) |
gsm_utils: Add a fn to test A5(x) support given a classmark2
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | include/osmocore/gsm_utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/osmocore/gsm_utils.h b/include/osmocore/gsm_utils.h index 685bc901..7dc2388b 100644 --- a/include/osmocore/gsm_utils.h +++ b/include/osmocore/gsm_utils.h @@ -66,6 +66,18 @@ int ms_pwr_dbm(enum gsm_band band, uint8_t lvl); int rxlev2dbm(uint8_t rxlev); uint8_t dbm2rxlev(int dbm); +/* According to GSM 04.08 Chapter 10.5.1.6 */ +static inline int ms_cm2_a5n_support(uint8_t *cm2, int n) { + switch (n) { + case 0: return 1; + case 1: return (cm2[0] & (1<<3)) ? 0 : 1; + case 2: return (cm2[2] & (1<<0)) ? 1 : 0; + case 3: return (cm2[2] & (1<<1)) ? 1 : 0; + default: + return 0; + } +} + /* According to GSM 04.08 Chapter 10.5.2.29 */ static inline int rach_max_trans_val2raw(int val) { return (val >> 1) & 3; } static inline int rach_max_trans_raw2val(int raw) { |