From patchwork Tue Jun 17 10:07:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 360435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CB682140091 for ; Tue, 17 Jun 2014 20:08:45 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1WwqJF-000600-PQ; Tue, 17 Jun 2014 12:08:10 +0200 Received: from hylle06.itea.ntnu.no ([129.241.56.235]) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1WwqIf-0005zu-IT for baseband-devel@lists.osmocom.org; Tue, 17 Jun 2014 12:07:36 +0200 Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id E7E53667B01 for ; Tue, 17 Jun 2014 12:07:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from alumnimail.it.ntnu.no (alumnimail.it.ntnu.no [129.241.18.22]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id 52158667AFF for ; Tue, 17 Jun 2014 12:07:32 +0200 (CEST) Received: from localhost (nat.sec.t-labs.tu-berlin.de [130.149.230.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: suraev) by alumnimail.it.ntnu.no (Postfix) with ESMTPSA id 28E095804E1 for ; Tue, 17 Jun 2014 12:07:32 +0200 (CEST) From: Max Suraev To: baseband-devel@lists.osmocom.org Subject: [PATCH] Addditional classmark check against A5/4 support Date: Tue, 17 Jun 2014 12:07:26 +0200 Message-Id: <1402999646-23848-1-git-send-email-Max.Suraev@fairwaves.co> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1402951717-31336-1-git-send-email-Max.Suraev@fairwaves.co> References: <1402951717-31336-1-git-send-email-Max.Suraev@fairwaves.co> X-Spam-Score: -2.3 (--) X-BeenThere: baseband-devel@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development discussion about Osmocom BaseBand List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: baseband-devel-bounces@lists.osmocom.org Errors-To: baseband-devel-bounces@lists.osmocom.org Signed-off-by: Max Suraev --- include/osmocom/gsm/gsm_utils.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h index 6eab7ac..5f9164b 100644 --- a/include/osmocom/gsm/gsm_utils.h +++ b/include/osmocom/gsm/gsm_utils.h @@ -117,7 +117,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; @@ -128,6 +128,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) {