From patchwork Thu Feb 5 09:57:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44413 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D135721521 for ; Thu, 5 Feb 2015 09:58:17 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf1963219wes.2 for ; Thu, 05 Feb 2015 01:58:17 -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=6xkBqT4LDtkNyE9SeLxxMyaMtM/OIvjxtts4gQjb9Po=; b=B7lwCLwD+xp9LZX69a2NbT7eQ4yEec0kfu98kpBNmvMCXinB7YYVNrWB3G/3j5f7ij lHR9wMxa7cPhr0PE+YoizwAs/MrHsZsLoVAavJ5/sE6N3emKTZ6ofaUerC2J4wA+Vy1K XL/zimXIgSIi/b00AJeKT6feqFCbdlafHaKDDpmZ64evXYwdk5diooOVAMV1oj0OBL6f AZe/wKVqGW7DDCNIIDH9x6jBhAvhgJKERGIKQJw1lJakQ6/sxVVdeJeKY//FfH8KXvS6 30+J4qzc/79tx4wrJH/gtQF2TM0dl2+CzMIqS4OY1OXvNpWl6j/1xotWKUhQyYsJtd2T dv/A== X-Gm-Message-State: ALoCoQlqviwcvGk/WoNUPEKnFVrQswWROu4Rnee5RnXBEpHmEJhvZwAxDIcKkk/x85mQgDUKbWRx X-Received: by 10.180.109.13 with SMTP id ho13mr1103711wib.7.1423130296994; Thu, 05 Feb 2015 01:58:16 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.193 with SMTP id v1ls123262lag.102.gmail; Thu, 05 Feb 2015 01:58:16 -0800 (PST) X-Received: by 10.112.78.39 with SMTP id y7mr2414784lbw.58.1423130296729; Thu, 05 Feb 2015 01:58:16 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id rl12si3515921lac.77.2015.02.05.01.58.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 01:58:16 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gd6so6311232lab.4 for ; Thu, 05 Feb 2015 01:58:16 -0800 (PST) X-Received: by 10.112.181.41 with SMTP id dt9mr2445573lbc.56.1423130296557; Thu, 05 Feb 2015 01:58:16 -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 h5csp1034722lbj; Thu, 5 Feb 2015 01:58:15 -0800 (PST) X-Received: by 10.224.112.9 with SMTP id u9mr6626045qap.38.1423130295051; Thu, 05 Feb 2015 01:58:15 -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 x46si5467953qgx.121.2015.02.05.01.57.44 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 01:58:15 -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 1YJJBu-0008OY-12; Thu, 05 Feb 2015 09:57:42 +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 1YJJBp-0008OM-2q for lng-odp@lists.linaro.org; Thu, 05 Feb 2015 09:57:37 +0000 Received: by mail-qc0-f171.google.com with SMTP id s11so5608235qcv.2 for ; Thu, 05 Feb 2015 01:57:31 -0800 (PST) X-Received: by 10.140.92.33 with SMTP id a30mr6145653qge.30.1423130251877; Thu, 05 Feb 2015 01:57:31 -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 r8sm2494306qad.43.2015.02.05.01.57.28 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Feb 2015 01:57:30 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 5 Feb 2015 11:57:11 +0200 Message-Id: <1423130234-6305-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 X-Topics: patch Subject: [lng-odp] [PATCH v3 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.45 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 139abdf..777b327 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..c389093 --- /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 identifier + * + * Determine CPU identifier on which the calling is running. CPU numbering is + * system specific. + * + * @return CPU identifier + */ +int odp_cpu_id(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 05f5378..7ebf7a3 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 \ @@ -71,6 +72,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