From patchwork Tue Feb 3 10:59:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2F7722034D for ; Tue, 3 Feb 2015 11:00:00 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id m14sf20229752wev.3 for ; Tue, 03 Feb 2015 02:59:59 -0800 (PST) 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: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=gGmV2xg4Pj4JpjVXbR+yjIF7c9QrLQRWSBztgGFSd7I=; b=lWPZqCT7jTQsEUFOoUU/x9Qoy4ahv0zsbMF38egdpyt9XATeBtAoFBil+2EMuFrvIg gokniz8Rbw0b7RIkarOThtXg9uQzN/Y18Geov6+fN+bwYxIFeh1UVDDd3Tdfa8c618EU C5xoP8f2DIgh43R+coOUutcStn9rvau/cg2biEfoiW9vQbYP90EveeX83o6pJ0RaYNHg ibkikPTBcuVMcnGsiq4UbLHqfUIN5/cOc2yqbtdaV8YcQKTEMJj9CjsgoOO5Dw1D9odO s5R9Lb6lIKpB7KO8gbmTqmQrKgmVv6clO8Icri0fbBzTkjh+uOS9ysnarsopt2IRbgDt lU5A== X-Gm-Message-State: ALoCoQkDqzwKzIdYUJIyiwszeKX0M9dn4iwDbA7qIx2+Tg3N/cjnFwTGGJbeWv/HhzU6z0i8YhA/ X-Received: by 10.180.92.133 with SMTP id cm5mr1838872wib.4.1422961199506; Tue, 03 Feb 2015 02:59:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.71 with SMTP id k7ls742133laf.9.gmail; Tue, 03 Feb 2015 02:59:59 -0800 (PST) X-Received: by 10.112.144.164 with SMTP id sn4mr18442210lbb.2.1422961199331; Tue, 03 Feb 2015 02:59:59 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id qc5si14144387lbb.51.2015.02.03.02.59.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 02:59:59 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id pn19so4270425lab.2 for ; Tue, 03 Feb 2015 02:59:59 -0800 (PST) X-Received: by 10.112.243.12 with SMTP id wu12mr24011213lbc.91.1422961199144; Tue, 03 Feb 2015 02:59:59 -0800 (PST) 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 h5csp1861114lbj; Tue, 3 Feb 2015 02:59:58 -0800 (PST) X-Received: by 10.229.25.200 with SMTP id a8mr7946101qcc.22.1422961197675; Tue, 03 Feb 2015 02:59:57 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id z35si25725277qgd.73.2015.02.03.02.59.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 02:59:57 -0800 (PST) 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 1YIbD0-0006X5-OT; Tue, 03 Feb 2015 10:59:54 +0000 Received: from mail-qc0-f171.google.com ([209.85.216.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIbCw-0006We-2Z for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 10:59:50 +0000 Received: by mail-qc0-f171.google.com with SMTP id s11so34677083qcv.2 for ; Tue, 03 Feb 2015 02:59:44 -0800 (PST) X-Received: by 10.224.80.135 with SMTP id t7mr51246269qak.65.1422961184906; Tue, 03 Feb 2015 02:59:44 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id v15sm20959791qav.11.2015.02.03.02.59.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 02:59:43 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 12:59:24 +0200 Message-Id: <1422961167-2307-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 X-Topics: patch Subject: [lng-odp] [PATCH v2 1/4] api: cpu: Added cpu.h 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: petri.savolainen@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.215.43 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 This file contains cpu related API calls. The calls are renames from odp_thread_cpu() and odp_sys_cpu_count(). Signed-off-by: Petri Savolainen Reviewed-by: Bill Fischofer --- include/odp.h | 1 + include/odp/api/cpu.h | 54 ++++++++++++++++++++++++++++++++ platform/linux-generic/Makefile.am | 2 ++ platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 include/odp/api/cpu.h create mode 100644 platform/linux-generic/include/odp/cpu.h diff --git a/include/odp.h b/include/odp.h index 30bed8e..99e01eb 100644 --- a/include/odp.h +++ b/include/odp.h @@ -27,6 +27,7 @@ extern "C" { #include #include #include +#include #include #include #include diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h new file mode 100644 index 0000000..16461a3 --- /dev/null +++ b/include/odp/api/cpu.h @@ -0,0 +1,54 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP CPU API + */ + +#ifndef ODP_CPU_H_ +#define ODP_CPU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_cpu ODP CPU + * @{ + */ + + +/** + * CPU number + * + * CPU number where the thread is currently running. CPU numbering is system + * specific. + * + * @return CPU number + */ +int odp_cpu(void); + +/** + * CPU count + * + * Report the number of CPU's available to this ODP program. + * This may be smaller than the number of (online) CPU's in the system. + * + * @return Number of available CPU's + */ +int odp_cpu_count(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index addb5ec..0e62650 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -18,6 +18,7 @@ odpinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/classification.h \ $(top_srcdir)/platform/linux-generic/include/odp/compiler.h \ $(top_srcdir)/platform/linux-generic/include/odp/config.h \ + $(top_srcdir)/platform/linux-generic/include/odp/cpu.h \ $(top_srcdir)/platform/linux-generic/include/odp/cpumask.h \ $(top_srcdir)/platform/linux-generic/include/odp/crypto.h \ $(top_srcdir)/platform/linux-generic/include/odp/debug.h \ @@ -69,6 +70,7 @@ odpapiinclude_HEADERS = \ $(top_srcdir)/include/odp/api/classification.h \ $(top_srcdir)/include/odp/api/compiler.h \ $(top_srcdir)/include/odp/api/config.h \ + $(top_srcdir)/include/odp/api/cpu.h \ $(top_srcdir)/include/odp/api/cpumask.h \ $(top_srcdir)/include/odp/api/crypto.h \ $(top_srcdir)/include/odp/api/debug.h \ diff --git a/platform/linux-generic/include/odp/cpu.h b/platform/linux-generic/include/odp/cpu.h new file mode 100644 index 0000000..b5b5320 --- /dev/null +++ b/platform/linux-generic/include/odp/cpu.h @@ -0,0 +1,26 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP CPU + */ + +#ifndef ODP_PLAT_CPU_H_ +#define ODP_PLAT_CPU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif + +#endif