STM32H735xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h7xx_hal_dsi.c 00004 * @author MCD Application Team 00005 * @brief DSI HAL module driver. 00006 * This file provides firmware functions to manage the following 00007 * functionalities of the DSI peripheral: 00008 * + Initialization and de-initialization functions 00009 * + IO operation functions 00010 * + Peripheral Control functions 00011 * + Peripheral State and Errors functions 00012 ****************************************************************************** 00013 * @attention 00014 * 00015 * Copyright (c) 2017 STMicroelectronics. 00016 * All rights reserved. 00017 * 00018 * This software is licensed under terms that can be found in the LICENSE file 00019 * in the root directory of this software component. 00020 * If no LICENSE file comes with this software, it is provided AS-IS. 00021 * 00022 ****************************************************************************** 00023 @verbatim 00024 ============================================================================== 00025 ##### How to use this driver ##### 00026 ============================================================================== 00027 [..] 00028 The DSI HAL driver can be used as follows: 00029 00030 (#) Declare a DSI_HandleTypeDef handle structure, for example: DSI_HandleTypeDef hdsi; 00031 00032 (#) Initialize the DSI low level resources by implementing the HAL_DSI_MspInit() API: 00033 (##) Enable the DSI interface clock 00034 (##) NVIC configuration if you need to use interrupt process 00035 (+++) Configure the DSI interrupt priority 00036 (+++) Enable the NVIC DSI IRQ Channel 00037 00038 (#) Initialize the DSI Host peripheral, the required PLL parameters, number of lances and 00039 TX Escape clock divider by calling the HAL_DSI_Init() API which calls HAL_DSI_MspInit(). 00040 00041 *** Configuration *** 00042 ========================= 00043 [..] 00044 (#) Use HAL_DSI_ConfigAdaptedCommandMode() function to configure the DSI host in adapted 00045 command mode. 00046 00047 (#) When operating in video mode , use HAL_DSI_ConfigVideoMode() to configure the DSI host. 00048 00049 (#) Function HAL_DSI_ConfigCommand() is used to configure the DSI commands behavior in low power mode. 00050 00051 (#) To configure the DSI PHY timings parameters, use function HAL_DSI_ConfigPhyTimer(). 00052 00053 (#) The DSI Host can be started/stopped using respectively functions HAL_DSI_Start() and HAL_DSI_Stop(). 00054 Functions HAL_DSI_ShortWrite(), HAL_DSI_LongWrite() and HAL_DSI_Read() allows respectively 00055 to write DSI short packets, long packets and to read DSI packets. 00056 00057 (#) The DSI Host Offers two Low power modes : 00058 (++) Low Power Mode on data lanes only: Only DSI data lanes are shut down. 00059 It is possible to enter/exit from this mode using respectively functions HAL_DSI_EnterULPMData() 00060 and HAL_DSI_ExitULPMData() 00061 00062 (++) Low Power Mode on data and clock lanes : All DSI lanes are shut down including data and clock lanes. 00063 It is possible to enter/exit from this mode using respectively functions HAL_DSI_EnterULPM() 00064 and HAL_DSI_ExitULPM() 00065 00066 (#) To control DSI state you can use the following function: HAL_DSI_GetState() 00067 00068 *** Error management *** 00069 ======================== 00070 [..] 00071 (#) User can select the DSI errors to be reported/monitored using function HAL_DSI_ConfigErrorMonitor() 00072 When an error occurs, the callback HAL_DSI_ErrorCallback() is asserted and then user can retrieve 00073 the error code by calling function HAL_DSI_GetError() 00074 00075 *** DSI HAL driver macros list *** 00076 ============================================= 00077 [..] 00078 Below the list of most used macros in DSI HAL driver. 00079 00080 (+) __HAL_DSI_ENABLE: Enable the DSI Host. 00081 (+) __HAL_DSI_DISABLE: Disable the DSI Host. 00082 (+) __HAL_DSI_WRAPPER_ENABLE: Enables the DSI wrapper. 00083 (+) __HAL_DSI_WRAPPER_DISABLE: Disable the DSI wrapper. 00084 (+) __HAL_DSI_PLL_ENABLE: Enables the DSI PLL. 00085 (+) __HAL_DSI_PLL_DISABLE: Disables the DSI PLL. 00086 (+) __HAL_DSI_REG_ENABLE: Enables the DSI regulator. 00087 (+) __HAL_DSI_REG_DISABLE: Disables the DSI regulator. 00088 (+) __HAL_DSI_GET_FLAG: Get the DSI pending flags. 00089 (+) __HAL_DSI_CLEAR_FLAG: Clears the DSI pending flags. 00090 (+) __HAL_DSI_ENABLE_IT: Enables the specified DSI interrupts. 00091 (+) __HAL_DSI_DISABLE_IT: Disables the specified DSI interrupts. 00092 (+) __HAL_DSI_GET_IT_SOURCE: Checks whether the specified DSI interrupt source is enabled or not. 00093 00094 [..] 00095 (@) You can refer to the DSI HAL driver header file for more useful macros 00096 00097 *** Callback registration *** 00098 ============================================= 00099 [..] 00100 The compilation define USE_HAL_DSI_REGISTER_CALLBACKS when set to 1 00101 allows the user to configure dynamically the driver callbacks. 00102 Use Function HAL_DSI_RegisterCallback() to register a callback. 00103 00104 [..] 00105 Function HAL_DSI_RegisterCallback() allows to register following callbacks: 00106 (+) TearingEffectCallback : DSI Tearing Effect Callback. 00107 (+) EndOfRefreshCallback : DSI End Of Refresh Callback. 00108 (+) ErrorCallback : DSI Error Callback 00109 (+) MspInitCallback : DSI MspInit. 00110 (+) MspDeInitCallback : DSI MspDeInit. 00111 [..] 00112 This function takes as parameters the HAL peripheral handle, the callback ID 00113 and a pointer to the user callback function. 00114 00115 [..] 00116 Use function HAL_DSI_UnRegisterCallback() to reset a callback to the default 00117 weak function. 00118 HAL_DSI_UnRegisterCallback takes as parameters the HAL peripheral handle, 00119 and the callback ID. 00120 [..] 00121 This function allows to reset following callbacks: 00122 (+) TearingEffectCallback : DSI Tearing Effect Callback. 00123 (+) EndOfRefreshCallback : DSI End Of Refresh Callback. 00124 (+) ErrorCallback : DSI Error Callback 00125 (+) MspInitCallback : DSI MspInit. 00126 (+) MspDeInitCallback : DSI MspDeInit. 00127 00128 [..] 00129 By default, after the HAL_DSI_Init and when the state is HAL_DSI_STATE_RESET 00130 all callbacks are set to the corresponding weak functions: 00131 examples HAL_DSI_TearingEffectCallback(), HAL_DSI_EndOfRefreshCallback(). 00132 Exception done for MspInit and MspDeInit functions that are respectively 00133 reset to the legacy weak (surcharged) functions in the HAL_DSI_Init() 00134 and HAL_DSI_DeInit() only when these callbacks are null (not registered beforehand). 00135 If not, MspInit or MspDeInit are not null, the HAL_DSI_Init() and HAL_DSI_DeInit() 00136 keep and use the user MspInit/MspDeInit callbacks (registered beforehand). 00137 00138 [..] 00139 Callbacks can be registered/unregistered in HAL_DSI_STATE_READY state only. 00140 Exception done MspInit/MspDeInit that can be registered/unregistered 00141 in HAL_DSI_STATE_READY or HAL_DSI_STATE_RESET state, 00142 thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. 00143 In that case first register the MspInit/MspDeInit user callbacks 00144 using HAL_DSI_RegisterCallback() before calling HAL_DSI_DeInit() 00145 or HAL_DSI_Init() function. 00146 00147 [..] 00148 When The compilation define USE_HAL_DSI_REGISTER_CALLBACKS is set to 0 or 00149 not defined, the callback registration feature is not available and all callbacks 00150 are set to the corresponding weak functions. 00151 00152 @endverbatim 00153 ****************************************************************************** 00154 */ 00155 00156 /* Includes ------------------------------------------------------------------*/ 00157 #include "stm32h7xx_hal.h" 00158 00159 /** @addtogroup STM32H7xx_HAL_Driver 00160 * @{ 00161 */ 00162 00163 #ifdef HAL_DSI_MODULE_ENABLED 00164 00165 #if defined(DSI) 00166 00167 /** @addtogroup DSI 00168 * @{ 00169 */ 00170 00171 /* Private types -------------------------------------------------------------*/ 00172 /* Private defines -----------------------------------------------------------*/ 00173 /** @addtogroup DSI_Private_Constants 00174 * @{ 00175 */ 00176 #define DSI_TIMEOUT_VALUE ((uint32_t)100U) /* 100ms */ 00177 00178 #define DSI_ERROR_ACK_MASK (DSI_ISR0_AE0 | DSI_ISR0_AE1 | DSI_ISR0_AE2 | DSI_ISR0_AE3 | \ 00179 DSI_ISR0_AE4 | DSI_ISR0_AE5 | DSI_ISR0_AE6 | DSI_ISR0_AE7 | \ 00180 DSI_ISR0_AE8 | DSI_ISR0_AE9 | DSI_ISR0_AE10 | DSI_ISR0_AE11 | \ 00181 DSI_ISR0_AE12 | DSI_ISR0_AE13 | DSI_ISR0_AE14 | DSI_ISR0_AE15) 00182 #define DSI_ERROR_PHY_MASK (DSI_ISR0_PE0 | DSI_ISR0_PE1 | DSI_ISR0_PE2 | DSI_ISR0_PE3 | DSI_ISR0_PE4) 00183 #define DSI_ERROR_TX_MASK DSI_ISR1_TOHSTX 00184 #define DSI_ERROR_RX_MASK DSI_ISR1_TOLPRX 00185 #define DSI_ERROR_ECC_MASK (DSI_ISR1_ECCSE | DSI_ISR1_ECCME) 00186 #define DSI_ERROR_CRC_MASK DSI_ISR1_CRCE 00187 #define DSI_ERROR_PSE_MASK DSI_ISR1_PSE 00188 #define DSI_ERROR_EOT_MASK DSI_ISR1_EOTPE 00189 #define DSI_ERROR_OVF_MASK DSI_ISR1_LPWRE 00190 #define DSI_ERROR_GEN_MASK (DSI_ISR1_GCWRE | DSI_ISR1_GPWRE | DSI_ISR1_GPTXE | DSI_ISR1_GPRDE | DSI_ISR1_GPRXE) 00191 /** 00192 * @} 00193 */ 00194 00195 /* Private variables ---------------------------------------------------------*/ 00196 /* Private constants ---------------------------------------------------------*/ 00197 /* Private macros ------------------------------------------------------------*/ 00198 /* Private function prototypes -----------------------------------------------*/ 00199 static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t DataType, uint32_t Data0, 00200 uint32_t Data1); 00201 00202 static HAL_StatusTypeDef DSI_ShortWrite(DSI_HandleTypeDef *hdsi, 00203 uint32_t ChannelID, 00204 uint32_t Mode, 00205 uint32_t Param1, 00206 uint32_t Param2); 00207 /* Private functions ---------------------------------------------------------*/ 00208 /** @defgroup DSI_Private_Functions DSI Private Functions 00209 * @{ 00210 */ 00211 /** 00212 * @brief Generic DSI packet header configuration 00213 * @param DSIx Pointer to DSI register base 00214 * @param ChannelID Virtual channel ID of the header packet 00215 * @param DataType Packet data type of the header packet 00216 * This parameter can be any value of : 00217 * @arg DSI_SHORT_WRITE_PKT_Data_Type 00218 * @arg DSI_LONG_WRITE_PKT_Data_Type 00219 * @arg DSI_SHORT_READ_PKT_Data_Type 00220 * @arg DSI_MAX_RETURN_PKT_SIZE 00221 * @param Data0 Word count LSB 00222 * @param Data1 Word count MSB 00223 * @retval None 00224 */ 00225 static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx, 00226 uint32_t ChannelID, 00227 uint32_t DataType, 00228 uint32_t Data0, 00229 uint32_t Data1) 00230 { 00231 /* Update the DSI packet header with new information */ 00232 DSIx->GHCR = (DataType | (ChannelID << 6U) | (Data0 << 8U) | (Data1 << 16U)); 00233 } 00234 00235 /** 00236 * @brief write short DCS or short Generic command 00237 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00238 * the configuration information for the DSI. 00239 * @param ChannelID Virtual channel ID. 00240 * @param Mode DSI short packet data type. 00241 * This parameter can be any value of @arg DSI_SHORT_WRITE_PKT_Data_Type. 00242 * @param Param1 DSC command or first generic parameter. 00243 * This parameter can be any value of @arg DSI_DCS_Command or a 00244 * generic command code. 00245 * @param Param2 DSC parameter or second generic parameter. 00246 * @retval HAL status 00247 */ 00248 static HAL_StatusTypeDef DSI_ShortWrite(DSI_HandleTypeDef *hdsi, 00249 uint32_t ChannelID, 00250 uint32_t Mode, 00251 uint32_t Param1, 00252 uint32_t Param2) 00253 { 00254 uint32_t tickstart; 00255 00256 /* Get tick */ 00257 tickstart = HAL_GetTick(); 00258 00259 /* Wait for Command FIFO Empty */ 00260 while ((hdsi->Instance->GPSR & DSI_GPSR_CMDFE) == 0U) 00261 { 00262 /* Check for the Timeout */ 00263 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 00264 { 00265 return HAL_TIMEOUT; 00266 } 00267 } 00268 00269 /* Configure the packet to send a short DCS command with 0 or 1 parameter */ 00270 /* Update the DSI packet header with new information */ 00271 hdsi->Instance->GHCR = (Mode | (ChannelID << 6U) | (Param1 << 8U) | (Param2 << 16U)); 00272 00273 return HAL_OK; 00274 } 00275 00276 /** 00277 * @} 00278 */ 00279 00280 /* Exported functions --------------------------------------------------------*/ 00281 /** @addtogroup DSI_Exported_Functions 00282 * @{ 00283 */ 00284 00285 /** @defgroup DSI_Group1 Initialization and Configuration functions 00286 * @brief Initialization and Configuration functions 00287 * 00288 @verbatim 00289 =============================================================================== 00290 ##### Initialization and Configuration functions ##### 00291 =============================================================================== 00292 [..] This section provides functions allowing to: 00293 (+) Initialize and configure the DSI 00294 (+) De-initialize the DSI 00295 00296 @endverbatim 00297 * @{ 00298 */ 00299 00300 /** 00301 * @brief Initializes the DSI according to the specified 00302 * parameters in the DSI_InitTypeDef and create the associated handle. 00303 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00304 * the configuration information for the DSI. 00305 * @param PLLInit pointer to a DSI_PLLInitTypeDef structure that contains 00306 * the PLL Clock structure definition for the DSI. 00307 * @retval HAL status 00308 */ 00309 HAL_StatusTypeDef HAL_DSI_Init(DSI_HandleTypeDef *hdsi, DSI_PLLInitTypeDef *PLLInit) 00310 { 00311 uint32_t tickstart; 00312 uint32_t unitIntervalx4; 00313 uint32_t tempIDF; 00314 00315 /* Check the DSI handle allocation */ 00316 if (hdsi == NULL) 00317 { 00318 return HAL_ERROR; 00319 } 00320 00321 /* Check function parameters */ 00322 assert_param(IS_DSI_PLL_NDIV(PLLInit->PLLNDIV)); 00323 assert_param(IS_DSI_PLL_IDF(PLLInit->PLLIDF)); 00324 assert_param(IS_DSI_PLL_ODF(PLLInit->PLLODF)); 00325 assert_param(IS_DSI_AUTO_CLKLANE_CONTROL(hdsi->Init.AutomaticClockLaneControl)); 00326 assert_param(IS_DSI_NUMBER_OF_LANES(hdsi->Init.NumberOfLanes)); 00327 00328 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00329 if (hdsi->State == HAL_DSI_STATE_RESET) 00330 { 00331 /* Reset the DSI callback to the legacy weak callbacks */ 00332 hdsi->TearingEffectCallback = HAL_DSI_TearingEffectCallback; /* Legacy weak TearingEffectCallback */ 00333 hdsi->EndOfRefreshCallback = HAL_DSI_EndOfRefreshCallback; /* Legacy weak EndOfRefreshCallback */ 00334 hdsi->ErrorCallback = HAL_DSI_ErrorCallback; /* Legacy weak ErrorCallback */ 00335 00336 if (hdsi->MspInitCallback == NULL) 00337 { 00338 hdsi->MspInitCallback = HAL_DSI_MspInit; 00339 } 00340 /* Initialize the low level hardware */ 00341 hdsi->MspInitCallback(hdsi); 00342 } 00343 #else 00344 if (hdsi->State == HAL_DSI_STATE_RESET) 00345 { 00346 /* Initialize the low level hardware */ 00347 HAL_DSI_MspInit(hdsi); 00348 } 00349 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00350 00351 /* Change DSI peripheral state */ 00352 hdsi->State = HAL_DSI_STATE_BUSY; 00353 00354 /**************** Turn on the regulator and enable the DSI PLL ****************/ 00355 00356 /* Enable the regulator */ 00357 __HAL_DSI_REG_ENABLE(hdsi); 00358 00359 /* Get tick */ 00360 tickstart = HAL_GetTick(); 00361 00362 /* Wait until the regulator is ready */ 00363 while (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_RRS) == 0U) 00364 { 00365 /* Check for the Timeout */ 00366 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 00367 { 00368 return HAL_TIMEOUT; 00369 } 00370 } 00371 00372 /* Set the PLL division factors */ 00373 hdsi->Instance->WRPCR &= ~(DSI_WRPCR_PLL_NDIV | DSI_WRPCR_PLL_IDF | DSI_WRPCR_PLL_ODF); 00374 hdsi->Instance->WRPCR |= (((PLLInit->PLLNDIV) << DSI_WRPCR_PLL_NDIV_Pos) | \ 00375 ((PLLInit->PLLIDF) << DSI_WRPCR_PLL_IDF_Pos) | \ 00376 ((PLLInit->PLLODF) << DSI_WRPCR_PLL_ODF_Pos)); 00377 00378 /* Enable the DSI PLL */ 00379 __HAL_DSI_PLL_ENABLE(hdsi); 00380 00381 /* Requires min of 400µs delay before reading the PLLLS flag */ 00382 /* 1ms delay is inserted that is the minimum HAL delay granularity */ 00383 HAL_Delay(1); 00384 00385 /* Get tick */ 00386 tickstart = HAL_GetTick(); 00387 00388 /* Wait for the lock of the PLL */ 00389 while (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_PLLLS) == 0U) 00390 { 00391 /* Check for the Timeout */ 00392 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 00393 { 00394 return HAL_TIMEOUT; 00395 } 00396 } 00397 00398 /*************************** Set the PHY parameters ***************************/ 00399 00400 /* D-PHY clock and digital enable*/ 00401 hdsi->Instance->PCTLR |= (DSI_PCTLR_CKE | DSI_PCTLR_DEN); 00402 00403 /* Clock lane configuration */ 00404 hdsi->Instance->CLCR &= ~(DSI_CLCR_DPCC | DSI_CLCR_ACR); 00405 hdsi->Instance->CLCR |= (DSI_CLCR_DPCC | hdsi->Init.AutomaticClockLaneControl); 00406 00407 /* Configure the number of active data lanes */ 00408 hdsi->Instance->PCONFR &= ~DSI_PCONFR_NL; 00409 hdsi->Instance->PCONFR |= hdsi->Init.NumberOfLanes; 00410 00411 /************************ Set the DSI clock parameters ************************/ 00412 00413 /* Set the TX escape clock division factor */ 00414 hdsi->Instance->CCR &= ~DSI_CCR_TXECKDIV; 00415 hdsi->Instance->CCR |= hdsi->Init.TXEscapeCkdiv; 00416 00417 /* Calculate the bit period in high-speed mode in unit of 0.25 ns (UIX4) */ 00418 /* The equation is : UIX4 = IntegerPart( (1000/F_PHY_Mhz) * 4 ) */ 00419 /* Where : F_PHY_Mhz = (NDIV * HSE_Mhz) / (IDF * ODF) */ 00420 tempIDF = (PLLInit->PLLIDF > 0U) ? PLLInit->PLLIDF : 1U; 00421 unitIntervalx4 = (4000000U * tempIDF * ((1UL << (0x3U & PLLInit->PLLODF)))) / ((HSE_VALUE / 1000U) * PLLInit->PLLNDIV); 00422 00423 /* Set the bit period in high-speed mode */ 00424 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_UIX4; 00425 hdsi->Instance->WPCR[0U] |= unitIntervalx4; 00426 00427 /****************************** Error management *****************************/ 00428 00429 /* Disable all error interrupts and reset the Error Mask */ 00430 hdsi->Instance->IER[0U] = 0U; 00431 hdsi->Instance->IER[1U] = 0U; 00432 hdsi->ErrorMsk = 0U; 00433 00434 /* Initialize the error code */ 00435 hdsi->ErrorCode = HAL_DSI_ERROR_NONE; 00436 00437 /* Initialize the DSI state*/ 00438 hdsi->State = HAL_DSI_STATE_READY; 00439 00440 return HAL_OK; 00441 } 00442 00443 /** 00444 * @brief De-initializes the DSI peripheral registers to their default reset 00445 * values. 00446 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00447 * the configuration information for the DSI. 00448 * @retval HAL status 00449 */ 00450 HAL_StatusTypeDef HAL_DSI_DeInit(DSI_HandleTypeDef *hdsi) 00451 { 00452 /* Check the DSI handle allocation */ 00453 if (hdsi == NULL) 00454 { 00455 return HAL_ERROR; 00456 } 00457 00458 /* Change DSI peripheral state */ 00459 hdsi->State = HAL_DSI_STATE_BUSY; 00460 00461 /* Disable the DSI wrapper */ 00462 __HAL_DSI_WRAPPER_DISABLE(hdsi); 00463 00464 /* Disable the DSI host */ 00465 __HAL_DSI_DISABLE(hdsi); 00466 00467 /* D-PHY clock and digital disable */ 00468 hdsi->Instance->PCTLR &= ~(DSI_PCTLR_CKE | DSI_PCTLR_DEN); 00469 00470 /* Turn off the DSI PLL */ 00471 __HAL_DSI_PLL_DISABLE(hdsi); 00472 00473 /* Disable the regulator */ 00474 __HAL_DSI_REG_DISABLE(hdsi); 00475 00476 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00477 if (hdsi->MspDeInitCallback == NULL) 00478 { 00479 hdsi->MspDeInitCallback = HAL_DSI_MspDeInit; 00480 } 00481 /* DeInit the low level hardware */ 00482 hdsi->MspDeInitCallback(hdsi); 00483 #else 00484 /* DeInit the low level hardware */ 00485 HAL_DSI_MspDeInit(hdsi); 00486 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00487 00488 /* Initialize the error code */ 00489 hdsi->ErrorCode = HAL_DSI_ERROR_NONE; 00490 00491 /* Initialize the DSI state*/ 00492 hdsi->State = HAL_DSI_STATE_RESET; 00493 00494 /* Release Lock */ 00495 __HAL_UNLOCK(hdsi); 00496 00497 return HAL_OK; 00498 } 00499 00500 /** 00501 * @brief Enable the error monitor flags 00502 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00503 * the configuration information for the DSI. 00504 * @param ActiveErrors indicates which error interrupts will be enabled. 00505 * This parameter can be any combination of @arg DSI_Error_Data_Type. 00506 * @retval HAL status 00507 */ 00508 HAL_StatusTypeDef HAL_DSI_ConfigErrorMonitor(DSI_HandleTypeDef *hdsi, uint32_t ActiveErrors) 00509 { 00510 /* Process locked */ 00511 __HAL_LOCK(hdsi); 00512 00513 hdsi->Instance->IER[0U] = 0U; 00514 hdsi->Instance->IER[1U] = 0U; 00515 00516 /* Store active errors to the handle */ 00517 hdsi->ErrorMsk = ActiveErrors; 00518 00519 if ((ActiveErrors & HAL_DSI_ERROR_ACK) != 0U) 00520 { 00521 /* Enable the interrupt generation on selected errors */ 00522 hdsi->Instance->IER[0U] |= DSI_ERROR_ACK_MASK; 00523 } 00524 00525 if ((ActiveErrors & HAL_DSI_ERROR_PHY) != 0U) 00526 { 00527 /* Enable the interrupt generation on selected errors */ 00528 hdsi->Instance->IER[0U] |= DSI_ERROR_PHY_MASK; 00529 } 00530 00531 if ((ActiveErrors & HAL_DSI_ERROR_TX) != 0U) 00532 { 00533 /* Enable the interrupt generation on selected errors */ 00534 hdsi->Instance->IER[1U] |= DSI_ERROR_TX_MASK; 00535 } 00536 00537 if ((ActiveErrors & HAL_DSI_ERROR_RX) != 0U) 00538 { 00539 /* Enable the interrupt generation on selected errors */ 00540 hdsi->Instance->IER[1U] |= DSI_ERROR_RX_MASK; 00541 } 00542 00543 if ((ActiveErrors & HAL_DSI_ERROR_ECC) != 0U) 00544 { 00545 /* Enable the interrupt generation on selected errors */ 00546 hdsi->Instance->IER[1U] |= DSI_ERROR_ECC_MASK; 00547 } 00548 00549 if ((ActiveErrors & HAL_DSI_ERROR_CRC) != 0U) 00550 { 00551 /* Enable the interrupt generation on selected errors */ 00552 hdsi->Instance->IER[1U] |= DSI_ERROR_CRC_MASK; 00553 } 00554 00555 if ((ActiveErrors & HAL_DSI_ERROR_PSE) != 0U) 00556 { 00557 /* Enable the interrupt generation on selected errors */ 00558 hdsi->Instance->IER[1U] |= DSI_ERROR_PSE_MASK; 00559 } 00560 00561 if ((ActiveErrors & HAL_DSI_ERROR_EOT) != 0U) 00562 { 00563 /* Enable the interrupt generation on selected errors */ 00564 hdsi->Instance->IER[1U] |= DSI_ERROR_EOT_MASK; 00565 } 00566 00567 if ((ActiveErrors & HAL_DSI_ERROR_OVF) != 0U) 00568 { 00569 /* Enable the interrupt generation on selected errors */ 00570 hdsi->Instance->IER[1U] |= DSI_ERROR_OVF_MASK; 00571 } 00572 00573 if ((ActiveErrors & HAL_DSI_ERROR_GEN) != 0U) 00574 { 00575 /* Enable the interrupt generation on selected errors */ 00576 hdsi->Instance->IER[1U] |= DSI_ERROR_GEN_MASK; 00577 } 00578 00579 /* Process Unlocked */ 00580 __HAL_UNLOCK(hdsi); 00581 00582 return HAL_OK; 00583 } 00584 00585 /** 00586 * @brief Initializes the DSI MSP. 00587 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00588 * the configuration information for the DSI. 00589 * @retval None 00590 */ 00591 __weak void HAL_DSI_MspInit(DSI_HandleTypeDef *hdsi) 00592 { 00593 /* Prevent unused argument(s) compilation warning */ 00594 UNUSED(hdsi); 00595 /* NOTE : This function Should not be modified, when the callback is needed, 00596 the HAL_DSI_MspInit could be implemented in the user file 00597 */ 00598 } 00599 00600 /** 00601 * @brief De-initializes the DSI MSP. 00602 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00603 * the configuration information for the DSI. 00604 * @retval None 00605 */ 00606 __weak void HAL_DSI_MspDeInit(DSI_HandleTypeDef *hdsi) 00607 { 00608 /* Prevent unused argument(s) compilation warning */ 00609 UNUSED(hdsi); 00610 /* NOTE : This function Should not be modified, when the callback is needed, 00611 the HAL_DSI_MspDeInit could be implemented in the user file 00612 */ 00613 } 00614 00615 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00616 /** 00617 * @brief Register a User DSI Callback 00618 * To be used instead of the weak predefined callback 00619 * @param hdsi dsi handle 00620 * @param CallbackID ID of the callback to be registered 00621 * This parameter can be one of the following values: 00622 * @arg HAL_DSI_TEARING_EFFECT_CB_ID Tearing Effect Callback ID 00623 * @arg HAL_DSI_ENDOF_REFRESH_CB_ID End Of Refresh Callback ID 00624 * @arg HAL_DSI_ERROR_CB_ID Error Callback ID 00625 * @arg HAL_DSI_MSPINIT_CB_ID MspInit callback ID 00626 * @arg HAL_DSI_MSPDEINIT_CB_ID MspDeInit callback ID 00627 * @param pCallback pointer to the Callback function 00628 * @retval status 00629 */ 00630 HAL_StatusTypeDef HAL_DSI_RegisterCallback(DSI_HandleTypeDef *hdsi, HAL_DSI_CallbackIDTypeDef CallbackID, 00631 pDSI_CallbackTypeDef pCallback) 00632 { 00633 HAL_StatusTypeDef status = HAL_OK; 00634 00635 if (pCallback == NULL) 00636 { 00637 /* Update the error code */ 00638 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00639 00640 return HAL_ERROR; 00641 } 00642 /* Process locked */ 00643 __HAL_LOCK(hdsi); 00644 00645 if (hdsi->State == HAL_DSI_STATE_READY) 00646 { 00647 switch (CallbackID) 00648 { 00649 case HAL_DSI_TEARING_EFFECT_CB_ID : 00650 hdsi->TearingEffectCallback = pCallback; 00651 break; 00652 00653 case HAL_DSI_ENDOF_REFRESH_CB_ID : 00654 hdsi->EndOfRefreshCallback = pCallback; 00655 break; 00656 00657 case HAL_DSI_ERROR_CB_ID : 00658 hdsi->ErrorCallback = pCallback; 00659 break; 00660 00661 case HAL_DSI_MSPINIT_CB_ID : 00662 hdsi->MspInitCallback = pCallback; 00663 break; 00664 00665 case HAL_DSI_MSPDEINIT_CB_ID : 00666 hdsi->MspDeInitCallback = pCallback; 00667 break; 00668 00669 default : 00670 /* Update the error code */ 00671 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00672 /* Return error status */ 00673 status = HAL_ERROR; 00674 break; 00675 } 00676 } 00677 else if (hdsi->State == HAL_DSI_STATE_RESET) 00678 { 00679 switch (CallbackID) 00680 { 00681 case HAL_DSI_MSPINIT_CB_ID : 00682 hdsi->MspInitCallback = pCallback; 00683 break; 00684 00685 case HAL_DSI_MSPDEINIT_CB_ID : 00686 hdsi->MspDeInitCallback = pCallback; 00687 break; 00688 00689 default : 00690 /* Update the error code */ 00691 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00692 /* Return error status */ 00693 status = HAL_ERROR; 00694 break; 00695 } 00696 } 00697 else 00698 { 00699 /* Update the error code */ 00700 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00701 /* Return error status */ 00702 status = HAL_ERROR; 00703 } 00704 00705 /* Release Lock */ 00706 __HAL_UNLOCK(hdsi); 00707 00708 return status; 00709 } 00710 00711 /** 00712 * @brief Unregister a DSI Callback 00713 * DSI callabck is redirected to the weak predefined callback 00714 * @param hdsi dsi handle 00715 * @param CallbackID ID of the callback to be unregistered 00716 * This parameter can be one of the following values: 00717 * @arg HAL_DSI_TEARING_EFFECT_CB_ID Tearing Effect Callback ID 00718 * @arg HAL_DSI_ENDOF_REFRESH_CB_ID End Of Refresh Callback ID 00719 * @arg HAL_DSI_ERROR_CB_ID Error Callback ID 00720 * @arg HAL_DSI_MSPINIT_CB_ID MspInit callback ID 00721 * @arg HAL_DSI_MSPDEINIT_CB_ID MspDeInit callback ID 00722 * @retval status 00723 */ 00724 HAL_StatusTypeDef HAL_DSI_UnRegisterCallback(DSI_HandleTypeDef *hdsi, HAL_DSI_CallbackIDTypeDef CallbackID) 00725 { 00726 HAL_StatusTypeDef status = HAL_OK; 00727 00728 /* Process locked */ 00729 __HAL_LOCK(hdsi); 00730 00731 if (hdsi->State == HAL_DSI_STATE_READY) 00732 { 00733 switch (CallbackID) 00734 { 00735 case HAL_DSI_TEARING_EFFECT_CB_ID : 00736 hdsi->TearingEffectCallback = HAL_DSI_TearingEffectCallback; /* Legacy weak TearingEffectCallback */ 00737 break; 00738 00739 case HAL_DSI_ENDOF_REFRESH_CB_ID : 00740 hdsi->EndOfRefreshCallback = HAL_DSI_EndOfRefreshCallback; /* Legacy weak EndOfRefreshCallback */ 00741 break; 00742 00743 case HAL_DSI_ERROR_CB_ID : 00744 hdsi->ErrorCallback = HAL_DSI_ErrorCallback; /* Legacy weak ErrorCallback */ 00745 break; 00746 00747 case HAL_DSI_MSPINIT_CB_ID : 00748 hdsi->MspInitCallback = HAL_DSI_MspInit; /* Legacy weak MspInit Callback */ 00749 break; 00750 00751 case HAL_DSI_MSPDEINIT_CB_ID : 00752 hdsi->MspDeInitCallback = HAL_DSI_MspDeInit; /* Legacy weak MspDeInit Callback */ 00753 break; 00754 00755 default : 00756 /* Update the error code */ 00757 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00758 /* Return error status */ 00759 status = HAL_ERROR; 00760 break; 00761 } 00762 } 00763 else if (hdsi->State == HAL_DSI_STATE_RESET) 00764 { 00765 switch (CallbackID) 00766 { 00767 case HAL_DSI_MSPINIT_CB_ID : 00768 hdsi->MspInitCallback = HAL_DSI_MspInit; /* Legacy weak MspInit Callback */ 00769 break; 00770 00771 case HAL_DSI_MSPDEINIT_CB_ID : 00772 hdsi->MspDeInitCallback = HAL_DSI_MspDeInit; /* Legacy weak MspDeInit Callback */ 00773 break; 00774 00775 default : 00776 /* Update the error code */ 00777 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00778 /* Return error status */ 00779 status = HAL_ERROR; 00780 break; 00781 } 00782 } 00783 else 00784 { 00785 /* Update the error code */ 00786 hdsi->ErrorCode |= HAL_DSI_ERROR_INVALID_CALLBACK; 00787 /* Return error status */ 00788 status = HAL_ERROR; 00789 } 00790 00791 /* Release Lock */ 00792 __HAL_UNLOCK(hdsi); 00793 00794 return status; 00795 } 00796 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00797 00798 /** 00799 * @} 00800 */ 00801 00802 /** @defgroup DSI_Group2 IO operation functions 00803 * @brief IO operation functions 00804 * 00805 @verbatim 00806 =============================================================================== 00807 ##### IO operation functions ##### 00808 =============================================================================== 00809 [..] This section provides function allowing to: 00810 (+) Handle DSI interrupt request 00811 00812 @endverbatim 00813 * @{ 00814 */ 00815 /** 00816 * @brief Handles DSI interrupt request. 00817 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00818 * the configuration information for the DSI. 00819 * @retval HAL status 00820 */ 00821 void HAL_DSI_IRQHandler(DSI_HandleTypeDef *hdsi) 00822 { 00823 uint32_t ErrorStatus0; 00824 uint32_t ErrorStatus1; 00825 00826 /* Tearing Effect Interrupt management ***************************************/ 00827 if (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_TE) != 0U) 00828 { 00829 if (__HAL_DSI_GET_IT_SOURCE(hdsi, DSI_IT_TE) != 0U) 00830 { 00831 /* Clear the Tearing Effect Interrupt Flag */ 00832 __HAL_DSI_CLEAR_FLAG(hdsi, DSI_FLAG_TE); 00833 00834 /* Tearing Effect Callback */ 00835 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00836 /*Call registered Tearing Effect callback */ 00837 hdsi->TearingEffectCallback(hdsi); 00838 #else 00839 /*Call legacy Tearing Effect callback*/ 00840 HAL_DSI_TearingEffectCallback(hdsi); 00841 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00842 } 00843 } 00844 00845 /* End of Refresh Interrupt management ***************************************/ 00846 if (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_ER) != 0U) 00847 { 00848 if (__HAL_DSI_GET_IT_SOURCE(hdsi, DSI_IT_ER) != 0U) 00849 { 00850 /* Clear the End of Refresh Interrupt Flag */ 00851 __HAL_DSI_CLEAR_FLAG(hdsi, DSI_FLAG_ER); 00852 00853 /* End of Refresh Callback */ 00854 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00855 /*Call registered End of refresh callback */ 00856 hdsi->EndOfRefreshCallback(hdsi); 00857 #else 00858 /*Call Legacy End of refresh callback */ 00859 HAL_DSI_EndOfRefreshCallback(hdsi); 00860 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00861 } 00862 } 00863 00864 /* Error Interrupts management ***********************************************/ 00865 if (hdsi->ErrorMsk != 0U) 00866 { 00867 ErrorStatus0 = hdsi->Instance->ISR[0U]; 00868 ErrorStatus0 &= hdsi->Instance->IER[0U]; 00869 ErrorStatus1 = hdsi->Instance->ISR[1U]; 00870 ErrorStatus1 &= hdsi->Instance->IER[1U]; 00871 00872 if ((ErrorStatus0 & DSI_ERROR_ACK_MASK) != 0U) 00873 { 00874 hdsi->ErrorCode |= HAL_DSI_ERROR_ACK; 00875 } 00876 00877 if ((ErrorStatus0 & DSI_ERROR_PHY_MASK) != 0U) 00878 { 00879 hdsi->ErrorCode |= HAL_DSI_ERROR_PHY; 00880 } 00881 00882 if ((ErrorStatus1 & DSI_ERROR_TX_MASK) != 0U) 00883 { 00884 hdsi->ErrorCode |= HAL_DSI_ERROR_TX; 00885 } 00886 00887 if ((ErrorStatus1 & DSI_ERROR_RX_MASK) != 0U) 00888 { 00889 hdsi->ErrorCode |= HAL_DSI_ERROR_RX; 00890 } 00891 00892 if ((ErrorStatus1 & DSI_ERROR_ECC_MASK) != 0U) 00893 { 00894 hdsi->ErrorCode |= HAL_DSI_ERROR_ECC; 00895 } 00896 00897 if ((ErrorStatus1 & DSI_ERROR_CRC_MASK) != 0U) 00898 { 00899 hdsi->ErrorCode |= HAL_DSI_ERROR_CRC; 00900 } 00901 00902 if ((ErrorStatus1 & DSI_ERROR_PSE_MASK) != 0U) 00903 { 00904 hdsi->ErrorCode |= HAL_DSI_ERROR_PSE; 00905 } 00906 00907 if ((ErrorStatus1 & DSI_ERROR_EOT_MASK) != 0U) 00908 { 00909 hdsi->ErrorCode |= HAL_DSI_ERROR_EOT; 00910 } 00911 00912 if ((ErrorStatus1 & DSI_ERROR_OVF_MASK) != 0U) 00913 { 00914 hdsi->ErrorCode |= HAL_DSI_ERROR_OVF; 00915 } 00916 00917 if ((ErrorStatus1 & DSI_ERROR_GEN_MASK) != 0U) 00918 { 00919 hdsi->ErrorCode |= HAL_DSI_ERROR_GEN; 00920 } 00921 00922 /* Check only selected errors */ 00923 if (hdsi->ErrorCode != HAL_DSI_ERROR_NONE) 00924 { 00925 /* DSI error interrupt callback */ 00926 #if (USE_HAL_DSI_REGISTER_CALLBACKS == 1) 00927 /*Call registered Error callback */ 00928 hdsi->ErrorCallback(hdsi); 00929 #else 00930 /*Call Legacy Error callback */ 00931 HAL_DSI_ErrorCallback(hdsi); 00932 #endif /* USE_HAL_DSI_REGISTER_CALLBACKS */ 00933 } 00934 } 00935 } 00936 00937 /** 00938 * @brief Tearing Effect DSI callback. 00939 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00940 * the configuration information for the DSI. 00941 * @retval None 00942 */ 00943 __weak void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef *hdsi) 00944 { 00945 /* Prevent unused argument(s) compilation warning */ 00946 UNUSED(hdsi); 00947 /* NOTE : This function Should not be modified, when the callback is needed, 00948 the HAL_DSI_TearingEffectCallback could be implemented in the user file 00949 */ 00950 } 00951 00952 /** 00953 * @brief End of Refresh DSI callback. 00954 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00955 * the configuration information for the DSI. 00956 * @retval None 00957 */ 00958 __weak void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi) 00959 { 00960 /* Prevent unused argument(s) compilation warning */ 00961 UNUSED(hdsi); 00962 /* NOTE : This function Should not be modified, when the callback is needed, 00963 the HAL_DSI_EndOfRefreshCallback could be implemented in the user file 00964 */ 00965 } 00966 00967 /** 00968 * @brief Operation Error DSI callback. 00969 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 00970 * the configuration information for the DSI. 00971 * @retval None 00972 */ 00973 __weak void HAL_DSI_ErrorCallback(DSI_HandleTypeDef *hdsi) 00974 { 00975 /* Prevent unused argument(s) compilation warning */ 00976 UNUSED(hdsi); 00977 /* NOTE : This function Should not be modified, when the callback is needed, 00978 the HAL_DSI_ErrorCallback could be implemented in the user file 00979 */ 00980 } 00981 00982 /** 00983 * @} 00984 */ 00985 00986 /** @defgroup DSI_Group3 Peripheral Control functions 00987 * @brief Peripheral Control functions 00988 * 00989 @verbatim 00990 =============================================================================== 00991 ##### Peripheral Control functions ##### 00992 =============================================================================== 00993 [..] This section provides functions allowing to: 00994 (+) Configure the Generic interface read-back Virtual Channel ID 00995 (+) Select video mode and configure the corresponding parameters 00996 (+) Configure command transmission mode: High-speed or Low-power 00997 (+) Configure the flow control 00998 (+) Configure the DSI PHY timer 00999 (+) Configure the DSI HOST timeout 01000 (+) Configure the DSI HOST timeout 01001 (+) Start/Stop the DSI module 01002 (+) Refresh the display in command mode 01003 (+) Controls the display color mode in Video mode 01004 (+) Control the display shutdown in Video mode 01005 (+) write short DCS or short Generic command 01006 (+) write long DCS or long Generic command 01007 (+) Read command (DCS or generic) 01008 (+) Enter/Exit the Ultra Low Power Mode on data only (D-PHY PLL running) 01009 (+) Enter/Exit the Ultra Low Power Mode on data only and clock (D-PHY PLL turned off) 01010 (+) Start/Stop test pattern generation 01011 (+) Slew-Rate And Delay Tuning 01012 (+) Low-Power Reception Filter Tuning 01013 (+) Activate an additional current path on all lanes to meet the SDDTx parameter 01014 (+) Custom lane pins configuration 01015 (+) Set custom timing for the PHY 01016 (+) Force the Clock/Data Lane in TX Stop Mode 01017 (+) Force LP Receiver in Low-Power Mode 01018 (+) Force Data Lanes in RX Mode after a BTA 01019 (+) Enable a pull-down on the lanes to prevent from floating states when unused 01020 (+) Switch off the contention detection on data lanes 01021 01022 @endverbatim 01023 * @{ 01024 */ 01025 01026 /** 01027 * @brief Configure the Generic interface read-back Virtual Channel ID. 01028 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01029 * the configuration information for the DSI. 01030 * @param VirtualChannelID Virtual channel ID 01031 * @retval HAL status 01032 */ 01033 HAL_StatusTypeDef HAL_DSI_SetGenericVCID(DSI_HandleTypeDef *hdsi, uint32_t VirtualChannelID) 01034 { 01035 /* Process locked */ 01036 __HAL_LOCK(hdsi); 01037 01038 /* Update the GVCID register */ 01039 hdsi->Instance->GVCIDR &= ~DSI_GVCIDR_VCID; 01040 hdsi->Instance->GVCIDR |= VirtualChannelID; 01041 01042 /* Process unlocked */ 01043 __HAL_UNLOCK(hdsi); 01044 01045 return HAL_OK; 01046 } 01047 01048 /** 01049 * @brief Select video mode and configure the corresponding parameters 01050 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01051 * the configuration information for the DSI. 01052 * @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains 01053 * the DSI video mode configuration parameters 01054 * @retval HAL status 01055 */ 01056 HAL_StatusTypeDef HAL_DSI_ConfigVideoMode(DSI_HandleTypeDef *hdsi, DSI_VidCfgTypeDef *VidCfg) 01057 { 01058 /* Process locked */ 01059 __HAL_LOCK(hdsi); 01060 01061 /* Check the parameters */ 01062 assert_param(IS_DSI_COLOR_CODING(VidCfg->ColorCoding)); 01063 assert_param(IS_DSI_VIDEO_MODE_TYPE(VidCfg->Mode)); 01064 assert_param(IS_DSI_LP_COMMAND(VidCfg->LPCommandEnable)); 01065 assert_param(IS_DSI_LP_HFP(VidCfg->LPHorizontalFrontPorchEnable)); 01066 assert_param(IS_DSI_LP_HBP(VidCfg->LPHorizontalBackPorchEnable)); 01067 assert_param(IS_DSI_LP_VACTIVE(VidCfg->LPVerticalActiveEnable)); 01068 assert_param(IS_DSI_LP_VFP(VidCfg->LPVerticalFrontPorchEnable)); 01069 assert_param(IS_DSI_LP_VBP(VidCfg->LPVerticalBackPorchEnable)); 01070 assert_param(IS_DSI_LP_VSYNC(VidCfg->LPVerticalSyncActiveEnable)); 01071 assert_param(IS_DSI_FBTAA(VidCfg->FrameBTAAcknowledgeEnable)); 01072 assert_param(IS_DSI_DE_POLARITY(VidCfg->DEPolarity)); 01073 assert_param(IS_DSI_VSYNC_POLARITY(VidCfg->VSPolarity)); 01074 assert_param(IS_DSI_HSYNC_POLARITY(VidCfg->HSPolarity)); 01075 /* Check the LooselyPacked variant only in 18-bit mode */ 01076 if (VidCfg->ColorCoding == DSI_RGB666) 01077 { 01078 assert_param(IS_DSI_LOOSELY_PACKED(VidCfg->LooselyPacked)); 01079 } 01080 01081 /* Select video mode by resetting CMDM and DSIM bits */ 01082 hdsi->Instance->MCR &= ~DSI_MCR_CMDM; 01083 hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM; 01084 01085 /* Configure the video mode transmission type */ 01086 hdsi->Instance->VMCR &= ~DSI_VMCR_VMT; 01087 hdsi->Instance->VMCR |= VidCfg->Mode; 01088 01089 /* Configure the video packet size */ 01090 hdsi->Instance->VPCR &= ~DSI_VPCR_VPSIZE; 01091 hdsi->Instance->VPCR |= VidCfg->PacketSize; 01092 01093 /* Set the chunks number to be transmitted through the DSI link */ 01094 hdsi->Instance->VCCR &= ~DSI_VCCR_NUMC; 01095 hdsi->Instance->VCCR |= VidCfg->NumberOfChunks; 01096 01097 /* Set the size of the null packet */ 01098 hdsi->Instance->VNPCR &= ~DSI_VNPCR_NPSIZE; 01099 hdsi->Instance->VNPCR |= VidCfg->NullPacketSize; 01100 01101 /* Select the virtual channel for the LTDC interface traffic */ 01102 hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID; 01103 hdsi->Instance->LVCIDR |= VidCfg->VirtualChannelID; 01104 01105 /* Configure the polarity of control signals */ 01106 hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP); 01107 hdsi->Instance->LPCR |= (VidCfg->DEPolarity | VidCfg->VSPolarity | VidCfg->HSPolarity); 01108 01109 /* Select the color coding for the host */ 01110 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC; 01111 hdsi->Instance->LCOLCR |= VidCfg->ColorCoding; 01112 01113 /* Select the color coding for the wrapper */ 01114 hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX; 01115 hdsi->Instance->WCFGR |= ((VidCfg->ColorCoding) << 1U); 01116 01117 /* Enable/disable the loosely packed variant to 18-bit configuration */ 01118 if (VidCfg->ColorCoding == DSI_RGB666) 01119 { 01120 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_LPE; 01121 hdsi->Instance->LCOLCR |= VidCfg->LooselyPacked; 01122 } 01123 01124 /* Set the Horizontal Synchronization Active (HSA) in lane byte clock cycles */ 01125 hdsi->Instance->VHSACR &= ~DSI_VHSACR_HSA; 01126 hdsi->Instance->VHSACR |= VidCfg->HorizontalSyncActive; 01127 01128 /* Set the Horizontal Back Porch (HBP) in lane byte clock cycles */ 01129 hdsi->Instance->VHBPCR &= ~DSI_VHBPCR_HBP; 01130 hdsi->Instance->VHBPCR |= VidCfg->HorizontalBackPorch; 01131 01132 /* Set the total line time (HLINE=HSA+HBP+HACT+HFP) in lane byte clock cycles */ 01133 hdsi->Instance->VLCR &= ~DSI_VLCR_HLINE; 01134 hdsi->Instance->VLCR |= VidCfg->HorizontalLine; 01135 01136 /* Set the Vertical Synchronization Active (VSA) */ 01137 hdsi->Instance->VVSACR &= ~DSI_VVSACR_VSA; 01138 hdsi->Instance->VVSACR |= VidCfg->VerticalSyncActive; 01139 01140 /* Set the Vertical Back Porch (VBP)*/ 01141 hdsi->Instance->VVBPCR &= ~DSI_VVBPCR_VBP; 01142 hdsi->Instance->VVBPCR |= VidCfg->VerticalBackPorch; 01143 01144 /* Set the Vertical Front Porch (VFP)*/ 01145 hdsi->Instance->VVFPCR &= ~DSI_VVFPCR_VFP; 01146 hdsi->Instance->VVFPCR |= VidCfg->VerticalFrontPorch; 01147 01148 /* Set the Vertical Active period*/ 01149 hdsi->Instance->VVACR &= ~DSI_VVACR_VA; 01150 hdsi->Instance->VVACR |= VidCfg->VerticalActive; 01151 01152 /* Configure the command transmission mode */ 01153 hdsi->Instance->VMCR &= ~DSI_VMCR_LPCE; 01154 hdsi->Instance->VMCR |= VidCfg->LPCommandEnable; 01155 01156 /* Low power largest packet size */ 01157 hdsi->Instance->LPMCR &= ~DSI_LPMCR_LPSIZE; 01158 hdsi->Instance->LPMCR |= ((VidCfg->LPLargestPacketSize) << 16U); 01159 01160 /* Low power VACT largest packet size */ 01161 hdsi->Instance->LPMCR &= ~DSI_LPMCR_VLPSIZE; 01162 hdsi->Instance->LPMCR |= VidCfg->LPVACTLargestPacketSize; 01163 01164 /* Enable LP transition in HFP period */ 01165 hdsi->Instance->VMCR &= ~DSI_VMCR_LPHFPE; 01166 hdsi->Instance->VMCR |= VidCfg->LPHorizontalFrontPorchEnable; 01167 01168 /* Enable LP transition in HBP period */ 01169 hdsi->Instance->VMCR &= ~DSI_VMCR_LPHBPE; 01170 hdsi->Instance->VMCR |= VidCfg->LPHorizontalBackPorchEnable; 01171 01172 /* Enable LP transition in VACT period */ 01173 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVAE; 01174 hdsi->Instance->VMCR |= VidCfg->LPVerticalActiveEnable; 01175 01176 /* Enable LP transition in VFP period */ 01177 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVFPE; 01178 hdsi->Instance->VMCR |= VidCfg->LPVerticalFrontPorchEnable; 01179 01180 /* Enable LP transition in VBP period */ 01181 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVBPE; 01182 hdsi->Instance->VMCR |= VidCfg->LPVerticalBackPorchEnable; 01183 01184 /* Enable LP transition in vertical sync period */ 01185 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVSAE; 01186 hdsi->Instance->VMCR |= VidCfg->LPVerticalSyncActiveEnable; 01187 01188 /* Enable the request for an acknowledge response at the end of a frame */ 01189 hdsi->Instance->VMCR &= ~DSI_VMCR_FBTAAE; 01190 hdsi->Instance->VMCR |= VidCfg->FrameBTAAcknowledgeEnable; 01191 01192 /* Process unlocked */ 01193 __HAL_UNLOCK(hdsi); 01194 01195 return HAL_OK; 01196 } 01197 01198 /** 01199 * @brief Select adapted command mode and configure the corresponding parameters 01200 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01201 * the configuration information for the DSI. 01202 * @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains 01203 * the DSI command mode configuration parameters 01204 * @retval HAL status 01205 */ 01206 HAL_StatusTypeDef HAL_DSI_ConfigAdaptedCommandMode(DSI_HandleTypeDef *hdsi, DSI_CmdCfgTypeDef *CmdCfg) 01207 { 01208 /* Process locked */ 01209 __HAL_LOCK(hdsi); 01210 01211 /* Check the parameters */ 01212 assert_param(IS_DSI_COLOR_CODING(CmdCfg->ColorCoding)); 01213 assert_param(IS_DSI_TE_SOURCE(CmdCfg->TearingEffectSource)); 01214 assert_param(IS_DSI_TE_POLARITY(CmdCfg->TearingEffectPolarity)); 01215 assert_param(IS_DSI_AUTOMATIC_REFRESH(CmdCfg->AutomaticRefresh)); 01216 assert_param(IS_DSI_VS_POLARITY(CmdCfg->VSyncPol)); 01217 assert_param(IS_DSI_TE_ACK_REQUEST(CmdCfg->TEAcknowledgeRequest)); 01218 assert_param(IS_DSI_DE_POLARITY(CmdCfg->DEPolarity)); 01219 assert_param(IS_DSI_VSYNC_POLARITY(CmdCfg->VSPolarity)); 01220 assert_param(IS_DSI_HSYNC_POLARITY(CmdCfg->HSPolarity)); 01221 01222 /* Select command mode by setting CMDM and DSIM bits */ 01223 hdsi->Instance->MCR |= DSI_MCR_CMDM; 01224 hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM; 01225 hdsi->Instance->WCFGR |= DSI_WCFGR_DSIM; 01226 01227 /* Select the virtual channel for the LTDC interface traffic */ 01228 hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID; 01229 hdsi->Instance->LVCIDR |= CmdCfg->VirtualChannelID; 01230 01231 /* Configure the polarity of control signals */ 01232 hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP); 01233 hdsi->Instance->LPCR |= (CmdCfg->DEPolarity | CmdCfg->VSPolarity | CmdCfg->HSPolarity); 01234 01235 /* Select the color coding for the host */ 01236 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC; 01237 hdsi->Instance->LCOLCR |= CmdCfg->ColorCoding; 01238 01239 /* Select the color coding for the wrapper */ 01240 hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX; 01241 hdsi->Instance->WCFGR |= ((CmdCfg->ColorCoding) << 1U); 01242 01243 /* Configure the maximum allowed size for write memory command */ 01244 hdsi->Instance->LCCR &= ~DSI_LCCR_CMDSIZE; 01245 hdsi->Instance->LCCR |= CmdCfg->CommandSize; 01246 01247 /* Configure the tearing effect source and polarity and select the refresh mode */ 01248 hdsi->Instance->WCFGR &= ~(DSI_WCFGR_TESRC | DSI_WCFGR_TEPOL | DSI_WCFGR_AR | DSI_WCFGR_VSPOL); 01249 hdsi->Instance->WCFGR |= (CmdCfg->TearingEffectSource | CmdCfg->TearingEffectPolarity | CmdCfg->AutomaticRefresh | 01250 CmdCfg->VSyncPol); 01251 01252 /* Configure the tearing effect acknowledge request */ 01253 hdsi->Instance->CMCR &= ~DSI_CMCR_TEARE; 01254 hdsi->Instance->CMCR |= CmdCfg->TEAcknowledgeRequest; 01255 01256 /* Enable the Tearing Effect interrupt */ 01257 __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_TE); 01258 01259 /* Enable the End of Refresh interrupt */ 01260 __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_ER); 01261 01262 /* Process unlocked */ 01263 __HAL_UNLOCK(hdsi); 01264 01265 return HAL_OK; 01266 } 01267 01268 /** 01269 * @brief Configure command transmission mode: High-speed or Low-power 01270 * and enable/disable acknowledge request after packet transmission 01271 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01272 * the configuration information for the DSI. 01273 * @param LPCmd pointer to a DSI_LPCmdTypeDef structure that contains 01274 * the DSI command transmission mode configuration parameters 01275 * @retval HAL status 01276 */ 01277 HAL_StatusTypeDef HAL_DSI_ConfigCommand(DSI_HandleTypeDef *hdsi, DSI_LPCmdTypeDef *LPCmd) 01278 { 01279 /* Process locked */ 01280 __HAL_LOCK(hdsi); 01281 01282 assert_param(IS_DSI_LP_GSW0P(LPCmd->LPGenShortWriteNoP)); 01283 assert_param(IS_DSI_LP_GSW1P(LPCmd->LPGenShortWriteOneP)); 01284 assert_param(IS_DSI_LP_GSW2P(LPCmd->LPGenShortWriteTwoP)); 01285 assert_param(IS_DSI_LP_GSR0P(LPCmd->LPGenShortReadNoP)); 01286 assert_param(IS_DSI_LP_GSR1P(LPCmd->LPGenShortReadOneP)); 01287 assert_param(IS_DSI_LP_GSR2P(LPCmd->LPGenShortReadTwoP)); 01288 assert_param(IS_DSI_LP_GLW(LPCmd->LPGenLongWrite)); 01289 assert_param(IS_DSI_LP_DSW0P(LPCmd->LPDcsShortWriteNoP)); 01290 assert_param(IS_DSI_LP_DSW1P(LPCmd->LPDcsShortWriteOneP)); 01291 assert_param(IS_DSI_LP_DSR0P(LPCmd->LPDcsShortReadNoP)); 01292 assert_param(IS_DSI_LP_DLW(LPCmd->LPDcsLongWrite)); 01293 assert_param(IS_DSI_LP_MRDP(LPCmd->LPMaxReadPacket)); 01294 assert_param(IS_DSI_ACK_REQUEST(LPCmd->AcknowledgeRequest)); 01295 01296 /* Select High-speed or Low-power for command transmission */ 01297 hdsi->Instance->CMCR &= ~(DSI_CMCR_GSW0TX | \ 01298 DSI_CMCR_GSW1TX | \ 01299 DSI_CMCR_GSW2TX | \ 01300 DSI_CMCR_GSR0TX | \ 01301 DSI_CMCR_GSR1TX | \ 01302 DSI_CMCR_GSR2TX | \ 01303 DSI_CMCR_GLWTX | \ 01304 DSI_CMCR_DSW0TX | \ 01305 DSI_CMCR_DSW1TX | \ 01306 DSI_CMCR_DSR0TX | \ 01307 DSI_CMCR_DLWTX | \ 01308 DSI_CMCR_MRDPS); 01309 hdsi->Instance->CMCR |= (LPCmd->LPGenShortWriteNoP | \ 01310 LPCmd->LPGenShortWriteOneP | \ 01311 LPCmd->LPGenShortWriteTwoP | \ 01312 LPCmd->LPGenShortReadNoP | \ 01313 LPCmd->LPGenShortReadOneP | \ 01314 LPCmd->LPGenShortReadTwoP | \ 01315 LPCmd->LPGenLongWrite | \ 01316 LPCmd->LPDcsShortWriteNoP | \ 01317 LPCmd->LPDcsShortWriteOneP | \ 01318 LPCmd->LPDcsShortReadNoP | \ 01319 LPCmd->LPDcsLongWrite | \ 01320 LPCmd->LPMaxReadPacket); 01321 01322 /* Configure the acknowledge request after each packet transmission */ 01323 hdsi->Instance->CMCR &= ~DSI_CMCR_ARE; 01324 hdsi->Instance->CMCR |= LPCmd->AcknowledgeRequest; 01325 01326 /* Process unlocked */ 01327 __HAL_UNLOCK(hdsi); 01328 01329 return HAL_OK; 01330 } 01331 01332 /** 01333 * @brief Configure the flow control parameters 01334 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01335 * the configuration information for the DSI. 01336 * @param FlowControl flow control feature(s) to be enabled. 01337 * This parameter can be any combination of @arg DSI_FlowControl. 01338 * @retval HAL status 01339 */ 01340 HAL_StatusTypeDef HAL_DSI_ConfigFlowControl(DSI_HandleTypeDef *hdsi, uint32_t FlowControl) 01341 { 01342 /* Process locked */ 01343 __HAL_LOCK(hdsi); 01344 01345 /* Check the parameters */ 01346 assert_param(IS_DSI_FLOW_CONTROL(FlowControl)); 01347 01348 /* Set the DSI Host Protocol Configuration Register */ 01349 hdsi->Instance->PCR &= ~DSI_FLOW_CONTROL_ALL; 01350 hdsi->Instance->PCR |= FlowControl; 01351 01352 /* Process unlocked */ 01353 __HAL_UNLOCK(hdsi); 01354 01355 return HAL_OK; 01356 } 01357 01358 /** 01359 * @brief Configure the DSI PHY timer parameters 01360 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01361 * the configuration information for the DSI. 01362 * @param PhyTimers DSI_PHY_TimerTypeDef structure that contains 01363 * the DSI PHY timing parameters 01364 * @retval HAL status 01365 */ 01366 HAL_StatusTypeDef HAL_DSI_ConfigPhyTimer(DSI_HandleTypeDef *hdsi, DSI_PHY_TimerTypeDef *PhyTimers) 01367 { 01368 uint32_t maxTime; 01369 /* Process locked */ 01370 __HAL_LOCK(hdsi); 01371 01372 maxTime = (PhyTimers->ClockLaneLP2HSTime > PhyTimers->ClockLaneHS2LPTime) ? PhyTimers->ClockLaneLP2HSTime : 01373 PhyTimers->ClockLaneHS2LPTime; 01374 01375 /* Clock lane timer configuration */ 01376 01377 /* In Automatic Clock Lane control mode, the DSI Host can turn off the clock lane between two 01378 High-Speed transmission. 01379 To do so, the DSI Host calculates the time required for the clock lane to change from HighSpeed 01380 to Low-Power and from Low-Power to High-Speed. 01381 This timings are configured by the HS2LP_TIME and LP2HS_TIME in the DSI Host Clock Lane Timer Configuration 01382 Register (DSI_CLTCR). 01383 But the DSI Host is not calculating LP2HS_TIME + HS2LP_TIME but 2 x HS2LP_TIME. 01384 01385 Workaround : Configure HS2LP_TIME and LP2HS_TIME with the same value being the max of HS2LP_TIME or LP2HS_TIME. 01386 */ 01387 hdsi->Instance->CLTCR &= ~(DSI_CLTCR_LP2HS_TIME | DSI_CLTCR_HS2LP_TIME); 01388 hdsi->Instance->CLTCR |= (maxTime | ((maxTime) << 16U)); 01389 01390 /* Data lane timer configuration */ 01391 hdsi->Instance->DLTCR &= ~(DSI_DLTCR_MRD_TIME | DSI_DLTCR_LP2HS_TIME | DSI_DLTCR_HS2LP_TIME); 01392 hdsi->Instance->DLTCR |= (PhyTimers->DataLaneMaxReadTime | ((PhyTimers->DataLaneLP2HSTime) << 16U) | (( 01393 PhyTimers->DataLaneHS2LPTime) << 24U)); 01394 01395 /* Configure the wait period to request HS transmission after a stop state */ 01396 hdsi->Instance->PCONFR &= ~DSI_PCONFR_SW_TIME; 01397 hdsi->Instance->PCONFR |= ((PhyTimers->StopWaitTime) << 8U); 01398 01399 /* Process unlocked */ 01400 __HAL_UNLOCK(hdsi); 01401 01402 return HAL_OK; 01403 } 01404 01405 /** 01406 * @brief Configure the DSI HOST timeout parameters 01407 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01408 * the configuration information for the DSI. 01409 * @param HostTimeouts DSI_HOST_TimeoutTypeDef structure that contains 01410 * the DSI host timeout parameters 01411 * @retval HAL status 01412 */ 01413 HAL_StatusTypeDef HAL_DSI_ConfigHostTimeouts(DSI_HandleTypeDef *hdsi, DSI_HOST_TimeoutTypeDef *HostTimeouts) 01414 { 01415 /* Process locked */ 01416 __HAL_LOCK(hdsi); 01417 01418 /* Set the timeout clock division factor */ 01419 hdsi->Instance->CCR &= ~DSI_CCR_TOCKDIV; 01420 hdsi->Instance->CCR |= ((HostTimeouts->TimeoutCkdiv) << 8U); 01421 01422 /* High-speed transmission timeout */ 01423 hdsi->Instance->TCCR[0U] &= ~DSI_TCCR0_HSTX_TOCNT; 01424 hdsi->Instance->TCCR[0U] |= ((HostTimeouts->HighSpeedTransmissionTimeout) << 16U); 01425 01426 /* Low-power reception timeout */ 01427 hdsi->Instance->TCCR[0U] &= ~DSI_TCCR0_LPRX_TOCNT; 01428 hdsi->Instance->TCCR[0U] |= HostTimeouts->LowPowerReceptionTimeout; 01429 01430 /* High-speed read timeout */ 01431 hdsi->Instance->TCCR[1U] &= ~DSI_TCCR1_HSRD_TOCNT; 01432 hdsi->Instance->TCCR[1U] |= HostTimeouts->HighSpeedReadTimeout; 01433 01434 /* Low-power read timeout */ 01435 hdsi->Instance->TCCR[2U] &= ~DSI_TCCR2_LPRD_TOCNT; 01436 hdsi->Instance->TCCR[2U] |= HostTimeouts->LowPowerReadTimeout; 01437 01438 /* High-speed write timeout */ 01439 hdsi->Instance->TCCR[3U] &= ~DSI_TCCR3_HSWR_TOCNT; 01440 hdsi->Instance->TCCR[3U] |= HostTimeouts->HighSpeedWriteTimeout; 01441 01442 /* High-speed write presp mode */ 01443 hdsi->Instance->TCCR[3U] &= ~DSI_TCCR3_PM; 01444 hdsi->Instance->TCCR[3U] |= HostTimeouts->HighSpeedWritePrespMode; 01445 01446 /* Low-speed write timeout */ 01447 hdsi->Instance->TCCR[4U] &= ~DSI_TCCR4_LPWR_TOCNT; 01448 hdsi->Instance->TCCR[4U] |= HostTimeouts->LowPowerWriteTimeout; 01449 01450 /* BTA timeout */ 01451 hdsi->Instance->TCCR[5U] &= ~DSI_TCCR5_BTA_TOCNT; 01452 hdsi->Instance->TCCR[5U] |= HostTimeouts->BTATimeout; 01453 01454 /* Process unlocked */ 01455 __HAL_UNLOCK(hdsi); 01456 01457 return HAL_OK; 01458 } 01459 01460 /** 01461 * @brief Start the DSI module 01462 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01463 * the configuration information for the DSI. 01464 * @retval HAL status 01465 */ 01466 HAL_StatusTypeDef HAL_DSI_Start(DSI_HandleTypeDef *hdsi) 01467 { 01468 /* Process locked */ 01469 __HAL_LOCK(hdsi); 01470 01471 /* Enable the DSI host */ 01472 __HAL_DSI_ENABLE(hdsi); 01473 01474 /* Enable the DSI wrapper */ 01475 __HAL_DSI_WRAPPER_ENABLE(hdsi); 01476 01477 /* Process unlocked */ 01478 __HAL_UNLOCK(hdsi); 01479 01480 return HAL_OK; 01481 } 01482 01483 /** 01484 * @brief Stop the DSI module 01485 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01486 * the configuration information for the DSI. 01487 * @retval HAL status 01488 */ 01489 HAL_StatusTypeDef HAL_DSI_Stop(DSI_HandleTypeDef *hdsi) 01490 { 01491 /* Process locked */ 01492 __HAL_LOCK(hdsi); 01493 01494 /* Disable the DSI host */ 01495 __HAL_DSI_DISABLE(hdsi); 01496 01497 /* Disable the DSI wrapper */ 01498 __HAL_DSI_WRAPPER_DISABLE(hdsi); 01499 01500 /* Process unlocked */ 01501 __HAL_UNLOCK(hdsi); 01502 01503 return HAL_OK; 01504 } 01505 01506 /** 01507 * @brief Refresh the display in command mode 01508 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01509 * the configuration information for the DSI. 01510 * @retval HAL status 01511 */ 01512 HAL_StatusTypeDef HAL_DSI_Refresh(DSI_HandleTypeDef *hdsi) 01513 { 01514 /* Process locked */ 01515 __HAL_LOCK(hdsi); 01516 01517 /* Update the display */ 01518 hdsi->Instance->WCR |= DSI_WCR_LTDCEN; 01519 01520 /* Process unlocked */ 01521 __HAL_UNLOCK(hdsi); 01522 01523 return HAL_OK; 01524 } 01525 01526 /** 01527 * @brief Controls the display color mode in Video mode 01528 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01529 * the configuration information for the DSI. 01530 * @param ColorMode Color mode (full or 8-colors). 01531 * This parameter can be any value of @arg DSI_Color_Mode 01532 * @retval HAL status 01533 */ 01534 HAL_StatusTypeDef HAL_DSI_ColorMode(DSI_HandleTypeDef *hdsi, uint32_t ColorMode) 01535 { 01536 /* Process locked */ 01537 __HAL_LOCK(hdsi); 01538 01539 /* Check the parameters */ 01540 assert_param(IS_DSI_COLOR_MODE(ColorMode)); 01541 01542 /* Update the display color mode */ 01543 hdsi->Instance->WCR &= ~DSI_WCR_COLM; 01544 hdsi->Instance->WCR |= ColorMode; 01545 01546 /* Process unlocked */ 01547 __HAL_UNLOCK(hdsi); 01548 01549 return HAL_OK; 01550 } 01551 01552 /** 01553 * @brief Control the display shutdown in Video mode 01554 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01555 * the configuration information for the DSI. 01556 * @param Shutdown Shut-down (Display-ON or Display-OFF). 01557 * This parameter can be any value of @arg DSI_ShutDown 01558 * @retval HAL status 01559 */ 01560 HAL_StatusTypeDef HAL_DSI_Shutdown(DSI_HandleTypeDef *hdsi, uint32_t Shutdown) 01561 { 01562 /* Process locked */ 01563 __HAL_LOCK(hdsi); 01564 01565 /* Check the parameters */ 01566 assert_param(IS_DSI_SHUT_DOWN(Shutdown)); 01567 01568 /* Update the display Shutdown */ 01569 hdsi->Instance->WCR &= ~DSI_WCR_SHTDN; 01570 hdsi->Instance->WCR |= Shutdown; 01571 01572 /* Process unlocked */ 01573 __HAL_UNLOCK(hdsi); 01574 01575 return HAL_OK; 01576 } 01577 01578 /** 01579 * @brief write short DCS or short Generic command 01580 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01581 * the configuration information for the DSI. 01582 * @param ChannelID Virtual channel ID. 01583 * @param Mode DSI short packet data type. 01584 * This parameter can be any value of @arg DSI_SHORT_WRITE_PKT_Data_Type. 01585 * @param Param1 DSC command or first generic parameter. 01586 * This parameter can be any value of @arg DSI_DCS_Command or a 01587 * generic command code. 01588 * @param Param2 DSC parameter or second generic parameter. 01589 * @retval HAL status 01590 */ 01591 HAL_StatusTypeDef HAL_DSI_ShortWrite(DSI_HandleTypeDef *hdsi, 01592 uint32_t ChannelID, 01593 uint32_t Mode, 01594 uint32_t Param1, 01595 uint32_t Param2) 01596 { 01597 HAL_StatusTypeDef status; 01598 /* Check the parameters */ 01599 assert_param(IS_DSI_SHORT_WRITE_PACKET_TYPE(Mode)); 01600 01601 /* Process locked */ 01602 __HAL_LOCK(hdsi); 01603 01604 status = DSI_ShortWrite(hdsi, ChannelID, Mode, Param1, Param2); 01605 01606 /* Process unlocked */ 01607 __HAL_UNLOCK(hdsi); 01608 01609 return status; 01610 } 01611 01612 /** 01613 * @brief write long DCS or long Generic command 01614 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01615 * the configuration information for the DSI. 01616 * @param ChannelID Virtual channel ID. 01617 * @param Mode DSI long packet data type. 01618 * This parameter can be any value of @arg DSI_LONG_WRITE_PKT_Data_Type. 01619 * @param NbParams Number of parameters. 01620 * @param Param1 DSC command or first generic parameter. 01621 * This parameter can be any value of @arg DSI_DCS_Command or a 01622 * generic command code 01623 * @param ParametersTable Pointer to parameter values table. 01624 * @retval HAL status 01625 */ 01626 HAL_StatusTypeDef HAL_DSI_LongWrite(DSI_HandleTypeDef *hdsi, 01627 uint32_t ChannelID, 01628 uint32_t Mode, 01629 uint32_t NbParams, 01630 uint32_t Param1, 01631 uint8_t *ParametersTable) 01632 { 01633 uint32_t uicounter; 01634 uint32_t nbBytes; 01635 uint32_t count; 01636 uint32_t tickstart; 01637 uint32_t fifoword; 01638 uint8_t *pparams = ParametersTable; 01639 01640 /* Process locked */ 01641 __HAL_LOCK(hdsi); 01642 01643 /* Check the parameters */ 01644 assert_param(IS_DSI_LONG_WRITE_PACKET_TYPE(Mode)); 01645 01646 /* Get tick */ 01647 tickstart = HAL_GetTick(); 01648 01649 /* Wait for Command FIFO Empty */ 01650 while ((hdsi->Instance->GPSR & DSI_GPSR_CMDFE) == 0U) 01651 { 01652 /* Check for the Timeout */ 01653 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01654 { 01655 /* Process Unlocked */ 01656 __HAL_UNLOCK(hdsi); 01657 01658 return HAL_TIMEOUT; 01659 } 01660 } 01661 01662 /* Set the DCS code on payload byte 1, and the other parameters on the write FIFO command*/ 01663 fifoword = Param1; 01664 nbBytes = (NbParams < 3U) ? NbParams : 3U; 01665 01666 for (count = 0U; count < nbBytes; count++) 01667 { 01668 fifoword |= (((uint32_t)(*(pparams + count))) << (8U + (8U * count))); 01669 } 01670 hdsi->Instance->GPDR = fifoword; 01671 01672 uicounter = NbParams - nbBytes; 01673 pparams += nbBytes; 01674 /* Set the Next parameters on the write FIFO command*/ 01675 while (uicounter != 0U) 01676 { 01677 nbBytes = (uicounter < 4U) ? uicounter : 4U; 01678 fifoword = 0U; 01679 for (count = 0U; count < nbBytes; count++) 01680 { 01681 fifoword |= (((uint32_t)(*(pparams + count))) << (8U * count)); 01682 } 01683 hdsi->Instance->GPDR = fifoword; 01684 01685 uicounter -= nbBytes; 01686 pparams += nbBytes; 01687 } 01688 01689 /* Configure the packet to send a long DCS command */ 01690 DSI_ConfigPacketHeader(hdsi->Instance, 01691 ChannelID, 01692 Mode, 01693 ((NbParams + 1U) & 0x00FFU), 01694 (((NbParams + 1U) & 0xFF00U) >> 8U)); 01695 01696 /* Process unlocked */ 01697 __HAL_UNLOCK(hdsi); 01698 01699 return HAL_OK; 01700 } 01701 01702 /** 01703 * @brief Read command (DCS or generic) 01704 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01705 * the configuration information for the DSI. 01706 * @param ChannelNbr Virtual channel ID 01707 * @param Array pointer to a buffer to store the payload of a read back operation. 01708 * @param Size Data size to be read (in byte). 01709 * @param Mode DSI read packet data type. 01710 * This parameter can be any value of @arg DSI_SHORT_READ_PKT_Data_Type. 01711 * @param DCSCmd DCS get/read command. 01712 * @param ParametersTable Pointer to parameter values table. 01713 * @retval HAL status 01714 */ 01715 HAL_StatusTypeDef HAL_DSI_Read(DSI_HandleTypeDef *hdsi, 01716 uint32_t ChannelNbr, 01717 uint8_t *Array, 01718 uint32_t Size, 01719 uint32_t Mode, 01720 uint32_t DCSCmd, 01721 uint8_t *ParametersTable) 01722 { 01723 uint32_t tickstart; 01724 uint8_t *pdata = Array; 01725 uint32_t datasize = Size; 01726 uint32_t fifoword; 01727 uint32_t nbbytes; 01728 uint32_t count; 01729 01730 /* Process locked */ 01731 __HAL_LOCK(hdsi); 01732 01733 /* Check the parameters */ 01734 assert_param(IS_DSI_READ_PACKET_TYPE(Mode)); 01735 01736 if (datasize > 2U) 01737 { 01738 /* set max return packet size */ 01739 if (DSI_ShortWrite(hdsi, ChannelNbr, DSI_MAX_RETURN_PKT_SIZE, ((datasize) & 0xFFU), 01740 (((datasize) >> 8U) & 0xFFU)) != HAL_OK) 01741 { 01742 /* Process Unlocked */ 01743 __HAL_UNLOCK(hdsi); 01744 01745 return HAL_ERROR; 01746 } 01747 } 01748 01749 /* Configure the packet to read command */ 01750 if (Mode == DSI_DCS_SHORT_PKT_READ) 01751 { 01752 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, DCSCmd, 0U); 01753 } 01754 else if (Mode == DSI_GEN_SHORT_PKT_READ_P0) 01755 { 01756 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, 0U, 0U); 01757 } 01758 else if (Mode == DSI_GEN_SHORT_PKT_READ_P1) 01759 { 01760 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0U], 0U); 01761 } 01762 else if (Mode == DSI_GEN_SHORT_PKT_READ_P2) 01763 { 01764 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0U], ParametersTable[1U]); 01765 } 01766 else 01767 { 01768 /* Process Unlocked */ 01769 __HAL_UNLOCK(hdsi); 01770 01771 return HAL_ERROR; 01772 } 01773 01774 /* Get tick */ 01775 tickstart = HAL_GetTick(); 01776 01777 /* If DSI fifo is not empty, read requested bytes */ 01778 while (((int32_t)(datasize)) > 0) 01779 { 01780 if ((hdsi->Instance->GPSR & DSI_GPSR_PRDFE) == 0U) 01781 { 01782 fifoword = hdsi->Instance->GPDR; 01783 nbbytes = (datasize < 4U) ? datasize : 4U; 01784 01785 for (count = 0U; count < nbbytes; count++) 01786 { 01787 *pdata = (uint8_t)(fifoword >> (8U * count)); 01788 pdata++; 01789 datasize--; 01790 } 01791 } 01792 01793 /* Check for the Timeout */ 01794 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01795 { 01796 /* Process Unlocked */ 01797 __HAL_UNLOCK(hdsi); 01798 01799 return HAL_TIMEOUT; 01800 } 01801 01802 /* Software workaround to avoid HAL_TIMEOUT when a DSI read command is */ 01803 /* issued to the panel and the read data is not captured by the DSI Host */ 01804 /* which returns Packet Size Error. */ 01805 /* Need to ensure that the Read command has finished before checking PSE */ 01806 if ((hdsi->Instance->GPSR & DSI_GPSR_RCB) == 0U) 01807 { 01808 if ((hdsi->Instance->ISR[1U] & DSI_ISR1_PSE) == DSI_ISR1_PSE) 01809 { 01810 /* Process Unlocked */ 01811 __HAL_UNLOCK(hdsi); 01812 01813 return HAL_ERROR; 01814 } 01815 } 01816 } 01817 01818 /* Process unlocked */ 01819 __HAL_UNLOCK(hdsi); 01820 01821 return HAL_OK; 01822 } 01823 01824 /** 01825 * @brief Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL running 01826 * (only data lanes are in ULPM) 01827 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01828 * the configuration information for the DSI. 01829 * @retval HAL status 01830 */ 01831 HAL_StatusTypeDef HAL_DSI_EnterULPMData(DSI_HandleTypeDef *hdsi) 01832 { 01833 uint32_t tickstart; 01834 01835 /* Process locked */ 01836 __HAL_LOCK(hdsi); 01837 01838 /* ULPS Request on Data Lanes */ 01839 hdsi->Instance->PUCR |= DSI_PUCR_URDL; 01840 01841 /* Get tick */ 01842 tickstart = HAL_GetTick(); 01843 01844 /* Wait until the D-PHY active lanes enter into ULPM */ 01845 if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE) 01846 { 01847 while ((hdsi->Instance->PSR & DSI_PSR_UAN0) != 0U) 01848 { 01849 /* Check for the Timeout */ 01850 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01851 { 01852 /* Process Unlocked */ 01853 __HAL_UNLOCK(hdsi); 01854 01855 return HAL_TIMEOUT; 01856 } 01857 } 01858 } 01859 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES) 01860 { 01861 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != 0U) 01862 { 01863 /* Check for the Timeout */ 01864 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01865 { 01866 /* Process Unlocked */ 01867 __HAL_UNLOCK(hdsi); 01868 01869 return HAL_TIMEOUT; 01870 } 01871 } 01872 } 01873 else 01874 { 01875 /* Process unlocked */ 01876 __HAL_UNLOCK(hdsi); 01877 01878 return HAL_ERROR; 01879 } 01880 01881 /* Process unlocked */ 01882 __HAL_UNLOCK(hdsi); 01883 01884 return HAL_OK; 01885 } 01886 01887 /** 01888 * @brief Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL running 01889 * (only data lanes are in ULPM) 01890 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01891 * the configuration information for the DSI. 01892 * @retval HAL status 01893 */ 01894 HAL_StatusTypeDef HAL_DSI_ExitULPMData(DSI_HandleTypeDef *hdsi) 01895 { 01896 uint32_t tickstart; 01897 01898 /* Process locked */ 01899 __HAL_LOCK(hdsi); 01900 01901 /* Exit ULPS on Data Lanes */ 01902 hdsi->Instance->PUCR |= DSI_PUCR_UEDL; 01903 01904 /* Get tick */ 01905 tickstart = HAL_GetTick(); 01906 01907 /* Wait until all active lanes exit ULPM */ 01908 if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE) 01909 { 01910 while ((hdsi->Instance->PSR & DSI_PSR_UAN0) != DSI_PSR_UAN0) 01911 { 01912 /* Check for the Timeout */ 01913 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01914 { 01915 /* Process Unlocked */ 01916 __HAL_UNLOCK(hdsi); 01917 01918 return HAL_TIMEOUT; 01919 } 01920 } 01921 } 01922 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES) 01923 { 01924 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1)) 01925 { 01926 /* Check for the Timeout */ 01927 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01928 { 01929 /* Process Unlocked */ 01930 __HAL_UNLOCK(hdsi); 01931 01932 return HAL_TIMEOUT; 01933 } 01934 } 01935 } 01936 else 01937 { 01938 /* Process unlocked */ 01939 __HAL_UNLOCK(hdsi); 01940 01941 return HAL_ERROR; 01942 } 01943 01944 /* wait for 1 ms*/ 01945 HAL_Delay(1U); 01946 01947 /* De-assert the ULPM requests and the ULPM exit bits */ 01948 hdsi->Instance->PUCR = 0U; 01949 01950 /* Process unlocked */ 01951 __HAL_UNLOCK(hdsi); 01952 01953 return HAL_OK; 01954 } 01955 01956 /** 01957 * @brief Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off 01958 * (both data and clock lanes are in ULPM) 01959 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 01960 * the configuration information for the DSI. 01961 * @retval HAL status 01962 */ 01963 HAL_StatusTypeDef HAL_DSI_EnterULPM(DSI_HandleTypeDef *hdsi) 01964 { 01965 uint32_t tickstart; 01966 01967 /* Process locked */ 01968 __HAL_LOCK(hdsi); 01969 01970 /* Clock lane configuration: no more HS request */ 01971 hdsi->Instance->CLCR &= ~DSI_CLCR_DPCC; 01972 01973 /* Use system PLL as byte lane clock source before stopping DSIPHY clock source */ 01974 __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_PLL2); 01975 01976 /* ULPS Request on Clock and Data Lanes */ 01977 hdsi->Instance->PUCR |= (DSI_PUCR_URCL | DSI_PUCR_URDL); 01978 01979 /* Get tick */ 01980 tickstart = HAL_GetTick(); 01981 01982 /* Wait until all active lanes exit ULPM */ 01983 if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE) 01984 { 01985 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != 0U) 01986 { 01987 /* Check for the Timeout */ 01988 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 01989 { 01990 /* Process Unlocked */ 01991 __HAL_UNLOCK(hdsi); 01992 01993 return HAL_TIMEOUT; 01994 } 01995 } 01996 } 01997 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES) 01998 { 01999 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != 0U) 02000 { 02001 /* Check for the Timeout */ 02002 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 02003 { 02004 /* Process Unlocked */ 02005 __HAL_UNLOCK(hdsi); 02006 02007 return HAL_TIMEOUT; 02008 } 02009 } 02010 } 02011 else 02012 { 02013 /* Process unlocked */ 02014 __HAL_UNLOCK(hdsi); 02015 02016 return HAL_ERROR; 02017 } 02018 02019 /* Turn off the DSI PLL */ 02020 __HAL_DSI_PLL_DISABLE(hdsi); 02021 02022 /* Process unlocked */ 02023 __HAL_UNLOCK(hdsi); 02024 02025 return HAL_OK; 02026 } 02027 02028 /** 02029 * @brief Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off 02030 * (both data and clock lanes are in ULPM) 02031 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02032 * the configuration information for the DSI. 02033 * @retval HAL status 02034 */ 02035 HAL_StatusTypeDef HAL_DSI_ExitULPM(DSI_HandleTypeDef *hdsi) 02036 { 02037 uint32_t tickstart; 02038 02039 /* Process locked */ 02040 __HAL_LOCK(hdsi); 02041 02042 /* Turn on the DSI PLL */ 02043 __HAL_DSI_PLL_ENABLE(hdsi); 02044 02045 /* Get tick */ 02046 tickstart = HAL_GetTick(); 02047 02048 /* Wait for the lock of the PLL */ 02049 while (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_PLLLS) == 0U) 02050 { 02051 /* Check for the Timeout */ 02052 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 02053 { 02054 /* Process Unlocked */ 02055 __HAL_UNLOCK(hdsi); 02056 02057 return HAL_TIMEOUT; 02058 } 02059 } 02060 02061 /* Exit ULPS on Clock and Data Lanes */ 02062 hdsi->Instance->PUCR |= (DSI_PUCR_UECL | DSI_PUCR_UEDL); 02063 02064 /* Get tick */ 02065 tickstart = HAL_GetTick(); 02066 02067 /* Wait until all active lanes exit ULPM */ 02068 if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE) 02069 { 02070 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UANC)) 02071 { 02072 /* Check for the Timeout */ 02073 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 02074 { 02075 /* Process Unlocked */ 02076 __HAL_UNLOCK(hdsi); 02077 02078 return HAL_TIMEOUT; 02079 } 02080 } 02081 } 02082 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES) 02083 { 02084 while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1 | 02085 DSI_PSR_UANC)) 02086 { 02087 /* Check for the Timeout */ 02088 if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) 02089 { 02090 /* Process Unlocked */ 02091 __HAL_UNLOCK(hdsi); 02092 02093 return HAL_TIMEOUT; 02094 } 02095 } 02096 } 02097 else 02098 { 02099 /* Process unlocked */ 02100 __HAL_UNLOCK(hdsi); 02101 02102 return HAL_ERROR; 02103 } 02104 02105 /* wait for 1 ms */ 02106 HAL_Delay(1U); 02107 02108 /* De-assert the ULPM requests and the ULPM exit bits */ 02109 hdsi->Instance->PUCR = 0U; 02110 02111 /* Switch the lane byte clock source in the RCC from system PLL to D-PHY */ 02112 __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_PHY); 02113 02114 /* Restore clock lane configuration to HS */ 02115 hdsi->Instance->CLCR |= DSI_CLCR_DPCC; 02116 02117 /* Process unlocked */ 02118 __HAL_UNLOCK(hdsi); 02119 02120 return HAL_OK; 02121 } 02122 02123 /** 02124 * @brief Start test pattern generation 02125 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02126 * the configuration information for the DSI. 02127 * @param Mode Pattern generator mode 02128 * This parameter can be one of the following values: 02129 * 0 : Color bars (horizontal or vertical) 02130 * 1 : BER pattern (vertical only) 02131 * @param Orientation Pattern generator orientation 02132 * This parameter can be one of the following values: 02133 * 0 : Vertical color bars 02134 * 1 : Horizontal color bars 02135 * @retval HAL status 02136 */ 02137 HAL_StatusTypeDef HAL_DSI_PatternGeneratorStart(DSI_HandleTypeDef *hdsi, uint32_t Mode, uint32_t Orientation) 02138 { 02139 /* Process locked */ 02140 __HAL_LOCK(hdsi); 02141 02142 /* Configure pattern generator mode and orientation */ 02143 hdsi->Instance->VMCR &= ~(DSI_VMCR_PGM | DSI_VMCR_PGO); 02144 hdsi->Instance->VMCR |= ((Mode << 20U) | (Orientation << 24U)); 02145 02146 /* Enable pattern generator by setting PGE bit */ 02147 hdsi->Instance->VMCR |= DSI_VMCR_PGE; 02148 02149 /* Process unlocked */ 02150 __HAL_UNLOCK(hdsi); 02151 02152 return HAL_OK; 02153 } 02154 02155 /** 02156 * @brief Stop test pattern generation 02157 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02158 * the configuration information for the DSI. 02159 * @retval HAL status 02160 */ 02161 HAL_StatusTypeDef HAL_DSI_PatternGeneratorStop(DSI_HandleTypeDef *hdsi) 02162 { 02163 /* Process locked */ 02164 __HAL_LOCK(hdsi); 02165 02166 /* Disable pattern generator by clearing PGE bit */ 02167 hdsi->Instance->VMCR &= ~DSI_VMCR_PGE; 02168 02169 /* Process unlocked */ 02170 __HAL_UNLOCK(hdsi); 02171 02172 return HAL_OK; 02173 } 02174 02175 /** 02176 * @brief Set Slew-Rate And Delay Tuning 02177 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02178 * the configuration information for the DSI. 02179 * @param CommDelay Communication delay to be adjusted. 02180 * This parameter can be any value of @arg DSI_Communication_Delay 02181 * @param Lane select between clock or data lanes. 02182 * This parameter can be any value of @arg DSI_Lane_Group 02183 * @param Value Custom value of the slew-rate or delay 02184 * @retval HAL status 02185 */ 02186 HAL_StatusTypeDef HAL_DSI_SetSlewRateAndDelayTuning(DSI_HandleTypeDef *hdsi, uint32_t CommDelay, uint32_t Lane, 02187 uint32_t Value) 02188 { 02189 /* Process locked */ 02190 __HAL_LOCK(hdsi); 02191 02192 /* Check function parameters */ 02193 assert_param(IS_DSI_COMMUNICATION_DELAY(CommDelay)); 02194 assert_param(IS_DSI_LANE_GROUP(Lane)); 02195 02196 switch (CommDelay) 02197 { 02198 case DSI_SLEW_RATE_HSTX: 02199 if (Lane == DSI_CLOCK_LANE) 02200 { 02201 /* High-Speed Transmission Slew Rate Control on Clock Lane */ 02202 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXSRCCL; 02203 hdsi->Instance->WPCR[1U] |= Value << 16U; 02204 } 02205 else if (Lane == DSI_DATA_LANES) 02206 { 02207 /* High-Speed Transmission Slew Rate Control on Data Lanes */ 02208 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXSRCDL; 02209 hdsi->Instance->WPCR[1U] |= Value << 18U; 02210 } 02211 else 02212 { 02213 /* Process unlocked */ 02214 __HAL_UNLOCK(hdsi); 02215 02216 return HAL_ERROR; 02217 } 02218 break; 02219 case DSI_SLEW_RATE_LPTX: 02220 if (Lane == DSI_CLOCK_LANE) 02221 { 02222 /* Low-Power transmission Slew Rate Compensation on Clock Lane */ 02223 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPSRCCL; 02224 hdsi->Instance->WPCR[1U] |= Value << 6U; 02225 } 02226 else if (Lane == DSI_DATA_LANES) 02227 { 02228 /* Low-Power transmission Slew Rate Compensation on Data Lanes */ 02229 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPSRCDL; 02230 hdsi->Instance->WPCR[1U] |= Value << 8U; 02231 } 02232 else 02233 { 02234 /* Process unlocked */ 02235 __HAL_UNLOCK(hdsi); 02236 02237 return HAL_ERROR; 02238 } 02239 break; 02240 case DSI_HS_DELAY: 02241 if (Lane == DSI_CLOCK_LANE) 02242 { 02243 /* High-Speed Transmission Delay on Clock Lane */ 02244 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXDCL; 02245 hdsi->Instance->WPCR[1U] |= Value; 02246 } 02247 else if (Lane == DSI_DATA_LANES) 02248 { 02249 /* High-Speed Transmission Delay on Data Lanes */ 02250 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXDDL; 02251 hdsi->Instance->WPCR[1U] |= Value << 2U; 02252 } 02253 else 02254 { 02255 /* Process unlocked */ 02256 __HAL_UNLOCK(hdsi); 02257 02258 return HAL_ERROR; 02259 } 02260 break; 02261 default: 02262 break; 02263 } 02264 02265 /* Process unlocked */ 02266 __HAL_UNLOCK(hdsi); 02267 02268 return HAL_OK; 02269 } 02270 02271 /** 02272 * @brief Low-Power Reception Filter Tuning 02273 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02274 * the configuration information for the DSI. 02275 * @param Frequency cutoff frequency of low-pass filter at the input of LPRX 02276 * @retval HAL status 02277 */ 02278 HAL_StatusTypeDef HAL_DSI_SetLowPowerRXFilter(DSI_HandleTypeDef *hdsi, uint32_t Frequency) 02279 { 02280 /* Process locked */ 02281 __HAL_LOCK(hdsi); 02282 02283 /* Low-Power RX low-pass Filtering Tuning */ 02284 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPRXFT; 02285 hdsi->Instance->WPCR[1U] |= Frequency << 25U; 02286 02287 /* Process unlocked */ 02288 __HAL_UNLOCK(hdsi); 02289 02290 return HAL_OK; 02291 } 02292 02293 /** 02294 * @brief Activate an additional current path on all lanes to meet the SDDTx parameter 02295 * defined in the MIPI D-PHY specification 02296 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02297 * the configuration information for the DSI. 02298 * @param State ENABLE or DISABLE 02299 * @retval HAL status 02300 */ 02301 HAL_StatusTypeDef HAL_DSI_SetSDD(DSI_HandleTypeDef *hdsi, FunctionalState State) 02302 { 02303 /* Process locked */ 02304 __HAL_LOCK(hdsi); 02305 02306 /* Check function parameters */ 02307 assert_param(IS_FUNCTIONAL_STATE(State)); 02308 02309 /* Activate/Disactivate additional current path on all lanes */ 02310 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_SDDC; 02311 hdsi->Instance->WPCR[1U] |= ((uint32_t)State << 12U); 02312 02313 /* Process unlocked */ 02314 __HAL_UNLOCK(hdsi); 02315 02316 return HAL_OK; 02317 } 02318 02319 /** 02320 * @brief Custom lane pins configuration 02321 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02322 * the configuration information for the DSI. 02323 * @param CustomLane Function to be applied on selected lane. 02324 * This parameter can be any value of @arg DSI_CustomLane 02325 * @param Lane select between clock or data lane 0 or data lane 1. 02326 * This parameter can be any value of @arg DSI_Lane_Select 02327 * @param State ENABLE or DISABLE 02328 * @retval HAL status 02329 */ 02330 HAL_StatusTypeDef HAL_DSI_SetLanePinsConfiguration(DSI_HandleTypeDef *hdsi, uint32_t CustomLane, uint32_t Lane, 02331 FunctionalState State) 02332 { 02333 /* Process locked */ 02334 __HAL_LOCK(hdsi); 02335 02336 /* Check function parameters */ 02337 assert_param(IS_DSI_CUSTOM_LANE(CustomLane)); 02338 assert_param(IS_DSI_LANE(Lane)); 02339 assert_param(IS_FUNCTIONAL_STATE(State)); 02340 02341 switch (CustomLane) 02342 { 02343 case DSI_SWAP_LANE_PINS: 02344 if (Lane == DSI_CLK_LANE) 02345 { 02346 /* Swap pins on clock lane */ 02347 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWCL; 02348 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 6U); 02349 } 02350 else if (Lane == DSI_DATA_LANE0) 02351 { 02352 /* Swap pins on data lane 0 */ 02353 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWDL0; 02354 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 7U); 02355 } 02356 else if (Lane == DSI_DATA_LANE1) 02357 { 02358 /* Swap pins on data lane 1 */ 02359 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWDL1; 02360 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 8U); 02361 } 02362 else 02363 { 02364 /* Process unlocked */ 02365 __HAL_UNLOCK(hdsi); 02366 02367 return HAL_ERROR; 02368 } 02369 break; 02370 case DSI_INVERT_HS_SIGNAL: 02371 if (Lane == DSI_CLK_LANE) 02372 { 02373 /* Invert HS signal on clock lane */ 02374 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSICL; 02375 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 9U); 02376 } 02377 else if (Lane == DSI_DATA_LANE0) 02378 { 02379 /* Invert HS signal on data lane 0 */ 02380 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSIDL0; 02381 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 10U); 02382 } 02383 else if (Lane == DSI_DATA_LANE1) 02384 { 02385 /* Invert HS signal on data lane 1 */ 02386 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSIDL1; 02387 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 11U); 02388 } 02389 else 02390 { 02391 /* Process unlocked */ 02392 __HAL_UNLOCK(hdsi); 02393 02394 return HAL_ERROR; 02395 } 02396 break; 02397 default: 02398 break; 02399 } 02400 02401 /* Process unlocked */ 02402 __HAL_UNLOCK(hdsi); 02403 02404 return HAL_OK; 02405 } 02406 02407 /** 02408 * @brief Set custom timing for the PHY 02409 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02410 * the configuration information for the DSI. 02411 * @param Timing PHY timing to be adjusted. 02412 * This parameter can be any value of @arg DSI_PHY_Timing 02413 * @param State ENABLE or DISABLE 02414 * @param Value Custom value of the timing 02415 * @retval HAL status 02416 */ 02417 HAL_StatusTypeDef HAL_DSI_SetPHYTimings(DSI_HandleTypeDef *hdsi, uint32_t Timing, FunctionalState State, uint32_t Value) 02418 { 02419 /* Process locked */ 02420 __HAL_LOCK(hdsi); 02421 02422 /* Check function parameters */ 02423 assert_param(IS_DSI_PHY_TIMING(Timing)); 02424 assert_param(IS_FUNCTIONAL_STATE(State)); 02425 02426 switch (Timing) 02427 { 02428 case DSI_TCLK_POST: 02429 /* Enable/Disable custom timing setting */ 02430 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKPOSTEN; 02431 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 27U); 02432 02433 if (State != DISABLE) 02434 { 02435 /* Set custom value */ 02436 hdsi->Instance->WPCR[4U] &= ~DSI_WPCR4_TCLKPOST; 02437 hdsi->Instance->WPCR[4U] |= Value & DSI_WPCR4_TCLKPOST; 02438 } 02439 02440 break; 02441 case DSI_TLPX_CLK: 02442 /* Enable/Disable custom timing setting */ 02443 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TLPXCEN; 02444 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 26U); 02445 02446 if (State != DISABLE) 02447 { 02448 /* Set custom value */ 02449 hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_TLPXC; 02450 hdsi->Instance->WPCR[3U] |= (Value << 24U) & DSI_WPCR3_TLPXC; 02451 } 02452 02453 break; 02454 case DSI_THS_EXIT: 02455 /* Enable/Disable custom timing setting */ 02456 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSEXITEN; 02457 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 25U); 02458 02459 if (State != DISABLE) 02460 { 02461 /* Set custom value */ 02462 hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_THSEXIT; 02463 hdsi->Instance->WPCR[3U] |= (Value << 16U) & DSI_WPCR3_THSEXIT; 02464 } 02465 02466 break; 02467 case DSI_TLPX_DATA: 02468 /* Enable/Disable custom timing setting */ 02469 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TLPXDEN; 02470 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 24U); 02471 02472 if (State != DISABLE) 02473 { 02474 /* Set custom value */ 02475 hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_TLPXD; 02476 hdsi->Instance->WPCR[3U] |= (Value << 8U) & DSI_WPCR3_TLPXD; 02477 } 02478 02479 break; 02480 case DSI_THS_ZERO: 02481 /* Enable/Disable custom timing setting */ 02482 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSZEROEN; 02483 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 23U); 02484 02485 if (State != DISABLE) 02486 { 02487 /* Set custom value */ 02488 hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_THSZERO; 02489 hdsi->Instance->WPCR[3U] |= Value & DSI_WPCR3_THSZERO; 02490 } 02491 02492 break; 02493 case DSI_THS_TRAIL: 02494 /* Enable/Disable custom timing setting */ 02495 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSTRAILEN; 02496 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 22U); 02497 02498 if (State != DISABLE) 02499 { 02500 /* Set custom value */ 02501 hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_THSTRAIL; 02502 hdsi->Instance->WPCR[2U] |= (Value << 24U) & DSI_WPCR2_THSTRAIL; 02503 } 02504 02505 break; 02506 case DSI_THS_PREPARE: 02507 /* Enable/Disable custom timing setting */ 02508 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSPREPEN; 02509 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 21U); 02510 02511 if (State != DISABLE) 02512 { 02513 /* Set custom value */ 02514 hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_THSPREP; 02515 hdsi->Instance->WPCR[2U] |= (Value << 16U) & DSI_WPCR2_THSPREP; 02516 } 02517 02518 break; 02519 case DSI_TCLK_ZERO: 02520 /* Enable/Disable custom timing setting */ 02521 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKZEROEN; 02522 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 20U); 02523 02524 if (State != DISABLE) 02525 { 02526 /* Set custom value */ 02527 hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_TCLKZERO; 02528 hdsi->Instance->WPCR[2U] |= (Value << 8U) & DSI_WPCR2_TCLKZERO; 02529 } 02530 02531 break; 02532 case DSI_TCLK_PREPARE: 02533 /* Enable/Disable custom timing setting */ 02534 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKPREPEN; 02535 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 19U); 02536 02537 if (State != DISABLE) 02538 { 02539 /* Set custom value */ 02540 hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_TCLKPREP; 02541 hdsi->Instance->WPCR[2U] |= Value & DSI_WPCR2_TCLKPREP; 02542 } 02543 02544 break; 02545 default: 02546 break; 02547 } 02548 02549 /* Process unlocked */ 02550 __HAL_UNLOCK(hdsi); 02551 02552 return HAL_OK; 02553 } 02554 02555 /** 02556 * @brief Force the Clock/Data Lane in TX Stop Mode 02557 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02558 * the configuration information for the DSI. 02559 * @param Lane select between clock or data lanes. 02560 * This parameter can be any value of @arg DSI_Lane_Group 02561 * @param State ENABLE or DISABLE 02562 * @retval HAL status 02563 */ 02564 HAL_StatusTypeDef HAL_DSI_ForceTXStopMode(DSI_HandleTypeDef *hdsi, uint32_t Lane, FunctionalState State) 02565 { 02566 /* Process locked */ 02567 __HAL_LOCK(hdsi); 02568 02569 /* Check function parameters */ 02570 assert_param(IS_DSI_LANE_GROUP(Lane)); 02571 assert_param(IS_FUNCTIONAL_STATE(State)); 02572 02573 if (Lane == DSI_CLOCK_LANE) 02574 { 02575 /* Force/Unforce the Clock Lane in TX Stop Mode */ 02576 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_FTXSMCL; 02577 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 12U); 02578 } 02579 else if (Lane == DSI_DATA_LANES) 02580 { 02581 /* Force/Unforce the Data Lanes in TX Stop Mode */ 02582 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_FTXSMDL; 02583 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 13U); 02584 } 02585 else 02586 { 02587 /* Process unlocked */ 02588 __HAL_UNLOCK(hdsi); 02589 02590 return HAL_ERROR; 02591 } 02592 02593 /* Process unlocked */ 02594 __HAL_UNLOCK(hdsi); 02595 02596 return HAL_OK; 02597 } 02598 02599 /** 02600 * @brief Force LP Receiver in Low-Power Mode 02601 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02602 * the configuration information for the DSI. 02603 * @param State ENABLE or DISABLE 02604 * @retval HAL status 02605 */ 02606 HAL_StatusTypeDef HAL_DSI_ForceRXLowPower(DSI_HandleTypeDef *hdsi, FunctionalState State) 02607 { 02608 /* Process locked */ 02609 __HAL_LOCK(hdsi); 02610 02611 /* Check function parameters */ 02612 assert_param(IS_FUNCTIONAL_STATE(State)); 02613 02614 /* Force/Unforce LP Receiver in Low-Power Mode */ 02615 hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_FLPRXLPM; 02616 hdsi->Instance->WPCR[1U] |= ((uint32_t)State << 22U); 02617 02618 /* Process unlocked */ 02619 __HAL_UNLOCK(hdsi); 02620 02621 return HAL_OK; 02622 } 02623 02624 /** 02625 * @brief Force Data Lanes in RX Mode after a BTA 02626 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02627 * the configuration information for the DSI. 02628 * @param State ENABLE or DISABLE 02629 * @retval HAL status 02630 */ 02631 HAL_StatusTypeDef HAL_DSI_ForceDataLanesInRX(DSI_HandleTypeDef *hdsi, FunctionalState State) 02632 { 02633 /* Process locked */ 02634 __HAL_LOCK(hdsi); 02635 02636 /* Check function parameters */ 02637 assert_param(IS_FUNCTIONAL_STATE(State)); 02638 02639 /* Force Data Lanes in RX Mode */ 02640 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TDDL; 02641 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 16U); 02642 02643 /* Process unlocked */ 02644 __HAL_UNLOCK(hdsi); 02645 02646 return HAL_OK; 02647 } 02648 02649 /** 02650 * @brief Enable a pull-down on the lanes to prevent from floating states when unused 02651 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02652 * the configuration information for the DSI. 02653 * @param State ENABLE or DISABLE 02654 * @retval HAL status 02655 */ 02656 HAL_StatusTypeDef HAL_DSI_SetPullDown(DSI_HandleTypeDef *hdsi, FunctionalState State) 02657 { 02658 /* Process locked */ 02659 __HAL_LOCK(hdsi); 02660 02661 /* Check function parameters */ 02662 assert_param(IS_FUNCTIONAL_STATE(State)); 02663 02664 /* Enable/Disable pull-down on lanes */ 02665 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_PDEN; 02666 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 18U); 02667 02668 /* Process unlocked */ 02669 __HAL_UNLOCK(hdsi); 02670 02671 return HAL_OK; 02672 } 02673 02674 /** 02675 * @brief Switch off the contention detection on data lanes 02676 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02677 * the configuration information for the DSI. 02678 * @param State ENABLE or DISABLE 02679 * @retval HAL status 02680 */ 02681 HAL_StatusTypeDef HAL_DSI_SetContentionDetectionOff(DSI_HandleTypeDef *hdsi, FunctionalState State) 02682 { 02683 /* Process locked */ 02684 __HAL_LOCK(hdsi); 02685 02686 /* Check function parameters */ 02687 assert_param(IS_FUNCTIONAL_STATE(State)); 02688 02689 /* Contention Detection on Data Lanes OFF */ 02690 hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_CDOFFDL; 02691 hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 14U); 02692 02693 /* Process unlocked */ 02694 __HAL_UNLOCK(hdsi); 02695 02696 return HAL_OK; 02697 } 02698 02699 /** 02700 * @} 02701 */ 02702 02703 /** @defgroup DSI_Group4 Peripheral State and Errors functions 02704 * @brief Peripheral State and Errors functions 02705 * 02706 @verbatim 02707 =============================================================================== 02708 ##### Peripheral State and Errors functions ##### 02709 =============================================================================== 02710 [..] 02711 This subsection provides functions allowing to 02712 (+) Check the DSI state. 02713 (+) Get error code. 02714 02715 @endverbatim 02716 * @{ 02717 */ 02718 02719 /** 02720 * @brief Return the DSI state 02721 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02722 * the configuration information for the DSI. 02723 * @retval HAL state 02724 */ 02725 HAL_DSI_StateTypeDef HAL_DSI_GetState(DSI_HandleTypeDef *hdsi) 02726 { 02727 return hdsi->State; 02728 } 02729 02730 /** 02731 * @brief Return the DSI error code 02732 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains 02733 * the configuration information for the DSI. 02734 * @retval DSI Error Code 02735 */ 02736 uint32_t HAL_DSI_GetError(DSI_HandleTypeDef *hdsi) 02737 { 02738 /* Get the error code */ 02739 return hdsi->ErrorCode; 02740 } 02741 02742 /** 02743 * @} 02744 */ 02745 02746 /** 02747 * @} 02748 */ 02749 02750 /** 02751 * @} 02752 */ 02753 02754 #endif /* DSI */ 02755 02756 #endif /* HAL_DSI_MODULE_ENABLED */ 02757 02758 /** 02759 * @} 02760 */