| MINI55_BSP V3.01.003 The Board Support Package for Mini55 Series MCU

hdiv.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __HDIV_H__
13#define __HDIV_H__
14
15#ifdef __cplusplus
16 extern "C"
17{
18#endif
19
20
45 static __INLINE int32_t HDIV_Div(int32_t x, int16_t y)
46{
47 uint32_t *p32;
48
49 p32 = (uint32_t *)HDIV_BASE;
50 *p32++ = x;
51 *p32++ = y;
52 return *p32;
53}
54
55
66 static __INLINE int16_t HDIV_Mod(int32_t x, int16_t y)
67{
68 uint32_t *p32;
69
70 p32 = (uint32_t *)HDIV_BASE;
71 *p32++ = x;
72 *p32++ = y;
73 return p32[1];
74}
75
76 /* end of group MINI55_HDIV_EXPORTED_FUNCTIONS */
78 /* end of group MINI55_HDIV_Driver */
80 /* end of group MINI55_Device_Driver */
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif //__HDIV_H__
88
89/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
HDIV_Mod
static __INLINE int16_t HDIV_Mod(int32_t x, int16_t y)
To calculate the remainder of x/y, i.e., the result of x mod y.
Definition: hdiv.h:66
HDIV_Div
static __INLINE int32_t HDIV_Div(int32_t x, int16_t y)
Division function to calculate (x/y)
Definition: hdiv.h:45
HDIV_BASE
#define HDIV_BASE
HDIV register base address.
Definition: Mini55Series.h:6985