hdiv_reg.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**************************************************************************//**
  2. * @file hdiv_reg.h
  3. * @version V1.00
  4. * @brief HDIV register definition header file
  5. *
  6. * SPDX-License-Identifier: Apache-2.0
  7. * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #ifndef __HDIV_REG_H__
  10. #define __HDIV_REG_H__
  11. #if defined ( __CC_ARM )
  12. #pragma anon_unions
  13. #endif
  14. /**
  15. @addtogroup REGISTER Control Register
  16. @{
  17. */
  18. /**
  19. @addtogroup HDIV Hardware Divider (HDIV)
  20. Memory Mapped Structure for HDIV Controller
  21. @{ */
  22. typedef struct
  23. {
  24. /**
  25. * DIVIDEND
  26. * ===================================================================================================
  27. * Offset: 0x00 Dividend Source Register
  28. * ---------------------------------------------------------------------------------------------------
  29. * |Bits |Field |Descriptions
  30. * | :----: | :----: | :---- |
  31. * |[31:0] |DIVIDEND |Dividend Source
  32. * | | |This register is given the dividend of divider before calculation starting.
  33. */
  34. __IO uint32_t DIVIDEND;
  35. /**
  36. * DIVISOR
  37. * ===================================================================================================
  38. * Offset: 0x04 Divisor Source Resister
  39. * ---------------------------------------------------------------------------------------------------
  40. * |Bits |Field |Descriptions
  41. * | :----: | :----: | :---- |
  42. * |[15:0] |DIVISOR |Divisor Source
  43. * | | |This register is given the divisor of divider before calculation starts.
  44. * | | |Note: When this register is written, hardware divider will start calculate.
  45. */
  46. __IO uint32_t DIVISOR;
  47. /**
  48. * QUOTIENT
  49. * ===================================================================================================
  50. * Offset: 0x08 Quotient Result Resister
  51. * ---------------------------------------------------------------------------------------------------
  52. * |Bits |Field |Descriptions
  53. * | :----: | :----: | :---- |
  54. * |[31:0] |QUOTIENT |Quotient Result
  55. * | | |This register holds the quotient result of divider after calculation complete.
  56. */
  57. __IO uint32_t QUOTIENT;
  58. /**
  59. * REM
  60. * ===================================================================================================
  61. * Offset: 0x0C Remainder Result Register
  62. * ---------------------------------------------------------------------------------------------------
  63. * |Bits |Field |Descriptions
  64. * | :----: | :----: | :---- |
  65. * |[31:0] |REM |Remainder Result
  66. * | | |The remainder of hardware divider is 16-bit sign integer (REM[15:0]) with sign extension
  67. * | | |(REM[31:16]) to 32-bit integer.
  68. */
  69. __IO uint32_t REM;
  70. /**
  71. * STATUS
  72. * ===================================================================================================
  73. * Offset: 0x10 Divider Status Register
  74. * ---------------------------------------------------------------------------------------------------
  75. * |Bits |Field |Descriptions
  76. * | :----: | :----: | :---- |
  77. * |[1] |DIVBYZERO |Divisor Zero Warning
  78. * | | |0 = The divisor is not 0.
  79. * | | |1 = The divisor is 0.
  80. * | | |Note: The DIVBYZERO flag is used to indicate divide-by-zero situation and updated whenever
  81. * | | |HDIV_DIVISOR is written.
  82. * | | |This register is read only.
  83. */
  84. __I uint32_t STATUS;
  85. } HDIV_T;
  86. /**
  87. @addtogroup HDIV_CONST HDIV Bit Field Definition
  88. Constant Definitions for HDIV Controller
  89. @{ */
  90. #define HDIV_DIVIDEND_DIVIDEND_Pos (0) /*!< HDIV_T::DIVIDEND: DIVIDEND Position */
  91. #define HDIV_DIVIDEND_DIVIDEND_Msk (0xfffffffful << HDIV_DIVIDEND_DIVIDEND_Pos) /*!< HDIV_T::DIVIDEND: DIVIDEND Mask */
  92. #define HDIV_DIVISOR_DIVISOR_Pos (0) /*!< HDIV_T::DIVISOR: DIVISOR Position */
  93. #define HDIV_DIVISOR_DIVISOR_Msk (0xfffful << HDIV_DIVISOR_DIVISOR_Pos) /*!< HDIV_T::DIVISOR: DIVISOR Mask */
  94. #define HDIV_QUOTIENT_QUOTIENT_Pos (0) /*!< HDIV_T::QUOTIENT: QUOTIENT Position */
  95. #define HDIV_QUOTIENT_QUOTIENT_Msk (0xfffffffful << HDIV_QUOTIENT_QUOTIENT_Pos) /*!< HDIV_T::QUOTIENT: QUOTIENT Mask */
  96. #define HDIV_REM_REM_Pos (0) /*!< HDIV_T::REM: REM Position */
  97. #define HDIV_REM_REM_Msk (0xfffffffful << HDIV_REM_REM_Pos) /*!< HDIV_T::REM: REM Mask */
  98. #define HDIV_STATUS_DIVBYZERO_Pos (1) /*!< HDIV_T::STATUS: DIVBYZERO Position */
  99. #define HDIV_STATUS_DIVBYZERO_Msk (0x1ul << HDIV_STATUS_DIVBYZERO_Pos) /*!< HDIV_T::STATUS: DIVBYZERO Mask */
  100. /**@}*/ /* HDIV_CONST */
  101. /**@}*/ /* end of HDIV register group */
  102. /**@}*/ /* end of REGISTER group */
  103. #if defined ( __CC_ARM )
  104. #pragma no_anon_unions
  105. #endif
  106. #endif /* __HDIV_REG_H__ */
  107. /**@}*/ /* HDIV_CONST */
  108. /**@}*/ /* end of HDIV register group */