From patchwork Fri Aug 3 15:28:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1271431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id C722EDF25A for ; Fri, 3 Aug 2012 15:35:06 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SxJqO-000838-AW; Fri, 03 Aug 2012 15:31:17 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SxJo0-0006LP-5b for linux-arm-kernel@lists.infradead.org; Fri, 03 Aug 2012 15:28:49 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WpXGN4jkyz4KK5v; Fri, 3 Aug 2012 17:28:44 +0200 (CEST) X-Auth-Info: GyOMZsLcvaT6MC4DZJ+++Tg8x5PlX+UKYezlLzlwiT0= Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3WpXGN2xLjzbbkj; Fri, 3 Aug 2012 17:28:44 +0200 (CEST) From: Marek Vasut To: linux-iio@vger.kernel.org Subject: [PATCH 1/3] IIO: Add 4-byte unsigned reads into generic-buffer example Date: Fri, 3 Aug 2012 17:28:39 +0200 Message-Id: <1344007721-11595-2-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344007721-11595-1-git-send-email-marex@denx.de> References: <1344007721-11595-1-git-send-email-marex@denx.de> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.18.0.9 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marek Vasut , Lars-Peter Clausen , Wolfgang Denk , linux-arm-kernel@lists.infradead.org, Jonathan Cameron X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add unsigned 32bit-wide reads into the generic-buffer.c Signed-off-by: Marek Vasut Cc: Jonathan Cameron Cc: Juergen Beisert Cc: Lars-Peter Clausen Cc: Wolfgang Denk --- drivers/staging/iio/Documentation/generic_buffer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 827e92d..40d0eca 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -104,6 +104,16 @@ void process_scan(char *data, print2byte(*(uint16_t *)(data + channels[k].location), &channels[k]); break; + case 4: + if (!channels[k].is_signed) { + uint32_t val = *(uint32_t *) + (data + channels[k].location); + printf("%05f ", ((float)val + + channels[k].offset)* + channels[k].scale); + + } + break; case 8: if (channels[k].is_signed) { int64_t val = *(int64_t *)