From patchwork Tue Oct 28 11:26:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 5175711 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47C4EC11AC for ; Tue, 28 Oct 2014 11:44:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4EC0D20254 for ; Tue, 28 Oct 2014 11:44:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 015302020E for ; Tue, 28 Oct 2014 11:44:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C5D02606A1; Tue, 28 Oct 2014 12:44:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0E043260426; Tue, 28 Oct 2014 12:41:41 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F3E5D260439; Tue, 28 Oct 2014 12:27:39 +0100 (CET) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by alsa0.perex.cz (Postfix) with ESMTP id A6C0926041F for ; Tue, 28 Oct 2014 12:27:27 +0100 (CET) Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id AE6DA337A6017; Tue, 28 Oct 2014 11:27:23 +0000 (GMT) Received: from KLMAIL02.kl.imgtec.org (10.40.60.222) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 28 Oct 2014 11:27:25 +0000 Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by klmail02.kl.imgtec.org (10.40.60.222) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 28 Oct 2014 11:27:25 +0000 Received: from qyousef-linux.le.imgtec.org (192.168.154.94) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 28 Oct 2014 11:27:24 +0000 From: Qais Yousef To: Date: Tue, 28 Oct 2014 11:26:22 +0000 Message-ID: <1414495589-8579-5-git-send-email-qais.yousef@imgtec.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1414495589-8579-1-git-send-email-qais.yousef@imgtec.com> References: <1414495589-8579-1-git-send-email-qais.yousef@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.94] X-Mailman-Approved-At: Tue, 28 Oct 2014 12:41:37 +0100 Cc: Greg Kroah-Hartman , alsa-devel@alsa-project.org, Qais Yousef , Arnd Bergmann Subject: [alsa-devel] [PATCH 04/11] drivers: char: axd: add fw binary header manipulation files X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP these files provide functions to get information from the fw binary header Signed-off-by: Qais Yousef Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: --- drivers/char/axd/axd_hdr.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/char/axd/axd_hdr.h | 20 ++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 drivers/char/axd/axd_hdr.c create mode 100644 drivers/char/axd/axd_hdr.h diff --git a/drivers/char/axd/axd_hdr.c b/drivers/char/axd/axd_hdr.c new file mode 100644 index 000000000000..86a3aeec83e9 --- /dev/null +++ b/drivers/char/axd/axd_hdr.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2014 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * Helper functions to parse AXD Header in the firmware binary. + */ +#include + +#include "axd_api.h" +#include "axd_hdr.h" + + +#ifdef DEBUG_HEADER +#define debughdr printk +#else +#define debughdr(format, ...) +#endif + +static struct axd_hdr *hdr; + +static void dump_hdr(void) +{ +#ifdef DEBUG_HEADER + unsigned int offset = 0; + unsigned long address = (unsigned long)hdr; + + debughdr("header <0x%08lX>:\n", address); + while (offset <= sizeof(*hdr)) { + debughdr("0x%08X\t", *(unsigned int *)(address+offset)); + offset += 4; + if ((offset % (4*4)) == 0) + debughdr("\n"); + } + debughdr("\n"); +#endif +} + +void axd_hdr_init(unsigned long address) +{ + hdr = (struct axd_hdr *)address; + dump_hdr(); +} + +unsigned long axd_hdr_get_pc(unsigned int thread) +{ + if (thread >= THREAD_COUNT) + return -1; + return hdr->thread_pc[thread]; +} + +unsigned long axd_hdr_get_cmdblock_offset(void) +{ + debughdr("cmdblock_offset = 0x%08X\n", hdr->cmd_block_offset); + return hdr->cmd_block_offset; +} + +char *axd_hdr_get_build_str(void) +{ + return hdr->build_str; +} + +unsigned long axd_hdr_get_log_offset(void) +{ + return hdr->log_offset; +} diff --git a/drivers/char/axd/axd_hdr.h b/drivers/char/axd/axd_hdr.h new file mode 100644 index 000000000000..34a46a7f8e65 --- /dev/null +++ b/drivers/char/axd/axd_hdr.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2011-2014 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * Helper functions to parse AXD Header in the firmware binary + */ + #ifndef AXD_HDR_H_ + #define AXD_HDR_H_ + +void axd_hdr_init(unsigned long address); +unsigned long axd_hdr_get_pc(unsigned int thread); +unsigned long axd_hdr_get_cmdblock_offset(void); +char *axd_hdr_get_build_str(void); +unsigned long axd_hdr_get_log_offset(void); + +#endif /* AXD_HDR_H_ */