Loading [MathJax]/extensions/tex2jax.js
XMC Peripheral Library for XMC1000 Family
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
MATH Coprocessor (MATH)

Macros

#define XMC_MATH_Q0_11(x)   ((XMC_MATH_Q0_11_t)(((x) >= 0) ? ((x) * (1 << 11) + 0.5) : ((x) * (1 << 11) - 0.5)))
 
#define XMC_MATH_Q0_23(x)   ((XMC_MATH_Q0_23_t)(((x) >= 0) ? ((x) * (1 << 23) + 0.5) : ((x) * (1 << 23) - 0.5)))
 

Functions

void XMC_MATH_ClearEvent (const XMC_MATH_EVENT_t event)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan (XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y)
 
void XMC_MATH_CORDIC_ArcTanNB (XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos (XMC_MATH_Q0_23_t angle_in_radians)
 
XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_CoshNB (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_CosNB (XMC_MATH_Q0_23_t angle_in_radians)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetArcTanResult (void)
 
XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetCoshResult (void)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetCosResult (void)
 
XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetSinhResult (void)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetSinResult (void)
 
XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanhResult (void)
 
XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanResult (void)
 
bool XMC_MATH_CORDIC_IsBusy (void)
 
int16_t XMC_MATH_CORDIC_Q15_Sqrt (int16_t x)
 
int32_t XMC_MATH_CORDIC_Q31_Sqrt (int32_t x)
 
XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin (XMC_MATH_Q0_23_t angle_in_radians)
 
XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_SinhNB (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_SinNB (XMC_MATH_Q0_23_t angle_in_radians)
 
XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan (XMC_MATH_Q0_23_t angle_in_radians)
 
XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_TanhNB (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_CORDIC_TanNB (XMC_MATH_Q0_23_t angle_in_radians)
 
void XMC_MATH_Disable (void)
 
void XMC_MATH_DisableEvent (const XMC_MATH_EVENT_t event)
 
int32_t XMC_MATH_DIV_GetSignedDivResult (void)
 
int32_t XMC_MATH_DIV_GetSignedModResult (void)
 
uint32_t XMC_MATH_DIV_GetUnsignedDivResult (void)
 
uint32_t XMC_MATH_DIV_GetUnsignedModResult (void)
 
bool XMC_MATH_DIV_IsBusy (void)
 
void XMC_MATH_DIV_SignedDivNB (int32_t dividend, int32_t divisor)
 
void XMC_MATH_DIV_SignedModNB (int32_t dividend, int32_t divisor)
 
void XMC_MATH_DIV_UnsignedDivNB (uint32_t dividend, uint32_t divisor)
 
void XMC_MATH_DIV_UnsignedModNB (uint32_t dividend, uint32_t divisor)
 
void XMC_MATH_Enable (void)
 
void XMC_MATH_EnableEvent (const XMC_MATH_EVENT_t event)
 
bool XMC_MATH_GetEventStatus (const XMC_MATH_EVENT_t event)
 
void XMC_MATH_SetEvent (const XMC_MATH_EVENT_t event)
 

Detailed Description

The MATH Coprocessor (MATH) module comprises of two independent sub-blocks to support the CPU in math-intensive computations: a Divider Unit (DIV) for signed and unsigned 32-bit division operations and a CORDIC (COrdinate Rotation DIgital Computer) Coprocessor for computation of trigonometric, linear or hyperbolic functions.

MATH driver features:

  1. CORDIC Coprocessor is used for computation of trigonometric and hyperbolic functions
  2. Supports result chaining between the Divider Unit and CORDIC Coprocessor
  3. All MATH APIs are available in Blocking and non-blocking modes. Non-blocking APIs are suffixed with NB.
  4. 32bit signed and unsigned division implementations available for __aeabi_uidiv(), __aeabi_idiv(), __aeabi_uidivmod(), __aeabi_idivmod()
  5. Divider and CORDIC unit busy status can be checked by XMC_MATH_DIV_IsBusy() and XMC_MATH_CORDIC_IsBusy()
  6. Individual APIs available to return the result of each non-blocking MATH function

Note:
All non-blocking MATH APIs are not atomic and hence occurence of interrupts during the normal execution of these APIs may lead to erroneous results. User has to exercise caution while using these APIs.

Example: Execution of divide instruction (/) in an ISR during the normal execution of non-blocking APIs may give erroneous results.

Macro Definition Documentation

◆ XMC_MATH_Q0_11

#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

◆ XMC_MATH_Q0_23

#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

Enumeration Type Documentation

◆ XMC_MATH_CORDIC_CORDXRC_t

CORDX Register Result Chaining.

Enumerator
XMC_MATH_CORDIC_CORDXRC_DISABLED 

No result chaining is selected

XMC_MATH_CORDIC_CORDXRC_QUOT_IS_SOURCE 

QUOT register is the selected source

XMC_MATH_CORDIC_CORDXRC_RMD_IS_SOURCE 

RMD register is the selected source

◆ XMC_MATH_CORDIC_CORDYRC_t

CORDY Register Result Chaining.

Enumerator
XMC_MATH_CORDIC_CORDYRC_DISABLED 

No result chaining is selected

XMC_MATH_CORDIC_CORDYRC_QUOT_IS_SOURCE 

QUOT register is the selected source

XMC_MATH_CORDIC_CORDYRC_RMD_IS_SOURCE 

RMD register is the selected source

◆ XMC_MATH_CORDIC_CORDZRC_t

CORDZ Register Result Chaining.

Enumerator
XMC_MATH_CORDIC_CORDZRC_DISABLED 

No result chaining is selected

XMC_MATH_CORDIC_CORDZRC_QUOT_IS_SOURCE 

QUOT register is the selected source

XMC_MATH_CORDIC_CORDZRC_RMD_IS_SOURCE 

RMD register is the selected source

◆ XMC_MATH_CORDIC_MAGNITUDE_t

Calculated value of CORRX and CORRY are each divided by this factor to yield the result.

Enumerator
XMC_MATH_CORDIC_MAGNITUDE_DIVBY1 

Divide by 1

XMC_MATH_CORDIC_MAGNITUDE_DIVBY2 

Divide by 2

XMC_MATH_CORDIC_MAGNITUDE_DIVBY4 

Divide by 4

◆ XMC_MATH_CORDIC_OPERATING_MODE_t

CORDIC operating mode.

Enumerator
XMC_MATH_CORDIC_OPERATING_MODE_LINEAR 

Linear mode

XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR 

Circular mode

XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC 

Hyperbolic mode

◆ XMC_MATH_CORDIC_ROTVEC_MODE_t

Rotation vectoring selection.

Enumerator
XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING 

Vectoring mode

XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION 

Rotation mode

◆ XMC_MATH_DIV_DVDRC_t

Dividend Register Result Chaining.

Enumerator
XMC_MATH_DIV_DVDRC_DISABLED 

No result chaining is selected

XMC_MATH_DIV_DVDRC_QUOT_IS_SOURCE 

QUOT register is the selected source

XMC_MATH_DIV_DVDRC_RMD_IS_SOURCE 

RMD register is the selected source

XMC_MATH_DIV_DVDRC_CORRX_IS_SOURCE 

CORRX is the selected source

XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE 

CORRY is the selected source

XMC_MATH_DIV_DVDRC_CORRZ_IS_SOURCE 

CORRZ is the selected source

◆ XMC_MATH_DIV_DVSRC_t

Divisor Register Result Chaining.

Enumerator
XMC_MATH_DIV_DVSRC_DISABLED 

No result chaining is selected

XMC_MATH_DIV_DVSRC_QUOT_IS_SOURCE 

QUOT register is the selected source

XMC_MATH_DIV_DVSRC_RMD_IS_SOURCE 

RMD register is the selected source

XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE 

CORRX is the selected source

XMC_MATH_DIV_DVSRC_CORRY_IS_SOURCE 

CORRY is the selected source

XMC_MATH_DIV_DVSRC_CORRZ_IS_SOURCE 

CORRZ is the selected source

◆ XMC_MATH_EVENT_t

Service request events for the DIV and CORDIC modules.

Enumerator
XMC_MATH_EVENT_DIV_END_OF_CALC 

Divider end of calculation event

XMC_MATH_EVENT_DIV_ERROR 

Divider error event

XMC_MATH_EVENT_CORDIC_END_OF_CALC 

CORDIC end of calculation event

XMC_MATH_EVENT_CORDIC_ERROR 

CORDIC error event

Function Documentation

◆ XMC_MATH_ClearEvent()

void XMC_MATH_ClearEvent ( const XMC_MATH_EVENT_t  event)
Parameters
eventEvent of type XMC_MATH_EVENT_t
Returns
None
Description:
Clears the requested event.
DIV & CORDIC unit's event (end of calculation & error) is cleared by setting bit-fields of EVFCR register.
Related APIs:
XMC_MATH_SetEvent()


◆ XMC_MATH_CORDIC_ArcTan()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan ( XMC_MATH_Q8_15_t  x,
XMC_MATH_Q8_15_t  y 
)
Parameters
xValue representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format)
yValue representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format)
Returns
XMC_MATH_Q0_23_t
Description:
Computes the principal value arc tangent of an angle of y/x expressed in radians. The input radians must be in XMC_MATH_Q8_15_t format.
This function programs CORDIC as circular mode. CORDY register is programmed with input y and CORDX register is programmed with input x. Most significant 24 bits of CORRZ register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.

◆ XMC_MATH_CORDIC_ArcTanNB()

void XMC_MATH_CORDIC_ArcTanNB ( XMC_MATH_Q8_15_t  x,
XMC_MATH_Q8_15_t  y 
)
Parameters
xValue representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format)
yValue representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format)
Returns
None
Description:
Computes the principal value arc tangent of an angle of y/x expressed in radians. The input radians must be in XMC_MATH_Q8_15_t format. Call XMC_MATH_CORDIC_GetArcTanResult() API to get the result.
This function programs CORDIC as circular mode. CORDY register is programmed with input y and CORDX register is programmed with input x.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetArcTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_Cos()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q0_23_t
Description:
Computes the cosine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & circular mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. Most significant 24 bits of CORRX register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Tan()


◆ XMC_MATH_CORDIC_Cosh()

XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q1_22_t
Description:
Computes the hyperbolic cosine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & hyperbolic mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. Most significant 24 bits of CORRX register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Tanh()


◆ XMC_MATH_CORDIC_CoshNB()

void XMC_MATH_CORDIC_CoshNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the hyperbolic cosine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetCoshResult() API to get the result.
This function programs CORDIC to rotation & hyperbolic mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetCoshResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_CosNB()

void XMC_MATH_CORDIC_CosNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the cosine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetCosResult() API to get the result.
This function programs CORDIC to rotation & circular mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetCosResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_GetArcTanResult()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetArcTanResult ( void  )
Returns
XMC_MATH_Q0_23_t
Description:
Returns result of a Arc Tangent operation.
Most significant 24 bits of CORRZ register returns the result of Arc Tangent operation.
Related APIs:
XMC_MATH_CORDIC_ArcTanNB()


◆ XMC_MATH_CORDIC_GetCoshResult()

XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetCoshResult ( void  )
Returns
XMC_MATH_Q1_22_t
Description:
Returns result of a Hyperbolic Cosine operation.
Most significant 24 bits of CORRX register returns the result of Hyperbolic Cosine operation.
Related APIs:
XMC_MATH_CORDIC_CoshNB()


◆ XMC_MATH_CORDIC_GetCosResult()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetCosResult ( void  )
Returns
XMC_MATH_Q0_23_t
Description:
Returns result of a Cosine operation.
Most significant 24 bits of CORRX register returns the result of Cosine operation.
Related APIs:
XMC_MATH_CORDIC_CosNB()


◆ XMC_MATH_CORDIC_GetSinhResult()

XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetSinhResult ( void  )
Returns
XMC_MATH_Q1_22_t
Description:
Returns result of a Hyperbolic Sine operation.
Most significant 24 bits of CORRY register returns the result of Hyperbolic Sine operation.
Related APIs:
XMC_MATH_CORDIC_SinhNB()


◆ XMC_MATH_CORDIC_GetSinResult()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetSinResult ( void  )
Returns
XMC_MATH_Q0_23_t
Description:
Returns result of a Sine operation.
Most significant 24 bits of CORRY register returns the result of Sine operation.
Related APIs:
XMC_MATH_CORDIC_SinNB()


◆ XMC_MATH_CORDIC_GetTanhResult()

XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanhResult ( void  )
Returns
XMC_MATH_Q0_11_t
Description:
Returns result of a Hyperbolic Tangent operation.
QUOT register returns the result of Hyperbolic Tangent operation.
Related APIs:
XMC_MATH_CORDIC_TanhNB()


◆ XMC_MATH_CORDIC_GetTanResult()

XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanResult ( void  )
Returns
XMC_MATH_Q0_11_t
Description:
Returns result of a Tangent operation.
QUOT register returns the result of Tangent operation.
Related APIs:
XMC_MATH_CORDIC_TanNB()


◆ XMC_MATH_CORDIC_IsBusy()

bool XMC_MATH_CORDIC_IsBusy ( void  )
Returns
bool
true - if CORDIC unit is busy
false - if CORDIC unit is not busy
Description:
Utility function to check if the DIV unit is busy.
CORDIC coprocessor's status is determined by reading BSY bit of STATC register.

◆ XMC_MATH_CORDIC_Q15_Sqrt()

int16_t XMC_MATH_CORDIC_Q15_Sqrt ( int16_t  x)
Parameters
x- Value whose square root is computed
Returns
Square root of x
Description:
Computes square root of Q15 number
Note:
x > 0

◆ XMC_MATH_CORDIC_Q31_Sqrt()

int32_t XMC_MATH_CORDIC_Q31_Sqrt ( int32_t  x)
Parameters
x- Value whose square root is computed
Returns
Square root of x
Description:
Computes square root of Q31 number
Note:
x > 0

◆ XMC_MATH_CORDIC_Sin()

XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q0_23_t
Description:
Computes the sine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & circular mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. Most significant 24 bits of CORRY register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Cos(), XMC_MATH_CORDIC_Tan()


◆ XMC_MATH_CORDIC_Sinh()

XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q1_22_t
Description:
Computes the hyperbolic sine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & hyperbolic mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. Most significant 24 bits of CORRY register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Cosh(), XMC_MATH_CORDIC_Tanh()


◆ XMC_MATH_CORDIC_SinhNB()

void XMC_MATH_CORDIC_SinhNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the hyperbolic sine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetSinhResult() API to get the result.
This function programs CORDIC to rotation & hyperbolic mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetSinhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_SinNB()

void XMC_MATH_CORDIC_SinNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the sine for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetSinResult() API to get the result.
This function programs CORDIC to rotation & circular mode. Configures CORDZ register with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetSinResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_Tan()

XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q0_11_t
Description:
Computes the tangent for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & circular mode. Chains the results of Cosine (CORRX) and Sine (CORRY) as a dividend and divisor by configuring GLBCON register. CORDZ register is programmed with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. Most significant 24 bits of CORRY register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Cos()


◆ XMC_MATH_CORDIC_Tanh()

XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
XMC_MATH_Q0_11_t
Description:
Computes the hyperbolic tangent for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format.
This function programs CORDIC to rotation & hyperbolic mode. Chains the results of Cosine (CORRX) and Sine (CORRY) as a dividend and divisor by configuring GLBCON register. CORDZ register is programmed with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. QUOT register returns the result of the operation.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Cosh()()


◆ XMC_MATH_CORDIC_TanhNB()

void XMC_MATH_CORDIC_TanhNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the hyperbolic tangent for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetTanhResult() API to get the result.
This function programs CORDIC to rotation & hyperbolic mode. Chains the results of Cosine (CORRX) and Sine (CORRY) as a dividend and divisor by configuring GLBCON register. CORDZ register is programmed with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetTanhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_CORDIC_TanNB()

void XMC_MATH_CORDIC_TanNB ( XMC_MATH_Q0_23_t  angle_in_radians)
Parameters
angle_in_radians- Normalised Angle in Radians (XMC_MATH_Q0_23_t format)
Returns
None
Description:
Computes the tangent for an angle in radians angle_in_radians. The input angle in radians must be in XMC_MATH_Q0_23_t format. Call XMC_MATH_CORDIC_GetTanResult() API to get the result.
This function programs CORDIC to rotation & circular mode. Chains the results of Cosine (CORRX) and Sine (CORRY) as a dividend and divisor by configuring GLBCON register. CORDZ register is programmed with input angle_in_radians and CORDX register with gain XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023.
Note:
Loading of CORDX register triggers the start of computation.
Related APIs:
XMC_MATH_CORDIC_GetTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_Disable()

void XMC_MATH_Disable ( void  )
Returns
None
Description:
Disables the Math module by gating the clock.
MATH coprocessor's clock is disabled by setting MATH bit of CGATSET0 register.
Related APIs:
XMC_MATH_Disable()


◆ XMC_MATH_DisableEvent()

void XMC_MATH_DisableEvent ( const XMC_MATH_EVENT_t  event)
Parameters
eventEvent of type XMC_MATH_EVENT_t
Returns
None
Description:
Disables the requested event.
DIV & CORDIC unit's event (end of calculation & error) is disabled by clearing bit-fields of EVIER register.
Related APIs:
XMC_MATH_GetEventStatus(), XMC_MATH_EnableEvent()


◆ XMC_MATH_DIV_GetSignedDivResult()

int32_t XMC_MATH_DIV_GetSignedDivResult ( void  )
Returns
int32_t
Description:
Returns result of a Signed Division operation.
QUOT register returns the result of Signed Division operation.
Related APIs:
XMC_MATH_DIV_SignedDivNB()


◆ XMC_MATH_DIV_GetSignedModResult()

int32_t XMC_MATH_DIV_GetSignedModResult ( void  )
Returns
int32_t
Description:
Returns result of a Signed Modulo operation.
RMD register returns the result of Signed Modulo operation.
Related APIs:
XMC_MATH_DIV_SignedModNB()


◆ XMC_MATH_DIV_GetUnsignedDivResult()

uint32_t XMC_MATH_DIV_GetUnsignedDivResult ( void  )
Returns
uint32_t
Description:
Returns result of a Unsigned Division operation.
QUOT register returns the result of Unsigned Division operation.
Related APIs:
XMC_MATH_DIV_UnsignedDivNB()


◆ XMC_MATH_DIV_GetUnsignedModResult()

uint32_t XMC_MATH_DIV_GetUnsignedModResult ( void  )
Returns
uint32_t
Description:
Returns result of a Unsigned Modulo operation.
RMD register returns the result of Unsigned Modulo operation.
Related APIs:
XMC_MATH_DIV_UnsignedModNB()


◆ XMC_MATH_DIV_IsBusy()

bool XMC_MATH_DIV_IsBusy ( void  )
Returns
bool
true - if DIV unit is busy false - if DIV unit is not busy
Description:
Utility function to check if the DIV unit is busy.
Divider unit status is determined by reading BSY bit of DIVST register.

◆ XMC_MATH_DIV_SignedDivNB()

void XMC_MATH_DIV_SignedDivNB ( int32_t  dividend,
int32_t  divisor 
)
Parameters
dividend- Dividend
divisor- Divisor
Returns
None
Description:
Performs signed integer division and computes quotient of the division. Call XMC_MATH_DIV_GetSignedDivResult() API to get the result.
Divider unit is configured for signed division. DVD & DVS registers are programmed with dividend and divisor values. The division is started with the write to DVS register.
Note:
Ensure divisor is smaller than dividend.
Related APIs:
XMC_MATH_DIV_GetSignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_DIV_SignedModNB()

void XMC_MATH_DIV_SignedModNB ( int32_t  dividend,
int32_t  divisor 
)
Parameters
dividend- Dividend
divisor- Divisor
Returns
None
Description:
Performs signed modulo operation and computes remainder of the division. Call XMC_MATH_DIV_GetSignedModResult() API to get the result.
Divider unit is configured for signed division. DVD & DVS registers are programmed with dividend and divisor values. The division is started with the write to DVS register.
Note:
Ensure divisor is smaller than dividend.
Related APIs:
XMC_MATH_DIV_GetSignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_DIV_UnsignedDivNB()

void XMC_MATH_DIV_UnsignedDivNB ( uint32_t  dividend,
uint32_t  divisor 
)
Parameters
dividend- Dividend
divisor- Divisor
Returns
None
Description:
Performs unsigned integer division and computes quotient of the division. Call XMC_MATH_DIV_GetUnsignedDivResult() API to get the result.
Divider unit is configured for unsigned division. DVD & DVS registers are programmed with dividend and divisor values. The division is started with the write to DVS register.
Note:
Ensure divisor is smaller than dividend.
Related APIs:
XMC_MATH_DIV_GetUnsignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_DIV_UnsignedModNB()

void XMC_MATH_DIV_UnsignedModNB ( uint32_t  dividend,
uint32_t  divisor 
)
Parameters
dividend- Dividend
divisor- Divisor
Returns
None
Description:
Performs unsigned modulo operation and computes remainder of the division. Call XMC_MATH_DIV_GetUnsignedModResult() API to get the result.
Divider unit is configured for unsigned division. DVD & DVS registers are programmed with dividend and divisor values. The division is started with the write to DVS register.
Note:
Ensure divisor is smaller than dividend.
Related APIs:
XMC_MATH_DIV_GetUnsignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()


◆ XMC_MATH_Enable()

void XMC_MATH_Enable ( void  )
Returns
None
Description:
Enables the Math module by un-gating the clock.
MATH coprocessor's clock is enabled by setting MATH bit of CGATCLR0 register.
Related APIs:
XMC_MATH_Disable()


◆ XMC_MATH_EnableEvent()

void XMC_MATH_EnableEvent ( const XMC_MATH_EVENT_t  event)
Parameters
eventEvent of type XMC_MATH_EVENT_t
Returns
None
Description:
Enables the requested event.
DIV & CORDIC unit's event (end of calculation & error) is enabled by setting bit-fields of EVIER register.
Related APIs:
XMC_MATH_GetEventStatus(), XMC_MATH_DisableEvent()


◆ XMC_MATH_GetEventStatus()

bool XMC_MATH_GetEventStatus ( const XMC_MATH_EVENT_t  event)
Parameters
eventEvent of type XMC_MATH_EVENT_t
Returns
bool
true - if status is set
false - if status is not set
Description:
Returns the status of the requested event.
Status of DIV & CORDIC unit's event (end of calculation & error) status is determined by reading EVFR register.
Related APIs:
XMC_MATH_EnableEvent(), XMC_MATH_DisableEvent(), XMC_MATH_SetEvent(), XMC_MATH_ClearEvent()


◆ XMC_MATH_SetEvent()

void XMC_MATH_SetEvent ( const XMC_MATH_EVENT_t  event)
Parameters
eventEvent of type XMC_MATH_EVENT_t
Returns
None
Description:
Sets the requested event. This is a software setting for the event.
DIV & CORDIC unit's event (end of calculation & error) is set by setting bit-fields of EVFSR register.
Related APIs:
XMC_MATH_ClearEvent()