From patchwork Wed Jan 21 04:57:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 43433 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 DF1262034D for ; Wed, 21 Jan 2015 04:58:22 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf22227541wes.2 for ; Tue, 20 Jan 2015 20:58:22 -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:in-reply-to :references: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=ove0i49upc4Ndfk2V1DS5CbXsdhm4Ve1aBJzTw6BLV4=; b=TQjpzwmOabFsjf5OTu80FrTtLLO3X3M3qIn0IGbyuwXTq3pHlGfsgNAGaFhsjh/BBn OV4JU9H63nC/Rm7/Pcwkp+SMMBzAjFhpsUZ0zp9z/SFFHjKyvGX2/5eFgWP9Mf+WyIOt u4Jkplc9EMXVCavUVUiVTDWK27m3Zz8NhwY0q82FCbj3g582SJN31hM4Z5IZl+dbRbHE 0jw91eYwgKig0Jkoj2bQPBBgne1Utp+c7AWUomdx/c9Ijsxm7qpI/beY7VhHRIQTABCD uIhGdDwaWKcMN5bvUvBYTXjIYTyyHsijtG3ABfXzVvU7xwq4wGiUrhEeNQYJSU84M0Na 8xRQ== X-Gm-Message-State: ALoCoQkvRuamrIUwg8D71LGAzMe7xnYy+SzknBzlTCZJZaKrOBHFNc7typP6ho0G0CfyrdzqE2GS X-Received: by 10.180.92.66 with SMTP id ck2mr3093598wib.3.1421816302204; Tue, 20 Jan 2015 20:58:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.72 with SMTP id i8ls245980lai.1.gmail; Tue, 20 Jan 2015 20:58:21 -0800 (PST) X-Received: by 10.112.25.7 with SMTP id y7mr41757243lbf.94.1421816301852; Tue, 20 Jan 2015 20:58:21 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id qf1si16871932lbb.132.2015.01.20.20.58.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 20:58:21 -0800 (PST) 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 mail-lb0-f182.google.com with SMTP id l4so11883423lbv.13 for ; Tue, 20 Jan 2015 20:58:21 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr42718609laa.59.1421816301703; Tue, 20 Jan 2015 20:58:21 -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.9.200 with SMTP id c8csp1651549lbb; Tue, 20 Jan 2015 20:58:20 -0800 (PST) X-Received: by 10.140.18.131 with SMTP id 3mr61213603qgf.50.1421816300389; Tue, 20 Jan 2015 20:58:20 -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 a18si3186161qai.69.2015.01.20.20.58.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 20:58:20 -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 1YDnMv-0002JT-HS; Wed, 21 Jan 2015 04:58:17 +0000 Received: from mail-oi0-f48.google.com ([209.85.218.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDnMi-0002AC-Gm for lng-odp@lists.linaro.org; Wed, 21 Jan 2015 04:58:04 +0000 Received: by mail-oi0-f48.google.com with SMTP id u20so35297199oif.7 for ; Tue, 20 Jan 2015 20:57:59 -0800 (PST) X-Received: by 10.60.125.130 with SMTP id mq2mr24071537oeb.50.1421816279256; Tue, 20 Jan 2015 20:57:59 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id a15sm2891071oic.18.2015.01.20.20.57.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jan 2015 20:57:58 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 22:57:41 -0600 Message-Id: <1421816266-31223-4-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1421816266-31223-1-git-send-email-bill.fischofer@linaro.org> References: <1421816266-31223-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 3/8] api: event: Add event implementation 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: bill.fischofer@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: Bill Fischofer --- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/api/odp_buffer.h | 21 +++++++++++++++++++++ .../linux-generic/include/odp_buffer_internal.h | 4 +++- platform/linux-generic/odp_buffer.c | 17 ++++++++++++++++- platform/linux-generic/odp_event.c | 19 +++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 platform/linux-generic/odp_event.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index b90b31e..38a1f14 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -82,6 +82,7 @@ __LIB__libodp_la_SOURCES = \ odp_classification.c \ odp_cpumask.c \ odp_crypto.c \ + odp_event.c \ odp_init.c \ odp_impl.c \ odp_linux.c \ diff --git a/platform/linux-generic/include/api/odp_buffer.h b/platform/linux-generic/include/api/odp_buffer.h index 0670464..f6c2087 100644 --- a/platform/linux-generic/include/api/odp_buffer.h +++ b/platform/linux-generic/include/api/odp_buffer.h @@ -27,6 +27,27 @@ extern "C" { * @{ */ +/** + * Get buffer handle from event + * + * Converts an ODP_EVENT_BUFFER type event to a buffer. + * + * @param ev Event handle + * + * @return Buffer handle + * + * @see odp_event_type() + */ +odp_buffer_t odp_buffer_from_event(odp_event_t ev); + +/** + * Convert buffer handle to event + * + * @param buf Buffer handle + * + * @return Event handle + */ +odp_event_t odp_buffer_to_event(odp_buffer_t buf); /** * Buffer start address diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 39b0b05..43d8619 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -20,7 +20,7 @@ extern "C" { #include #include -#include +#include #include #include #include @@ -28,6 +28,7 @@ extern "C" { #include #include #include +#include #define ODP_BITSIZE(x) \ @@ -152,6 +153,7 @@ typedef struct { /* Forward declarations */ odp_buffer_t buffer_alloc(odp_buffer_pool_t pool, size_t size); +int _odp_buffer_type(odp_buffer_t buf); #ifdef __cplusplus } diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index 57ba408..99b5f59 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -13,6 +13,15 @@ #include #include +odp_buffer_t odp_buffer_from_event(odp_event_t ev) +{ + return (odp_buffer_t)ev; +} + +odp_event_t odp_buffer_to_event(odp_buffer_t buf) +{ + return (odp_event_t)buf; +} void *odp_buffer_addr(odp_buffer_t buf) { @@ -30,7 +39,7 @@ uint32_t odp_buffer_size(odp_buffer_t buf) } -int odp_buffer_type(odp_buffer_t buf) +int _odp_buffer_type(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); @@ -38,6 +47,12 @@ int odp_buffer_type(odp_buffer_t buf) } +int odp_buffer_type(odp_buffer_t buf) +{ + return _odp_buffer_type(buf); +} + + int odp_buffer_is_valid(odp_buffer_t buf) { return validate_buf(buf) != NULL; diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c new file mode 100644 index 0000000..c4291f8 --- /dev/null +++ b/platform/linux-generic/odp_event.c @@ -0,0 +1,19 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include + +int odp_event_type(odp_event_t event) +{ + odp_buffer_t buf; + + buf = odp_buffer_from_event(event); + + return _odp_buffer_type(buf); +}