From patchwork Fri Jan 30 11:39:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44037 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B04B22410D for ; Fri, 30 Jan 2015 11:40:11 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf408219lbv.1 for ; Fri, 30 Jan 2015 03:40:07 -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=DL/sKukuQJRj2EEXK/becHbqTkMF5EOQAUPK1w+CdzIOr0O5xx8UBrg4/w36EA/CSz 9nxf19ftgF+CcIzDuJ64mCMdykjrTgSNIOvU/mKmZFl9tsWX6vJaSJ6Uz3uaqUuBv/ZE r/ktODDlQyu038LSpIpDv4yBbHdvsFIN8ghxlxkwX4pKJ/0GOCgIYKxGUNerCAehgk6i Ho4mLQV4LuvaBuNc+s+J9wsWUHXZpOzbRXvUspuSOdtEsi3vB7kkeRtWJ17OiZh23LZr 8ZbE9PhShFQYsJsMJj8HJctfOpvJT1UGjOK7BTZUIIvSVbZWWDOb2hrHn/H660y45PgT Hx5Q== X-Gm-Message-State: ALoCoQkRtYJga+1o85QniiPFNy0/GgoY/628xuYO7Il7MBl9VOy7lXy81+SxJyqMBGaVnQULOSel X-Received: by 10.112.64.171 with SMTP id p11mr755616lbs.12.1422618001525; Fri, 30 Jan 2015 03:40:01 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.228 with SMTP id uh4ls429975lac.108.gmail; Fri, 30 Jan 2015 03:40:01 -0800 (PST) X-Received: by 10.112.163.229 with SMTP id yl5mr6025592lbb.60.1422618001382; Fri, 30 Jan 2015 03:40:01 -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 to9si9962297lbb.15.2015.01.30.03.40.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:40:01 -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 q1so23203361lam.2 for ; Fri, 30 Jan 2015 03:40:01 -0800 (PST) X-Received: by 10.152.245.44 with SMTP id xl12mr5855800lac.81.1422618001294; Fri, 30 Jan 2015 03:40:01 -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 h5csp253307lbj; Fri, 30 Jan 2015 03:40:00 -0800 (PST) X-Received: by 10.224.11.5 with SMTP id r5mr10743980qar.67.1422617999961; Fri, 30 Jan 2015 03:39:59 -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 f5si13904867qab.9.2015.01.30.03.39.57 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:39:59 -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 1YH9vW-0002QD-Mt; Fri, 30 Jan 2015 11:39:54 +0000 Received: from mail-qc0-f181.google.com ([209.85.216.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH9vR-0002Q0-BR for lng-odp@lists.linaro.org; Fri, 30 Jan 2015 11:39:49 +0000 Received: by mail-qc0-f181.google.com with SMTP id l6so19901028qcy.12 for ; Fri, 30 Jan 2015 03:39:44 -0800 (PST) X-Received: by 10.229.249.137 with SMTP id mk9mr11447214qcb.4.1422617984158; Fri, 30 Jan 2015 03:39: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 y17sm9778758qaq.14.2015.01.30.03.39.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:39:42 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 30 Jan 2015 13:39:23 +0200 Message-Id: <1422617966-27160-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 X-Topics: patch Subject: [lng-odp] [PATCH 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 --- 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