From patchwork Tue Mar 10 15:31:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 45583 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A568214BF for ; Tue, 10 Mar 2015 15:31:48 +0000 (UTC) Received: by wggx13 with SMTP id x13sf2029138wgg.0 for ; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=SDejzAS10rqY+i1XGVFX24s4x+tYLnKWA8qWZwb6eVY=; b=bCHb7Snr6qNA7JemK6wZSPeK4hx0bDAA7sbNgRZLNxI0+QxBMLkDNj8GRrIW00bzor OgsB8bEGGo3pLAWNnAHAk/FOuRyn71TRtsdHiSoNlZfU69MUlElZAHe3ASogcYiql86e A5bZ1AuYxyA3gPqi90i3/ga2v8OnmRGGHPD7KsisdM7cpP6va4o72L8FHhhO3Fx01Qgg N/s1QiApduAmwLq0NhK+xdNwLROkbvpPwiNjaHczsRpuPvE0IlbGWpEtb7FKWB3xu2Tw 3CXX2zEiJOjFquNISkmXoLOoKR+8dBUzYVoRcDsXVNc7uHkK/VPwDctdmldT09kSu0I7 IAeQ== X-Gm-Message-State: ALoCoQmFnOFwpvq8P68qmKIIjxWsKtDdWigTorn8DUJj65o29C8hbMPXDxvQSDHrw0jrw/TMi6CU X-Received: by 10.112.120.136 with SMTP id lc8mr1848856lbb.24.1426001507448; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.197.97 with SMTP id it1ls45673lac.1.gmail; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) X-Received: by 10.152.198.8 with SMTP id iy8mr11625829lac.13.1426001507298; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id py2si593299lbb.33.2015.03.10.08.31.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2015 08:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbiz11 with SMTP id z11so2591910lbi.3 for ; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) X-Received: by 10.152.87.3 with SMTP id t3mr31081424laz.19.1426001507160; Tue, 10 Mar 2015 08:31:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2206521lbj; Tue, 10 Mar 2015 08:31:46 -0700 (PDT) X-Received: by 10.140.231.151 with SMTP id b145mr42146743qhc.22.1426001504456; Tue, 10 Mar 2015 08:31:44 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id b108si726566qgf.111.2015.03.10.08.31.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Mar 2015 08:31:44 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YVM8C-0003qW-Ud; Tue, 10 Mar 2015 15:31:40 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YVM7z-0003os-AU for lng-odp@lists.linaro.org; Tue, 10 Mar 2015 15:31:27 +0000 Received: by labgq15 with SMTP id gq15so2577545lab.1 for ; Tue, 10 Mar 2015 08:31:21 -0700 (PDT) X-Received: by 10.112.55.5 with SMTP id n5mr10603063lbp.75.1426001481503; Tue, 10 Mar 2015 08:31:21 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id a2sm106609lbm.32.2015.03.10.08.31.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Mar 2015 08:31:20 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Tue, 10 Mar 2015 17:31:00 +0200 Message-Id: <1426001473-14618-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426001473-14618-1-git-send-email-taras.kondratiuk@linaro.org> References: <1426001473-14618-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Cc: Taras Kondratiuk Subject: [lng-odp] [KEYSTONE2 PATCH 02/15] linux-ks2: debug: sort out after merge X-BeenThere: lng-odp@lists.linaro.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 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Taras Kondratiuk Signed-off-by: Taras Kondratiuk --- platform/linux-keystone2/Makefile.am | 1 + platform/linux-keystone2/include/odp/plat/debug.h | 88 ++++++++++++++++++++++ .../linux-keystone2/include/odp_debug_internal.h | 78 +++---------------- 3 files changed, 98 insertions(+), 69 deletions(-) create mode 100644 platform/linux-keystone2/include/odp/plat/debug.h diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am index 638b903..d17ea45 100644 --- a/platform/linux-keystone2/Makefile.am +++ b/platform/linux-keystone2/Makefile.am @@ -58,6 +58,7 @@ odpinclude_HEADERS = \ odpplatincludedir = $(includedir)/odp/plat odpplatinclude_HEADERS = \ + $(srcdir)/include/odp/plat/debug.h \ $(srcdir)/include/odp/plat/mcsdk_tune.h \ $(srcdir)/include/odp/plat/state.h \ $(srcdir)/include/odp/plat/ti_mcsdk.h \ diff --git a/platform/linux-keystone2/include/odp/plat/debug.h b/platform/linux-keystone2/include/odp/plat/debug.h new file mode 100644 index 0000000..2a40404 --- /dev/null +++ b/platform/linux-keystone2/include/odp/plat/debug.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2014, Linaro Limited + * Copyright (c) 2014, Texas Instruments Incorporated + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_DEBUG_INTERNAL_H_ +#define ODP_DEBUG_INTERNAL_H_ + +#include +#include + +/** + * Runtime assertion-macro - aborts if 'cond' is false. + */ +#define ODP_ASSERT(cond, fmt, ...) \ + do { if ((ODP_DEBUG == 1) && (!(cond))) \ + ODP_ABORT(fmt "\n", ##__VA_ARGS__); \ + } while (0) + +/** + * This macro is used to indicate when a given function is not implemented + */ +#define ODP_UNIMPLEMENTED() \ + odp_proc.log_fn(ODP_LOG_UNIMPLEMENTED, \ + "%s:%d:The function %s() is not implemented\n", \ + __FILE__, __LINE__, __func__) +/** + * Log debug message if ODP_DEBUG_PRINT flag is set. + */ +#define ODP_DBG(fmt, ...) \ + do { \ + if (ODP_DEBUG_PRINT == 1) \ + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ + } while (0) + +/** + * Log error message. + */ +#define ODP_ERR(fmt, ...) \ + ODP_LOG(ODP_LOG_ERR, fmt, ##__VA_ARGS__) + +/** + * Log abort message and then stop execution (by default call abort()). + * This function should not return. + */ +#define ODP_ABORT(fmt, ...) \ + do { \ + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ + odp_proc.abort_fn(); \ + } while (0) + +/** + * ODP LOG macro. + */ +#define ODP_LOG(level, fmt, ...) \ + odp_proc.log_fn(level, "%s:%d:%s():" fmt, __FILE__, \ + __LINE__, __func__, ##__VA_ARGS__) + +/** + * Log print message when the application calls one of the ODP APIs + * specifically for dumping internal data. + */ +#define ODP_PRINT(fmt, ...) \ + odp_proc.log_fn(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) + +#define odp_pr_err ODP_ERR +#define odp_pr_warn ODP_ERR +#define odp_pr_info ODP_PRINT +#define odp_pr_dbg ODP_DBG +#if 0 +#define odp_pr_vdbg ODP_DBG +#else +#define odp_pr_vdbg(...) +#endif + +void odp_print_mem(void *addr, size_t size, const char *desc); + +#define odp_pr_err_mem(...) odp_print_mem +#ifdef ODP_DEBUG_PRINT +#define odp_pr_dbg_mem odp_print_mem +#else +#define odp_pr_dbg_mem +#endif + +#endif diff --git a/platform/linux-keystone2/include/odp_debug_internal.h b/platform/linux-keystone2/include/odp_debug_internal.h index a93e282..839d66f 100644 --- a/platform/linux-keystone2/include/odp_debug_internal.h +++ b/platform/linux-keystone2/include/odp_debug_internal.h @@ -1,76 +1,16 @@ -/* - * Copyright (c) 2014, Linaro Limited - * Copyright (c) 2014, Texas Instruments Incorporated +/* Copyright (c) 2014, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ - -#ifndef ODP_DEBUG_INTERNAL_H_ -#define ODP_DEBUG_INTERNAL_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define ODP_PRINT_LEVEL_DISABLED 0 -#define ODP_PRINT_LEVEL_CRIT 1 -#define ODP_PRINT_LEVEL_ERR 2 -#define ODP_PRINT_LEVEL_WARN 3 -#define ODP_PRINT_LEVEL_INFO 4 -#define ODP_PRINT_LEVEL_DBG 5 -#define ODP_PRINT_LEVEL_VDBG 6 -#define ODP_PRINT_LEVEL_MAX 7 - -#define ODP_PRINT_LEVEL ODP_PRINT_LEVEL_DBG - -/** - * Internal debug printing macro - */ -#ifndef ODP_NO_PRINT -#define odp_print(level, fmt, ...) \ - do { if (level <= ODP_PRINT_LEVEL) \ - fprintf(stderr, "%s():%d: " fmt, \ - __func__, __LINE__, ##__VA_ARGS__); \ - } while (0) -#else -#define odp_print(level, fmt, ...) -#endif - -#define odp_pr_err(fmt, ...) \ - odp_print(ODP_PRINT_LEVEL_ERR, fmt, ##__VA_ARGS__) -#define odp_pr_warn(fmt, ...) \ - odp_print(ODP_PRINT_LEVEL_WARN, fmt, ##__VA_ARGS__) -#define odp_pr_info(fmt, ...) \ - odp_print(ODP_PRINT_LEVEL_INFO, fmt, ##__VA_ARGS__) -#define odp_pr_dbg(fmt, ...) \ - odp_print(ODP_PRINT_LEVEL_DBG, fmt, ##__VA_ARGS__) -#define odp_pr_vdbg(fmt, ...) \ - odp_print(ODP_PRINT_LEVEL_VDBG, fmt, ##__VA_ARGS__) - -void odp_print_mem(void *addr, size_t size, const char *desc); - -static inline void odp_pr_mem(int level, void *addr, size_t size, - const char *desc) -{ - if (level <= ODP_PRINT_LEVEL) - odp_print_mem(addr, size, desc); -} - -#define odp_pr_err_mem(...) odp_pr_mem(ODP_PRINT_LEVEL_ERR, ##__VA_ARGS__) -#define odp_pr_dbg_mem(...) odp_pr_mem(ODP_PRINT_LEVEL_DBG, ##__VA_ARGS__) - /** - * This macro is used to indicate when a given function is not implemented + * @file + * + * ODP Debug internal + * This file contains implementer support functions for Debug capabilities. + * + * @note This is a wrapper for a code reused from linux-generic. */ -#define ODP_UNIMPLEMENTED(fmt, ...) \ - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) - -#ifdef __cplusplus -} -#endif -#endif +#include +#include