ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsp_common.h
Go to the documentation of this file.
1// Copyright 2018-2022 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#ifndef _dsp_common_H_
16#define _dsp_common_H_
17#include <stdint.h>
18#include <stdbool.h>
19#include "dsp_err.h"
20#include "esp_idf_version.h"
21
22#if defined(__XTENSA__) || defined(__riscv)
23#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
24#include "esp_cpu.h"
25#else
26#include "soc/cpu.h"
27#endif
28#endif
29
30#ifdef __cplusplus
31extern "C"
32{
33#endif
34
44bool dsp_is_power_of_two(int x);
45
46
55int dsp_power_of_two(int x);
56
57
68esp_err_t tie_log(int n_regs, ...);
69
70#ifdef __cplusplus
71}
72#endif
73
74// esp_cpu_get_ccount function is implemented in IDF 4.1 and later
75#if defined(__XTENSA__) || defined(__riscv)
76#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
77#define dsp_get_cpu_cycle_count esp_cpu_get_cycle_count
78#else
79#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
80#define dsp_get_cpu_cycle_count esp_cpu_get_ccount
81#else
82#define dsp_get_cpu_cycle_count xthal_get_ccount
83#endif
84#endif // ESP_IDF_VERSION
85#else
86// Linux Target
87#include <x86intrin.h>
88#define dsp_get_cpu_cycle_count __rdtsc
89#endif
90#endif // _dsp_common_H_
bool dsp_is_power_of_two(int x)
check power of two The function check if the argument is power of 2. The implementation use ANSI C an...
int dsp_power_of_two(int x)
Power of two The function return power of 2 for values 2^N. The implementation use ANSI C and could b...
esp_err_t tie_log(int n_regs,...)
Logginng for esp32s3 TIE core Registers covered q0 to q7, ACCX and SAR_BYTE.
int esp_err_t
Definition esp_err.h:21
float x[1024]
Definition test_fir.c:10