LVREV_ClearAudioBuffers.c revision c59c6fd7f859b4010d788db89b8d4d76bbb70e57
1/*
2 * Copyright (C) 2004-2010 NXP Software
3 * Copyright (C) 2010 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/****************************************************************************************/
19/*                                                                                      */
20/*     Project::                                                                        */
21/*     $Author: nxp007753 $ */
22/*     $Revision: 1316 $ */
23/*     $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
24/*                                                                                      */
25/****************************************************************************************/
26
27/****************************************************************************************/
28/*                                                                                      */
29/* Includes                                                                             */
30/*                                                                                      */
31/****************************************************************************************/
32#include "LVREV_Private.h"
33#include "VectorArithmetic.h"
34
35
36/****************************************************************************************/
37/*                                                                                      */
38/* FUNCTION:                LVREV_ClearAudioBuffers                                     */
39/*                                                                                      */
40/* DESCRIPTION:                                                                         */
41/*  This function is used to clear the internal audio buffers of the module.            */
42/*                                                                                      */
43/* PARAMETERS:                                                                          */
44/*  hInstance               Instance handle                                             */
45/*                                                                                      */
46/* RETURNS:                                                                             */
47/*  LVREV_SUCCESS          Initialisation succeeded                                     */
48/*  LVREV_NULLADDRESS      Instance is NULL                                             */
49/*                                                                                      */
50/* NOTES:                                                                               */
51/*  1. This function must not be interrupted by the LVM_Process function                */
52/*                                                                                      */
53/****************************************************************************************/
54LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t  hInstance)
55{
56
57   LVREV_Instance_st     *pLVREV_Private = (LVREV_Instance_st *)hInstance;
58
59
60    /*
61     * Check for error conditions
62     */
63    /* Check for NULL pointers */
64    if(hInstance == LVM_NULL)
65    {
66        return LVREV_NULLADDRESS;
67    }
68
69    /*
70     * Clear all filter tap data, delay-lines and other signal related data
71     */
72
73
74    LoadConst_32(0,
75        (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
76        2);
77    LoadConst_32(0,
78        (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
79        2);
80
81    if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
82    {
83        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
84        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
85        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
86        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
87
88        LoadConst_32(0,pLVREV_Private->pDelay_T[3], (LVM_INT16)LVREV_MAX_T3_DELAY);
89        LoadConst_32(0,pLVREV_Private->pDelay_T[2], (LVM_INT16)LVREV_MAX_T2_DELAY);
90        LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
91        LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
92
93    }
94
95    if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
96    {
97        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
98        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
99
100        LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
101        LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
102    }
103
104    if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
105    {
106        LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
107        LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
108    }
109
110    return LVREV_SUCCESS;
111}
112
113/* End of file */
114