arm_math.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /******************************************************************************
  2. * @file arm_math.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.7.0
  5. * @date 18. March 2019
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. /**
  25. \mainpage CMSIS DSP Software Library
  26. *
  27. * \section intro Introduction
  28. *
  29. * This user manual describes the CMSIS DSP software library,
  30. * a suite of common signal processing functions for use on Cortex-M and Cortex-A processor
  31. * based devices.
  32. *
  33. * The library is divided into a number of functions each covering a specific category:
  34. * - Basic math functions
  35. * - Fast math functions
  36. * - Complex math functions
  37. * - Filtering functions
  38. * - Matrix functions
  39. * - Transform functions
  40. * - Motor control functions
  41. * - Statistical functions
  42. * - Support functions
  43. * - Interpolation functions
  44. * - Support Vector Machine functions (SVM)
  45. * - Bayes classifier functions
  46. * - Distance functions
  47. * - Quaternion functions
  48. *
  49. * The library has generally separate functions for operating on 8-bit integers, 16-bit integers,
  50. * 32-bit integer and 32-bit floating-point values.
  51. *
  52. * The library is providing vectorized versions of most algorthms for Helium
  53. * and of most f32 algorithms for Neon.
  54. *
  55. * When using a vectorized version, provide a little bit of padding after the end of
  56. * a buffer (3 words) because the vectorized code may read a little bit after the end
  57. * of a buffer. You don't have to modify your buffers but just ensure that the
  58. * end of buffer + padding is not outside of a memory region.
  59. *
  60. * \section using Using the Library
  61. *
  62. * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
  63. *
  64. * Here is the list of pre-built libraries :
  65. * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
  66. * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
  67. * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
  68. * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
  69. * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
  70. * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
  71. * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
  72. * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
  73. * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
  74. * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
  75. * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
  76. * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
  77. * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
  78. * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
  79. * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
  80. * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
  81. * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
  82. * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
  83. * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
  84. *
  85. * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
  86. * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
  87. * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
  88. *
  89. *
  90. * \section example Examples
  91. *
  92. * The library ships with a number of examples which demonstrate how to use the library functions.
  93. *
  94. * \section toolchain Toolchain Support
  95. *
  96. * The library is now tested on Fast Models building with cmake.
  97. * Core M0, M7, A5 are tested.
  98. *
  99. *
  100. *
  101. * \section building Building the Library
  102. *
  103. * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP\\Projects\\ARM</code> folder.
  104. * - arm_cortexM_math.uvprojx
  105. *
  106. *
  107. * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.
  108. *
  109. * There is also a work in progress cmake build. The README file is giving more details.
  110. *
  111. * \section preprocessor Preprocessor Macros
  112. *
  113. * Each library project have different preprocessor macros.
  114. *
  115. * - ARM_MATH_BIG_ENDIAN:
  116. *
  117. * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
  118. *
  119. * - ARM_MATH_MATRIX_CHECK:
  120. *
  121. * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
  122. *
  123. * - ARM_MATH_ROUNDING:
  124. *
  125. * Define macro ARM_MATH_ROUNDING for rounding on support functions
  126. *
  127. * - ARM_MATH_LOOPUNROLL:
  128. *
  129. * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions
  130. *
  131. * - ARM_MATH_NEON:
  132. *
  133. * Define macro ARM_MATH_NEON to enable Neon versions of the DSP functions.
  134. * It is not enabled by default when Neon is available because performances are
  135. * dependent on the compiler and target architecture.
  136. *
  137. * - ARM_MATH_NEON_EXPERIMENTAL:
  138. *
  139. * Define macro ARM_MATH_NEON_EXPERIMENTAL to enable experimental Neon versions of
  140. * of some DSP functions. Experimental Neon versions currently do not have better
  141. * performances than the scalar versions.
  142. *
  143. * - ARM_MATH_HELIUM:
  144. *
  145. * It implies the flags ARM_MATH_MVEF and ARM_MATH_MVEI and ARM_MATH_FLOAT16.
  146. *
  147. * - ARM_MATH_MVEF:
  148. *
  149. * Select Helium versions of the f32 algorithms.
  150. * It implies ARM_MATH_FLOAT16 and ARM_MATH_MVEI.
  151. *
  152. * - ARM_MATH_MVEI:
  153. *
  154. * Select Helium versions of the int and fixed point algorithms.
  155. *
  156. * - ARM_MATH_MVE_FLOAT16:
  157. *
  158. * MVE Float16 implementations of some algorithms (Requires MVE extension).
  159. *
  160. * - DISABLEFLOAT16:
  161. *
  162. * Disable float16 algorithms when __fp16 is not supported for a
  163. * specific compiler / core configuration
  164. *
  165. * <hr>
  166. * \section pack CMSIS-DSP in ARM::CMSIS Pack
  167. *
  168. * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
  169. * |File/Folder |Content |
  170. * |---------------------------------|------------------------------------------------------------------------|
  171. * |\b CMSIS\\Documentation\\DSP | This documentation |
  172. * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib deprecated test suite |
  173. * |\b CMSIS\\DSP\\Examples | Example projects demonstrating the usage of the library functions |
  174. * |\b CMSIS\\DSP\\Include | DSP_Lib include files for using and building the lib
  175. * |\b CMSIS\\DSP\\PrivateInclude | DSP_Lib private include files for building the lib |
  176. * |\b CMSIS\\DSP\\Lib | DSP_Lib binaries |
  177. * |\b CMSIS\\DSP\\Projects | Projects to rebuild DSP_Lib binaries |
  178. * |\b CMSIS\\DSP\\Source | DSP_Lib source files |
  179. *
  180. * <hr>
  181. * \section rev Revision History of CMSIS-DSP
  182. * Please refer to \ref ChangeLog_pg.
  183. */
  184. /**
  185. * @defgroup groupExamples Examples
  186. */
  187. #ifndef _ARM_MATH_H
  188. #define _ARM_MATH_H
  189. #include "arm_math_types.h"
  190. #include "arm_math_memory.h"
  191. #include "dsp/none.h"
  192. #include "dsp/utils.h"
  193. #include "dsp/basic_math_functions.h"
  194. #include "dsp/interpolation_functions.h"
  195. #include "dsp/bayes_functions.h"
  196. #include "dsp/matrix_functions.h"
  197. #include "dsp/complex_math_functions.h"
  198. #include "dsp/statistics_functions.h"
  199. #include "dsp/controller_functions.h"
  200. #include "dsp/support_functions.h"
  201. #include "dsp/distance_functions.h"
  202. #include "dsp/svm_functions.h"
  203. #include "dsp/fast_math_functions.h"
  204. #include "dsp/transform_functions.h"
  205. #include "dsp/filtering_functions.h"
  206. #include "dsp/quaternion_math_functions.h"
  207. #ifdef __cplusplus
  208. extern "C"
  209. {
  210. #endif
  211. //#define TABLE_SPACING_Q31 0x400000
  212. //#define TABLE_SPACING_Q15 0x80
  213. #ifdef __cplusplus
  214. }
  215. #endif
  216. #endif /* _ARM_MATH_H */
  217. /**
  218. *
  219. * End of file.
  220. */