CMSIS DSP library

Dependents:   performance_timer Surfboard_ gps2rtty Capstone ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Committer:
emilmont
Date:
Wed Nov 28 12:30:09 2012 +0000
Revision:
1:fdd22bb7aa52
Child:
2:da51fb522205
DSP library code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:fdd22bb7aa52 1 /* ----------------------------------------------------------------------
emilmont 1:fdd22bb7aa52 2 * Copyright (C) 2010 ARM Limited. All rights reserved.
emilmont 1:fdd22bb7aa52 3 *
emilmont 1:fdd22bb7aa52 4 * $Date: 15. February 2012
emilmont 1:fdd22bb7aa52 5 * $Revision: V1.1.0
emilmont 1:fdd22bb7aa52 6 *
emilmont 1:fdd22bb7aa52 7 * Project: CMSIS DSP Library
emilmont 1:fdd22bb7aa52 8 * Title: arm_fir_init_q7.c
emilmont 1:fdd22bb7aa52 9 *
emilmont 1:fdd22bb7aa52 10 * Description: Q7 FIR filter initialization function.
emilmont 1:fdd22bb7aa52 11 *
emilmont 1:fdd22bb7aa52 12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emilmont 1:fdd22bb7aa52 13 *
emilmont 1:fdd22bb7aa52 14 * Version 1.1.0 2012/02/15
emilmont 1:fdd22bb7aa52 15 * Updated with more optimizations, bug fixes and minor API changes.
emilmont 1:fdd22bb7aa52 16 *
emilmont 1:fdd22bb7aa52 17 * Version 1.0.10 2011/7/15
emilmont 1:fdd22bb7aa52 18 * Big Endian support added and Merged M0 and M3/M4 Source code.
emilmont 1:fdd22bb7aa52 19 *
emilmont 1:fdd22bb7aa52 20 * Version 1.0.3 2010/11/29
emilmont 1:fdd22bb7aa52 21 * Re-organized the CMSIS folders and updated documentation.
emilmont 1:fdd22bb7aa52 22 *
emilmont 1:fdd22bb7aa52 23 * Version 1.0.2 2010/11/11
emilmont 1:fdd22bb7aa52 24 * Documentation updated.
emilmont 1:fdd22bb7aa52 25 *
emilmont 1:fdd22bb7aa52 26 * Version 1.0.1 2010/10/05
emilmont 1:fdd22bb7aa52 27 * Production release and review comments incorporated.
emilmont 1:fdd22bb7aa52 28 *
emilmont 1:fdd22bb7aa52 29 * Version 1.0.0 2010/09/20
emilmont 1:fdd22bb7aa52 30 * Production release and review comments incorporated.
emilmont 1:fdd22bb7aa52 31 *
emilmont 1:fdd22bb7aa52 32 * Version 0.0.5 2010/04/26
emilmont 1:fdd22bb7aa52 33 * incorporated review comments and updated with latest CMSIS layer
emilmont 1:fdd22bb7aa52 34 *
emilmont 1:fdd22bb7aa52 35 * Version 0.0.3 2010/03/10
emilmont 1:fdd22bb7aa52 36 * Initial version
emilmont 1:fdd22bb7aa52 37 * ------------------------------------------------------------------- */
emilmont 1:fdd22bb7aa52 38
emilmont 1:fdd22bb7aa52 39 #include "arm_math.h"
emilmont 1:fdd22bb7aa52 40
emilmont 1:fdd22bb7aa52 41 /**
emilmont 1:fdd22bb7aa52 42 * @ingroup groupFilters
emilmont 1:fdd22bb7aa52 43 */
emilmont 1:fdd22bb7aa52 44
emilmont 1:fdd22bb7aa52 45 /**
emilmont 1:fdd22bb7aa52 46 * @addtogroup FIR
emilmont 1:fdd22bb7aa52 47 * @{
emilmont 1:fdd22bb7aa52 48 */
emilmont 1:fdd22bb7aa52 49 /**
emilmont 1:fdd22bb7aa52 50 * @param[in,out] *S points to an instance of the Q7 FIR filter structure.
emilmont 1:fdd22bb7aa52 51 * @param[in] numTaps Number of filter coefficients in the filter.
emilmont 1:fdd22bb7aa52 52 * @param[in] *pCoeffs points to the filter coefficients buffer.
emilmont 1:fdd22bb7aa52 53 * @param[in] *pState points to the state buffer.
emilmont 1:fdd22bb7aa52 54 * @param[in] blockSize number of samples that are processed per call.
emilmont 1:fdd22bb7aa52 55 * @return none
emilmont 1:fdd22bb7aa52 56 *
emilmont 1:fdd22bb7aa52 57 * <b>Description:</b>
emilmont 1:fdd22bb7aa52 58 * \par
emilmont 1:fdd22bb7aa52 59 * <code>pCoeffs</code> points to the array of filter coefficients stored in time reversed order:
emilmont 1:fdd22bb7aa52 60 * <pre>
emilmont 1:fdd22bb7aa52 61 * {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
emilmont 1:fdd22bb7aa52 62 * </pre>
emilmont 1:fdd22bb7aa52 63 * \par
emilmont 1:fdd22bb7aa52 64 * <code>pState</code> points to the array of state variables.
emilmont 1:fdd22bb7aa52 65 * <code>pState</code> is of length <code>numTaps+blockSize-1</code> samples, where <code>blockSize</code> is the number of input samples processed by each call to <code>arm_fir_q7()</code>.
emilmont 1:fdd22bb7aa52 66 */
emilmont 1:fdd22bb7aa52 67
emilmont 1:fdd22bb7aa52 68 void arm_fir_init_q7(
emilmont 1:fdd22bb7aa52 69 arm_fir_instance_q7 * S,
emilmont 1:fdd22bb7aa52 70 uint16_t numTaps,
emilmont 1:fdd22bb7aa52 71 q7_t * pCoeffs,
emilmont 1:fdd22bb7aa52 72 q7_t * pState,
emilmont 1:fdd22bb7aa52 73 uint32_t blockSize)
emilmont 1:fdd22bb7aa52 74 {
emilmont 1:fdd22bb7aa52 75
emilmont 1:fdd22bb7aa52 76 /* Assign filter taps */
emilmont 1:fdd22bb7aa52 77 S->numTaps = numTaps;
emilmont 1:fdd22bb7aa52 78
emilmont 1:fdd22bb7aa52 79 /* Assign coefficient pointer */
emilmont 1:fdd22bb7aa52 80 S->pCoeffs = pCoeffs;
emilmont 1:fdd22bb7aa52 81
emilmont 1:fdd22bb7aa52 82 /* Clear the state buffer. The size is always (blockSize + numTaps - 1) */
emilmont 1:fdd22bb7aa52 83 memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(q7_t));
emilmont 1:fdd22bb7aa52 84
emilmont 1:fdd22bb7aa52 85 /* Assign state pointer */
emilmont 1:fdd22bb7aa52 86 S->pState = pState;
emilmont 1:fdd22bb7aa52 87
emilmont 1:fdd22bb7aa52 88 }
emilmont 1:fdd22bb7aa52 89
emilmont 1:fdd22bb7aa52 90 /**
emilmont 1:fdd22bb7aa52 91 * @} end of FIR group
emilmont 1:fdd22bb7aa52 92 */