summaryrefslogtreecommitdiff
path: root/fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-10-14 12:47:28 +0200
committerjaseg <git@jaseg.net>2020-10-14 12:47:28 +0200
commit6ab94e0b318884bbcb95e2ea3835f951502e1d99 (patch)
tree4cc5794b89f89c55ff8370ae252518ab96b5fed3 /fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c
parent1e6e8a2062923b434b2f4f5f2a9f8c0098135b01 (diff)
downloadminikbd-6ab94e0b318884bbcb95e2ea3835f951502e1d99.tar.gz
minikbd-6ab94e0b318884bbcb95e2ea3835f951502e1d99.tar.bz2
minikbd-6ab94e0b318884bbcb95e2ea3835f951502e1d99.zip
Move firmware into subdirectory
Diffstat (limited to 'fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c')
-rw-r--r--fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c b/fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c
new file mode 100644
index 0000000..d8a8e17
--- /dev/null
+++ b/fw/hid-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/rfft_fast_tests.c
@@ -0,0 +1,75 @@
+#include "jtest.h"
+#include "ref.h"
+#include "arr_desc.h"
+#include "transform_templates.h"
+#include "transform_test_data.h"
+#include "type_abbrev.h"
+
+/*
+FFT fast function test template. Arguments are: function configuration suffix
+(q7/q15/q31/f32) and inverse-transform flag
+*/
+#define RFFT_FAST_DEFINE_TEST(config_suffix, ifft_flag) \
+ JTEST_DEFINE_TEST(arm_rfft_fast_f32_##config_suffix##_test, \
+ arm_fft_f32) \
+ { \
+ arm_rfft_fast_instance_f32 rfft_inst_fut = {{0}, 0, 0}; \
+ arm_rfft_fast_instance_f32 rfft_inst_ref = {{0}, 0, 0}; \
+ \
+ /* Go through all FFT lengths */ \
+ TEMPLATE_DO_ARR_DESC( \
+ fftlen_idx, uint16_t, fftlen, transform_rfft_fast_fftlens \
+ , \
+ \
+ /* Initialize the RFFT and CFFT Instances */ \
+ arm_rfft_fast_init_f32( \
+ &rfft_inst_fut, fftlen); \
+ \
+ arm_rfft_fast_init_f32( \
+ &rfft_inst_ref, fftlen); \
+ \
+ TRANSFORM_COPY_INPUTS( \
+ transform_fft_f32_inputs, \
+ fftlen * \
+ sizeof(float32_t)); \
+ \
+ /* Display parameter values */ \
+ JTEST_DUMP_STRF("Block Size: %d\n" \
+ "Inverse-transform flag: %d\n", \
+ (int)fftlen, \
+ (int)ifft_flag); \
+ \
+ /* Display cycle count and run test */ \
+ JTEST_COUNT_CYCLES( \
+ arm_rfft_fast_f32( \
+ &rfft_inst_fut, \
+ (void *) transform_fft_input_fut, \
+ (void *) transform_fft_output_fut, \
+ ifft_flag)); \
+ \
+ ref_rfft_fast_f32( \
+ &rfft_inst_ref, \
+ (void *) transform_fft_input_ref, \
+ (void *) transform_fft_output_ref, \
+ ifft_flag); \
+ \
+ /* Test correctness */ \
+ TRANSFORM_SNR_COMPARE_INTERFACE( \
+ fftlen, \
+ float32_t)); \
+ \
+ return JTEST_TEST_PASSED; \
+ }
+
+RFFT_FAST_DEFINE_TEST(forward, 0U);
+RFFT_FAST_DEFINE_TEST(inverse, 1U);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(rfft_fast_tests)
+{
+ JTEST_TEST_CALL(arm_rfft_fast_f32_forward_test);
+ JTEST_TEST_CALL(arm_rfft_fast_f32_inverse_test);
+}