1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __HAL_HWFFT__ 5 #define __HAL_HWFFT__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 //#include "cmsis_os.h" 12 13 #define HWFFT_USE_BUSY_WAIT 1 14 #define HAVE_EQUIVALENT_MODE 1 /* 128in 128out not 128in 130out mode */ 15 16 struct hwfft_t { 17 int mode; 18 int order; 19 int sym_fft; 20 //osSemaphoreId _osSemaphoreId; 21 // osSemaphoreDef_t _osSemaphoreDef; 22 //#ifdef CMSIS_OS_RTX 23 // uint32_t _semaphore_data[2]; 24 //#endif 25 }; 26 27 enum hwfft_mode_t { 28 HWFFT_MODE_FFT = 0x1, 29 HWFFT_MODE_IFFT = 0x2, 30 HWFFT_MODE_EQVL_FFT = 0x4, 31 HWFFT_MODE_EQVL_IFFT = 0x8, 32 }; 33 34 enum hwfft_order_t { 35 HWFFT_ORDER_64SAMP = 64, 36 HWFFT_ORDER_128SAMP = 128, 37 HWFFT_ORDER_256SAMP = 256, 38 HWFFT_ORDER_512SAMP = 512, 39 }; 40 41 bool hwfft_is_enable(void); 42 int hwfft_destroy(struct hwfft_t *fft_inst); 43 /* 44 ����hwfft_t �ṹ�� 45 mode: hwfft_mode_t����HWFFT_MODE_FFT: ������ ����n�����������n����������ʱsym_fft����Ϊ0�� 46 ʵ��������n��ʵ���������n/2+1 ����������ʱsym_fft����Ϊ1�� 47 HWFFT_MODE_IFFT: ������ ����n�����������n����������ʱsym_fft����Ϊ0�� 48 ʵ�������� n/2+1�����������n��ʵ������ʱsym_fft����Ϊ1�� 49 HWFFT_MODE_EQVL_FFT: �������spx_fft����fftģʽ 50 HWFFT_MODE_EQVL_IFFT: �������spx_ifft����ifftģʽ 51 52 order: hwfft_order_t���ͣ�֧�� 512/256/128/64 ��� fft/ifft 53 54 sym_fft: 1: ������fft�ĶԳ���;��fft������n��ʵ���������n/2+1 �������� 55 ��ifft�� ���� n/2+1�����������n��ʵ����n Ϊfft/ifft���� 56 0: ����n�����������n������ 57 */ 58 int hwfft_create(struct hwfft_t *fft_inst, int mode, int order, int sym_fft); 59 /* 60 ����fft/ifft 61 fft_inst: hwfft_create���ɵĶ�Ӧ�ṹ�� 62 in: ����buf 63 out: ���buf 64 */ 65 int hwfft_fft_process(struct hwfft_t *fft_inst, short *in, short *out); 66 /* 67 ���������� fft/ifft 68 fft_inst: hwfft_create���ɵĶ�Ӧ�ṹ�� 69 in: ����buf�����fft������buf������������ 70 out: ���buf 71 num: ������� 72 mode: 0 һֱ�ȵ�fft��ɺ����ŷ��� 73 1 dma������ɣ�fft��ʼ�������ɷ��أ�cpu������Ӳ��fft ʱ������������ 74 */ 75 int hwfft_multifft_process(struct hwfft_t *fft_inst, short *in, short *out, unsigned short num,unsigned char mode); 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif 82