From patchwork Fri Feb 6 16:16:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Cussins X-Patchwork-Id: 5793071 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E7939F336 for ; Fri, 6 Feb 2015 16:19:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38BC020173 for ; Fri, 6 Feb 2015 16:19:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id F269D20138 for ; Fri, 6 Feb 2015 16:18:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2A50D2651DC; Fri, 6 Feb 2015 17:18:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,SUBJ_OBFU_PUNCT_MANY,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 35E8C265314; Fri, 6 Feb 2015 17:17:50 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D01052651DC; Fri, 6 Feb 2015 17:17:48 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by alsa0.perex.cz (Postfix) with ESMTP id 60BDB265314 for ; Fri, 6 Feb 2015 17:16:40 +0100 (CET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id B448B20B91 for ; Fri, 6 Feb 2015 11:16:39 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Fri, 06 Feb 2015 11:16:39 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=eml.cc; h= x-sasl-enc:from:to:cc:subject:date:message-id; s=mesmtp; bh=Lg7A CrSoy24948S9g86rxCTQPfw=; b=NByPOHsLnYzXv8z3hRGgiDifaBu0nfRkYKB3 naU+PV3P7K87P9vJk4j8Fv9DF3usBaExmR3NujYF7flFjCAv7b3Gr9ZUR4WSPH37 HExiQBEinY2qKYug7csFtqzqAd+Pi0uW+3mQK08otgjoWIy1WXxKcfYZgh2cHcPO NbbpJKU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:date :message-id; s=smtpout; bh=Lg7ACrSoy24948S9g86rxCTQPfw=; b=mHpdG /ctDkbfde9d/t1Vd3sjqwfBY61NJ6uSbnpLmwQy0q8Mnv78o2o4xj2yiKVQv1q31 SLV3Y89jf5Zk3yDns2xoogI+CiMiqa9/pAV7tCQv1q09YHAHL+rGYybFTmPe+GKr 1QyUW00jrp08uZPldL8lgvSyKTHZfUYUcCeB1A= X-Sasl-enc: RF2ZaJ3vUqkcJIV5fr09YAriG+EdvCPlU7Tgsl0STCsf 1423239398 Received: from PC816.linn.co.uk (unknown [195.59.102.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 918396800F0; Fri, 6 Feb 2015 11:16:38 -0500 (EST) From: Tim Cussins To: alsa-devel@alsa-project.org Date: Fri, 6 Feb 2015 16:16:26 +0000 Message-Id: <1423239388-17745-1-git-send-email-timcussins@eml.cc> X-Mailer: git-send-email 1.9.1 Cc: Tim Cussins Subject: [alsa-devel] [PATCH v3 kernel 1/3] snd_pcm_start_at and friends. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP We introduce the kernel-side of the START_AT ioctl. struct runtime is updated to hold information about the currently active start_at timer, if any. This facilitates cancellation via snd_pcm_start_at_abort(), and querying via snd_pcm_status(). struct snd_start_at holds a startat operation and its arguments. Signed-off-by: Tim Cussins diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 0e88e7a..2943e1a 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -421,7 +421,10 @@ struct snd_pcm_status { snd_pcm_state_t suspended_state; /* suspended stream state */ __u32 reserved_alignment; /* must be filled with zero */ struct timespec audio_tstamp; /* from sample counter or wall clock */ - unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */ + int startat_pending; /* 1 if a start_at timer is pending, 0 otherwise */ + int startat_clock_type; /* start_at clock type, if pending */ + struct timespec startat_start_time; /* start_at start time, if pending */ + unsigned char reserved[48-(2*sizeof(struct timespec))]; /* must be filled with zero */ }; struct snd_pcm_mmap_status { @@ -473,6 +476,34 @@ enum { SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, }; +enum { + SNDRV_PCM_STARTAT_OP_SET = 0, + SNDRV_PCM_STARTAT_OP_CANCEL, + SNDRV_PCM_STARTAT_OP_STATUS, + SNDRV_PCM_STARTAT_OP_LAST = SNDRV_PCM_STARTAT_OP_STATUS, +}; + +enum { + SNDRV_PCM_STARTAT_CLOCK_TYPE_GETTIMEOFDAY = 0, + SNDRV_PCM_STARTAT_CLOCK_TYPE_MONOTONIC, + SNDRV_PCM_STARTAT_CLOCK_TYPE_LINK, + SNDRV_PCM_STARTAT_CLOCK_TYPE_LAST = SNDRV_PCM_STARTAT_CLOCK_TYPE_LINK, +}; + +struct snd_start_at { + int op; /* startat operation to be performed */ + union { /* fields for setting a startat timer */ + struct { + int clock_type; /* clock type e.g. SNDRV_PCM_STARTAT_CLOCK_TYPE_GETTIMEOFDAY */ + struct timespec start_time; /* start time */ + } set; + struct { + int clock_type; + struct timespec current_time; + } status; + } args; +}; + /* channel positions */ enum { SNDRV_CHMAP_UNKNOWN = 0, @@ -551,6 +582,8 @@ enum { #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) +#define SNDRV_PCM_IOCTL_START_AT _IOW('A', 0x62, struct snd_start_at) + /***************************************************************************** * *