pinebuds/platform/hal/hal_hwfft.h

94 lines
3.0 KiB
C
Raw Normal View History

2022-08-15 04:20:27 -05:00
/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
#ifndef __HAL_HWFFT__
#define __HAL_HWFFT__
#ifdef __cplusplus
extern "C" {
#endif
//#include "cmsis_os.h"
#define HWFFT_USE_BUSY_WAIT 1
#define HAVE_EQUIVALENT_MODE 1 /* 128in 128out not 128in 130out mode */
struct hwfft_t {
int mode;
int order;
int sym_fft;
//osSemaphoreId _osSemaphoreId;
// osSemaphoreDef_t _osSemaphoreDef;
//#ifdef CMSIS_OS_RTX
// uint32_t _semaphore_data[2];
//#endif
};
enum hwfft_mode_t {
HWFFT_MODE_FFT = 0x1,
HWFFT_MODE_IFFT = 0x2,
HWFFT_MODE_EQVL_FFT = 0x4,
HWFFT_MODE_EQVL_IFFT = 0x8,
};
enum hwfft_order_t {
HWFFT_ORDER_64SAMP = 64,
HWFFT_ORDER_128SAMP = 128,
HWFFT_ORDER_256SAMP = 256,
HWFFT_ORDER_512SAMP = 512,
};
bool hwfft_is_enable(void);
int hwfft_destroy(struct hwfft_t *fft_inst);
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>hwfft_t <EFBFBD><EFBFBD><EFBFBD>
mode: hwfft_mode_t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>HWFFT_MODE_FFT: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBF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EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>spx_fft<EFBFBD><EFBFBD><EFBFBD><EFBFBD>fftģʽ
HWFFT_MODE_EQVL_IFFT: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>spx_ifft<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ifftģʽ
order: hwfft_order_t<EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>֧<EFBFBD><EFBFBD> 512/256/128/64 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> fft/ifft
sym_fft: 1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>fft<EFBFBD>ĶԳ<EFBFBD><EFBFBD><EFBFBD>;<EFBFBD><EFBFBD>fft<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n/2+1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>ifft<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> n/2+1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>n Ϊfft/ifft<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int hwfft_create(struct hwfft_t *fft_inst, int mode, int order, int sym_fft);
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>fft/ifft
fft_inst: hwfft_create<EFBFBD><EFBFBD><EFBFBD>ɵĶ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>
in: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>buf
out: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>buf
*/
int hwfft_fft_process(struct hwfft_t *fft_inst, short *in, short *out);
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> fft/ifft
fft_inst: hwfft_create<EFBFBD><EFBFBD><EFBFBD>ɵĶ<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>
in: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>buf<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>fft<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>buf<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
out: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>buf
num: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mode: 0 һֱ<EFBFBD>ȵ<EFBFBD>fft<EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD>
1 dma<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>fft<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD>أ<EFBFBD>cpu<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD>fft ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int hwfft_multifft_process(struct hwfft_t *fft_inst, short *in, short *out, unsigned short num,unsigned char mode);
#ifdef __cplusplus
}
#endif
#endif