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 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define FFT_FAILURE (1) 22 #define FFT_SUCCESS (0) 23 24 #define FFT_DEV_NAME "fft" 25 26 #define FFT_CMD_MAGIC (0xe260000) 27 enum 28 { 29 CMD_FFT_BUSY = FFT_CMD_MAGIC + 1, 30 CMD_FFT_ENABLE, 31 CMD_FIR_SIGNLE_ENABLE 32 }; 33 34 enum 35 { 36 FFT_MODE_FFT, 37 FFT_MODE_IFFT 38 }; 39 40 typedef struct 41 { 42 int mode; 43 INT16 *inbuf; 44 INT16 *outbuf; 45 UINT16 size; 46 } input_fft_t; 47 48 typedef struct 49 { 50 UINT8 fir_len; 51 UINT8 fir_cwidth; 52 UINT8 fir_dwidth; 53 INT16 *coef; 54 INT16 *input; 55 INT32 *mac; 56 } input_fir_t; 57 58 /******************************************************************************* 59 * Function Declarations 60 *******************************************************************************/ 61 void fft_init(void); 62 void fft_exit(void); 63 void fft_isr(void); 64 65 #ifdef __cplusplus 66 } 67 #endif 68