00001 /*----------------------------------------------------------------------------- 00002 * Copyright (C) 2011 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 15. December 2011 00005 * $Revision: V2.0.0 00006 * 00007 * Project: Cortex-R DSP Library 00008 * Title: arm_fir_interpolate_init_q15.c 00009 * 00010 * Description: Q15 FIR interpolator initialization function 00011 * 00012 * Target Processor: Cortex-R4/R5 00013 * 00014 * Version 1.0.0 2011/03/08 00015 * Alpha release. 00016 * 00017 * Version 1.0.1 2011/09/30 00018 * Beta release. 00019 * 00020 * Version 2.0.0 2011/12/15 00021 * Final release. 00022 * 00023 * ---------------------------------------------------------------------------*/ 00024 #include "arm_math.h" 00025 00059 arm_status arm_fir_interpolate_init_q15( 00060 arm_fir_interpolate_instance_q15 * S, 00061 uint8_t L, 00062 uint16_t numTaps, 00063 q15_t * pCoeffs, 00064 q15_t * pState, 00065 uint32_t blockSize) 00066 { 00067 arm_status status; 00068 00069 /* The filter length must be a multiple of the interpolation factor */ 00070 if((numTaps % L) != 0u) 00071 { 00072 /* Set status as ARM_MATH_LENGTH_ERROR */ 00073 status = ARM_MATH_LENGTH_ERROR; 00074 } 00075 else 00076 { 00077 00078 /* Assign coefficient pointer */ 00079 S->pCoeffs = pCoeffs; 00080 00081 /* Assign Interpolation factor */ 00082 S->L = L; 00083 00084 /* Assign polyPhaseLength */ 00085 S->phaseLength = numTaps / L; 00086 00087 /* Clear state buffer and size of buffer is always phaseLength + blockSize - 1 */ 00088 memset(pState, 0, 00089 (blockSize + ((uint32_t) S->phaseLength - 1u)) * sizeof(q15_t)); 00090 00091 /* Assign state pointer */ 00092 S->pState = pState; 00093 00094 status = ARM_MATH_SUCCESS; 00095 } 00096 00097 return (status); 00098 00099 } 00100