From patchwork Fri Aug 19 15:48:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 74264 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp352722qga; Fri, 19 Aug 2016 07:51:25 -0700 (PDT) X-Received: by 10.200.39.246 with SMTP id x51mr8861434qtx.42.1471618285145; Fri, 19 Aug 2016 07:51:25 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 54si2904786qtw.17.2016.08.19.07.51.24; Fri, 19 Aug 2016 07:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C171B616CA; Fri, 19 Aug 2016 14:51:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B58FA616D1; Fri, 19 Aug 2016 14:49:59 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 72BC4616BF; Fri, 19 Aug 2016 14:49:38 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id EC0F9616B8 for ; Fri, 19 Aug 2016 14:49:35 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id f93so34611527lfi.2 for ; Fri, 19 Aug 2016 07:49:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cVdXvtTEXFkLqfvawG3IKfStc3BS3SepfxO0oMDWjEo=; b=ai/38445HoNUT1YAujttTX9J5x0cIvB0IxHcM7QfQx6pQGD1iogALLzEtAxQjofsf5 9QO3RLzj1Ti3GwjVCBVOtj1ZRik/aBTtW/p6PYoY39hwd2s2FLUtHumreOW/OnPH7rTx spnvvZXniANSeNGWCyuMgAKaUf28LFY7at0gkX+PV8L5IW1rImyDpng3NRABqYnC/7uh mMOwpI2yIcuEKNk9X5YooBG1TfcEQzL7MYCjdqyXPe3SFwPqCsbKSYxOTreDTN9jUKQv MbDSj5nGfqNh717ZuVxLM+9X1+EN2XGiuh6iSI/Z57TVKr5E6P7SbJP3H11pdN/YI0PX D6dw== X-Gm-Message-State: AEkoouuDZmlS06om8NjYw6Nnb4WFOevFJQjMp1ExxhHCJypVins2qg842H1Zdilc3dB+CEwRMuk= X-Received: by 10.25.160.15 with SMTP id j15mr2317981lfe.109.1471618174647; Fri, 19 Aug 2016 07:49:34 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id l10sm1277648lfd.19.2016.08.19.07.49.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Aug 2016 07:49:34 -0700 (PDT) From: Christophe Milard To: lng-odp@lists.linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org Date: Fri, 19 Aug 2016 17:48:33 +0200 Message-Id: <1471621724-8485-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471621724-8485-1-git-send-email-christophe.milard@linaro.org> References: <1471621724-8485-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 02/13] drv: adding barrier.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Based on API interface file. Signed-off-by: Christophe Milard --- include/odp/drv/spec/barrier.h | 66 ++++++++++++++++++++++++++++++++++++++++++ platform/Makefile.inc | 1 + 2 files changed, 67 insertions(+) create mode 100644 include/odp/drv/spec/barrier.h -- 2.7.4 diff --git a/include/odp/drv/spec/barrier.h b/include/odp/drv/spec/barrier.h new file mode 100644 index 0000000..5ac65a3 --- /dev/null +++ b/include/odp/drv/spec/barrier.h @@ -0,0 +1,66 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV execution barriers + */ + +#ifndef ODPDRV_API_BARRIER_H_ +#define ODPDRV_API_BARRIER_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup odpdrv_barrier ODPDRV BARRIER + * Thread execution and memory ordering barriers. + * + * @details + * Thread execution barrier (odpdrv_barrier_t) + * + * Thread execution barrier synchronizes a group of threads to wait on the + * barrier until the entire group has reached the barrier. + * @{ + */ + +/** + * @typedef odpdrv_barrier_t + * ODPDRV thread synchronization barrier + */ + +/** + * Initialize barrier with thread count. + * + * @param barr Pointer to a barrier variable + * @param count Thread count + */ +void odpdrv_barrier_init(odpdrv_barrier_t *barr, int count); + +/** + * Synchronize thread execution on barrier. + * Wait for all threads to arrive at the barrier until they are let loose again. + * Threads will block (spin) until the last thread has arrived at the barrier. + * All memory operations before the odpdrv_barrier_wait() call will be visible + * to all threads when they leave the barrier. + * + * @param barr Pointer to a barrier variable + */ +void odpdrv_barrier_wait(odpdrv_barrier_t *barr); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 079f34d..6ade6df 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -65,6 +65,7 @@ odpdrvspecincludedir= $(includedir)/odp/drv/spec odpdrvspecinclude_HEADERS = \ $(top_srcdir)/include/odp/drv/spec/align.h \ $(top_srcdir)/include/odp/drv/spec/atomic.h \ + $(top_srcdir)/include/odp/drv/spec/barrier.h \ $(top_srcdir)/include/odp/drv/spec/byteorder.h \ $(top_srcdir)/include/odp/drv/spec/compiler.h \ $(top_srcdir)/include/odp/drv/spec/spinlock.h \