summaryrefslogtreecommitdiff
path: root/hifi/xaf/hifi-dpf/include/xf-timebase.h
diff options
context:
space:
mode:
Diffstat (limited to 'hifi/xaf/hifi-dpf/include/xf-timebase.h')
-rw-r--r--hifi/xaf/hifi-dpf/include/xf-timebase.h132
1 files changed, 0 insertions, 132 deletions
diff --git a/hifi/xaf/hifi-dpf/include/xf-timebase.h b/hifi/xaf/hifi-dpf/include/xf-timebase.h
deleted file mode 100644
index 7b27d580..00000000
--- a/hifi/xaf/hifi-dpf/include/xf-timebase.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
-* Copyright (C) 2018 Cadence Design Systems, Inc.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to use this Software with Cadence processor cores only and
-* not with any other processors and platforms, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************/
-
-/*******************************************************************************
- * xf-timebase.h
- *
- * Common timebase for deadline-driven scheduler
- *
- *******************************************************************************/
-
-#ifndef __XF_H
-#error "xf-timebase.h mustn't be included directly"
-#endif
-
-/*******************************************************************************
- * Timebase for deadline-driven scheduler
- ******************************************************************************/
-#ifdef XAF_ENABLE_NON_HIKEY
-/* ...set internal scheduler frequency as a LCM of all supported sample rates;
- * it is in general not a problem to have large number here, however it should
- * be noted that maximal-size audio-buffer that we handle, when expressed in
- * ticks of this virtual frequency, must not exceed 2**31 (for otherwise
- * scheduler timestamp comparison function will misbehave).
- */
-#define XF_TIMEBASE_FREQ (4 * 3 * 56448000U)
-/* ...add paranoic check considering maximal audio-buffer duration as 0.1 sec */
-C_BUG((u32)(XF_TIMEBASE_FREQ / 10) >= (1 << 31));
-#else
-/* ...set internal scheduler frequency as a LCM of all supported sample rates */
-#define XF_TIMEBASE_FREQ 56448000U
-#endif
-/* ...supported sampling rates */
-C_BUG(XF_TIMEBASE_FREQ % 4000);
-C_BUG(XF_TIMEBASE_FREQ % 8000);
-C_BUG(XF_TIMEBASE_FREQ % 11025);
-C_BUG(XF_TIMEBASE_FREQ % 12000);
-C_BUG(XF_TIMEBASE_FREQ % 16000);
-C_BUG(XF_TIMEBASE_FREQ % 22050);
-C_BUG(XF_TIMEBASE_FREQ % 24000);
-C_BUG(XF_TIMEBASE_FREQ % 32000);
-C_BUG(XF_TIMEBASE_FREQ % 44100);
-C_BUG(XF_TIMEBASE_FREQ % 48000);
-C_BUG(XF_TIMEBASE_FREQ % 64000);
-C_BUG(XF_TIMEBASE_FREQ % 88200);
-C_BUG(XF_TIMEBASE_FREQ % 96000);
-C_BUG(XF_TIMEBASE_FREQ % 128000);
-C_BUG(XF_TIMEBASE_FREQ % 176400);
-C_BUG(XF_TIMEBASE_FREQ % 192000);
-
-/* ...calculate upsampling factor for given sample rate */
-static inline u32 xf_timebase_factor(u32 sample_rate)
-{
- /* ...probably we can tolerate single division */
- switch(sample_rate)
- {
- case 4000:
- return XF_TIMEBASE_FREQ / 4000;
- case 8000:
- return XF_TIMEBASE_FREQ / 8000;
- case 11025:
- return XF_TIMEBASE_FREQ / 11025;
- case 12000:
- return XF_TIMEBASE_FREQ / 11025;
- case 16000:
- return XF_TIMEBASE_FREQ / 16000;
- case 22050:
- return XF_TIMEBASE_FREQ / 22050;
- case 24000:
- return XF_TIMEBASE_FREQ / 24000;
- case 32000:
- return XF_TIMEBASE_FREQ / 32000;
- case 44100:
- return XF_TIMEBASE_FREQ / 44100;
- case 48000:
- return XF_TIMEBASE_FREQ / 48000;
- case 64000:
- return XF_TIMEBASE_FREQ / 64000;
- case 88200:
- return XF_TIMEBASE_FREQ / 88200;
- case 96000:
- return XF_TIMEBASE_FREQ / 96000;
- case 128000:
- return XF_TIMEBASE_FREQ / 128000;
- case 176400:
- return XF_TIMEBASE_FREQ / 176400;
- case 192000:
- return XF_TIMEBASE_FREQ / 192000;
- default:
- return 0;
- }
-}
-
-/* ...core timebase */
-static inline u32 xf_core_timebase(u32 core)
-{
- xf_core_data_t *cd = XF_CORE_DATA(core);
-
- /* ...get local scheduler timebase */
- return xf_sched_timestamp(&cd->sched);
-}
-
-/* ...compare timestamps */
-static inline int xf_time_after(u32 a, u32 b)
-{
- return ((s32)(a - b) > 0);
-}
-
-/* ...compare timstamps */
-static inline int xf_time_before(u32 a, u32 b)
-{
- return ((s32)(a - b) < 0);
-}
-