ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_fird_init_f32.c
Go to the documentation of this file.
1
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
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
#include "
dsps_fir.h
"
16
17
18
esp_err_t
dsps_fird_init_f32
(
fir_f32_t
*fir,
float
*
coeffs
,
float
*
delay
,
int
N
,
int
decim)
19
{
20
fir->
coeffs
=
coeffs
;
21
fir->
delay
=
delay
;
22
fir->
N
=
N
;
23
fir->
pos
= 0;
24
fir->
decim
= decim;
25
26
#ifdef CONFIG_IDF_TARGET_ESP32S3
27
// The amount of coefficients should be divided to 4,
28
// if not, add zero coefficients to round length to 0
29
if
(fir->
N
% 4 != 0) {
30
return
ESP_ERR_DSP_INVALID_LENGTH
;
31
}
32
// The coeffs array should be aligned to 16
33
if
(((uint32_t)
coeffs
) & 0x0f) {
34
return
ESP_ERR_DSP_ARRAY_NOT_ALIGNED
;
35
}
36
// The delay array should be aligned to 16
37
if
(((uint32_t)
delay
) & 0x0f) {
38
return
ESP_ERR_DSP_ARRAY_NOT_ALIGNED
;
39
}
40
#endif
// CONFIG_IDF_TARGET_ESP32S3
41
42
for
(
int
i = 0 ; i <
N
; i++) {
43
fir->
delay
[i] = 0;
44
}
45
return
ESP_OK
;
46
}
ESP_ERR_DSP_INVALID_LENGTH
#define ESP_ERR_DSP_INVALID_LENGTH
Definition
dsp_err_codes.h:20
ESP_ERR_DSP_ARRAY_NOT_ALIGNED
#define ESP_ERR_DSP_ARRAY_NOT_ALIGNED
Definition
dsp_err_codes.h:25
dsps_fir.h
fir_f32_t
struct fir_f32_s fir_f32_t
Data struct of f32 fir filter.
dsps_fird_init_f32
esp_err_t dsps_fird_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N, int decim)
initialize structure for 32 bit Decimation FIR filter Function initialize structure for 32 bit floati...
Definition
dsps_fird_init_f32.c:18
esp_err_t
int esp_err_t
Definition
esp_err.h:21
ESP_OK
#define ESP_OK
Definition
esp_err.h:23
fir_f32_s::coeffs
float * coeffs
Definition
dsps_fir.h:30
fir_f32_s::pos
int pos
Definition
dsps_fir.h:33
fir_f32_s::delay
float * delay
Definition
dsps_fir.h:31
fir_f32_s::N
int N
Definition
dsps_fir.h:32
fir_f32_s::decim
int decim
Definition
dsps_fir.h:34
delay
float delay[256]
Definition
test_fir.c:15
coeffs
float coeffs[256]
Definition
test_fir.c:14
N
#define N
Definition
test_mmult.c:13
components
espressif__esp-dsp
modules
fir
float
dsps_fird_init_f32.c
Generated by
1.16.1