The section describes the programming interface of the MMDVSQ HAL driver. The memory-mapped divide and square root (MMDVSQ) module provides hardware division and square root operation for the MCU. The MMDVSQ HAL provides a set of APIs to access these registers.
Perform MMDVSQ Divide or square root operation
The MMDVSQ HAL provides a set of API functions to set up mathematical computations for division and square root. Ensure that the mode setting registers are configured properly. Otherwise, the API functions are provided with an invalid value.
This is an example to access MMDVSQ HAL APIs:
#include "fsl_mmdvsq_hal.h"
|
uint32_t | MMDVSQ_HAL_DivUR (MMDVSQ_Type *base, uint32_t dividend, uint32_t divisor) |
| perform the current MMDVSQ unsigned divide operation and get remainder More...
|
|
uint32_t | MMDVSQ_HAL_DivUQ (MMDVSQ_Type *base, uint32_t dividend, uint32_t divisor) |
| perform the current MMDVSQ unsigned divide operation and get quotient More...
|
|
uint32_t | MMDVSQ_HAL_DivSR (MMDVSQ_Type *base, uint32_t dividend, uint32_t divisor) |
| perform the current MMDVSQ signed divide operation and get remainder More...
|
|
uint32_t | MMDVSQ_HAL_DivSQ (MMDVSQ_Type *base, uint32_t dividend, uint32_t divisor) |
| perform the current MMDVSQ signed divide operation and get quotient More...
|
|
uint16_t | MMDVSQ_HAL_Sqrt (MMDVSQ_Type *base, uint32_t radicand) |
| set the current MMDVSQ square root operation More...
|
|
uint32_t MMDVSQ_HAL_DivUR |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
dividend, |
|
|
uint32_t |
divisor |
|
) |
| |
This function performs the MMDVSQ unsigned divide operation and get remainder. It is in block mode. For non-block mode, other HAL routines can be used.
- Parameters
-
base | Base address for current MMDVSQ instance. |
dividend | -Dividend value |
divisor | -Divisor value |
- Returns
- Unsigned divide calculation result in the MMDVSQ_RES register.
uint32_t MMDVSQ_HAL_DivUQ |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
dividend, |
|
|
uint32_t |
divisor |
|
) |
| |
This function performs the MMDVSQ unsigned divide operation and get quotient. It is in block mode. For non-block mode, other HAL routines can be used.
- Parameters
-
base | Base address for current MMDVSQ instance. |
dividend | -Dividend value |
divisor | -Divisor value |
- Returns
- Unsigned divide calculation result in the MMDVSQ_RES register.
uint32_t MMDVSQ_HAL_DivSR |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
dividend, |
|
|
uint32_t |
divisor |
|
) |
| |
This function performs the MMDVSQ signed divide operation and get remainder. It is in block mode. For non-block mode, other HAL routines can be used.
- Parameters
-
base | Base address for current MMDVSQ instance. |
dividend | -Dividend value |
divisor | -Divisor value |
- Returns
- Signed divide calculation result in the MMDVSQ_RES register.
uint32_t MMDVSQ_HAL_DivSQ |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
dividend, |
|
|
uint32_t |
divisor |
|
) |
| |
This function performs the MMDVSQ signed divide operation and get quotient. It is in block mode. For non-block mode, other HAL routines can be used.
- Parameters
-
base | Base address for current MMDVSQ instance. |
dividend | -Dividend value |
divisor | -Divisor value |
- Returns
- Signed divide calculation result in the MMDVSQ_RES register.
uint16_t MMDVSQ_HAL_Sqrt |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
radicand |
|
) |
| |
This function performs the MMDVSQ square root operation and return the sqrt result of given radicantvalue It is in block mode. For non-block mode, other HAL routines can be used.
- Parameters
-
base | Base address for current MMDVSQ instance. |
radicand | - Radicand value |
- Returns
- Square root calculation result in the MMDVSQ_RES register.
This function checks the current MMDVSQ execution status
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- Current MMDVSQ execution status
static bool MMDVSQ_HAL_GetBusyStatus |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function checks the current MMDVSQ BUSY status
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ is busy or idle
static void MMDVSQ_HAL_SetDivideFastStart |
( |
MMDVSQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ divide fast start.
- Parameters
-
base | Base address for current MMDVSQ instance. |
enable | Enable or disable divide fast start mode.
- true: ensable divide fast start.
- false: disable divide fast start, use normal start.
|
static bool MMDVSQ_HAL_GetDivideFastStart |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ divide fast start setting
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divide start is fast start or normal start -true : enable fast start mode. -false : disable fast start, divide works normal start mode.
static void MMDVSQ_HAL_SetDivdeByZero |
( |
MMDVSQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ divide by zero detection
- Parameters
-
base | Base address for current MMDVSQ instance. |
enable | Enable or disable divide by zero detect.
- true: Enable divide by zero detect.
- false: Disable divide by zero detect.
|
static bool MMDVSQ_HAL_GetDivdeByZeroSetting |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ divide by zero setting
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divide is non-zero divisor or zero divisor
- true: Enable divide by zero detect.
- false: Disable divide by zero detect.
static bool MMDVSQ_HAL_GetDivdeByZeroStatus |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ divide by zero status
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divide is non-zero divisor or zero divisor
static void MMDVSQ_HAL_SetRemainderCalculation |
( |
MMDVSQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ divide remainder calculation
- Parameters
-
base | Base address for current MMDVSQ instance. |
enable | Return quotient or remainder in the MMDVSQ_RES register.
- true: Return remainder in MMQVSQ_RES.
- false: Return quotient in MMQVSQ_RES.
|
static bool MMDVSQ_HAL_GetRemainderCalculation |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ divide remainder calculation
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divide remainder calculation is quotient or remainder
- true: return remainder in RES register.
- false: return quotient in RES register.
static void MMDVSQ_HAL_SetUnsignedCalculation |
( |
MMDVSQ_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ unsigned divide calculation
- Parameters
-
base | Base address for current MMDVSQ instance. |
enable | Enable or disable unsigned divide calculation.
- true: Enable unsigned divide calculation.
- false: Disable unsigned divide calculation.
|
static bool MMDVSQ_HAL_GetUnsignedCalculation |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ unsigned divide calculation
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divide is unsigned divide operation
- true: perform an unsigned divide.
- false: perform a signed divide
static uint32_t MMDVSQ_HAL_GetResult |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ operation result
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ operation result
static void MMDVSQ_HAL_SetDividend |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
dividend |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ dividend value
- Parameters
-
base | Base address for current MMDVSQ instance. |
dividend | Dividend value for divide calculations. |
static uint32_t MMDVSQ_HAL_GetDividend |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ dividend value
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ dividend value
static void MMDVSQ_HAL_SetDivisor |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
divisor |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ divisor value
- Parameters
-
base | Base address for current MMDVSQ instance. |
divisor | Divisor value for divide calculations.. |
static uint32_t MMDVSQ_HAL_GetDivisor |
( |
MMDVSQ_Type * |
base | ) |
|
|
inlinestatic |
This function gets the MMDVSQ divisor value
- Parameters
-
base | Base address for current MMDVSQ instance. |
- Returns
- MMDVSQ divisor value
static void MMDVSQ_HAL_SetRadicand |
( |
MMDVSQ_Type * |
base, |
|
|
uint32_t |
radicand |
|
) |
| |
|
inlinestatic |
This function sets the MMDVSQ radicand value
- Parameters
-
base | Base address for current MMDVSQ instance. |
radicand | Radicand value of Sqrt. |