Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

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"
// set divide normal start //
// perform square root operation of 2 //
result = MMDVSQ_HAL_Sqrt(MMDVSQ_BASE, 2);

Files

file  fsl_mmdvsq_hal.h
 

Enumerations

enum  mmdvsq_execution_status_t
 MMDVSQ execution status.
 
enum  mmdvsq_divide_operation_select_t
 MMDVSQ divide operation select.
 
enum  mmdvsq_divide_fast_start_select_t
 MMDVSQ divide fast start select.
 
enum  mmdvsq_divide_by_zero_select_t
 MMDVSQ divide by zero setting.
 
enum  mmdvsq_divide_by_zero_status_t
 MMDVSQ divide by zero status.
 
enum  mmdvsq_unsined_divide_select_t
 MMDVSQ unsigned or signed divide calculation select.
 
enum  mmdvsq_remainder_calculation_select_t
 MMDVSQ remainder or quotient result select.
 
enum  mmdvsq_error_code_t
 MCG mode transition API error code definitions.
 

MMDVSQ operations access API

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...
 

MMDVSQ control register access API

static mmdvsq_execution_status_t MMDVSQ_HAL_GetExecutionStatus (MMDVSQ_Type *base)
 Get the current MMDVSQ execution status. More...
 
static bool MMDVSQ_HAL_GetBusyStatus (MMDVSQ_Type *base)
 Get the current MMDVSQ BUSY status. More...
 
static void MMDVSQ_HAL_SetDivideFastStart (MMDVSQ_Type *base, bool enable)
 set the current MMDVSQ divide fast start More...
 
static bool MMDVSQ_HAL_GetDivideFastStart (MMDVSQ_Type *base)
 get the current MMDVSQ divide fast start setting More...
 
static void MMDVSQ_HAL_SetDivdeByZero (MMDVSQ_Type *base, bool enable)
 set the current MMDVSQ divide by zero detection More...
 
static bool MMDVSQ_HAL_GetDivdeByZeroSetting (MMDVSQ_Type *base)
 get the current MMDVSQ divide by zero setting More...
 
static bool MMDVSQ_HAL_GetDivdeByZeroStatus (MMDVSQ_Type *base)
 get the current MMDVSQ divide by zero status More...
 
static void MMDVSQ_HAL_SetRemainderCalculation (MMDVSQ_Type *base, bool enable)
 set the current MMDVSQ divide remainder calculation More...
 
static bool MMDVSQ_HAL_GetRemainderCalculation (MMDVSQ_Type *base)
 get the current MMDVSQ divide remainder calculation More...
 
static void MMDVSQ_HAL_SetUnsignedCalculation (MMDVSQ_Type *base, bool enable)
 set the current MMDVSQ unsigned divide calculation More...
 
static bool MMDVSQ_HAL_GetUnsignedCalculation (MMDVSQ_Type *base)
 get the current MMDVSQ unsigned divide calculation More...
 
static uint32_t MMDVSQ_HAL_GetResult (MMDVSQ_Type *base)
 get the current MMDVSQ operation result More...
 
static void MMDVSQ_HAL_SetDividend (MMDVSQ_Type *base, uint32_t dividend)
 set the current MMDVSQ dividend value More...
 
static uint32_t MMDVSQ_HAL_GetDividend (MMDVSQ_Type *base)
 get the current MMDVSQ dividend value More...
 
static void MMDVSQ_HAL_SetDivisor (MMDVSQ_Type *base, uint32_t divisor)
 set the current MMDVSQ divisor value More...
 
static uint32_t MMDVSQ_HAL_GetDivisor (MMDVSQ_Type *base)
 get the current MMDVSQ divisor value More...
 
static void MMDVSQ_HAL_SetRadicand (MMDVSQ_Type *base, uint32_t radicand)
 set the current MMDVSQ radicand value More...
 

Function Documentation

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
baseBase 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
baseBase 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
baseBase 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
baseBase 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
baseBase address for current MMDVSQ instance.
radicand- Radicand value
Returns
Square root calculation result in the MMDVSQ_RES register.
static mmdvsq_execution_status_t MMDVSQ_HAL_GetExecutionStatus ( MMDVSQ_Type *  base)
inlinestatic

This function checks the current MMDVSQ execution status

Parameters
baseBase 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
baseBase 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
baseBase address for current MMDVSQ instance.
enableEnable 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
baseBase 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
baseBase address for current MMDVSQ instance.
enableEnable 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
baseBase 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
baseBase address for current MMDVSQ instance.
Returns
MMDVSQ divide is non-zero divisor or zero divisor
  • true: zero divisor.
    • false: non-zero divisor.
static void MMDVSQ_HAL_SetRemainderCalculation ( MMDVSQ_Type *  base,
bool  enable 
)
inlinestatic

This function sets the MMDVSQ divide remainder calculation

Parameters
baseBase address for current MMDVSQ instance.
enableReturn 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
baseBase 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
baseBase address for current MMDVSQ instance.
enableEnable 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
baseBase 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
baseBase 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
baseBase address for current MMDVSQ instance.
dividendDividend value for divide calculations.
static uint32_t MMDVSQ_HAL_GetDividend ( MMDVSQ_Type *  base)
inlinestatic

This function gets the MMDVSQ dividend value

Parameters
baseBase 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
baseBase address for current MMDVSQ instance.
divisorDivisor value for divide calculations..
static uint32_t MMDVSQ_HAL_GetDivisor ( MMDVSQ_Type *  base)
inlinestatic

This function gets the MMDVSQ divisor value

Parameters
baseBase 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
baseBase address for current MMDVSQ instance.
radicandRadicand value of Sqrt.