blob: 23ba07122f7bb17bdc4b13aab8563bf34fd7344c [file] [log] [blame]
#ifndef __DXS_MISC_H__
#define __DXS_MISC_H__
/******************************************************************************
Copyright (c) 2006-2015 Lantiq Deutschland GmbH
Copyright (c) 2015 Lantiq Beteiligungs-GmbH & Co.KG
Copyright 2018, Intel Corporation.
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file dxs_misc.h
Miscellaneous functions declarations.
*/
/* ========================================================================== */
/* Includes */
/* ========================================================================== */
#include <stdint.h>
/* ========================================================================== */
/* Macro definitions */
/* ========================================================================== */
/* ========================================================================== */
/* Type definitions */
/* ========================================================================== */
/* ========================================================================== */
/* Function prototypes */
/* ========================================================================== */
extern uint16_t DXS_Misc_MulQ15 (int16_t a, int16_t b);
extern uint16_t DXS_Misc_LeveldB_to_Factor (int16_t dB_ten);
extern uint16_t DXS_Misc_PowerdB_to_Factor (int16_t dB_t);
extern uint32_t DXS_Misc_RoundDiv(uint32_t dividend, uint32_t divisor);
/******************************************************************************/
/* Fixed Point Calculations in Q4.27 format */
/******************************************************************************/
#define Q4_27_ONE (1 << 27)
#define Q4_27_TEN (10 * Q4_27_ONE)
/*extern int32_t DXS_Misc_Q4_27_Sqrt(int32_t a);*/
extern int32_t DXS_Misc_Float_to_Q4_27 (float f);
extern float DXS_Misc_Q4_27_to_Float (int32_t q);
extern int32_t DXS_Misc_Q4_27_Mul (int32_t a, int32_t b);
/******************************************************************************/
/* Fixed Point Calculations in Q15.16 format */
/******************************************************************************/
#define Q15_16_ONE (1 << 16)
#define Q15_16_HALF (Q15_16_ONE >> 1)
#define Q15_16_TEN (10 * Q15_16_ONE)
#define Q15_16_TWENTY (2 * Q15_16_TEN)
#define Q15_16__3_14 0x323D7
extern int32_t DXS_Misc_Float_to_Q15_16 (float f);
extern float DXS_Misc_Q15_16_to_Float (int32_t q);
extern int32_t DXS_Misc_Q15_16_Log10 (int32_t a);
extern int32_t DXS_Misc_Q15_16_Mul(int32_t a, int32_t b);
extern int32_t DXS_Misc_Q15_16_Div(int32_t a, int32_t b);
/******************************************************************************/
/* Other functions */
/******************************************************************************/
extern void DXS_Misc_DataBlkRor (unsigned char* , int , int );
#endif /* __DXS_MISC_H__ */