Browse Source

add:更新部分至最新sdk(分步省的出问题,先来最没用的)

Dozingfiretruck 3 years ago
parent
commit
c7705524ad

+ 1 - 0
.gitignore

@@ -6,3 +6,4 @@ lib/build/
 lib/bin/
 tools/xt804/AIR101_secboot.img
 tools/xt804/wm_tool
+releases/

+ 2 - 0
include/app/wm_http_client.h

@@ -126,6 +126,8 @@ typedef signed long             LONG;
 #define HTTP_CLIENT_ERROR_TLS_NEGO			30
 /** Feature is not (yet) implemented */
 #define HTTP_CLIENT_ERROR_NOT_IMPLEMENTED   64
+/** Connection closed.       */
+#define HTTP_CLIENT_ERROR_CONNECTION_CLOSE	500
 /** HTTP end of stream message */
 #define HTTP_CLIENT_EOS                     1000
 

+ 5 - 0
include/arch/xt804/csi_config.h

@@ -9,6 +9,11 @@
 #define CONFIG_IRQ_VECTOR_SIZE   256
 #define USE_UART0_PRINT            1
 
+/*for dsp function used*/
+#define SAVE_VR_REGISTERS          1
+/*for float function used*/
+#define SAVE_HIGH_REGISTERS     1
+
 #ifdef CONFIG_KERNEL_NONE
 #define CONFIG_SYSTEM_SECURE  1
 #endif

+ 0 - 140
include/arch/xt804/csi_dsp/csky_vdsp2_const_structs.h

@@ -1,140 +0,0 @@
-/******************************************************************************
- * @file     csky_vdsp2_const_structs.h
- * @brief    This file has constant structs that are initialized for
- *           user convenience.  For example, some can be given as
- *           arguments to the csky_vdsp2_cfft_f32() function.
- * @version  V1.0
- * @date     20. Dec 2016
- ******************************************************************************/
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2016 CSKY Limited. All rights reserved.
- *
- * Redistribution and use of this software in source and binary forms,
- * with or without modification, are permitted provided that the following
- * conditions are met:
- *   * Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright notice,
- *     this list of conditions and the following disclaimer in the documentation
- *     and/or other materials provided with the distribution.
- *   * Neither the name of CSKY Ltd. nor the names of CSKY's contributors may
- *     be used to endorse or promote products derived from this software without
- *     specific prior written permission of CSKY Ltd.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- * -------------------------------------------------------------------------- */
-
-#ifndef _CSKY_CONST_STRUCTS_H
-#define _CSKY_CONST_STRUCTS_H
-
-#include "csky_vdsp2_math.h"
-#include "csky_common_tables.h"
-
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len16;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len32;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len64;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len128;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len256;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len512;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len1024;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len2048;
-   extern const csky_vdsp2_cfft_instance_f32 csky_vdsp2_cfft_sR_f32_len4096;
-
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len16;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len32;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len64;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len128;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len256;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len512;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len1024;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len2048;
-   extern const csky_vdsp2_cfft_instance_q31 csky_vdsp2_cfft_sR_q31_len4096;
-
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len16;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len32;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len64;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len128;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len256;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len512;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len1024;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len2048;
-   extern const csky_vdsp2_cfft_instance_q15 csky_vdsp2_cfft_sR_q15_len4096;
-
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len32;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len64;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len128;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len256;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len512;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len1024;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len2048;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len4096;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_rfft_sR_q15_len8192;
-
-
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len32;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len64;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len128;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len256;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len512;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len1024;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len2048;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len4096;
-   extern csky_vdsp2_rfft_instance_q15 csky_vdsp2_inv_rfft_sR_q15_len8192;
-
-
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len32;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len64;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len128;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len256;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len512;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len1024;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len2048;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len4096;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_rfft_sR_q31_len8192;
-
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len32;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len64;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len128;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len256;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len512;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len1024;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len2048;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len4096;
-   extern csky_vdsp2_rfft_instance_q31 csky_vdsp2_inv_rfft_sR_q31_len8192;
-
-
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len32;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len64;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len128;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len256;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len512;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len1024;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len2048;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len4096;
-   extern csky_vdsp2_rfft_fast_instance_f32 csky_vdsp2_rfft_sR_f32_len8192;
-
-   extern csky_vdsp2_dct4_instance_q15 csky_vdsp2_dct4_sR_q15_len128;
-   extern csky_vdsp2_dct4_instance_q15 csky_vdsp2_dct4_sR_q15_len512;
-   extern csky_vdsp2_dct4_instance_q15 csky_vdsp2_dct4_sR_q15_len2048;
-   extern csky_vdsp2_dct4_instance_q15 csky_vdsp2_dct4_sR_q15_len8192;
-
-   extern csky_vdsp2_dct4_instance_q31 csky_vdsp2_dct4_sR_q31_len128;
-   extern csky_vdsp2_dct4_instance_q31 csky_vdsp2_dct4_sR_q31_len512;
-   extern csky_vdsp2_dct4_instance_q31 csky_vdsp2_dct4_sR_q31_len2048;
-   extern csky_vdsp2_dct4_instance_q31 csky_vdsp2_dct4_sR_q31_len8192;
-
-   extern csky_vdsp2_dct4_instance_f32 csky_vdsp2_dct4_sR_f32_len128;
-   extern csky_vdsp2_dct4_instance_f32 csky_vdsp2_dct4_sR_f32_len512;
-   extern csky_vdsp2_dct4_instance_f32 csky_vdsp2_dct4_sR_f32_len2048;
-   extern csky_vdsp2_dct4_instance_f32 csky_vdsp2_dct4_sR_f32_len8192;
-#endif

+ 0 - 2291
include/arch/xt804/csi_dsp/csky_vdsp2_math.h

@@ -1,2291 +0,0 @@
-/******************************************************************************
- * @file     csky_vdsp2_math.h
- * @brief    Public header file for CSI DSP Library.
- * @version  V1.0
- * @date     20. Dec 2016
- ******************************************************************************/
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2016 CSKY Limited. All rights reserved.
- *
- * Redistribution and use of this software in source and binary forms,
- * with or without modification, are permitted provided that the following
- * conditions are met:
- *   * Redistributions of source code must retain the above copyright notice,
- *     this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright notice,
- *     this list of conditions and the following disclaimer in the documentation
- *     and/or other materials provided with the distribution.
- *   * Neither the name of CSKY Ltd. nor the names of CSKY's contributors may
- *     be used to endorse or promote products derived from this software without
- *     specific prior written permission of CSKY Ltd.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- * -------------------------------------------------------------------------- */
-
-#ifndef _CSKY_VDSP2_MATH_H
-#define _CSKY_VDSP2_MATH_H
-
-#include "csky_math.h"
-
-#ifdef   __cplusplus
-extern "C"
-{
-#endif
-
-  /**
-   * @brief Error status returned by some functions in the library.
-   */
-
-  typedef enum
-  {
-    CSKY_VDSP2_MATH_SUCCESS = 0,                /**< No error */
-    CSKY_VDSP2_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */
-    CSKY_VDSP2_MATH_LENGTH_ERROR = -2,          /**< Length of data buffer is incorrect */
-    CSKY_VDSP2_MATH_SIZE_MISMATCH = -3,         /**< Size of matrices is not compatible with the operation. */
-    CSKY_VDSP2_MATH_NANINF = -4,                /**< Not-a-number (NaN) or infinity is generated */
-    CSKY_VDSP2_MATH_SINGULAR = -5,              /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
-    CSKY_VDSP2_MATH_TEST_FAILURE = -6           /**< Test Failed  */
-  } csky_vdsp2_status;
-
-  /**
-   * @brief Instance structure for the Q7 FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;        /**< number of filter coefficients in the filter. */
-    q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
-  } csky_vdsp2_fir_instance_q7;
-
-  /**
-   * @brief Instance structure for the Q15 FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;         /**< number of filter coefficients in the filter. */
-    q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
-  } csky_vdsp2_fir_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;         /**< number of filter coefficients in the filter. */
-    q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */
-  } csky_vdsp2_fir_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;     /**< number of filter coefficients in the filter. */
-    float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
-  } csky_vdsp2_fir_instance_f32;
-
-  void csky_vdsp2_fir_q7(
-  const csky_vdsp2_fir_instance_q7 * S,
-  q7_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_init_q7(
-  csky_vdsp2_fir_instance_q7 * S,
-  uint16_t numTaps,
-  q7_t * pCoeffs,
-  q7_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_q15(
-  const csky_vdsp2_fir_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_fast_q15(
-  const csky_vdsp2_fir_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_init_q15(
-  csky_vdsp2_fir_instance_q15 * S,
-  uint16_t numTaps,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_q31(
-  const csky_vdsp2_fir_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_fast_q31(
-  const csky_vdsp2_fir_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_init_q31(
-  csky_vdsp2_fir_instance_q31 * S,
-  uint16_t numTaps,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_f32(
-  const csky_vdsp2_fir_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_init_f32(
-  csky_vdsp2_fir_instance_f32 * S,
-  uint16_t numTaps,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q15 Biquad cascade filter.
-   */
-  typedef struct
-  {
-    int8_t numStages;        /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    q15_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
-    q15_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
-    int8_t postShift;        /**< Additional shift, in bits, applied to each output sample. */
-  } csky_vdsp2_biquad_casd_df1_inst_q15;
-
-  /**
-   * @brief Instance structure for the Q31 Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
-    q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
-    uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */
-  } csky_vdsp2_biquad_casd_df1_inst_q31;
-
- /**
-   * @brief Instance structure for the Q31 Biquad cascade filter.
-   */
-
-  /**
-   * @brief Instance structure for the floating-point Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    float32_t *pState;       /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
-    float32_t *pCoeffs;      /**< Points to the array of coefficients.  The array is of length 5*numStages. */
-  } csky_vdsp2_biquad_casd_df1_inst_f32;
-
-  void csky_vdsp2_biquad_cascade_df1_q15(
-  const csky_vdsp2_biquad_casd_df1_inst_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df1_init_q15(
-  csky_vdsp2_biquad_casd_df1_inst_q15 * S,
-  uint8_t numStages,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  int8_t postShift);
-
-  void csky_vdsp2_biquad_cascade_df1_fast_q15(
-  const csky_vdsp2_biquad_casd_df1_inst_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df1_q31(
-  const csky_vdsp2_biquad_casd_df1_inst_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df1_fast_q31(
-  const csky_vdsp2_biquad_casd_df1_inst_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df1_init_q31(
-  csky_vdsp2_biquad_casd_df1_inst_q31 * S,
-  uint8_t numStages,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  int8_t postShift);
-
-  void csky_vdsp2_biquad_cascade_df1_f32(
-  const csky_vdsp2_biquad_casd_df1_inst_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df1_init_f32(
-  csky_vdsp2_biquad_casd_df1_inst_f32 * S,
-  uint8_t numStages,
-  float32_t * pCoeffs,
-  float32_t * pState);
-
-
-  /**
-   * @brief Instance structure for the floating-point matrix structure.
-   */
-  typedef struct
-  {
-    uint16_t numRows;     /**< number of rows of the matrix.     */
-    uint16_t numCols;     /**< number of columns of the matrix.  */
-    float32_t *pData;     /**< points to the data of the matrix. */
-  } csky_vdsp2_matrix_instance_f32;
-
-
-  /**
-   * @brief Instance structure for the floating-point matrix structure.
-   */
-  typedef struct
-  {
-    uint16_t numRows;     /**< number of rows of the matrix.     */
-    uint16_t numCols;     /**< number of columns of the matrix.  */
-    float64_t *pData;     /**< points to the data of the matrix. */
-  } csky_vdsp2_matrix_instance_f64;
-
-  /**
-   * @brief Instance structure for the Q15 matrix structure.
-   */
-  typedef struct
-  {
-    uint16_t numRows;     /**< number of rows of the matrix.     */
-    uint16_t numCols;     /**< number of columns of the matrix.  */
-    q15_t *pData;         /**< points to the data of the matrix. */
-  } csky_vdsp2_matrix_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 matrix structure.
-   */
-  typedef struct
-  {
-    uint16_t numRows;     /**< number of rows of the matrix.     */
-    uint16_t numCols;     /**< number of columns of the matrix.  */
-    q31_t *pData;         /**< points to the data of the matrix. */
-  } csky_vdsp2_matrix_instance_q31;
-
-  csky_vdsp2_status csky_vdsp2_mat_add_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrcA,
-  const csky_vdsp2_matrix_instance_f32 * pSrcB,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_add_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_add_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_cmplx_mult_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrcA,
-  const csky_vdsp2_matrix_instance_f32 * pSrcB,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_cmplx_mult_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst,
-  q15_t * pScratch);
-
-  csky_vdsp2_status csky_vdsp2_mat_cmplx_mult_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_trans_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrc,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_trans_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrc,
-  csky_vdsp2_matrix_instance_q15 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_trans_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrc,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrcA,
-  const csky_vdsp2_matrix_instance_f32 * pSrcB,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst,
-  q15_t * pState);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_trans_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst,
-  q15_t * pState);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_fast_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst,
-  q15_t * pState);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_trans_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_mult_fast_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_sub_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrcA,
-  const csky_vdsp2_matrix_instance_f32 * pSrcB,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_sub_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrcA,
-  const csky_vdsp2_matrix_instance_q15 * pSrcB,
-  csky_vdsp2_matrix_instance_q15 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_sub_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrcA,
-  const csky_vdsp2_matrix_instance_q31 * pSrcB,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_scale_f32(
-  const csky_vdsp2_matrix_instance_f32 * pSrc,
-  float32_t scale,
-  csky_vdsp2_matrix_instance_f32 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_scale_q15(
-  const csky_vdsp2_matrix_instance_q15 * pSrc,
-  q15_t scaleFract,
-  int32_t shift,
-  csky_vdsp2_matrix_instance_q15 * pDst);
-
-  csky_vdsp2_status csky_vdsp2_mat_scale_q31(
-  const csky_vdsp2_matrix_instance_q31 * pSrc,
-  q31_t scaleFract,
-  int32_t shift,
-  csky_vdsp2_matrix_instance_q31 * pDst);
-
-  void csky_vdsp2_mat_init_q31(
-  csky_vdsp2_matrix_instance_q31 * S,
-  uint16_t nRows,
-  uint16_t nColumns,
-  q31_t * pData);
-
-  void csky_vdsp2_mat_init_q15(
-  csky_vdsp2_matrix_instance_q15 * S,
-  uint16_t nRows,
-  uint16_t nColumns,
-  q15_t * pData);
-
-  void csky_vdsp2_mat_init_f32(
-  csky_vdsp2_matrix_instance_f32 * S,
-  uint16_t nRows,
-  uint16_t nColumns,
-  float32_t * pData);
-
-  void csky_vdsp2_mult_q7(
-  q7_t * pSrcA,
-  q7_t * pSrcB,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_mult_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_mult_rnd_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_mult_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_mult_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q15 CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                 /**< length of the FFT. */
-    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    q15_t *pTwiddle;                 /**< points to the Sin twiddle factor table. */
-    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-  } csky_vdsp2_cfft_radix2_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q15 CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                 /**< length of the FFT. */
-    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    q15_t *pTwiddle;                 /**< points to the twiddle factor table. */
-    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-  } csky_vdsp2_cfft_radix4_instance_q15;
-
-  /**
-   * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                 /**< length of the FFT. */
-    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    q31_t *pTwiddle;                 /**< points to the Twiddle factor table. */
-    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-  } csky_vdsp2_cfft_radix2_instance_q31;
-
-  /**
-   * @brief Instance structure for the Q31 CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                 /**< length of the FFT. */
-    uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    q31_t *pTwiddle;                 /**< points to the twiddle factor table. */
-    uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-  } csky_vdsp2_cfft_radix4_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                   /**< length of the FFT. */
-    uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
-    uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-    float32_t onebyfftLen;             /**< value of 1/fftLen. */
-  } csky_vdsp2_cfft_radix2_instance_f32;
-
-  /**
-   * @brief Instance structure for the floating-point CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                   /**< length of the FFT. */
-    uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
-    uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
-    float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
-    uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
-    uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
-    float32_t onebyfftLen;             /**< value of 1/fftLen. */
-  } csky_vdsp2_cfft_radix4_instance_f32;
-
-  /**
-   * @brief Instance structure for the fixed-point CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                   /**< length of the FFT. */
-    const q15_t *pTwiddle;             /**< points to the Twiddle factor table. */
-    const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
-    uint16_t bitRevLength;             /**< bit reversal table length. */
-  } csky_vdsp2_cfft_instance_q15;
-
-void csky_vdsp2_cfft_q15(
-    const csky_vdsp2_cfft_instance_q15 * S,
-    q15_t * p1,
-    uint8_t ifftFlag,
-    uint8_t bitReverseFlag);
-
-  /**
-   * @brief Instance structure for the fixed-point CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                   /**< length of the FFT. */
-    const q31_t *pTwiddle;             /**< points to the Twiddle factor table. */
-    const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
-    uint16_t bitRevLength;             /**< bit reversal table length. */
-  } csky_vdsp2_cfft_instance_q31;
-
-void csky_vdsp2_cfft_q31(
-    const csky_vdsp2_cfft_instance_q31 * S,
-    q31_t * p1,
-    uint8_t ifftFlag,
-    uint8_t bitReverseFlag);
-
-  /**
-   * @brief Instance structure for the floating-point CFFT/CIFFT function.
-   */
-  typedef struct
-  {
-    uint16_t fftLen;                   /**< length of the FFT. */
-    const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */
-    const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
-    uint16_t bitRevLength;             /**< bit reversal table length. */
-  } csky_vdsp2_cfft_instance_f32;
-
-  void csky_vdsp2_cfft_f32(
-  const csky_vdsp2_cfft_instance_f32 * S,
-  float32_t * p1,
-  uint8_t ifftFlag,
-  uint8_t bitReverseFlag);
-
-  /**
-   * @brief Instance structure for the Q15 RFFT/RIFFT function.
-   */
-  typedef struct
-  {
-    uint32_t fftLenReal;                      /**< length of the real FFT. */
-    uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
-    uint8_t bitReverseFlagR;                  /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
-    uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */
-    const csky_vdsp2_cfft_instance_q15 *pCfft;      /**< points to the complex FFT instance. */
-  } csky_vdsp2_rfft_instance_q15;
-
-  csky_vdsp2_status csky_vdsp2_rfft_init_q15(
-  csky_vdsp2_rfft_instance_q15 * S,
-  uint32_t fftLenReal,
-  uint32_t ifftFlagR,
-  uint32_t bitReverseFlag);
-
-  void csky_vdsp2_rfft_q15(
-  const csky_vdsp2_rfft_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst);
-
-  /**
-   * @brief Instance structure for the Q31 RFFT/RIFFT function.
-   */
-  typedef struct
-  {
-    uint32_t fftLenReal;                        /**< length of the real FFT. */
-    uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
-    uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
-    uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */
-    const csky_vdsp2_cfft_instance_q31 *pCfft;        /**< points to the complex FFT instance. */
-  } csky_vdsp2_rfft_instance_q31;
-
-  csky_vdsp2_status csky_vdsp2_rfft_init_q31(
-  csky_vdsp2_rfft_instance_q31 * S,
-  uint32_t fftLenReal,
-  uint32_t ifftFlagR,
-  uint32_t bitReverseFlag);
-
-  void csky_vdsp2_rfft_q31(
-  const csky_vdsp2_rfft_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst);
-
-  /**
-   * @brief Instance structure for the floating-point RFFT/RIFFT function.
-   */
-  typedef struct
-  {
-    uint32_t fftLenReal;                        /**< length of the real FFT. */
-    uint16_t fftLenBy2;                         /**< length of the complex FFT. */
-    uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
-    uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
-    uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
-    float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */
-    float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */
-    csky_vdsp2_cfft_radix4_instance_f32 *pCfft;       /**< points to the complex FFT instance. */
-  } csky_vdsp2_rfft_instance_f32;
-
-  csky_vdsp2_status csky_vdsp2_rfft_init_f32(
-  csky_vdsp2_rfft_instance_f32 * S,
-  csky_vdsp2_cfft_radix4_instance_f32 * S_CFFT,
-  uint32_t fftLenReal,
-  uint32_t ifftFlagR,
-  uint32_t bitReverseFlag);
-
-  void csky_vdsp2_rfft_f32(
-  const csky_vdsp2_rfft_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst);
-
-  /**
-   * @brief Instance structure for the floating-point RFFT/RIFFT function.
-   */
-typedef struct
-  {
-    csky_vdsp2_cfft_instance_f32 Sint;     /**< Internal CFFT structure. */
-    uint16_t fftLenRFFT;             /**< length of the real sequence */
-    float32_t * pTwiddleRFFT;        /**< Twiddle factors real stage  */
-  } csky_vdsp2_rfft_fast_instance_f32 ;
-
-csky_vdsp2_status csky_vdsp2_rfft_fast_init_f32 (
-   csky_vdsp2_rfft_fast_instance_f32 * S,
-   uint16_t fftLen);
-
-void csky_vdsp2_rfft_fast_f32(
-  csky_vdsp2_rfft_fast_instance_f32 * S,
-  float32_t * p, float32_t * pOut,
-  uint8_t ifftFlag);
-
-  /**
-   * @brief Instance structure for the floating-point DCT4/IDCT4 function.
-   */
-  typedef struct
-  {
-    uint16_t N;                           /**< length of the DCT4. */
-    uint16_t Nby2;                        /**< half of the length of the DCT4. */
-    float32_t normalize;                  /**< normalizing factor. */
-    float32_t *pTwiddle;                  /**< points to the twiddle factor table. */
-    float32_t *pCosFactor;                /**< points to the cosFactor table. */
-    csky_vdsp2_rfft_fast_instance_f32 *pRfft;   /**< points to the real FFT fast instance. */
-    csky_vdsp2_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
-  } csky_vdsp2_dct4_instance_f32;
-
-  csky_vdsp2_status csky_vdsp2_dct4_init_f32(
-  csky_vdsp2_dct4_instance_f32 * S,
-  csky_vdsp2_rfft_fast_instance_f32 * S_RFFT,
-  csky_vdsp2_cfft_radix4_instance_f32 * S_CFFT,
-  uint16_t N,
-  uint16_t Nby2,
-  float32_t normalize);
-
-  void csky_vdsp2_dct4_f32(
-  const csky_vdsp2_dct4_instance_f32 * S,
-  float32_t * pState,
-  float32_t * pInlineBuffer);
-
-
-  /**
-   * @brief Instance structure for the Q31 DCT4/IDCT4 function.
-   */
-  typedef struct
-  {
-    uint16_t N;                           /**< length of the DCT4. */
-    uint16_t Nby2;                        /**< half of the length of the DCT4. */
-    q31_t normalize;                      /**< normalizing factor. */
-    q31_t *pTwiddle;                      /**< points to the twiddle factor table. */
-    q31_t *pCosFactor;                    /**< points to the cosFactor table. */
-    csky_vdsp2_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */
-    csky_vdsp2_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
-  } csky_vdsp2_dct4_instance_q31;
-
-  csky_vdsp2_status csky_vdsp2_dct4_init_q31(
-  csky_vdsp2_dct4_instance_q31 * S,
-  csky_vdsp2_rfft_instance_q31 * S_RFFT,
-  csky_vdsp2_cfft_radix4_instance_q31 * S_CFFT,
-  uint16_t N,
-  uint16_t Nby2,
-  q31_t normalize);
-
-  void csky_vdsp2_dct4_q31(
-  const csky_vdsp2_dct4_instance_q31 * S,
-  q31_t * pState,
-  q31_t * pInlineBuffer);
-
-  /**
-   * @brief Instance structure for the Q15 DCT4/IDCT4 function.
-   */
-  typedef struct
-  {
-    uint16_t N;                           /**< length of the DCT4. */
-    uint16_t Nby2;                        /**< half of the length of the DCT4. */
-    q15_t normalize;                      /**< normalizing factor. */
-    q15_t *pTwiddle;                      /**< points to the twiddle factor table. */
-    q15_t *pCosFactor;                    /**< points to the cosFactor table. */
-    csky_vdsp2_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */
-    csky_vdsp2_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
-  } csky_vdsp2_dct4_instance_q15;
-
-  csky_vdsp2_status csky_vdsp2_dct4_init_q15(
-  csky_vdsp2_dct4_instance_q15 * S,
-  csky_vdsp2_rfft_instance_q15 * S_RFFT,
-  csky_vdsp2_cfft_radix4_instance_q15 * S_CFFT,
-  uint16_t N,
-  uint16_t Nby2,
-  q15_t normalize);
-
-  void csky_vdsp2_dct4_q15(
-  const csky_vdsp2_dct4_instance_q15 * S,
-  q15_t * pState,
-  q15_t * pInlineBuffer);
-
-  void csky_vdsp2_add_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_add_q7(
-  q7_t * pSrcA,
-  q7_t * pSrcB,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_add_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_add_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_sub_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_sub_q7(
-  q7_t * pSrcA,
-  q7_t * pSrcB,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_sub_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_sub_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_scale_f32(
-  float32_t * pSrc,
-  float32_t scale,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_scale_q7(
-  q7_t * pSrc,
-  q7_t scaleFract,
-  int8_t shift,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_scale_q15(
-  q15_t * pSrc,
-  q15_t scaleFract,
-  int8_t shift,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_scale_q31(
-  q31_t * pSrc,
-  q31_t scaleFract,
-  int8_t shift,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_q7(
-  q7_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_max_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_abs_max_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-
-  void csky_vdsp2_dot_prod_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  uint32_t blockSize,
-  float32_t * result);
-
-  void csky_vdsp2_dot_prod_q7(
-  q7_t * pSrcA,
-  q7_t * pSrcB,
-  uint32_t blockSize,
-  q31_t * result);
-
-  void csky_vdsp2_dot_prod_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  uint32_t blockSize,
-  q63_t * result);
-
-  void csky_vdsp2_dot_prod_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  uint32_t blockSize,
-  q63_t * result);
-
-  void csky_vdsp2_shift_q7(
-  q7_t * pSrc,
-  int8_t shiftBits,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_shift_q15(
-  q15_t * pSrc,
-  int8_t shiftBits,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_shift_q31(
-  q31_t * pSrc,
-  int8_t shiftBits,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_offset_f32(
-  float32_t * pSrc,
-  float32_t offset,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_offset_q7(
-  q7_t * pSrc,
-  q7_t offset,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_offset_q15(
-  q15_t * pSrc,
-  q15_t offset,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_offset_q31(
-  q31_t * pSrc,
-  q31_t offset,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_negate_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_negate_q7(
-  q7_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_negate_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_negate_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_copy_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_copy_q7(
-  q7_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_copy_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_copy_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fill_f32(
-  float32_t value,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fill_q7(
-  q7_t value,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fill_q15(
-  q15_t value,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fill_q31(
-  q31_t value,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_conv_f32(
-  float32_t * pSrcA,
-  uint32_t srcALen,
-  float32_t * pSrcB,
-  uint32_t srcBLen,
-  float32_t * pDst);
-
-  void csky_vdsp2_conv_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  void csky_vdsp2_conv_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst);
-
-  void csky_vdsp2_conv_fast_q15(
-          q15_t * pSrcA,
-          uint32_t srcALen,
-          q15_t * pSrcB,
-          uint32_t srcBLen,
-          q15_t * pDst);
-
-  void csky_vdsp2_conv_fast_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  void csky_vdsp2_conv_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst);
-
-  void csky_vdsp2_conv_fast_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst);
-
-  void csky_vdsp2_conv_opt_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  void csky_vdsp2_conv_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_f32(
-  float32_t * pSrcA,
-  uint32_t srcALen,
-  float32_t * pSrcB,
-  uint32_t srcBLen,
-  float32_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_fast_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_fast_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_fast_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_opt_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  csky_vdsp2_status csky_vdsp2_conv_partial_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst,
-  uint32_t firstIndex,
-  uint32_t numPoints);
-
-  /**
-   * @brief Instance structure for the Q15 FIR decimator.
-   */
-  typedef struct
-  {
-    uint8_t M;                  /**< decimation factor. */
-    uint16_t numTaps;           /**< number of coefficients in the filter. */
-    q15_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/
-    q15_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-  } csky_vdsp2_fir_decimate_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 FIR decimator.
-   */
-  typedef struct
-  {
-    uint8_t M;                  /**< decimation factor. */
-    uint16_t numTaps;           /**< number of coefficients in the filter. */
-    q31_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/
-    q31_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-  } csky_vdsp2_fir_decimate_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point FIR decimator.
-   */
-  typedef struct
-  {
-    uint8_t M;                  /**< decimation factor. */
-    uint16_t numTaps;           /**< number of coefficients in the filter. */
-    float32_t *pCoeffs;         /**< points to the coefficient array. The array is of length numTaps.*/
-    float32_t *pState;          /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-  } csky_vdsp2_fir_decimate_instance_f32;
-
-  void csky_vdsp2_fir_decimate_f32(
-  const csky_vdsp2_fir_decimate_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_decimate_init_f32(
-  csky_vdsp2_fir_decimate_instance_f32 * S,
-  uint16_t numTaps,
-  uint8_t M,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_decimate_q15(
-  const csky_vdsp2_fir_decimate_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_decimate_fast_q15(
-  const csky_vdsp2_fir_decimate_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_decimate_init_q15(
-  csky_vdsp2_fir_decimate_instance_q15 * S,
-  uint16_t numTaps,
-  uint8_t M,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_decimate_q31(
-  const csky_vdsp2_fir_decimate_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_decimate_fast_q31(
-  csky_vdsp2_fir_decimate_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_decimate_init_q31(
-  csky_vdsp2_fir_decimate_instance_q31 * S,
-  uint16_t numTaps,
-  uint8_t M,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q15 FIR interpolator.
-   */
-  typedef struct
-  {
-    uint8_t L;                      /**< upsample factor. */
-    uint16_t phaseLength;           /**< length of each polyphase filter component. */
-    q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
-    q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
-  } csky_vdsp2_fir_interpolate_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 FIR interpolator.
-   */
-  typedef struct
-  {
-    uint8_t L;                      /**< upsample factor. */
-    uint16_t phaseLength;           /**< length of each polyphase filter component. */
-    q31_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
-    q31_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
-  } csky_vdsp2_fir_interpolate_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point FIR interpolator.
-   */
-  typedef struct
-  {
-    uint8_t L;                     /**< upsample factor. */
-    uint16_t phaseLength;          /**< length of each polyphase filter component. */
-    float32_t *pCoeffs;            /**< points to the coefficient array. The array is of length L*phaseLength. */
-    float32_t *pState;             /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
-  } csky_vdsp2_fir_interpolate_instance_f32;
-
-  void csky_vdsp2_fir_interpolate_q15(
-  const csky_vdsp2_fir_interpolate_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_interpolate_init_q15(
-  csky_vdsp2_fir_interpolate_instance_q15 * S,
-  uint8_t L,
-  uint16_t numTaps,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_interpolate_q31(
-  const csky_vdsp2_fir_interpolate_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_interpolate_init_q31(
-  csky_vdsp2_fir_interpolate_instance_q31 * S,
-  uint8_t L,
-  uint16_t numTaps,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_interpolate_f32(
-  const csky_vdsp2_fir_interpolate_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_fir_interpolate_init_f32(
-  csky_vdsp2_fir_interpolate_instance_f32 * S,
-  uint8_t L,
-  uint16_t numTaps,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the high precision Q31 Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */
-    q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */
-    uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */
-  } csky_vdsp2_biquad_cas_df1_32x64_ins_q31;
-
-  void csky_vdsp2_biquad_cas_df1_32x64_q31(
-  const csky_vdsp2_biquad_cas_df1_32x64_ins_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cas_df1_32x64_init_q31(
-  csky_vdsp2_biquad_cas_df1_32x64_ins_q31 * S,
-  uint8_t numStages,
-  q31_t * pCoeffs,
-  q63_t * pState,
-  uint8_t postShift);
-
-
-  /**
-   * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
-    float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
-  } csky_vdsp2_biquad_cascade_df2T_instance_f32;
-
-  /**
-   * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 4*numStages. */
-    float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
-  } csky_vdsp2_biquad_cascade_stereo_df2T_instance_f32;
-
-  /**
-   * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
-   */
-  typedef struct
-  {
-    uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
-    float64_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
-    float64_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
-  } csky_vdsp2_biquad_cascade_df2T_instance_f64;
-
-  void csky_vdsp2_biquad_cascade_df2T_f32(
-  const csky_vdsp2_biquad_cascade_df2T_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_stereo_df2T_f32(
-  const csky_vdsp2_biquad_cascade_stereo_df2T_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df2T_f64(
-  const csky_vdsp2_biquad_cascade_df2T_instance_f64 * S,
-  float64_t * pSrc,
-  float64_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_biquad_cascade_df2T_init_f32(
-  csky_vdsp2_biquad_cascade_df2T_instance_f32 * S,
-  uint8_t numStages,
-  float32_t * pCoeffs,
-  float32_t * pState);
-
-  void csky_vdsp2_biquad_cascade_stereo_df2T_init_f32(
-  csky_vdsp2_biquad_cascade_stereo_df2T_instance_f32 * S,
-  uint8_t numStages,
-  float32_t * pCoeffs,
-  float32_t * pState);
-
-
-  void csky_vdsp2_biquad_cascade_df2T_init_f64(
-  csky_vdsp2_biquad_cascade_df2T_instance_f64 * S,
-  uint8_t numStages,
-  float64_t * pCoeffs,
-  float64_t * pState);
-
-
-  /**
-   * @brief Instance structure for the Q15 FIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of filter stages. */
-    q15_t *pState;                       /**< points to the state variable array. The array is of length numStages. */
-    q15_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */
-  } csky_vdsp2_fir_lattice_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 FIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of filter stages. */
-    q31_t *pState;                       /**< points to the state variable array. The array is of length numStages. */
-    q31_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */
-  } csky_vdsp2_fir_lattice_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point FIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of filter stages. */
-    float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */
-    float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */
-  } csky_vdsp2_fir_lattice_instance_f32;
-
-  void csky_vdsp2_fir_lattice_init_q15(
-  csky_vdsp2_fir_lattice_instance_q15 * S,
-  uint16_t numStages,
-  q15_t * pCoeffs,
-  q15_t * pState);
-
-  void csky_vdsp2_fir_lattice_q15(
-  const csky_vdsp2_fir_lattice_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_lattice_init_q31(
-  csky_vdsp2_fir_lattice_instance_q31 * S,
-  uint16_t numStages,
-  q31_t * pCoeffs,
-  q31_t * pState);
-
-  void csky_vdsp2_fir_lattice_q31(
-  const csky_vdsp2_fir_lattice_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_lattice_init_f32(
-  csky_vdsp2_fir_lattice_instance_f32 * S,
-  uint16_t numStages,
-  float32_t * pCoeffs,
-  float32_t * pState);
-
-  void csky_vdsp2_fir_lattice_f32(
-  const csky_vdsp2_fir_lattice_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q15 IIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of stages in the filter. */
-    q15_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */
-    q15_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */
-    q15_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */
-  } csky_vdsp2_iir_lattice_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q31 IIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of stages in the filter. */
-    q31_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */
-    q31_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */
-    q31_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */
-  } csky_vdsp2_iir_lattice_instance_q31;
-
-  /**
-   * @brief Instance structure for the floating-point IIR lattice filter.
-   */
-  typedef struct
-  {
-    uint16_t numStages;                  /**< number of stages in the filter. */
-    float32_t *pState;                   /**< points to the state variable array. The array is of length numStages+blockSize. */
-    float32_t *pkCoeffs;                 /**< points to the reflection coefficient array. The array is of length numStages. */
-    float32_t *pvCoeffs;                 /**< points to the ladder coefficient array. The array is of length numStages+1. */
-  } csky_vdsp2_iir_lattice_instance_f32;
-
-  void csky_vdsp2_iir_lattice_f32(
-  const csky_vdsp2_iir_lattice_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_iir_lattice_init_f32(
-  csky_vdsp2_iir_lattice_instance_f32 * S,
-  uint16_t numStages,
-  float32_t * pkCoeffs,
-  float32_t * pvCoeffs,
-  float32_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_iir_lattice_q31(
-  const csky_vdsp2_iir_lattice_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_iir_lattice_init_q31(
-  csky_vdsp2_iir_lattice_instance_q31 * S,
-  uint16_t numStages,
-  q31_t * pkCoeffs,
-  q31_t * pvCoeffs,
-  q31_t * pState,
-  uint32_t blockSize);
-
-  void csky_vdsp2_iir_lattice_q15(
-  const csky_vdsp2_iir_lattice_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_iir_lattice_init_q15(
-  csky_vdsp2_iir_lattice_instance_q15 * S,
-  uint16_t numStages,
-  q15_t * pkCoeffs,
-  q15_t * pvCoeffs,
-  q15_t * pState,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the floating-point LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;    /**< number of coefficients in the filter. */
-    float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */
-    float32_t mu;        /**< step size that controls filter coefficient updates. */
-  } csky_vdsp2_lms_instance_f32;
-
-  void csky_vdsp2_lms_f32(
-  const csky_vdsp2_lms_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pRef,
-  float32_t * pOut,
-  float32_t * pErr,
-  uint32_t blockSize);
-
-  void csky_vdsp2_lms_init_f32(
-  csky_vdsp2_lms_instance_f32 * S,
-  uint16_t numTaps,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  float32_t mu,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q15 LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;    /**< number of coefficients in the filter. */
-    q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
-    q15_t mu;            /**< step size that controls filter coefficient updates. */
-    uint32_t postShift;  /**< bit shift applied to coefficients. */
-  } csky_vdsp2_lms_instance_q15;
-
-  void csky_vdsp2_lms_init_q15(
-  csky_vdsp2_lms_instance_q15 * S,
-  uint16_t numTaps,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  q15_t mu,
-  uint32_t blockSize,
-  uint32_t postShift);
-
-  void csky_vdsp2_lms_q15(
-  const csky_vdsp2_lms_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pRef,
-  q15_t * pOut,
-  q15_t * pErr,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q31 LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;    /**< number of coefficients in the filter. */
-    q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
-    q31_t mu;            /**< step size that controls filter coefficient updates. */
-    uint32_t postShift;  /**< bit shift applied to coefficients. */
-  } csky_vdsp2_lms_instance_q31;
-
-  void csky_vdsp2_lms_q31(
-  const csky_vdsp2_lms_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pRef,
-  q31_t * pOut,
-  q31_t * pErr,
-  uint32_t blockSize);
-
-  void csky_vdsp2_lms_init_q31(
-  csky_vdsp2_lms_instance_q31 * S,
-  uint16_t numTaps,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  q31_t mu,
-  uint32_t blockSize,
-  uint32_t postShift);
-
-
-  /**
-   * @brief Instance structure for the floating-point normalized LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;     /**< number of coefficients in the filter. */
-    float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
-    float32_t mu;         /**< step size that control filter coefficient updates. */
-    float32_t energy;     /**< saves previous frame energy. */
-    float32_t x0;         /**< saves previous input sample. */
-  } csky_vdsp2_lms_norm_instance_f32;
-
-  void csky_vdsp2_lms_norm_f32(
-  csky_vdsp2_lms_norm_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pRef,
-  float32_t * pOut,
-  float32_t * pErr,
-  uint32_t blockSize);
-
-  void csky_vdsp2_lms_norm_init_f32(
-  csky_vdsp2_lms_norm_instance_f32 * S,
-  uint16_t numTaps,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  float32_t mu,
-  uint32_t blockSize);
-
-
-  /**
-   * @brief Instance structure for the Q31 normalized LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;     /**< number of coefficients in the filter. */
-    q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
-    q31_t mu;             /**< step size that controls filter coefficient updates. */
-    uint8_t postShift;    /**< bit shift applied to coefficients. */
-    q31_t *recipTable;    /**< points to the reciprocal initial value table. */
-    q31_t energy;         /**< saves previous frame energy. */
-    q31_t x0;             /**< saves previous input sample. */
-  } csky_vdsp2_lms_norm_instance_q31;
-
-  void csky_vdsp2_lms_norm_q31(
-  csky_vdsp2_lms_norm_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pRef,
-  q31_t * pOut,
-  q31_t * pErr,
-  uint32_t blockSize);
-
-  void csky_vdsp2_lms_norm_init_q31(
-  csky_vdsp2_lms_norm_instance_q31 * S,
-  uint16_t numTaps,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  q31_t mu,
-  uint32_t blockSize,
-  uint8_t postShift);
-
-
-  /**
-   * @brief Instance structure for the Q15 normalized LMS filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;     /**< Number of coefficients in the filter. */
-    q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
-    q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
-    q15_t mu;             /**< step size that controls filter coefficient updates. */
-    uint8_t postShift;    /**< bit shift applied to coefficients. */
-    q15_t *recipTable;    /**< Points to the reciprocal initial value table. */
-    q15_t energy;         /**< saves previous frame energy. */
-    q15_t x0;             /**< saves previous input sample. */
-  } csky_vdsp2_lms_norm_instance_q15;
-
-  void csky_vdsp2_lms_norm_q15(
-  csky_vdsp2_lms_norm_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pRef,
-  q15_t * pOut,
-  q15_t * pErr,
-  uint32_t blockSize);
-
-  void csky_vdsp2_lms_norm_init_q15(
-  csky_vdsp2_lms_norm_instance_q15 * S,
-  uint16_t numTaps,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  q15_t mu,
-  uint32_t blockSize,
-  uint8_t postShift);
-
-  void csky_vdsp2_correlate_f32(
-  float32_t * pSrcA,
-  uint32_t srcALen,
-  float32_t * pSrcB,
-  uint32_t srcBLen,
-  float32_t * pDst);
-
-  void csky_vdsp2_correlate_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  q15_t * pScratch);
-
-  void csky_vdsp2_correlate_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst);
-
-  void csky_vdsp2_correlate_fast_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst);
-
-  void csky_vdsp2_correlate_fast_opt_q15(
-  q15_t * pSrcA,
-  uint32_t srcALen,
-  q15_t * pSrcB,
-  uint32_t srcBLen,
-  q15_t * pDst,
-  q15_t * pScratch);
-
-  void csky_vdsp2_correlate_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst);
-
-  void csky_vdsp2_correlate_fast_q31(
-  q31_t * pSrcA,
-  uint32_t srcALen,
-  q31_t * pSrcB,
-  uint32_t srcBLen,
-  q31_t * pDst);
-
-  void csky_vdsp2_correlate_opt_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst,
-  q15_t * pScratch1,
-  q15_t * pScratch2);
-
-  void csky_vdsp2_correlate_q7(
-  q7_t * pSrcA,
-  uint32_t srcALen,
-  q7_t * pSrcB,
-  uint32_t srcBLen,
-  q7_t * pDst);
-
-
-  /**
-   * @brief Instance structure for the floating-point sparse FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;             /**< number of coefficients in the filter. */
-    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
-    float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
-    float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
-    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
-    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
-  } csky_vdsp2_fir_sparse_instance_f32;
-
-  /**
-   * @brief Instance structure for the Q31 sparse FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;             /**< number of coefficients in the filter. */
-    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
-    q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
-    q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
-    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
-    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
-  } csky_vdsp2_fir_sparse_instance_q31;
-
-  /**
-   * @brief Instance structure for the Q15 sparse FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;             /**< number of coefficients in the filter. */
-    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
-    q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
-    q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
-    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
-    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
-  } csky_vdsp2_fir_sparse_instance_q15;
-
-  /**
-   * @brief Instance structure for the Q7 sparse FIR filter.
-   */
-  typedef struct
-  {
-    uint16_t numTaps;             /**< number of coefficients in the filter. */
-    uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
-    q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
-    q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/
-    uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
-    int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
-  } csky_vdsp2_fir_sparse_instance_q7;
-
-  void csky_vdsp2_fir_sparse_f32(
-  csky_vdsp2_fir_sparse_instance_f32 * S,
-  float32_t * pSrc,
-  float32_t * pDst,
-  float32_t * pScratchIn,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_init_f32(
-  csky_vdsp2_fir_sparse_instance_f32 * S,
-  uint16_t numTaps,
-  float32_t * pCoeffs,
-  float32_t * pState,
-  int32_t * pTapDelay,
-  uint16_t maxDelay,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_q31(
-  csky_vdsp2_fir_sparse_instance_q31 * S,
-  q31_t * pSrc,
-  q31_t * pDst,
-  q31_t * pScratchIn,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_init_q31(
-  csky_vdsp2_fir_sparse_instance_q31 * S,
-  uint16_t numTaps,
-  q31_t * pCoeffs,
-  q31_t * pState,
-  int32_t * pTapDelay,
-  uint16_t maxDelay,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_q15(
-  csky_vdsp2_fir_sparse_instance_q15 * S,
-  q15_t * pSrc,
-  q15_t * pDst,
-  q15_t * pScratchIn,
-  q31_t * pScratchOut,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_init_q15(
-  csky_vdsp2_fir_sparse_instance_q15 * S,
-  uint16_t numTaps,
-  q15_t * pCoeffs,
-  q15_t * pState,
-  int32_t * pTapDelay,
-  uint16_t maxDelay,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_q7(
-  csky_vdsp2_fir_sparse_instance_q7 * S,
-  q7_t * pSrc,
-  q7_t * pDst,
-  q7_t * pScratchIn,
-  q31_t * pScratchOut,
-  uint32_t blockSize);
-
-  void csky_vdsp2_fir_sparse_init_q7(
-  csky_vdsp2_fir_sparse_instance_q7 * S,
-  uint16_t numTaps,
-  q7_t * pCoeffs,
-  q7_t * pState,
-  int32_t * pTapDelay,
-  uint16_t maxDelay,
-  uint32_t blockSize);
-
-  void csky_vdsp2_sin_cos_f32(
-  float32_t theta,
-  float32_t * pSinVal,
-  float32_t * pCosVal);
-
-  void csky_vdsp2_sin_cos_q31(
-  q31_t theta,
-  q31_t * pSinVal,
-  q31_t * pCosVal);
-
-  void csky_vdsp2_cmplx_conj_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_conj_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_conj_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mag_squared_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mag_squared_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mag_squared_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_vsqrt_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_vsqrt_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_vsqrt_q7(
-  q7_t * pSrc,
-  q7_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_q7_to_q31(
-  q7_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q7_to_q15(
-  q7_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q7_to_float(
-  q7_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q31_to_float(
-  q31_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  csky_vdsp2_status csky_vdsp2_sqrt_f32(
-  float32_t in,
-  float32_t * pOut);
-
-  csky_vdsp2_status csky_vdsp2_sqrt_q31(
-  q31_t in,
-  q31_t * pOut);
-
-  csky_vdsp2_status csky_vdsp2_sqrt_q15(
-  q15_t in,
-  q15_t * pOut);
-
-  void csky_vdsp2_power_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q63_t * pResult);
-
-  void csky_vdsp2_power_int32(
-  int32_t * pSrc,
-  uint32_t blockSize,
-  q63_t * pResult);
-
-  void csky_vdsp2_power_int32(
-  int32_t * pSrc,
-  uint32_t blockSize,
-  q63_t * pResult);
-
-  void csky_vdsp2_power_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult);
-
-  void csky_vdsp2_power_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q63_t * pResult);
-
-  void csky_vdsp2_power_q7(
-  q7_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult);
-
-  void csky_vdsp2_mean_q7(
-  q7_t * pSrc,
-  uint32_t blockSize,
-  q7_t * pResult);
-
-  void csky_vdsp2_mean_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult);
-
-  void csky_vdsp2_mean_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult);
-
-  void csky_vdsp2_mean_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult);
-
-  void csky_vdsp2_var_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult);
-
-  void csky_vdsp2_var_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult);
-
-  void csky_vdsp2_var_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult);
-
-  void csky_vdsp2_rms_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult);
-
-  void csky_vdsp2_rms_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult);
-
-  void csky_vdsp2_rms_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult);
-
-  void csky_vdsp2_std_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult);
-
-  void csky_vdsp2_std_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult);
-
-  void csky_vdsp2_std_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult);
-
-  void csky_vdsp2_cmplx_mag_f32(
-  float32_t * pSrc,
-  float32_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mag_q31(
-  q31_t * pSrc,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mag_q15(
-  q15_t * pSrc,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_dot_prod_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  uint32_t numSamples,
-  q31_t * realResult,
-  q31_t * imagResult);
-
-  void csky_vdsp2_cmplx_dot_prod_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  uint32_t numSamples,
-  q63_t * realResult,
-  q63_t * imagResult);
-
-  void csky_vdsp2_cmplx_dot_prod_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  uint32_t numSamples,
-  float32_t * realResult,
-  float32_t * imagResult);
-
-  void csky_vdsp2_cmplx_mult_real_q15(
-  q15_t * pSrcCmplx,
-  q15_t * pSrcReal,
-  q15_t * pCmplxDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_real_q31(
-  q31_t * pSrcCmplx,
-  q31_t * pSrcReal,
-  q31_t * pCmplxDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_real_f32(
-  float32_t * pSrcCmplx,
-  float32_t * pSrcReal,
-  float32_t * pCmplxDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_min_q7(
-  q7_t * pSrc,
-  uint32_t blockSize,
-  q7_t * result,
-  uint32_t * index);
-
-  void csky_vdsp2_min_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_min_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_min_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_max_q7(
-  q7_t * pSrc,
-  uint32_t blockSize,
-  q7_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_max_q15(
-  q15_t * pSrc,
-  uint32_t blockSize,
-  q15_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_max_q31(
-  q31_t * pSrc,
-  uint32_t blockSize,
-  q31_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_max_f32(
-  float32_t * pSrc,
-  uint32_t blockSize,
-  float32_t * pResult,
-  uint32_t * pIndex);
-
-  void csky_vdsp2_cmplx_mult_cmplx_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_cmplx_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_cmplx_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  float32_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_cmplx_re_q15(
-  q15_t * pSrcA,
-  q15_t * pSrcB,
-  q15_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_cmplx_re_q31(
-  q31_t * pSrcA,
-  q31_t * pSrcB,
-  q31_t * pDst,
-  uint32_t numSamples);
-
-  void csky_vdsp2_cmplx_mult_cmplx_re_f32(
-  float32_t * pSrcA,
-  float32_t * pSrcB,
-  float32_t * pDst,
-  uint32_t numSamples);
-
-
-  void csky_vdsp2_float_to_q31(
-  float32_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_float_to_q15(
-  float32_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_float_to_q7(
-  float32_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q31_to_q15(
-  q31_t * pSrc,
-  q15_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q31_to_q7(
-  q31_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q15_to_float(
-  q15_t * pSrc,
-  float32_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q15_to_q31(
-  q15_t * pSrc,
-  q31_t * pDst,
-  uint32_t blockSize);
-
-  void csky_vdsp2_q15_to_q7(
-  q15_t * pSrc,
-  q7_t * pDst,
-  uint32_t blockSize);
-
-#endif /* _CSKY_VDSP2_MATH_H */
-
-/**
- *
- * End of file.
- */

+ 36 - 0
include/bt/wm_bt.h

@@ -410,6 +410,42 @@ tls_bt_status_t enable_bt_test_mode(tls_bt_hci_if_t *p_hci_if);
 
 void tls_rf_bt_mode(uint8_t enable);
 
+/**
+ * @brief          this function enable controller to running in mesh mode or not
+ *
+ * @param[in]       1, mesh mode, 0 normal mode
+ *
+ * @retval         None
+ *
+ * @note           None
+ */
+
+tls_bt_status_t tls_bt_set_mesh_mode(uint8_t enable);
+
+/**
+ * @brief          this function register callback function when controller entering or exiting sleep mode 
+ *
+ * @param[in]      sleep_enter, sleep starting callback;sleep_exit, sleep exiting callback
+ *
+ * @retval         TLS_BT_STATUS_SUCCESS or TLS_BT_STATUS_UNSUPPORTED;
+ *
+ * @note           None
+ */
+
+tls_bt_status_t tls_bt_register_sleep_callback(tls_bt_controller_sleep_enter_func_ptr sleep_enter, tls_bt_controller_sleep_exit_func_ptr sleep_exit);
+
+/**
+ * @brief          this function register blocking operation function(eg. flash read/write).
+ *
+ * @param[in]      process_ptr blocking operation function pointer
+ *
+ * @retval         always TLS_BT_STATUS_SUCCESS;
+ *
+ * @note           if the function is running, the system interrupt will be holded. so we have to do ti when bt is in idle state
+ */
+
+tls_bt_status_t tls_bt_register_pending_process_callback(tls_bt_app_pending_process_func_ptr process_ptr);
+
 /**
  * @}
  */

+ 191 - 0
include/bt/wm_bt_api.h

@@ -0,0 +1,191 @@
+#ifndef __WM_BT_API_H__
+#define __WM_BT_API_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if (WM_NIMBLE_INCLUDED == CFG_ON)
+#include "wm_bt.h"
+#include "wm_ble.h"
+
+extern tls_bt_status_t enable_bt_test_mode(tls_bt_hci_if_t *p_hci_if);
+extern tls_bt_status_t exit_bt_test_mode();
+
+extern int tls_at_bt_enable(int uart_no, tls_bt_log_level_t log_level);
+extern int tls_at_bt_destroy(void);
+extern void tls_rf_bt_mode(uint8_t mode);
+extern int tls_ble_client_demo_api_init(tls_ble_uart_output_ptr output_func_ptr,tls_ble_uart_sent_ptr uart_in_and_sent_ptr);
+extern int tls_ble_server_demo_api_init(tls_ble_uart_output_ptr output_func_ptr,tls_ble_uart_sent_ptr uart_in_and_sent_ptr);
+extern int tls_ble_client_demo_api_deinit();
+extern int tls_ble_server_demo_api_deinit();
+extern int tls_ble_client_multi_conn_demo_api_init();
+extern int tls_ble_client_multi_conn_demo_api_deinit();
+extern int tls_ble_uart_init(tls_ble_uart_mode_t mode, uint8_t uart_id, tls_uart_options_t *p_hci_if);
+extern int tls_ble_uart_deinit(tls_ble_uart_mode_t mode,uint8_t uart_id);
+extern int tls_ble_demo_adv(uint8_t type);
+extern int tls_ble_demo_scan(uint8_t start);
+extern tls_bt_status_t tls_ble_set_scan_chnl_map(uint8_t map);
+extern int tls_ble_client_demo_api_send_msg(uint8_t *ptr, int length);
+extern int tls_ble_server_demo_api_send_msg(uint8_t *data, int data_len);
+
+
+extern int tls_ble_gap_set_name(const char *dev_name, uint8_t update_flash);
+extern int tls_ble_gap_get_name(char *dev_name);
+extern int tls_ble_gap_set_data(wm_ble_gap_data_t type, uint8_t *data, uint8_t data_len);
+extern int tls_ble_gap_set_adv_param(uint8_t adv_type, uint32_t min, uint32_t max, uint8_t chn_map, uint8_t filter_policy, uint8_t *dir_mac, uint8_t dir_mac_type);
+extern int tls_ble_gap_set_scan_param(uint32_t intv, uint32_t window, uint8_t filter_policy, bool limited, bool passive, bool filter_duplicate);
+extern int tls_nimble_gap_adv(wm_ble_adv_type_t type, int duration);
+extern void tls_ble_demo_scan_at_cmd_register(void (*scan_resp_cb_fn)(int type, int8_t rssi, uint8_t *addr, const uint8_t *name, int name_len, const uint8_t *raw_scan_resp, int raw_scan_resp_length));
+extern void tls_ble_demo_scan_at_cmd_unregister();
+extern int tls_ble_gap_scan(wm_ble_scan_type_t type, bool filter_duplicate);
+
+
+#if (WM_MESH_INCLUDED == CFG_ON) 
+extern int tls_ble_mesh_init(tls_bt_mesh_at_callback_t at_cb, tls_bt_mesh_role_t role, bool running);
+extern int tls_ble_mesh_deinit(void);
+extern int tls_ble_mesh_get_cfg(tls_mesh_primary_cfg_t *cfg);
+extern int tls_ble_mesh_get_primary_addr(uint16_t *primary_addr);
+extern int tls_ble_mesh_change_ttl(uint8_t ttl);
+extern int tls_ble_mesh_change_primary_addr(uint16_t primary_addr);
+extern int tls_ble_mesh_clear_local_rpl(void);
+extern int tls_ble_mesh_gen_level_set(uint16_t net_idx, uint16_t dst, uint16_t app_idx, int16_t val,
+                               int16_t *state);
+extern int tls_ble_mesh_gen_level_get(uint16_t net_idx, uint16_t dst, uint16_t app_idx, int16_t *state);
+extern int tls_ble_mesh_gen_off_publish(uint8_t onoff_state);
+extern int tls_ble_mesh_gen_onoff_get(uint16_t net_idx, uint16_t dst, uint16_t app_idx, uint8_t *state);
+extern int tls_ble_mesh_gen_onoff_set(uint16_t net_idx, uint16_t dst, uint16_t app_idx, uint8_t val,
+                               uint8_t *state);
+extern int tls_ble_mesh_pub_set(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t mod_id,
+                         uint16_t cid,
+                         tls_bt_mesh_cfg_mod_pub *pub, uint8_t *status);
+extern int tls_ble_mesh_pub_get(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t mod_id,
+                         uint16_t cid, tls_bt_mesh_cfg_mod_pub *pub, uint8_t *status);
+extern int tls_ble_mesh_sub_add(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t sub_addr,
+                         uint16_t mod_id, uint16_t cid, uint8_t *status);
+
+extern int tls_ble_mesh_sub_del(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t sub_addr,
+                         uint16_t mod_id, uint16_t cid, uint8_t *status);
+extern int tls_ble_mesh_sub_add(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t sub_addr,
+                         uint16_t mod_id, uint16_t cid, uint8_t *status);
+extern int tls_ble_mesh_sub_get(uint16_t net_idx, uint16_t dst, uint16_t elem_addr, uint16_t mod_id,
+                         uint16_t cid,
+                         uint8_t *status, uint16_t *subs, uint32_t *sub_cnt);
+extern int tls_ble_mesh_friend_set(uint16_t net_idx, uint16_t dst, uint8_t val, uint8_t *status);
+extern int tls_ble_mesh_friend_get(uint16_t net_idx, uint16_t dst, uint8_t *val);
+extern int tls_ble_mesh_proxy_get(uint16_t net_idx, uint16_t dst, uint8_t *proxy);
+extern int tls_ble_mesh_proxy_set(uint16_t net_idx, uint16_t dst, uint8_t val, uint8_t *proxy);
+extern int tls_ble_mesh_relay_get(uint16_t net_idx, uint16_t dst, uint8_t *relay, uint8_t *transmit);
+extern int tls_ble_mesh_relay_set(uint16_t net_idx, uint16_t dst, uint8_t relay, uint8_t count,
+                           uint8_t interval, uint8_t *status, uint8_t *transmit);
+extern int tls_ble_mesh_unbind_app_key(uint16_t net_idx, uint16_t dst, uint16_t elem_addr,
+                                uint16_t mod_app_idx, uint16_t mod_id, uint16_t cid, uint8_t *status);
+extern int tls_ble_mesh_bind_app_key(uint16_t net_idx, uint16_t dst, uint16_t elem_addr,
+                              uint16_t mod_app_idx, uint16_t mod_id, uint16_t cid, uint8_t *status);
+extern int tls_ble_mesh_add_app_key(uint16_t net_idx, uint16_t dst, uint16_t key_net_idx,
+                             uint16_t key_app_idx, uint8_t app_key[16], uint8_t *status);
+extern int tls_ble_mesh_add_local_app_key(uint16_t net_idx, uint16_t app_idx, uint8_t app_key[16]);
+extern int tls_ble_mesh_input_oob_number(uint32_t number);
+extern int tls_ble_mesh_input_oob_string(const char *string);
+extern int tls_ble_mesh_node_reset(uint16_t net_idx, uint16_t addr, uint8_t *status);
+extern int tls_ble_mesh_provisioner_prov_adv(uint8_t uuid[16], uint16_t net_idx, uint16_t addr,
+                                      uint8_t duration);
+extern int tls_ble_mesh_provisioner_scan(bool enable);
+extern int tls_ble_mesh_clear_local_rpl(void);
+extern int tls_ble_mesh_change_primary_addr(uint16_t primary_addr);
+extern int tls_ble_mesh_get_primary_addr(uint16_t *primary_addr);
+extern int tls_ble_mesh_change_ttl(uint8_t ttl);
+extern int tls_ble_mesh_get_cfg(tls_mesh_primary_cfg_t *cfg);
+extern int tls_ble_mesh_get_comp(uint16_t net_idx, uint16_t dst, uint8_t *status, char *rsp_data,
+                          uint32_t *data_len);
+extern int tls_ble_mesh_vnd_send_msg(uint8_t *msg, int len);
+
+extern int tls_ble_mesh_hb_sub_set(uint16_t net_idx, uint16_t dst, tls_bt_mesh_cfg_hb_sub *hb_sub, uint8_t *status);
+extern int tls_ble_mesh_hb_sub_get(uint16_t net_idx, uint16_t dst, tls_bt_mesh_cfg_hb_sub *hb_sub, uint8_t *status);
+
+extern int tls_ble_mesh_hb_pub_set(uint16_t net_idx, uint16_t dst, const tls_bt_mesh_cfg_hb_pub *hb_pub, uint8_t *status);
+extern int tls_ble_mesh_hb_pub_get(uint16_t net_idx, uint16_t dst, tls_bt_mesh_cfg_hb_pub *hb_pub, uint8_t *status);
+/**node demo api for at command*/
+extern int tls_ble_mesh_node_deinit(int reason);
+extern int tls_ble_mesh_node_init(void);
+extern int tls_ble_mesh_erase_cfg(void);
+
+#endif
+
+#else
+#if (WM_BT_INCLUDED == CFG_ON || WM_BLE_INCLUDED == CFG_ON)
+#include "wm_bt.h"
+#include "wm_ble.h"
+#include "wm_ble_gatt.h"
+
+extern tls_bt_status_t enable_bt_test_mode(tls_bt_hci_if_t *p_hci_if);
+extern tls_bt_status_t exit_bt_test_mode();
+
+extern int tls_at_bt_enable(int uart_no, tls_bt_log_level_t log_level, tls_bt_host_callback_t at_callback_ptr);
+extern int tls_at_bt_destroy(void);
+extern int tls_at_bt_cleanup_host(void);
+extern void tls_rf_bt_mode(uint8_t mode);
+#if (WM_BT_INCLUDED == CFG_ON)
+extern int demo_bt_scan_mode(int type);
+extern int demo_bt_inquiry(int type);
+extern int demo_bt_app_on();
+extern int demo_bt_app_off();
+#endif
+
+#if (WM_BTA_AV_SINK_INCLUDED == CFG_ON)
+extern tls_bt_status_t tls_bt_enable_a2dp_sink();
+extern tls_bt_status_t tls_bt_disable_a2dp_sink();
+#endif
+
+#if (WM_BTA_HFP_HSP_INCLUDED == CFG_ON)
+extern tls_bt_status_t tls_bt_enable_hfp_client();
+extern tls_bt_status_t tls_bt_disable_hfp_client();
+extern tls_bt_status_t tls_bt_dial_number(const char* number);
+#endif
+
+#if (WM_BTA_SPPS_INCLUDED == CFG_ON)
+extern tls_bt_status_t tls_bt_enable_spp_server();
+extern tls_bt_status_t tls_bt_disable_spp_server();
+#endif
+#if (WM_BTA_SPPC_INCLUDED == CFG_ON)
+extern tls_bt_status_t tls_bt_enable_spp_client();
+extern tls_bt_status_t tls_bt_disable_spp_client();
+#endif
+
+#if (WM_BLE_INCLUDED == CFG_ON)
+extern int tls_ble_client_demo_api_init(tls_ble_output_func_ptr output_func_ptr);
+extern int tls_ble_server_demo_api_init(tls_ble_output_func_ptr output_func_ptr);
+extern int tls_ble_client_demo_api_deinit();
+extern int tls_ble_server_demo_api_deinit();
+
+extern int tls_ble_client_multi_conn_demo_api_init();
+extern int tls_ble_client_multi_conn_demo_api_deinit();
+extern int tls_ble_uart_init(tls_ble_uart_mode_t mode, uint8_t uart_id, tls_uart_options_t *p_hci_if);
+extern int tls_ble_uart_deinit(tls_ble_uart_mode_t mode,uint8_t uart_id);
+extern int tls_ble_demo_adv(uint8_t type);
+extern int tls_ble_demo_scan(uint8_t start);
+extern tls_bt_status_t tls_ble_set_scan_chnl_map(uint8_t map);
+extern int tls_ble_client_demo_api_send_msg(uint8_t *ptr, int length);
+extern int tls_ble_server_demo_api_send_msg(uint8_t *data, int data_len);
+
+extern int tls_ble_register_report_evt(tls_ble_dm_evt_t rpt_evt,  tls_ble_dm_callback_t rpt_callback);
+extern int tls_ble_deregister_report_result(tls_ble_dm_evt_t rpt_evt,  tls_ble_dm_callback_t rpt_callback);
+extern int tls_ble_demo_prof_init(uint16_t uuid, tls_ble_callback_t at_cb_ptr);
+extern int tls_ble_demo_prof_deinit(int server_if);
+extern int tls_ble_demo_cli_init(uint16_t uuid, tls_ble_callback_t at_cb_ptr);
+extern int tls_ble_demo_cli_deinit(int client_if);
+extern tls_bt_uuid_t * app_uuid16_to_uuid128(uint16_t uuid16);
+
+#endif
+
+#endif
+
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif

+ 163 - 1
include/bt/wm_bt_def.h

@@ -235,6 +235,7 @@ typedef enum{
 #define WM_BLE_GAP_EVENT_PERIODIC_SYNC_LOST    (0x01<<22)
 #define WM_BLE_GAP_EVENT_SCAN_REQ_RCVD         (0x01<<23)
 #define WM_BLE_GAP_EVENT_PERIODIC_TRANSFER     (0x01<<24)
+#define WM_BLE_GAP_EVENT_HOST_SHUTDOWN         (0x01<<31)
 
 
 /** Bluetooth Address */
@@ -872,6 +873,7 @@ typedef enum
 	WM_BLE_DM_SEC_EVT               = (0x01<<7),
 	WM_BLE_DM_ADV_STARTED_EVT       = (0x01<<8),
     WM_BLE_DM_ADV_STOPPED_EVT       = (0x01<<9),
+	WM_BLE_DM_HOST_SHUTDOWN_EVT     = (0x01<<31),
 	
 } tls_ble_dm_evt_t;
 
@@ -1880,7 +1882,167 @@ typedef enum
     BLE_UART_UNKNOWN_MODE,
 } tls_ble_uart_mode_t;
 
-typedef void (*tls_ble_output_func_ptr)(uint8_t *p_data, uint32_t length);
+typedef enum{
+    UART_OUTPUT_DATA=0,
+    UART_OUTPUT_CMD_ADVERTISING,
+    UART_OUTPUT_CMD_CONNECTED,
+    UART_OUTPUT_CMD_DISCONNECTED,
+} tls_uart_msg_out_t;
+
+/**uart output function pointer, ble server send the received data to uart */
+typedef void (*tls_ble_uart_output_ptr)(tls_uart_msg_out_t type,uint8_t *payload, int length);
+
+/**uart sent function pointer, after ble server sending the uart data, it will be called */
+typedef void (*tls_ble_uart_sent_ptr)(tls_ble_uart_mode_t mode, int status);
+
+
+/**WM Mesh definition*/
+
+typedef enum{
+    MESH_ROLE_UNKNOWN = 0x00,
+    MESH_ROLE_NODE,
+    MESH_ROLE_PROVISIONER
+} tls_bt_mesh_role_t;
+
+#ifndef BIT
+#define BIT(n)  (1UL << (n))
+#endif
+
+#define BIT_MASK(n) (BIT(n) - 1)
+
+#define TLS_BT_MESH_TRANSMIT_INT(transmit) ((((transmit) >> 3) + 1) * 10)
+
+#define TLS_BT_MESH_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3)))
+
+#define TLS_BT_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3))
+
+#define TLS_BT_MESH_PUB_TRANSMIT(count, int_ms) TLS_BT_MESH_TRANSMIT(count,           \
+                                 (int_ms) / 5)
+
+#define TLS_BT_MESH_PUB_TRANSMIT_INT(transmit) ((((transmit) >> 3) + 1) * 50)
+#define TLS_BT_MESH_PUB_TRANSMIT_COUNT(transmit) TLS_BT_MESH_TRANSMIT_COUNT(transmit)
+
+typedef struct {
+    uint8_t net_transmit_count;         /* Network Transmit state */
+    uint8_t net_transmit_intvl;         /* Network Transmit state */
+    uint8_t relay;                /* Relay Mode state */
+    uint8_t relay_retransmit_count;     /* Relay Retransmit state */
+    uint8_t relay_retransmit_intvl;     /* Relay Retransmit state */
+    uint8_t beacon;               /* Secure Network Beacon state */
+    uint8_t gatt_proxy;           /* GATT Proxy state */
+    uint8_t frnd;                 /* Friend state */
+    uint8_t default_ttl;          /* Default TTL */
+} tls_mesh_primary_cfg_t;
+
+typedef struct {
+    uint16_t  addr;
+    uint16_t  app_idx;
+    uint8_t   cred_flag;
+    uint8_t   ttl;
+    uint8_t   period;
+    uint8_t   transmit;
+} tls_bt_mesh_cfg_mod_pub ;
+
+typedef struct {
+    uint16_t dst;
+    uint8_t  count;
+    uint8_t  period;
+    uint8_t  ttl;
+    uint16_t feat;
+    uint16_t net_idx;
+} tls_bt_mesh_cfg_hb_pub;
+
+typedef struct  {
+    uint16_t src;
+    uint16_t dst;
+    uint8_t  period;
+    uint8_t  count;
+    uint8_t  min;
+    uint8_t  max;
+} tls_bt_mesh_cfg_hb_sub;
+
+typedef struct{
+    uint8_t addr[6];
+    uint8_t addr_type;
+    uint8_t uuid[16];
+    uint32_t oob_info;
+    uint32_t uri_hash;
+    
+} tls_mesh_unprov_msg_t;
+
+typedef struct{
+    uint16_t net_idx;
+    uint16_t addr;
+    uint8_t num_elem;
+
+} tls_mesh_node_added_msg_t;
+
+typedef struct{
+    uint16_t net_idx;
+    uint16_t addr;
+
+} tls_mesh_prov_complete_msg_t;
+
+typedef struct{
+    char *str;
+} tls_mesh_oob_output_str_msg_t;
+
+typedef struct{
+    uint32_t number;
+} tls_mesh_oob_output_number_msg_t;
+
+typedef struct{
+    uint32_t act;
+} tls_mesh_oob_input_msg_t;
+
+typedef struct{
+    bool success;
+    uint16_t net_idx;
+    uint16_t addr;
+    uint8_t num_elem;    
+    
+} tls_mesh_prov_end_msg_t;
+
+typedef union
+{
+    tls_mesh_unprov_msg_t                  unprov_msg;
+    tls_mesh_node_added_msg_t              node_added_msg;
+    tls_mesh_oob_output_str_msg_t          oob_output_string_msg;
+    tls_mesh_oob_output_number_msg_t       oob_output_number_msg;
+    tls_mesh_prov_complete_msg_t           prov_cmplt_msg;
+    tls_mesh_oob_input_msg_t               oob_input_msg;
+    tls_mesh_prov_end_msg_t                prov_end_msg;
+    
+} tls_mesh_msg_t;
+
+
+typedef enum{
+    WM_MESH_UNPROVISION_BEACON_EVT = (0x01<<1),
+    WM_MESH_SECURE_BEACON_EVT      = (0x01<<2),
+    WM_MESH_NODE_ADDED_EVT         = (0x01<<3),
+    WM_MESH_OOB_STRING_EVT         = (0x01<<4),
+    WM_MESH_OOB_NUMBER_EVT         = (0x01<<5),    
+    WM_MESH_PROV_CMPLT_EVT         = (0x01<<6),
+    WM_MESH_OOB_INPUT_EVT          = (0x01<<7),
+    WM_MESH_PROV_END_EVT           = (0x01<<8),
+    
+} tls_mesh_event_t;
+
+typedef void (*tls_bt_mesh_at_callback_t)(tls_mesh_event_t event, tls_mesh_msg_t *p_data);
+
+typedef void (*tls_bt_controller_sleep_enter_func_ptr)(uint32_t sleep_duration_ms);
+
+typedef void (*tls_bt_controller_sleep_exit_func_ptr)(void);
+
+typedef void (*tls_bt_app_pending_process_func_ptr)(void);
+
+#define TLS_HAL_AT_NOTIFY(P_CB, PARAM1, PARAM2)\
+    if (P_CB) {                             \
+        P_CB(PARAM1, PARAM2);               \
+    } 
+
+
+
 #define TLS_HAL_CBACK(P_CB, P_CBACK, ...)\
     if (P_CB && P_CB->P_CBACK) {            \
         P_CB->P_CBACK(__VA_ARGS__);         \

+ 43 - 0
include/driver/wm_touchsensor.h

@@ -23,6 +23,49 @@
  */
 int tls_touchsensor_init_config(u32 sensorno, u8 scan_period, u8 window, u32 enable);
 
+/**
+ * @brief          This function is used to initialize touch scan channel.
+ *
+ * @param[in]      sensorno    is the touch sensor number from 1-15
+ *
+ * @retval         0:success
+ *
+ * @note           if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
+ */
+int tls_touchsensor_chan_config(u32 sensorno);
+
+/**
+ * @brief          This function is used to initialize touch general configuration.
+ *
+ * @param[in]      scanperiod  is scan period for per touch sensor ,unit:16ms, >0
+ * @param[in]      window      is count window, window must be greater than 2.Real count window is window - 2.
+ * @param[in]      bias        is touch sensor bias current
+ *
+ * @retval         0:success
+ *
+ * @note           if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
+ */
+int tls_touchsensor_scan_config(u8 scanperiod, u8 window, u8 bias);
+
+/**
+ * @brief          This function is used to start touch scan
+ *
+ * @retval         0:success
+ *
+ * @note           if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
+ */
+int tls_touchsensor_scan_start(void);
+
+/**
+ * @brief          This function is used to stop touch scan
+ *
+ * @retval         0:success
+ *
+ * @note           if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
+ */
+int tls_touchsensor_scan_stop(void);
+
+
 /**
  * @brief          This function is used to deinit touch sensor's selection and disable touch.
  *

+ 23 - 0
include/driver/wm_watchdog.h

@@ -74,6 +74,29 @@ void tls_watchdog_deinit(void);
  */
 void tls_sys_reset(void);
 
+/**
+ * @brief          This function is used to set reboot reason
+ *
+ * @param          reason (enum SYS_REBOOT_REASON)
+ *
+ * @return         None
+ *
+ * @note           used with tls_sys_reset
+ */
+void tls_sys_set_reboot_reason(u32 reason);
+
+/**
+ * @brief          This function is used to get reboot reason
+ *
+ * @param          None
+ *
+ * @return         reason (enum SYS_REBOOT_REASON)
+ *
+ * @note           None
+ */
+int tls_sys_get_reboot_reason(void);
+
+
 /**
  * @}
  */

+ 2 - 2
include/list.h

@@ -13,8 +13,8 @@
  * See README and COPYING for more details.
  */
 
-#ifndef LIST_H
-#define LIST_H
+#ifndef COMMON_LIST_H
+#define COMMON_LIST_H
 
 #include <stdio.h>
 

+ 17 - 0
include/platform/wm_params.h

@@ -670,6 +670,23 @@ int tls_param_get_program_param(u32 *pBase);
  */
 int tls_param_set_program_param(u32 base, u32 totallen, u32 checksum);
 
+/**
+ * @brief          This function is used to get bt param offset located in system param area
+ *
+ * @param[in]      id        from TLS_PARAM_ID_BT_REMOTE_DEVICE_1 to TLS_PARAM_ID_BT_REMOTE_DEVICE_5
+ * @param[in]      from_flash    whether the parameter is readed from flash,
+                                  1 read from flash(invalid for now),0 read from memory
+
+ *
+ * @retval         >0     success
+ * @retval         other failed
+ *
+ * @note           None
+ */
+
+int tls_param_get_bt_param_address(int id, int from_flash);
+
+
 /**
  * @}
  */

+ 2 - 1
include/wifi/litepoint.h

@@ -80,7 +80,7 @@ void tls_set_test_channel(u8 channel, u8 bandwidth);
 void tls_tx_litepoint_test_start(u32 tempcomp,u32 Packetcnt, u16 Psdulen, u32 Gain, u32 TxRate, u8 GiMode, u8 Gf, u8 Rifs);
 void tls_txrx_litepoint_test_stop(void);
 void tls_txrx_litepoint_clear_data(void);
-int tls_tx_litepoint_test_get_totalsnd(void);
+int  tls_tx_litepoint_test_get_totalsnd(void);
 void tls_rx_litepoint_test_start(u32 Channel, u32 BandWidth);
 void tls_rx_litepoint_test_result(u32 *total, u32 *goodcnt, u32 *badcnt);
 void tls_tx_litepoint_param_update(u8 Gain, u8 TxRate);
@@ -89,4 +89,5 @@ void tls_rx_litepoint_pwr_result(u32 *valid, u32 *snr, u32 *rcpi);
 void tls_tx_litepoint_period(u32 period);
 u32  tls_get_tx_litepoint_period(void);
 void tls_set_tx_litepoint_period(u32 period);
+void tls_lp_notify_lp_tx_data(void);
 #endif

+ 5 - 1
include/wm_bt_config.h

@@ -18,6 +18,8 @@
     #define WM_BTA_HFP_HSP_INCLUDED    CFG_ON
     #define WM_BTA_SPPS_INCLUDED       CFG_ON
     #define WM_BTA_SPPC_INCLUDED       CFG_ON
+    #define WM_AUDIO_BOARD_INCLUDED    CFG_OFF
+
 #else
     #define WM_BTA_AV_SINK_INCLUDED    CFG_OFF
     #define WM_BTA_HFP_HSP_INCLUDED    CFG_OFF
@@ -29,9 +31,11 @@
 #if (TLS_CONFIG_BLE == CFG_ON)
     #define WM_BLE_PERIPHERAL_INCLUDED CFG_ON
     #define WM_BLE_CENTRAL_INCLUDED    CFG_ON
+    #define WM_MESH_INCLUDED           CFG_OFF
 #else
     #define WM_BLE_PERIPHERAL_INCLUDED CFG_OFF
     #define WM_BLE_CENTRAL_INCLUDED    CFG_OFF
+    #define WM_MESH_INCLUDED           CFG_OFF
 #endif
 
 #if (WM_BTA_AV_SINK_INCLUDED == CFG_ON) || (WM_BTA_HFP_HSP_INCLUDED == CFG_ON) || (WM_BTA_SPPS_INCLUDED == CFG_ON) || (WM_BTA_SPPC_INCLUDED == CFG_ON)
@@ -58,7 +62,7 @@
 #endif
 
 #if (WM_BLE_CENTRAL_INCLUDED == CFG_ON)
-    #if (WM_BT_INCLUDED == CFG_ON)
+    #if (WM_BT_INCLUDED == CFG_ON || WM_MESH_INCLUDED == CFG_ON)
     #define WM_BLE_MAX_CONNECTION       1
     #else
     #define WM_BLE_MAX_CONNECTION       7

+ 10 - 3
include/wm_config.h

@@ -20,11 +20,14 @@
 #define TLS_CONFIG_LS_SPI          						CFG_ON /*Low Speed SPI*/
 #define TLS_CONFIG_UART									CFG_ON  /*UART*/
 
+/**Only Factory Test At Command**/
+#define TLS_CONFIG_ONLY_FACTORY_ATCMD                   CFG_OFF
+
 /**Host Interface&Command**/
 #define TLS_CONFIG_HOSTIF 								CFG_ON
 #define TLS_CONFIG_AT_CMD								(CFG_OFF && TLS_CONFIG_HOSTIF)
 #define TLS_CONFIG_RI_CMD								(CFG_OFF && TLS_CONFIG_HOSTIF)
-#define TLS_CONFIG_RMMS									CFG_OFF
+#define TLS_CONFIG_RMMS									(CFG_OFF && TLS_CONFIG_HOSTIF)
 
 //LWIP CONFIG
 #define TLS_CONFIG_IPV4                 				CFG_ON      //must ON
@@ -72,9 +75,13 @@ CRYPTO
 
 #define TLS_CONFIG_NTP 									CFG_OFF
 
-
-#define TLS_CONFIG_BR_EDR								CFG_OFF
+#if NIMBLE_FTR
 #define TLS_CONFIG_BLE                                  CFG_ON
+#define TLS_CONFIG_BR_EDR								CFG_OFF
+#else
+#define TLS_CONFIG_BLE                                  CFG_OFF
+#define TLS_CONFIG_BR_EDR								CFG_ON
+#endif
 
 #define TLS_CONFIG_BT                                  (TLS_CONFIG_BR_EDR || TLS_CONFIG_BLE)
 

+ 15 - 0
include/wm_ram_config.h

@@ -11,6 +11,9 @@
 #define __WM_RAM_CONFIG_H__
 #include "wm_config.h"
 
+/*see gcc_csky.ld in directory ld,__heap_end must be bigger than 0x20028000
+if __heap_end is lower than 0x20028000,then SLAVE_HSPI_SDIO_ADDR must be changed to 0x20028000 or bigger.
+*/
 extern unsigned int __heap_end;
 extern unsigned int __heap_start;
 
@@ -26,6 +29,18 @@ extern unsigned int __heap_start;
 /*Wi-Fi use buffer to exchange data*/
 #define WIFI_MEM_START_ADDR		(SLAVE_HSPI_SDIO_ADDR + SLAVE_HSPI_MAX_SIZE)
 
+/*Store reboot reason by RAM's Last Word*/
+#define SYS_REBOOT_REASON_ADDRESS (0x20047EFC)
+
+enum SYS_REBOOT_REASON
+{
+	REBOOT_REASON_POWER_ON 	   = 0,   /*power on or reset button*/
+	REBOOT_REASON_STANDBY	   = 1,   /*chip standby*/
+	REBOOT_REASON_EXCEPTION    = 2,   /*exception reset*/
+	REBOOT_REASON_WDG_TIMEOUT  = 3,   /*watchdog timeout*/
+	REBOOT_REASON_ACTIVE       = 4,   /*user active reset*/
+	REBOOT_REASON_MAX
+};
 
 #endif /*__WM_RAM_CONFIG_H__*/
 

+ 3 - 1
include/wm_regs.h

@@ -119,6 +119,8 @@ typedef volatile unsigned int TLS_REG;    /* Hardware register definition */
 #define HR_FLASH_CMD_START          (HR_FLASH_BASE_ADDR + 0x004)
 #define HR_FLASH_CR                 (HR_FLASH_BASE_ADDR + 0x008)
 #define HR_FLASH_ADDR               (HR_FLASH_BASE_ADDR + 0x010)
+#define HR_FLASH_ENCRYPT_CTRL       (HR_FLASH_BASE_ADDR + 0x014)
+#define HR_FLASH_KEY_STATUS         (HR_FLASH_BASE_ADDR + 0x018)
 /***************************************************************
  * SDIO WRAPPER Register
  ***************************************************************/
@@ -252,7 +254,7 @@ typedef volatile unsigned int TLS_REG;    /* Hardware register definition */
 #define HR_CLK_RST_STA			(HR_CLK_BASE_ADDR + 0x1C)
 
 /***************************************************************
- * �ڴ�ģ��Ĵ�������
+ * \C4ڴ\E6ģ\BF\E9\BCĴ\E6\C6\F7\B6\A8\D2\E5
  ***************************************************************/
 #define HR_MEM_BASE_ADDR        	(DEVICE_BASE_ADDR + 0xF00)
 #define HR_MEM_TXBUF_BASE_ADDR      (HR_MEM_BASE_ADDR + 0x00)

+ 3 - 3
include/wm_wifi_config.h

@@ -23,8 +23,6 @@
 
 #define  TLS_CONFIG_SOFTAP_11N              (CFG_WIFI_OFF&& TLS_CONFIG_AP)
 
-#define  LINK_RETRY_METHOD_MACRO            CFG_WIFI_OFF
-
 #define  TLS_CONFIG_AP_BEACON_SOFT         (CFG_OFF && TLS_CONFIG_AP)
 #define  TLS_CONFIG_AP_OPT_PS              (CFG_WIFI_OFF && TLS_CONFIG_AP)/* SOFTAP POWER SAVE */
 #define  TLS_CONFIG_AP_OPT_FWD             (CFG_WIFI_OFF && TLS_CONFIG_AP)/* IP PACKET FORWARD */
@@ -38,7 +36,9 @@
 
 #define TLS_CONFIG_LOG_PRINT			    CFG_WIFI_OFF
 
-#define TLS_PS_MODE_NEW_FTR                CFG_WIFI_OFF
+#define TLS_SCAN_TASK_DYNAMIC_CREATE_FTR  CFG_WIFI_OFF
+
+#define TLS_BSS_MGMT_TASK_DYNAMIC_CREATE_FTR CFG_WIFI_OFF
 
 #endif /*__WM_WIFI_CONFIG_H__*/
 

+ 37 - 2
platform/common/crypto/wm_crypto_hard.c

@@ -50,6 +50,8 @@ unsigned long __t = (x); memcpy(y, &__t, 4); \
 //extern volatile uint32_t sys_count;
 #define sys_count tls_os_get_time()
 
+extern 	void delay_cnt(int count);
+
 struct wm_crypto_ctx  g_crypto_ctx = {0,0
 #ifndef CONFIG_KERNEL_NONE
 	,NULL
@@ -59,6 +61,7 @@ struct wm_crypto_ctx  g_crypto_ctx = {0,0
 #if 1
 typedef s32 psPool_t;
 #include "libtommath.h"
+extern int wpa_mp_init (mp_int * a);
 #define pstm_set(a, b) mp_set((mp_int *)a, b)
 #define pstm_init(pool, a) wpa_mp_init((mp_int *)a)
 #define pstm_count_bits(a) mp_count_bits((mp_int *)a)
@@ -247,6 +250,7 @@ int tls_crypto_random_bytes(unsigned char *out, u32 len)
     uint32 inLen = len;
     int randomBytes = 2;
 #if USE_TRNG
+	delay_cnt(1000);
 	randomBytes = 4;
 #else
     val = tls_reg_read32(HR_CRYPTO_SEC_CFG);
@@ -274,7 +278,7 @@ int tls_crypto_random_bytes(unsigned char *out, u32 len)
             inLen = 0;
         }
     }
-    tls_close_peripheral_clock(TLS_PERIPHERAL_TYPE_GPSEC);	
+    //tls_close_peripheral_clock(TLS_PERIPHERAL_TYPE_GPSEC);	
     return ERR_CRY_OK;
 }
 
@@ -298,6 +302,7 @@ int tls_crypto_trng(unsigned char *out, u32 len)
 	tls_crypto_sem_lock();	
 	tls_open_peripheral_clock(TLS_PERIPHERAL_TYPE_GPSEC);	
 	sec_cfg = (1 << TRNG_INT_MASK) | (4 << TRNG_CP) | (1 << TRNG_SEL) | (1 << TRNG_EN);
+	tls_reg_write32(HR_CRYPTO_TRNG_CR, sec_cfg);
 	sec_cfg &= ~(1 << TRNG_INT_MASK);
 	tls_reg_write32(HR_CRYPTO_TRNG_CR, sec_cfg);		
 	delay_cnt(1000);
@@ -1222,8 +1227,10 @@ static int rsaMulModRead(unsigned char w, hstm_int *a)
     }
     return 0;
 }
+#if 0
 static void rsaMulModDump(unsigned char w)
 {
+	extern void dumpUint32(char *name, uint32_t* buffer, int len);
 	int addr = 0;
     switch(w)
     {
@@ -1240,7 +1247,7 @@ static void rsaMulModDump(unsigned char w)
 	printf("%c", w);
 	dumpUint32(" Val:",((volatile u32*) (RSA_BASE_ADDRESS + addr )), RSAN);
 }
-
+#endif
 static void rsaMulModWrite(unsigned char w, hstm_int *a)
 {
     u32 in[64];
@@ -1474,3 +1481,31 @@ int tls_crypto_init(void)
 	return 0;
 }
 
+
+/**
+ * @brief        	This function is used to generate true random number seed.
+ *
+ * @param[in]   	None
+ *
+ * @retval  		random number
+ *
+ * @note         	None
+ */
+unsigned int tls_random_seed_generation(void)
+{
+#if 0
+	extern void delay_cnt(int count);
+	unsigned int val;
+	unsigned int seed;
+	val = tls_reg_read32(HR_CRYPTO_TRNG_CR);
+	tls_reg_write32(HR_CRYPTO_TRNG_CR, val|(1 << TRNG_SEL));
+	delay_cnt(2000);
+	seed = tls_reg_read32(HR_CRYPTO_RNG_RESULT);
+	tls_reg_write32(HR_CRYPTO_TRNG_CR, val);
+	return seed;
+#else
+	return csi_coret_get_value();
+#endif	
+}
+
+

+ 11 - 5
platform/common/crypto/wm_crypto_hard_mbed.c

@@ -9,11 +9,15 @@
 #include "wm_pmu.h"
 #include "wm_crypto_hard.h"
 #include "wm_crypto_hard_mbed.h"
+#include "wm_internal_flash.h"
+#include "libtommath.h"
+
 
 #define ciL    (sizeof(mbedtls_mpi_uint))         /* chars in limb  */
 #define biL    (ciL << 3)               /* bits  in limb  */
 #define biH    (ciL << 2)               /* half limb size */
 
+extern int mbedtls_mpi_write_binary_nr( const mbedtls_mpi *X,unsigned char *buf, size_t buflen );
 extern struct wm_crypto_ctx  g_crypto_ctx;
 static void rsaMonMulSetLen(const u32 len)
 {
@@ -79,6 +83,8 @@ static int rsaMulModRead(unsigned char w, mbedtls_mpi *a)
     }
     return 0;
 }
+
+#if 0
 static void rsaMulModDump(unsigned char w)
 {
 	int addr = 0;
@@ -97,7 +103,7 @@ static void rsaMulModDump(unsigned char w)
 	printf("%c", w);
 	dumpUint32(" Val:",((volatile u32*) (RSA_BASE_ADDRESS + addr )), RSAN);
 }
-
+#endif
 static void rsaMulModWrite(unsigned char w, mbedtls_mpi *a)
 {
     u32 in[64];
@@ -190,7 +196,7 @@ int tls_crypto_mbedtls_exptmod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbed
     u32 k = 0, mc = 0, dp0;
     volatile u8 monmulFlag = 0;
     mbedtls_mpi R, X1, Y;
-	mbedtls_mpi T;
+//	mbedtls_mpi T;
 	int ret = 0;
 	size_t max_len;
 
@@ -205,7 +211,7 @@ int tls_crypto_mbedtls_exptmod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbed
     mbedtls_mpi_init(&X1);
     mbedtls_mpi_init(&Y);
     mbedtls_mpi_init(&R);
-	MBEDTLS_MPI_CHK( mbedtls_mpi_shrink( N, max_len ) );
+	MBEDTLS_MPI_CHK( mbedtls_mpi_shrink((mbedtls_mpi *)N, max_len ) );
 	
     MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &R, 1 ) );
     MBEDTLS_MPI_CHK( mbedtls_mpi_shift_l( &R, N->n * biL ) );
@@ -222,9 +228,9 @@ int tls_crypto_mbedtls_exptmod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbed
     
     dp0 = (u32)N->p[0];
     rsaCalMc(&mc, dp0);
-    rsaMonMulSetLen(N->n);
+    rsaMonMulSetLen((const u32)N->n);
     rsaMonMulWriteMc(mc);
-    rsaMulModWrite('M', N);
+    rsaMulModWrite('M', (mbedtls_mpi *)N);
     rsaMulModWrite('B', &X1);
     rsaMulModWrite('A', &Y);
 	

+ 33 - 6
platform/common/fwup/wm_fwup.c

@@ -29,6 +29,7 @@
 #include "wm_wl_task.h"
 #include "wm_params.h"
 #include "wm_param.h"
+#include "wm_ram_config.h"
 
 #define FWUP_MSG_QUEUE_SIZE      (4)
 
@@ -66,11 +67,31 @@ int tls_fwup_img_header_check(IMAGE_HEADER_PARAM_ST *img_param)
 	unsigned int crcvalue = 0;
 	unsigned int crccallen = 0;
 	int i = 0;
+	IMAGE_HEADER_PARAM_ST run_param;
 
 	if (img_param->magic_no != SIGNATURE_WORD)
 	{
 		return FALSE;	
 	}
+	/*temperary forbid to update secboot*/
+	if (img_param->img_attr.b.img_type != IMG_TYPE_FLASHBIN0)
+	{
+		return FALSE;
+	}
+
+	/*check run image and upgrade image have the same image info*/
+	tls_fls_read(img_param->img_header_addr, (u8 *)&run_param, sizeof(run_param));
+	if ((run_param.img_attr.b.signature && (img_param->img_attr.b.signature == 0))
+		|| ((run_param.img_attr.b.signature == 0) && img_param->img_attr.b.signature))
+	{
+		return FALSE;
+	}
+
+	if ((run_param.img_attr.b.code_encrypt && (img_param->img_attr.b.code_encrypt == 0))
+		|| ((run_param.img_attr.b.code_encrypt == 0) && img_param->img_attr.b.code_encrypt))
+	{
+		return FALSE;
+	}	
 
     if (img_param->img_addr % IMAGE_START_ADDR_MSK) //vbr register must be 1024 align.
     {
@@ -198,6 +219,7 @@ static void fwup_scheduler(void *data)
 								fwup->program_base = booter.upgrade_img_addr | FLASH_BASE_ADDR;
 								fwup->program_offset = 0;
 								fwup->total_len = booter.img_len + sizeof(IMAGE_HEADER_PARAM_ST);
+
 								if (booter.img_attr.b.signature)
 								{
 									fwup->total_len += 128;
@@ -284,7 +306,7 @@ static void fwup_scheduler(void *data)
 
 							if (booter.org_checksum != image_checksum)			
 							{
-                                TLS_DBGPRT_ERR("varify incorrect[0x%02x, but 0x%02x]\n", booter.org_checksum, image_checksum);
+                                TLS_DBGPRT_ERR("verify incorrect[0x%02x, but 0x%02x]\n", booter.org_checksum, image_checksum);
 								request->status = TLS_FWUP_REQ_STATUS_FCRC;
 								fwup->current_state |= TLS_FWUP_STATE_ERROR_CRC;
 								goto request_finish;
@@ -313,15 +335,20 @@ request_finish:
 					{
 						fwup->current_state &= ~TLS_FWUP_STATE_BUSY;
 					}
-					if(request->complete) 
-					{
-						request->complete(request, request->arg);
-					}
-					if(fwup->updated_len >= (fwup->total_len))
+
+					/*when all data has received  or error happened, reset system*/
+					if(((fwup->updated_len >= sizeof(IMAGE_HEADER_PARAM_ST)) && (fwup->updated_len >= (fwup->total_len)))
+						|| (request->status != TLS_FWUP_REQ_STATUS_SUCCESS))
 					{
 					    fwup_update_autoflag();
+						tls_sys_set_reboot_reason(REBOOT_REASON_ACTIVE);
 					    tls_sys_reset();
 					}
+					
+					if(request->complete) 
+					{
+						request->complete(request, request->arg);
+					}
 				}
 				break;
 

+ 65 - 3
platform/common/params/wm_param.c

@@ -21,6 +21,7 @@
 #include "wm_mem.h"
 #include "utils.h"
 #include "wm_flash_map.h"
+#include "wm_crypto_hard.h"
 
 #define USE_TWO_RAM_FOR_PARAMETER  0
 static struct tls_param_flash flash_param;
@@ -383,6 +384,10 @@ int tls_param_init(void)
 	int err;
 	signed short i;
 	u16 tryrestore = 0;
+	u32 crckey = 0xFFFFFFFF;
+	psCrcContext_t ctx;
+	u32 crcvalue = 0;
+	
 	struct tls_param_flash *flash;
 
 	if(flash_param.magic == TLS_PARAM_MAGIC)
@@ -425,18 +430,27 @@ int tls_param_init(void)
 			TLS_DBGPRT_INFO("read parameter partition - %d.\n", i);
 			tls_fls_read((i == 0) ? TLS_FLASH_PARAM1_ADDR : TLS_FLASH_PARAM2_ADDR, (u8 *)flash, sizeof(*flash));
 			TLS_DBGPRT_INFO("patition %d magic - 0x%x, crc -0x%x .\n", i, flash->magic, flash->crc32);
+			
+			if (flash->magic == TLS_PARAM_MAGIC)
+			{
+				crckey = 0xFFFFFFFF;
+				tls_crypto_crc_init(&ctx, crckey, CRYPTO_CRC_TYPE_32, 3);
+				tls_crypto_crc_update(&ctx, (u8 *)flash, flash->length - 4);
+				tls_crypto_crc_final(&ctx, &crcvalue);
+			}
+
 			if (flash->magic != TLS_PARAM_MAGIC)
 			{
 				TLS_DBGPRT_WARNING("parameter partition - %d has been damaged.\n", i);
 				is_damage[i] = TRUE;
 				damaged++;
-				//continue;
+				continue;
 			}
-			else if (get_crc32((u8 *)flash, flash->length - 4) != *(u32*)((u8*)flash + flash->length - 4))
+			else if ((~crcvalue) != *(u32*)((u8*)flash + flash->length - 4))
 			{
 				is_damage[i] = TRUE;
 				damaged++;
-				//continue;
+				continue;
 			}
 			else
 			{
@@ -994,6 +1008,54 @@ exit:
 
 	return err;
 }
+/**********************************************************************************************************
+* Description: 	This function is used to get bt param address offset in system param area.
+*
+* Arguments  : 	id		param id,from TLS_PARAM_ID_BT_REMOTE_DEVICE_1 to TLS_PARAM_ID_BT_REMOTE_DEVICE_5
+*				from_flash	whether the parameter is readed from flash,1 read from flash(invalid for now), 0 read from ram
+
+* Returns    :		address offset(>0) in system param area	success
+*				-1	invalid param
+**********************************************************************************************************/
+
+int tls_param_get_bt_param_address(int id, int from_flash)
+{
+    int addr_offset = 0;
+	struct tls_sys_param *src = NULL;
+
+	if ((id < TLS_PARAM_ID_ALL) || (id >= TLS_PARAM_ID_MAX)) {return TLS_PARAM_STATUS_EINVALID;}  
+
+    if(from_flash)
+    {
+        /*!!unsupport for now!!*/
+        return -1;
+    }
+
+    src = &flash_param.parameters;
+    tls_os_sem_acquire(sys_param_lock, 0);
+    switch (id) {
+
+	case TLS_PARAM_ID_BT_REMOTE_DEVICE_1:
+        addr_offset = (int)&src->remote_device1;
+		break;
+	case TLS_PARAM_ID_BT_REMOTE_DEVICE_2:
+		addr_offset = (int)&src->remote_device2;
+		break;
+	case TLS_PARAM_ID_BT_REMOTE_DEVICE_3:
+		addr_offset = (int)&src->remote_device3;
+		break;
+	case TLS_PARAM_ID_BT_REMOTE_DEVICE_4:
+		addr_offset = (int)&src->remote_device4;
+		break;
+	case TLS_PARAM_ID_BT_REMOTE_DEVICE_5:
+		addr_offset = (int)&src->remote_device5;
+		break;
+    }
+    
+    tls_os_sem_release(sys_param_lock);
+
+    return addr_offset;
+}
 
 /**********************************************************************************************************
 * Description: 	This function is used to get system parameter.