1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <components/log.h> 18 #include <driver/fft_types.h> 19 20 #define FFT_TAG "fft" 21 #define FFT_LOGI(...) BK_LOGI(FFT_TAG, ##__VA_ARGS__) 22 #define FFT_LOGW(...) BK_LOGW(FFT_TAG, ##__VA_ARGS__) 23 #define FFT_LOGE(...) BK_LOGE(FFT_TAG, ##__VA_ARGS__) 24 #define FFT_LOGD(...) BK_LOGD(FFT_TAG, ##__VA_ARGS__) 25 26 /** 27 * @brief Enable fft module to process fir function 28 * 29 * This API process fir function : 30 * - Set fir work mode: signal/dual 31 * - Configure the fir parameters 32 * - start trigger 33 * - enable interrupts 34 * Usage example: 35 * 36 * //init fft driver 37 * ret = bk_fft_driver_init(); 38 * 39 * fir_conf.coef_c0 = os_malloc(2*FFT_TEST_DATA_SIZE); 40 * os_memset(fir_conf.coef_c0, 0, 2*FFT_TEST_DATA_SIZE); 41 * fir_conf.coef_c1 = NULL; 42 * fir_conf.input_d0 = os_malloc(2*FFT_TEST_DATA_SIZE); 43 * os_memset(fir_conf.input_d0, 0, 2*FFT_TEST_DATA_SIZE); 44 * fir_conf.input_d1 = NULL; 45 * fir_conf.mode = FFT_FIR_MODE_SIGNAL; 46 * fir_conf.fir_len = FFT_TEST_DATA_SIZE; 47 * 48 * //start fir 49 * bk_fft_fir_single_enable(&fir_conf); 50 * CLI_LOGI("start fir process \r\n"); 51 * 52 * //wait fir complete 53 * while(fft_busy_flag) 54 * bk_fft_is_busy(&fft_busy_flag); 55 * CLI_LOGI("fft complete\r\n"); 56 * 57 * //read output data 58 * bk_fft_output_read(data_proc_i, data_proc_q, 2 * FFT_TEST_DATA_SIZE); 59 * 60 * @param fir_conf fir parameters 61 * 62 * @return 63 * - BK_OK: succeed 64 * - others: other errors. 65 */ 66 bk_err_t bk_fft_fir_single_enable(fft_fir_input_t *fir_conf); 67 68