1 /**
2  * @file xmc_math.h
3  * @date 2015-10-08
4  *
5  * @cond
6  **********************************************************************************
7  * XMClib v2.1.24 - XMC Peripheral Driver Library
8  *
9  * Copyright (c) 2015-2019, Infineon Technologies AG
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification,are permitted provided that the following conditions are met:
14  *
15  *   Redistributions of source code must retain the above copyright notice,
16  *   this list of conditions and the following disclaimer.
17  *
18  *   Redistributions in binary form must reproduce the above copyright notice,
19  *   this list of conditions and the following disclaimer in the documentation
20  *   and/or other materials provided with the distribution.
21  *
22  *   Neither the name of the copyright holders nor the names of its contributors
23  *   may be used to endorse or promote products derived from this software without
24  *   specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30  * LIABLE  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  * To improve the quality of the software, users are encouraged to share
39  * modifications, enhancements or bug fixes with Infineon Technologies AG
40  * dave@infineon.com).
41  **********************************************************************************
42  *
43  * Change History
44  * --------------
45  *
46  * 2015-06-20:
47  *     - Removed version macros and declaration of GetDriverVersion API <br>
48  *     - Updated copyright and change history section.
49  *
50  * 2015-08-25:
51  *     - XMC_MATH_ClearEvent() API is updated to set the event clear flag bit. <br>
52  *
53  * 2015-09-23:
54  *     - Added SQRT functions
55  *
56  * 2015-10-08:
57  *     - Return values for sin(), cos(), sinh(), cosh(), arctan() are corrected.
58  *
59  * @endcond
60  *
61  */
62 
63 #ifndef XMC_MATH_H
64 #define XMC_MATH_H
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /*********************************************************************************************************************
71  * HEADER FILES
72  ********************************************************************************************************************/
73 #include <xmc_common.h>
74 
75 #if defined(MATH)
76 #include <xmc_scu.h>
77 
78 /**
79  * @addtogroup XMClib
80  * @{
81  */
82 
83 /**
84  * @addtogroup MATH
85  * @{
86  * @brief MATH Coprocessor (MATH) driver for the XMC1302 microcontroller family <br>
87  *
88  * The MATH Coprocessor (MATH) module comprises of two independent sub-blocks to support the CPU in math-intensive
89  * computations: a Divider Unit (DIV) for signed and unsigned 32-bit division operations and a CORDIC
90  * (COrdinate Rotation DIgital Computer) Coprocessor for computation of trigonometric, linear or hyperbolic functions.<br>
91  *
92  * MATH driver features:
93  * -# CORDIC Coprocessor is used for computation of trigonometric and hyperbolic functions
94  * -# Supports result chaining between the Divider Unit and CORDIC Coprocessor
95  * -# All MATH APIs are available in <B>Blocking</B> and <B>non-blocking</B> modes. Non-blocking APIs are suffixed with <B>NB</B>.
96  * -# 32bit signed and unsigned division implementations available for __aeabi_uidiv(), __aeabi_idiv(), __aeabi_uidivmod(), __aeabi_idivmod()
97  * -# Divider and CORDIC unit busy status can be checked by XMC_MATH_DIV_IsBusy() and XMC_MATH_CORDIC_IsBusy()
98  * -# Individual APIs available to return the result of each non-blocking MATH function
99  *
100  * <B>Note:</B> <br>
101  * All non-blocking MATH APIs are not atomic and hence occurence of interrupts during the normal execution of
102  * these APIs may lead to erroneous results. User has to exercise caution while using these APIs.
103  *
104  * Example:
105  * Execution of divide instruction (/) in an ISR during the normal execution of non-blocking APIs may give erroneous results.
106  *
107  */
108 
109 
110 /*********************************************************************************************************************
111  * TYPE DEFINITIONS
112  ********************************************************************************************************************/
113 /**
114  * @brief This typedef is used for Input and Output Data representation in blocking & non-blocking functions.
115  * XMC_MATH_Q0_23_t => 1 Signed bit, 0 Integer bits, 23 fraction bits.
116  */
117 typedef int32_t XMC_MATH_Q0_23_t;
118 
119 /**
120  * @brief This typedef is used for Input Data representation in blocking & non-blocking functions.
121  * XMC_MATH_Q8_15_t => 1 Signed bit, 8 Integer bits, 15 fraction bits.
122  */
123 typedef int32_t XMC_MATH_Q8_15_t;
124 
125 /**
126  * @brief This typedef is used for Output Data representation in blocking & non-blocking functions.
127  * XMC_MATH_Q1_22_t => 1 Signed bit, 1 Integer bits, 22 fraction bits.
128  */
129 typedef int32_t XMC_MATH_Q1_22_t;
130 
131 /**
132  * @brief This typedef is used for Output Data representation in blocking & non-blocking functions.
133  * XMC_MATH_Q0_11_t => 1 Signed bit, 0 Integer bits, 11 fraction bits.
134  */
135 typedef int32_t XMC_MATH_Q0_11_t;
136 
137 /*********************************************************************************************************************
138  * MACROS
139  ********************************************************************************************************************/
140 /* Utility macros */
141 #define XMC_MATH_Q0_23(x) ((XMC_MATH_Q0_23_t)(((x) >= 0) ? ((x) * (1 << 23) + 0.5) : ((x) * (1 << 23) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_23_t format */
142 #define XMC_MATH_Q0_11(x) ((XMC_MATH_Q0_11_t)(((x) >= 0) ? ((x) * (1 << 11) + 0.5) : ((x) * (1 << 11) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_11_t format */
143 
144 /*********************************************************************************************************************
145  * ENUMS
146  ********************************************************************************************************************/
147 
148 /**
149  * @brief Service request events for the DIV and CORDIC modules
150  */
151 typedef enum XMC_MATH_EVENT
152 {
153   XMC_MATH_EVENT_DIV_END_OF_CALC    = 1U, /**< Divider end of calculation event */
154   XMC_MATH_EVENT_DIV_ERROR          = 2U, /**< Divider error event */
155   XMC_MATH_EVENT_CORDIC_END_OF_CALC = 4U, /**< CORDIC end of calculation event */
156   XMC_MATH_EVENT_CORDIC_ERROR       = 8U  /**< CORDIC error event */
157 } XMC_MATH_EVENT_t;
158 
159 /**
160  * @brief Dividend Register Result Chaining
161  */
162 typedef enum XMC_MATH_DIV_DVDRC
163 {
164   XMC_MATH_DIV_DVDRC_DISABLED        = 0U << MATH_GLBCON_DVDRC_Pos, /**< No result chaining is selected */
165   XMC_MATH_DIV_DVDRC_QUOT_IS_SOURCE  = 1U << MATH_GLBCON_DVDRC_Pos, /**< QUOT register is the selected source */
166   XMC_MATH_DIV_DVDRC_RMD_IS_SOURCE   = 2U << MATH_GLBCON_DVDRC_Pos, /**< RMD register is the selected source */
167   XMC_MATH_DIV_DVDRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVDRC_Pos, /**< CORRX is the selected source */
168   XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVDRC_Pos, /**< CORRY is the selected source */
169   XMC_MATH_DIV_DVDRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVDRC_Pos  /**< CORRZ is the selected source */
170 } XMC_MATH_DIV_DVDRC_t;
171 
172 /**
173  * @brief Divisor Register Result Chaining
174  */
175 typedef enum XMC_MATH_DIV_DVSRC
176 {
177   XMC_MATH_DIV_DVSRC_DISABLED        = 0U << MATH_GLBCON_DVSRC_Pos, /**< No result chaining is selected */
178   XMC_MATH_DIV_DVSRC_QUOT_IS_SOURCE  = 1U << MATH_GLBCON_DVSRC_Pos, /**< QUOT register is the selected source */
179   XMC_MATH_DIV_DVSRC_RMD_IS_SOURCE   = 2U << MATH_GLBCON_DVSRC_Pos, /**< RMD register is the selected source */
180   XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVSRC_Pos, /**< CORRX is the selected source */
181   XMC_MATH_DIV_DVSRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVSRC_Pos, /**< CORRY is the selected source */
182   XMC_MATH_DIV_DVSRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVSRC_Pos  /**< CORRZ is the selected source */
183 } XMC_MATH_DIV_DVSRC_t;
184 
185 /**
186  * @brief CORDX Register Result Chaining
187  */
188 typedef enum XMC_MATH_CORDIC_CORDXRC
189 {
190   XMC_MATH_CORDIC_CORDXRC_DISABLED       = 0U << MATH_GLBCON_CORDXRC_Pos, /**< No result chaining is selected */
191   XMC_MATH_CORDIC_CORDXRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDXRC_Pos, /**< QUOT register is the selected source */
192   XMC_MATH_CORDIC_CORDXRC_RMD_IS_SOURCE  = 2U << MATH_GLBCON_CORDXRC_Pos  /**< RMD register is the selected source */
193 } XMC_MATH_CORDIC_CORDXRC_t;
194 
195 /**
196  * @brief CORDY Register Result Chaining
197  */
198 typedef enum XMC_MATH_CORDIC_CORDYRC
199 {
200   XMC_MATH_CORDIC_CORDYRC_DISABLED       = 0U << MATH_GLBCON_CORDYRC_Pos, /**< No result chaining is selected */
201   XMC_MATH_CORDIC_CORDYRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDYRC_Pos, /**< QUOT register is the selected source */
202   XMC_MATH_CORDIC_CORDYRC_RMD_IS_SOURCE  = 2U << MATH_GLBCON_CORDYRC_Pos  /**< RMD register is the selected source */
203 } XMC_MATH_CORDIC_CORDYRC_t;
204 
205 /**
206  * @brief CORDZ Register Result Chaining
207  */
208 typedef enum XMC_MATH_CORDIC_CORDZRC
209 {
210   XMC_MATH_CORDIC_CORDZRC_DISABLED       = 0U << MATH_GLBCON_CORDZRC_Pos, /**< No result chaining is selected */
211   XMC_MATH_CORDIC_CORDZRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDZRC_Pos, /**< QUOT register is the selected source */
212   XMC_MATH_CORDIC_CORDZRC_RMD_IS_SOURCE  = 2U << MATH_GLBCON_CORDZRC_Pos  /**< RMD register is the selected source */
213 } XMC_MATH_CORDIC_CORDZRC_t;
214 /**
215  * @brief CORDIC operating mode
216  */
217 typedef enum XMC_MATH_CORDIC_OPERATING_MODE
218 {
219   XMC_MATH_CORDIC_OPERATING_MODE_LINEAR     = 0U << MATH_CON_MODE_Pos,    /**< Linear mode */
220   XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR   = 1U << MATH_CON_MODE_Pos,    /**< Circular mode */
221   XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC = 3U << MATH_CON_MODE_Pos     /**< Hyperbolic mode */
222 } XMC_MATH_CORDIC_OPERATING_MODE_t;
223 
224 /**
225  * @brief Rotation vectoring selection
226  */
227 typedef enum XMC_MATH_CORDIC_ROTVEC_MODE
228 {
229   XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING     = 0U << MATH_CON_ROTVEC_Pos,  /**< Vectoring mode */
230   XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION      = 1U << MATH_CON_ROTVEC_Pos   /**< Rotation mode */
231 } XMC_MATH_CORDIC_ROTVEC_MODE_t;
232 
233 /**
234  * @brief Calculated value of CORRX and CORRY are each divided by this factor to yield the result.
235  */
236 typedef enum XMC_MATH_CORDIC_MAGNITUDE
237 {
238   XMC_MATH_CORDIC_MAGNITUDE_DIVBY1 = 0U << MATH_CON_MPS_Pos,              /**< Divide by 1 */
239   XMC_MATH_CORDIC_MAGNITUDE_DIVBY2 = 1U << MATH_CON_MPS_Pos,              /**< Divide by 2 */
240   XMC_MATH_CORDIC_MAGNITUDE_DIVBY4 = 2U << MATH_CON_MPS_Pos,              /**< Divide by 4 */
241 } XMC_MATH_CORDIC_MAGNITUDE_t;
242 
243 /*********************************************************************************************************************
244  * DATA STRUCTURES
245  ********************************************************************************************************************/
246 
247 /*********************************************************************************************************************
248  * API Prototypes - General
249  ********************************************************************************************************************/
250 
251 /**
252  *
253  * @return None
254  *
255  * \par<b>Description:</b><br>
256  * Enables the Math module by un-gating the clock.
257  *
258  * \par
259  * MATH coprocessor's clock is enabled by setting \a MATH bit of \a CGATCLR0 register.
260  *
261  * \par<b>Related APIs:</b><BR>
262  * XMC_MATH_Disable()\n\n\n
263  *
264  */
XMC_MATH_Enable(void)265 __STATIC_INLINE void XMC_MATH_Enable(void)
266 {
267   /* Un-gates clock to the MATH kernel */
268   XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH);
269 }
270 
271 /**
272  *
273  * @return None
274  *
275  * \par<b>Description:</b><br>
276  * Disables the Math module by gating the clock.
277  *
278  * \par
279  * MATH coprocessor's clock is disabled by setting \a MATH bit of \a CGATSET0 register.
280  *
281  * \par<b>Related APIs:</b><BR>
282  * XMC_MATH_Disable()\n\n\n
283  *
284  */
XMC_MATH_Disable(void)285 __STATIC_INLINE void XMC_MATH_Disable(void)
286 {
287   /* Gates clock to the MATH kernel */
288   XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH);
289 }
290 
291 /**
292  *
293  * @return bool \n
294  * true  - if DIV unit is busy
295  * false - if DIV unit is not busy
296  *
297  * \par<b>Description:</b><br>
298  * Utility function to check if the DIV unit is busy.
299  *
300  * \par
301  * Divider unit status is determined by reading \a BSY bit of \a DIVST register.
302  *
303  */
304 bool XMC_MATH_DIV_IsBusy(void);
305 
306 /**
307  *
308  * @return bool \n
309  * true  - if CORDIC unit is busy\n
310  * false - if CORDIC unit is not busy
311  *
312  * \par<b>Description:</b><br>
313  * Utility function to check if the DIV unit is busy.
314  *
315  * \par
316  * CORDIC coprocessor's status is determined by reading \a BSY bit of \a STATC register.
317  *
318  */
319 bool XMC_MATH_CORDIC_IsBusy(void);
320 
321 /**
322  * @param event Event of type XMC_MATH_EVENT_t
323  *
324  * @return bool\n
325  * true  - if status is set\n
326  * false - if status is not set
327  *
328  * \par<b>Description:</b><br>
329  * Returns the status of the requested event.
330  *
331  * \par
332  * Status of DIV & CORDIC unit's event (end of calculation & error) status is determined by reading \a EVFR register.
333  *
334  * \par<b>Related APIs:</b><BR>
335  * XMC_MATH_EnableEvent(), XMC_MATH_DisableEvent(), XMC_MATH_SetEvent(), XMC_MATH_ClearEvent()\n\n\n
336  *
337  */
338 bool XMC_MATH_GetEventStatus(const XMC_MATH_EVENT_t event);
339 
340 /**
341  * @param event Event of type XMC_MATH_EVENT_t
342  *
343  * @return None
344  *
345  * \par<b>Description:</b><br>
346  * Enables the requested event.
347  *
348  * \par
349  * DIV & CORDIC unit's event (end of calculation & error) is enabled by setting bit-fields of \a EVIER register.
350  *
351  * \par<b>Related APIs:</b><BR>
352  * XMC_MATH_GetEventStatus(), XMC_MATH_DisableEvent()\n\n\n
353  *
354  */
XMC_MATH_EnableEvent(const XMC_MATH_EVENT_t event)355 __STATIC_INLINE void XMC_MATH_EnableEvent(const XMC_MATH_EVENT_t event)
356 {
357   MATH->EVIER |= (uint32_t) event;
358 }
359 
360 /**
361  * @param event Event of type XMC_MATH_EVENT_t
362  *
363  * @return None
364  *
365  * \par<b>Description:</b><br>
366  * Disables the requested event.
367  *
368  * \par
369  * DIV & CORDIC unit's event (end of calculation & error) is disabled by clearing bit-fields of \a EVIER register.
370  *
371  * \par<b>Related APIs:</b><BR>
372  * XMC_MATH_GetEventStatus(), XMC_MATH_EnableEvent()\n\n\n
373  *
374  */
XMC_MATH_DisableEvent(const XMC_MATH_EVENT_t event)375 __STATIC_INLINE void XMC_MATH_DisableEvent(const XMC_MATH_EVENT_t event)
376 {
377   MATH->EVIER &= ~((uint32_t) event);
378 }
379 
380 /**
381  * @param event Event of type XMC_MATH_EVENT_t
382  *
383  * @return None
384  *
385  * \par<b>Description:</b><br>
386  * Sets the requested event. This is a software setting for the event.
387  *
388  * \par
389  * DIV & CORDIC unit's event (end of calculation & error) is set by setting bit-fields of \a EVFSR register.
390  *
391  * \par<b>Related APIs:</b><BR>
392  * XMC_MATH_ClearEvent()\n\n\n
393  *
394  */
XMC_MATH_SetEvent(const XMC_MATH_EVENT_t event)395 __STATIC_INLINE void XMC_MATH_SetEvent(const XMC_MATH_EVENT_t event)
396 {
397   MATH->EVFSR |= (uint32_t) event;
398 }
399 
400 /**
401  * @param event Event of type XMC_MATH_EVENT_t
402  *
403  * @return None
404  *
405  * \par<b>Description:</b><br>
406  * Clears the requested event.
407  *
408  * \par
409  * DIV & CORDIC unit's event (end of calculation & error) is cleared by setting bit-fields of \a EVFCR register.
410  *
411  * \par<b>Related APIs:</b><BR>
412  * XMC_MATH_SetEvent()\n\n\n
413  *
414  */
XMC_MATH_ClearEvent(const XMC_MATH_EVENT_t event)415 __STATIC_INLINE void XMC_MATH_ClearEvent(const XMC_MATH_EVENT_t event)
416 {
417   MATH->EVFCR |= (uint32_t) event;
418 }
419 
420 /**
421  * @return XMC_MATH_Q0_23_t
422  *
423  * \par<b>Description:</b><br>
424  * Returns result of a Cosine operation.
425  *
426  * \par
427  * Most significant 24 bits of \a CORRX register returns the result of Cosine operation.
428  *
429  * \par<b>Related APIs:</b><BR>
430  * XMC_MATH_CORDIC_CosNB()\n\n\n
431  *
432  */
XMC_MATH_CORDIC_GetCosResult(void)433 __STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetCosResult(void)
434 {
435   return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos));
436 }
437 
438 /**
439  * @return XMC_MATH_Q0_23_t
440  *
441  * \par<b>Description:</b><br>
442  * Returns result of a Sine operation.
443  *
444  * \par
445  * Most significant 24 bits of \a CORRY register returns the result of Sine operation.
446  *
447  * \par<b>Related APIs:</b><BR>
448  * XMC_MATH_CORDIC_SinNB()\n\n\n
449  *
450  */
XMC_MATH_CORDIC_GetSinResult(void)451 __STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetSinResult(void)
452 {
453   return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos));
454 }
455 
456 /**
457  * @return XMC_MATH_Q0_11_t
458  *
459  * \par<b>Description:</b><br>
460  * Returns result of a Tangent operation.
461  *
462  * \par
463  * \a QUOT register returns the result of Tangent operation.
464  *
465  * \par<b>Related APIs:</b><BR>
466  * XMC_MATH_CORDIC_TanNB()\n\n\n
467  *
468  */
XMC_MATH_CORDIC_GetTanResult(void)469 __STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanResult(void)
470 {
471   return ((XMC_MATH_Q0_11_t) MATH->QUOT);
472 }
473 
474 /**
475  * @return XMC_MATH_Q0_23_t
476  *
477  * \par<b>Description:</b><br>
478  * Returns result of a Arc Tangent operation.
479  *
480  * \par
481  * Most significant 24 bits of \a CORRZ register returns the result of Arc Tangent operation.
482  *
483  * \par<b>Related APIs:</b><BR>
484  * XMC_MATH_CORDIC_ArcTanNB()\n\n\n
485  *
486  */
XMC_MATH_CORDIC_GetArcTanResult(void)487 __STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetArcTanResult(void)
488 {
489   return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRZ) >> MATH_CORRZ_RESULT_Pos));
490 }
491 
492 /**
493  * @return XMC_MATH_Q1_22_t
494  *
495  * \par<b>Description:</b><br>
496  * Returns result of a Hyperbolic Cosine operation.
497  *
498  * \par
499  * Most significant 24 bits of \a CORRX register returns the result of Hyperbolic Cosine operation.
500  *
501  * \par<b>Related APIs:</b><BR>
502  * XMC_MATH_CORDIC_CoshNB()\n\n\n
503  *
504  */
XMC_MATH_CORDIC_GetCoshResult(void)505 __STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetCoshResult(void)
506 {
507   return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos));
508 }
509 
510 /**
511  * @return XMC_MATH_Q1_22_t
512  *
513  * \par<b>Description:</b><br>
514  * Returns result of a Hyperbolic Sine operation.
515  *
516  * \par
517  * Most significant 24 bits of \a CORRY register returns the result of Hyperbolic Sine operation.
518  *
519  * \par<b>Related APIs:</b><BR>
520  * XMC_MATH_CORDIC_SinhNB()\n\n\n
521  *
522  */
XMC_MATH_CORDIC_GetSinhResult(void)523 __STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetSinhResult(void)
524 {
525   return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos));
526 }
527 
528 /**
529  * @return XMC_MATH_Q0_11_t
530  *
531  * \par<b>Description:</b><br>
532  * Returns result of a Hyperbolic Tangent operation.
533  *
534  * \par
535  * \a QUOT register returns the result of Hyperbolic Tangent operation.
536  *
537  * \par<b>Related APIs:</b><BR>
538  * XMC_MATH_CORDIC_TanhNB()\n\n\n
539  *
540  */
XMC_MATH_CORDIC_GetTanhResult(void)541 __STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanhResult(void)
542 {
543   return ((XMC_MATH_Q0_11_t) MATH->QUOT);
544 }
545 
546 /**
547  * @return uint32_t
548  *
549  * \par<b>Description:</b><br>
550  * Returns result of a Unsigned Division operation.
551  *
552  * \par
553  * \a QUOT register returns the result of Unsigned Division operation.
554  *
555  * \par<b>Related APIs:</b><BR>
556  * XMC_MATH_DIV_UnsignedDivNB()\n\n\n
557  *
558  */
XMC_MATH_DIV_GetUnsignedDivResult(void)559 __STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedDivResult(void)
560 {
561   return ((uint32_t) MATH->QUOT);
562 }
563 
564 /**
565  * @return uint32_t
566  *
567  * \par<b>Description:</b><br>
568  * Returns result of a Unsigned Modulo operation.
569  *
570  * \par
571  * \a RMD register returns the result of Unsigned Modulo operation.
572  *
573  * \par<b>Related APIs:</b><BR>
574  * XMC_MATH_DIV_UnsignedModNB()\n\n\n
575  *
576  */
XMC_MATH_DIV_GetUnsignedModResult(void)577 __STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedModResult(void)
578 {
579   return ((uint32_t) MATH->RMD);
580 }
581 
582 /**
583  * @return int32_t
584  *
585  * \par<b>Description:</b><br>
586  * Returns result of a Signed Division operation.
587  *
588  * \par
589  * \a QUOT register returns the result of Signed Division operation.
590  *
591  * \par<b>Related APIs:</b><BR>
592  * XMC_MATH_DIV_SignedDivNB()\n\n\n
593  *
594  */
XMC_MATH_DIV_GetSignedDivResult(void)595 __STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedDivResult(void)
596 {
597   return ((int32_t) MATH->QUOT);
598 }
599 
600 /**
601  * @return int32_t
602  *
603  * \par<b>Description:</b><br>
604  * Returns result of a Signed Modulo operation.
605  *
606  * \par
607  * \a RMD register returns the result of Signed Modulo operation.
608  *
609  * \par<b>Related APIs:</b><BR>
610  * XMC_MATH_DIV_SignedModNB()\n\n\n
611  *
612  */
XMC_MATH_DIV_GetSignedModResult(void)613 __STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedModResult(void)
614 {
615   return ((int32_t) MATH->RMD);
616 }
617 
618 /***********************************************************************************************************************
619  * API Prototypes - Blocking functions
620  **********************************************************************************************************************/
621 /**
622  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
623  *
624  * @return XMC_MATH_Q0_23_t <BR>
625  *
626  * \par<b>Description:</b><br>
627  * Computes the cosine for an angle in radians \e angle_in_radians.
628  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
629  *
630  * \par
631  * This function programs CORDIC to rotation & circular mode.
632  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
633  * Most significant 24 bits of \a CORRX register returns the result of the operation.
634  *
635  * \par<b>Note:</b><br>
636  * Loading of \a CORDX register triggers the start of computation.
637  *
638  * \par<b>Related APIs:</b><BR>
639  * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Tan()\n\n\n
640  *
641  */
642 XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos(XMC_MATH_Q0_23_t angle_in_radians);
643 
644 /**
645  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
646  *
647  * @return XMC_MATH_Q0_23_t <BR>
648  *
649  * \par<b>Description:</b><br>
650  * Computes the sine for an angle in radians \e angle_in_radians.
651  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
652  *
653  * \par
654  * This function programs CORDIC to rotation & circular mode.
655  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
656  * Most significant 24 bits of \a CORRY register returns the result of the operation.
657  *
658  * \par<b>Note:</b><br>
659  * Loading of \a CORDX register triggers the start of computation.
660  *
661  * \par<b>Related APIs:</b><BR>
662  * XMC_MATH_CORDIC_Cos(), XMC_MATH_CORDIC_Tan()\n\n\n
663  *
664  */
665 XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin(XMC_MATH_Q0_23_t angle_in_radians);
666 
667 /**
668  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
669  *
670  * @return XMC_MATH_Q0_11_t <BR>
671  *
672  * \par<b>Description:</b><br>
673  * Computes the tangent for an angle in radians \e angle_in_radians.
674  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
675  *
676  * \par
677  * This function programs CORDIC to rotation & circular mode.
678  * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register.
679  * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
680  * Most significant 24 bits of \a CORRY register returns the result of the operation.
681  *
682  * \par<b>Note:</b><br>
683  * Loading of \a CORDX register triggers the start of computation.
684  *
685  * \par<b>Related APIs:</b><BR>
686  * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Cos()\n\n\n
687  *
688  */
689 XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan(XMC_MATH_Q0_23_t angle_in_radians);
690 
691 /**
692  *
693  * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format)
694  * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format)
695  *
696  * @return XMC_MATH_Q0_23_t <BR>
697  *
698  * \par<b>Description:</b><br>
699  * Computes the principal value arc tangent of an angle of y/x expressed in radians.
700  * The input radians must be in XMC_MATH_Q8_15_t format.
701  *
702  * \par
703  * This function programs CORDIC as circular mode.
704  * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x.
705  * Most significant 24 bits of \a CORRZ register returns the result of the operation.
706  *
707  * \par<b>Note:</b><br>
708  * Loading of \a CORDX register triggers the start of computation.
709  *
710  */
711 XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y);
712 
713 /**
714  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
715  *
716  * @return XMC_MATH_Q1_22_t <BR>
717  *
718  * \par<b>Description:</b><br>
719  * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians.
720  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
721  *
722  * \par
723  * This function programs CORDIC to rotation & hyperbolic mode.
724  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
725  * Most significant 24 bits of \a CORRX register returns the result of the operation.
726  *
727  * \par<b>Note:</b><br>
728  * Loading of \a CORDX register triggers the start of computation.
729  *
730  * \par<b>Related APIs:</b><BR>
731  * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Tanh()\n\n\n
732  *
733  */
734 XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh(XMC_MATH_Q0_23_t angle_in_radians);
735 
736 /**
737  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
738  *
739  * @return XMC_MATH_Q1_22_t <BR>
740  *
741  * \par<b>Description:</b><br>
742  * Computes the hyperbolic sine for an angle in radians \e angle_in_radians.
743  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
744  *
745  * \par
746  * This function programs CORDIC to rotation & hyperbolic mode.
747  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
748  * Most significant 24 bits of \a CORRY register returns the result of the operation.
749  *
750  * \par<b>Note:</b><br>
751  * Loading of \a CORDX register triggers the start of computation.
752  *
753  * \par<b>Related APIs:</b><BR>
754  * XMC_MATH_CORDIC_Cosh(), XMC_MATH_CORDIC_Tanh()\n\n\n
755  *
756  */
757 XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh(XMC_MATH_Q0_23_t angle_in_radians);
758 
759 /**
760  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
761  *
762  * @return XMC_MATH_Q0_11_t <BR>
763  *
764  * \par<b>Description:</b><br>
765  * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians.
766  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
767  *
768  * \par
769  * This function programs CORDIC to rotation & hyperbolic mode.
770  * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register.
771  * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
772  * \a QUOT register returns the result of the operation.
773  *
774  * \par<b>Note:</b><br>
775  * Loading of \a CORDX register triggers the start of computation.
776  *
777  * \par<b>Related APIs:</b><BR>
778  * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Cosh()()\n\n\n
779  *
780  */
781 XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh(XMC_MATH_Q0_23_t angle_in_radians);
782 
783 /***********************************************************************************************************************
784  * API Prototypes - Non blocking functions
785  **********************************************************************************************************************/
786 /**
787  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
788  *
789  * @return None <BR>
790  *
791  * \par<b>Description:</b><br>
792  * Computes the cosine for an angle in radians \e angle_in_radians.
793  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
794  * Call XMC_MATH_CORDIC_GetCosResult() API to get the result.
795  *
796  * \par
797  * This function programs CORDIC to rotation & circular mode.
798  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
799  *
800  * \par<b>Note:</b><br>
801  * Loading of \a CORDX register triggers the start of computation.
802  *
803  * \par<b>Related APIs:</b><BR>
804  * XMC_MATH_CORDIC_GetCosResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
805  *
806  */
807 void XMC_MATH_CORDIC_CosNB(XMC_MATH_Q0_23_t angle_in_radians);
808 
809 /**
810  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
811  *
812  * @return None <BR>
813  *
814  * \par<b>Description:</b><br>
815  * Computes the sine for an angle in radians \e angle_in_radians.
816  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
817  * Call XMC_MATH_CORDIC_GetSinResult() API to get the result.
818  *
819  * \par
820  * This function programs CORDIC to rotation & circular mode.
821  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
822  *
823  * \par<b>Note:</b><br>
824  * Loading of \a CORDX register triggers the start of computation.
825  *
826  * \par<b>Related APIs:</b><BR>
827  * XMC_MATH_CORDIC_GetSinResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
828  *
829  */
830 void XMC_MATH_CORDIC_SinNB(XMC_MATH_Q0_23_t angle_in_radians);
831 
832 /**
833  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
834  *
835  * @return None <BR>
836  *
837  * \par<b>Description:</b><br>
838  * Computes the tangent for an angle in radians \e angle_in_radians.
839  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
840  * Call XMC_MATH_CORDIC_GetTanResult() API to get the result.
841  *
842  * \par
843  * This function programs CORDIC to rotation & circular mode.
844  * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register.
845  * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
846  *
847  * \par<b>Note:</b><br>
848  * Loading of \a CORDX register triggers the start of computation.
849  *
850  * \par<b>Related APIs:</b><BR>
851  * XMC_MATH_CORDIC_GetTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
852  *
853  */
854 void XMC_MATH_CORDIC_TanNB(XMC_MATH_Q0_23_t angle_in_radians);
855 
856 /**
857  *
858  * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format)
859  * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format)
860  *
861  * @return None <BR>
862  *
863  * \par<b>Description:</b><br>
864  * Computes the principal value arc tangent of an angle of y/x expressed in radians.
865  * The input radians must be in XMC_MATH_Q8_15_t format.
866  * Call XMC_MATH_CORDIC_GetArcTanResult() API to get the result.
867  *
868  * \par
869  * This function programs CORDIC as circular mode.
870  * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x.
871  *
872  * \par<b>Note:</b><br>
873  * Loading of \a CORDX register triggers the start of computation.
874  *
875  * \par<b>Related APIs:</b><BR>
876  * XMC_MATH_CORDIC_GetArcTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
877  *
878  */
879 void XMC_MATH_CORDIC_ArcTanNB(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y);
880 
881 /**
882  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
883  *
884  * @return None <BR>
885  *
886  * \par<b>Description:</b><br>
887  * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians.
888  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
889  * Call XMC_MATH_CORDIC_GetCoshResult() API to get the result.
890  *
891  * \par
892  * This function programs CORDIC to rotation & hyperbolic mode.
893  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
894  *
895  * \par<b>Note:</b><br>
896  * Loading of \a CORDX register triggers the start of computation.
897  *
898  * \par<b>Related APIs:</b><BR>
899  * XMC_MATH_CORDIC_GetCoshResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
900  *
901  */
902 void XMC_MATH_CORDIC_CoshNB(XMC_MATH_Q0_23_t angle_in_radians);
903 
904 /**
905  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
906  *
907  * @return None <BR>
908  *
909  * \par<b>Description:</b><br>
910  * Computes the hyperbolic sine for an angle in radians \e angle_in_radians.
911  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
912  * Call XMC_MATH_CORDIC_GetSinhResult() API to get the result.
913  *
914  * \par
915  * This function programs CORDIC to rotation & hyperbolic mode.
916  * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
917  *
918  * \par<b>Note:</b><br>
919  * Loading of \a CORDX register triggers the start of computation.
920  *
921  * \par<b>Related APIs:</b><BR>
922  * XMC_MATH_CORDIC_GetSinhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
923  *
924  */
925 void XMC_MATH_CORDIC_SinhNB(XMC_MATH_Q0_23_t angle_in_radians);
926 
927 /**
928  * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
929  *
930  * @return None <BR>
931  *
932  * \par<b>Description:</b><br>
933  * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians.
934  * The input angle in radians must be in XMC_MATH_Q0_23_t format.
935  * Call XMC_MATH_CORDIC_GetTanhResult() API to get the result.
936  *
937  * \par
938  * This function programs CORDIC to rotation & hyperbolic mode.
939  * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register.
940  * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
941  *
942  * \par<b>Note:</b><br>
943  * Loading of \a CORDX register triggers the start of computation.
944  *
945  * \par<b>Related APIs:</b><BR>
946  * XMC_MATH_CORDIC_GetTanhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
947  *
948  */
949 void XMC_MATH_CORDIC_TanhNB(XMC_MATH_Q0_23_t angle_in_radians);
950 
951 /**
952  * @param dividend - Dividend
953  * @param divisor  - Divisor
954  *
955  * @return None <BR>
956  *
957  * \par<b>Description:</b><br>
958  * Performs unsigned integer division and computes quotient of the division.
959  * Call XMC_MATH_DIV_GetUnsignedDivResult() API to get the result.
960  *
961  * \par
962  * Divider unit is configured for unsigned division.
963  * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values.
964  * The division is started with the write to DVS register.
965  *
966  * \par<b>Note:</b><br>
967  * Ensure \e divisor is smaller than \e dividend.
968  *
969  * \par<b>Related APIs:</b><BR>
970  * XMC_MATH_DIV_GetUnsignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
971  *
972  */
973 void XMC_MATH_DIV_UnsignedDivNB(uint32_t dividend, uint32_t divisor);
974 
975 /**
976  * @param dividend - Dividend
977  * @param divisor  - Divisor
978  *
979  * @return None <BR>
980  *
981  * \par<b>Description:</b><br>
982  * Performs signed integer division and computes quotient of the division.
983  * Call XMC_MATH_DIV_GetSignedDivResult() API to get the result.
984  *
985  * \par
986  * Divider unit is configured for signed division.
987  * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values.
988  * The division is started with the write to DVS register.
989  *
990  * \par<b>Note:</b><br>
991  * Ensure \e divisor is smaller than \e dividend.
992  *
993  * \par<b>Related APIs:</b><BR>
994  * XMC_MATH_DIV_GetSignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
995  *
996  */
997 void XMC_MATH_DIV_SignedDivNB(int32_t dividend, int32_t divisor);
998 
999 /**
1000  * @param dividend - Dividend
1001  * @param divisor  - Divisor
1002  *
1003  * @return None <BR>
1004  *
1005  * \par<b>Description:</b><br>
1006  * Performs unsigned modulo operation and computes remainder of the division.
1007  * Call XMC_MATH_DIV_GetUnsignedModResult() API to get the result.
1008  *
1009  * \par
1010  * Divider unit is configured for unsigned division.
1011  * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values.
1012  * The division is started with the write to DVS register.
1013  *
1014  * \par<b>Note:</b><br>
1015  * Ensure \e divisor is smaller than \e dividend.
1016  *
1017  * \par<b>Related APIs:</b><BR>
1018  * XMC_MATH_DIV_GetUnsignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
1019  *
1020  */
1021 void XMC_MATH_DIV_UnsignedModNB(uint32_t dividend, uint32_t divisor);
1022 
1023 /**
1024  * @param dividend - Dividend
1025  * @param divisor  - Divisor
1026  *
1027  * @return None <BR>
1028  *
1029  * \par<b>Description:</b><br>
1030  * Performs signed modulo operation and computes remainder of the division.
1031  * Call XMC_MATH_DIV_GetSignedModResult() API to get the result.
1032  *
1033  * \par
1034  * Divider unit is configured for signed division.
1035  * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values.
1036  * The division is started with the write to DVS register.
1037  *
1038  * \par<b>Note:</b><br>
1039  * Ensure \e divisor is smaller than \e dividend.
1040  *
1041  * \par<b>Related APIs:</b><BR>
1042  * XMC_MATH_DIV_GetSignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n
1043  *
1044  */
1045 void XMC_MATH_DIV_SignedModNB(int32_t dividend, int32_t divisor);
1046 
1047 /**
1048  * @param x - Value whose square root is computed
1049  *
1050  * @return Square root of x <BR>
1051  *
1052  * \par<b>Description:</b><br>
1053  * Computes square root of Q15 number
1054  *
1055  * \par<b>Note:</b><br>
1056  * x > 0
1057  *
1058  */
1059 int16_t XMC_MATH_CORDIC_Q15_Sqrt(int16_t x);
1060 
1061 /**
1062  * @param x - Value whose square root is computed
1063  *
1064  * @return Square root of x <BR>
1065  *
1066  * \par<b>Description:</b><br>
1067  * Computes square root of Q31 number
1068  *
1069  * \par<b>Note:</b><br>
1070  * x > 0
1071  *
1072  */
1073 int32_t XMC_MATH_CORDIC_Q31_Sqrt(int32_t x);
1074 /**
1075  * @}
1076  */
1077 
1078 /**
1079  * @}
1080  */
1081 
1082 #endif /* end of #if defined(MATH) */
1083 
1084 #ifdef __cplusplus
1085 }
1086 #endif
1087 
1088 #endif /* XMC_MATH_H */
1089