Lines Matching refs:hpssi
181 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode);
188 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl…
235 HAL_StatusTypeDef HAL_PSSI_Init(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Init() argument
238 if (hpssi == NULL) in HAL_PSSI_Init()
244 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_Init()
245 assert_param(IS_PSSI_CONTROL_SIGNAL(hpssi->Init.ControlSignal)); in HAL_PSSI_Init()
246 assert_param(IS_PSSI_BUSWIDTH(hpssi->Init.BusWidth)); in HAL_PSSI_Init()
247 assert_param(IS_PSSI_CLOCK_POLARITY(hpssi->Init.ClockPolarity)); in HAL_PSSI_Init()
248 assert_param(IS_PSSI_DE_POLARITY(hpssi->Init.DataEnablePolarity)); in HAL_PSSI_Init()
249 assert_param(IS_PSSI_RDY_POLARITY(hpssi->Init.ReadyPolarity)); in HAL_PSSI_Init()
251 if (hpssi->State == HAL_PSSI_STATE_RESET) in HAL_PSSI_Init()
254 hpssi->Lock = HAL_UNLOCKED; in HAL_PSSI_Init()
257 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_Init()
258 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_Init()
259 …hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_Init()
260 …hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_Init()
262 if (hpssi->MspInitCallback == NULL) in HAL_PSSI_Init()
264 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_Init()
268 hpssi->MspInitCallback(hpssi); in HAL_PSSI_Init()
272 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Init()
275 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Init()
280 MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DERDYCFG|PSSI_CR_EDM|PSSI_CR_DEPOL|PSSI_CR_RDYPOL, in HAL_PSSI_Init()
281 …hpssi->Init.ControlSignal|hpssi->Init.DataEnablePolarity|hpssi->Init.ReadyPolarity|hpssi->Init.Bus… in HAL_PSSI_Init()
283 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Init()
284 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Init()
295 HAL_StatusTypeDef HAL_PSSI_DeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_DeInit() argument
298 if (hpssi == NULL) in HAL_PSSI_DeInit()
304 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_DeInit()
306 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_DeInit()
309 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_DeInit()
311 if (hpssi->MspDeInitCallback == NULL) in HAL_PSSI_DeInit()
313 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_DeInit()
317 hpssi->MspDeInitCallback(hpssi); in HAL_PSSI_DeInit()
319 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_DeInit()
320 hpssi->State = HAL_PSSI_STATE_RESET; in HAL_PSSI_DeInit()
323 __HAL_UNLOCK(hpssi); in HAL_PSSI_DeInit()
334 __weak void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspInit() argument
337 UNUSED(hpssi); in HAL_PSSI_MspInit()
350 __weak void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspDeInit() argument
353 UNUSED(hpssi); in HAL_PSSI_MspDeInit()
376 HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef C… in HAL_PSSI_RegisterCallback() argument
383 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
388 __HAL_LOCK(hpssi); in HAL_PSSI_RegisterCallback()
390 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_RegisterCallback()
395 hpssi->TxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
399 hpssi->RxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
403 hpssi->ErrorCallback = pCallback; in HAL_PSSI_RegisterCallback()
407 hpssi->AbortCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
411 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
415 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
420 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
427 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_RegisterCallback()
432 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
436 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
441 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
451 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
458 __HAL_UNLOCK(hpssi); in HAL_PSSI_RegisterCallback()
477 HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef… in HAL_PSSI_UnRegisterCallback() argument
482 __HAL_LOCK(hpssi); in HAL_PSSI_UnRegisterCallback()
484 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_UnRegisterCallback()
489 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
493 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
497 …hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_UnRegisterCallback()
501 …hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_UnRegisterCallback()
505 …hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
509 …hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
514 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
521 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_UnRegisterCallback()
526 …hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
530 …hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
535 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
545 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
552 __HAL_UNLOCK(hpssi); in HAL_PSSI_UnRegisterCallback()
608 HAL_StatusTypeDef HAL_PSSI_Transmit(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint3… in HAL_PSSI_Transmit() argument
613 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || in HAL_PSSI_Transmit()
614 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size%2U) != 0U)) || in HAL_PSSI_Transmit()
615 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size%4U) != 0U))) in HAL_PSSI_Transmit()
617 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
620 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit()
623 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit()
625 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Transmit()
626 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit()
629 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
632 hpssi->Instance->CR |= PSSI_CR_OUTEN_OUTPUT | in HAL_PSSI_Transmit()
633 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL); in HAL_PSSI_Transmit()
635 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Transmit()
638 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit()
640 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Transmit()
648 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
650 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
651 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
653 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
657 *(__IO uint8_t *)(&hpssi->Instance->DR) = *(uint8_t *)pbuffer; in HAL_PSSI_Transmit()
665 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Transmit()
674 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
676 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
677 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
679 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
687 *(__IO uint32_t *)((uint32_t)(&hpssi->Instance->DR)) = data; in HAL_PSSI_Transmit()
694 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Transmit()
703 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
705 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
706 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
708 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
720 *(__IO uint32_t *)(&hpssi->Instance->DR) = data; in HAL_PSSI_Transmit()
729 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
730 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
732 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
737 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Transmit()
739 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit()
740 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
741 hpssi->ErrorCode = HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_Transmit()
742 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
744 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
748 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
751 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
771 HAL_StatusTypeDef HAL_PSSI_Receive(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32… in HAL_PSSI_Receive() argument
776 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || in HAL_PSSI_Receive()
777 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size%2U) != 0U)) || in HAL_PSSI_Receive()
778 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size%4U) != 0U))) in HAL_PSSI_Receive()
780 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Receive()
784 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive()
787 __HAL_LOCK(hpssi); in HAL_PSSI_Receive()
789 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Receive()
790 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive()
793 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive()
795 …hpssi->Instance->CR |= PSSI_CR_OUTEN_INPUT |((hpssi->Init.ClockPolarity == HAL_PSSI_FALLING_EDGE)?… in HAL_PSSI_Receive()
799 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Receive()
802 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive()
803 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Receive()
812 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
814 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
815 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
817 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
821 *pbuffer = *(__IO uint8_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
826 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Receive()
835 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
837 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
838 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
840 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
845 data = *(__IO uint32_t *)((uint32_t)&hpssi->Instance->DR); in HAL_PSSI_Receive()
853 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Receive()
862 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
864 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
865 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
867 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
872 data = *(__IO uint32_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
887 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Receive()
888 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
890 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
895 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Receive()
897 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive()
898 hpssi->ErrorCode = HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_Receive()
899 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
903 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
906 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
924 HAL_StatusTypeDef HAL_PSSI_Transmit_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Transmit_DMA() argument
928 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit_DMA()
932 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit_DMA()
934 hpssi->State = HAL_PSSI_STATE_BUSY_TX; in HAL_PSSI_Transmit_DMA()
935 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit_DMA()
938 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit_DMA()
941 hpssi->pBuffPtr = pData; in HAL_PSSI_Transmit_DMA()
942 hpssi->XferCount = Size; in HAL_PSSI_Transmit_DMA()
944 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Transmit_DMA()
946 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Transmit_DMA()
950 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Transmit_DMA()
953 if (hpssi->XferSize > 0U) in HAL_PSSI_Transmit_DMA()
955 if (hpssi->hdmatx != NULL) in HAL_PSSI_Transmit_DMA()
959 if( hpssi->hdmatx->Init.PeriphDataAlignment == DMA_PDATAALIGN_BYTE) in HAL_PSSI_Transmit_DMA()
961 …MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | PSSI… in HAL_PSSI_Transmit_DMA()
962 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
966 …MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | hpss… in HAL_PSSI_Transmit_DMA()
967 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?0U:PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
971 hpssi->hdmatx->XferCpltCallback = PSSI_DMATransmitCplt; in HAL_PSSI_Transmit_DMA()
974 hpssi->hdmatx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Transmit_DMA()
977 hpssi->hdmatx->XferHalfCpltCallback = NULL; in HAL_PSSI_Transmit_DMA()
978 hpssi->hdmatx->XferAbortCallback = NULL; in HAL_PSSI_Transmit_DMA()
981 …dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmatx, (uint32_t)pData, (uint32_t)&hpssi->Instance->DR, h… in HAL_PSSI_Transmit_DMA()
986 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
989 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
992 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1002 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
1005 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1011 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1014 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Transmit_DMA()
1016 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit_DMA()
1021 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1024 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1027 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1035 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1043 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1062 HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Receive_DMA() argument
1067 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive_DMA()
1071 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive_DMA()
1073 __HAL_LOCK(hpssi); in HAL_PSSI_Receive_DMA()
1075 hpssi->State = HAL_PSSI_STATE_BUSY_RX; in HAL_PSSI_Receive_DMA()
1076 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive_DMA()
1079 hpssi->pBuffPtr = pData; in HAL_PSSI_Receive_DMA()
1080 hpssi->XferCount = Size; in HAL_PSSI_Receive_DMA()
1082 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Receive_DMA()
1084 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Receive_DMA()
1088 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Receive_DMA()
1091 if (hpssi->XferSize > 0U) in HAL_PSSI_Receive_DMA()
1093 if (hpssi->hdmarx != NULL) in HAL_PSSI_Receive_DMA()
1097 if( hpssi->hdmatx->Init.PeriphDataAlignment == DMA_PDATAALIGN_BYTE) in HAL_PSSI_Receive_DMA()
1099 … MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | in HAL_PSSI_Receive_DMA()
1100 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?PSSI_CR_CKPOL:0U)); in HAL_PSSI_Receive_DMA()
1104 …MODIFY_REG(hpssi->Instance->CR,PSSI_CR_DMAEN|PSSI_CR_OUTEN|PSSI_CR_CKPOL,PSSI_CR_DMA_ENABLE | hpss… in HAL_PSSI_Receive_DMA()
1105 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE)?PSSI_CR_CKPOL:0U)); in HAL_PSSI_Receive_DMA()
1109 hpssi->hdmarx->XferCpltCallback = PSSI_DMAReceiveCplt; in HAL_PSSI_Receive_DMA()
1112 hpssi->hdmarx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Receive_DMA()
1115 hpssi->hdmarx->XferHalfCpltCallback = NULL; in HAL_PSSI_Receive_DMA()
1116 hpssi->hdmarx->XferAbortCallback = NULL; in HAL_PSSI_Receive_DMA()
1119 …dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmarx, (uint32_t)&hpssi->Instance->DR, (uint32_t)pData, h… in HAL_PSSI_Receive_DMA()
1124 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1127 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1130 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1138 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1141 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1147 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1150 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Receive_DMA()
1152 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive_DMA()
1157 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1160 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1163 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1172 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1175 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1194 HAL_StatusTypeDef HAL_PSSI_Abort_DMA(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Abort_DMA() argument
1198 __HAL_LOCK(hpssi); in HAL_PSSI_Abort_DMA()
1201 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1204 hpssi->State = HAL_PSSI_STATE_ABORT; in HAL_PSSI_Abort_DMA()
1207 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_Abort_DMA()
1209 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_Abort_DMA()
1212 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1214 if (hpssi->hdmatx != NULL) in HAL_PSSI_Abort_DMA()
1218 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1221 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1224 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_Abort_DMA()
1230 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_Abort_DMA()
1233 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1235 if (hpssi->hdmarx != NULL) in HAL_PSSI_Abort_DMA()
1239 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1242 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1245 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_Abort_DMA()
1252 hpssi->ErrorCallback(hpssi); in HAL_PSSI_Abort_DMA()
1258 __HAL_UNLOCK(hpssi); in HAL_PSSI_Abort_DMA()
1263 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1283 void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_IRQHandler() argument
1286 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_MIS) != 0U) in HAL_PSSI_IRQHandler()
1290 hpssi->XferCount = 0U; in HAL_PSSI_IRQHandler()
1293 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_IRQHandler()
1297 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_IRQHandler()
1299 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_IRQHandler()
1302 hpssi->ErrorCode |= HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_IRQHandler()
1304 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1306 if (hpssi->hdmatx != NULL) in HAL_PSSI_IRQHandler()
1310 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1313 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1316 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_IRQHandler()
1319 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_IRQHandler()
1325 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_IRQHandler()
1328 hpssi->ErrorCode |= HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_IRQHandler()
1330 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1332 if (hpssi->hdmarx != NULL) in HAL_PSSI_IRQHandler()
1336 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1339 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1342 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_IRQHandler()
1345 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_IRQHandler()
1352 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1357 if (hpssi->State == HAL_PSSI_STATE_ABORT) in HAL_PSSI_IRQHandler()
1360 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1365 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1367 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1370 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1384 __weak void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_TxCpltCallback() argument
1387 UNUSED(hpssi); in HAL_PSSI_TxCpltCallback()
1400 __weak void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_RxCpltCallback() argument
1403 UNUSED(hpssi); in HAL_PSSI_RxCpltCallback()
1417 __weak void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_ErrorCallback() argument
1420 UNUSED(hpssi); in HAL_PSSI_ErrorCallback()
1433 __weak void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_AbortCpltCallback() argument
1436 UNUSED(hpssi); in HAL_PSSI_AbortCpltCallback()
1468 HAL_PSSI_StateTypeDef HAL_PSSI_GetState(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetState() argument
1471 return hpssi->State; in HAL_PSSI_GetState()
1481 uint32_t HAL_PSSI_GetError(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetError() argument
1483 return hpssi->ErrorCode; in HAL_PSSI_GetError()
1504 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode) in PSSI_Error() argument
1509 hpssi->XferCount = 0U; in PSSI_Error()
1512 hpssi->ErrorCode |= ErrorCode; in PSSI_Error()
1515 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_Error()
1519 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in PSSI_Error()
1521 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in PSSI_Error()
1523 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1525 if (hpssi->hdmatx != NULL) in PSSI_Error()
1529 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1532 __HAL_UNLOCK(hpssi); in PSSI_Error()
1535 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in PSSI_Error()
1538 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in PSSI_Error()
1544 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in PSSI_Error()
1546 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1548 if (hpssi->hdmarx != NULL) in PSSI_Error()
1552 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1555 __HAL_UNLOCK(hpssi); in PSSI_Error()
1558 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in PSSI_Error()
1561 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in PSSI_Error()
1572 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_Error()
1575 __HAL_UNLOCK(hpssi); in PSSI_Error()
1580 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1583 __HAL_UNLOCK(hpssi); in PSSI_Error()
1586 hpssi->ErrorCallback(hpssi); in PSSI_Error()
1598 …PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Deroga… in PSSI_DMATransmitCplt() local
1604 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMATransmitCplt()
1607 tmperror = hpssi->ErrorCode; in PSSI_DMATransmitCplt()
1610 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMATransmitCplt()
1613 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMATransmitCplt()
1618 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMATransmitCplt()
1621 __HAL_UNLOCK(hpssi); in PSSI_DMATransmitCplt()
1625 hpssi->TxCpltCallback(hpssi); in PSSI_DMATransmitCplt()
1639 …PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Deroga… in PSSI_DMAReceiveCplt() local
1645 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAReceiveCplt()
1648 tmperror = hpssi->ErrorCode; in PSSI_DMAReceiveCplt()
1651 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAReceiveCplt()
1654 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAReceiveCplt()
1659 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAReceiveCplt()
1662 __HAL_UNLOCK(hpssi); in PSSI_DMAReceiveCplt()
1665 hpssi->RxCpltCallback(hpssi); in PSSI_DMAReceiveCplt()
1680 …PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Deroga… in PSSI_DMAAbort() local
1683 hpssi->hdmatx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1684 hpssi->hdmarx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1687 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_DMAAbort()
1689 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAAbort()
1693 hpssi->AbortCpltCallback(hpssi); in PSSI_DMAAbort()
1699 hpssi->ErrorCallback(hpssi); in PSSI_DMAAbort()
1713 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl… in PSSI_WaitOnStatusUntilTimeout() argument
1715 while ((HAL_PSSI_GET_STATUS(hpssi, Flag) & Flag) == (uint32_t)Status) in PSSI_WaitOnStatusUntilTimeout()
1722 hpssi->ErrorCode |= HAL_PSSI_ERROR_TIMEOUT; in PSSI_WaitOnStatusUntilTimeout()
1723 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_WaitOnStatusUntilTimeout()
1726 __HAL_UNLOCK(hpssi); in PSSI_WaitOnStatusUntilTimeout()
1742 …PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); /* Deroga… in PSSI_DMAError() local
1748 HAL_PSSI_DISABLE(hpssi); in PSSI_DMAError()
1751 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAError()
1754 tmperror = hpssi->ErrorCode; in PSSI_DMAError()
1757 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAError()
1760 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAError()
1764 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAError()
1767 __HAL_UNLOCK(hpssi); in PSSI_DMAError()
1770 hpssi->ErrorCallback(hpssi); in PSSI_DMAError()