schneider françois / mbed-dev

Dependents:   STM32_F103-C8T6basecanblink_led

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Tue Mar 20 16:56:18 2018 +0000
Revision:
183:a56a73fd2a6f
Parent:
168:9672193075cf
mbed-dev library. Release version 160

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32f7xx_hal_dsi.c
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
<> 144:ef7eb2e8f9f7 5 * @brief DSI HAL module driver.
<> 144:ef7eb2e8f9f7 6 * This file provides firmware functions to manage the following
<> 144:ef7eb2e8f9f7 7 * functionalities of the DSI peripheral:
<> 144:ef7eb2e8f9f7 8 * + Initialization and de-initialization functions
<> 144:ef7eb2e8f9f7 9 * + IO operation functions
<> 144:ef7eb2e8f9f7 10 * + Peripheral Control functions
<> 144:ef7eb2e8f9f7 11 * + Peripheral State and Errors functions
<> 144:ef7eb2e8f9f7 12 ******************************************************************************
<> 144:ef7eb2e8f9f7 13 * @attention
<> 144:ef7eb2e8f9f7 14 *
AnnaBridge 168:9672193075cf 15 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 16 *
<> 144:ef7eb2e8f9f7 17 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 18 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 19 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 20 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 21 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 22 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 23 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 24 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 25 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 26 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 27 *
<> 144:ef7eb2e8f9f7 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 31 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 38 *
<> 144:ef7eb2e8f9f7 39 ******************************************************************************
<> 144:ef7eb2e8f9f7 40 */
<> 144:ef7eb2e8f9f7 41
<> 144:ef7eb2e8f9f7 42 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 43 #include "stm32f7xx_hal.h"
<> 144:ef7eb2e8f9f7 44
<> 144:ef7eb2e8f9f7 45 /** @addtogroup STM32F7xx_HAL_Driver
<> 144:ef7eb2e8f9f7 46 * @{
<> 144:ef7eb2e8f9f7 47 */
<> 144:ef7eb2e8f9f7 48 /** @addtogroup DSI
<> 144:ef7eb2e8f9f7 49 * @{
<> 144:ef7eb2e8f9f7 50 */
<> 144:ef7eb2e8f9f7 51
<> 144:ef7eb2e8f9f7 52 #ifdef HAL_DSI_MODULE_ENABLED
<> 144:ef7eb2e8f9f7 53
<> 144:ef7eb2e8f9f7 54 #if defined (STM32F769xx) || defined (STM32F779xx)
<> 144:ef7eb2e8f9f7 55
<> 144:ef7eb2e8f9f7 56 /* Private types -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 57 /* Private defines -----------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 58 /** @addtogroup DSI_Private_Constants
<> 144:ef7eb2e8f9f7 59 * @{
<> 144:ef7eb2e8f9f7 60 */
<> 144:ef7eb2e8f9f7 61 #define DSI_TIMEOUT_VALUE ((uint32_t)1000) /* 1s */
<> 144:ef7eb2e8f9f7 62
<> 144:ef7eb2e8f9f7 63 #define DSI_ERROR_ACK_MASK (DSI_ISR0_AE0 | DSI_ISR0_AE1 | DSI_ISR0_AE2 | DSI_ISR0_AE3 | \
<> 144:ef7eb2e8f9f7 64 DSI_ISR0_AE4 | DSI_ISR0_AE5 | DSI_ISR0_AE6 | DSI_ISR0_AE7 | \
<> 144:ef7eb2e8f9f7 65 DSI_ISR0_AE8 | DSI_ISR0_AE9 | DSI_ISR0_AE10 | DSI_ISR0_AE11 | \
<> 144:ef7eb2e8f9f7 66 DSI_ISR0_AE12 | DSI_ISR0_AE13 | DSI_ISR0_AE14 | DSI_ISR0_AE15)
<> 144:ef7eb2e8f9f7 67 #define DSI_ERROR_PHY_MASK (DSI_ISR0_PE0 | DSI_ISR0_PE1 | DSI_ISR0_PE2 | DSI_ISR0_PE3 | DSI_ISR0_PE4)
<> 144:ef7eb2e8f9f7 68 #define DSI_ERROR_TX_MASK DSI_ISR1_TOHSTX
<> 144:ef7eb2e8f9f7 69 #define DSI_ERROR_RX_MASK DSI_ISR1_TOLPRX
<> 144:ef7eb2e8f9f7 70 #define DSI_ERROR_ECC_MASK (DSI_ISR1_ECCSE | DSI_ISR1_ECCME)
<> 144:ef7eb2e8f9f7 71 #define DSI_ERROR_CRC_MASK DSI_ISR1_CRCE
<> 144:ef7eb2e8f9f7 72 #define DSI_ERROR_PSE_MASK DSI_ISR1_PSE
<> 144:ef7eb2e8f9f7 73 #define DSI_ERROR_EOT_MASK DSI_ISR1_EOTPE
<> 144:ef7eb2e8f9f7 74 #define DSI_ERROR_OVF_MASK DSI_ISR1_LPWRE
<> 144:ef7eb2e8f9f7 75 #define DSI_ERROR_GEN_MASK (DSI_ISR1_GCWRE | DSI_ISR1_GPWRE | DSI_ISR1_GPTXE | DSI_ISR1_GPRDE | DSI_ISR1_GPRXE)
<> 144:ef7eb2e8f9f7 76 /**
<> 144:ef7eb2e8f9f7 77 * @}
<> 144:ef7eb2e8f9f7 78 */
<> 144:ef7eb2e8f9f7 79
<> 144:ef7eb2e8f9f7 80 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 81 /* Private constants ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 82 /* Private macros ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 83 /* Private function prototypes -----------------------------------------------*/
<> 144:ef7eb2e8f9f7 84 static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t DataType, uint32_t Data0, uint32_t Data1);
<> 144:ef7eb2e8f9f7 85
<> 144:ef7eb2e8f9f7 86 /* Private functions ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 87 /**
<> 144:ef7eb2e8f9f7 88 * @brief Generic DSI packet header configuration
AnnaBridge 183:a56a73fd2a6f 89 * @param DSIx Pointer to DSI register base
AnnaBridge 183:a56a73fd2a6f 90 * @param ChannelID Virtual channel ID of the header packet
AnnaBridge 183:a56a73fd2a6f 91 * @param DataType Packet data type of the header packet
<> 144:ef7eb2e8f9f7 92 * This parameter can be any value of :
<> 144:ef7eb2e8f9f7 93 * @ref DSI_SHORT_WRITE_PKT_Data_Type
<> 144:ef7eb2e8f9f7 94 * or @ref DSI_LONG_WRITE_PKT_Data_Type
<> 144:ef7eb2e8f9f7 95 * or @ref DSI_SHORT_READ_PKT_Data_Type
<> 144:ef7eb2e8f9f7 96 * or DSI_MAX_RETURN_PKT_SIZE
AnnaBridge 183:a56a73fd2a6f 97 * @param Data0 Word count LSB
AnnaBridge 183:a56a73fd2a6f 98 * @param Data1 Word count MSB
<> 144:ef7eb2e8f9f7 99 * @retval None
<> 144:ef7eb2e8f9f7 100 */
<> 144:ef7eb2e8f9f7 101 static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx,
<> 144:ef7eb2e8f9f7 102 uint32_t ChannelID,
<> 144:ef7eb2e8f9f7 103 uint32_t DataType,
<> 144:ef7eb2e8f9f7 104 uint32_t Data0,
<> 144:ef7eb2e8f9f7 105 uint32_t Data1)
<> 144:ef7eb2e8f9f7 106 {
<> 144:ef7eb2e8f9f7 107 /* Update the DSI packet header with new information */
<> 144:ef7eb2e8f9f7 108 DSIx->GHCR = (DataType | (ChannelID<<6) | (Data0<<8) | (Data1<<16));
<> 144:ef7eb2e8f9f7 109 }
<> 144:ef7eb2e8f9f7 110
<> 144:ef7eb2e8f9f7 111 /* Exported functions --------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 112 /** @addtogroup DSI_Exported_Functions
<> 144:ef7eb2e8f9f7 113 * @{
<> 144:ef7eb2e8f9f7 114 */
<> 144:ef7eb2e8f9f7 115
<> 144:ef7eb2e8f9f7 116 /** @defgroup DSI_Group1 Initialization and Configuration functions
<> 144:ef7eb2e8f9f7 117 * @brief Initialization and Configuration functions
<> 144:ef7eb2e8f9f7 118 *
<> 144:ef7eb2e8f9f7 119 @verbatim
<> 144:ef7eb2e8f9f7 120 ===============================================================================
<> 144:ef7eb2e8f9f7 121 ##### Initialization and Configuration functions #####
<> 144:ef7eb2e8f9f7 122 ===============================================================================
<> 144:ef7eb2e8f9f7 123 [..] This section provides functions allowing to:
<> 144:ef7eb2e8f9f7 124 (+) Initialize and configure the DSI
<> 144:ef7eb2e8f9f7 125 (+) De-initialize the DSI
<> 144:ef7eb2e8f9f7 126
<> 144:ef7eb2e8f9f7 127 @endverbatim
<> 144:ef7eb2e8f9f7 128 * @{
<> 144:ef7eb2e8f9f7 129 */
<> 144:ef7eb2e8f9f7 130
<> 144:ef7eb2e8f9f7 131 /**
<> 144:ef7eb2e8f9f7 132 * @brief Initializes the DSI according to the specified
<> 144:ef7eb2e8f9f7 133 * parameters in the DSI_InitTypeDef and create the associated handle.
AnnaBridge 183:a56a73fd2a6f 134 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 135 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 136 * @param PLLInit pointer to a DSI_PLLInitTypeDef structure that contains
<> 144:ef7eb2e8f9f7 137 * the PLL Clock structure definition for the DSI.
<> 144:ef7eb2e8f9f7 138 * @retval HAL status
<> 144:ef7eb2e8f9f7 139 */
<> 144:ef7eb2e8f9f7 140 HAL_StatusTypeDef HAL_DSI_Init(DSI_HandleTypeDef *hdsi, DSI_PLLInitTypeDef *PLLInit)
<> 144:ef7eb2e8f9f7 141 {
<> 144:ef7eb2e8f9f7 142 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 143 uint32_t unitIntervalx4 = 0;
<> 144:ef7eb2e8f9f7 144 uint32_t tempIDF = 0;
<> 144:ef7eb2e8f9f7 145
<> 144:ef7eb2e8f9f7 146 /* Check the DSI handle allocation */
<> 144:ef7eb2e8f9f7 147 if(hdsi == NULL)
<> 144:ef7eb2e8f9f7 148 {
<> 144:ef7eb2e8f9f7 149 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 150 }
<> 144:ef7eb2e8f9f7 151
<> 144:ef7eb2e8f9f7 152 /* Check function parameters */
<> 144:ef7eb2e8f9f7 153 assert_param(IS_DSI_PLL_NDIV(PLLInit->PLLNDIV));
<> 144:ef7eb2e8f9f7 154 assert_param(IS_DSI_PLL_IDF(PLLInit->PLLIDF));
<> 144:ef7eb2e8f9f7 155 assert_param(IS_DSI_PLL_ODF(PLLInit->PLLODF));
<> 144:ef7eb2e8f9f7 156 assert_param(IS_DSI_AUTO_CLKLANE_CONTROL(hdsi->Init.AutomaticClockLaneControl));
<> 144:ef7eb2e8f9f7 157 assert_param(IS_DSI_NUMBER_OF_LANES(hdsi->Init.NumberOfLanes));
<> 144:ef7eb2e8f9f7 158
<> 144:ef7eb2e8f9f7 159 if(hdsi->State == HAL_DSI_STATE_RESET)
<> 144:ef7eb2e8f9f7 160 {
<> 144:ef7eb2e8f9f7 161 /* Initialize the low level hardware */
<> 144:ef7eb2e8f9f7 162 HAL_DSI_MspInit(hdsi);
<> 144:ef7eb2e8f9f7 163 }
<> 144:ef7eb2e8f9f7 164
<> 144:ef7eb2e8f9f7 165 /* Change DSI peripheral state */
<> 144:ef7eb2e8f9f7 166 hdsi->State = HAL_DSI_STATE_BUSY;
<> 144:ef7eb2e8f9f7 167
<> 144:ef7eb2e8f9f7 168 /**************** Turn on the regulator and enable the DSI PLL ****************/
<> 144:ef7eb2e8f9f7 169
<> 144:ef7eb2e8f9f7 170 /* Enable the regulator */
<> 144:ef7eb2e8f9f7 171 __HAL_DSI_REG_ENABLE(hdsi);
<> 144:ef7eb2e8f9f7 172
<> 144:ef7eb2e8f9f7 173 /* Get tick */
<> 144:ef7eb2e8f9f7 174 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 175
<> 144:ef7eb2e8f9f7 176 /* Wait until the regulator is ready */
<> 144:ef7eb2e8f9f7 177 while(__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_RRS) == RESET)
<> 144:ef7eb2e8f9f7 178 {
<> 144:ef7eb2e8f9f7 179 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 180 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 181 {
<> 144:ef7eb2e8f9f7 182 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 183 }
<> 144:ef7eb2e8f9f7 184 }
<> 144:ef7eb2e8f9f7 185
<> 144:ef7eb2e8f9f7 186 /* Set the PLL division factors */
<> 144:ef7eb2e8f9f7 187 hdsi->Instance->WRPCR &= ~(DSI_WRPCR_PLL_NDIV | DSI_WRPCR_PLL_IDF | DSI_WRPCR_PLL_ODF);
<> 144:ef7eb2e8f9f7 188 hdsi->Instance->WRPCR |= (((PLLInit->PLLNDIV)<<2) | ((PLLInit->PLLIDF)<<11) | ((PLLInit->PLLODF)<<16));
<> 144:ef7eb2e8f9f7 189
<> 144:ef7eb2e8f9f7 190 /* Enable the DSI PLL */
<> 144:ef7eb2e8f9f7 191 __HAL_DSI_PLL_ENABLE(hdsi);
<> 144:ef7eb2e8f9f7 192
<> 144:ef7eb2e8f9f7 193 /* Get tick */
<> 144:ef7eb2e8f9f7 194 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 195
<> 144:ef7eb2e8f9f7 196 /* Wait for the lock of the PLL */
<> 144:ef7eb2e8f9f7 197 while(__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_PLLLS) == RESET)
<> 144:ef7eb2e8f9f7 198 {
<> 144:ef7eb2e8f9f7 199 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 200 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 201 {
<> 144:ef7eb2e8f9f7 202 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 203 }
<> 144:ef7eb2e8f9f7 204 }
<> 144:ef7eb2e8f9f7 205
<> 144:ef7eb2e8f9f7 206 /*************************** Set the PHY parameters ***************************/
<> 144:ef7eb2e8f9f7 207
<> 144:ef7eb2e8f9f7 208 /* D-PHY clock and digital enable*/
<> 144:ef7eb2e8f9f7 209 hdsi->Instance->PCTLR |= (DSI_PCTLR_CKE | DSI_PCTLR_DEN);
<> 144:ef7eb2e8f9f7 210
<> 144:ef7eb2e8f9f7 211 /* Clock lane configuration */
<> 144:ef7eb2e8f9f7 212 hdsi->Instance->CLCR &= ~(DSI_CLCR_DPCC | DSI_CLCR_ACR);
<> 144:ef7eb2e8f9f7 213 hdsi->Instance->CLCR |= (DSI_CLCR_DPCC | hdsi->Init.AutomaticClockLaneControl);
<> 144:ef7eb2e8f9f7 214
<> 144:ef7eb2e8f9f7 215 /* Configure the number of active data lanes */
<> 144:ef7eb2e8f9f7 216 hdsi->Instance->PCONFR &= ~DSI_PCONFR_NL;
<> 144:ef7eb2e8f9f7 217 hdsi->Instance->PCONFR |= hdsi->Init.NumberOfLanes;
<> 144:ef7eb2e8f9f7 218
<> 144:ef7eb2e8f9f7 219 /************************ Set the DSI clock parameters ************************/
<> 144:ef7eb2e8f9f7 220
<> 144:ef7eb2e8f9f7 221 /* Set the TX escape clock division factor */
<> 144:ef7eb2e8f9f7 222 hdsi->Instance->CCR &= ~DSI_CCR_TXECKDIV;
<> 157:ff67d9f36b67 223 hdsi->Instance->CCR |= hdsi->Init.TXEscapeCkdiv;
<> 144:ef7eb2e8f9f7 224
<> 144:ef7eb2e8f9f7 225 /* Calculate the bit period in high-speed mode in unit of 0.25 ns (UIX4) */
<> 144:ef7eb2e8f9f7 226 /* The equation is : UIX4 = IntegerPart( (1000/F_PHY_Mhz) * 4 ) */
<> 144:ef7eb2e8f9f7 227 /* Where : F_PHY_Mhz = (NDIV * HSE_Mhz) / (IDF * ODF) */
<> 144:ef7eb2e8f9f7 228 tempIDF = (PLLInit->PLLIDF > 0) ? PLLInit->PLLIDF : 1;
<> 144:ef7eb2e8f9f7 229 unitIntervalx4 = (4000000 * tempIDF * (1 << PLLInit->PLLODF)) / ((HSE_VALUE/1000) * PLLInit->PLLNDIV);
<> 144:ef7eb2e8f9f7 230
<> 144:ef7eb2e8f9f7 231 /* Set the bit period in high-speed mode */
<> 144:ef7eb2e8f9f7 232 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_UIX4;
<> 144:ef7eb2e8f9f7 233 hdsi->Instance->WPCR[0] |= unitIntervalx4;
<> 144:ef7eb2e8f9f7 234
<> 144:ef7eb2e8f9f7 235 /****************************** Error management *****************************/
<> 144:ef7eb2e8f9f7 236
<> 144:ef7eb2e8f9f7 237 /* Disable all error interrupts and reset the Error Mask */
<> 144:ef7eb2e8f9f7 238 hdsi->Instance->IER[0] = 0;
<> 144:ef7eb2e8f9f7 239 hdsi->Instance->IER[1] = 0;
<> 144:ef7eb2e8f9f7 240 hdsi->ErrorMsk = 0;
<> 144:ef7eb2e8f9f7 241
<> 144:ef7eb2e8f9f7 242 /* Initialise the error code */
<> 144:ef7eb2e8f9f7 243 hdsi->ErrorCode = HAL_DSI_ERROR_NONE;
<> 144:ef7eb2e8f9f7 244
<> 144:ef7eb2e8f9f7 245 /* Initialize the DSI state*/
<> 144:ef7eb2e8f9f7 246 hdsi->State = HAL_DSI_STATE_READY;
<> 144:ef7eb2e8f9f7 247
<> 144:ef7eb2e8f9f7 248 return HAL_OK;
<> 144:ef7eb2e8f9f7 249 }
<> 144:ef7eb2e8f9f7 250
<> 144:ef7eb2e8f9f7 251 /**
<> 144:ef7eb2e8f9f7 252 * @brief De-initializes the DSI peripheral registers to their default reset
<> 144:ef7eb2e8f9f7 253 * values.
AnnaBridge 183:a56a73fd2a6f 254 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 255 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 256 * @retval HAL status
<> 144:ef7eb2e8f9f7 257 */
<> 144:ef7eb2e8f9f7 258 HAL_StatusTypeDef HAL_DSI_DeInit(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 259 {
<> 144:ef7eb2e8f9f7 260 /* Check the DSI handle allocation */
<> 144:ef7eb2e8f9f7 261 if(hdsi == NULL)
<> 144:ef7eb2e8f9f7 262 {
<> 144:ef7eb2e8f9f7 263 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 264 }
<> 144:ef7eb2e8f9f7 265
<> 144:ef7eb2e8f9f7 266 /* Change DSI peripheral state */
<> 144:ef7eb2e8f9f7 267 hdsi->State = HAL_DSI_STATE_BUSY;
<> 144:ef7eb2e8f9f7 268
<> 144:ef7eb2e8f9f7 269 /* Disable the DSI wrapper */
<> 144:ef7eb2e8f9f7 270 __HAL_DSI_WRAPPER_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 271
<> 144:ef7eb2e8f9f7 272 /* Disable the DSI host */
<> 144:ef7eb2e8f9f7 273 __HAL_DSI_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 274
<> 144:ef7eb2e8f9f7 275 /* D-PHY clock and digital disable */
<> 144:ef7eb2e8f9f7 276 hdsi->Instance->PCTLR &= ~(DSI_PCTLR_CKE | DSI_PCTLR_DEN);
<> 144:ef7eb2e8f9f7 277
<> 144:ef7eb2e8f9f7 278 /* Turn off the DSI PLL */
<> 144:ef7eb2e8f9f7 279 __HAL_DSI_PLL_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 280
<> 144:ef7eb2e8f9f7 281 /* Disable the regulator */
<> 144:ef7eb2e8f9f7 282 __HAL_DSI_REG_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 283
<> 144:ef7eb2e8f9f7 284 /* DeInit the low level hardware */
<> 144:ef7eb2e8f9f7 285 HAL_DSI_MspDeInit(hdsi);
<> 144:ef7eb2e8f9f7 286
<> 144:ef7eb2e8f9f7 287 /* Initialise the error code */
<> 144:ef7eb2e8f9f7 288 hdsi->ErrorCode = HAL_DSI_ERROR_NONE;
<> 144:ef7eb2e8f9f7 289
<> 144:ef7eb2e8f9f7 290 /* Initialize the DSI state*/
<> 144:ef7eb2e8f9f7 291 hdsi->State = HAL_DSI_STATE_RESET;
<> 144:ef7eb2e8f9f7 292
<> 144:ef7eb2e8f9f7 293 /* Release Lock */
<> 144:ef7eb2e8f9f7 294 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 295
<> 144:ef7eb2e8f9f7 296 return HAL_OK;
<> 144:ef7eb2e8f9f7 297 }
<> 144:ef7eb2e8f9f7 298
<> 144:ef7eb2e8f9f7 299 /**
<> 144:ef7eb2e8f9f7 300 * @brief Return the DSI error code
AnnaBridge 183:a56a73fd2a6f 301 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 302 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 303 * @retval DSI Error Code
<> 144:ef7eb2e8f9f7 304 */
<> 144:ef7eb2e8f9f7 305 uint32_t HAL_DSI_GetError(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 306 {
<> 144:ef7eb2e8f9f7 307 /* Get the error code */
<> 144:ef7eb2e8f9f7 308 return hdsi->ErrorCode;
<> 144:ef7eb2e8f9f7 309 }
<> 144:ef7eb2e8f9f7 310
<> 144:ef7eb2e8f9f7 311 /**
<> 144:ef7eb2e8f9f7 312 * @brief Enable the error monitor flags
AnnaBridge 183:a56a73fd2a6f 313 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 314 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 315 * @param ActiveErrors indicates which error interrupts will be enabled.
<> 144:ef7eb2e8f9f7 316 * This parameter can be any combination of @ref DSI_Error_Data_Type.
<> 144:ef7eb2e8f9f7 317 * @retval HAL status
<> 144:ef7eb2e8f9f7 318 */
<> 144:ef7eb2e8f9f7 319 HAL_StatusTypeDef HAL_DSI_ConfigErrorMonitor(DSI_HandleTypeDef *hdsi, uint32_t ActiveErrors)
<> 144:ef7eb2e8f9f7 320 {
<> 144:ef7eb2e8f9f7 321 /* Process locked */
<> 144:ef7eb2e8f9f7 322 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 323
<> 144:ef7eb2e8f9f7 324 hdsi->Instance->IER[0] = 0;
<> 144:ef7eb2e8f9f7 325 hdsi->Instance->IER[1] = 0;
<> 144:ef7eb2e8f9f7 326
<> 144:ef7eb2e8f9f7 327 /* Store active errors to the handle */
<> 144:ef7eb2e8f9f7 328 hdsi->ErrorMsk = ActiveErrors;
<> 144:ef7eb2e8f9f7 329
<> 144:ef7eb2e8f9f7 330 if((ActiveErrors & HAL_DSI_ERROR_ACK) != RESET)
<> 144:ef7eb2e8f9f7 331 {
<> 144:ef7eb2e8f9f7 332 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 333 hdsi->Instance->IER[0] |= DSI_ERROR_ACK_MASK;
<> 144:ef7eb2e8f9f7 334 }
<> 144:ef7eb2e8f9f7 335
<> 144:ef7eb2e8f9f7 336 if((ActiveErrors & HAL_DSI_ERROR_PHY ) != RESET)
<> 144:ef7eb2e8f9f7 337 {
<> 144:ef7eb2e8f9f7 338 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 339 hdsi->Instance->IER[0] |= DSI_ERROR_PHY_MASK;
<> 144:ef7eb2e8f9f7 340 }
<> 144:ef7eb2e8f9f7 341
<> 144:ef7eb2e8f9f7 342 if((ActiveErrors & HAL_DSI_ERROR_TX) != RESET)
<> 144:ef7eb2e8f9f7 343 {
<> 144:ef7eb2e8f9f7 344 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 345 hdsi->Instance->IER[1] |= DSI_ERROR_TX_MASK;
<> 144:ef7eb2e8f9f7 346 }
<> 144:ef7eb2e8f9f7 347
<> 144:ef7eb2e8f9f7 348 if((ActiveErrors & HAL_DSI_ERROR_RX) != RESET)
<> 144:ef7eb2e8f9f7 349 {
<> 144:ef7eb2e8f9f7 350 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 351 hdsi->Instance->IER[1] |= DSI_ERROR_RX_MASK;
<> 144:ef7eb2e8f9f7 352 }
<> 144:ef7eb2e8f9f7 353
<> 144:ef7eb2e8f9f7 354 if((ActiveErrors & HAL_DSI_ERROR_ECC) != RESET)
<> 144:ef7eb2e8f9f7 355 {
<> 144:ef7eb2e8f9f7 356 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 357 hdsi->Instance->IER[1] |= DSI_ERROR_ECC_MASK;
<> 144:ef7eb2e8f9f7 358 }
<> 144:ef7eb2e8f9f7 359
<> 144:ef7eb2e8f9f7 360 if((ActiveErrors & HAL_DSI_ERROR_CRC) != RESET)
<> 144:ef7eb2e8f9f7 361 {
<> 144:ef7eb2e8f9f7 362 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 363 hdsi->Instance->IER[1] |= DSI_ERROR_CRC_MASK;
<> 144:ef7eb2e8f9f7 364 }
<> 144:ef7eb2e8f9f7 365
<> 144:ef7eb2e8f9f7 366 if((ActiveErrors & HAL_DSI_ERROR_PSE) != RESET)
<> 144:ef7eb2e8f9f7 367 {
<> 144:ef7eb2e8f9f7 368 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 369 hdsi->Instance->IER[1] |= DSI_ERROR_PSE_MASK;
<> 144:ef7eb2e8f9f7 370 }
<> 144:ef7eb2e8f9f7 371
<> 144:ef7eb2e8f9f7 372 if((ActiveErrors & HAL_DSI_ERROR_EOT) != RESET)
<> 144:ef7eb2e8f9f7 373 {
<> 144:ef7eb2e8f9f7 374 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 375 hdsi->Instance->IER[1] |= DSI_ERROR_EOT_MASK;
<> 144:ef7eb2e8f9f7 376 }
<> 144:ef7eb2e8f9f7 377
<> 144:ef7eb2e8f9f7 378 if((ActiveErrors & HAL_DSI_ERROR_OVF) != RESET)
<> 144:ef7eb2e8f9f7 379 {
<> 144:ef7eb2e8f9f7 380 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 381 hdsi->Instance->IER[1] |= DSI_ERROR_OVF_MASK;
<> 144:ef7eb2e8f9f7 382 }
<> 144:ef7eb2e8f9f7 383
<> 144:ef7eb2e8f9f7 384 if((ActiveErrors & HAL_DSI_ERROR_GEN) != RESET)
<> 144:ef7eb2e8f9f7 385 {
<> 144:ef7eb2e8f9f7 386 /* Enable the interrupt generation on selected errors */
<> 144:ef7eb2e8f9f7 387 hdsi->Instance->IER[1] |= DSI_ERROR_GEN_MASK;
<> 144:ef7eb2e8f9f7 388 }
<> 144:ef7eb2e8f9f7 389
<> 144:ef7eb2e8f9f7 390 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 391 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 392
<> 144:ef7eb2e8f9f7 393 return HAL_OK;
<> 144:ef7eb2e8f9f7 394 }
<> 144:ef7eb2e8f9f7 395
<> 144:ef7eb2e8f9f7 396 /**
<> 144:ef7eb2e8f9f7 397 * @brief Initializes the DSI MSP.
AnnaBridge 183:a56a73fd2a6f 398 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 399 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 400 * @retval None
<> 144:ef7eb2e8f9f7 401 */
<> 144:ef7eb2e8f9f7 402 __weak void HAL_DSI_MspInit(DSI_HandleTypeDef* hdsi)
<> 144:ef7eb2e8f9f7 403 {
<> 144:ef7eb2e8f9f7 404 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 405 UNUSED(hdsi);
<> 144:ef7eb2e8f9f7 406
<> 144:ef7eb2e8f9f7 407 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 408 the HAL_DSI_MspInit could be implemented in the user file
<> 144:ef7eb2e8f9f7 409 */
<> 144:ef7eb2e8f9f7 410 }
<> 144:ef7eb2e8f9f7 411
<> 144:ef7eb2e8f9f7 412 /**
<> 144:ef7eb2e8f9f7 413 * @brief De-initializes the DSI MSP.
AnnaBridge 183:a56a73fd2a6f 414 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 415 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 416 * @retval None
<> 144:ef7eb2e8f9f7 417 */
<> 144:ef7eb2e8f9f7 418 __weak void HAL_DSI_MspDeInit(DSI_HandleTypeDef* hdsi)
<> 144:ef7eb2e8f9f7 419 {
<> 144:ef7eb2e8f9f7 420 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 421 UNUSED(hdsi);
<> 144:ef7eb2e8f9f7 422
<> 144:ef7eb2e8f9f7 423 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 424 the HAL_DSI_MspDeInit could be implemented in the user file
<> 144:ef7eb2e8f9f7 425 */
<> 144:ef7eb2e8f9f7 426 }
<> 144:ef7eb2e8f9f7 427
<> 144:ef7eb2e8f9f7 428 /**
<> 144:ef7eb2e8f9f7 429 * @}
<> 144:ef7eb2e8f9f7 430 */
<> 144:ef7eb2e8f9f7 431
<> 144:ef7eb2e8f9f7 432 /** @defgroup DSI_Group2 IO operation functions
<> 144:ef7eb2e8f9f7 433 * @brief IO operation functions
<> 144:ef7eb2e8f9f7 434 *
<> 144:ef7eb2e8f9f7 435 @verbatim
<> 144:ef7eb2e8f9f7 436 ===============================================================================
<> 144:ef7eb2e8f9f7 437 ##### IO operation functions #####
<> 144:ef7eb2e8f9f7 438 ===============================================================================
<> 144:ef7eb2e8f9f7 439 [..] This section provides function allowing to:
<> 144:ef7eb2e8f9f7 440 (+) Handle DSI interrupt request
<> 144:ef7eb2e8f9f7 441
<> 144:ef7eb2e8f9f7 442 @endverbatim
<> 144:ef7eb2e8f9f7 443 * @{
<> 144:ef7eb2e8f9f7 444 */
<> 144:ef7eb2e8f9f7 445 /**
<> 144:ef7eb2e8f9f7 446 * @brief Handles DSI interrupt request.
AnnaBridge 183:a56a73fd2a6f 447 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 448 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 449 * @retval HAL status
<> 144:ef7eb2e8f9f7 450 */
<> 144:ef7eb2e8f9f7 451 void HAL_DSI_IRQHandler(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 452 {
<> 144:ef7eb2e8f9f7 453 uint32_t ErrorStatus0, ErrorStatus1;
<> 144:ef7eb2e8f9f7 454
<> 144:ef7eb2e8f9f7 455 /* Tearing Effect Interrupt management ***************************************/
<> 144:ef7eb2e8f9f7 456 if(__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_TE) != RESET)
<> 144:ef7eb2e8f9f7 457 {
<> 144:ef7eb2e8f9f7 458 if(__HAL_DSI_GET_IT_SOURCE(hdsi, DSI_IT_TE) != RESET)
<> 144:ef7eb2e8f9f7 459 {
<> 144:ef7eb2e8f9f7 460 /* Clear the Tearing Effect Interrupt Flag */
<> 144:ef7eb2e8f9f7 461 __HAL_DSI_CLEAR_FLAG(hdsi, DSI_FLAG_TE);
<> 144:ef7eb2e8f9f7 462
<> 144:ef7eb2e8f9f7 463 /* Tearing Effect Callback */
<> 144:ef7eb2e8f9f7 464 HAL_DSI_TearingEffectCallback(hdsi);
<> 144:ef7eb2e8f9f7 465 }
<> 144:ef7eb2e8f9f7 466 }
<> 144:ef7eb2e8f9f7 467
<> 144:ef7eb2e8f9f7 468 /* End of Refresh Interrupt management ***************************************/
<> 144:ef7eb2e8f9f7 469 if(__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_ER) != RESET)
<> 144:ef7eb2e8f9f7 470 {
<> 144:ef7eb2e8f9f7 471 if(__HAL_DSI_GET_IT_SOURCE(hdsi, DSI_IT_ER) != RESET)
<> 144:ef7eb2e8f9f7 472 {
<> 144:ef7eb2e8f9f7 473 /* Clear the End of Refresh Interrupt Flag */
<> 144:ef7eb2e8f9f7 474 __HAL_DSI_CLEAR_FLAG(hdsi, DSI_FLAG_ER);
<> 144:ef7eb2e8f9f7 475
<> 144:ef7eb2e8f9f7 476 /* End of Refresh Callback */
<> 144:ef7eb2e8f9f7 477 HAL_DSI_EndOfRefreshCallback(hdsi);
<> 144:ef7eb2e8f9f7 478 }
<> 144:ef7eb2e8f9f7 479 }
<> 144:ef7eb2e8f9f7 480
<> 144:ef7eb2e8f9f7 481 /* Error Interrupts management ***********************************************/
<> 144:ef7eb2e8f9f7 482 if(hdsi->ErrorMsk != 0)
<> 144:ef7eb2e8f9f7 483 {
<> 144:ef7eb2e8f9f7 484 ErrorStatus0 = hdsi->Instance->ISR[0];
<> 144:ef7eb2e8f9f7 485 ErrorStatus0 &= hdsi->Instance->IER[0];
<> 144:ef7eb2e8f9f7 486 ErrorStatus1 = hdsi->Instance->ISR[1];
<> 144:ef7eb2e8f9f7 487 ErrorStatus1 &= hdsi->Instance->IER[1];
<> 144:ef7eb2e8f9f7 488
<> 144:ef7eb2e8f9f7 489 if((ErrorStatus0 & DSI_ERROR_ACK_MASK) != RESET)
<> 144:ef7eb2e8f9f7 490 {
<> 144:ef7eb2e8f9f7 491 hdsi->ErrorCode |= HAL_DSI_ERROR_ACK;
<> 144:ef7eb2e8f9f7 492 }
<> 144:ef7eb2e8f9f7 493
<> 144:ef7eb2e8f9f7 494 if((ErrorStatus0 & DSI_ERROR_PHY_MASK) != RESET)
<> 144:ef7eb2e8f9f7 495 {
<> 144:ef7eb2e8f9f7 496 hdsi->ErrorCode |= HAL_DSI_ERROR_PHY;
<> 144:ef7eb2e8f9f7 497 }
<> 144:ef7eb2e8f9f7 498
<> 144:ef7eb2e8f9f7 499 if((ErrorStatus1 & DSI_ERROR_TX_MASK) != RESET)
<> 144:ef7eb2e8f9f7 500 {
<> 144:ef7eb2e8f9f7 501 hdsi->ErrorCode |= HAL_DSI_ERROR_TX;
<> 144:ef7eb2e8f9f7 502 }
<> 144:ef7eb2e8f9f7 503
<> 144:ef7eb2e8f9f7 504 if((ErrorStatus1 & DSI_ERROR_RX_MASK) != RESET)
<> 144:ef7eb2e8f9f7 505 {
<> 144:ef7eb2e8f9f7 506 hdsi->ErrorCode |= HAL_DSI_ERROR_RX;
<> 144:ef7eb2e8f9f7 507 }
<> 144:ef7eb2e8f9f7 508
<> 144:ef7eb2e8f9f7 509 if((ErrorStatus1 & DSI_ERROR_ECC_MASK) != RESET)
<> 144:ef7eb2e8f9f7 510 {
<> 144:ef7eb2e8f9f7 511 hdsi->ErrorCode |= HAL_DSI_ERROR_ECC;
<> 144:ef7eb2e8f9f7 512 }
<> 144:ef7eb2e8f9f7 513
<> 144:ef7eb2e8f9f7 514 if((ErrorStatus1 & DSI_ERROR_CRC_MASK) != RESET)
<> 144:ef7eb2e8f9f7 515 {
<> 144:ef7eb2e8f9f7 516 hdsi->ErrorCode |= HAL_DSI_ERROR_CRC;
<> 144:ef7eb2e8f9f7 517 }
<> 144:ef7eb2e8f9f7 518
<> 144:ef7eb2e8f9f7 519 if((ErrorStatus1 & DSI_ERROR_PSE_MASK) != RESET)
<> 144:ef7eb2e8f9f7 520 {
<> 144:ef7eb2e8f9f7 521 hdsi->ErrorCode |= HAL_DSI_ERROR_PSE;
<> 144:ef7eb2e8f9f7 522 }
<> 144:ef7eb2e8f9f7 523
<> 144:ef7eb2e8f9f7 524 if((ErrorStatus1 & DSI_ERROR_EOT_MASK) != RESET)
<> 144:ef7eb2e8f9f7 525 {
<> 144:ef7eb2e8f9f7 526 hdsi->ErrorCode |= HAL_DSI_ERROR_EOT;
<> 144:ef7eb2e8f9f7 527 }
<> 144:ef7eb2e8f9f7 528
<> 144:ef7eb2e8f9f7 529 if((ErrorStatus1 & DSI_ERROR_OVF_MASK) != RESET)
<> 144:ef7eb2e8f9f7 530 {
<> 144:ef7eb2e8f9f7 531 hdsi->ErrorCode |= HAL_DSI_ERROR_OVF;
<> 144:ef7eb2e8f9f7 532 }
<> 144:ef7eb2e8f9f7 533
<> 144:ef7eb2e8f9f7 534 if((ErrorStatus1 & DSI_ERROR_GEN_MASK) != RESET)
<> 144:ef7eb2e8f9f7 535 {
<> 144:ef7eb2e8f9f7 536 hdsi->ErrorCode |= HAL_DSI_ERROR_GEN;
<> 144:ef7eb2e8f9f7 537 }
<> 144:ef7eb2e8f9f7 538
<> 144:ef7eb2e8f9f7 539 /* Check only selected errors */
<> 144:ef7eb2e8f9f7 540 if(hdsi->ErrorCode != HAL_DSI_ERROR_NONE)
<> 144:ef7eb2e8f9f7 541 {
<> 144:ef7eb2e8f9f7 542 /* DSI error interrupt user callback */
<> 144:ef7eb2e8f9f7 543 HAL_DSI_ErrorCallback(hdsi);
<> 144:ef7eb2e8f9f7 544 }
<> 144:ef7eb2e8f9f7 545 }
<> 144:ef7eb2e8f9f7 546 }
<> 144:ef7eb2e8f9f7 547
<> 144:ef7eb2e8f9f7 548 /**
<> 144:ef7eb2e8f9f7 549 * @brief Tearing Effect DSI callback.
AnnaBridge 183:a56a73fd2a6f 550 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 551 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 552 * @retval None
<> 144:ef7eb2e8f9f7 553 */
<> 144:ef7eb2e8f9f7 554 __weak void HAL_DSI_TearingEffectCallback(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 555 {
<> 144:ef7eb2e8f9f7 556 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 557 UNUSED(hdsi);
<> 144:ef7eb2e8f9f7 558
<> 144:ef7eb2e8f9f7 559 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 560 the HAL_DSI_TearingEffectCallback could be implemented in the user file
<> 144:ef7eb2e8f9f7 561 */
<> 144:ef7eb2e8f9f7 562 }
<> 144:ef7eb2e8f9f7 563
<> 144:ef7eb2e8f9f7 564 /**
<> 144:ef7eb2e8f9f7 565 * @brief End of Refresh DSI callback.
AnnaBridge 183:a56a73fd2a6f 566 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 567 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 568 * @retval None
<> 144:ef7eb2e8f9f7 569 */
<> 144:ef7eb2e8f9f7 570 __weak void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 571 {
<> 144:ef7eb2e8f9f7 572 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 573 UNUSED(hdsi);
<> 144:ef7eb2e8f9f7 574
<> 144:ef7eb2e8f9f7 575 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 576 the HAL_DSI_EndOfRefreshCallback could be implemented in the user file
<> 144:ef7eb2e8f9f7 577 */
<> 144:ef7eb2e8f9f7 578 }
<> 144:ef7eb2e8f9f7 579
<> 144:ef7eb2e8f9f7 580 /**
<> 144:ef7eb2e8f9f7 581 * @brief Operation Error DSI callback.
AnnaBridge 183:a56a73fd2a6f 582 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 583 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 584 * @retval None
<> 144:ef7eb2e8f9f7 585 */
<> 144:ef7eb2e8f9f7 586 __weak void HAL_DSI_ErrorCallback(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 587 {
<> 144:ef7eb2e8f9f7 588 /* Prevent unused argument(s) compilation warning */
<> 144:ef7eb2e8f9f7 589 UNUSED(hdsi);
<> 144:ef7eb2e8f9f7 590
<> 144:ef7eb2e8f9f7 591 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 592 the HAL_DSI_ErrorCallback could be implemented in the user file
<> 144:ef7eb2e8f9f7 593 */
<> 144:ef7eb2e8f9f7 594 }
<> 144:ef7eb2e8f9f7 595
<> 144:ef7eb2e8f9f7 596 /**
<> 144:ef7eb2e8f9f7 597 * @}
<> 144:ef7eb2e8f9f7 598 */
<> 144:ef7eb2e8f9f7 599
<> 144:ef7eb2e8f9f7 600 /** @defgroup DSI_Group3 Peripheral Control functions
<> 144:ef7eb2e8f9f7 601 * @brief Peripheral Control functions
<> 144:ef7eb2e8f9f7 602 *
<> 144:ef7eb2e8f9f7 603 @verbatim
<> 144:ef7eb2e8f9f7 604 ===============================================================================
<> 144:ef7eb2e8f9f7 605 ##### Peripheral Control functions #####
<> 161:2cc1468da177 606 ===============================================================================
<> 144:ef7eb2e8f9f7 607
<> 144:ef7eb2e8f9f7 608 @endverbatim
<> 144:ef7eb2e8f9f7 609 * @{
<> 144:ef7eb2e8f9f7 610 */
<> 144:ef7eb2e8f9f7 611
<> 144:ef7eb2e8f9f7 612 /**
<> 144:ef7eb2e8f9f7 613 * @brief Configure the Generic interface read-back Virtual Channel ID.
AnnaBridge 183:a56a73fd2a6f 614 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 615 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 616 * @param VirtualChannelID Virtual channel ID
<> 144:ef7eb2e8f9f7 617 * @retval HAL status
<> 144:ef7eb2e8f9f7 618 */
<> 144:ef7eb2e8f9f7 619 HAL_StatusTypeDef HAL_DSI_SetGenericVCID(DSI_HandleTypeDef *hdsi, uint32_t VirtualChannelID)
<> 144:ef7eb2e8f9f7 620 {
<> 144:ef7eb2e8f9f7 621 /* Process locked */
<> 144:ef7eb2e8f9f7 622 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 623
<> 144:ef7eb2e8f9f7 624 /* Update the GVCID register */
<> 144:ef7eb2e8f9f7 625 hdsi->Instance->GVCIDR &= ~DSI_GVCIDR_VCID;
<> 144:ef7eb2e8f9f7 626 hdsi->Instance->GVCIDR |= VirtualChannelID;
<> 144:ef7eb2e8f9f7 627
<> 144:ef7eb2e8f9f7 628 /* Process unlocked */
<> 144:ef7eb2e8f9f7 629 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 630
<> 144:ef7eb2e8f9f7 631 return HAL_OK;
<> 144:ef7eb2e8f9f7 632 }
<> 144:ef7eb2e8f9f7 633
<> 144:ef7eb2e8f9f7 634 /**
<> 144:ef7eb2e8f9f7 635 * @brief Select video mode and configure the corresponding parameters
AnnaBridge 183:a56a73fd2a6f 636 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 637 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 638 * @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains
<> 144:ef7eb2e8f9f7 639 * the DSI video mode configuration parameters
<> 144:ef7eb2e8f9f7 640 * @retval HAL status
<> 144:ef7eb2e8f9f7 641 */
<> 144:ef7eb2e8f9f7 642 HAL_StatusTypeDef HAL_DSI_ConfigVideoMode(DSI_HandleTypeDef *hdsi, DSI_VidCfgTypeDef *VidCfg)
<> 144:ef7eb2e8f9f7 643 {
<> 144:ef7eb2e8f9f7 644 /* Process locked */
<> 144:ef7eb2e8f9f7 645 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 646
<> 144:ef7eb2e8f9f7 647 /* Check the parameters */
<> 144:ef7eb2e8f9f7 648 assert_param(IS_DSI_COLOR_CODING(VidCfg->ColorCoding));
<> 144:ef7eb2e8f9f7 649 assert_param(IS_DSI_VIDEO_MODE_TYPE(VidCfg->Mode));
<> 144:ef7eb2e8f9f7 650 assert_param(IS_DSI_LP_COMMAND(VidCfg->LPCommandEnable));
<> 144:ef7eb2e8f9f7 651 assert_param(IS_DSI_LP_HFP(VidCfg->LPHorizontalFrontPorchEnable));
<> 144:ef7eb2e8f9f7 652 assert_param(IS_DSI_LP_HBP(VidCfg->LPHorizontalBackPorchEnable));
<> 144:ef7eb2e8f9f7 653 assert_param(IS_DSI_LP_VACTIVE(VidCfg->LPVerticalActiveEnable));
<> 144:ef7eb2e8f9f7 654 assert_param(IS_DSI_LP_VFP(VidCfg->LPVerticalFrontPorchEnable));
<> 144:ef7eb2e8f9f7 655 assert_param(IS_DSI_LP_VBP(VidCfg->LPVerticalBackPorchEnable));
<> 144:ef7eb2e8f9f7 656 assert_param(IS_DSI_LP_VSYNC(VidCfg->LPVerticalSyncActiveEnable));
<> 144:ef7eb2e8f9f7 657 assert_param(IS_DSI_FBTAA(VidCfg->FrameBTAAcknowledgeEnable));
<> 144:ef7eb2e8f9f7 658 assert_param(IS_DSI_DE_POLARITY(VidCfg->DEPolarity));
<> 144:ef7eb2e8f9f7 659 assert_param(IS_DSI_VSYNC_POLARITY(VidCfg->VSPolarity));
<> 144:ef7eb2e8f9f7 660 assert_param(IS_DSI_HSYNC_POLARITY(VidCfg->HSPolarity));
<> 144:ef7eb2e8f9f7 661 /* Check the LooselyPacked variant only in 18-bit mode */
<> 144:ef7eb2e8f9f7 662 if(VidCfg->ColorCoding == DSI_RGB666)
<> 144:ef7eb2e8f9f7 663 {
<> 144:ef7eb2e8f9f7 664 assert_param(IS_DSI_LOOSELY_PACKED(VidCfg->LooselyPacked));
<> 144:ef7eb2e8f9f7 665 }
<> 144:ef7eb2e8f9f7 666
<> 144:ef7eb2e8f9f7 667 /* Select video mode by resetting CMDM and DSIM bits */
<> 144:ef7eb2e8f9f7 668 hdsi->Instance->MCR &= ~DSI_MCR_CMDM;
<> 144:ef7eb2e8f9f7 669 hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM;
<> 144:ef7eb2e8f9f7 670
<> 144:ef7eb2e8f9f7 671 /* Configure the video mode transmission type */
<> 144:ef7eb2e8f9f7 672 hdsi->Instance->VMCR &= ~DSI_VMCR_VMT;
<> 144:ef7eb2e8f9f7 673 hdsi->Instance->VMCR |= VidCfg->Mode;
<> 144:ef7eb2e8f9f7 674
<> 144:ef7eb2e8f9f7 675 /* Configure the video packet size */
<> 144:ef7eb2e8f9f7 676 hdsi->Instance->VPCR &= ~DSI_VPCR_VPSIZE;
<> 144:ef7eb2e8f9f7 677 hdsi->Instance->VPCR |= VidCfg->PacketSize;
<> 144:ef7eb2e8f9f7 678
<> 144:ef7eb2e8f9f7 679 /* Set the chunks number to be transmitted through the DSI link */
<> 144:ef7eb2e8f9f7 680 hdsi->Instance->VCCR &= ~DSI_VCCR_NUMC;
<> 144:ef7eb2e8f9f7 681 hdsi->Instance->VCCR |= VidCfg->NumberOfChunks;
<> 144:ef7eb2e8f9f7 682
<> 144:ef7eb2e8f9f7 683 /* Set the size of the null packet */
<> 144:ef7eb2e8f9f7 684 hdsi->Instance->VNPCR &= ~DSI_VNPCR_NPSIZE;
<> 144:ef7eb2e8f9f7 685 hdsi->Instance->VNPCR |= VidCfg->NullPacketSize;
<> 144:ef7eb2e8f9f7 686
<> 144:ef7eb2e8f9f7 687 /* Select the virtual channel for the LTDC interface traffic */
<> 144:ef7eb2e8f9f7 688 hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID;
<> 144:ef7eb2e8f9f7 689 hdsi->Instance->LVCIDR |= VidCfg->VirtualChannelID;
<> 144:ef7eb2e8f9f7 690
<> 144:ef7eb2e8f9f7 691 /* Configure the polarity of control signals */
<> 144:ef7eb2e8f9f7 692 hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP);
<> 144:ef7eb2e8f9f7 693 hdsi->Instance->LPCR |= (VidCfg->DEPolarity | VidCfg->VSPolarity | VidCfg->HSPolarity);
<> 144:ef7eb2e8f9f7 694
<> 144:ef7eb2e8f9f7 695 /* Select the color coding for the host */
<> 144:ef7eb2e8f9f7 696 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC;
<> 144:ef7eb2e8f9f7 697 hdsi->Instance->LCOLCR |= VidCfg->ColorCoding;
<> 144:ef7eb2e8f9f7 698
<> 144:ef7eb2e8f9f7 699 /* Select the color coding for the wrapper */
<> 144:ef7eb2e8f9f7 700 hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX;
<> 144:ef7eb2e8f9f7 701 hdsi->Instance->WCFGR |= ((VidCfg->ColorCoding)<<1);
<> 144:ef7eb2e8f9f7 702
<> 144:ef7eb2e8f9f7 703 /* Enable/disable the loosely packed variant to 18-bit configuration */
<> 144:ef7eb2e8f9f7 704 if(VidCfg->ColorCoding == DSI_RGB666)
<> 144:ef7eb2e8f9f7 705 {
<> 144:ef7eb2e8f9f7 706 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_LPE;
<> 144:ef7eb2e8f9f7 707 hdsi->Instance->LCOLCR |= VidCfg->LooselyPacked;
<> 144:ef7eb2e8f9f7 708 }
<> 144:ef7eb2e8f9f7 709
<> 144:ef7eb2e8f9f7 710 /* Set the Horizontal Synchronization Active (HSA) in lane byte clock cycles */
<> 144:ef7eb2e8f9f7 711 hdsi->Instance->VHSACR &= ~DSI_VHSACR_HSA;
<> 144:ef7eb2e8f9f7 712 hdsi->Instance->VHSACR |= VidCfg->HorizontalSyncActive;
<> 144:ef7eb2e8f9f7 713
<> 144:ef7eb2e8f9f7 714 /* Set the Horizontal Back Porch (HBP) in lane byte clock cycles */
<> 144:ef7eb2e8f9f7 715 hdsi->Instance->VHBPCR &= ~DSI_VHBPCR_HBP;
<> 144:ef7eb2e8f9f7 716 hdsi->Instance->VHBPCR |= VidCfg->HorizontalBackPorch;
<> 144:ef7eb2e8f9f7 717
<> 144:ef7eb2e8f9f7 718 /* Set the total line time (HLINE=HSA+HBP+HACT+HFP) in lane byte clock cycles */
<> 144:ef7eb2e8f9f7 719 hdsi->Instance->VLCR &= ~DSI_VLCR_HLINE;
<> 144:ef7eb2e8f9f7 720 hdsi->Instance->VLCR |= VidCfg->HorizontalLine;
<> 144:ef7eb2e8f9f7 721
<> 144:ef7eb2e8f9f7 722 /* Set the Vertical Synchronization Active (VSA) */
<> 144:ef7eb2e8f9f7 723 hdsi->Instance->VVSACR &= ~DSI_VVSACR_VSA;
<> 144:ef7eb2e8f9f7 724 hdsi->Instance->VVSACR |= VidCfg->VerticalSyncActive;
<> 144:ef7eb2e8f9f7 725
<> 144:ef7eb2e8f9f7 726 /* Set the Vertical Back Porch (VBP)*/
<> 144:ef7eb2e8f9f7 727 hdsi->Instance->VVBPCR &= ~DSI_VVBPCR_VBP;
<> 144:ef7eb2e8f9f7 728 hdsi->Instance->VVBPCR |= VidCfg->VerticalBackPorch;
<> 144:ef7eb2e8f9f7 729
<> 144:ef7eb2e8f9f7 730 /* Set the Vertical Front Porch (VFP)*/
<> 144:ef7eb2e8f9f7 731 hdsi->Instance->VVFPCR &= ~DSI_VVFPCR_VFP;
<> 144:ef7eb2e8f9f7 732 hdsi->Instance->VVFPCR |= VidCfg->VerticalFrontPorch;
<> 144:ef7eb2e8f9f7 733
<> 144:ef7eb2e8f9f7 734 /* Set the Vertical Active period*/
<> 144:ef7eb2e8f9f7 735 hdsi->Instance->VVACR &= ~DSI_VVACR_VA;
<> 144:ef7eb2e8f9f7 736 hdsi->Instance->VVACR |= VidCfg->VerticalActive;
<> 144:ef7eb2e8f9f7 737
<> 144:ef7eb2e8f9f7 738 /* Configure the command transmission mode */
<> 144:ef7eb2e8f9f7 739 hdsi->Instance->VMCR &= ~DSI_VMCR_LPCE;
<> 144:ef7eb2e8f9f7 740 hdsi->Instance->VMCR |= VidCfg->LPCommandEnable;
<> 144:ef7eb2e8f9f7 741
<> 144:ef7eb2e8f9f7 742 /* Low power largest packet size */
<> 144:ef7eb2e8f9f7 743 hdsi->Instance->LPMCR &= ~DSI_LPMCR_LPSIZE;
<> 144:ef7eb2e8f9f7 744 hdsi->Instance->LPMCR |= ((VidCfg->LPLargestPacketSize)<<16);
<> 144:ef7eb2e8f9f7 745
<> 144:ef7eb2e8f9f7 746 /* Low power VACT largest packet size */
<> 144:ef7eb2e8f9f7 747 hdsi->Instance->LPMCR &= ~DSI_LPMCR_VLPSIZE;
<> 144:ef7eb2e8f9f7 748 hdsi->Instance->LPMCR |= VidCfg->LPVACTLargestPacketSize;
<> 144:ef7eb2e8f9f7 749
<> 144:ef7eb2e8f9f7 750 /* Enable LP transition in HFP period */
<> 144:ef7eb2e8f9f7 751 hdsi->Instance->VMCR &= ~DSI_VMCR_LPHFPE;
<> 144:ef7eb2e8f9f7 752 hdsi->Instance->VMCR |= VidCfg->LPHorizontalFrontPorchEnable;
<> 144:ef7eb2e8f9f7 753
<> 144:ef7eb2e8f9f7 754 /* Enable LP transition in HBP period */
<> 144:ef7eb2e8f9f7 755 hdsi->Instance->VMCR &= ~DSI_VMCR_LPHBPE;
<> 144:ef7eb2e8f9f7 756 hdsi->Instance->VMCR |= VidCfg->LPHorizontalBackPorchEnable;
<> 144:ef7eb2e8f9f7 757
<> 144:ef7eb2e8f9f7 758 /* Enable LP transition in VACT period */
<> 144:ef7eb2e8f9f7 759 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVAE;
<> 144:ef7eb2e8f9f7 760 hdsi->Instance->VMCR |= VidCfg->LPVerticalActiveEnable;
<> 144:ef7eb2e8f9f7 761
<> 144:ef7eb2e8f9f7 762 /* Enable LP transition in VFP period */
<> 144:ef7eb2e8f9f7 763 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVFPE;
<> 144:ef7eb2e8f9f7 764 hdsi->Instance->VMCR |= VidCfg->LPVerticalFrontPorchEnable;
<> 144:ef7eb2e8f9f7 765
<> 144:ef7eb2e8f9f7 766 /* Enable LP transition in VBP period */
<> 144:ef7eb2e8f9f7 767 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVBPE;
<> 144:ef7eb2e8f9f7 768 hdsi->Instance->VMCR |= VidCfg->LPVerticalBackPorchEnable;
<> 144:ef7eb2e8f9f7 769
<> 144:ef7eb2e8f9f7 770 /* Enable LP transition in vertical sync period */
<> 144:ef7eb2e8f9f7 771 hdsi->Instance->VMCR &= ~DSI_VMCR_LPVSAE;
<> 144:ef7eb2e8f9f7 772 hdsi->Instance->VMCR |= VidCfg->LPVerticalSyncActiveEnable;
<> 144:ef7eb2e8f9f7 773
<> 144:ef7eb2e8f9f7 774 /* Enable the request for an acknowledge response at the end of a frame */
<> 144:ef7eb2e8f9f7 775 hdsi->Instance->VMCR &= ~DSI_VMCR_FBTAAE;
<> 144:ef7eb2e8f9f7 776 hdsi->Instance->VMCR |= VidCfg->FrameBTAAcknowledgeEnable;
<> 144:ef7eb2e8f9f7 777
<> 144:ef7eb2e8f9f7 778 /* Process unlocked */
<> 144:ef7eb2e8f9f7 779 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 780
<> 144:ef7eb2e8f9f7 781 return HAL_OK;
<> 144:ef7eb2e8f9f7 782 }
<> 144:ef7eb2e8f9f7 783
<> 144:ef7eb2e8f9f7 784 /**
<> 144:ef7eb2e8f9f7 785 * @brief Select adapted command mode and configure the corresponding parameters
AnnaBridge 183:a56a73fd2a6f 786 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 787 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 788 * @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains
<> 144:ef7eb2e8f9f7 789 * the DSI command mode configuration parameters
<> 144:ef7eb2e8f9f7 790 * @retval HAL status
<> 144:ef7eb2e8f9f7 791 */
<> 144:ef7eb2e8f9f7 792 HAL_StatusTypeDef HAL_DSI_ConfigAdaptedCommandMode(DSI_HandleTypeDef *hdsi, DSI_CmdCfgTypeDef *CmdCfg)
<> 144:ef7eb2e8f9f7 793 {
<> 144:ef7eb2e8f9f7 794 /* Process locked */
<> 144:ef7eb2e8f9f7 795 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 796
<> 144:ef7eb2e8f9f7 797 /* Check the parameters */
<> 144:ef7eb2e8f9f7 798 assert_param(IS_DSI_COLOR_CODING(CmdCfg->ColorCoding));
<> 144:ef7eb2e8f9f7 799 assert_param(IS_DSI_TE_SOURCE(CmdCfg->TearingEffectSource));
<> 144:ef7eb2e8f9f7 800 assert_param(IS_DSI_TE_POLARITY(CmdCfg->TearingEffectPolarity));
<> 144:ef7eb2e8f9f7 801 assert_param(IS_DSI_AUTOMATIC_REFRESH(CmdCfg->AutomaticRefresh));
<> 144:ef7eb2e8f9f7 802 assert_param(IS_DSI_VS_POLARITY(CmdCfg->VSyncPol));
<> 144:ef7eb2e8f9f7 803 assert_param(IS_DSI_TE_ACK_REQUEST(CmdCfg->TEAcknowledgeRequest));
<> 144:ef7eb2e8f9f7 804 assert_param(IS_DSI_DE_POLARITY(CmdCfg->DEPolarity));
<> 144:ef7eb2e8f9f7 805 assert_param(IS_DSI_VSYNC_POLARITY(CmdCfg->VSPolarity));
<> 144:ef7eb2e8f9f7 806 assert_param(IS_DSI_HSYNC_POLARITY(CmdCfg->HSPolarity));
<> 144:ef7eb2e8f9f7 807
<> 144:ef7eb2e8f9f7 808 /* Select command mode by setting CMDM and DSIM bits */
<> 144:ef7eb2e8f9f7 809 hdsi->Instance->MCR |= DSI_MCR_CMDM;
<> 144:ef7eb2e8f9f7 810 hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM;
<> 144:ef7eb2e8f9f7 811 hdsi->Instance->WCFGR |= DSI_WCFGR_DSIM;
<> 144:ef7eb2e8f9f7 812
<> 144:ef7eb2e8f9f7 813 /* Select the virtual channel for the LTDC interface traffic */
<> 144:ef7eb2e8f9f7 814 hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID;
<> 144:ef7eb2e8f9f7 815 hdsi->Instance->LVCIDR |= CmdCfg->VirtualChannelID;
<> 144:ef7eb2e8f9f7 816
<> 144:ef7eb2e8f9f7 817 /* Configure the polarity of control signals */
<> 144:ef7eb2e8f9f7 818 hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP);
<> 144:ef7eb2e8f9f7 819 hdsi->Instance->LPCR |= (CmdCfg->DEPolarity | CmdCfg->VSPolarity | CmdCfg->HSPolarity);
<> 144:ef7eb2e8f9f7 820
<> 144:ef7eb2e8f9f7 821 /* Select the color coding for the host */
<> 144:ef7eb2e8f9f7 822 hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC;
<> 144:ef7eb2e8f9f7 823 hdsi->Instance->LCOLCR |= CmdCfg->ColorCoding;
<> 144:ef7eb2e8f9f7 824
<> 144:ef7eb2e8f9f7 825 /* Select the color coding for the wrapper */
<> 144:ef7eb2e8f9f7 826 hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX;
<> 144:ef7eb2e8f9f7 827 hdsi->Instance->WCFGR |= ((CmdCfg->ColorCoding)<<1);
<> 144:ef7eb2e8f9f7 828
<> 144:ef7eb2e8f9f7 829 /* Configure the maximum allowed size for write memory command */
<> 144:ef7eb2e8f9f7 830 hdsi->Instance->LCCR &= ~DSI_LCCR_CMDSIZE;
<> 144:ef7eb2e8f9f7 831 hdsi->Instance->LCCR |= CmdCfg->CommandSize;
<> 144:ef7eb2e8f9f7 832
<> 144:ef7eb2e8f9f7 833 /* Configure the tearing effect source and polarity and select the refresh mode */
<> 144:ef7eb2e8f9f7 834 hdsi->Instance->WCFGR &= ~(DSI_WCFGR_TESRC | DSI_WCFGR_TEPOL | DSI_WCFGR_AR | DSI_WCFGR_VSPOL);
<> 144:ef7eb2e8f9f7 835 hdsi->Instance->WCFGR |= (CmdCfg->TearingEffectSource | CmdCfg->TearingEffectPolarity | CmdCfg->AutomaticRefresh | CmdCfg->VSyncPol);
<> 144:ef7eb2e8f9f7 836
<> 144:ef7eb2e8f9f7 837 /* Configure the tearing effect acknowledge request */
<> 144:ef7eb2e8f9f7 838 hdsi->Instance->CMCR &= ~DSI_CMCR_TEARE;
<> 144:ef7eb2e8f9f7 839 hdsi->Instance->CMCR |= CmdCfg->TEAcknowledgeRequest;
<> 144:ef7eb2e8f9f7 840
<> 144:ef7eb2e8f9f7 841 /* Enable the Tearing Effect interrupt */
<> 144:ef7eb2e8f9f7 842 __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_TE);
<> 144:ef7eb2e8f9f7 843
<> 144:ef7eb2e8f9f7 844 /* Enable the End of Refresh interrupt */
<> 144:ef7eb2e8f9f7 845 __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_ER);
<> 144:ef7eb2e8f9f7 846
<> 144:ef7eb2e8f9f7 847 /* Process unlocked */
<> 144:ef7eb2e8f9f7 848 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 849
<> 144:ef7eb2e8f9f7 850 return HAL_OK;
<> 144:ef7eb2e8f9f7 851 }
<> 144:ef7eb2e8f9f7 852
<> 144:ef7eb2e8f9f7 853 /**
<> 144:ef7eb2e8f9f7 854 * @brief Configure command transmission mode: High-speed or Low-power
<> 144:ef7eb2e8f9f7 855 * and enable/disable acknowledge request after packet transmission
AnnaBridge 183:a56a73fd2a6f 856 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 857 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 858 * @param LPCmd pointer to a DSI_LPCmdTypeDef structure that contains
<> 144:ef7eb2e8f9f7 859 * the DSI command transmission mode configuration parameters
<> 144:ef7eb2e8f9f7 860 * @retval HAL status
<> 144:ef7eb2e8f9f7 861 */
<> 144:ef7eb2e8f9f7 862 HAL_StatusTypeDef HAL_DSI_ConfigCommand(DSI_HandleTypeDef *hdsi, DSI_LPCmdTypeDef *LPCmd)
<> 144:ef7eb2e8f9f7 863 {
<> 144:ef7eb2e8f9f7 864 /* Process locked */
<> 144:ef7eb2e8f9f7 865 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 866
<> 144:ef7eb2e8f9f7 867 assert_param(IS_DSI_LP_GSW0P(LPCmd->LPGenShortWriteNoP));
<> 144:ef7eb2e8f9f7 868 assert_param(IS_DSI_LP_GSW1P(LPCmd->LPGenShortWriteOneP));
<> 144:ef7eb2e8f9f7 869 assert_param(IS_DSI_LP_GSW2P(LPCmd->LPGenShortWriteTwoP));
<> 144:ef7eb2e8f9f7 870 assert_param(IS_DSI_LP_GSR0P(LPCmd->LPGenShortReadNoP));
<> 144:ef7eb2e8f9f7 871 assert_param(IS_DSI_LP_GSR1P(LPCmd->LPGenShortReadOneP));
<> 144:ef7eb2e8f9f7 872 assert_param(IS_DSI_LP_GSR2P(LPCmd->LPGenShortReadTwoP));
<> 144:ef7eb2e8f9f7 873 assert_param(IS_DSI_LP_GLW(LPCmd->LPGenLongWrite));
<> 144:ef7eb2e8f9f7 874 assert_param(IS_DSI_LP_DSW0P(LPCmd->LPDcsShortWriteNoP));
<> 144:ef7eb2e8f9f7 875 assert_param(IS_DSI_LP_DSW1P(LPCmd->LPDcsShortWriteOneP));
<> 144:ef7eb2e8f9f7 876 assert_param(IS_DSI_LP_DSR0P(LPCmd->LPDcsShortReadNoP));
<> 144:ef7eb2e8f9f7 877 assert_param(IS_DSI_LP_DLW(LPCmd->LPDcsLongWrite));
<> 144:ef7eb2e8f9f7 878 assert_param(IS_DSI_LP_MRDP(LPCmd->LPMaxReadPacket));
<> 144:ef7eb2e8f9f7 879 assert_param(IS_DSI_ACK_REQUEST(LPCmd->AcknowledgeRequest));
<> 144:ef7eb2e8f9f7 880
<> 144:ef7eb2e8f9f7 881 /* Select High-speed or Low-power for command transmission */
<> 144:ef7eb2e8f9f7 882 hdsi->Instance->CMCR &= ~(DSI_CMCR_GSW0TX |\
<> 144:ef7eb2e8f9f7 883 DSI_CMCR_GSW1TX |\
<> 144:ef7eb2e8f9f7 884 DSI_CMCR_GSW2TX |\
<> 144:ef7eb2e8f9f7 885 DSI_CMCR_GSR0TX |\
<> 144:ef7eb2e8f9f7 886 DSI_CMCR_GSR1TX |\
<> 144:ef7eb2e8f9f7 887 DSI_CMCR_GSR2TX |\
<> 144:ef7eb2e8f9f7 888 DSI_CMCR_GLWTX |\
<> 144:ef7eb2e8f9f7 889 DSI_CMCR_DSW0TX |\
<> 144:ef7eb2e8f9f7 890 DSI_CMCR_DSW1TX |\
<> 144:ef7eb2e8f9f7 891 DSI_CMCR_DSR0TX |\
<> 144:ef7eb2e8f9f7 892 DSI_CMCR_DLWTX |\
<> 144:ef7eb2e8f9f7 893 DSI_CMCR_MRDPS);
<> 144:ef7eb2e8f9f7 894 hdsi->Instance->CMCR |= (LPCmd->LPGenShortWriteNoP |\
<> 144:ef7eb2e8f9f7 895 LPCmd->LPGenShortWriteOneP |\
<> 144:ef7eb2e8f9f7 896 LPCmd->LPGenShortWriteTwoP |\
<> 144:ef7eb2e8f9f7 897 LPCmd->LPGenShortReadNoP |\
<> 144:ef7eb2e8f9f7 898 LPCmd->LPGenShortReadOneP |\
<> 144:ef7eb2e8f9f7 899 LPCmd->LPGenShortReadTwoP |\
<> 144:ef7eb2e8f9f7 900 LPCmd->LPGenLongWrite |\
<> 144:ef7eb2e8f9f7 901 LPCmd->LPDcsShortWriteNoP |\
<> 144:ef7eb2e8f9f7 902 LPCmd->LPDcsShortWriteOneP |\
<> 144:ef7eb2e8f9f7 903 LPCmd->LPDcsShortReadNoP |\
<> 144:ef7eb2e8f9f7 904 LPCmd->LPDcsLongWrite |\
<> 144:ef7eb2e8f9f7 905 LPCmd->LPMaxReadPacket);
<> 144:ef7eb2e8f9f7 906
<> 144:ef7eb2e8f9f7 907 /* Configure the acknowledge request after each packet transmission */
<> 144:ef7eb2e8f9f7 908 hdsi->Instance->CMCR &= ~DSI_CMCR_ARE;
<> 144:ef7eb2e8f9f7 909 hdsi->Instance->CMCR |= LPCmd->AcknowledgeRequest;
<> 144:ef7eb2e8f9f7 910
<> 144:ef7eb2e8f9f7 911 /* Process unlocked */
<> 144:ef7eb2e8f9f7 912 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 913
<> 144:ef7eb2e8f9f7 914 return HAL_OK;
<> 144:ef7eb2e8f9f7 915 }
<> 144:ef7eb2e8f9f7 916
<> 144:ef7eb2e8f9f7 917 /**
<> 144:ef7eb2e8f9f7 918 * @brief Configure the flow control parameters
AnnaBridge 183:a56a73fd2a6f 919 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 920 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 921 * @param FlowControl flow control feature(s) to be enabled.
<> 144:ef7eb2e8f9f7 922 * This parameter can be any combination of @ref DSI_FlowControl.
<> 144:ef7eb2e8f9f7 923 * @retval HAL status
<> 144:ef7eb2e8f9f7 924 */
<> 144:ef7eb2e8f9f7 925 HAL_StatusTypeDef HAL_DSI_ConfigFlowControl(DSI_HandleTypeDef *hdsi, uint32_t FlowControl)
<> 144:ef7eb2e8f9f7 926 {
<> 144:ef7eb2e8f9f7 927 /* Process locked */
<> 144:ef7eb2e8f9f7 928 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 929
<> 144:ef7eb2e8f9f7 930 /* Check the parameters */
<> 144:ef7eb2e8f9f7 931 assert_param(IS_DSI_FLOW_CONTROL(FlowControl));
<> 144:ef7eb2e8f9f7 932
<> 144:ef7eb2e8f9f7 933 /* Set the DSI Host Protocol Configuration Register */
<> 144:ef7eb2e8f9f7 934 hdsi->Instance->PCR &= ~DSI_FLOW_CONTROL_ALL;
<> 144:ef7eb2e8f9f7 935 hdsi->Instance->PCR |= FlowControl;
<> 144:ef7eb2e8f9f7 936
<> 144:ef7eb2e8f9f7 937 /* Process unlocked */
<> 144:ef7eb2e8f9f7 938 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 939
<> 144:ef7eb2e8f9f7 940 return HAL_OK;
<> 144:ef7eb2e8f9f7 941 }
<> 144:ef7eb2e8f9f7 942
<> 144:ef7eb2e8f9f7 943 /**
<> 144:ef7eb2e8f9f7 944 * @brief Configure the DSI PHY timer parameters
AnnaBridge 183:a56a73fd2a6f 945 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 946 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 947 * @param PhyTimers DSI_PHY_TimerTypeDef structure that contains
<> 144:ef7eb2e8f9f7 948 * the DSI PHY timing parameters
<> 144:ef7eb2e8f9f7 949 * @retval HAL status
<> 144:ef7eb2e8f9f7 950 */
<> 144:ef7eb2e8f9f7 951 HAL_StatusTypeDef HAL_DSI_ConfigPhyTimer(DSI_HandleTypeDef *hdsi, DSI_PHY_TimerTypeDef *PhyTimers)
<> 144:ef7eb2e8f9f7 952 {
<> 144:ef7eb2e8f9f7 953 uint32_t maxTime;
<> 144:ef7eb2e8f9f7 954 /* Process locked */
<> 144:ef7eb2e8f9f7 955 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 956
<> 144:ef7eb2e8f9f7 957 maxTime = (PhyTimers->ClockLaneLP2HSTime > PhyTimers->ClockLaneHS2LPTime)? PhyTimers->ClockLaneLP2HSTime: PhyTimers->ClockLaneHS2LPTime;
<> 144:ef7eb2e8f9f7 958
<> 144:ef7eb2e8f9f7 959 /* Clock lane timer configuration */
<> 144:ef7eb2e8f9f7 960
<> 144:ef7eb2e8f9f7 961 /* In Automatic Clock Lane control mode, the DSI Host can turn off the clock lane between two
<> 144:ef7eb2e8f9f7 962 High-Speed transmission.
<> 144:ef7eb2e8f9f7 963 To do so, the DSI Host calculates the time required for the clock lane to change from HighSpeed
<> 144:ef7eb2e8f9f7 964 to Low-Power and from Low-Power to High-Speed.
<> 144:ef7eb2e8f9f7 965 This timings are configured by the HS2LP_TIME and LP2HS_TIME in the DSI Host Clock Lane Timer Configuration Register (DSI_CLTCR).
<> 144:ef7eb2e8f9f7 966 But the DSI Host is not calculating LP2HS_TIME + HS2LP_TIME but 2 x HS2LP_TIME.
<> 144:ef7eb2e8f9f7 967
<> 144:ef7eb2e8f9f7 968 Workaround : Configure HS2LP_TIME and LP2HS_TIME with the same value being the max of HS2LP_TIME or LP2HS_TIME.
<> 144:ef7eb2e8f9f7 969 */
<> 144:ef7eb2e8f9f7 970 hdsi->Instance->CLTCR &= ~(DSI_CLTCR_LP2HS_TIME | DSI_CLTCR_HS2LP_TIME);
<> 144:ef7eb2e8f9f7 971 hdsi->Instance->CLTCR |= (maxTime | ((maxTime)<<16));
<> 144:ef7eb2e8f9f7 972
<> 144:ef7eb2e8f9f7 973 /* Data lane timer configuration */
<> 144:ef7eb2e8f9f7 974 hdsi->Instance->DLTCR &= ~(DSI_DLTCR_MRD_TIME | DSI_DLTCR_LP2HS_TIME | DSI_DLTCR_HS2LP_TIME);
<> 144:ef7eb2e8f9f7 975 hdsi->Instance->DLTCR |= (PhyTimers->DataLaneMaxReadTime | ((PhyTimers->DataLaneLP2HSTime)<<16) | ((PhyTimers->DataLaneHS2LPTime)<<24));
<> 144:ef7eb2e8f9f7 976
<> 144:ef7eb2e8f9f7 977 /* Configure the wait period to request HS transmission after a stop state */
<> 144:ef7eb2e8f9f7 978 hdsi->Instance->PCONFR &= ~DSI_PCONFR_SW_TIME;
<> 144:ef7eb2e8f9f7 979 hdsi->Instance->PCONFR |= ((PhyTimers->StopWaitTime)<<8);
<> 144:ef7eb2e8f9f7 980
<> 144:ef7eb2e8f9f7 981 /* Process unlocked */
<> 144:ef7eb2e8f9f7 982 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 983
<> 144:ef7eb2e8f9f7 984 return HAL_OK;
<> 144:ef7eb2e8f9f7 985 }
<> 144:ef7eb2e8f9f7 986
<> 144:ef7eb2e8f9f7 987 /**
<> 144:ef7eb2e8f9f7 988 * @brief Configure the DSI HOST timeout parameters
AnnaBridge 183:a56a73fd2a6f 989 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 990 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 991 * @param HostTimeouts DSI_HOST_TimeoutTypeDef structure that contains
<> 144:ef7eb2e8f9f7 992 * the DSI host timeout parameters
<> 144:ef7eb2e8f9f7 993 * @retval HAL status
<> 144:ef7eb2e8f9f7 994 */
<> 144:ef7eb2e8f9f7 995 HAL_StatusTypeDef HAL_DSI_ConfigHostTimeouts(DSI_HandleTypeDef *hdsi, DSI_HOST_TimeoutTypeDef *HostTimeouts)
<> 144:ef7eb2e8f9f7 996 {
<> 144:ef7eb2e8f9f7 997 /* Process locked */
<> 144:ef7eb2e8f9f7 998 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 999
<> 144:ef7eb2e8f9f7 1000 /* Set the timeout clock division factor */
<> 144:ef7eb2e8f9f7 1001 hdsi->Instance->CCR &= ~DSI_CCR_TOCKDIV;
<> 157:ff67d9f36b67 1002 hdsi->Instance->CCR |= ((HostTimeouts->TimeoutCkdiv)<<8);
<> 144:ef7eb2e8f9f7 1003
<> 144:ef7eb2e8f9f7 1004 /* High-speed transmission timeout */
<> 144:ef7eb2e8f9f7 1005 hdsi->Instance->TCCR[0] &= ~DSI_TCCR0_HSTX_TOCNT;
<> 144:ef7eb2e8f9f7 1006 hdsi->Instance->TCCR[0] |= ((HostTimeouts->HighSpeedTransmissionTimeout)<<16);
<> 144:ef7eb2e8f9f7 1007
<> 144:ef7eb2e8f9f7 1008 /* Low-power reception timeout */
<> 144:ef7eb2e8f9f7 1009 hdsi->Instance->TCCR[0] &= ~DSI_TCCR0_LPRX_TOCNT;
<> 144:ef7eb2e8f9f7 1010 hdsi->Instance->TCCR[0] |= HostTimeouts->LowPowerReceptionTimeout;
<> 144:ef7eb2e8f9f7 1011
<> 144:ef7eb2e8f9f7 1012 /* High-speed read timeout */
<> 144:ef7eb2e8f9f7 1013 hdsi->Instance->TCCR[1] &= ~DSI_TCCR1_HSRD_TOCNT;
<> 144:ef7eb2e8f9f7 1014 hdsi->Instance->TCCR[1] |= HostTimeouts->HighSpeedReadTimeout;
<> 144:ef7eb2e8f9f7 1015
<> 144:ef7eb2e8f9f7 1016 /* Low-power read timeout */
<> 144:ef7eb2e8f9f7 1017 hdsi->Instance->TCCR[2] &= ~DSI_TCCR2_LPRD_TOCNT;
<> 144:ef7eb2e8f9f7 1018 hdsi->Instance->TCCR[2] |= HostTimeouts->LowPowerReadTimeout;
<> 144:ef7eb2e8f9f7 1019
<> 144:ef7eb2e8f9f7 1020 /* High-speed write timeout */
<> 144:ef7eb2e8f9f7 1021 hdsi->Instance->TCCR[3] &= ~DSI_TCCR3_HSWR_TOCNT;
<> 144:ef7eb2e8f9f7 1022 hdsi->Instance->TCCR[3] |= HostTimeouts->HighSpeedWriteTimeout;
<> 144:ef7eb2e8f9f7 1023
<> 144:ef7eb2e8f9f7 1024 /* High-speed write presp mode */
<> 144:ef7eb2e8f9f7 1025 hdsi->Instance->TCCR[3] &= ~DSI_TCCR3_PM;
<> 144:ef7eb2e8f9f7 1026 hdsi->Instance->TCCR[3] |= HostTimeouts->HighSpeedWritePrespMode;
<> 144:ef7eb2e8f9f7 1027
<> 144:ef7eb2e8f9f7 1028 /* Low-speed write timeout */
<> 144:ef7eb2e8f9f7 1029 hdsi->Instance->TCCR[4] &= ~DSI_TCCR4_LPWR_TOCNT;
<> 144:ef7eb2e8f9f7 1030 hdsi->Instance->TCCR[4] |= HostTimeouts->LowPowerWriteTimeout;
<> 144:ef7eb2e8f9f7 1031
<> 144:ef7eb2e8f9f7 1032 /* BTA timeout */
<> 144:ef7eb2e8f9f7 1033 hdsi->Instance->TCCR[5] &= ~DSI_TCCR5_BTA_TOCNT;
<> 144:ef7eb2e8f9f7 1034 hdsi->Instance->TCCR[5] |= HostTimeouts->BTATimeout;
<> 144:ef7eb2e8f9f7 1035
<> 144:ef7eb2e8f9f7 1036 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1037 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1038
<> 144:ef7eb2e8f9f7 1039 return HAL_OK;
<> 144:ef7eb2e8f9f7 1040 }
<> 144:ef7eb2e8f9f7 1041
<> 144:ef7eb2e8f9f7 1042 /**
<> 144:ef7eb2e8f9f7 1043 * @brief Start the DSI module
AnnaBridge 183:a56a73fd2a6f 1044 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1045 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1046 * @retval HAL status
<> 144:ef7eb2e8f9f7 1047 */
<> 144:ef7eb2e8f9f7 1048 HAL_StatusTypeDef HAL_DSI_Start(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1049 {
<> 144:ef7eb2e8f9f7 1050 /* Process locked */
<> 144:ef7eb2e8f9f7 1051 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1052
<> 144:ef7eb2e8f9f7 1053 /* Enable the DSI host */
<> 144:ef7eb2e8f9f7 1054 __HAL_DSI_ENABLE(hdsi);
<> 144:ef7eb2e8f9f7 1055
<> 144:ef7eb2e8f9f7 1056 /* Enable the DSI wrapper */
<> 144:ef7eb2e8f9f7 1057 __HAL_DSI_WRAPPER_ENABLE(hdsi);
<> 144:ef7eb2e8f9f7 1058
<> 144:ef7eb2e8f9f7 1059 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1060 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1061
<> 144:ef7eb2e8f9f7 1062 return HAL_OK;
<> 144:ef7eb2e8f9f7 1063 }
<> 144:ef7eb2e8f9f7 1064
<> 144:ef7eb2e8f9f7 1065 /**
<> 144:ef7eb2e8f9f7 1066 * @brief Stop the DSI module
AnnaBridge 183:a56a73fd2a6f 1067 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1068 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1069 * @retval HAL status
<> 144:ef7eb2e8f9f7 1070 */
<> 144:ef7eb2e8f9f7 1071 HAL_StatusTypeDef HAL_DSI_Stop(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1072 {
<> 144:ef7eb2e8f9f7 1073 /* Process locked */
<> 144:ef7eb2e8f9f7 1074 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1075
<> 144:ef7eb2e8f9f7 1076 /* Disable the DSI host */
<> 144:ef7eb2e8f9f7 1077 __HAL_DSI_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 1078
<> 144:ef7eb2e8f9f7 1079 /* Disable the DSI wrapper */
<> 144:ef7eb2e8f9f7 1080 __HAL_DSI_WRAPPER_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 1081
<> 144:ef7eb2e8f9f7 1082 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1083 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1084
<> 144:ef7eb2e8f9f7 1085 return HAL_OK;
<> 144:ef7eb2e8f9f7 1086 }
<> 144:ef7eb2e8f9f7 1087
<> 144:ef7eb2e8f9f7 1088 /**
<> 144:ef7eb2e8f9f7 1089 * @brief Refresh the display in command mode
AnnaBridge 183:a56a73fd2a6f 1090 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1091 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1092 * @retval HAL status
<> 144:ef7eb2e8f9f7 1093 */
<> 144:ef7eb2e8f9f7 1094 HAL_StatusTypeDef HAL_DSI_Refresh(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1095 {
<> 144:ef7eb2e8f9f7 1096 /* Process locked */
<> 144:ef7eb2e8f9f7 1097 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1098
<> 144:ef7eb2e8f9f7 1099 /* Update the display */
<> 144:ef7eb2e8f9f7 1100 hdsi->Instance->WCR |= DSI_WCR_LTDCEN;
<> 144:ef7eb2e8f9f7 1101
<> 144:ef7eb2e8f9f7 1102 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1103 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1104
<> 144:ef7eb2e8f9f7 1105 return HAL_OK;
<> 144:ef7eb2e8f9f7 1106 }
<> 144:ef7eb2e8f9f7 1107
<> 144:ef7eb2e8f9f7 1108 /**
<> 144:ef7eb2e8f9f7 1109 * @brief Controls the display color mode in Video mode
AnnaBridge 183:a56a73fd2a6f 1110 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1111 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1112 * @param ColorMode Color mode (full or 8-colors).
<> 144:ef7eb2e8f9f7 1113 * This parameter can be any value of @ref DSI_Color_Mode
<> 144:ef7eb2e8f9f7 1114 * @retval HAL status
<> 144:ef7eb2e8f9f7 1115 */
<> 144:ef7eb2e8f9f7 1116 HAL_StatusTypeDef HAL_DSI_ColorMode(DSI_HandleTypeDef *hdsi, uint32_t ColorMode)
<> 144:ef7eb2e8f9f7 1117 {
<> 144:ef7eb2e8f9f7 1118 /* Process locked */
<> 144:ef7eb2e8f9f7 1119 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1120
<> 144:ef7eb2e8f9f7 1121 /* Check the parameters */
<> 144:ef7eb2e8f9f7 1122 assert_param(IS_DSI_COLOR_MODE(ColorMode));
<> 144:ef7eb2e8f9f7 1123
<> 144:ef7eb2e8f9f7 1124 /* Update the display color mode */
<> 144:ef7eb2e8f9f7 1125 hdsi->Instance->WCR &= ~DSI_WCR_COLM;
<> 144:ef7eb2e8f9f7 1126 hdsi->Instance->WCR |= ColorMode;
<> 144:ef7eb2e8f9f7 1127
<> 144:ef7eb2e8f9f7 1128 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1129 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1130
<> 144:ef7eb2e8f9f7 1131 return HAL_OK;
<> 144:ef7eb2e8f9f7 1132 }
<> 144:ef7eb2e8f9f7 1133
<> 144:ef7eb2e8f9f7 1134 /**
<> 144:ef7eb2e8f9f7 1135 * @brief Control the display shutdown in Video mode
AnnaBridge 183:a56a73fd2a6f 1136 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1137 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1138 * @param Shutdown Shut-down (Display-ON or Display-OFF).
<> 144:ef7eb2e8f9f7 1139 * This parameter can be any value of @ref DSI_ShutDown
<> 144:ef7eb2e8f9f7 1140 * @retval HAL status
<> 144:ef7eb2e8f9f7 1141 */
<> 144:ef7eb2e8f9f7 1142 HAL_StatusTypeDef HAL_DSI_Shutdown(DSI_HandleTypeDef *hdsi, uint32_t Shutdown)
<> 144:ef7eb2e8f9f7 1143 {
<> 144:ef7eb2e8f9f7 1144 /* Process locked */
<> 144:ef7eb2e8f9f7 1145 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1146
<> 144:ef7eb2e8f9f7 1147 /* Check the parameters */
<> 144:ef7eb2e8f9f7 1148 assert_param(IS_DSI_SHUT_DOWN(Shutdown));
<> 144:ef7eb2e8f9f7 1149
<> 144:ef7eb2e8f9f7 1150 /* Update the display Shutdown */
<> 144:ef7eb2e8f9f7 1151 hdsi->Instance->WCR &= ~DSI_WCR_SHTDN;
<> 144:ef7eb2e8f9f7 1152 hdsi->Instance->WCR |= Shutdown;
<> 144:ef7eb2e8f9f7 1153
<> 144:ef7eb2e8f9f7 1154 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1155 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1156
<> 144:ef7eb2e8f9f7 1157 return HAL_OK;
<> 144:ef7eb2e8f9f7 1158 }
<> 144:ef7eb2e8f9f7 1159
<> 144:ef7eb2e8f9f7 1160 /**
<> 144:ef7eb2e8f9f7 1161 * @brief DCS or Generic short write command
AnnaBridge 183:a56a73fd2a6f 1162 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1163 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1164 * @param ChannelID Virtual channel ID.
AnnaBridge 183:a56a73fd2a6f 1165 * @param Mode DSI short packet data type.
<> 144:ef7eb2e8f9f7 1166 * This parameter can be any value of @ref DSI_SHORT_WRITE_PKT_Data_Type.
AnnaBridge 183:a56a73fd2a6f 1167 * @param Param1 DSC command or first generic parameter.
<> 144:ef7eb2e8f9f7 1168 * This parameter can be any value of @ref DSI_DCS_Command or a
<> 144:ef7eb2e8f9f7 1169 * generic command code.
AnnaBridge 183:a56a73fd2a6f 1170 * @param Param2 DSC parameter or second generic parameter.
<> 144:ef7eb2e8f9f7 1171 * @retval HAL status
<> 144:ef7eb2e8f9f7 1172 */
<> 144:ef7eb2e8f9f7 1173 HAL_StatusTypeDef HAL_DSI_ShortWrite(DSI_HandleTypeDef *hdsi,
<> 144:ef7eb2e8f9f7 1174 uint32_t ChannelID,
<> 144:ef7eb2e8f9f7 1175 uint32_t Mode,
<> 144:ef7eb2e8f9f7 1176 uint32_t Param1,
<> 144:ef7eb2e8f9f7 1177 uint32_t Param2)
<> 144:ef7eb2e8f9f7 1178 {
<> 144:ef7eb2e8f9f7 1179 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1180
<> 144:ef7eb2e8f9f7 1181 /* Process locked */
<> 144:ef7eb2e8f9f7 1182 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1183
<> 144:ef7eb2e8f9f7 1184 /* Check the parameters */
<> 144:ef7eb2e8f9f7 1185 assert_param(IS_DSI_SHORT_WRITE_PACKET_TYPE(Mode));
<> 144:ef7eb2e8f9f7 1186
<> 144:ef7eb2e8f9f7 1187 /* Get tick */
<> 144:ef7eb2e8f9f7 1188 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1189
<> 144:ef7eb2e8f9f7 1190 /* Wait for Command FIFO Empty */
<> 144:ef7eb2e8f9f7 1191 while((hdsi->Instance->GPSR & DSI_GPSR_CMDFE) == 0)
<> 144:ef7eb2e8f9f7 1192 {
<> 144:ef7eb2e8f9f7 1193 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1194 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1195 {
<> 144:ef7eb2e8f9f7 1196 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1197 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1198
<> 144:ef7eb2e8f9f7 1199 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1200 }
<> 144:ef7eb2e8f9f7 1201 }
<> 144:ef7eb2e8f9f7 1202
<> 144:ef7eb2e8f9f7 1203 /* Configure the packet to send a short DCS command with 0 or 1 parameter */
<> 144:ef7eb2e8f9f7 1204 DSI_ConfigPacketHeader(hdsi->Instance,
<> 144:ef7eb2e8f9f7 1205 ChannelID,
<> 144:ef7eb2e8f9f7 1206 Mode,
<> 144:ef7eb2e8f9f7 1207 Param1,
<> 144:ef7eb2e8f9f7 1208 Param2);
<> 144:ef7eb2e8f9f7 1209
<> 144:ef7eb2e8f9f7 1210 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1211 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1212
<> 144:ef7eb2e8f9f7 1213 return HAL_OK;
<> 144:ef7eb2e8f9f7 1214 }
<> 144:ef7eb2e8f9f7 1215
<> 144:ef7eb2e8f9f7 1216 /**
<> 144:ef7eb2e8f9f7 1217 * @brief DCS or Generic long write command
AnnaBridge 183:a56a73fd2a6f 1218 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1219 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1220 * @param ChannelID Virtual channel ID.
AnnaBridge 183:a56a73fd2a6f 1221 * @param Mode DSI long packet data type.
<> 144:ef7eb2e8f9f7 1222 * This parameter can be any value of @ref DSI_LONG_WRITE_PKT_Data_Type.
AnnaBridge 183:a56a73fd2a6f 1223 * @param NbParams Number of parameters.
AnnaBridge 183:a56a73fd2a6f 1224 * @param Param1 DSC command or first generic parameter.
<> 144:ef7eb2e8f9f7 1225 * This parameter can be any value of @ref DSI_DCS_Command or a
<> 144:ef7eb2e8f9f7 1226 * generic command code
AnnaBridge 183:a56a73fd2a6f 1227 * @param ParametersTable Pointer to parameter values table.
<> 144:ef7eb2e8f9f7 1228 * @retval HAL status
<> 144:ef7eb2e8f9f7 1229 */
<> 144:ef7eb2e8f9f7 1230 HAL_StatusTypeDef HAL_DSI_LongWrite(DSI_HandleTypeDef *hdsi,
<> 144:ef7eb2e8f9f7 1231 uint32_t ChannelID,
<> 144:ef7eb2e8f9f7 1232 uint32_t Mode,
<> 144:ef7eb2e8f9f7 1233 uint32_t NbParams,
<> 144:ef7eb2e8f9f7 1234 uint32_t Param1,
<> 144:ef7eb2e8f9f7 1235 uint8_t* ParametersTable)
<> 144:ef7eb2e8f9f7 1236 {
<> 144:ef7eb2e8f9f7 1237 uint32_t uicounter = 0;
<> 144:ef7eb2e8f9f7 1238 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1239
<> 144:ef7eb2e8f9f7 1240 /* Process locked */
<> 144:ef7eb2e8f9f7 1241 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1242
<> 144:ef7eb2e8f9f7 1243 /* Check the parameters */
<> 144:ef7eb2e8f9f7 1244 assert_param(IS_DSI_LONG_WRITE_PACKET_TYPE(Mode));
<> 144:ef7eb2e8f9f7 1245
<> 144:ef7eb2e8f9f7 1246 /* Get tick */
<> 144:ef7eb2e8f9f7 1247 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1248
<> 144:ef7eb2e8f9f7 1249 /* Wait for Command FIFO Empty */
<> 144:ef7eb2e8f9f7 1250 while((hdsi->Instance->GPSR & DSI_GPSR_CMDFE) == RESET)
<> 144:ef7eb2e8f9f7 1251 {
<> 144:ef7eb2e8f9f7 1252 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1253 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1254 {
<> 144:ef7eb2e8f9f7 1255 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1256 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1257
<> 144:ef7eb2e8f9f7 1258 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1259 }
<> 144:ef7eb2e8f9f7 1260 }
<> 144:ef7eb2e8f9f7 1261
<> 144:ef7eb2e8f9f7 1262 /* Set the DCS code hexadecimal on payload byte 1, and the other parameters on the write FIFO command*/
<> 144:ef7eb2e8f9f7 1263 while(uicounter < NbParams)
<> 144:ef7eb2e8f9f7 1264 {
<> 144:ef7eb2e8f9f7 1265 if(uicounter == 0x00)
<> 144:ef7eb2e8f9f7 1266 {
<> 144:ef7eb2e8f9f7 1267 hdsi->Instance->GPDR=(Param1 | \
<> 144:ef7eb2e8f9f7 1268 ((uint32_t)(*(ParametersTable + uicounter)) << 8) | \
<> 144:ef7eb2e8f9f7 1269 ((uint32_t)(*(ParametersTable + uicounter+1))<<16) | \
<> 144:ef7eb2e8f9f7 1270 ((uint32_t)(*(ParametersTable + uicounter+2))<<24));
<> 144:ef7eb2e8f9f7 1271 uicounter += 3;
<> 144:ef7eb2e8f9f7 1272 }
<> 144:ef7eb2e8f9f7 1273 else
<> 144:ef7eb2e8f9f7 1274 {
<> 144:ef7eb2e8f9f7 1275 hdsi->Instance->GPDR=((uint32_t)(*(ParametersTable + uicounter)) | \
<> 144:ef7eb2e8f9f7 1276 ((uint32_t)(*(ParametersTable + uicounter+1)) << 8) | \
<> 144:ef7eb2e8f9f7 1277 ((uint32_t)(*(ParametersTable + uicounter+2)) << 16) | \
<> 144:ef7eb2e8f9f7 1278 ((uint32_t)(*(ParametersTable + uicounter+3)) << 24));
<> 144:ef7eb2e8f9f7 1279 uicounter+=4;
<> 144:ef7eb2e8f9f7 1280 }
<> 144:ef7eb2e8f9f7 1281 }
<> 144:ef7eb2e8f9f7 1282
<> 144:ef7eb2e8f9f7 1283 /* Configure the packet to send a long DCS command */
<> 144:ef7eb2e8f9f7 1284 DSI_ConfigPacketHeader(hdsi->Instance,
<> 144:ef7eb2e8f9f7 1285 ChannelID,
<> 144:ef7eb2e8f9f7 1286 Mode,
<> 144:ef7eb2e8f9f7 1287 ((NbParams+1)&0x00FF),
<> 144:ef7eb2e8f9f7 1288 (((NbParams+1)&0xFF00)>>8));
<> 144:ef7eb2e8f9f7 1289
<> 144:ef7eb2e8f9f7 1290 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1291 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1292
<> 144:ef7eb2e8f9f7 1293 return HAL_OK;
<> 144:ef7eb2e8f9f7 1294 }
<> 144:ef7eb2e8f9f7 1295
<> 144:ef7eb2e8f9f7 1296 /**
<> 144:ef7eb2e8f9f7 1297 * @brief Read command (DCS or generic)
AnnaBridge 183:a56a73fd2a6f 1298 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1299 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1300 * @param ChannelNbr Virtual channel ID
AnnaBridge 183:a56a73fd2a6f 1301 * @param Array pointer to a buffer to store the payload of a read back operation.
AnnaBridge 183:a56a73fd2a6f 1302 * @param Size Data size to be read (in byte).
AnnaBridge 183:a56a73fd2a6f 1303 * @param Mode DSI read packet data type.
<> 144:ef7eb2e8f9f7 1304 * This parameter can be any value of @ref DSI_SHORT_READ_PKT_Data_Type.
AnnaBridge 183:a56a73fd2a6f 1305 * @param DCSCmd DCS get/read command.
AnnaBridge 183:a56a73fd2a6f 1306 * @param ParametersTable Pointer to parameter values table.
<> 144:ef7eb2e8f9f7 1307 * @retval HAL status
<> 144:ef7eb2e8f9f7 1308 */
<> 144:ef7eb2e8f9f7 1309 HAL_StatusTypeDef HAL_DSI_Read(DSI_HandleTypeDef *hdsi,
<> 144:ef7eb2e8f9f7 1310 uint32_t ChannelNbr,
<> 144:ef7eb2e8f9f7 1311 uint8_t* Array,
<> 144:ef7eb2e8f9f7 1312 uint32_t Size,
<> 144:ef7eb2e8f9f7 1313 uint32_t Mode,
<> 144:ef7eb2e8f9f7 1314 uint32_t DCSCmd,
<> 144:ef7eb2e8f9f7 1315 uint8_t* ParametersTable)
<> 144:ef7eb2e8f9f7 1316 {
<> 144:ef7eb2e8f9f7 1317 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1318
<> 144:ef7eb2e8f9f7 1319 /* Process locked */
<> 144:ef7eb2e8f9f7 1320 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1321
<> 144:ef7eb2e8f9f7 1322 /* Check the parameters */
<> 144:ef7eb2e8f9f7 1323 assert_param(IS_DSI_READ_PACKET_TYPE(Mode));
<> 144:ef7eb2e8f9f7 1324
<> 144:ef7eb2e8f9f7 1325 if(Size > 2)
<> 144:ef7eb2e8f9f7 1326 {
<> 144:ef7eb2e8f9f7 1327 /* set max return packet size */
<> 144:ef7eb2e8f9f7 1328 HAL_DSI_ShortWrite(hdsi, ChannelNbr, DSI_MAX_RETURN_PKT_SIZE, ((Size)&0xFF), (((Size)>>8)&0xFF));
<> 144:ef7eb2e8f9f7 1329 }
<> 144:ef7eb2e8f9f7 1330
<> 144:ef7eb2e8f9f7 1331 /* Configure the packet to read command */
<> 144:ef7eb2e8f9f7 1332 if (Mode == DSI_DCS_SHORT_PKT_READ)
<> 144:ef7eb2e8f9f7 1333 {
<> 144:ef7eb2e8f9f7 1334 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, DCSCmd, 0);
<> 144:ef7eb2e8f9f7 1335 }
<> 144:ef7eb2e8f9f7 1336 else if (Mode == DSI_GEN_SHORT_PKT_READ_P0)
<> 144:ef7eb2e8f9f7 1337 {
<> 144:ef7eb2e8f9f7 1338 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, 0, 0);
<> 144:ef7eb2e8f9f7 1339 }
<> 144:ef7eb2e8f9f7 1340 else if (Mode == DSI_GEN_SHORT_PKT_READ_P1)
<> 144:ef7eb2e8f9f7 1341 {
<> 144:ef7eb2e8f9f7 1342 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0], 0);
<> 144:ef7eb2e8f9f7 1343 }
<> 144:ef7eb2e8f9f7 1344 else if (Mode == DSI_GEN_SHORT_PKT_READ_P2)
<> 144:ef7eb2e8f9f7 1345 {
<> 144:ef7eb2e8f9f7 1346 DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0], ParametersTable[1]);
<> 144:ef7eb2e8f9f7 1347 }
<> 144:ef7eb2e8f9f7 1348 else
<> 144:ef7eb2e8f9f7 1349 {
<> 144:ef7eb2e8f9f7 1350 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1351 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1352
<> 144:ef7eb2e8f9f7 1353 return HAL_ERROR;
<> 144:ef7eb2e8f9f7 1354 }
<> 144:ef7eb2e8f9f7 1355
<> 144:ef7eb2e8f9f7 1356 /* Get tick */
<> 144:ef7eb2e8f9f7 1357 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1358
<> 144:ef7eb2e8f9f7 1359 /* Check that the payload read FIFO is not empty */
<> 144:ef7eb2e8f9f7 1360 while((hdsi->Instance->GPSR & DSI_GPSR_PRDFE) == DSI_GPSR_PRDFE)
<> 144:ef7eb2e8f9f7 1361 {
<> 144:ef7eb2e8f9f7 1362 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1363 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1364 {
<> 144:ef7eb2e8f9f7 1365 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1366 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1367
<> 144:ef7eb2e8f9f7 1368 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1369 }
<> 144:ef7eb2e8f9f7 1370 }
<> 144:ef7eb2e8f9f7 1371
<> 144:ef7eb2e8f9f7 1372 /* Get the first byte */
<> 144:ef7eb2e8f9f7 1373 *((uint32_t *)Array) = (hdsi->Instance->GPDR);
<> 144:ef7eb2e8f9f7 1374 if (Size > 4)
<> 144:ef7eb2e8f9f7 1375 {
<> 144:ef7eb2e8f9f7 1376 Size -= 4;
<> 144:ef7eb2e8f9f7 1377 Array += 4;
<> 144:ef7eb2e8f9f7 1378 }
<> 144:ef7eb2e8f9f7 1379 else
<> 144:ef7eb2e8f9f7 1380 {
<> 144:ef7eb2e8f9f7 1381 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1382 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1383
<> 144:ef7eb2e8f9f7 1384 return HAL_OK;
<> 144:ef7eb2e8f9f7 1385 }
<> 144:ef7eb2e8f9f7 1386
<> 144:ef7eb2e8f9f7 1387 /* Get tick */
<> 144:ef7eb2e8f9f7 1388 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1389
<> 144:ef7eb2e8f9f7 1390 /* Get the remaining bytes if any */
<> 144:ef7eb2e8f9f7 1391 while(((int)(Size)) > 0)
<> 144:ef7eb2e8f9f7 1392 {
<> 144:ef7eb2e8f9f7 1393 if((hdsi->Instance->GPSR & DSI_GPSR_PRDFE) == 0)
<> 144:ef7eb2e8f9f7 1394 {
<> 144:ef7eb2e8f9f7 1395 *((uint32_t *)Array) = (hdsi->Instance->GPDR);
<> 144:ef7eb2e8f9f7 1396 Size -= 4;
<> 144:ef7eb2e8f9f7 1397 Array += 4;
<> 144:ef7eb2e8f9f7 1398 }
<> 144:ef7eb2e8f9f7 1399
<> 144:ef7eb2e8f9f7 1400 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1401 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1402 {
<> 144:ef7eb2e8f9f7 1403 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1404 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1405
<> 144:ef7eb2e8f9f7 1406 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1407 }
<> 144:ef7eb2e8f9f7 1408 }
<> 144:ef7eb2e8f9f7 1409
<> 144:ef7eb2e8f9f7 1410 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1411 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1412
<> 144:ef7eb2e8f9f7 1413 return HAL_OK;
<> 144:ef7eb2e8f9f7 1414 }
<> 144:ef7eb2e8f9f7 1415
<> 144:ef7eb2e8f9f7 1416 /**
<> 144:ef7eb2e8f9f7 1417 * @brief Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL running
<> 144:ef7eb2e8f9f7 1418 * (only data lanes are in ULPM)
AnnaBridge 183:a56a73fd2a6f 1419 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1420 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1421 * @retval HAL status
<> 144:ef7eb2e8f9f7 1422 */
<> 144:ef7eb2e8f9f7 1423 HAL_StatusTypeDef HAL_DSI_EnterULPMData(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1424 {
<> 144:ef7eb2e8f9f7 1425 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1426
<> 144:ef7eb2e8f9f7 1427 /* Process locked */
<> 144:ef7eb2e8f9f7 1428 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1429
<> 144:ef7eb2e8f9f7 1430 /* ULPS Request on Data Lanes */
<> 144:ef7eb2e8f9f7 1431 hdsi->Instance->PUCR |= DSI_PUCR_URDL;
<> 144:ef7eb2e8f9f7 1432
<> 144:ef7eb2e8f9f7 1433 /* Get tick */
<> 144:ef7eb2e8f9f7 1434 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1435
<> 144:ef7eb2e8f9f7 1436 /* Wait until the D-PHY active lanes enter into ULPM */
<> 144:ef7eb2e8f9f7 1437 if((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
<> 144:ef7eb2e8f9f7 1438 {
<> 144:ef7eb2e8f9f7 1439 while((hdsi->Instance->PSR & DSI_PSR_UAN0) != RESET)
<> 144:ef7eb2e8f9f7 1440 {
<> 144:ef7eb2e8f9f7 1441 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1442 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1443 {
<> 144:ef7eb2e8f9f7 1444 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1445 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1446
<> 144:ef7eb2e8f9f7 1447 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1448 }
<> 144:ef7eb2e8f9f7 1449 }
<> 144:ef7eb2e8f9f7 1450 }
<> 144:ef7eb2e8f9f7 1451 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
<> 144:ef7eb2e8f9f7 1452 {
<> 144:ef7eb2e8f9f7 1453 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != RESET)
<> 144:ef7eb2e8f9f7 1454 {
<> 144:ef7eb2e8f9f7 1455 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1456 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1457 {
<> 144:ef7eb2e8f9f7 1458 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1459 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1460
<> 144:ef7eb2e8f9f7 1461 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1462 }
<> 144:ef7eb2e8f9f7 1463 }
<> 144:ef7eb2e8f9f7 1464 }
<> 144:ef7eb2e8f9f7 1465
<> 144:ef7eb2e8f9f7 1466 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1467 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1468
<> 144:ef7eb2e8f9f7 1469 return HAL_OK;
<> 144:ef7eb2e8f9f7 1470 }
<> 144:ef7eb2e8f9f7 1471
<> 144:ef7eb2e8f9f7 1472 /**
<> 144:ef7eb2e8f9f7 1473 * @brief Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL running
<> 144:ef7eb2e8f9f7 1474 * (only data lanes are in ULPM)
AnnaBridge 183:a56a73fd2a6f 1475 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1476 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1477 * @retval HAL status
<> 144:ef7eb2e8f9f7 1478 */
<> 144:ef7eb2e8f9f7 1479 HAL_StatusTypeDef HAL_DSI_ExitULPMData(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1480 {
<> 144:ef7eb2e8f9f7 1481 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1482
<> 144:ef7eb2e8f9f7 1483 /* Process locked */
<> 144:ef7eb2e8f9f7 1484 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1485
<> 144:ef7eb2e8f9f7 1486 /* Exit ULPS on Data Lanes */
<> 144:ef7eb2e8f9f7 1487 hdsi->Instance->PUCR |= DSI_PUCR_UEDL;
<> 144:ef7eb2e8f9f7 1488
<> 144:ef7eb2e8f9f7 1489 /* Get tick */
<> 144:ef7eb2e8f9f7 1490 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1491
<> 144:ef7eb2e8f9f7 1492 /* Wait until all active lanes exit ULPM */
<> 144:ef7eb2e8f9f7 1493 if((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
<> 144:ef7eb2e8f9f7 1494 {
<> 144:ef7eb2e8f9f7 1495 while((hdsi->Instance->PSR & DSI_PSR_UAN0) != DSI_PSR_UAN0)
<> 144:ef7eb2e8f9f7 1496 {
<> 144:ef7eb2e8f9f7 1497 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1498 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1499 {
<> 144:ef7eb2e8f9f7 1500 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1501 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1502
<> 144:ef7eb2e8f9f7 1503 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1504 }
<> 144:ef7eb2e8f9f7 1505 }
<> 144:ef7eb2e8f9f7 1506 }
<> 144:ef7eb2e8f9f7 1507 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
<> 144:ef7eb2e8f9f7 1508 {
<> 144:ef7eb2e8f9f7 1509 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1))
<> 144:ef7eb2e8f9f7 1510 {
<> 144:ef7eb2e8f9f7 1511 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1512 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1513 {
<> 144:ef7eb2e8f9f7 1514 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1515 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1516
<> 144:ef7eb2e8f9f7 1517 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1518 }
<> 144:ef7eb2e8f9f7 1519 }
<> 144:ef7eb2e8f9f7 1520 }
<> 144:ef7eb2e8f9f7 1521
<> 144:ef7eb2e8f9f7 1522 /* De-assert the ULPM requests and the ULPM exit bits */
<> 144:ef7eb2e8f9f7 1523 hdsi->Instance->PUCR = 0;
<> 144:ef7eb2e8f9f7 1524
<> 144:ef7eb2e8f9f7 1525 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1526 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1527
<> 144:ef7eb2e8f9f7 1528 return HAL_OK;
<> 144:ef7eb2e8f9f7 1529 }
<> 144:ef7eb2e8f9f7 1530
<> 144:ef7eb2e8f9f7 1531 /**
<> 144:ef7eb2e8f9f7 1532 * @brief Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off
<> 144:ef7eb2e8f9f7 1533 * (both data and clock lanes are in ULPM)
AnnaBridge 183:a56a73fd2a6f 1534 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1535 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1536 * @retval HAL status
<> 144:ef7eb2e8f9f7 1537 */
<> 144:ef7eb2e8f9f7 1538 HAL_StatusTypeDef HAL_DSI_EnterULPM(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1539 {
<> 144:ef7eb2e8f9f7 1540 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1541
<> 144:ef7eb2e8f9f7 1542 /* Process locked */
<> 144:ef7eb2e8f9f7 1543 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1544
<> 144:ef7eb2e8f9f7 1545 /* Clock lane configuration: no more HS request */
<> 144:ef7eb2e8f9f7 1546 hdsi->Instance->CLCR &= ~DSI_CLCR_DPCC;
<> 144:ef7eb2e8f9f7 1547
<> 144:ef7eb2e8f9f7 1548 /* Use system PLL as byte lane clock source before stopping DSIPHY clock source */
<> 144:ef7eb2e8f9f7 1549 __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_PLLR);
<> 144:ef7eb2e8f9f7 1550
<> 144:ef7eb2e8f9f7 1551 /* ULPS Request on Clock and Data Lanes */
<> 144:ef7eb2e8f9f7 1552 hdsi->Instance->PUCR |= (DSI_PUCR_URCL | DSI_PUCR_URDL);
<> 144:ef7eb2e8f9f7 1553
<> 144:ef7eb2e8f9f7 1554 /* Get tick */
<> 144:ef7eb2e8f9f7 1555 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1556
<> 144:ef7eb2e8f9f7 1557 /* Wait until all active lanes exit ULPM */
<> 144:ef7eb2e8f9f7 1558 if((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
<> 144:ef7eb2e8f9f7 1559 {
<> 144:ef7eb2e8f9f7 1560 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != RESET)
<> 144:ef7eb2e8f9f7 1561 {
<> 144:ef7eb2e8f9f7 1562 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1563 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1564 {
<> 144:ef7eb2e8f9f7 1565 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1566 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1567
<> 144:ef7eb2e8f9f7 1568 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1569 }
<> 144:ef7eb2e8f9f7 1570 }
<> 144:ef7eb2e8f9f7 1571 }
<> 144:ef7eb2e8f9f7 1572 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
<> 144:ef7eb2e8f9f7 1573 {
<> 144:ef7eb2e8f9f7 1574 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != RESET)
<> 144:ef7eb2e8f9f7 1575 {
<> 144:ef7eb2e8f9f7 1576 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1577 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1578 {
<> 144:ef7eb2e8f9f7 1579 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1580 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1581
<> 144:ef7eb2e8f9f7 1582 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1583 }
<> 144:ef7eb2e8f9f7 1584 }
<> 144:ef7eb2e8f9f7 1585 }
<> 144:ef7eb2e8f9f7 1586
<> 144:ef7eb2e8f9f7 1587 /* Turn off the DSI PLL */
<> 144:ef7eb2e8f9f7 1588 __HAL_DSI_PLL_DISABLE(hdsi);
<> 144:ef7eb2e8f9f7 1589
<> 144:ef7eb2e8f9f7 1590 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1591 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1592
<> 144:ef7eb2e8f9f7 1593 return HAL_OK;
<> 144:ef7eb2e8f9f7 1594 }
<> 144:ef7eb2e8f9f7 1595
<> 144:ef7eb2e8f9f7 1596 /**
<> 144:ef7eb2e8f9f7 1597 * @brief Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off
<> 144:ef7eb2e8f9f7 1598 * (both data and clock lanes are in ULPM)
AnnaBridge 183:a56a73fd2a6f 1599 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1600 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1601 * @retval HAL status
<> 144:ef7eb2e8f9f7 1602 */
<> 144:ef7eb2e8f9f7 1603 HAL_StatusTypeDef HAL_DSI_ExitULPM(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1604 {
<> 144:ef7eb2e8f9f7 1605 uint32_t tickstart = 0;
<> 144:ef7eb2e8f9f7 1606
<> 144:ef7eb2e8f9f7 1607 /* Process locked */
<> 144:ef7eb2e8f9f7 1608 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1609
<> 144:ef7eb2e8f9f7 1610 /* Turn on the DSI PLL */
<> 144:ef7eb2e8f9f7 1611 __HAL_DSI_PLL_ENABLE(hdsi);
<> 144:ef7eb2e8f9f7 1612
<> 144:ef7eb2e8f9f7 1613 /* Get tick */
<> 144:ef7eb2e8f9f7 1614 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1615
<> 144:ef7eb2e8f9f7 1616 /* Wait for the lock of the PLL */
<> 144:ef7eb2e8f9f7 1617 while(__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_PLLLS) == RESET)
<> 144:ef7eb2e8f9f7 1618 {
<> 144:ef7eb2e8f9f7 1619 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1620 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1621 {
<> 144:ef7eb2e8f9f7 1622 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1623 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1624
<> 144:ef7eb2e8f9f7 1625 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1626 }
<> 144:ef7eb2e8f9f7 1627 }
<> 144:ef7eb2e8f9f7 1628
<> 144:ef7eb2e8f9f7 1629 /* Exit ULPS on Clock and Data Lanes */
<> 144:ef7eb2e8f9f7 1630 hdsi->Instance->PUCR |= (DSI_PUCR_UECL | DSI_PUCR_UEDL);
<> 144:ef7eb2e8f9f7 1631
<> 144:ef7eb2e8f9f7 1632 /* Get tick */
<> 144:ef7eb2e8f9f7 1633 tickstart = HAL_GetTick();
<> 144:ef7eb2e8f9f7 1634
<> 144:ef7eb2e8f9f7 1635 /* Wait until all active lanes exit ULPM */
<> 144:ef7eb2e8f9f7 1636 if((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
<> 144:ef7eb2e8f9f7 1637 {
<> 144:ef7eb2e8f9f7 1638 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UANC))
<> 144:ef7eb2e8f9f7 1639 {
<> 144:ef7eb2e8f9f7 1640 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1641 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1642 {
<> 144:ef7eb2e8f9f7 1643 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1644 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1645
<> 144:ef7eb2e8f9f7 1646 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1647 }
<> 144:ef7eb2e8f9f7 1648 }
<> 144:ef7eb2e8f9f7 1649 }
<> 144:ef7eb2e8f9f7 1650 else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
<> 144:ef7eb2e8f9f7 1651 {
<> 144:ef7eb2e8f9f7 1652 while((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC))
<> 144:ef7eb2e8f9f7 1653 {
<> 144:ef7eb2e8f9f7 1654 /* Check for the Timeout */
<> 144:ef7eb2e8f9f7 1655 if((HAL_GetTick() - tickstart ) > DSI_TIMEOUT_VALUE)
<> 144:ef7eb2e8f9f7 1656 {
<> 144:ef7eb2e8f9f7 1657 /* Process Unlocked */
<> 144:ef7eb2e8f9f7 1658 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1659
<> 144:ef7eb2e8f9f7 1660 return HAL_TIMEOUT;
<> 144:ef7eb2e8f9f7 1661 }
<> 144:ef7eb2e8f9f7 1662 }
<> 144:ef7eb2e8f9f7 1663 }
<> 144:ef7eb2e8f9f7 1664
<> 144:ef7eb2e8f9f7 1665 /* De-assert the ULPM requests and the ULPM exit bits */
<> 144:ef7eb2e8f9f7 1666 hdsi->Instance->PUCR = 0;
<> 144:ef7eb2e8f9f7 1667
<> 144:ef7eb2e8f9f7 1668 /* Switch the lanbyteclock source in the RCC from system PLL to D-PHY */
<> 144:ef7eb2e8f9f7 1669 __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_DSIPHY);
<> 144:ef7eb2e8f9f7 1670
<> 144:ef7eb2e8f9f7 1671 /* Restore clock lane configuration to HS */
<> 144:ef7eb2e8f9f7 1672 hdsi->Instance->CLCR |= DSI_CLCR_DPCC;
<> 144:ef7eb2e8f9f7 1673
<> 144:ef7eb2e8f9f7 1674 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1675 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1676
<> 144:ef7eb2e8f9f7 1677 return HAL_OK;
<> 144:ef7eb2e8f9f7 1678 }
<> 144:ef7eb2e8f9f7 1679
<> 144:ef7eb2e8f9f7 1680 /**
<> 144:ef7eb2e8f9f7 1681 * @brief Start test pattern generation
AnnaBridge 183:a56a73fd2a6f 1682 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1683 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1684 * @param Mode Pattern generator mode
<> 144:ef7eb2e8f9f7 1685 * This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 1686 * 0 : Color bars (horizontal or vertical)
<> 144:ef7eb2e8f9f7 1687 * 1 : BER pattern (vertical only)
AnnaBridge 183:a56a73fd2a6f 1688 * @param Orientation Pattern generator orientation
<> 144:ef7eb2e8f9f7 1689 * This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 1690 * 0 : Vertical color bars
<> 144:ef7eb2e8f9f7 1691 * 1 : Horizontal color bars
<> 144:ef7eb2e8f9f7 1692 * @retval HAL status
<> 144:ef7eb2e8f9f7 1693 */
<> 144:ef7eb2e8f9f7 1694 HAL_StatusTypeDef HAL_DSI_PatternGeneratorStart(DSI_HandleTypeDef *hdsi, uint32_t Mode, uint32_t Orientation)
<> 144:ef7eb2e8f9f7 1695 {
<> 144:ef7eb2e8f9f7 1696 /* Process locked */
<> 144:ef7eb2e8f9f7 1697 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1698
<> 144:ef7eb2e8f9f7 1699 /* Configure pattern generator mode and orientation */
<> 144:ef7eb2e8f9f7 1700 hdsi->Instance->VMCR &= ~(DSI_VMCR_PGM | DSI_VMCR_PGO);
<> 144:ef7eb2e8f9f7 1701 hdsi->Instance->VMCR |= ((Mode<<20) | (Orientation<<24));
<> 144:ef7eb2e8f9f7 1702
<> 144:ef7eb2e8f9f7 1703 /* Enable pattern generator by setting PGE bit */
<> 144:ef7eb2e8f9f7 1704 hdsi->Instance->VMCR |= DSI_VMCR_PGE;
<> 144:ef7eb2e8f9f7 1705
<> 144:ef7eb2e8f9f7 1706 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1707 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1708
<> 144:ef7eb2e8f9f7 1709 return HAL_OK;
<> 144:ef7eb2e8f9f7 1710 }
<> 144:ef7eb2e8f9f7 1711
<> 144:ef7eb2e8f9f7 1712 /**
<> 144:ef7eb2e8f9f7 1713 * @brief Stop test pattern generation
AnnaBridge 183:a56a73fd2a6f 1714 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1715 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 1716 * @retval HAL status
<> 144:ef7eb2e8f9f7 1717 */
<> 144:ef7eb2e8f9f7 1718 HAL_StatusTypeDef HAL_DSI_PatternGeneratorStop(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 1719 {
<> 144:ef7eb2e8f9f7 1720 /* Process locked */
<> 144:ef7eb2e8f9f7 1721 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1722
<> 144:ef7eb2e8f9f7 1723 /* Disable pattern generator by clearing PGE bit */
<> 144:ef7eb2e8f9f7 1724 hdsi->Instance->VMCR &= ~DSI_VMCR_PGE;
<> 144:ef7eb2e8f9f7 1725
<> 144:ef7eb2e8f9f7 1726 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1727 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1728
<> 144:ef7eb2e8f9f7 1729 return HAL_OK;
<> 144:ef7eb2e8f9f7 1730 }
<> 144:ef7eb2e8f9f7 1731
<> 144:ef7eb2e8f9f7 1732 /**
<> 144:ef7eb2e8f9f7 1733 * @brief Set Slew-Rate And Delay Tuning
AnnaBridge 183:a56a73fd2a6f 1734 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1735 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1736 * @param CommDelay Communication delay to be adjusted.
<> 144:ef7eb2e8f9f7 1737 * This parameter can be any value of @ref DSI_Communication_Delay
AnnaBridge 183:a56a73fd2a6f 1738 * @param Lane select between clock or data lanes.
<> 144:ef7eb2e8f9f7 1739 * This parameter can be any value of @ref DSI_Lane_Group
AnnaBridge 183:a56a73fd2a6f 1740 * @param Value Custom value of the slew-rate or delay
<> 144:ef7eb2e8f9f7 1741 * @retval HAL status
<> 144:ef7eb2e8f9f7 1742 */
<> 144:ef7eb2e8f9f7 1743 HAL_StatusTypeDef HAL_DSI_SetSlewRateAndDelayTuning(DSI_HandleTypeDef *hdsi, uint32_t CommDelay, uint32_t Lane, uint32_t Value)
<> 144:ef7eb2e8f9f7 1744 {
<> 144:ef7eb2e8f9f7 1745 /* Process locked */
<> 144:ef7eb2e8f9f7 1746 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1747
<> 144:ef7eb2e8f9f7 1748 /* Check function parameters */
<> 144:ef7eb2e8f9f7 1749 assert_param(IS_DSI_COMMUNICATION_DELAY(CommDelay));
<> 144:ef7eb2e8f9f7 1750 assert_param(IS_DSI_LANE_GROUP(Lane));
<> 144:ef7eb2e8f9f7 1751
<> 144:ef7eb2e8f9f7 1752 switch(CommDelay)
<> 144:ef7eb2e8f9f7 1753 {
<> 144:ef7eb2e8f9f7 1754 case DSI_SLEW_RATE_HSTX:
<> 144:ef7eb2e8f9f7 1755 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 1756 {
<> 144:ef7eb2e8f9f7 1757 /* High-Speed Transmission Slew Rate Control on Clock Lane */
<> 144:ef7eb2e8f9f7 1758 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_HSTXSRCCL;
<> 144:ef7eb2e8f9f7 1759 hdsi->Instance->WPCR[1] |= Value<<16;
<> 144:ef7eb2e8f9f7 1760 }
<> 144:ef7eb2e8f9f7 1761 else if(Lane == DSI_DATA_LANES)
<> 144:ef7eb2e8f9f7 1762 {
<> 144:ef7eb2e8f9f7 1763 /* High-Speed Transmission Slew Rate Control on Data Lanes */
<> 144:ef7eb2e8f9f7 1764 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_HSTXSRCDL;
<> 144:ef7eb2e8f9f7 1765 hdsi->Instance->WPCR[1] |= Value<<18;
<> 144:ef7eb2e8f9f7 1766 }
<> 144:ef7eb2e8f9f7 1767 break;
<> 144:ef7eb2e8f9f7 1768 case DSI_SLEW_RATE_LPTX:
<> 144:ef7eb2e8f9f7 1769 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 1770 {
<> 144:ef7eb2e8f9f7 1771 /* Low-Power transmission Slew Rate Compensation on Clock Lane */
<> 144:ef7eb2e8f9f7 1772 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_LPSRCCL;
<> 144:ef7eb2e8f9f7 1773 hdsi->Instance->WPCR[1] |= Value<<6;
<> 144:ef7eb2e8f9f7 1774 }
<> 144:ef7eb2e8f9f7 1775 else if(Lane == DSI_DATA_LANES)
<> 144:ef7eb2e8f9f7 1776 {
<> 144:ef7eb2e8f9f7 1777 /* Low-Power transmission Slew Rate Compensation on Data Lanes */
<> 144:ef7eb2e8f9f7 1778 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_LPSRCDL;
<> 144:ef7eb2e8f9f7 1779 hdsi->Instance->WPCR[1] |= Value<<8;
<> 144:ef7eb2e8f9f7 1780 }
<> 144:ef7eb2e8f9f7 1781 break;
<> 144:ef7eb2e8f9f7 1782 case DSI_HS_DELAY:
<> 144:ef7eb2e8f9f7 1783 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 1784 {
<> 144:ef7eb2e8f9f7 1785 /* High-Speed Transmission Delay on Clock Lane */
<> 144:ef7eb2e8f9f7 1786 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_HSTXDCL;
<> 144:ef7eb2e8f9f7 1787 hdsi->Instance->WPCR[1] |= Value;
<> 144:ef7eb2e8f9f7 1788 }
<> 144:ef7eb2e8f9f7 1789 else if(Lane == DSI_DATA_LANES)
<> 144:ef7eb2e8f9f7 1790 {
<> 144:ef7eb2e8f9f7 1791 /* High-Speed Transmission Delay on Data Lanes */
<> 144:ef7eb2e8f9f7 1792 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_HSTXDDL;
<> 144:ef7eb2e8f9f7 1793 hdsi->Instance->WPCR[1] |= Value<<2;
<> 144:ef7eb2e8f9f7 1794 }
<> 144:ef7eb2e8f9f7 1795 break;
<> 144:ef7eb2e8f9f7 1796 default:
<> 144:ef7eb2e8f9f7 1797 break;
<> 144:ef7eb2e8f9f7 1798 }
<> 144:ef7eb2e8f9f7 1799
<> 144:ef7eb2e8f9f7 1800 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1801 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1802
<> 144:ef7eb2e8f9f7 1803 return HAL_OK;
<> 144:ef7eb2e8f9f7 1804 }
<> 144:ef7eb2e8f9f7 1805
<> 144:ef7eb2e8f9f7 1806 /**
<> 144:ef7eb2e8f9f7 1807 * @brief Low-Power Reception Filter Tuning
AnnaBridge 183:a56a73fd2a6f 1808 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1809 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1810 * @param Frequency cutoff frequency of low-pass filter at the input of LPRX
<> 144:ef7eb2e8f9f7 1811 * @retval HAL status
<> 144:ef7eb2e8f9f7 1812 */
<> 144:ef7eb2e8f9f7 1813 HAL_StatusTypeDef HAL_DSI_SetLowPowerRXFilter(DSI_HandleTypeDef *hdsi, uint32_t Frequency)
<> 144:ef7eb2e8f9f7 1814 {
<> 144:ef7eb2e8f9f7 1815 /* Process locked */
<> 144:ef7eb2e8f9f7 1816 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1817
<> 144:ef7eb2e8f9f7 1818 /* Low-Power RX low-pass Filtering Tuning */
<> 144:ef7eb2e8f9f7 1819 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_LPRXFT;
<> 144:ef7eb2e8f9f7 1820 hdsi->Instance->WPCR[1] |= Frequency<<25;
<> 144:ef7eb2e8f9f7 1821
<> 144:ef7eb2e8f9f7 1822 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1823 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1824
<> 144:ef7eb2e8f9f7 1825 return HAL_OK;
<> 144:ef7eb2e8f9f7 1826 }
<> 144:ef7eb2e8f9f7 1827
<> 144:ef7eb2e8f9f7 1828 /**
<> 144:ef7eb2e8f9f7 1829 * @brief Activate an additional current path on all lanes to meet the SDDTx parameter
<> 144:ef7eb2e8f9f7 1830 * defined in the MIPI D-PHY specification
AnnaBridge 183:a56a73fd2a6f 1831 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1832 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1833 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 1834 * @retval HAL status
<> 144:ef7eb2e8f9f7 1835 */
<> 144:ef7eb2e8f9f7 1836 HAL_StatusTypeDef HAL_DSI_SetSDD(DSI_HandleTypeDef *hdsi, FunctionalState State)
<> 144:ef7eb2e8f9f7 1837 {
<> 144:ef7eb2e8f9f7 1838 /* Process locked */
<> 144:ef7eb2e8f9f7 1839 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1840
<> 144:ef7eb2e8f9f7 1841 /* Check function parameters */
<> 144:ef7eb2e8f9f7 1842 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 1843
<> 144:ef7eb2e8f9f7 1844 /* Activate/Disactivate additional current path on all lanes */
<> 144:ef7eb2e8f9f7 1845 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_SDDC;
<> 144:ef7eb2e8f9f7 1846 hdsi->Instance->WPCR[1] |= ((uint32_t)State << 12);
<> 144:ef7eb2e8f9f7 1847
<> 144:ef7eb2e8f9f7 1848 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1849 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1850
<> 144:ef7eb2e8f9f7 1851 return HAL_OK;
<> 144:ef7eb2e8f9f7 1852 }
<> 144:ef7eb2e8f9f7 1853
<> 144:ef7eb2e8f9f7 1854 /**
<> 144:ef7eb2e8f9f7 1855 * @brief Custom lane pins configuration
AnnaBridge 183:a56a73fd2a6f 1856 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1857 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1858 * @param CustomLane Function to be applyed on selected lane.
<> 144:ef7eb2e8f9f7 1859 * This parameter can be any value of @ref DSI_CustomLane
AnnaBridge 183:a56a73fd2a6f 1860 * @param Lane select between clock or data lane 0 or data lane 1.
<> 144:ef7eb2e8f9f7 1861 * This parameter can be any value of @ref DSI_Lane_Select
AnnaBridge 183:a56a73fd2a6f 1862 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 1863 * @retval HAL status
<> 144:ef7eb2e8f9f7 1864 */
<> 144:ef7eb2e8f9f7 1865 HAL_StatusTypeDef HAL_DSI_SetLanePinsConfiguration(DSI_HandleTypeDef *hdsi, uint32_t CustomLane, uint32_t Lane, FunctionalState State)
<> 144:ef7eb2e8f9f7 1866 {
<> 144:ef7eb2e8f9f7 1867 /* Process locked */
<> 144:ef7eb2e8f9f7 1868 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1869
<> 144:ef7eb2e8f9f7 1870 /* Check function parameters */
<> 144:ef7eb2e8f9f7 1871 assert_param(IS_DSI_CUSTOM_LANE(CustomLane));
<> 144:ef7eb2e8f9f7 1872 assert_param(IS_DSI_LANE(Lane));
<> 144:ef7eb2e8f9f7 1873 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 1874
<> 144:ef7eb2e8f9f7 1875 switch(CustomLane)
<> 144:ef7eb2e8f9f7 1876 {
<> 144:ef7eb2e8f9f7 1877 case DSI_SWAP_LANE_PINS:
<> 144:ef7eb2e8f9f7 1878 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 1879 {
<> 144:ef7eb2e8f9f7 1880 /* Swap pins on clock lane */
<> 144:ef7eb2e8f9f7 1881 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_SWCL;
<> 144:ef7eb2e8f9f7 1882 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 6);
<> 144:ef7eb2e8f9f7 1883 }
<> 144:ef7eb2e8f9f7 1884 else if(Lane == DSI_DATA_LANE0)
<> 144:ef7eb2e8f9f7 1885 {
<> 144:ef7eb2e8f9f7 1886 /* Swap pins on data lane 0 */
<> 144:ef7eb2e8f9f7 1887 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_SWDL0;
<> 144:ef7eb2e8f9f7 1888 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 7);
<> 144:ef7eb2e8f9f7 1889 }
<> 144:ef7eb2e8f9f7 1890 else if(Lane == DSI_DATA_LANE1)
<> 144:ef7eb2e8f9f7 1891 {
<> 144:ef7eb2e8f9f7 1892 /* Swap pins on data lane 1 */
<> 144:ef7eb2e8f9f7 1893 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_SWDL1;
<> 144:ef7eb2e8f9f7 1894 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 8);
<> 144:ef7eb2e8f9f7 1895 }
<> 144:ef7eb2e8f9f7 1896 break;
<> 144:ef7eb2e8f9f7 1897 case DSI_INVERT_HS_SIGNAL:
<> 144:ef7eb2e8f9f7 1898 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 1899 {
<> 144:ef7eb2e8f9f7 1900 /* Invert HS signal on clock lane */
<> 144:ef7eb2e8f9f7 1901 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_HSICL;
<> 144:ef7eb2e8f9f7 1902 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 9);
<> 144:ef7eb2e8f9f7 1903 }
<> 144:ef7eb2e8f9f7 1904 else if(Lane == DSI_DATA_LANE0)
<> 144:ef7eb2e8f9f7 1905 {
<> 144:ef7eb2e8f9f7 1906 /* Invert HS signal on data lane 0 */
<> 144:ef7eb2e8f9f7 1907 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_HSIDL0;
<> 144:ef7eb2e8f9f7 1908 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 10);
<> 144:ef7eb2e8f9f7 1909 }
<> 144:ef7eb2e8f9f7 1910 else if(Lane == DSI_DATA_LANE1)
<> 144:ef7eb2e8f9f7 1911 {
<> 144:ef7eb2e8f9f7 1912 /* Invert HS signal on data lane 1 */
<> 144:ef7eb2e8f9f7 1913 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_HSIDL1;
<> 144:ef7eb2e8f9f7 1914 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 11);
<> 144:ef7eb2e8f9f7 1915 }
<> 144:ef7eb2e8f9f7 1916 break;
<> 144:ef7eb2e8f9f7 1917 default:
<> 144:ef7eb2e8f9f7 1918 break;
<> 144:ef7eb2e8f9f7 1919 }
<> 144:ef7eb2e8f9f7 1920
<> 144:ef7eb2e8f9f7 1921 /* Process unlocked */
<> 144:ef7eb2e8f9f7 1922 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 1923
<> 144:ef7eb2e8f9f7 1924 return HAL_OK;
<> 144:ef7eb2e8f9f7 1925 }
<> 144:ef7eb2e8f9f7 1926
<> 144:ef7eb2e8f9f7 1927 /**
<> 144:ef7eb2e8f9f7 1928 * @brief Set custom timing for the PHY
AnnaBridge 183:a56a73fd2a6f 1929 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 1930 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 1931 * @param Timing PHY timing to be adjusted.
<> 144:ef7eb2e8f9f7 1932 * This parameter can be any value of @ref DSI_PHY_Timing
AnnaBridge 183:a56a73fd2a6f 1933 * @param State ENABLE or DISABLE
AnnaBridge 183:a56a73fd2a6f 1934 * @param Value Custom value of the timing
<> 144:ef7eb2e8f9f7 1935 * @retval HAL status
<> 144:ef7eb2e8f9f7 1936 */
<> 144:ef7eb2e8f9f7 1937 HAL_StatusTypeDef HAL_DSI_SetPHYTimings(DSI_HandleTypeDef *hdsi, uint32_t Timing, FunctionalState State, uint32_t Value)
<> 144:ef7eb2e8f9f7 1938 {
<> 144:ef7eb2e8f9f7 1939 /* Process locked */
<> 144:ef7eb2e8f9f7 1940 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 1941
<> 144:ef7eb2e8f9f7 1942 /* Check function parameters */
<> 144:ef7eb2e8f9f7 1943 assert_param(IS_DSI_PHY_TIMING(Timing));
<> 144:ef7eb2e8f9f7 1944 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 1945
<> 144:ef7eb2e8f9f7 1946 switch(Timing)
<> 144:ef7eb2e8f9f7 1947 {
<> 144:ef7eb2e8f9f7 1948 case DSI_TCLK_POST:
<> 144:ef7eb2e8f9f7 1949 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 1950 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TCLKPOSTEN;
<> 144:ef7eb2e8f9f7 1951 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 27);
<> 144:ef7eb2e8f9f7 1952
<> 144:ef7eb2e8f9f7 1953 if(State)
<> 144:ef7eb2e8f9f7 1954 {
<> 144:ef7eb2e8f9f7 1955 /* Set custom value */
<> 144:ef7eb2e8f9f7 1956 hdsi->Instance->WPCR[4] &= ~DSI_WPCR4_TCLKPOST;
<> 144:ef7eb2e8f9f7 1957 hdsi->Instance->WPCR[4] |= Value & DSI_WPCR4_TCLKPOST;
<> 144:ef7eb2e8f9f7 1958 }
<> 144:ef7eb2e8f9f7 1959
<> 144:ef7eb2e8f9f7 1960 break;
<> 144:ef7eb2e8f9f7 1961 case DSI_TLPX_CLK:
<> 144:ef7eb2e8f9f7 1962 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 1963 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TLPXCEN;
<> 144:ef7eb2e8f9f7 1964 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 26);
<> 144:ef7eb2e8f9f7 1965
<> 144:ef7eb2e8f9f7 1966 if(State)
<> 144:ef7eb2e8f9f7 1967 {
<> 144:ef7eb2e8f9f7 1968 /* Set custom value */
<> 144:ef7eb2e8f9f7 1969 hdsi->Instance->WPCR[3] &= ~DSI_WPCR3_TLPXC;
<> 144:ef7eb2e8f9f7 1970 hdsi->Instance->WPCR[3] |= (Value << 24) & DSI_WPCR3_TLPXC;
<> 144:ef7eb2e8f9f7 1971 }
<> 144:ef7eb2e8f9f7 1972
<> 144:ef7eb2e8f9f7 1973 break;
<> 144:ef7eb2e8f9f7 1974 case DSI_THS_EXIT:
<> 144:ef7eb2e8f9f7 1975 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 1976 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_THSEXITEN;
<> 144:ef7eb2e8f9f7 1977 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 25);
<> 144:ef7eb2e8f9f7 1978
<> 144:ef7eb2e8f9f7 1979 if(State)
<> 144:ef7eb2e8f9f7 1980 {
<> 144:ef7eb2e8f9f7 1981 /* Set custom value */
<> 144:ef7eb2e8f9f7 1982 hdsi->Instance->WPCR[3] &= ~DSI_WPCR3_THSEXIT;
<> 144:ef7eb2e8f9f7 1983 hdsi->Instance->WPCR[3] |= (Value << 16) & DSI_WPCR3_THSEXIT;
<> 144:ef7eb2e8f9f7 1984 }
<> 144:ef7eb2e8f9f7 1985
<> 144:ef7eb2e8f9f7 1986 break;
<> 144:ef7eb2e8f9f7 1987 case DSI_TLPX_DATA:
<> 144:ef7eb2e8f9f7 1988 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 1989 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TLPXDEN;
<> 144:ef7eb2e8f9f7 1990 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 24);
<> 144:ef7eb2e8f9f7 1991
<> 144:ef7eb2e8f9f7 1992 if(State)
<> 144:ef7eb2e8f9f7 1993 {
<> 144:ef7eb2e8f9f7 1994 /* Set custom value */
<> 144:ef7eb2e8f9f7 1995 hdsi->Instance->WPCR[3] &= ~DSI_WPCR3_TLPXD;
<> 144:ef7eb2e8f9f7 1996 hdsi->Instance->WPCR[3] |= (Value << 8) & DSI_WPCR3_TLPXD;
<> 144:ef7eb2e8f9f7 1997 }
<> 144:ef7eb2e8f9f7 1998
<> 144:ef7eb2e8f9f7 1999 break;
<> 144:ef7eb2e8f9f7 2000 case DSI_THS_ZERO:
<> 144:ef7eb2e8f9f7 2001 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 2002 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_THSZEROEN;
<> 144:ef7eb2e8f9f7 2003 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 23);
<> 144:ef7eb2e8f9f7 2004
<> 144:ef7eb2e8f9f7 2005 if(State)
<> 144:ef7eb2e8f9f7 2006 {
<> 144:ef7eb2e8f9f7 2007 /* Set custom value */
<> 144:ef7eb2e8f9f7 2008 hdsi->Instance->WPCR[3] &= ~DSI_WPCR3_THSZERO;
<> 144:ef7eb2e8f9f7 2009 hdsi->Instance->WPCR[3] |= Value & DSI_WPCR3_THSZERO;
<> 144:ef7eb2e8f9f7 2010 }
<> 144:ef7eb2e8f9f7 2011
<> 144:ef7eb2e8f9f7 2012 break;
<> 144:ef7eb2e8f9f7 2013 case DSI_THS_TRAIL:
<> 144:ef7eb2e8f9f7 2014 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 2015 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_THSTRAILEN;
<> 144:ef7eb2e8f9f7 2016 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 22);
<> 144:ef7eb2e8f9f7 2017
<> 144:ef7eb2e8f9f7 2018 if(State)
<> 144:ef7eb2e8f9f7 2019 {
<> 144:ef7eb2e8f9f7 2020 /* Set custom value */
<> 144:ef7eb2e8f9f7 2021 hdsi->Instance->WPCR[2] &= ~DSI_WPCR2_THSTRAIL;
<> 144:ef7eb2e8f9f7 2022 hdsi->Instance->WPCR[2] |= (Value << 24) & DSI_WPCR2_THSTRAIL;
<> 144:ef7eb2e8f9f7 2023 }
<> 144:ef7eb2e8f9f7 2024
<> 144:ef7eb2e8f9f7 2025 break;
<> 144:ef7eb2e8f9f7 2026 case DSI_THS_PREPARE:
<> 144:ef7eb2e8f9f7 2027 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 2028 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_THSPREPEN;
<> 144:ef7eb2e8f9f7 2029 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 21);
<> 144:ef7eb2e8f9f7 2030
<> 144:ef7eb2e8f9f7 2031 if(State)
<> 144:ef7eb2e8f9f7 2032 {
<> 144:ef7eb2e8f9f7 2033 /* Set custom value */
<> 144:ef7eb2e8f9f7 2034 hdsi->Instance->WPCR[2] &= ~DSI_WPCR2_THSPREP;
<> 144:ef7eb2e8f9f7 2035 hdsi->Instance->WPCR[2] |= (Value << 16) & DSI_WPCR2_THSPREP;
<> 144:ef7eb2e8f9f7 2036 }
<> 144:ef7eb2e8f9f7 2037
<> 144:ef7eb2e8f9f7 2038 break;
<> 144:ef7eb2e8f9f7 2039 case DSI_TCLK_ZERO:
<> 144:ef7eb2e8f9f7 2040 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 2041 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TCLKZEROEN;
<> 144:ef7eb2e8f9f7 2042 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 20);
<> 144:ef7eb2e8f9f7 2043
<> 144:ef7eb2e8f9f7 2044 if(State)
<> 144:ef7eb2e8f9f7 2045 {
<> 144:ef7eb2e8f9f7 2046 /* Set custom value */
<> 144:ef7eb2e8f9f7 2047 hdsi->Instance->WPCR[2] &= ~DSI_WPCR2_TCLKZERO;
<> 144:ef7eb2e8f9f7 2048 hdsi->Instance->WPCR[2] |= (Value << 8) & DSI_WPCR2_TCLKZERO;
<> 144:ef7eb2e8f9f7 2049 }
<> 144:ef7eb2e8f9f7 2050
<> 144:ef7eb2e8f9f7 2051 break;
<> 144:ef7eb2e8f9f7 2052 case DSI_TCLK_PREPARE:
<> 144:ef7eb2e8f9f7 2053 /* Enable/Disable custom timing setting */
<> 144:ef7eb2e8f9f7 2054 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TCLKPREPEN;
<> 144:ef7eb2e8f9f7 2055 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 19);
<> 144:ef7eb2e8f9f7 2056
<> 144:ef7eb2e8f9f7 2057 if(State)
<> 144:ef7eb2e8f9f7 2058 {
<> 144:ef7eb2e8f9f7 2059 /* Set custom value */
<> 144:ef7eb2e8f9f7 2060 hdsi->Instance->WPCR[2] &= ~DSI_WPCR2_TCLKPREP;
<> 144:ef7eb2e8f9f7 2061 hdsi->Instance->WPCR[2] |= Value & DSI_WPCR2_TCLKPREP;
<> 144:ef7eb2e8f9f7 2062 }
<> 144:ef7eb2e8f9f7 2063
<> 144:ef7eb2e8f9f7 2064 break;
<> 144:ef7eb2e8f9f7 2065 default:
<> 144:ef7eb2e8f9f7 2066 break;
<> 144:ef7eb2e8f9f7 2067 }
<> 144:ef7eb2e8f9f7 2068
<> 144:ef7eb2e8f9f7 2069 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2070 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2071
<> 144:ef7eb2e8f9f7 2072 return HAL_OK;
<> 144:ef7eb2e8f9f7 2073 }
<> 144:ef7eb2e8f9f7 2074
<> 144:ef7eb2e8f9f7 2075 /**
<> 144:ef7eb2e8f9f7 2076 * @brief Force the Clock/Data Lane in TX Stop Mode
AnnaBridge 183:a56a73fd2a6f 2077 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2078 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 2079 * @param Lane select between clock or data lanes.
<> 144:ef7eb2e8f9f7 2080 * This parameter can be any value of @ref DSI_Lane_Group
AnnaBridge 183:a56a73fd2a6f 2081 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 2082 * @retval HAL status
<> 144:ef7eb2e8f9f7 2083 */
<> 144:ef7eb2e8f9f7 2084 HAL_StatusTypeDef HAL_DSI_ForceTXStopMode(DSI_HandleTypeDef *hdsi, uint32_t Lane, FunctionalState State)
<> 144:ef7eb2e8f9f7 2085 {
<> 144:ef7eb2e8f9f7 2086 /* Process locked */
<> 144:ef7eb2e8f9f7 2087 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 2088
<> 144:ef7eb2e8f9f7 2089 /* Check function parameters */
<> 144:ef7eb2e8f9f7 2090 assert_param(IS_DSI_LANE_GROUP(Lane));
<> 144:ef7eb2e8f9f7 2091 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 2092
<> 144:ef7eb2e8f9f7 2093 if(Lane == DSI_CLOCK_LANE)
<> 144:ef7eb2e8f9f7 2094 {
<> 144:ef7eb2e8f9f7 2095 /* Force/Unforce the Clock Lane in TX Stop Mode */
<> 144:ef7eb2e8f9f7 2096 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_FTXSMCL;
<> 144:ef7eb2e8f9f7 2097 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 12);
<> 144:ef7eb2e8f9f7 2098 }
<> 144:ef7eb2e8f9f7 2099 else if(Lane == DSI_DATA_LANES)
<> 144:ef7eb2e8f9f7 2100 {
<> 144:ef7eb2e8f9f7 2101 /* Force/Unforce the Data Lanes in TX Stop Mode */
<> 144:ef7eb2e8f9f7 2102 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_FTXSMDL;
<> 144:ef7eb2e8f9f7 2103 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 13);
<> 144:ef7eb2e8f9f7 2104 }
<> 144:ef7eb2e8f9f7 2105
<> 144:ef7eb2e8f9f7 2106 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2107 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2108
<> 144:ef7eb2e8f9f7 2109 return HAL_OK;
<> 144:ef7eb2e8f9f7 2110 }
<> 144:ef7eb2e8f9f7 2111
<> 144:ef7eb2e8f9f7 2112 /**
<> 144:ef7eb2e8f9f7 2113 * @brief Forces LP Receiver in Low-Power Mode
AnnaBridge 183:a56a73fd2a6f 2114 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2115 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 2116 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 2117 * @retval HAL status
<> 144:ef7eb2e8f9f7 2118 */
<> 144:ef7eb2e8f9f7 2119 HAL_StatusTypeDef HAL_DSI_ForceRXLowPower(DSI_HandleTypeDef *hdsi, FunctionalState State)
<> 144:ef7eb2e8f9f7 2120 {
<> 144:ef7eb2e8f9f7 2121 /* Process locked */
<> 144:ef7eb2e8f9f7 2122 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 2123
<> 144:ef7eb2e8f9f7 2124 /* Check function parameters */
<> 144:ef7eb2e8f9f7 2125 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 2126
<> 144:ef7eb2e8f9f7 2127 /* Force/Unforce LP Receiver in Low-Power Mode */
<> 144:ef7eb2e8f9f7 2128 hdsi->Instance->WPCR[1] &= ~DSI_WPCR1_FLPRXLPM;
<> 144:ef7eb2e8f9f7 2129 hdsi->Instance->WPCR[1] |= ((uint32_t)State << 22);
<> 144:ef7eb2e8f9f7 2130
<> 144:ef7eb2e8f9f7 2131 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2132 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2133
<> 144:ef7eb2e8f9f7 2134 return HAL_OK;
<> 144:ef7eb2e8f9f7 2135 }
<> 144:ef7eb2e8f9f7 2136
<> 144:ef7eb2e8f9f7 2137 /**
<> 144:ef7eb2e8f9f7 2138 * @brief Force Data Lanes in RX Mode after a BTA
AnnaBridge 183:a56a73fd2a6f 2139 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2140 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 2141 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 2142 * @retval HAL status
<> 144:ef7eb2e8f9f7 2143 */
<> 144:ef7eb2e8f9f7 2144 HAL_StatusTypeDef HAL_DSI_ForceDataLanesInRX(DSI_HandleTypeDef *hdsi, FunctionalState State)
<> 144:ef7eb2e8f9f7 2145 {
<> 144:ef7eb2e8f9f7 2146 /* Process locked */
<> 144:ef7eb2e8f9f7 2147 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 2148
<> 144:ef7eb2e8f9f7 2149 /* Check function parameters */
<> 144:ef7eb2e8f9f7 2150 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 2151
<> 144:ef7eb2e8f9f7 2152 /* Force Data Lanes in RX Mode */
<> 144:ef7eb2e8f9f7 2153 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_TDDL;
<> 144:ef7eb2e8f9f7 2154 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 16);
<> 144:ef7eb2e8f9f7 2155
<> 144:ef7eb2e8f9f7 2156 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2157 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2158
<> 144:ef7eb2e8f9f7 2159 return HAL_OK;
<> 144:ef7eb2e8f9f7 2160 }
<> 144:ef7eb2e8f9f7 2161
<> 144:ef7eb2e8f9f7 2162 /**
<> 144:ef7eb2e8f9f7 2163 * @brief Enable a pull-down on the lanes to prevent from floating states when unused
AnnaBridge 183:a56a73fd2a6f 2164 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2165 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 2166 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 2167 * @retval HAL status
<> 144:ef7eb2e8f9f7 2168 */
<> 144:ef7eb2e8f9f7 2169 HAL_StatusTypeDef HAL_DSI_SetPullDown(DSI_HandleTypeDef *hdsi, FunctionalState State)
<> 144:ef7eb2e8f9f7 2170 {
<> 144:ef7eb2e8f9f7 2171 /* Process locked */
<> 144:ef7eb2e8f9f7 2172 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 2173
<> 144:ef7eb2e8f9f7 2174 /* Check function parameters */
<> 144:ef7eb2e8f9f7 2175 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 2176
<> 144:ef7eb2e8f9f7 2177 /* Enable/Disable pull-down on lanes */
<> 144:ef7eb2e8f9f7 2178 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_PDEN;
<> 144:ef7eb2e8f9f7 2179 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 18);
<> 144:ef7eb2e8f9f7 2180
<> 144:ef7eb2e8f9f7 2181 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2182 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2183
<> 144:ef7eb2e8f9f7 2184 return HAL_OK;
<> 144:ef7eb2e8f9f7 2185 }
<> 144:ef7eb2e8f9f7 2186
<> 144:ef7eb2e8f9f7 2187 /**
<> 144:ef7eb2e8f9f7 2188 * @brief Switch off the contention detection on data lanes
AnnaBridge 183:a56a73fd2a6f 2189 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2190 * the configuration information for the DSI.
AnnaBridge 183:a56a73fd2a6f 2191 * @param State ENABLE or DISABLE
<> 144:ef7eb2e8f9f7 2192 * @retval HAL status
<> 144:ef7eb2e8f9f7 2193 */
<> 144:ef7eb2e8f9f7 2194 HAL_StatusTypeDef HAL_DSI_SetContentionDetectionOff(DSI_HandleTypeDef *hdsi, FunctionalState State)
<> 144:ef7eb2e8f9f7 2195 {
<> 144:ef7eb2e8f9f7 2196 /* Process locked */
<> 144:ef7eb2e8f9f7 2197 __HAL_LOCK(hdsi);
<> 144:ef7eb2e8f9f7 2198
<> 144:ef7eb2e8f9f7 2199 /* Check function parameters */
<> 144:ef7eb2e8f9f7 2200 assert_param(IS_FUNCTIONAL_STATE(State));
<> 144:ef7eb2e8f9f7 2201
<> 144:ef7eb2e8f9f7 2202 /* Contention Detection on Data Lanes OFF */
<> 144:ef7eb2e8f9f7 2203 hdsi->Instance->WPCR[0] &= ~DSI_WPCR0_CDOFFDL;
<> 144:ef7eb2e8f9f7 2204 hdsi->Instance->WPCR[0] |= ((uint32_t)State << 14);
<> 144:ef7eb2e8f9f7 2205
<> 144:ef7eb2e8f9f7 2206 /* Process unlocked */
<> 144:ef7eb2e8f9f7 2207 __HAL_UNLOCK(hdsi);
<> 144:ef7eb2e8f9f7 2208
<> 144:ef7eb2e8f9f7 2209 return HAL_OK;
<> 144:ef7eb2e8f9f7 2210 }
<> 144:ef7eb2e8f9f7 2211
<> 144:ef7eb2e8f9f7 2212 /**
<> 144:ef7eb2e8f9f7 2213 * @}
<> 144:ef7eb2e8f9f7 2214 */
<> 144:ef7eb2e8f9f7 2215
<> 144:ef7eb2e8f9f7 2216 /** @defgroup DSI_Group4 Peripheral State and Errors functions
<> 144:ef7eb2e8f9f7 2217 * @brief Peripheral State and Errors functions
<> 144:ef7eb2e8f9f7 2218 *
<> 144:ef7eb2e8f9f7 2219 @verbatim
<> 144:ef7eb2e8f9f7 2220 ===============================================================================
<> 144:ef7eb2e8f9f7 2221 ##### Peripheral State and Errors functions #####
<> 144:ef7eb2e8f9f7 2222 ===============================================================================
<> 144:ef7eb2e8f9f7 2223 [..]
<> 144:ef7eb2e8f9f7 2224 This subsection provides functions allowing to
<> 144:ef7eb2e8f9f7 2225 (+) Check the DSI state.
<> 144:ef7eb2e8f9f7 2226 (+) Get error code.
<> 144:ef7eb2e8f9f7 2227
<> 144:ef7eb2e8f9f7 2228 @endverbatim
<> 144:ef7eb2e8f9f7 2229 * @{
<> 144:ef7eb2e8f9f7 2230 */
<> 144:ef7eb2e8f9f7 2231
<> 144:ef7eb2e8f9f7 2232 /**
<> 144:ef7eb2e8f9f7 2233 * @brief Return the DSI state
AnnaBridge 183:a56a73fd2a6f 2234 * @param hdsi pointer to a DSI_HandleTypeDef structure that contains
<> 144:ef7eb2e8f9f7 2235 * the configuration information for the DSI.
<> 144:ef7eb2e8f9f7 2236 * @retval HAL state
<> 144:ef7eb2e8f9f7 2237 */
<> 144:ef7eb2e8f9f7 2238 HAL_DSI_StateTypeDef HAL_DSI_GetState(DSI_HandleTypeDef *hdsi)
<> 144:ef7eb2e8f9f7 2239 {
<> 144:ef7eb2e8f9f7 2240 return hdsi->State;
<> 144:ef7eb2e8f9f7 2241 }
<> 144:ef7eb2e8f9f7 2242
<> 144:ef7eb2e8f9f7 2243 /**
<> 144:ef7eb2e8f9f7 2244 * @}
<> 144:ef7eb2e8f9f7 2245 */
<> 144:ef7eb2e8f9f7 2246
<> 144:ef7eb2e8f9f7 2247 /**
<> 144:ef7eb2e8f9f7 2248 * @}
<> 144:ef7eb2e8f9f7 2249 */
<> 144:ef7eb2e8f9f7 2250 #endif /*STM32F769xx | STM32F779xx */
<> 144:ef7eb2e8f9f7 2251 #endif /* HAL_DSI_MODULE_ENABLED */
<> 144:ef7eb2e8f9f7 2252 /**
<> 144:ef7eb2e8f9f7 2253 * @}
<> 144:ef7eb2e8f9f7 2254 */
<> 144:ef7eb2e8f9f7 2255
<> 144:ef7eb2e8f9f7 2256 /**
<> 144:ef7eb2e8f9f7 2257 * @}
<> 144:ef7eb2e8f9f7 2258 */
<> 144:ef7eb2e8f9f7 2259
<> 144:ef7eb2e8f9f7 2260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/