system_M031Series.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**************************************************************************//**
  2. * @file system_M031Series.h
  3. * @version V3.00
  4. * $Revision: 5 $
  5. * $Date: 18/05/29 5:31p $
  6. * @brief M031 Series System Setting Header File
  7. *
  8. * @note
  9. * SPDX-License-Identifier: Apache-2.0
  10. * Copyright (C) 2017 Nuvoton Technology Corp. All rights reserved.
  11. ******************************************************************************/
  12. #ifndef __SYSTEM_M031_H__
  13. #define __SYSTEM_M031_H__
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*---------------------------------------------------------------------------------------------------------*/
  18. /* Macro Definition */
  19. /*---------------------------------------------------------------------------------------------------------*/
  20. #ifndef DEBUG_PORT
  21. #define DEBUG_PORT UART0 /*!< Select Debug Port which is used for retarget.c to output debug message to UART */
  22. #endif
  23. /**
  24. *
  25. * @details This is used to enable PLL to speed up booting at startup. Remove it will cause system using
  26. * default clock source (External crystal or internal 22.1184MHz IRC).
  27. * Enable this option will cause system booting in 72MHz(By XTAL) or 71.8848MHz(By IRC22M) according to
  28. * user configuration setting in CONFIG0
  29. *
  30. */
  31. /*----------------------------------------------------------------------------
  32. Define SYSCLK
  33. *----------------------------------------------------------------------------*/
  34. #ifndef __HXT
  35. #define __HXT (32000000UL) /*!< External Crystal Clock Frequency */
  36. #endif /*!defined(__HXT) */
  37. #ifndef __LXT
  38. #define __LXT (32768UL) /*!< External Crystal Clock Frequency 32.768KHz */
  39. #endif /*!defined(__LXT) */
  40. #define __LIRC (38400UL) /*!< Internal 38.4KHz RC Oscillator Frequency */
  41. #define __HIRC (48000000UL) /*!< Internal 48M RC Oscillator Frequency */
  42. #define __HSI (96000000UL) /*!< PLL default output is 96MHz from HIRC */
  43. extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
  44. extern uint32_t CyclesPerUs; /*!< Cycles per micro second */
  45. extern uint32_t PllClock; /*!< PLL Output Clock Frequency */
  46. #if USE_ASSERT
  47. /**
  48. * @brief Assert Function
  49. *
  50. * @param[in] expr Expression to be evaluated
  51. *
  52. * @return None
  53. *
  54. * @details If the expression is false, an error message will be printed out
  55. * from debug port (UART0 or UART1).
  56. */
  57. #define ASSERT_PARAM(expr) { if (!(expr)) { AssertError((uint8_t*)__FILE__, __LINE__); } }
  58. void AssertError(uint8_t* file, uint32_t line);
  59. #else
  60. #define ASSERT_PARAM(expr)
  61. #endif
  62. #define assert_param(expr) ASSERT_PARAM(expr)
  63. /**
  64. * @brief System Initialization
  65. *
  66. * @param None
  67. *
  68. * @return None
  69. *
  70. * @details The necessary initialization of system.
  71. */
  72. extern void SystemInit(void);
  73. /**
  74. * @brief Update the Variable SystemCoreClock
  75. *
  76. * @param None
  77. *
  78. * @return None
  79. *
  80. * @details This function is used to update the variable SystemCoreClock
  81. * and must be called whenever the core clock is changed.
  82. */
  83. extern void SystemCoreClockUpdate(void);
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif
  88. /* Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved. */