| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 | 
							- /**
 
-   ******************************************************************************
 
-   * @file    py32f002b_ll_utils.h
 
-   * @author  MCU Application Team
 
-   * @brief   Header file of UTILS LL module.
 
-   @verbatim
 
-   ==============================================================================
 
-                      ##### How to use this driver #####
 
-   ==============================================================================
 
-     [..]
 
-     The LL UTILS driver contains a set of generic APIs that can be
 
-     used by user:
 
-       (+) Device electronic signature
 
-       (+) Timing functions
 
-       (+) PLL configuration functions
 
-   @endverbatim
 
-   ******************************************************************************
 
-   * @attention
 
-   *
 
-   * <h2><center>© Copyright (c) 2023 Puya Semiconductor Co.
 
-   * All rights reserved.</center></h2>
 
-   *
 
-   * This software component is licensed by Puya under BSD 3-Clause license,
 
-   * the "License"; You may not use this file except in compliance with the
 
-   * License. You may obtain a copy of the License at:
 
-   *                        opensource.org/licenses/BSD-3-Clause
 
-   *
 
-   ******************************************************************************
 
-   * @attention
 
-   *
 
-   * <h2><center>© Copyright (c) 2016 STMicroelectronics.
 
-   * All rights reserved.</center></h2>
 
-   *
 
-   * This software component is licensed by ST under BSD 3-Clause license,
 
-   * the "License"; You may not use this file except in compliance with the
 
-   * License. You may obtain a copy of the License at:
 
-   *                        opensource.org/licenses/BSD-3-Clause
 
-   *
 
-   ******************************************************************************
 
-   */
 
- /* Define to prevent recursive inclusion -------------------------------------*/
 
- #ifndef __PY32F002B_LL_UTILS_H
 
- #define __PY32F002B_LL_UTILS_H
 
- #ifdef __cplusplus
 
- extern "C" {
 
- #endif
 
- /* Includes ------------------------------------------------------------------*/
 
- #include "py32f0xx.h"
 
- /** @addtogroup PY32F002B_LL_Driver
 
-   * @{
 
-   */
 
- /** @defgroup UTILS_LL UTILS
 
-   * @{
 
-   */
 
- /* Private types -------------------------------------------------------------*/
 
- /* Private variables ---------------------------------------------------------*/
 
- /* Private constants ---------------------------------------------------------*/
 
- /** @defgroup UTILS_LL_Private_Constants UTILS Private Constants
 
-   * @{
 
-   */
 
- /* Max delay can be used in LL_mDelay */
 
- #define LL_MAX_DELAY                  0xFFFFFFFFU
 
- /**
 
-  * @brief Unique device ID register base address
 
-  */
 
- #define UID_BASE_ADDRESS              UID_BASE
 
- /**
 
-  * @brief Flash size data register base address
 
-  */
 
- #define FLASHSIZE_BASE_ADDRESS        FLASHSIZE_BASE
 
- /**
 
-   * @}
 
-   */
 
- /* Private macros ------------------------------------------------------------*/
 
- /** @defgroup UTILS_LL_Private_Macros UTILS Private Macros
 
-   * @{
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- /* Exported types ------------------------------------------------------------*/
 
- /** @defgroup UTILS_LL_ES_INIT UTILS Exported structures
 
-   * @{
 
-   */
 
- /**
 
-   * @brief  UTILS System, AHB and APB1 buses clock configuration structure definition
 
-   */
 
- typedef struct
 
- {
 
-   uint32_t AHBCLKDivider;         /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
 
-                                        This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV
 
-                                        This feature can be modified afterwards using unitary function
 
-                                        @ref LL_RCC_SetAHBPrescaler(). */
 
-   uint32_t APB1CLKDivider;         /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
 
-                                        This parameter can be a value of @ref RCC_LL_EC_APB1_DIV
 
-                                        This feature can be modified afterwards using unitary function
 
-                                        @ref LL_RCC_SetAPB1Prescaler(). */
 
- } LL_UTILS_ClkInitTypeDef;
 
- /**
 
-   * @}
 
-   */
 
- /* Exported constants --------------------------------------------------------*/
 
- /** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants
 
-   * @{
 
-   */
 
- /** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation
 
-   * @{
 
-   */
 
- #define LL_UTILS_HSEBYPASS_OFF        0x00000000U       /*!< HSE Bypass is not enabled                */
 
- #define LL_UTILS_HSEBYPASS_ON         0x00000001U       /*!< HSE Bypass is enabled                    */
 
- /**
 
-   * @}
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- /* Exported macro ------------------------------------------------------------*/
 
- /* Exported functions --------------------------------------------------------*/
 
- /** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions
 
-   * @{
 
-   */
 
- /** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE
 
-   * @{
 
-   */
 
- /**
 
-   * @brief  Get Word0 of the unique device identifier (UID based on 96 bits)
 
-   * @retval UID[31:0]
 
-   */
 
- __STATIC_INLINE uint32_t LL_GetUID_Word0(void)
 
- {
 
-   return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS)));
 
- }
 
- /**
 
-   * @brief  Get Word1 of the unique device identifier (UID based on 96 bits)
 
-   * @retval UID[63:32]
 
-   */
 
- __STATIC_INLINE uint32_t LL_GetUID_Word1(void)
 
- {
 
-   return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U))));
 
- }
 
- /**
 
-   * @brief  Get Word2 of the unique device identifier (UID based on 96 bits)
 
-   * @retval UID[95:64]
 
-   */
 
- __STATIC_INLINE uint32_t LL_GetUID_Word2(void)
 
- {
 
-   return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U))));
 
- }
 
- /**
 
-   * @brief  Get Flash memory size
 
-   * @retval Flash memory size(Bytes)
 
-   */
 
- __STATIC_INLINE uint32_t LL_GetFlashSize(void)
 
- {
 
-   return (uint32_t)(FLASH_SIZE);
 
- }
 
- /**
 
-   * @brief  Get SRAM memory size
 
-   * @retval SRAM memory size(Bytes)
 
-   */
 
- __STATIC_INLINE uint32_t LL_GetSramSize(void)
 
- {
 
-   return (uint32_t)(SRAM_END - SRAM_BASE + 1);
 
- }
 
- /**
 
-   * @}
 
-   */
 
- /** @defgroup UTILS_LL_EF_DELAY DELAY
 
-   * @{
 
-   */
 
- /**
 
-   * @brief  This function configures the Cortex-M SysTick source of the time base.
 
-   * @param  HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro)
 
-   * @note   When a RTOS is used, it is recommended to avoid changing the SysTick
 
-   *         configuration by calling this function, for a delay use rather osDelay RTOS service.
 
-   * @param  Ticks Number of ticks
 
-   * @retval None
 
-   */
 
- __STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks)
 
- {
 
-   /* Configure the SysTick to have interrupt in 1ms time base */
 
-   SysTick->LOAD  = (uint32_t)((HCLKFrequency / Ticks) - 1UL);  /* set reload register */
 
-   SysTick->VAL   = 0UL;                                       /* Load the SysTick Counter Value */
 
-   SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
 
-                    SysTick_CTRL_ENABLE_Msk;                   /* Enable the Systick Timer */
 
- }
 
- void        LL_Init1msTick(uint32_t HCLKFrequency);
 
- void        LL_mDelay(uint32_t Delay);
 
- /**
 
-   * @}
 
-   */
 
- /** @defgroup UTILS_EF_SYSTEM SYSTEM
 
-   * @{
 
-   */
 
- void        LL_SetSystemCoreClock(uint32_t HCLKFrequency);
 
- ErrorStatus LL_SetFlashLatency(uint32_t HCLKFrequency);
 
- /**
 
-   * @}
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- #ifdef __cplusplus
 
- }
 
- #endif
 
- #endif /* PY32F002B_LL_UTILS_H */
 
- /************************ (C) COPYRIGHT Puya *****END OF FILE****/
 
 
  |