generated from Template/H563ZI-HAL-CMake-Template
添加Ble,以及修改了H5的一些基础配置
This commit is contained in:
@@ -1,300 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h5xx_hal_icache.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of ICACHE HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion ------------------------------------*/
|
||||
#ifndef STM32H5xx_HAL_ICACHE_H
|
||||
#define STM32H5xx_HAL_ICACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes -----------------------------------------------------------------*/
|
||||
#include "stm32h5xx_hal_def.h"
|
||||
|
||||
#if defined(ICACHE)
|
||||
/** @addtogroup STM32H5xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ICACHE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types -----------------------------------------------------------*/
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_Exported_Types ICACHE Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief HAL ICACHE region configuration structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t BaseAddress; /*!< Configures the Base address of Region i to be remapped */
|
||||
|
||||
uint32_t RemapAddress; /*!< Configures the Remap address of Region i to be remapped */
|
||||
|
||||
uint32_t Size; /*!< Configures the Region size.
|
||||
This parameter can be a value of @ref ICACHE_Region_Size */
|
||||
|
||||
uint32_t TrafficRoute; /*!< Selects the traffic route.
|
||||
This parameter can be a value of @ref ICACHE_Traffic_Route */
|
||||
|
||||
uint32_t OutputBurstType; /*!< Selects the output burst type.
|
||||
This parameter can be a value of @ref ICACHE_Output_Burst_Type */
|
||||
} ICACHE_RegionConfigTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/* Exported constants -------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_Exported_Constants ICACHE Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_WaysSelection Ways selection
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_1WAY 0U /*!< 1-way cache (direct mapped cache) */
|
||||
#define ICACHE_2WAYS ICACHE_CR_WAYSEL /*!< 2-ways set associative cache (default) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Monitor_Type Monitor type
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_MONITOR_HIT_MISS (ICACHE_CR_HITMEN | ICACHE_CR_MISSMEN) /*!< Hit & Miss monitoring */
|
||||
#define ICACHE_MONITOR_HIT ICACHE_CR_HITMEN /*!< Hit monitoring */
|
||||
#define ICACHE_MONITOR_MISS ICACHE_CR_MISSMEN /*!< Miss monitoring */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_Region Remapped Region number
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_REGION_0 0U /*!< Region 0 */
|
||||
#define ICACHE_REGION_1 1U /*!< Region 1 */
|
||||
#define ICACHE_REGION_2 2U /*!< Region 2 */
|
||||
#define ICACHE_REGION_3 3U /*!< Region 3 */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Region_Size Remapped Region size
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_REGIONSIZE_2MB 1U /*!< Region size 2MB */
|
||||
#define ICACHE_REGIONSIZE_4MB 2U /*!< Region size 4MB */
|
||||
#define ICACHE_REGIONSIZE_8MB 3U /*!< Region size 8MB */
|
||||
#define ICACHE_REGIONSIZE_16MB 4U /*!< Region size 16MB */
|
||||
#define ICACHE_REGIONSIZE_32MB 5U /*!< Region size 32MB */
|
||||
#define ICACHE_REGIONSIZE_64MB 6U /*!< Region size 64MB */
|
||||
#define ICACHE_REGIONSIZE_128MB 7U /*!< Region size 128MB */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Traffic_Route Remapped Traffic route
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_MASTER1_PORT 0U /*!< Master1 port */
|
||||
#define ICACHE_MASTER2_PORT ICACHE_CRRx_MSTSEL /*!< Master2 port */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Output_Burst_Type Remapped Output burst type
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_OUTPUT_BURST_WRAP 0U /*!< WRAP */
|
||||
#define ICACHE_OUTPUT_BURST_INCR ICACHE_CRRx_HBURST /*!< INCR */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/** @defgroup ICACHE_Interrupts Interrupts
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_IT_BUSYEND ICACHE_IER_BSYENDIE /*!< Busy end interrupt */
|
||||
#define ICACHE_IT_ERROR ICACHE_IER_ERRIE /*!< Cache error interrupt */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Flags Flags
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_FLAG_BUSY ICACHE_SR_BUSYF /*!< Busy flag */
|
||||
#define ICACHE_FLAG_BUSYEND ICACHE_SR_BSYENDF /*!< Busy end flag */
|
||||
#define ICACHE_FLAG_ERROR ICACHE_SR_ERRF /*!< Cache error flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros ----------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_Exported_Macros ICACHE Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Flags_Interrupts_Management Flags and Interrupts Management
|
||||
* @brief macros to manage the specified ICACHE flags and interrupts.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Enable ICACHE interrupts.
|
||||
* @param __INTERRUPT__ specifies the ICACHE interrupt sources to be enabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg @ref ICACHE_IT_BUSYEND Busy end interrupt
|
||||
* @arg @ref ICACHE_IT_ERROR Cache error interrupt
|
||||
*/
|
||||
#define __HAL_ICACHE_ENABLE_IT(__INTERRUPT__) SET_BIT(ICACHE->IER, (__INTERRUPT__))
|
||||
|
||||
/** @brief Disable ICACHE interrupts.
|
||||
* @param __INTERRUPT__ specifies the ICACHE interrupt sources to be disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg @ref ICACHE_IT_BUSYEND Busy end interrupt
|
||||
* @arg @ref ICACHE_IT_ERROR Cache error interrupt
|
||||
*/
|
||||
#define __HAL_ICACHE_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(ICACHE->IER, (__INTERRUPT__))
|
||||
|
||||
/** @brief Check whether the specified ICACHE interrupt source is enabled or not.
|
||||
* @param __INTERRUPT__ specifies the ICACHE interrupt source to check.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg @ref ICACHE_IT_BUSYEND Busy end interrupt
|
||||
* @arg @ref ICACHE_IT_ERROR Cache error interrupt
|
||||
* @retval The state of __INTERRUPT__ (0 or 1).
|
||||
*/
|
||||
#define __HAL_ICACHE_GET_IT_SOURCE(__INTERRUPT__) \
|
||||
((READ_BIT(ICACHE->IER, (__INTERRUPT__)) == (__INTERRUPT__)) ? 1U : 0U)
|
||||
|
||||
/** @brief Check whether the selected ICACHE flag is set or not.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg @ref ICACHE_FLAG_BUSY Busy flag
|
||||
* @arg @ref ICACHE_FLAG_BUSYEND Busy end flag
|
||||
* @arg @ref ICACHE_FLAG_ERROR Cache error flag
|
||||
* @retval The state of __FLAG__ (0 or 1).
|
||||
*/
|
||||
#define __HAL_ICACHE_GET_FLAG(__FLAG__) ((READ_BIT(ICACHE->SR, (__FLAG__)) != 0U) ? 1U : 0U)
|
||||
|
||||
/** @brief Clear the selected ICACHE flags.
|
||||
* @param __FLAG__ specifies the ICACHE flags to clear.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg @ref ICACHE_FLAG_BUSYEND Busy end flag
|
||||
* @arg @ref ICACHE_FLAG_ERROR Cache error flag
|
||||
*/
|
||||
#define __HAL_ICACHE_CLEAR_FLAG(__FLAG__) WRITE_REG(ICACHE->FCR, (__FLAG__))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions -------------------------------------------------------*/
|
||||
/** @addtogroup ICACHE_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup ICACHE_Exported_Functions_Group1
|
||||
* @brief Initialization and control functions
|
||||
* @{
|
||||
*/
|
||||
/* Peripheral Control functions **********************************************/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Enable(void);
|
||||
HAL_StatusTypeDef HAL_ICACHE_Disable(void);
|
||||
uint32_t HAL_ICACHE_IsEnabled(void);
|
||||
HAL_StatusTypeDef HAL_ICACHE_ConfigAssociativityMode(uint32_t AssociativityMode);
|
||||
HAL_StatusTypeDef HAL_ICACHE_DeInit(void);
|
||||
|
||||
/******* Invalidate in blocking mode (Polling) */
|
||||
HAL_StatusTypeDef HAL_ICACHE_Invalidate(void);
|
||||
/******* Invalidate in non-blocking mode (Interrupt) */
|
||||
HAL_StatusTypeDef HAL_ICACHE_Invalidate_IT(void);
|
||||
/******* Wait for Invalidate complete in blocking mode (Polling) */
|
||||
HAL_StatusTypeDef HAL_ICACHE_WaitForInvalidateComplete(void);
|
||||
|
||||
/******* Performance instruction cache monitoring functions */
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Start(uint32_t MonitorType);
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Stop(uint32_t MonitorType);
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Reset(uint32_t MonitorType);
|
||||
uint32_t HAL_ICACHE_Monitor_GetHitValue(void);
|
||||
uint32_t HAL_ICACHE_Monitor_GetMissValue(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup ICACHE_Exported_Functions_Group2
|
||||
* @brief IRQ and callback functions
|
||||
* @{
|
||||
*/
|
||||
/******* IRQHandler and Callbacks used in non-blocking mode (Interrupt) */
|
||||
void HAL_ICACHE_IRQHandler(void);
|
||||
void HAL_ICACHE_InvalidateCompleteCallback(void);
|
||||
void HAL_ICACHE_ErrorCallback(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @addtogroup ICACHE_Exported_Functions_Group3
|
||||
* @brief Memory remapped regions functions
|
||||
* @{
|
||||
*/
|
||||
/******* Memory remapped regions functions */
|
||||
HAL_StatusTypeDef HAL_ICACHE_EnableRemapRegion(uint32_t Region, const ICACHE_RegionConfigTypeDef *const pRegionConfig);
|
||||
HAL_StatusTypeDef HAL_ICACHE_DisableRemapRegion(uint32_t Region);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32H5xx_HAL_ICACHE_H */
|
||||
1775
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_uart.h
Normal file
1775
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_uart.h
Normal file
File diff suppressed because it is too large
Load Diff
437
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_uart_ex.h
Normal file
437
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_hal_uart_ex.h
Normal file
@@ -0,0 +1,437 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h5xx_hal_uart_ex.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of UART HAL Extended module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H5xx_HAL_UART_EX_H
|
||||
#define STM32H5xx_HAL_UART_EX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h5xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32H5xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup UARTEx
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup UARTEx_Exported_Types UARTEx Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief UART wake up from stop mode parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t WakeUpEvent; /*!< Specifies which event will activate the Wakeup from Stop mode flag (WUF).
|
||||
This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection.
|
||||
If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must
|
||||
be filled up. */
|
||||
|
||||
uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long.
|
||||
This parameter can be a value of @ref UARTEx_WakeUp_Address_Length. */
|
||||
|
||||
uint8_t Address; /*!< UART/USART node address (7-bit long max). */
|
||||
} UART_WakeUpTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup UARTEx_Exported_Constants UARTEx Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_Word_Length UARTEx Word Length
|
||||
* @{
|
||||
*/
|
||||
#define UART_WORDLENGTH_7B USART_CR1_M1 /*!< 7-bit long UART frame */
|
||||
#define UART_WORDLENGTH_8B 0x00000000U /*!< 8-bit long UART frame */
|
||||
#define UART_WORDLENGTH_9B USART_CR1_M0 /*!< 9-bit long UART frame */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_WakeUp_Address_Length UARTEx WakeUp Address Length
|
||||
* @{
|
||||
*/
|
||||
#define UART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit long wake-up address */
|
||||
#define UART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit long wake-up address */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_FIFO_mode UARTEx FIFO mode
|
||||
* @brief UART FIFO mode
|
||||
* @{
|
||||
*/
|
||||
#define UART_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */
|
||||
#define UART_FIFOMODE_ENABLE USART_CR1_FIFOEN /*!< FIFO mode enable */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_TXFIFO_threshold_level UARTEx TXFIFO threshold level
|
||||
* @brief UART TXFIFO threshold level
|
||||
* @{
|
||||
*/
|
||||
#define UART_TXFIFO_THRESHOLD_1_8 0x00000000U /*!< TX FIFO reaches 1/8 of its depth */
|
||||
#define UART_TXFIFO_THRESHOLD_1_4 USART_CR3_TXFTCFG_0 /*!< TX FIFO reaches 1/4 of its depth */
|
||||
#define UART_TXFIFO_THRESHOLD_1_2 USART_CR3_TXFTCFG_1 /*!< TX FIFO reaches 1/2 of its depth */
|
||||
#define UART_TXFIFO_THRESHOLD_3_4 (USART_CR3_TXFTCFG_0|USART_CR3_TXFTCFG_1) /*!< TX FIFO reaches 3/4 of its depth */
|
||||
#define UART_TXFIFO_THRESHOLD_7_8 USART_CR3_TXFTCFG_2 /*!< TX FIFO reaches 7/8 of its depth */
|
||||
#define UART_TXFIFO_THRESHOLD_8_8 (USART_CR3_TXFTCFG_2|USART_CR3_TXFTCFG_0) /*!< TX FIFO becomes empty */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_RXFIFO_threshold_level UARTEx RXFIFO threshold level
|
||||
* @brief UART RXFIFO threshold level
|
||||
* @{
|
||||
*/
|
||||
#define UART_RXFIFO_THRESHOLD_1_8 0x00000000U /*!< RX FIFO reaches 1/8 of its depth */
|
||||
#define UART_RXFIFO_THRESHOLD_1_4 USART_CR3_RXFTCFG_0 /*!< RX FIFO reaches 1/4 of its depth */
|
||||
#define UART_RXFIFO_THRESHOLD_1_2 USART_CR3_RXFTCFG_1 /*!< RX FIFO reaches 1/2 of its depth */
|
||||
#define UART_RXFIFO_THRESHOLD_3_4 (USART_CR3_RXFTCFG_0|USART_CR3_RXFTCFG_1) /*!< RX FIFO reaches 3/4 of its depth */
|
||||
#define UART_RXFIFO_THRESHOLD_7_8 USART_CR3_RXFTCFG_2 /*!< RX FIFO reaches 7/8 of its depth */
|
||||
#define UART_RXFIFO_THRESHOLD_8_8 (USART_CR3_RXFTCFG_2|USART_CR3_RXFTCFG_0) /*!< RX FIFO becomes full */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup UARTEx_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup UARTEx_Exported_Functions_Group1
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Initialization and de-initialization functions ****************************/
|
||||
HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, uint32_t AssertionTime,
|
||||
uint32_t DeassertionTime);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup UARTEx_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
|
||||
void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart);
|
||||
|
||||
void HAL_UARTEx_RxFifoFullCallback(UART_HandleTypeDef *huart);
|
||||
void HAL_UARTEx_TxFifoEmptyCallback(UART_HandleTypeDef *huart);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup UARTEx_Exported_Functions_Group3
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Peripheral Control functions **********************************************/
|
||||
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
|
||||
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart);
|
||||
|
||||
HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength);
|
||||
|
||||
HAL_StatusTypeDef HAL_UARTEx_EnableFifoMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_UARTEx_DisableFifoMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_UARTEx_SetTxFifoThreshold(UART_HandleTypeDef *huart, uint32_t Threshold);
|
||||
HAL_StatusTypeDef HAL_UARTEx_SetRxFifoThreshold(UART_HandleTypeDef *huart, uint32_t Threshold);
|
||||
|
||||
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint16_t *RxLen,
|
||||
uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
||||
#if defined(HAL_DMA_MODULE_ENABLED)
|
||||
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
HAL_UART_RxEventTypeTypeDef HAL_UARTEx_GetRxEventType(const UART_HandleTypeDef *huart);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/** @defgroup UARTEx_Private_Macros UARTEx Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Report the UART clock source.
|
||||
* @param __HANDLE__ specifies the UART Handle.
|
||||
* @param __CLOCKSOURCE__ output variable.
|
||||
* @retval UART clocking source, written in __CLOCKSOURCE__.
|
||||
*/
|
||||
#if (defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx))
|
||||
#define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
if((__HANDLE__)->Instance == USART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART2) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART2; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART3) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART3; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART4) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART4; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART5) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART5; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART6) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART6; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART7) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART7; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART8) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART8; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART9) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART9; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART10) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART10; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART11) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART11; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART12) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART12; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == LPUART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_LPUART1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = 0U; \
|
||||
} \
|
||||
} while(0U)
|
||||
#elif (defined(STM32H523xx) || defined(STM32H533xx))
|
||||
#define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
if((__HANDLE__)->Instance == USART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART2) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART2; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART3) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART3; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART4) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART4; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == UART5) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_UART5; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART6) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART6; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == LPUART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_LPUART1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = 0U; \
|
||||
} \
|
||||
} while(0U)
|
||||
#else
|
||||
#define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
if((__HANDLE__)->Instance == USART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART2) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART2; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART3) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_USART3; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == LPUART1) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = (uint32_t)RCC_PERIPHCLK_LPUART1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = 0U; \
|
||||
} \
|
||||
} while(0U)
|
||||
#endif /* (defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) */
|
||||
|
||||
|
||||
/** @brief Report the UART mask to apply to retrieve the received data
|
||||
* according to the word length and to the parity bits activation.
|
||||
* @note If PCE = 1, the parity bit is not included in the data extracted
|
||||
* by the reception API().
|
||||
* This masking operation is not carried out in the case of
|
||||
* DMA transfers.
|
||||
* @param __HANDLE__ specifies the UART Handle.
|
||||
* @retval None, the mask to apply to UART RDR register is stored in (__HANDLE__)->Mask field.
|
||||
*/
|
||||
#define UART_MASK_COMPUTATION(__HANDLE__) \
|
||||
do { \
|
||||
if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
|
||||
{ \
|
||||
if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x01FFU ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x00FFU ; \
|
||||
} \
|
||||
} \
|
||||
else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \
|
||||
{ \
|
||||
if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x00FFU ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x007FU ; \
|
||||
} \
|
||||
} \
|
||||
else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \
|
||||
{ \
|
||||
if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x007FU ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x003FU ; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__HANDLE__)->Mask = 0x0000U; \
|
||||
} \
|
||||
} while(0U)
|
||||
|
||||
/**
|
||||
* @brief Ensure that UART frame length is valid.
|
||||
* @param __LENGTH__ UART frame length.
|
||||
* @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
|
||||
*/
|
||||
#define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_7B) || \
|
||||
((__LENGTH__) == UART_WORDLENGTH_8B) || \
|
||||
((__LENGTH__) == UART_WORDLENGTH_9B))
|
||||
|
||||
/**
|
||||
* @brief Ensure that UART wake-up address length is valid.
|
||||
* @param __ADDRESS__ UART wake-up address length.
|
||||
* @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
|
||||
*/
|
||||
#define IS_UART_ADDRESSLENGTH_DETECT(__ADDRESS__) (((__ADDRESS__) == UART_ADDRESS_DETECT_4B) || \
|
||||
((__ADDRESS__) == UART_ADDRESS_DETECT_7B))
|
||||
|
||||
/**
|
||||
* @brief Ensure that UART TXFIFO threshold level is valid.
|
||||
* @param __THRESHOLD__ UART TXFIFO threshold level.
|
||||
* @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid)
|
||||
*/
|
||||
#define IS_UART_TXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_8) || \
|
||||
((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_4) || \
|
||||
((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_2) || \
|
||||
((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_3_4) || \
|
||||
((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_7_8) || \
|
||||
((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_8_8))
|
||||
|
||||
/**
|
||||
* @brief Ensure that UART RXFIFO threshold level is valid.
|
||||
* @param __THRESHOLD__ UART RXFIFO threshold level.
|
||||
* @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid)
|
||||
*/
|
||||
#define IS_UART_RXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_8) || \
|
||||
((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_4) || \
|
||||
((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_2) || \
|
||||
((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_3_4) || \
|
||||
((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_7_8) || \
|
||||
((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_8_8))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32H5xx_HAL_UART_EX_H */
|
||||
|
||||
@@ -1,788 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h5xx_ll_icache.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of ICACHE LL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion ------------------------------------*/
|
||||
#ifndef STM32H5xx_LL_ICACHE_H
|
||||
#define STM32H5xx_LL_ICACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes -----------------------------------------------------------------*/
|
||||
#include "stm32h5xx.h"
|
||||
|
||||
/** @addtogroup STM32H5xx_LL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(ICACHE)
|
||||
|
||||
/** @defgroup ICACHE_LL ICACHE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_LL_REGION_CONFIG ICACHE Exported Configuration structure
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LL ICACHE region configuration structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t BaseAddress; /*!< Configures the C-AHB base address to be remapped */
|
||||
|
||||
uint32_t RemapAddress; /*!< Configures the remap address to be remapped */
|
||||
|
||||
uint32_t Size; /*!< Configures the region size.
|
||||
This parameter can be a value of @ref ICACHE_LL_EC_Region_Size */
|
||||
|
||||
uint32_t TrafficRoute; /*!< Selects the traffic route.
|
||||
This parameter can be a value of @ref ICACHE_LL_EC_Traffic_Route */
|
||||
|
||||
uint32_t OutputBurstType; /*!< Selects the output burst type.
|
||||
This parameter can be a value of @ref ICACHE_LL_EC_Output_Burst_Type */
|
||||
} LL_ICACHE_RegionTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/* Exported constants -------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_LL_Exported_Constants ICACHE Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_WaysSelection Ways selection
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_1WAY 0U /*!< 1-way cache (direct mapped cache) */
|
||||
#define LL_ICACHE_2WAYS ICACHE_CR_WAYSEL /*!< 2-ways set associative cache (default) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_Monitor_Type Monitor type
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_MONITOR_HIT ICACHE_CR_HITMEN /*!< Hit monitor counter */
|
||||
#define LL_ICACHE_MONITOR_MISS ICACHE_CR_MISSMEN /*!< Miss monitor counter */
|
||||
#define LL_ICACHE_MONITOR_ALL (ICACHE_CR_HITMEN | ICACHE_CR_MISSMEN) /*!< All monitors counters */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_GET_FLAG Get Flags Defines
|
||||
* @brief Flags defines which can be used with LL_ICACHE_ReadReg function
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_SR_BUSYF ICACHE_SR_BUSYF /*!< Busy flag */
|
||||
#define LL_ICACHE_SR_BSYENDF ICACHE_SR_BSYENDF /*!< Busy end flag */
|
||||
#define LL_ICACHE_SR_ERRF ICACHE_SR_ERRF /*!< Cache error flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_CLEAR_FLAG Clear Flags Defines
|
||||
* @brief Flags defines which can be used with LL_ICACHE_WriteReg function
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_FCR_CBSYENDF ICACHE_FCR_CBSYENDF /*!< Busy end flag */
|
||||
#define LL_ICACHE_FCR_CERRF ICACHE_FCR_CERRF /*!< Cache error flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_IT IT Defines
|
||||
* @brief IT defines which can be used with LL_ICACHE_ReadReg and LL_ICACHE_WriteReg functions
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_IER_BSYENDIE ICACHE_IER_BSYENDIE /*!< Busy end interrupt */
|
||||
#define LL_ICACHE_IER_ERRIE ICACHE_IER_ERRIE /*!< Cache error interrupt */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_LL_EC_Region Remapped Region number
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_REGION_0 0U /*!< Region 0 */
|
||||
#define LL_ICACHE_REGION_1 1U /*!< Region 1 */
|
||||
#define LL_ICACHE_REGION_2 2U /*!< Region 2 */
|
||||
#define LL_ICACHE_REGION_3 3U /*!< Region 3 */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_Region_Size Remapped Region size
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_REGIONSIZE_2MB 1U /*!< Region size 2MB */
|
||||
#define LL_ICACHE_REGIONSIZE_4MB 2U /*!< Region size 4MB */
|
||||
#define LL_ICACHE_REGIONSIZE_8MB 3U /*!< Region size 8MB */
|
||||
#define LL_ICACHE_REGIONSIZE_16MB 4U /*!< Region size 16MB */
|
||||
#define LL_ICACHE_REGIONSIZE_32MB 5U /*!< Region size 32MB */
|
||||
#define LL_ICACHE_REGIONSIZE_64MB 6U /*!< Region size 64MB */
|
||||
#define LL_ICACHE_REGIONSIZE_128MB 7U /*!< Region size 128MB */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_Traffic_Route Remapped Traffic route
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_MASTER1_PORT 0U /*!< Master1 port */
|
||||
#define LL_ICACHE_MASTER2_PORT ICACHE_CRRx_MSTSEL /*!< Master2 port */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EC_Output_Burst_Type Remapped Output burst type
|
||||
* @{
|
||||
*/
|
||||
#define LL_ICACHE_OUTPUT_BURST_WRAP 0U /*!< WRAP */
|
||||
#define LL_ICACHE_OUTPUT_BURST_INCR ICACHE_CRRx_HBURST /*!< INCR */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros ----------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_LL_Exported_Macros ICACHE Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EM_WRITE_READ Common write and read registers Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Write a value in ICACHE register
|
||||
* @param __REG__ Register to be written
|
||||
* @param __VALUE__ Value to be written in the register
|
||||
* @retval None
|
||||
*/
|
||||
#define LL_ICACHE_WriteReg(__REG__, __VALUE__) WRITE_REG(ICACHE->__REG__, (__VALUE__))
|
||||
|
||||
/**
|
||||
* @brief Read a value in ICACHE register
|
||||
* @param __REG__ Register to be read
|
||||
* @retval Register value
|
||||
*/
|
||||
#define LL_ICACHE_ReadReg(__REG__) READ_REG(ICACHE->__REG__)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_LL_Exported_Functions ICACHE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EF_Configuration Configuration
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable the ICACHE.
|
||||
* @rmtoll CR EN LL_ICACHE_Enable
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_Enable(void)
|
||||
{
|
||||
SET_BIT(ICACHE->CR, ICACHE_CR_EN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the ICACHE.
|
||||
* @rmtoll CR EN LL_ICACHE_Disable
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_Disable(void)
|
||||
{
|
||||
CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if ICACHE is enabled or not.
|
||||
* @rmtoll CR EN LL_ICACHE_IsEnabled
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsEnabled(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->CR, ICACHE_CR_EN) == (ICACHE_CR_EN)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the ICACHE operating mode.
|
||||
* @rmtoll CR WAYSEL LL_ICACHE_SetMode
|
||||
* @param Mode This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_1WAY
|
||||
* @arg @ref LL_ICACHE_2WAYS
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetMode(uint32_t Mode)
|
||||
{
|
||||
MODIFY_REG(ICACHE->CR, ICACHE_CR_WAYSEL, Mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the selected ICACHE operating mode.
|
||||
* @rmtoll CR WAYSEL LL_ICACHE_GetMode
|
||||
* @retval Returned value can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_1WAY
|
||||
* @arg @ref LL_ICACHE_2WAYS
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetMode(void)
|
||||
{
|
||||
return (READ_BIT(ICACHE->CR, ICACHE_CR_WAYSEL));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invalidate the ICACHE.
|
||||
* @note Until the BSYEND flag is set, the cache is bypassed.
|
||||
* @rmtoll CR CACHEINV LL_ICACHE_Invalidate
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_Invalidate(void)
|
||||
{
|
||||
SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EF_Monitors Monitors
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable the hit/miss monitor(s).
|
||||
* @rmtoll CR HITMEN LL_ICACHE_EnableMonitors
|
||||
* @rmtoll CR MISSMEN LL_ICACHE_EnableMonitors
|
||||
* @param Monitors This parameter can be one or a combination of the following values:
|
||||
* @arg @ref LL_ICACHE_MONITOR_HIT
|
||||
* @arg @ref LL_ICACHE_MONITOR_MISS
|
||||
* @arg @ref LL_ICACHE_MONITOR_ALL
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_EnableMonitors(uint32_t Monitors)
|
||||
{
|
||||
SET_BIT(ICACHE->CR, Monitors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the hit/miss monitor(s).
|
||||
* @rmtoll CR HITMEN LL_ICACHE_DisableMonitors
|
||||
* @rmtoll CR MISSMEN LL_ICACHE_DisableMonitors
|
||||
* @param Monitors This parameter can be one or a combination of the following values:
|
||||
* @arg @ref LL_ICACHE_MONITOR_HIT
|
||||
* @arg @ref LL_ICACHE_MONITOR_MISS
|
||||
* @arg @ref LL_ICACHE_MONITOR_ALL
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_DisableMonitors(uint32_t Monitors)
|
||||
{
|
||||
CLEAR_BIT(ICACHE->CR, Monitors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the monitor(s) is(are) enabled or disabled.
|
||||
* @rmtoll CR HITMEN LL_ICACHE_IsEnabledMonitors
|
||||
* @rmtoll CR MISSMEN LL_ICACHE_IsEnabledMonitors
|
||||
* @param Monitors This parameter can be one or a combination of the following values:
|
||||
* @arg @ref LL_ICACHE_MONITOR_HIT
|
||||
* @arg @ref LL_ICACHE_MONITOR_MISS
|
||||
* @arg @ref LL_ICACHE_MONITOR_ALL
|
||||
* @retval State of parameter value (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsEnabledMonitors(uint32_t Monitors)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->CR, Monitors) == (Monitors)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the hit/miss monitor(s).
|
||||
* @rmtoll CR HITMRST LL_ICACHE_ResetMonitors
|
||||
* @rmtoll CR MISSMRST LL_ICACHE_ResetMonitors
|
||||
* @param Monitors This parameter can be one or a combination of the following values:
|
||||
* @arg @ref LL_ICACHE_MONITOR_HIT
|
||||
* @arg @ref LL_ICACHE_MONITOR_MISS
|
||||
* @arg @ref LL_ICACHE_MONITOR_ALL
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_ResetMonitors(uint32_t Monitors)
|
||||
{
|
||||
/* Reset */
|
||||
SET_BIT(ICACHE->CR, (Monitors << 2U));
|
||||
/* Release reset */
|
||||
CLEAR_BIT(ICACHE->CR, (Monitors << 2U));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Hit monitor.
|
||||
* @note Upon reaching the 32-bit maximum value, hit monitor does not wrap.
|
||||
* @rmtoll HMONR HITMON LL_ICACHE_GetHitMonitor
|
||||
* @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetHitMonitor(void)
|
||||
{
|
||||
return (ICACHE->HMONR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Miss monitor.
|
||||
* @note Upon reaching the 16-bit maximum value, miss monitor does not wrap.
|
||||
* @rmtoll MMONR MISSMON LL_ICACHE_GetMissMonitor
|
||||
* @retval Value between Min_Data=0 and Max_Data=0xFFFF
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetMissMonitor(void)
|
||||
{
|
||||
return (ICACHE->MMONR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EF_IT_Management IT_Management
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable BSYEND interrupt.
|
||||
* @rmtoll IER BSYENDIE LL_ICACHE_EnableIT_BSYEND
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_EnableIT_BSYEND(void)
|
||||
{
|
||||
SET_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable BSYEND interrupt.
|
||||
* @rmtoll IER BSYENDIE LL_ICACHE_DisableIT_BSYEND
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_DisableIT_BSYEND(void)
|
||||
{
|
||||
CLEAR_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the BSYEND Interrupt is enabled or disabled.
|
||||
* @rmtoll IER BSYENDIE LL_ICACHE_IsEnabledIT_BSYEND
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsEnabledIT_BSYEND(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE) == (ICACHE_IER_BSYENDIE)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable ERR interrupt.
|
||||
* @rmtoll IER ERRIE LL_ICACHE_EnableIT_ERR
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_EnableIT_ERR(void)
|
||||
{
|
||||
SET_BIT(ICACHE->IER, ICACHE_IER_ERRIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable ERR interrupt.
|
||||
* @rmtoll IER ERRIE LL_ICACHE_DisableIT_ERR
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_DisableIT_ERR(void)
|
||||
{
|
||||
CLEAR_BIT(ICACHE->IER, ICACHE_IER_ERRIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the ERR Interrupt is enabled or disabled.
|
||||
* @rmtoll IER ERRIE LL_ICACHE_IsEnabledIT_ERR
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsEnabledIT_ERR(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->IER, ICACHE_IER_ERRIE) == (ICACHE_IER_ERRIE)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_LL_EF_FLAG_Management FLAG_Management
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Indicate the status of an ongoing operation flag.
|
||||
* @rmtoll SR BUSYF LL_ICACHE_IsActiveFlag_BUSY
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_BUSY(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) == (ICACHE_SR_BUSYF)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicate the status of an operation end flag.
|
||||
* @rmtoll SR BSYEND LL_ICACHE_IsActiveFlag_BSYEND
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_BSYEND(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == (ICACHE_SR_BSYENDF)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicate the status of an error flag.
|
||||
* @rmtoll SR ERRF LL_ICACHE_IsActiveFlag_ERR
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsActiveFlag_ERR(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->SR, ICACHE_SR_ERRF) == (ICACHE_SR_ERRF)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear busy end of operation flag.
|
||||
* @rmtoll FCR CBSYENDF LL_ICACHE_ClearFlag_BSYEND
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_ClearFlag_BSYEND(void)
|
||||
{
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear error flag.
|
||||
* @rmtoll FCR ERRF LL_ICACHE_ClearFlag_ERR
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_ClearFlag_ERR(void)
|
||||
{
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CERRF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_LL_EF_REGION_Management REGION_Management
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable the remapped memory region.
|
||||
* @note The region must have been already configured.
|
||||
* @rmtoll CRRx REN LL_ICACHE_EnableRegion
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_EnableRegion(uint32_t Region)
|
||||
{
|
||||
SET_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_REN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the remapped memory region.
|
||||
* @rmtoll CRRx REN LL_ICACHE_DisableRegion
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_DisableRegion(uint32_t Region)
|
||||
{
|
||||
CLEAR_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_REN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return if remapped memory region is enabled or not.
|
||||
* @rmtoll CRRx REN LL_ICACHE_IsEnabledRegion
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval State of bit (1 or 0).
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_IsEnabledRegion(uint32_t Region)
|
||||
{
|
||||
return ((READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_REN) == (ICACHE_CRRx_REN)) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the memory remapped region base address.
|
||||
* @note The useful bits depends on RSIZE as described in the Reference Manual.
|
||||
* @rmtoll CRRx BASEADDR LL_ICACHE_SetRegionBaseAddress
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @param Address Alias address in the Code region
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetRegionBaseAddress(uint32_t Region, uint32_t Address)
|
||||
{
|
||||
MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_BASEADDR, ((Address & 0x1FFFFFFFU) >> 21U));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the memory remapped region base address.
|
||||
* @note The base address is the alias in the Code region.
|
||||
* @note The useful bits depends on RSIZE as described in the Reference Manual.
|
||||
* @rmtoll CRRx BASEADDR LL_ICACHE_GetRegionBaseAddress
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval Address Alias address in the Code region
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetRegionBaseAddress(uint32_t Region)
|
||||
{
|
||||
return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_BASEADDR) << 21U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the memory remapped region address.
|
||||
* @note The useful bits depends on RSIZE as described in the Reference Manual.
|
||||
* @rmtoll CRRx REMAPADDR LL_ICACHE_SetRegionRemapAddress
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @param Address Memory address to remap
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetRegionRemapAddress(uint32_t Region, uint32_t Address)
|
||||
{
|
||||
MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_REMAPADDR, ((Address >> 21U) << ICACHE_CRRx_REMAPADDR_Pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the memory remapped region address.
|
||||
* @note The useful bits depends on RSIZE as described in the Reference Manual.
|
||||
* @rmtoll CRRx REMAPADDR LL_ICACHE_GetRegionRemapAddress
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval Address Remapped memory address
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetRegionRemapAddress(uint32_t Region)
|
||||
{
|
||||
return ((READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_REMAPADDR) >> ICACHE_CRRx_REMAPADDR_Pos) << 21U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the memory remapped region size.
|
||||
* @rmtoll CRRx RSIZE LL_ICACHE_SetRegionSize
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @param Size This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_2MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_4MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_8MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_16MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_32MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_64MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_128MB
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetRegionSize(uint32_t Region, uint32_t Size)
|
||||
{
|
||||
MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_RSIZE, (Size << ICACHE_CRRx_RSIZE_Pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the selected the memory remapped region size.
|
||||
* @rmtoll CRRx RSIZE LL_ICACHE_GetRegionSize
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval Returned value can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_2MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_4MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_8MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_16MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_32MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_64MB
|
||||
* @arg @ref LL_ICACHE_REGIONSIZE_128MB
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetRegionSize(uint32_t Region)
|
||||
{
|
||||
return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_RSIZE) >> ICACHE_CRRx_RSIZE_Pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the memory remapped region output burst type.
|
||||
* @rmtoll CRRx HBURST LL_ICACHE_SetRegionOutputBurstType
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @param Type This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_OUTPUT_BURST_WRAP
|
||||
* @arg @ref LL_ICACHE_OUTPUT_BURST_INCR
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetRegionOutputBurstType(uint32_t Region, uint32_t Type)
|
||||
{
|
||||
MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_HBURST, Type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the selected the memory remapped region output burst type.
|
||||
* @rmtoll CRRx HBURST LL_ICACHE_GetRegionOutputBurstType
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval Returned value can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_OUTPUT_BURST_WRAP
|
||||
* @arg @ref LL_ICACHE_OUTPUT_BURST_INCR
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetRegionOutputBurstType(uint32_t Region)
|
||||
{
|
||||
return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_HBURST));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Select the memory remapped region cache master port.
|
||||
* @rmtoll CRRx MSTSEL LL_ICACHE_SetRegionMasterPort
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @param Port This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_MASTER1_PORT
|
||||
* @arg @ref LL_ICACHE_MASTER2_PORT
|
||||
* @retval None
|
||||
*/
|
||||
__STATIC_INLINE void LL_ICACHE_SetRegionMasterPort(uint32_t Region, uint32_t Port)
|
||||
{
|
||||
MODIFY_REG(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_MSTSEL, Port);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the selected the memory remapped region cache master port.
|
||||
* @rmtoll CRRx MSTSEL LL_ICACHE_GetRegionMasterPort
|
||||
* @param Region This parameter can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_REGION_0
|
||||
* @arg @ref LL_ICACHE_REGION_1
|
||||
* @arg @ref LL_ICACHE_REGION_2
|
||||
* @arg @ref LL_ICACHE_REGION_3
|
||||
* @retval Returned value can be one of the following values:
|
||||
* @arg @ref LL_ICACHE_MASTER1_PORT
|
||||
* @arg @ref LL_ICACHE_MASTER2_PORT
|
||||
*/
|
||||
__STATIC_INLINE uint32_t LL_ICACHE_GetRegionMasterPort(uint32_t Region)
|
||||
{
|
||||
return (READ_BIT(*((__IO uint32_t *)(&(ICACHE->CRR0) + (1U * Region))), \
|
||||
ICACHE_CRRx_MSTSEL));
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(USE_FULL_LL_DRIVER)
|
||||
/** @defgroup ICACHE_LL_EF_REGION_Init Region Initialization functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void LL_ICACHE_ConfigRegion(uint32_t Region, const LL_ICACHE_RegionTypeDef *const pICACHE_RegionStruct);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* USE_FULL_LL_DRIVER */
|
||||
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* ICACHE */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32H5xx_LL_ICACHE_H */
|
||||
2662
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_lpuart.h
Normal file
2662
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_lpuart.h
Normal file
File diff suppressed because it is too large
Load Diff
4405
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_usart.h
Normal file
4405
Drivers/STM32H5xx_HAL_Driver/Inc/stm32h5xx_ll_usart.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,657 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h5xx_hal_icache.c
|
||||
* @author MCD Application Team
|
||||
* @brief ICACHE HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Instruction Cache (ICACHE).
|
||||
* + Initialization and Configuration
|
||||
* + Invalidate functions
|
||||
* + Monitoring management
|
||||
* + Memory address remap management
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
@verbatim
|
||||
==============================================================================
|
||||
##### ICACHE main features #####
|
||||
==============================================================================
|
||||
[..]
|
||||
The Instruction Cache (ICACHE) is introduced on C-AHB code bus of
|
||||
Cortex-M33 processor to improve performance when fetching instruction
|
||||
and data from both internal and external memories. It allows close to
|
||||
zero wait states performance.
|
||||
|
||||
(+) The ICACHE provides two performance counters (Hit and Miss),
|
||||
cache invalidate maintenance operation, error management and TrustZone
|
||||
security support.
|
||||
|
||||
(+) The ICACHE provides additionally the possibility to remap input address
|
||||
falling into up to four memory regions (used to remap aliased code in
|
||||
external memories to the internal Code region, for execution)
|
||||
|
||||
===============================================================================
|
||||
##### How to use this driver #####
|
||||
===============================================================================
|
||||
[..]
|
||||
The ICACHE HAL driver can be used as follows:
|
||||
|
||||
(#) Optionally configure the Instruction Cache mode with
|
||||
HAL_ICACHE_ConfigAssociativityMode() if the default configuration
|
||||
does not suit the application requirements.
|
||||
|
||||
(#) Enable and disable the Instruction Cache with respectively
|
||||
HAL_ICACHE_Enable() and HAL_ICACHE_Disable().
|
||||
Use HAL_ICACHE_IsEnabled() to get the Instruction Cache status.
|
||||
To ensure a deterministic cache behavior after power on, system reset or after
|
||||
a call to @ref HAL_ICACHE_Disable(), the application must call
|
||||
@ref HAL_ICACHE_WaitForInvalidateComplete(). Indeed on power on, system reset
|
||||
or cache disable, an automatic cache invalidation procedure is launched and the
|
||||
cache is bypassed until the operation completes.
|
||||
|
||||
(#) Initiate the cache maintenance invalidation procedure with either
|
||||
HAL_ICACHE_Invalidate() (blocking mode) or HAL_ICACHE_Invalidate_IT()
|
||||
(interrupt mode). When interrupt mode is used, the callback function
|
||||
HAL_ICACHE_InvalidateCompleteCallback() is called when the invalidate
|
||||
procedure is complete. The function HAL_ICACHE_WaitForInvalidateComplete()
|
||||
may be called to wait for the end of the invalidate procedure automatically
|
||||
initiated when disabling the Instruction Cache with HAL_ICACHE_Disable().
|
||||
The cache operation is bypassed during the invalidation procedure.
|
||||
|
||||
(#) Use the performance monitoring counters for Hit and Miss with the following
|
||||
functions: HAL_ICACHE_Monitor_Start(), HAL_ICACHE_Monitor_Stop(),
|
||||
HAL_ICACHE_Monitor_Reset(), HAL_ICACHE_Monitor_GetHitValue() and
|
||||
HAL_ICACHE_Monitor_GetMissValue()
|
||||
|
||||
(#) Enable and disable up to four regions to remap input address from external
|
||||
memories to the internal Code region for execution with
|
||||
HAL_ICACHE_EnableRemapRegion() and HAL_ICACHE_DisableRemapRegion()
|
||||
|
||||
@endverbatim
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h5xx_hal.h"
|
||||
|
||||
/** @addtogroup STM32H5xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE ICACHE
|
||||
* @brief HAL ICACHE module driver
|
||||
* @{
|
||||
*/
|
||||
#if defined(ICACHE) && defined (HAL_ICACHE_MODULE_ENABLED)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/** @addtogroup ICACHE_Private_Constants ICACHE Private Constants
|
||||
* @{
|
||||
*/
|
||||
#define ICACHE_INVALIDATE_TIMEOUT_VALUE 1U /* 1ms */
|
||||
#define ICACHE_DISABLE_TIMEOUT_VALUE 1U /* 1ms */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/** @defgroup ICACHE_Private_Macros ICACHE Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define IS_ICACHE_ASSOCIATIVITY_MODE(__MODE__) (((__MODE__) == ICACHE_1WAY) || \
|
||||
((__MODE__) == ICACHE_2WAYS))
|
||||
|
||||
#define IS_ICACHE_MONITOR_TYPE(__TYPE__) (((__TYPE__) == ICACHE_MONITOR_HIT_MISS) || \
|
||||
((__TYPE__) == ICACHE_MONITOR_HIT) || \
|
||||
((__TYPE__) == ICACHE_MONITOR_MISS))
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
#define IS_ICACHE_REGION_NUMBER(__NUMBER__) ((__NUMBER__) < 4U)
|
||||
|
||||
#define IS_ICACHE_REGION_SIZE(__SIZE__) (((__SIZE__) == ICACHE_REGIONSIZE_2MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_4MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_8MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_16MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_32MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_64MB) || \
|
||||
((__SIZE__) == ICACHE_REGIONSIZE_128MB))
|
||||
|
||||
#define IS_ICACHE_REGION_TRAFFIC_ROUTE(__TRAFFICROUTE__) (((__TRAFFICROUTE__) == ICACHE_MASTER1_PORT) || \
|
||||
((__TRAFFICROUTE__) == ICACHE_MASTER2_PORT))
|
||||
|
||||
#define IS_ICACHE_REGION_OUTPUT_BURST_TYPE(__OUTPUTBURSTTYPE_) (((__OUTPUTBURSTTYPE_) == ICACHE_OUTPUT_BURST_WRAP) || \
|
||||
((__OUTPUTBURSTTYPE_) == ICACHE_OUTPUT_BURST_INCR))
|
||||
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup ICACHE_Exported_Functions ICACHE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Exported_Functions_Group1 Initialization and control functions
|
||||
* @brief Initialization and control functions
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
##### Initialization and control functions #####
|
||||
==============================================================================
|
||||
[..]
|
||||
This section provides functions allowing to initialize and control the
|
||||
Instruction Cache (mode, invalidate procedure, performance counters).
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configure the Instruction Cache cache associativity mode selection.
|
||||
* @param AssociativityMode Associativity mode selection
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ICACHE_1WAY 1-way cache (direct mapped cache)
|
||||
* @arg ICACHE_2WAYS 2-ways set associative cache (default)
|
||||
* @retval HAL status (HAL_OK/HAL_ERROR)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_ConfigAssociativityMode(uint32_t AssociativityMode)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_ASSOCIATIVITY_MODE(AssociativityMode));
|
||||
|
||||
/* Check cache is not enabled */
|
||||
if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
MODIFY_REG(ICACHE->CR, ICACHE_CR_WAYSEL, AssociativityMode);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitialize the Instruction Cache.
|
||||
* @retval HAL status (HAL_OK)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_DeInit(void)
|
||||
{
|
||||
/* Reset interrupt enable value */
|
||||
WRITE_REG(ICACHE->IER, 0U);
|
||||
|
||||
/* Clear any pending flags */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF | ICACHE_FCR_CERRF);
|
||||
|
||||
/* Disable cache then set default associative mode value */
|
||||
CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN);
|
||||
WRITE_REG(ICACHE->CR, ICACHE_CR_WAYSEL);
|
||||
|
||||
/* Stop monitor and reset monitor values */
|
||||
CLEAR_BIT(ICACHE->CR, ICACHE_MONITOR_HIT_MISS);
|
||||
SET_BIT(ICACHE->CR, (ICACHE_MONITOR_HIT_MISS << 2U));
|
||||
CLEAR_BIT(ICACHE->CR, (ICACHE_MONITOR_HIT_MISS << 2U));
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/* Reset regions configuration values */
|
||||
WRITE_REG(ICACHE->CRR0, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos);
|
||||
WRITE_REG(ICACHE->CRR1, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos);
|
||||
WRITE_REG(ICACHE->CRR2, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos);
|
||||
WRITE_REG(ICACHE->CRR3, ICACHE_REGIONSIZE_2MB << ICACHE_CRRx_RSIZE_Pos);
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable the Instruction Cache.
|
||||
* @note This function always returns HAL_OK even if there is any ongoing
|
||||
* cache operation. The Instruction Cache is bypassed until the
|
||||
* cache operation completes.
|
||||
* @retval HAL status (HAL_OK)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Enable(void)
|
||||
{
|
||||
SET_BIT(ICACHE->CR, ICACHE_CR_EN);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the Instruction Cache.
|
||||
* @note This function waits for the cache being disabled but
|
||||
* not for the end of the automatic cache invalidation procedure.
|
||||
* @retval HAL status (HAL_OK/HAL_TIMEOUT)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Disable(void)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
uint32_t tickstart;
|
||||
|
||||
/* Make sure BSYENDF is reset before to disable the instruction cache */
|
||||
/* as it automatically starts a cache invalidation procedure */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF);
|
||||
|
||||
CLEAR_BIT(ICACHE->CR, ICACHE_CR_EN);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait for instruction cache being disabled */
|
||||
while (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U)
|
||||
{
|
||||
if ((HAL_GetTick() - tickstart) > ICACHE_DISABLE_TIMEOUT_VALUE)
|
||||
{
|
||||
/* New check to avoid false timeout detection in case of preemption */
|
||||
if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U)
|
||||
{
|
||||
status = HAL_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the Instruction Cache is enabled or not.
|
||||
* @retval Status (0: disabled, 1: enabled)
|
||||
*/
|
||||
uint32_t HAL_ICACHE_IsEnabled(void)
|
||||
{
|
||||
return ((READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) ? 1UL : 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invalidate the Instruction Cache.
|
||||
* @note This function waits for the end of cache invalidation procedure
|
||||
* and clears the associated BSYENDF flag.
|
||||
* @retval HAL status (HAL_OK/HAL_ERROR/HAL_TIMEOUT)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Invalidate(void)
|
||||
{
|
||||
HAL_StatusTypeDef status;
|
||||
|
||||
/* Check if no ongoing operation */
|
||||
if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) == 0U)
|
||||
{
|
||||
/* Launch cache invalidation */
|
||||
SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV);
|
||||
}
|
||||
|
||||
status = HAL_ICACHE_WaitForInvalidateComplete();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Invalidate the Instruction Cache with interrupt.
|
||||
* @note This function launches cache invalidation and returns.
|
||||
* User application shall resort to interrupt generation to check
|
||||
* the end of the cache invalidation with the BSYENDF flag and the
|
||||
* HAL_ICACHE_InvalidateCompleteCallback() callback.
|
||||
* @retval HAL status (HAL_OK/HAL_ERROR)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Invalidate_IT(void)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
/* Check no ongoing operation */
|
||||
if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) != 0U)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure BSYENDF is reset before to start cache invalidation */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF);
|
||||
|
||||
/* Enable end of cache invalidation interrupt */
|
||||
SET_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE);
|
||||
|
||||
/* Launch cache invalidation */
|
||||
SET_BIT(ICACHE->CR, ICACHE_CR_CACHEINV);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for the end of the Instruction Cache invalidate procedure.
|
||||
* @note This function checks and clears the BSYENDF flag when set.
|
||||
* @retval HAL status (HAL_OK/HAL_TIMEOUT)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_WaitForInvalidateComplete(void)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
uint32_t tickstart;
|
||||
|
||||
/* Check if ongoing invalidation operation */
|
||||
if (READ_BIT(ICACHE->SR, ICACHE_SR_BUSYF) != 0U)
|
||||
{
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait for end of cache invalidation */
|
||||
while (READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == 0U)
|
||||
{
|
||||
if ((HAL_GetTick() - tickstart) > ICACHE_INVALIDATE_TIMEOUT_VALUE)
|
||||
{
|
||||
/* New check to avoid false timeout detection in case of preemption */
|
||||
if (READ_BIT(ICACHE->SR, ICACHE_SR_BSYENDF) == 0U)
|
||||
{
|
||||
status = HAL_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear BSYENDF */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Start the Instruction Cache performance monitoring.
|
||||
* @param MonitorType Monitoring type
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ICACHE_MONITOR_HIT_MISS Hit & Miss monitoring
|
||||
* @arg ICACHE_MONITOR_HIT Hit monitoring
|
||||
* @arg ICACHE_MONITOR_MISS Miss monitoring
|
||||
* @retval HAL status (HAL_OK)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Start(uint32_t MonitorType)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType));
|
||||
|
||||
SET_BIT(ICACHE->CR, MonitorType);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the Instruction Cache performance monitoring.
|
||||
* @note Stopping the monitoring does not reset the values.
|
||||
* @param MonitorType Monitoring type
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ICACHE_MONITOR_HIT_MISS Hit & Miss monitoring
|
||||
* @arg ICACHE_MONITOR_HIT Hit monitoring
|
||||
* @arg ICACHE_MONITOR_MISS Miss monitoring
|
||||
* @retval HAL status (HAL_OK)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Stop(uint32_t MonitorType)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType));
|
||||
|
||||
CLEAR_BIT(ICACHE->CR, MonitorType);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the Instruction Cache performance monitoring values.
|
||||
* @param MonitorType Monitoring type
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ICACHE_MONITOR_HIT_MISS Hit & Miss monitoring
|
||||
* @arg ICACHE_MONITOR_HIT Hit monitoring
|
||||
* @arg ICACHE_MONITOR_MISS Miss monitoring
|
||||
* @retval HAL status (HAL_OK)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_Monitor_Reset(uint32_t MonitorType)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_MONITOR_TYPE(MonitorType));
|
||||
|
||||
/* Force/Release reset */
|
||||
SET_BIT(ICACHE->CR, (MonitorType << 2U));
|
||||
CLEAR_BIT(ICACHE->CR, (MonitorType << 2U));
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Instruction Cache performance Hit monitoring value.
|
||||
* @note Upon reaching the 32-bit maximum value, monitor does not wrap.
|
||||
* @retval Hit monitoring value
|
||||
*/
|
||||
uint32_t HAL_ICACHE_Monitor_GetHitValue(void)
|
||||
{
|
||||
return (ICACHE->HMONR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Instruction Cache performance Miss monitoring value.
|
||||
* @note Upon reaching the 32-bit maximum value, monitor does not wrap.
|
||||
* @retval Miss monitoring value
|
||||
*/
|
||||
uint32_t HAL_ICACHE_Monitor_GetMissValue(void)
|
||||
{
|
||||
return (ICACHE->MMONR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup ICACHE_Exported_Functions_Group2 IRQ and callback functions
|
||||
* @brief IRQ and callback functions
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
##### IRQ and callback functions #####
|
||||
==============================================================================
|
||||
[..]
|
||||
This section provides functions allowing to handle ICACHE global interrupt
|
||||
and the associated callback functions.
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Handle the Instruction Cache interrupt request.
|
||||
* @note This function should be called under the ICACHE_IRQHandler().
|
||||
* @note This function respectively disables the interrupt and clears the
|
||||
* flag of any pending flag before calling the associated user callback.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ICACHE_IRQHandler(void)
|
||||
{
|
||||
/* Get current interrupt flags and interrupt sources value */
|
||||
uint32_t itflags = READ_REG(ICACHE->SR);
|
||||
uint32_t itsources = READ_REG(ICACHE->IER);
|
||||
|
||||
/* Check Instruction cache Error interrupt flag */
|
||||
if (((itflags & itsources) & ICACHE_FLAG_ERROR) != 0U)
|
||||
{
|
||||
/* Disable error interrupt */
|
||||
CLEAR_BIT(ICACHE->IER, ICACHE_IER_ERRIE);
|
||||
|
||||
/* Clear ERR pending flag */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CERRF);
|
||||
|
||||
/* Instruction cache error interrupt user callback */
|
||||
HAL_ICACHE_ErrorCallback();
|
||||
}
|
||||
|
||||
/* Check Instruction cache BusyEnd interrupt flag */
|
||||
if (((itflags & itsources) & ICACHE_FLAG_BUSYEND) != 0U)
|
||||
{
|
||||
/* Disable end of cache invalidation interrupt */
|
||||
CLEAR_BIT(ICACHE->IER, ICACHE_IER_BSYENDIE);
|
||||
|
||||
/* Clear BSYENDF pending flag */
|
||||
WRITE_REG(ICACHE->FCR, ICACHE_FCR_CBSYENDF);
|
||||
|
||||
/* Instruction cache busyend interrupt user callback */
|
||||
HAL_ICACHE_InvalidateCompleteCallback();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cache invalidation complete callback.
|
||||
*/
|
||||
__weak void HAL_ICACHE_InvalidateCompleteCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified, when the callback is needed,
|
||||
the HAL_ICACHE_InvalidateCompleteCallback() should be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Error callback.
|
||||
*/
|
||||
__weak void HAL_ICACHE_ErrorCallback(void)
|
||||
{
|
||||
/* NOTE : This function should not be modified, when the callback is needed,
|
||||
the HAL_ICACHE_ErrorCallback() should be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(ICACHE_CRRx_REN)
|
||||
/** @defgroup ICACHE_Exported_Functions_Group3 Memory remapped regions functions
|
||||
* @brief Memory remapped regions functions
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
##### Memory remapped regions functions #####
|
||||
==============================================================================
|
||||
[..]
|
||||
This section provides functions allowing to manage the remapping of
|
||||
external memories to internal Code for execution.
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configure and enable a region for memory remapping.
|
||||
* @note The Instruction Cache and the region must be disabled.
|
||||
* @param Region Region number
|
||||
This parameter can be a value of @arg @ref ICACHE_Region
|
||||
* @param pRegionConfig Pointer to structure of ICACHE region configuration parameters
|
||||
* @retval HAL status (HAL_OK/HAL_ERROR)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_EnableRemapRegion(uint32_t Region, const ICACHE_RegionConfigTypeDef *const pRegionConfig)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
__IO uint32_t *p_reg;
|
||||
uint32_t value;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_REGION_NUMBER(Region));
|
||||
assert_param(IS_ICACHE_REGION_SIZE(pRegionConfig->Size));
|
||||
assert_param(IS_ICACHE_REGION_TRAFFIC_ROUTE(pRegionConfig->TrafficRoute));
|
||||
assert_param(IS_ICACHE_REGION_OUTPUT_BURST_TYPE(pRegionConfig->OutputBurstType));
|
||||
|
||||
/* Check cache is not enabled */
|
||||
if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get region control register address */
|
||||
p_reg = &(ICACHE->CRR0) + (1U * Region);
|
||||
|
||||
/* Check region is not already enabled */
|
||||
if ((*p_reg & ICACHE_CRRx_REN) != 0U)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Region 2MB: BaseAddress size 8 bits, RemapAddress size 11 bits */
|
||||
/* Region 4MB: BaseAddress size 7 bits, RemapAddress size 10 bits */
|
||||
/* Region 8MB: BaseAddress size 6 bits, RemapAddress size 9 bits */
|
||||
/* Region 16MB: BaseAddress size 5 bits, RemapAddress size 8 bits */
|
||||
/* Region 32MB: BaseAddress size 4 bits, RemapAddress size 7 bits */
|
||||
/* Region 64MB: BaseAddress size 3 bits, RemapAddress size 6 bits */
|
||||
/* Region 128MB: BaseAddress size 2 bits, RemapAddress size 5 bits */
|
||||
value = ((pRegionConfig->BaseAddress & 0x1FFFFFFFU) >> 21U) & \
|
||||
(0xFFU & ~(pRegionConfig->Size - 1U));
|
||||
value |= ((pRegionConfig->RemapAddress >> 5U) & \
|
||||
((uint32_t)(0x7FFU & ~(pRegionConfig->Size - 1U)) << ICACHE_CRRx_REMAPADDR_Pos));
|
||||
value |= (pRegionConfig->Size << ICACHE_CRRx_RSIZE_Pos) | pRegionConfig->TrafficRoute | \
|
||||
pRegionConfig->OutputBurstType;
|
||||
*p_reg = (value | ICACHE_CRRx_REN);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable the memory remapping for a predefined region.
|
||||
* @param Region Region number
|
||||
This parameter can be a value of @arg @ref ICACHE_Region
|
||||
* @retval HAL status (HAL_OK/HAL_ERROR)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_ICACHE_DisableRemapRegion(uint32_t Region)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
__IO uint32_t *p_reg;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ICACHE_REGION_NUMBER(Region));
|
||||
|
||||
/* Check cache is not enabled */
|
||||
if (READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get region control register address */
|
||||
p_reg = &(ICACHE->CRR0) + (1U * Region);
|
||||
|
||||
*p_reg &= ~ICACHE_CRRx_REN;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* ICACHE_CRRx_REN */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* ICACHE && HAL_ICACHE_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
4880
Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_uart.c
Normal file
4880
Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_uart.c
Normal file
File diff suppressed because it is too large
Load Diff
1056
Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_uart_ex.c
Normal file
1056
Drivers/STM32H5xx_HAL_Driver/Src/stm32h5xx_hal_uart_ex.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user