diff options
author | Max <msuraev@sysmocom.de> | 2016-04-21 14:58:30 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-04-22 15:09:09 +0200 |
commit | 402b9b055538737838ce112a99a75401aa4f14c6 (patch) | |
tree | 238cb8212a5c72ba8fbf025d701c7b1d4acf72e6 | |
parent | fbb8bfa514284f9744809afba51dec716590090c (diff) |
Addditional classmark check against A5/4 support
Add classmark check function according to GSM 04.08 Chapter 10.5.1.7
Fix interface to use unsigned for unsigned value.
-rw-r--r-- | include/osmocom/gsm/gsm_utils.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h index 99aae65f..0fbfcba8 100644 --- a/include/osmocom/gsm/gsm_utils.h +++ b/include/osmocom/gsm/gsm_utils.h @@ -119,7 +119,7 @@ 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) { +static inline int ms_cm2_a5n_support(uint8_t *cm2, unsigned n) { switch (n) { case 0: return 1; case 1: return (cm2[0] & (1<<3)) ? 0 : 1; @@ -130,6 +130,18 @@ static inline int ms_cm2_a5n_support(uint8_t *cm2, int n) { } } +/* According to GSM 04.08 Chapter 10.5.1.7 */ +static inline int ms_cm3_a5n_support(uint8_t *cm3, unsigned n) { + switch (n) { + case 4: return (cm3[0] & (1<<0)) ? 1 : 0; + case 5: return (cm3[0] & (1<<1)) ? 1 : 0; + case 6: return (cm3[0] & (1<<2)) ? 1 : 0; + case 7: return (cm3[0] & (1<<3)) ? 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) { |