1 /*********************************************************************************************************//**
2 * @file ht32f5xxxx_div.h
3 * @version $Rev:: 4617 $
4 * @date $Date:: 2020-02-26 #$
5 * @brief The header file of the DIV library.
6 *************************************************************************************************************
7 * @attention
8 *
9 * Firmware Disclaimer Information
10 *
11 * 1. The customer hereby acknowledges and agrees that the program technical documentation, including the
12 * code, which is supplied by Holtek Semiconductor Inc., (hereinafter referred to as "HOLTEK") is the
13 * proprietary and confidential intellectual property of HOLTEK, and is protected by copyright law and
14 * other intellectual property laws.
15 *
16 * 2. The customer hereby acknowledges and agrees that the program technical documentation, including the
17 * code, is confidential information belonging to HOLTEK, and must not be disclosed to any third parties
18 * other than HOLTEK and the customer.
19 *
20 * 3. The program technical documentation, including the code, is provided "as is" and for customer reference
21 * only. After delivery by HOLTEK, the customer shall use the program technical documentation, including
22 * the code, at their own risk. HOLTEK disclaims any expressed, implied or statutory warranties, including
23 * the warranties of merchantability, satisfactory quality and fitness for a particular purpose.
24 *
25 * <h2><center>Copyright (C) Holtek Semiconductor Inc. All rights reserved</center></h2>
26 ************************************************************************************************************/
27
28 /* Define to prevent recursive inclusion -------------------------------------------------------------------*/
29 #ifndef __HT32F5XXXX_DIV_H
30 #define __HT32F5XXXX_DIV_H
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /* Includes ------------------------------------------------------------------------------------------------*/
37 #include "ht32.h"
38
39 /** @addtogroup HT32F5xxxx_Peripheral_Driver HT32F5xxxx Peripheral Driver
40 * @{
41 */
42
43 /** @addtogroup DIV
44 * @{
45 */
46
47 /* Settings ------------------------------------------------------------------------------------------------*/
48 /** @defgroup DIV_Settings DIV settings
49 * @{
50 */
51 #define DIV_ENABLE_DIVIDE_BY_ZERO_CHECK (0)
52 /**
53 * @}
54 */
55
56
57 /* Exported types ------------------------------------------------------------------------------------------*/
58 /** @defgroup DIV_Exported_Types DIV exported types
59 * @{
60 */
61
62 /**
63 * @}
64 */
65
66 /* Exported constants --------------------------------------------------------------------------------------*/
67 /** @defgroup DIV_Exported_Constants DIV exported constants
68 * @{
69 */
70
71 /**
72 * @}
73 */
74
75 /* Exported functions --------------------------------------------------------------------------------------*/
76 /** @defgroup DIV_Exported_Functions DIV exported functions
77 * @{
78 */
79 void DIV_DeInit(void);
80 s32 DIV_Div32(s32 dividend, s32 divisor);
81 s32 DIV_Mod(s32 dividend, s32 divisor);
82 bool DIV_IsDivByZero(void);
83
84 u32 DIV_uDiv32(u32 dividend, u32 divisor);
85 u32 DIV_uGetLastRemainder(void);
86
87 /*********************************************************************************************************//**
88 * @brief Retuen the remainder of last dividend/divisor calculatation.
89 * @retval The remainder of dividend/divisor
90 ************************************************************************************************************/
DIV_GetLastRemainder(void)91 __STATIC_INLINE s32 DIV_GetLastRemainder(void)
92 {
93 return (HT_DIV->RMR);
94 }
95
96 /**
97 * @}
98 */
99
100
101 /**
102 * @}
103 */
104
105 /**
106 * @}
107 */
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif
114