hc32_ll_utility.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll_utility.h
  4. * @brief This file contains all the functions prototypes of the DDL utility.
  5. @verbatim
  6. Change Logs:
  7. Date Author Notes
  8. 2022-12-31 CDT First version
  9. @endverbatim
  10. *******************************************************************************
  11. * Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  12. *
  13. * This software component is licensed by XHSC under BSD 3-Clause license
  14. * (the "License"); You may not use this file except in compliance with the
  15. * License. You may obtain a copy of the License at:
  16. * opensource.org/licenses/BSD-3-Clause
  17. *
  18. *******************************************************************************
  19. */
  20. #ifndef __HC32_LL_UTILITY_H__
  21. #define __HC32_LL_UTILITY_H__
  22. /* C binding of definitions if building with C++ compiler */
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. /*******************************************************************************
  28. * Include files
  29. ******************************************************************************/
  30. #include "hc32_ll_def.h"
  31. #include "hc32f4xx.h"
  32. #include "hc32f4xx_conf.h"
  33. /**
  34. * @addtogroup LL_Driver
  35. * @{
  36. */
  37. /**
  38. * @addtogroup LL_UTILITY
  39. * @{
  40. */
  41. #if (LL_UTILITY_ENABLE == DDL_ON)
  42. /*******************************************************************************
  43. * Global type definitions ('typedef')
  44. ******************************************************************************/
  45. /*******************************************************************************
  46. * Global pre-processor symbols/macros ('#define')
  47. ******************************************************************************/
  48. /*******************************************************************************
  49. * Global variable definitions ('extern')
  50. ******************************************************************************/
  51. /*******************************************************************************
  52. * Global function prototypes (definition in C source)
  53. ******************************************************************************/
  54. /**
  55. * @addtogroup UTILITY_Global_Functions
  56. * @{
  57. */
  58. /* Imprecise delay */
  59. void DDL_DelayMS(uint32_t u32Count);
  60. void DDL_DelayUS(uint32_t u32Count);
  61. /* Systick functions */
  62. int32_t SysTick_Init(uint32_t u32Freq);
  63. void SysTick_Delay(uint32_t u32Delay);
  64. void SysTick_IncTick(void);
  65. uint32_t SysTick_GetTick(void);
  66. void SysTick_Suspend(void);
  67. void SysTick_Resume(void);
  68. #if (LL_PRINT_ENABLE == DDL_ON)
  69. int32_t LL_PrintfInit(void *vpDevice, uint32_t u32Param, int32_t (*pfnPreinit)(void *vpDevice, uint32_t u32Param));
  70. #endif
  71. /* You can add your own assert functions by implement the function DDL_AssertHandler
  72. definition follow the function DDL_AssertHandler declaration */
  73. #ifdef __DEBUG
  74. #define DDL_ASSERT(x) \
  75. do { \
  76. ((x) ? (void)0 : DDL_AssertHandler(__FILE__, __LINE__)); \
  77. } while (0)
  78. /* Exported function */
  79. void DDL_AssertHandler(const char *file, int line);
  80. #else
  81. #define DDL_ASSERT(x) ((void)0U)
  82. #endif /* __DEBUG */
  83. #if (LL_PRINT_ENABLE == DDL_ON)
  84. #include <stdio.h>
  85. __WEAKDEF int32_t DDL_ConsoleOutputChar(char cData);
  86. #define DDL_PrintfInit (void)LL_PrintfInit
  87. #define DDL_Printf (void)printf
  88. #else
  89. #define DDL_PrintfInit(vpDevice, u32Param, pfnPreinit)
  90. #define DDL_Printf(...)
  91. #endif
  92. /**
  93. * @}
  94. */
  95. #endif /* LL_UTILITY_ENABLE */
  96. /**
  97. * @}
  98. */
  99. /**
  100. * @}
  101. */
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105. #endif /* __HC32_LL_UTILITY_H__ */
  106. /*******************************************************************************
  107. * EOF (not truncated)
  108. ******************************************************************************/