1 /** 2 ********************************************************************************************************************** 3 * @file stm32h7rsxx_util_i3c.h 4 * @author MCD Application Team 5 * @brief Header of stm32h7rsxx_util_i3c.c 6 ********************************************************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2022 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ********************************************************************************************************************** 17 */ 18 19 /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/ 20 #ifndef STM32H7RSxx_UTIL_I3C_H 21 #define STM32H7RSxx_UTIL_I3C_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ----------------------------------------------------------------------------------------------------------*/ 28 #if defined (USE_HAL_DRIVER) 29 #include "stm32h7rsxx_hal.h" 30 #endif /* USE_HAL_DRIVER */ 31 32 #if defined (USE_FULL_LL_DRIVER) 33 #include "stm32h7rsxx_ll_i3c.h" 34 #endif /* USE_FULL_LL_DRIVER */ 35 36 #if (defined(USE_HAL_DRIVER) && defined(HAL_I3C_MODULE_ENABLED)) || defined(USE_FULL_LL_DRIVER) 37 /** @addtogroup STM32H7RSxx_UTIL_Driver 38 * @{ 39 */ 40 41 /** @defgroup UTILITY_I3C I3C Utility 42 * @{ 43 */ 44 /* Exported types ----------------------------------------------------------------------------------------------------*/ 45 /** @defgroup I3C_UTIL_Exported_Types I3C Utility Exported Types 46 * @{ 47 */ 48 49 /** @defgroup I3C_Controller_Timing_Structure_definition I3C Controller Timing Structure definition 50 * @brief I3C Controller Timing Structure definition 51 * @{ 52 */ 53 typedef struct 54 { 55 uint32_t clockSrcFreq; /*!< Specifies the I3C clock source (in Hz). */ 56 57 uint32_t i3cPPFreq; /*!< Specifies the I3C required bus clock for Push-Pull phase (in Hz). */ 58 59 uint32_t i2cODFreq; /*!< Specifies I2C required bus clock for Open-Drain phase (in Hz). */ 60 61 uint32_t dutyCycle; /*!< Specifies the I3C duty cycle for Pure I3C bus or I2C duty cycle for Mixed bus in percent 62 This parameter must be a value less than or equal to 50 percent. */ 63 64 uint32_t busType; /*!< Specifies the Bus configuration type. 65 This parameter must be a value of @ref I3C_UTIL_EC_BUS_TYPE */ 66 } I3C_CtrlTimingTypeDef; 67 /** 68 * @} 69 */ 70 71 /** @defgroup I3C_Target_Timing_Structure_definition I3C Target Timing Structure definition 72 * @brief I3C Target Timing Structure definition 73 * @{ 74 */ 75 typedef struct 76 { 77 uint32_t clockSrcFreq; /*!< Specifies the I3C clock source (in Hz). */ 78 } I3C_TgtTimingTypeDef; 79 /** 80 * @} 81 */ 82 83 /** 84 * @} 85 */ 86 87 /* Exported define ---------------------------------------------------------------------------------------------------*/ 88 /** @defgroup I3C_UTIL_Exported_Define I3C Utility Exported Define 89 * @{ 90 */ 91 92 /** @defgroup I3C_UTIL_EC_BUS_TYPE I3C Utility Bus Type 93 * @brief Bus type defines which can be used with I3C_CtrlTimingComputation function 94 * @{ 95 */ 96 #define I3C_PURE_I3C_BUS 0U /*!< Pure I3C bus, no I2C */ 97 #define I3C_MIXED_BUS 1U /*!< Mixed bus I3C and I2C */ 98 /** 99 * @} 100 */ 101 102 /** 103 * @} 104 */ 105 106 /* Exported functions ------------------------------------------------------------------------------------------------*/ 107 /** @addtogroup I3C_UTIL_Exported_Functions 108 * @{ 109 */ 110 /** @addtogroup I3C_UTIL_EF_Computation 111 * @{ 112 */ 113 ErrorStatus I3C_CtrlTimingComputation(const I3C_CtrlTimingTypeDef *pInputTiming, 114 LL_I3C_CtrlBusConfTypeDef *pOutputConfig); 115 ErrorStatus I3C_TgtTimingComputation(const I3C_TgtTimingTypeDef *pInputTiming, 116 LL_I3C_TgtBusConfTypeDef *pOutputConfig); 117 /** 118 * @} 119 */ 120 /** 121 * @} 122 */ 123 124 /** 125 * @} 126 */ 127 128 /** 129 * @} 130 */ 131 132 #endif /* (defined(USE_HAL_DRIVER) && defined(HAL_I3C_MODULE_ENABLED)) || defined(USE_FULL_LL_DRIVER) */ 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif /* __STM32H7RSxx_UTIL_I3C_H */ 138