STM32H735xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h7xx_hal_pssi.c 00004 * @author MCD Application Team 00005 * @brief PSSI HAL module driver. 00006 * This file provides firmware functions to manage the following 00007 * functionalities of the Parallel Synchronous Slave Interface (PSSI) peripheral: 00008 * + Initialization and de-initialization functions 00009 * + IO operation functions 00010 * + Peripheral State and Errors functions 00011 * 00012 ****************************************************************************** 00013 * @attention 00014 * 00015 * Copyright (c) 2017 STMicroelectronics. 00016 * All rights reserved. 00017 * 00018 * This software is licensed under terms that can be found in the LICENSE file 00019 * in the root directory of this software component. 00020 * If no LICENSE file comes with this software, it is provided AS-IS. 00021 * 00022 ****************************************************************************** 00023 @verbatim 00024 ============================================================================== 00025 ##### How to use this driver ##### 00026 ============================================================================== 00027 [..] 00028 The PSSI HAL driver can be used as follows: 00029 00030 (#) Declare a PSSI_HandleTypeDef handle structure, for example: 00031 PSSI_HandleTypeDef hpssi; 00032 00033 (#) Initialize the PSSI low level resources by implementing the HAL_PSSI_MspInit() API: 00034 (##) Enable the PSSIx interface clock 00035 (##) PSSI pins configuration 00036 (+++) Enable the clock for the PSSI GPIOs 00037 (+++) Configure PSSI pins as alternate function open-drain 00038 (##) NVIC configuration if you need to use interrupt process 00039 (+++) Configure the PSSIx interrupt priority 00040 (+++) Enable the NVIC PSSI IRQ Channel 00041 (##) DMA Configuration if you need to use DMA process 00042 (+++) Declare DMA_HandleTypeDef handles structure for the transmit and receive 00043 (+++) Enable the DMAx interface clock 00044 (+++) Configure the DMA handle parameters 00045 (+++) Configure the DMA Tx and Rx 00046 (+++) Associate the initialized DMA handle to the hpssi DMA Tx and Rx handle 00047 (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on 00048 the DMA Tx and Rx 00049 00050 (#) Configure the Communication Bus Width, Control Signals, Input Polarity and Output Polarity 00051 in the hpssi Init structure. 00052 00053 (#) Initialize the PSSI registers by calling the HAL_PSSI_Init(), configure also the low level Hardware 00054 (GPIO, CLOCK, NVIC...etc) by calling the customized HAL_PSSI_MspInit(&hpssi) API. 00055 00056 00057 (#) For PSSI IO operations, two operation modes are available within this driver : 00058 00059 *** Polling mode IO operation *** 00060 ================================= 00061 [..] 00062 (+) Transmit an amount of data by byte in blocking mode using HAL_PSSI_Transmit() 00063 (+) Receive an amount of data by byte in blocking mode using HAL_PSSI_Receive() 00064 00065 *** DMA mode IO operation *** 00066 ============================== 00067 [..] 00068 (+) Transmit an amount of data in non-blocking mode (DMA) using 00069 HAL_PSSI_Transmit_DMA() 00070 (+) At transmission end of transfer, HAL_PSSI_TxCpltCallback() is executed and user can 00071 add his own code by customization of function pointer HAL_PSSI_TxCpltCallback() 00072 (+) Receive an amount of data in non-blocking mode (DMA) using 00073 HAL_PSSI_Receive_DMA() 00074 (+) At reception end of transfer, HAL_PSSI_RxCpltCallback() is executed and user can 00075 add his own code by customization of function pointer HAL_PSSI_RxCpltCallback() 00076 (+) In case of transfer Error, HAL_PSSI_ErrorCallback() function is executed and user can 00077 add his own code by customization of function pointer HAL_PSSI_ErrorCallback() 00078 (+) Abort a PSSI process communication with Interrupt using HAL_PSSI_Abort_IT() 00079 (+) End of abort process, HAL_PSSI_AbortCpltCallback() is executed and user can 00080 add his own code by customization of function pointer HAL_PSSI_AbortCpltCallback() 00081 00082 *** PSSI HAL driver macros list *** 00083 ================================== 00084 [..] 00085 Below the list of most used macros in PSSI HAL driver. 00086 00087 (+) HAL_PSSI_ENABLE : Enable the PSSI peripheral 00088 (+) HAL_PSSI_DISABLE : Disable the PSSI peripheral 00089 (+) HAL_PSSI_GET_FLAG : Check whether the specified PSSI flag is set or not 00090 (+) HAL_PSSI_CLEAR_FLAG : Clear the specified PSSI pending flag 00091 (+) HAL_PSSI_ENABLE_IT : Enable the specified PSSI interrupt 00092 (+) HAL_PSSI_DISABLE_IT : Disable the specified PSSI interrupt 00093 00094 *** Callback registration *** 00095 ============================================= 00096 Use Functions HAL_PSSI_RegisterCallback() or HAL_PSSI_RegisterAddrCallback() 00097 to register an interrupt callback. 00098 00099 Function HAL_PSSI_RegisterCallback() allows to register following callbacks: 00100 (+) TxCpltCallback : callback for transmission end of transfer. 00101 (+) RxCpltCallback : callback for reception end of transfer. 00102 (+) ErrorCallback : callback for error detection. 00103 (+) AbortCpltCallback : callback for abort completion process. 00104 (+) MspInitCallback : callback for Msp Init. 00105 (+) MspDeInitCallback : callback for Msp DeInit. 00106 This function takes as parameters the HAL peripheral handle, the Callback ID 00107 and a pointer to the user callback function. 00108 00109 00110 Use function HAL_PSSI_UnRegisterCallback to reset a callback to the default 00111 weak function. 00112 HAL_PSSI_UnRegisterCallback takes as parameters the HAL peripheral handle, 00113 and the Callback ID. 00114 This function allows to reset following callbacks: 00115 (+) TxCpltCallback : callback for transmission end of transfer. 00116 (+) RxCpltCallback : callback for reception end of transfer. 00117 (+) ErrorCallback : callback for error detection. 00118 (+) AbortCpltCallback : callback for abort completion process. 00119 (+) MspInitCallback : callback for Msp Init. 00120 (+) MspDeInitCallback : callback for Msp DeInit. 00121 00122 00123 By default, after the HAL_PSSI_Init() and when the state is HAL_PSSI_STATE_RESET 00124 all callbacks are set to the corresponding weak functions: 00125 examples HAL_PSSI_TxCpltCallback(), HAL_PSSI_RxCpltCallback(). 00126 Exception done for MspInit and MspDeInit functions that are 00127 reset to the legacy weak functions in the HAL_PSSI_Init()/ HAL_PSSI_DeInit() only when 00128 these callbacks are null (not registered beforehand). 00129 If MspInit or MspDeInit are not null, the HAL_PSSI_Init()/ HAL_PSSI_DeInit() 00130 keep and use the user MspInit/MspDeInit callbacks (registered beforehand) whatever the state. 00131 00132 Callbacks can be registered/unregistered in HAL_PSSI_STATE_READY state only. 00133 Exception done MspInit/MspDeInit functions that can be registered/unregistered 00134 in HAL_PSSI_STATE_READY or HAL_PSSI_STATE_RESET state, 00135 thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit. 00136 Then, the user first registers the MspInit/MspDeInit user callbacks 00137 using HAL_PSSI_RegisterCallback() before calling HAL_PSSI_DeInit() 00138 or HAL_PSSI_Init() function. 00139 00140 00141 [..] 00142 (@) You can refer to the PSSI HAL driver header file for more useful macros 00143 00144 @endverbatim 00145 ****************************************************************************** 00146 */ 00147 00148 /* Includes ------------------------------------------------------------------*/ 00149 #include "stm32h7xx_hal.h" 00150 00151 /** @addtogroup STM32H7xx_HAL_Driver 00152 * @{ 00153 */ 00154 00155 /** @defgroup PSSI PSSI 00156 * @brief PSSI HAL module driver 00157 * @{ 00158 */ 00159 00160 #ifdef HAL_PSSI_MODULE_ENABLED 00161 #if defined(PSSI) 00162 /* Private typedef -----------------------------------------------------------*/ 00163 /* Private define ------------------------------------------------------------*/ 00164 00165 /** @defgroup PSSI_Private_Define PSSI Private Define 00166 * @{ 00167 */ 00168 00169 00170 00171 /** 00172 * @} 00173 */ 00174 00175 /* Private macro -------------------------------------------------------------*/ 00176 /* Private variables ---------------------------------------------------------*/ 00177 /* Private function prototypes -----------------------------------------------*/ 00178 00179 /** @defgroup PSSI_Private_Functions PSSI Private Functions 00180 * @{ 00181 */ 00182 /* Private functions to handle DMA transfer */ 00183 void PSSI_DMATransmitCplt(DMA_HandleTypeDef *hdma); 00184 void PSSI_DMAReceiveCplt(DMA_HandleTypeDef *hdma); 00185 void PSSI_DMAError(DMA_HandleTypeDef *hdma); 00186 void PSSI_DMAAbort(DMA_HandleTypeDef *hdma); 00187 00188 00189 /* Private functions to handle IT transfer */ 00190 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode); 00191 00192 /* Private functions to handle flags during polling transfer */ 00193 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, FlagStatus Status, uint32_t Timeout, uint32_t Tickstart); 00194 00195 /** 00196 * @} 00197 */ 00198 00199 /* Exported functions --------------------------------------------------------*/ 00200 00201 /** @defgroup PSSI_Exported_Functions PSSI Exported Functions 00202 * @{ 00203 */ 00204 00205 /** @defgroup PSSI_Exported_Functions_Group1 Initialization and de-initialization functions 00206 * @brief Initialization and Configuration functions 00207 * 00208 @verbatim 00209 =============================================================================== 00210 ##### Initialization and de-initialization functions ##### 00211 =============================================================================== 00212 [..] This subsection provides a set of functions allowing to initialize and 00213 deinitialize the PSSIx peripheral: 00214 00215 (+) User must implement HAL_PSSI_MspInit() function in which he configures 00216 all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ). 00217 00218 (+) Call the function HAL_PSSI_Init() to configure the selected device with 00219 the selected configuration: 00220 (++) Data Width 00221 (++) Control Signals 00222 (++) Input Clock polarity 00223 (++) Output Clock polarity 00224 00225 (+) Call the function HAL_PSSI_DeInit() to restore the default configuration 00226 of the selected PSSIx peripheral. 00227 00228 @endverbatim 00229 * @{ 00230 */ 00231 00232 /** 00233 * @brief Initializes the PSSI according to the specified parameters 00234 * in the PSSI_InitTypeDef and initialize the associated handle. 00235 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00236 * the configuration information for the specified PSSI. 00237 * @retval HAL status 00238 */ 00239 HAL_StatusTypeDef HAL_PSSI_Init(PSSI_HandleTypeDef *hpssi) 00240 { 00241 /* Check the PSSI handle allocation */ 00242 if (hpssi == NULL) 00243 { 00244 return HAL_ERROR; 00245 } 00246 00247 /* Check the parameters */ 00248 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); 00249 assert_param(IS_PSSI_CONTROL_SIGNAL(hpssi->Init.ControlSignal)); 00250 assert_param(IS_PSSI_BUSWIDTH(hpssi->Init.BusWidth)); 00251 assert_param(IS_PSSI_CLOCK_POLARITY(hpssi->Init.ClockPolarity)); 00252 assert_param(IS_PSSI_DE_POLARITY(hpssi->Init.DataEnablePolarity)); 00253 assert_param(IS_PSSI_RDY_POLARITY(hpssi->Init.ReadyPolarity)); 00254 00255 if (hpssi->State == HAL_PSSI_STATE_RESET) 00256 { 00257 /* Allocate lock resource and initialize it */ 00258 hpssi->Lock = HAL_UNLOCKED; 00259 00260 /* Init the PSSI Callback settings */ 00261 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ 00262 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ 00263 hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ 00264 hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ 00265 00266 if (hpssi->MspInitCallback == NULL) 00267 { 00268 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ 00269 } 00270 00271 /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */ 00272 hpssi->MspInitCallback(hpssi); 00273 00274 } 00275 00276 hpssi->State = HAL_PSSI_STATE_BUSY; 00277 00278 /* Disable the selected PSSI peripheral */ 00279 HAL_PSSI_DISABLE(hpssi); 00280 00281 /*---------------------------- PSSIx CR Configuration ----------------------*/ 00282 /* Configure PSSIx: Control Signal and Bus Width*/ 00283 00284 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DERDYCFG|PSSI_CR_EDM|PSSI_CR_DEPOL|PSSI_CR_RDYPOL, 00285 hpssi->Init.ControlSignal|hpssi->Init.DataEnablePolarity|hpssi->Init.ReadyPolarity|hpssi->Init.BusWidth); 00286 00287 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 00288 hpssi->State = HAL_PSSI_STATE_READY; 00289 00290 return HAL_OK; 00291 } 00292 00293 /** 00294 * @brief DeInitialize the PSSI peripheral. 00295 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00296 * the configuration information for the specified PSSI. 00297 * @retval HAL status 00298 */ 00299 HAL_StatusTypeDef HAL_PSSI_DeInit(PSSI_HandleTypeDef *hpssi) 00300 { 00301 /* Check the PSSI handle allocation */ 00302 if (hpssi == NULL) 00303 { 00304 return HAL_ERROR; 00305 } 00306 00307 /* Check the parameters */ 00308 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); 00309 00310 hpssi->State = HAL_PSSI_STATE_BUSY; 00311 00312 /* Disable the PSSI Peripheral Clock */ 00313 HAL_PSSI_DISABLE(hpssi); 00314 00315 if (hpssi->MspDeInitCallback == NULL) 00316 { 00317 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ 00318 } 00319 00320 /* DeInit the low level hardware: GPIO, CLOCK, NVIC */ 00321 hpssi->MspDeInitCallback(hpssi); 00322 00323 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 00324 hpssi->State = HAL_PSSI_STATE_RESET; 00325 00326 /* Release Lock */ 00327 __HAL_UNLOCK(hpssi); 00328 00329 return HAL_OK; 00330 } 00331 00332 /** 00333 * @brief Initialize the PSSI MSP. 00334 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00335 * the configuration information for the specified PSSI. 00336 * @retval None 00337 */ 00338 __weak void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi) 00339 { 00340 /* Prevent unused argument(s) compilation warning */ 00341 UNUSED(hpssi); 00342 00343 /* NOTE : This function should not be modified, when the callback is needed, 00344 the HAL_PSSI_MspInit can be implemented in the user file 00345 */ 00346 } 00347 00348 /** 00349 * @brief DeInitialize the PSSI MSP. 00350 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00351 * the configuration information for the specified PSSI. 00352 * @retval None 00353 */ 00354 __weak void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi) 00355 { 00356 /* Prevent unused argument(s) compilation warning */ 00357 UNUSED(hpssi); 00358 00359 /* NOTE : This function should not be modified, when the callback is needed, 00360 the HAL_PSSI_MspDeInit can be implemented in the user file 00361 */ 00362 } 00363 00364 /** 00365 * @brief Register a User PSSI Callback 00366 * To be used instead of the weak predefined callback 00367 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00368 * the configuration information for the specified PSSI. 00369 * @param CallbackID ID of the callback to be registered 00370 * This parameter can be one of the following values: 00371 * @arg @ref HAL_PSSI_TX_COMPLETE_CB_ID Tx Transfer completed callback ID 00372 * @arg @ref HAL_PSSI_RX_COMPLETE_CB_ID Rx Transfer completed callback ID 00373 * @arg @ref HAL_PSSI_ERROR_CB_ID Error callback ID 00374 * @arg @ref HAL_PSSI_ABORT_CB_ID Abort callback ID 00375 * @arg @ref HAL_PSSI_MSPINIT_CB_ID MspInit callback ID 00376 * @arg @ref HAL_PSSI_MSPDEINIT_CB_ID MspDeInit callback ID 00377 * @param pCallback pointer to the Callback function 00378 * @retval HAL status 00379 */ 00380 HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef CallbackID, pPSSI_CallbackTypeDef pCallback) 00381 { 00382 HAL_StatusTypeDef status = HAL_OK; 00383 00384 if (pCallback == NULL) 00385 { 00386 /* Update the error code */ 00387 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00388 00389 return HAL_ERROR; 00390 } 00391 /* Process locked */ 00392 __HAL_LOCK(hpssi); 00393 00394 if (HAL_PSSI_STATE_READY == hpssi->State) 00395 { 00396 switch (CallbackID) 00397 { 00398 case HAL_PSSI_TX_COMPLETE_CB_ID : 00399 hpssi->TxCpltCallback = pCallback; 00400 break; 00401 00402 case HAL_PSSI_RX_COMPLETE_CB_ID : 00403 hpssi->RxCpltCallback = pCallback; 00404 break; 00405 00406 case HAL_PSSI_ERROR_CB_ID : 00407 hpssi->ErrorCallback = pCallback; 00408 break; 00409 00410 case HAL_PSSI_ABORT_CB_ID : 00411 hpssi->AbortCpltCallback = pCallback; 00412 break; 00413 00414 case HAL_PSSI_MSPINIT_CB_ID : 00415 hpssi->MspInitCallback = pCallback; 00416 break; 00417 00418 case HAL_PSSI_MSPDEINIT_CB_ID : 00419 hpssi->MspDeInitCallback = pCallback; 00420 break; 00421 00422 default : 00423 /* Update the error code */ 00424 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00425 00426 /* Return error status */ 00427 status = HAL_ERROR; 00428 break; 00429 } 00430 } 00431 else if (HAL_PSSI_STATE_RESET == hpssi->State) 00432 { 00433 switch (CallbackID) 00434 { 00435 case HAL_PSSI_MSPINIT_CB_ID : 00436 hpssi->MspInitCallback = pCallback; 00437 break; 00438 00439 case HAL_PSSI_MSPDEINIT_CB_ID : 00440 hpssi->MspDeInitCallback = pCallback; 00441 break; 00442 00443 default : 00444 /* Update the error code */ 00445 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00446 00447 /* Return error status */ 00448 status = HAL_ERROR; 00449 break; 00450 } 00451 } 00452 else 00453 { 00454 /* Update the error code */ 00455 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00456 00457 /* Return error status */ 00458 status = HAL_ERROR; 00459 } 00460 00461 /* Release Lock */ 00462 __HAL_UNLOCK(hpssi); 00463 return status; 00464 } 00465 00466 /** 00467 * @brief Unregister an PSSI Callback 00468 * PSSI callback is redirected to the weak predefined callback 00469 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00470 * the configuration information for the specified PSSI. 00471 * @param CallbackID ID of the callback to be unregistered 00472 * This parameter can be one of the following values: 00473 * @arg @ref HAL_PSSI_TX_COMPLETE_CB_ID Tx Transfer completed callback ID 00474 * @arg @ref HAL_PSSI_RX_COMPLETE_CB_ID Rx Transfer completed callback ID 00475 * @arg @ref HAL_PSSI_ERROR_CB_ID Error callback ID 00476 * @arg @ref HAL_PSSI_ABORT_CB_ID Abort callback ID 00477 * @arg @ref HAL_PSSI_MSPINIT_CB_ID MspInit callback ID 00478 * @arg @ref HAL_PSSI_MSPDEINIT_CB_ID MspDeInit callback ID 00479 * @retval HAL status 00480 */ 00481 HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef CallbackID) 00482 { 00483 HAL_StatusTypeDef status = HAL_OK; 00484 00485 /* Process locked */ 00486 __HAL_LOCK(hpssi); 00487 00488 if (HAL_PSSI_STATE_READY == hpssi->State) 00489 { 00490 switch (CallbackID) 00491 { 00492 case HAL_PSSI_TX_COMPLETE_CB_ID : 00493 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ 00494 break; 00495 00496 case HAL_PSSI_RX_COMPLETE_CB_ID : 00497 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ 00498 break; 00499 00500 case HAL_PSSI_ERROR_CB_ID : 00501 hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ 00502 break; 00503 00504 case HAL_PSSI_ABORT_CB_ID : 00505 hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ 00506 break; 00507 00508 case HAL_PSSI_MSPINIT_CB_ID : 00509 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ 00510 break; 00511 00512 case HAL_PSSI_MSPDEINIT_CB_ID : 00513 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ 00514 break; 00515 00516 default : 00517 /* Update the error code */ 00518 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00519 00520 /* Return error status */ 00521 status = HAL_ERROR; 00522 break; 00523 } 00524 } 00525 else if (HAL_PSSI_STATE_RESET == hpssi->State) 00526 { 00527 switch (CallbackID) 00528 { 00529 case HAL_PSSI_MSPINIT_CB_ID : 00530 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ 00531 break; 00532 00533 case HAL_PSSI_MSPDEINIT_CB_ID : 00534 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ 00535 break; 00536 00537 default : 00538 /* Update the error code */ 00539 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00540 00541 /* Return error status */ 00542 status = HAL_ERROR; 00543 break; 00544 } 00545 } 00546 else 00547 { 00548 /* Update the error code */ 00549 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; 00550 00551 /* Return error status */ 00552 status = HAL_ERROR; 00553 } 00554 00555 /* Release Lock */ 00556 __HAL_UNLOCK(hpssi); 00557 return status; 00558 } 00559 00560 00561 /** 00562 * @} 00563 */ 00564 00565 /** @defgroup PSSI_Exported_Functions_Group2 Input and Output operation functions 00566 * @brief Data transfers functions 00567 * 00568 @verbatim 00569 =============================================================================== 00570 ##### IO operation functions ##### 00571 =============================================================================== 00572 [..] 00573 This subsection provides a set of functions allowing to manage the PSSI data 00574 transfers. 00575 00576 (#) There are two modes of transfer: 00577 (++) Blocking mode : The communication is performed in the polling mode. 00578 The status of all data processing is returned by the same function 00579 after finishing transfer. 00580 (++) No-Blocking mode : The communication is performed using DMA. 00581 These functions return the status of the transfer startup. 00582 The end of the data processing will be indicated through the 00583 dedicated the DMA IRQ . 00584 00585 (#) Blocking mode functions are : 00586 (++) HAL_PSSI_Transmit() 00587 (++) HAL_PSSI_Receive() 00588 00589 (#) No-Blocking mode functions with DMA are : 00590 (++) HAL_PSSI_Transmit_DMA() 00591 (++) HAL_PSSI_Receive_DMA() 00592 00593 (#) A set of Transfer Complete Callbacks are provided in non Blocking mode: 00594 (++) HAL_PSSI_TxCpltCallback() 00595 (++) HAL_PSSI_RxCpltCallback() 00596 (++) HAL_PSSI_ErrorCallback() 00597 (++) HAL_PSSI_AbortCpltCallback() 00598 00599 @endverbatim 00600 * @{ 00601 */ 00602 00603 /** 00604 * @brief Transmits in master mode an amount of data in blocking mode. 00605 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00606 * the configuration information for the specified PSSI. 00607 * @param pData Pointer to data buffer 00608 * @param Size Amount of data to be sent (in bytes) 00609 * @param Timeout Timeout duration 00610 * @retval HAL status 00611 */ 00612 HAL_StatusTypeDef HAL_PSSI_Transmit(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32_t Timeout) 00613 { 00614 uint32_t tickstart; 00615 uint32_t transfer_size = Size; 00616 00617 #if defined (__GNUC__) 00618 __IO uint16_t *pdr_16bits = (__IO uint16_t *)(&(hpssi->Instance->DR)); 00619 #endif /* __GNUC__ */ 00620 00621 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || 00622 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size%2U) != 0U)) || 00623 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size%4U) != 0U))) 00624 { 00625 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; 00626 return HAL_ERROR; 00627 } 00628 if (hpssi->State == HAL_PSSI_STATE_READY) 00629 { 00630 /* Process Locked */ 00631 __HAL_LOCK(hpssi); 00632 00633 hpssi->State = HAL_PSSI_STATE_BUSY; 00634 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 00635 00636 /* Disable the selected PSSI peripheral */ 00637 HAL_PSSI_DISABLE(hpssi); 00638 00639 /* Configure transfer parameters */ 00640 hpssi->Instance->CR |= PSSI_CR_OUTEN_OUTPUT | 00641 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL); 00642 /* DMA Disable */ 00643 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; 00644 00645 /* Enable the selected PSSI peripheral */ 00646 HAL_PSSI_ENABLE(hpssi); 00647 00648 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) 00649 { 00650 uint8_t *pbuffer = pData; 00651 while (transfer_size > 0U) 00652 { 00653 /* Init tickstart for timeout management*/ 00654 tickstart = HAL_GetTick(); 00655 /* Wait until Fifo is ready to transfer one byte flag is set */ 00656 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) 00657 { 00658 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00659 hpssi->State = HAL_PSSI_STATE_READY; 00660 /* Process Unlocked */ 00661 __HAL_UNLOCK(hpssi); 00662 return HAL_ERROR; 00663 } 00664 /* Write data to DR */ 00665 *(__IO uint8_t *)(&hpssi->Instance->DR) = *(uint8_t *)pbuffer; 00666 00667 /* Increment Buffer pointer */ 00668 pbuffer++; 00669 00670 transfer_size--; 00671 } 00672 } 00673 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) 00674 { 00675 uint16_t *pbuffer = (uint16_t *)pData; 00676 while (transfer_size > 0U) 00677 { 00678 /* Init tickstart for timeout management*/ 00679 tickstart = HAL_GetTick(); 00680 /* Wait until Fifo is ready to transfer four bytes flag is set */ 00681 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) 00682 { 00683 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00684 hpssi->State = HAL_PSSI_STATE_READY; 00685 /* Process Unlocked */ 00686 __HAL_UNLOCK(hpssi); 00687 return HAL_ERROR; 00688 } 00689 /* Write data to DR */ 00690 #if defined (__GNUC__) 00691 *pdr_16bits = *pbuffer; 00692 #else 00693 *(__IO uint16_t *)((uint32_t)(&hpssi->Instance->DR)) = *pbuffer; 00694 #endif /* __GNUC__ */ 00695 00696 /* Increment Buffer pointer */ 00697 pbuffer++; 00698 transfer_size -= 2U; 00699 00700 } 00701 } 00702 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) 00703 { 00704 uint32_t *pbuffer = (uint32_t *)pData; 00705 while (transfer_size > 0U) 00706 { 00707 /* Init tickstart for timeout management*/ 00708 tickstart = HAL_GetTick(); 00709 /* Wait until Fifo is ready to transfer four bytes flag is set */ 00710 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) 00711 { 00712 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00713 hpssi->State = HAL_PSSI_STATE_READY; 00714 /* Process Unlocked */ 00715 __HAL_UNLOCK(hpssi); 00716 return HAL_ERROR; 00717 } 00718 /* Write data to DR */ 00719 *(__IO uint32_t *)(&hpssi->Instance->DR) = *pbuffer; 00720 00721 /* Increment Buffer pointer */ 00722 pbuffer++; 00723 transfer_size -= 4U; 00724 } 00725 00726 } 00727 else 00728 { 00729 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; 00730 hpssi->State = HAL_PSSI_STATE_READY; 00731 /* Process Unlocked */ 00732 __HAL_UNLOCK(hpssi); 00733 return HAL_ERROR; 00734 } 00735 00736 /* Check Errors Flags */ 00737 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) 00738 { 00739 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); 00740 HAL_PSSI_DISABLE(hpssi); 00741 hpssi->ErrorCode = HAL_PSSI_ERROR_UNDER_RUN; 00742 hpssi->State = HAL_PSSI_STATE_READY; 00743 /* Process Unlocked */ 00744 __HAL_UNLOCK(hpssi); 00745 return HAL_ERROR; 00746 } 00747 00748 hpssi->State = HAL_PSSI_STATE_READY; 00749 00750 /* Process Unlocked */ 00751 __HAL_UNLOCK(hpssi); 00752 00753 return HAL_OK; 00754 } 00755 else 00756 { 00757 return HAL_BUSY; 00758 } 00759 } 00760 00761 00762 /** 00763 * @brief Receives an amount of data in blocking mode. 00764 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00765 * the configuration information for the specified PSSI. 00766 * @param pData Pointer to data buffer 00767 * @param Size Amount of data to be received (in bytes) 00768 * @param Timeout Timeout duration 00769 * @retval HAL status 00770 */ 00771 HAL_StatusTypeDef HAL_PSSI_Receive(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32_t Timeout) 00772 { 00773 uint32_t tickstart; 00774 uint32_t transfer_size = Size; 00775 #if defined (__GNUC__) 00776 __IO uint16_t *pdr_16bits = (__IO uint16_t *)(&(hpssi->Instance->DR)); 00777 #endif /* __GNUC__ */ 00778 00779 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || 00780 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size%2U) != 0U)) || 00781 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size%4U) != 0U))) 00782 { 00783 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; 00784 return HAL_ERROR; 00785 } 00786 00787 if (hpssi->State == HAL_PSSI_STATE_READY) 00788 { 00789 /* Process Locked */ 00790 __HAL_LOCK(hpssi); 00791 00792 hpssi->State = HAL_PSSI_STATE_BUSY; 00793 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 00794 00795 /* Disable the selected PSSI peripheral */ 00796 HAL_PSSI_DISABLE(hpssi); 00797 /* Configure transfer parameters */ 00798 hpssi->Instance->CR |= PSSI_CR_OUTEN_INPUT |((hpssi->Init.ClockPolarity == HAL_PSSI_FALLING_EDGE)?0U:PSSI_CR_CKPOL); 00799 00800 00801 /* DMA Disable */ 00802 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; 00803 00804 /* Enable the selected PSSI peripheral */ 00805 HAL_PSSI_ENABLE(hpssi); 00806 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) 00807 { 00808 uint8_t *pbuffer = pData; 00809 00810 while (transfer_size > 0U) 00811 { 00812 /* Init tickstart for timeout management*/ 00813 tickstart = HAL_GetTick(); 00814 /* Wait until Fifo is ready to receive one byte flag is set */ 00815 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) 00816 { 00817 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00818 hpssi->State = HAL_PSSI_STATE_READY; 00819 /* Process Unlocked */ 00820 __HAL_UNLOCK(hpssi); 00821 return HAL_ERROR; 00822 } 00823 /* Read data from DR */ 00824 *pbuffer = *(__IO uint8_t *)(&hpssi->Instance->DR); 00825 pbuffer++; 00826 transfer_size--; 00827 } 00828 } 00829 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) 00830 { 00831 uint16_t *pbuffer = (uint16_t *)pData; 00832 00833 while (transfer_size > 0U) 00834 { 00835 /* Init tickstart for timeout management*/ 00836 tickstart = HAL_GetTick(); 00837 /* Wait until Fifo is ready to receive four bytes flag is set */ 00838 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) 00839 { 00840 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00841 hpssi->State = HAL_PSSI_STATE_READY; 00842 /* Process Unlocked */ 00843 __HAL_UNLOCK(hpssi); 00844 return HAL_ERROR; 00845 } 00846 00847 /* Read data from DR */ 00848 #if defined (__GNUC__) 00849 *pbuffer = *pdr_16bits; 00850 #else 00851 *pbuffer = *(__IO uint16_t *)((uint32_t)&hpssi->Instance->DR); 00852 #endif /* __GNUC__ */ 00853 00854 pbuffer++; 00855 transfer_size -= 2U; 00856 00857 } 00858 } 00859 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) 00860 { 00861 uint32_t *pbuffer = (uint32_t *)pData; 00862 00863 while (transfer_size > 0U) 00864 { 00865 /* Init tickstart for timeout management*/ 00866 tickstart = HAL_GetTick(); 00867 /* Wait until Fifo is ready to receive four bytes flag is set */ 00868 if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) 00869 { 00870 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; 00871 hpssi->State = HAL_PSSI_STATE_READY; 00872 /* Process Unlocked */ 00873 __HAL_UNLOCK(hpssi); 00874 return HAL_ERROR; 00875 } 00876 00877 /* Read data from DR */ 00878 *pbuffer = *(__IO uint32_t *)(&hpssi->Instance->DR); 00879 pbuffer++; 00880 transfer_size -= 4U; 00881 00882 } 00883 } 00884 else 00885 { 00886 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; 00887 hpssi->State = HAL_PSSI_STATE_READY; 00888 /* Process Unlocked */ 00889 __HAL_UNLOCK(hpssi); 00890 return HAL_ERROR; 00891 } 00892 /* Check Errors Flags */ 00893 00894 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) 00895 { 00896 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); 00897 hpssi->ErrorCode = HAL_PSSI_ERROR_OVER_RUN; 00898 __HAL_UNLOCK(hpssi); 00899 return HAL_ERROR; 00900 } 00901 00902 00903 hpssi->State = HAL_PSSI_STATE_READY; 00904 00905 /* Process Unlocked */ 00906 __HAL_UNLOCK(hpssi); 00907 00908 return HAL_OK; 00909 } 00910 else 00911 { 00912 return HAL_BUSY; 00913 } 00914 } 00915 00916 /** 00917 * @brief Transmit an amount of data in non-blocking mode with DMA 00918 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 00919 * the configuration information for the specified PSSI. 00920 * @param pData Pointer to data buffer 00921 * @param Size Amount of data to be sent (in bytes) 00922 * @retval HAL status 00923 */ 00924 HAL_StatusTypeDef HAL_PSSI_Transmit_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) 00925 { 00926 HAL_StatusTypeDef dmaxferstatus; 00927 00928 if (hpssi->State == HAL_PSSI_STATE_READY) 00929 { 00930 00931 /* Process Locked */ 00932 __HAL_LOCK(hpssi); 00933 00934 hpssi->State = HAL_PSSI_STATE_BUSY_TX; 00935 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 00936 00937 /* Disable the selected PSSI peripheral */ 00938 HAL_PSSI_DISABLE(hpssi); 00939 00940 /* Prepare transfer parameters */ 00941 hpssi->pBuffPtr = pData; 00942 hpssi->XferCount = Size; 00943 00944 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) 00945 { 00946 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; 00947 } 00948 else 00949 { 00950 hpssi->XferSize = hpssi->XferCount; 00951 } 00952 00953 if (hpssi->XferSize > 0U) 00954 { 00955 if (hpssi->hdmatx != NULL) 00956 { 00957 00958 /* Configure BusWidth */ 00959 if( hpssi->hdmatx->Init.PeriphDataAlignment == DMA_PDATAALIGN_BYTE) 00960 { 00961 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | PSSI_CR_OUTEN_OUTPUT | 00962 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL)); 00963 } 00964 else 00965 { 00966 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | PSSI_CR_OUTEN_OUTPUT | 00967 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL)); 00968 } 00969 00970 /* Set the PSSI DMA transfer complete callback */ 00971 hpssi->hdmatx->XferCpltCallback = PSSI_DMATransmitCplt; 00972 00973 /* Set the DMA error callback */ 00974 hpssi->hdmatx->XferErrorCallback = PSSI_DMAError; 00975 00976 /* Set the unused DMA callbacks to NULL */ 00977 hpssi->hdmatx->XferHalfCpltCallback = NULL; 00978 hpssi->hdmatx->XferAbortCallback = NULL; 00979 00980 /* Enable the DMA */ 00981 dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmatx, (uint32_t)pData, (uint32_t)&hpssi->Instance->DR, hpssi->XferSize); 00982 } 00983 else 00984 { 00985 /* Update PSSI state */ 00986 hpssi->State = HAL_PSSI_STATE_READY; 00987 00988 /* Update PSSI error code */ 00989 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; 00990 00991 /* Process Unlocked */ 00992 __HAL_UNLOCK(hpssi); 00993 00994 return HAL_ERROR; 00995 } 00996 00997 if (dmaxferstatus == HAL_OK) 00998 { 00999 01000 01001 /* Update XferCount value */ 01002 hpssi->XferCount -= hpssi->XferSize; 01003 01004 /* Process Unlocked */ 01005 __HAL_UNLOCK(hpssi); 01006 01007 /* Note : The PSSI interrupts must be enabled after unlocking current process 01008 to avoid the risk of PSSI interrupt handle execution before current 01009 process unlock */ 01010 /* Enable ERR interrupt */ 01011 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01012 01013 /* Enable DMA Request */ 01014 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; 01015 /* Enable the selected PSSI peripheral */ 01016 HAL_PSSI_ENABLE(hpssi); 01017 } 01018 else 01019 { 01020 /* Update PSSI state */ 01021 hpssi->State = HAL_PSSI_STATE_READY; 01022 01023 /* Update PSSI error code */ 01024 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; 01025 01026 /* Process Unlocked */ 01027 __HAL_UNLOCK(hpssi); 01028 01029 return HAL_ERROR; 01030 } 01031 } 01032 else 01033 { 01034 /* Process Unlocked */ 01035 __HAL_UNLOCK(hpssi); 01036 01037 /* Note : The PSSI interrupts must be enabled after unlocking current process 01038 to avoid the risk of PSSI interrupt handle execution before current 01039 process unlock */ 01040 /* Enable ERRinterrupt */ 01041 /* possible to enable all of these */ 01042 01043 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01044 } 01045 01046 return HAL_OK; 01047 } 01048 else 01049 { 01050 return HAL_BUSY; 01051 } 01052 } 01053 01054 /** 01055 * @brief Receive an amount of data in non-blocking mode with DMA 01056 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01057 * the configuration information for the specified PSSI. 01058 * @param pData Pointer to data buffer 01059 * @param Size Amount of data to be received (in bytes) 01060 * @retval HAL status 01061 */ 01062 HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) 01063 { 01064 01065 HAL_StatusTypeDef dmaxferstatus; 01066 01067 if (hpssi->State == HAL_PSSI_STATE_READY) 01068 { 01069 01070 /* Disable the selected PSSI peripheral */ 01071 HAL_PSSI_DISABLE(hpssi); 01072 /* Process Locked */ 01073 __HAL_LOCK(hpssi); 01074 01075 hpssi->State = HAL_PSSI_STATE_BUSY_RX; 01076 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; 01077 01078 /* Prepare transfer parameters */ 01079 hpssi->pBuffPtr = pData; 01080 hpssi->XferCount = Size; 01081 01082 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) 01083 { 01084 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; 01085 } 01086 else 01087 { 01088 hpssi->XferSize = hpssi->XferCount; 01089 } 01090 01091 if (hpssi->XferSize > 0U) 01092 { 01093 if (hpssi->hdmarx != NULL) 01094 { 01095 01096 /* Configure BusWidth */ 01097 if( hpssi->hdmatx->Init.PeriphDataAlignment == DMA_PDATAALIGN_BYTE) 01098 { 01099 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | 01100 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?PSSI_CR_CKPOL:0U)); 01101 } 01102 else 01103 { 01104 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | 01105 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?PSSI_CR_CKPOL:0U)); 01106 } 01107 01108 /* Set the PSSI DMA transfer complete callback */ 01109 hpssi->hdmarx->XferCpltCallback = PSSI_DMAReceiveCplt; 01110 01111 /* Set the DMA error callback */ 01112 hpssi->hdmarx->XferErrorCallback = PSSI_DMAError; 01113 01114 /* Set the unused DMA callbacks to NULL */ 01115 hpssi->hdmarx->XferHalfCpltCallback = NULL; 01116 hpssi->hdmarx->XferAbortCallback = NULL; 01117 01118 /* Enable the DMA */ 01119 dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmarx, (uint32_t)&hpssi->Instance->DR, (uint32_t)pData, hpssi->XferSize); 01120 } 01121 else 01122 { 01123 /* Update PSSI state */ 01124 hpssi->State = HAL_PSSI_STATE_READY; 01125 01126 /* Update PSSI error code */ 01127 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; 01128 01129 /* Process Unlocked */ 01130 __HAL_UNLOCK(hpssi); 01131 01132 return HAL_ERROR; 01133 } 01134 01135 if (dmaxferstatus == HAL_OK) 01136 { 01137 /* Update XferCount value */ 01138 hpssi->XferCount -= hpssi->XferSize; 01139 01140 /* Process Unlocked */ 01141 __HAL_UNLOCK(hpssi); 01142 01143 /* Note : The PSSI interrupts must be enabled after unlocking current process 01144 to avoid the risk of PSSI interrupt handle execution before current 01145 process unlock */ 01146 /* Enable ERR interrupt */ 01147 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01148 01149 /* Enable DMA Request */ 01150 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; 01151 /* Enable the selected PSSI peripheral */ 01152 HAL_PSSI_ENABLE(hpssi); 01153 } 01154 else 01155 { 01156 /* Update PSSI state */ 01157 hpssi->State = HAL_PSSI_STATE_READY; 01158 01159 /* Update PSSI error code */ 01160 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; 01161 01162 /* Process Unlocked */ 01163 __HAL_UNLOCK(hpssi); 01164 01165 return HAL_ERROR; 01166 } 01167 } 01168 else 01169 { 01170 01171 /* Process Unlocked */ 01172 __HAL_UNLOCK(hpssi); 01173 01174 /* Enable ERR,interrupt */ 01175 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01176 } 01177 01178 return HAL_OK; 01179 } 01180 else 01181 { 01182 return HAL_BUSY; 01183 } 01184 } 01185 01186 01187 01188 /** 01189 * @brief Abort a DMA process communication with Interrupt. 01190 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01191 * the configuration information for the specified PSSI. 01192 * @retval HAL status 01193 */ 01194 HAL_StatusTypeDef HAL_PSSI_Abort_DMA(PSSI_HandleTypeDef *hpssi) 01195 { 01196 01197 /* Process Locked */ 01198 __HAL_LOCK(hpssi); 01199 01200 /* Disable Interrupts */ 01201 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01202 01203 /* Set State at HAL_PSSI_STATE_ABORT */ 01204 hpssi->State = HAL_PSSI_STATE_ABORT; 01205 01206 /* Abort DMA TX transfer if any */ 01207 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) 01208 { 01209 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) 01210 { 01211 01212 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01213 01214 if (hpssi->hdmatx != NULL) 01215 { 01216 /* Set the PSSI DMA Abort callback : 01217 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01218 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; 01219 01220 /* Abort DMA TX */ 01221 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) 01222 { 01223 /* Call Directly XferAbortCallback function in case of error */ 01224 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); 01225 } 01226 } 01227 01228 } 01229 /* Abort DMA RX transfer if any */ 01230 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) 01231 { 01232 01233 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01234 01235 if (hpssi->hdmarx != NULL) 01236 { 01237 /* Set the PSSI DMA Abort callback : 01238 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01239 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; 01240 01241 /* Abort DMA RX */ 01242 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) 01243 { 01244 /* Call Directly hpssi->hdma->XferAbortCallback function in case of error */ 01245 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); 01246 } 01247 } 01248 } 01249 else 01250 { 01251 /* Call the error callback */ 01252 hpssi->ErrorCallback(hpssi); 01253 } 01254 } 01255 01256 01257 /* Process Unlocked */ 01258 __HAL_UNLOCK(hpssi); 01259 01260 /* Note : The PSSI interrupts must be enabled after unlocking current process 01261 to avoid the risk of PSSI interrupt handle execution before current 01262 process unlock */ 01263 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01264 01265 return HAL_OK; 01266 01267 } 01268 01269 /** 01270 * @} 01271 */ 01272 01273 /** @defgroup PSSI_Exported_Functions_Group3 IRQ Handler and Callbacks 01274 * @{ 01275 */ 01276 01277 /** 01278 * @brief This function handles PSSI event interrupt request. 01279 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01280 * the configuration information for the specified PSSI. 01281 * @retval None 01282 */ 01283 void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi) 01284 { 01285 /* Overrun/ Underrun Errors */ 01286 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_MIS) != 0U) 01287 { 01288 /* Reset handle parameters */ 01289 01290 hpssi->XferCount = 0U; 01291 01292 /* Disable all interrupts */ 01293 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01294 01295 01296 /* Abort DMA TX transfer if any */ 01297 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) 01298 { 01299 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) 01300 { 01301 /* Set new error code */ 01302 hpssi->ErrorCode |= HAL_PSSI_ERROR_UNDER_RUN; 01303 01304 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01305 01306 if (hpssi->hdmatx != NULL) 01307 { 01308 /* Set the PSSI DMA Abort callback : 01309 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01310 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; 01311 01312 /* Process Unlocked */ 01313 __HAL_UNLOCK(hpssi); 01314 01315 /* Abort DMA TX */ 01316 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) 01317 { 01318 /* Call Directly XferAbortCallback function in case of error */ 01319 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); 01320 } 01321 } 01322 01323 } 01324 /* Abort DMA RX transfer if any */ 01325 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) 01326 { 01327 /* Set new error code */ 01328 hpssi->ErrorCode |= HAL_PSSI_ERROR_OVER_RUN; 01329 01330 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01331 01332 if (hpssi->hdmarx != NULL) 01333 { 01334 /* Set the PSSI DMA Abort callback : 01335 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01336 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; 01337 01338 /* Process Unlocked */ 01339 __HAL_UNLOCK(hpssi); 01340 01341 /* Abort DMA RX */ 01342 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) 01343 { 01344 /* Call Directly hpssi->hdma->XferAbortCallback function in case of error */ 01345 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); 01346 } 01347 } 01348 } 01349 else 01350 { 01351 /* Call the corresponding callback to inform upper layer of the error */ 01352 hpssi->ErrorCallback(hpssi); 01353 } 01354 } 01355 01356 /* If state is an abort treatment on going, don't change state */ 01357 if (hpssi->State == HAL_PSSI_STATE_ABORT) 01358 { 01359 hpssi->State = HAL_PSSI_STATE_READY; 01360 01361 /* Process Unlocked */ 01362 __HAL_UNLOCK(hpssi); 01363 01364 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01365 hpssi->AbortCpltCallback(hpssi); 01366 01367 } 01368 else 01369 { 01370 /* Set HAL_PSSI_STATE_READY */ 01371 hpssi->State = HAL_PSSI_STATE_READY; 01372 /* Process Unlocked */ 01373 __HAL_UNLOCK(hpssi); 01374 01375 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01376 hpssi->ErrorCallback(hpssi); 01377 01378 } 01379 01380 } 01381 } 01382 01383 01384 /** 01385 * @brief Tx Transfer complete callback. 01386 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01387 * the configuration information for the specified PSSI. 01388 * @retval None 01389 */ 01390 __weak void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi) 01391 { 01392 /* Prevent unused argument(s) compilation warning */ 01393 UNUSED(hpssi); 01394 01395 /* NOTE : This function should not be modified, when the callback is needed, 01396 the HAL_PSSI_TxCpltCallback can be implemented in the user file 01397 */ 01398 } 01399 01400 /** 01401 * @brief Rx Transfer complete callback. 01402 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01403 * the configuration information for the specified PSSI. 01404 * @retval None 01405 */ 01406 __weak void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi) 01407 { 01408 /* Prevent unused argument(s) compilation warning */ 01409 UNUSED(hpssi); 01410 01411 /* NOTE : This function should not be modified, when the callback is needed, 01412 the HAL_PSSI_RxCpltCallback can be implemented in the user file 01413 */ 01414 } 01415 01416 01417 /** 01418 * @brief PSSI error callback. 01419 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01420 * the configuration information for the specified PSSI. 01421 * @retval None 01422 */ 01423 __weak void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi) 01424 { 01425 /* Prevent unused argument(s) compilation warning */ 01426 UNUSED(hpssi); 01427 01428 /* NOTE : This function should not be modified, when the callback is needed, 01429 the HAL_PSSI_ErrorCallback could be implemented in the user file 01430 */ 01431 } 01432 01433 /** 01434 * @brief PSSI abort callback. 01435 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01436 * the configuration information for the specified PSSI. 01437 * @retval None 01438 */ 01439 __weak void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi) 01440 { 01441 /* Prevent unused argument(s) compilation warning */ 01442 UNUSED(hpssi); 01443 01444 /* NOTE : This function should not be modified, when the callback is needed, 01445 the HAL_PSSI_AbortCpltCallback could be implemented in the user file 01446 */ 01447 } 01448 01449 /** 01450 * @} 01451 */ 01452 01453 /** @defgroup PSSI_Exported_Functions_Group4 Peripheral State, Mode and Error functions 01454 * @brief Peripheral State, Mode and Error functions 01455 * 01456 @verbatim 01457 =============================================================================== 01458 ##### Peripheral State, Mode and Error functions ##### 01459 =============================================================================== 01460 [..] 01461 This subsection permit to get in run-time the status of the peripheral 01462 and the data flow. 01463 01464 @endverbatim 01465 * @{ 01466 */ 01467 01468 /** 01469 * @brief Return the PSSI handle state. 01470 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01471 * the configuration information for the specified PSSI. 01472 * @retval HAL state 01473 */ 01474 HAL_PSSI_StateTypeDef HAL_PSSI_GetState(PSSI_HandleTypeDef *hpssi) 01475 { 01476 /* Return PSSI handle state */ 01477 return hpssi->State; 01478 } 01479 01480 01481 /** 01482 * @brief Return the PSSI error code. 01483 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01484 * the configuration information for the specified PSSI. 01485 * @retval PSSI Error Code 01486 */ 01487 uint32_t HAL_PSSI_GetError(PSSI_HandleTypeDef *hpssi) 01488 { 01489 return hpssi->ErrorCode; 01490 } 01491 01492 /** 01493 * @} 01494 */ 01495 01496 /** 01497 * @} 01498 */ 01499 01500 /** @addtogroup PSSI_Private_Functions 01501 * @{ 01502 */ 01503 01504 /** 01505 * @brief PSSI Errors process. 01506 * @param hpssi PSSI handle. 01507 * @param ErrorCode Error code to handle. 01508 * @retval None 01509 */ 01510 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode) 01511 { 01512 01513 /* Reset handle parameters */ 01514 01515 hpssi->XferCount = 0U; 01516 01517 /* Set new error code */ 01518 hpssi->ErrorCode |= ErrorCode; 01519 01520 /* Disable all interrupts */ 01521 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01522 01523 01524 /* Abort DMA TX transfer if any */ 01525 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) 01526 { 01527 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) 01528 { 01529 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01530 01531 if (hpssi->hdmatx != NULL) 01532 { 01533 /* Set the PSSI DMA Abort callback : 01534 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01535 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; 01536 01537 /* Process Unlocked */ 01538 __HAL_UNLOCK(hpssi); 01539 01540 /* Abort DMA TX */ 01541 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) 01542 { 01543 /* Call Directly XferAbortCallback function in case of error */ 01544 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); 01545 } 01546 } 01547 01548 } 01549 /* Abort DMA RX transfer if any */ 01550 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) 01551 { 01552 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; 01553 01554 if (hpssi->hdmarx != NULL) 01555 { 01556 /* Set the PSSI DMA Abort callback : 01557 will lead to call HAL_PSSI_ErrorCallback() at end of DMA abort procedure */ 01558 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; 01559 01560 /* Process Unlocked */ 01561 __HAL_UNLOCK(hpssi); 01562 01563 /* Abort DMA RX */ 01564 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) 01565 { 01566 /* Call Directly hpssi->hdma->XferAbortCallback function in case of error */ 01567 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); 01568 } 01569 } 01570 } 01571 else 01572 { 01573 /*Nothing to do*/ 01574 } 01575 } 01576 01577 /* If state is an abort treatment on going, don't change state */ 01578 if (hpssi->State == HAL_PSSI_STATE_ABORT) 01579 { 01580 hpssi->State = HAL_PSSI_STATE_READY; 01581 01582 /* Process Unlocked */ 01583 __HAL_UNLOCK(hpssi); 01584 01585 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01586 01587 hpssi->AbortCpltCallback(hpssi); 01588 01589 } 01590 else 01591 { 01592 /* Set HAL_PSSI_STATE_READY */ 01593 hpssi->State = HAL_PSSI_STATE_READY; 01594 01595 /* Process Unlocked */ 01596 __HAL_UNLOCK(hpssi); 01597 01598 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01599 hpssi->ErrorCallback(hpssi); 01600 01601 } 01602 } 01603 01604 /** 01605 * @brief DMA PSSI slave transmit process complete callback. 01606 * @param hdma DMA handle 01607 * @retval None 01608 */ 01609 void PSSI_DMATransmitCplt(DMA_HandleTypeDef *hdma) 01610 { 01611 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Derogation MISRAC2012-Rule-11.5 */ 01612 01613 uint32_t tmperror; 01614 01615 01616 /* Disable Interrupts */ 01617 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01618 01619 /* Store current volatile hpssi->ErrorCode, misra rule */ 01620 tmperror = hpssi->ErrorCode; 01621 01622 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01623 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) 01624 { 01625 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01626 PSSI_Error(hpssi, hpssi->ErrorCode); 01627 } 01628 /* hpssi->State == HAL_PSSI_STATE_BUSY_TX */ 01629 else 01630 { 01631 hpssi->State = HAL_PSSI_STATE_READY; 01632 01633 /* Process Unlocked */ 01634 __HAL_UNLOCK(hpssi); 01635 01636 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01637 01638 hpssi->TxCpltCallback(hpssi); 01639 01640 } 01641 01642 01643 } 01644 01645 /** 01646 * @brief DMA PSSI master receive process complete callback. 01647 * @param hdma DMA handle 01648 * @retval None 01649 */ 01650 void PSSI_DMAReceiveCplt(DMA_HandleTypeDef *hdma) 01651 { 01652 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Derogation MISRAC2012-Rule-11.5 */ 01653 01654 uint32_t tmperror; 01655 01656 01657 /* Disable Interrupts */ 01658 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01659 01660 /* Store current volatile hpssi->ErrorCode, misra rule */ 01661 tmperror = hpssi->ErrorCode; 01662 01663 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01664 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) 01665 { 01666 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01667 PSSI_Error(hpssi, hpssi->ErrorCode); 01668 } 01669 /* hpssi->State == HAL_PSSI_STATE_BUSY_RX */ 01670 else 01671 { 01672 hpssi->State = HAL_PSSI_STATE_READY; 01673 01674 /* Process Unlocked */ 01675 __HAL_UNLOCK(hpssi); 01676 01677 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01678 hpssi->RxCpltCallback(hpssi); 01679 01680 } 01681 01682 01683 } 01684 01685 /** 01686 * @brief DMA PSSI communication abort callback 01687 * (To be called at end of DMA Abort procedure). 01688 * @param hdma DMA handle. 01689 * @retval None 01690 */ 01691 void PSSI_DMAAbort(DMA_HandleTypeDef *hdma) 01692 { 01693 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Derogation MISRAC2012-Rule-11.5 */ 01694 01695 /* Reset AbortCpltCallback */ 01696 hpssi->hdmatx->XferAbortCallback = NULL; 01697 hpssi->hdmarx->XferAbortCallback = NULL; 01698 01699 /* Check if come from abort from user */ 01700 if (hpssi->State == HAL_PSSI_STATE_ABORT) 01701 { 01702 hpssi->State = HAL_PSSI_STATE_READY; 01703 01704 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01705 01706 hpssi->AbortCpltCallback(hpssi); 01707 01708 } 01709 else 01710 { 01711 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01712 hpssi->ErrorCallback(hpssi); 01713 } 01714 } 01715 01716 /** 01717 * @brief This function handles PSSI Communication Timeout. 01718 * @param hpssi Pointer to a PSSI_HandleTypeDef structure that contains 01719 * the configuration information for the specified PSSI. 01720 * @param Flag Specifies the PSSI flag to check. 01721 * @param Status The new Flag status (SET or RESET). 01722 * @param Timeout Timeout duration 01723 * @param Tickstart Tick start value 01724 * @retval HAL status 01725 */ 01726 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, FlagStatus Status, uint32_t Timeout, uint32_t Tickstart) 01727 { 01728 while ((HAL_PSSI_GET_STATUS(hpssi, Flag) & Flag) == (uint32_t)Status) 01729 { 01730 /* Check for the Timeout */ 01731 if (Timeout != HAL_MAX_DELAY) 01732 { 01733 if (((HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U)) 01734 { 01735 hpssi->ErrorCode |= HAL_PSSI_ERROR_TIMEOUT; 01736 hpssi->State = HAL_PSSI_STATE_READY; 01737 01738 /* Process Unlocked */ 01739 __HAL_UNLOCK(hpssi); 01740 01741 return HAL_ERROR; 01742 } 01743 } 01744 } 01745 return HAL_OK; 01746 } 01747 void PSSI_DMAError(DMA_HandleTypeDef *hdma) 01748 { 01749 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Derogation MISRAC2012-Rule-11.5 */ 01750 01751 uint32_t tmperror; 01752 01753 01754 /* Disable the selected PSSI peripheral */ 01755 HAL_PSSI_DISABLE(hpssi); 01756 01757 /* Disable Interrupts */ 01758 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); 01759 01760 /* Store current volatile hpssi->ErrorCode, misra rule */ 01761 tmperror = hpssi->ErrorCode; 01762 01763 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01764 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) 01765 { 01766 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01767 PSSI_Error(hpssi, hpssi->ErrorCode); 01768 } 01769 else 01770 { 01771 hpssi->State = HAL_PSSI_STATE_READY; 01772 01773 /* Process Unlocked */ 01774 __HAL_UNLOCK(hpssi); 01775 01776 /* Call the corresponding callback to inform upper layer of End of Transfer */ 01777 hpssi->ErrorCallback(hpssi); 01778 01779 } 01780 01781 } 01782 01783 01784 01785 /** 01786 * @} 01787 */ 01788 #endif /* PSSI */ 01789 #endif /* HAL_PSSI_MODULE_ENABLED */ 01790 /** 01791 * @} 01792 */ 01793 01794 /** 01795 * @} 01796 */