1 /**************************************************************************//**
\r
5 * $Date: 16/07/07 7:50p $
\r
6 * @brief M0564 series Hardware Divider(HDIV) driver header file
\r
9 * Copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
\r
11 ******************************************************************************/
\r
21 /** @addtogroup Standard_Driver Standard Driver
\r
25 /** @addtogroup HDIV_Driver HDIV Driver
\r
29 /** @addtogroup HDIV_EXPORTED_FUNCTIONS HDIV Exported Functions
\r
34 * @brief Division function to calculate (x/y)
\r
36 * @param[in] x the dividend of the division
\r
37 * @param[in] y the divisor of the division
\r
39 * @return The result of (x/y)
\r
41 * @details This is a division function to calculate x/y
\r
44 static __INLINE int32_t HDIV_Div(int32_t x, int16_t y)
\r
48 p32 = (uint32_t *)HDIV_BASE;
\r
49 *p32++ = (uint32_t)x;
\r
50 *p32++ = (uint32_t)y;
\r
51 return (int32_t) * p32;
\r
56 * @brief To calculate the remainder of x/y, i.e., the result of x mod y.
\r
58 * @param[in] x the dividend of the division
\r
59 * @param[in] y the divisor of the division
\r
61 * @return The remainder of (x/y)
\r
63 * @details This function is used to calculate the remainder of x/y.
\r
65 static __INLINE int16_t HDIV_Mod(int32_t x, int16_t y)
\r
69 p32 = (uint32_t *)HDIV_BASE;
\r
70 *p32++ = (uint32_t)x;
\r
71 *p32++ = (uint32_t)y;
\r
72 return (int16_t)p32[1];
\r
75 /*@}*/ /* end of group HDIV_EXPORTED_FUNCTIONS */
\r
77 /*@}*/ /* end of group HDIV_Driver */
\r
79 /*@}*/ /* end of group Standard_Driver */
\r
87 /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
\r