From patchwork Wed Jul 1 20:40:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 6706661 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7326DC05AC for ; Wed, 1 Jul 2015 20:44:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97747206E1 for ; Wed, 1 Jul 2015 20:44:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5825420489 for ; Wed, 1 Jul 2015 20:44:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D810E26592E; Wed, 1 Jul 2015 22:44:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 049F22658ED; Wed, 1 Jul 2015 22:42:31 +0200 (CEST) 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 B5CC42658D8; Wed, 1 Jul 2015 22:42:28 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 0E916265068 for ; Wed, 1 Jul 2015 22:41:33 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 01 Jul 2015 13:41:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,388,1432623600"; d="scan'208";a="738774057" Received: from gjlavell-mobl3.amr.corp.intel.com (HELO pbossart-mobl2.ger.corp.intel.com) ([10.252.8.159]) by fmsmga001.fm.intel.com with ESMTP; 01 Jul 2015 13:41:33 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 1 Jul 2015 15:40:58 -0500 Message-Id: <1435783258-23730-6-git-send-email-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435783258-23730-1-git-send-email-pierre-louis.bossart@linux.intel.com> References: <1435783258-23730-1-git-send-email-pierre-louis.bossart@linux.intel.com> Cc: tiwai@suse.de, Pierre-Louis Bossart Subject: [alsa-devel] [PATCH v4 5/5] test: audio_time: show report validity and accuracy 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 Add checks to show if driver reports valid report and resolution information. disabled by default Signed-off-by: Pierre-Louis Bossart --- test/audio_time.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/test/audio_time.c b/test/audio_time.c index e369e59..a54c10d 100644 --- a/test/audio_time.c +++ b/test/audio_time.c @@ -33,6 +33,7 @@ static void usage(char *command) "-D, --device=NAME select PCM by name \n" "-p, --playback playback tstamps \n" "-t, --ts_type=TYPE Default(0),link(1),link_estimated(2),synchronized(3) \n" + "-r, --report show audio timestamp and accuracy validity\n" , command); } @@ -128,7 +129,7 @@ int main(int argc, char *argv[]) snd_pcm_audio_tstamp_report_t audio_tstamp_report_c; int option_index; - static const char short_options[] = "hcpdD:t:"; + static const char short_options[] = "hcpdrD:t:"; static const struct option long_options[] = { {"capture", 0, 0, 'c'}, @@ -137,6 +138,7 @@ int main(int argc, char *argv[]) {"help", no_argument, 0, 'h'}, {"playback", 0, 0, 'p'}, {"ts_type", required_argument, 0, 't'}, + {"report", 0, 0, 'r'}, {0, 0, 0, 0} }; @@ -144,6 +146,7 @@ int main(int argc, char *argv[]) int do_playback = 0; int do_capture = 0; int type = 0; + int do_report = 0; while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) { switch (c) { @@ -165,6 +168,8 @@ int main(int argc, char *argv[]) case 't': type = atoi(optarg); break; + case 'r': + do_report = 1; } } @@ -376,11 +381,19 @@ int main(int argc, char *argv[]) (long long)curr_count_c * 1000000000LL / SAMPLE_FREQ - timestamp2ns(audio_tstamp_c) ); #endif + if (do_report) { + if (audio_tstamp_report_c.valid == 0) + printf("Audio capture timestamp report invalid - "); + if (audio_tstamp_report_c.accuracy_report == 0) + printf("Audio capture timestamp accuracy report invalid"); + printf("\n"); + } + - printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli\n", + printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli \t resolution %d ns \n", timediff(tstamp_c, trigger_tstamp_c), timestamp2ns(audio_tstamp_c), - timediff(tstamp_c, trigger_tstamp_c) - timestamp2ns(audio_tstamp_c) + timediff(tstamp_c, trigger_tstamp_c) - timestamp2ns(audio_tstamp_c), audio_tstamp_report_c.accuracy ); #endif } @@ -411,11 +424,18 @@ int main(int argc, char *argv[]) (long long)curr_count_p * 1000000000LL / SAMPLE_FREQ - timestamp2ns(audio_tstamp_p) ); #endif + if (do_report) { + if (audio_tstamp_report_p.valid == 0) + printf("Audio playback timestamp report invalid - "); + if (audio_tstamp_report_p.accuracy_report == 0) + printf("Audio playback timestamp accuracy report invalid"); + printf("\n"); + } - printf("playback: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli\n", + printf("playback: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli resolution %d ns\n", timediff(tstamp_p, trigger_tstamp_p), timestamp2ns(audio_tstamp_p), - timediff(tstamp_p, trigger_tstamp_p) - timestamp2ns(audio_tstamp_p) + timediff(tstamp_p, trigger_tstamp_p) - timestamp2ns(audio_tstamp_p), audio_tstamp_report_p.accuracy ); #endif }