mirror of
https://github.com/ArteryTek/AT32F415_Firmware_Library.git
synced 2026-05-21 01:12:20 +00:00
update version to v2.1.0
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 17. January 2013
|
||||
* $Revision: V1.4.0
|
||||
* $Revision: V1.4.0
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Project: CMSIS DSP Library
|
||||
*
|
||||
* Title: math_helper.h
|
||||
* Title: math_helper.h
|
||||
*
|
||||
* Description: Prototypes of all helper functions required.
|
||||
* Description: Prototypes of all helper functions required.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3
|
||||
*
|
||||
|
||||
@@ -52,4 +52,4 @@
|
||||
(c) if the ip-code is successfully executed, the green led4 should toggle
|
||||
continuously. else the red led2 toggles continuously.
|
||||
|
||||
for details, please refer to the application note document AN0065.
|
||||
for details, please refer to the application note document AN0065.
|
||||
@@ -2,12 +2,12 @@
|
||||
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 17. January 2013
|
||||
* $Revision: V1.4.0
|
||||
* $Revision: V1.4.0
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fir_data.c
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fir_data.c
|
||||
*
|
||||
* Description: Data file used for example code
|
||||
* Description: Data file used for example code
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
* - system clock = hext / 2 * pll_mult
|
||||
* - system clock source = pll (hext)
|
||||
* - hext = 8000000
|
||||
* system clock (sclk) = hext / 2 * pll_mult
|
||||
* system clock source = pll (hext)
|
||||
* - hext = HEXT_VALUE
|
||||
* - sclk = 144000000
|
||||
* - ahbdiv = 1
|
||||
* - ahbclk = 144000000
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 17. January 2013
|
||||
* $Revision: V1.4.0 b
|
||||
* $Revision: V1.4.0 b
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Project: CMSIS DSP Library
|
||||
*
|
||||
* Title: math_helper.c
|
||||
* Title: math_helper.c
|
||||
*
|
||||
* Description: Definition of all helper functions required.
|
||||
* Description: Definition of all helper functions required.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3
|
||||
*
|
||||
@@ -39,20 +39,20 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* -------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------
|
||||
* Include standard header files
|
||||
* Include standard header files
|
||||
* -------------------------------------------------------------------- */
|
||||
#include<math.h>
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Include project header files
|
||||
* Include project header files
|
||||
* -------------------------------------------------------------------- */
|
||||
#include "math_helper.h"
|
||||
|
||||
/**
|
||||
* @brief Caluclation of SNR
|
||||
* @param[in] pRef Pointer to the reference buffer
|
||||
* @param[in] pTest Pointer to the test buffer
|
||||
* @param[in] buffSize total number of samples
|
||||
* @param[in] pRef Pointer to the reference buffer
|
||||
* @param[in] pTest Pointer to the test buffer
|
||||
* @param[in] buffSize total number of samples
|
||||
* @return SNR
|
||||
* The function Caluclates signal to noise ratio for the reference output
|
||||
* and test output
|
||||
@@ -68,34 +68,34 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
|
||||
|
||||
for (i = 0; i < buffSize; i++)
|
||||
{
|
||||
/* Checking for a NAN value in pRef array */
|
||||
test = (int *)(&pRef[i]);
|
||||
/* Checking for a NAN value in pRef array */
|
||||
test = (int *)(&pRef[i]);
|
||||
temp = *test;
|
||||
|
||||
if (temp == 0x7FC00000)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
if (temp == 0x7FC00000)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Checking for a NAN value in pTest array */
|
||||
test = (int *)(&pTest[i]);
|
||||
/* Checking for a NAN value in pTest array */
|
||||
test = (int *)(&pTest[i]);
|
||||
temp = *test;
|
||||
|
||||
if (temp == 0x7FC00000)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
if (temp == 0x7FC00000)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
EnergySignal += pRef[i] * pRef[i];
|
||||
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
|
||||
}
|
||||
|
||||
/* Checking for a NAN value in EnergyError */
|
||||
test = (int *)(&EnergyError);
|
||||
/* Checking for a NAN value in EnergyError */
|
||||
test = (int *)(&EnergyError);
|
||||
temp = *test;
|
||||
|
||||
if (temp == 0x7FC00000)
|
||||
{
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
/* 1048576.0f corresponds to pow(2, 20) */
|
||||
/* 1048576.0f corresponds to pow(2, 20) */
|
||||
pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
|
||||
|
||||
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
|
||||
@@ -170,13 +170,13 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
|
||||
if (diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
if (diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
}
|
||||
|
||||
return(maxDiff);
|
||||
@@ -198,13 +198,13 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
|
||||
if (diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
if (diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
}
|
||||
|
||||
return(maxDiff);
|
||||
@@ -221,7 +221,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
|
||||
*/
|
||||
|
||||
void arm_provide_guard_bits_q31 (q31_t * input_buf,
|
||||
uint32_t blockSize,
|
||||
uint32_t blockSize,
|
||||
uint32_t guard_bits)
|
||||
{
|
||||
uint32_t i;
|
||||
@@ -243,7 +243,7 @@ void arm_provide_guard_bits_q31 (q31_t * input_buf,
|
||||
*/
|
||||
|
||||
void arm_provide_guard_bits_q7 (q7_t * input_buf,
|
||||
uint32_t blockSize,
|
||||
uint32_t blockSize,
|
||||
uint32_t guard_bits)
|
||||
{
|
||||
uint32_t i;
|
||||
@@ -258,7 +258,7 @@ void arm_provide_guard_bits_q7 (q7_t * input_buf,
|
||||
|
||||
/**
|
||||
* @brief Caluclates number of guard bits
|
||||
* @param[in] num_adds number of additions
|
||||
* @param[in] num_adds number of additions
|
||||
* @return guard bits
|
||||
* The function Caluclates the number of guard bits
|
||||
* depending on the numtaps
|
||||
@@ -291,8 +291,8 @@ uint32_t arm_calc_guard_bits (uint32_t num_adds)
|
||||
*/
|
||||
|
||||
void arm_apply_guard_bits (float32_t *pIn,
|
||||
uint32_t numSamples,
|
||||
uint32_t guard_bits)
|
||||
uint32_t numSamples,
|
||||
uint32_t guard_bits)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
@@ -304,7 +304,7 @@ void arm_apply_guard_bits (float32_t *pIn,
|
||||
|
||||
/**
|
||||
* @brief Calculates pow(2, numShifts)
|
||||
* @param[in] numShifts number of shifts
|
||||
* @param[in] numShifts number of shifts
|
||||
* @return pow(2, numShifts)
|
||||
*/
|
||||
uint32_t arm_calc_2pow(uint32_t numShifts)
|
||||
@@ -337,7 +337,7 @@ void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
/* 16384.0f corresponds to pow(2, 14) */
|
||||
/* 16384.0f corresponds to pow(2, 14) */
|
||||
pOut[i] = (q15_t) (pIn[i] * 16384.0f);
|
||||
|
||||
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
|
||||
@@ -367,7 +367,7 @@ void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
/* 1073741824.0f corresponds to pow(2, 30) */
|
||||
/* 1073741824.0f corresponds to pow(2, 30) */
|
||||
pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
|
||||
|
||||
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
|
||||
@@ -394,7 +394,7 @@ void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
/* 1073741824.0f corresponds to pow(2, 30) */
|
||||
/* 1073741824.0f corresponds to pow(2, 30) */
|
||||
pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
|
||||
|
||||
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
|
||||
@@ -422,7 +422,7 @@ void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
/* 268435456.0f corresponds to pow(2, 28) */
|
||||
/* 268435456.0f corresponds to pow(2, 28) */
|
||||
pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
|
||||
|
||||
pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
|
||||
@@ -449,13 +449,13 @@ void arm_clip_f32 (float *pIn, uint32_t numSamples)
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
if (pIn[i] > 1.0f)
|
||||
{
|
||||
pIn[i] = 1.0;
|
||||
}
|
||||
else if ( pIn[i] < -1.0f)
|
||||
{
|
||||
pIn[i] = -1.0;
|
||||
}
|
||||
{
|
||||
pIn[i] = 1.0;
|
||||
}
|
||||
else if ( pIn[i] < -1.0f)
|
||||
{
|
||||
pIn[i] = -1.0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user