Lines Matching refs:hpssi
190 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode);
197 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl…
247 HAL_StatusTypeDef HAL_PSSI_Init(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Init() argument
250 if (hpssi == NULL) in HAL_PSSI_Init()
256 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_Init()
257 assert_param(IS_PSSI_CONTROL_SIGNAL(hpssi->Init.ControlSignal)); in HAL_PSSI_Init()
258 assert_param(IS_PSSI_BUSWIDTH(hpssi->Init.BusWidth)); in HAL_PSSI_Init()
259 assert_param(IS_PSSI_CLOCK_POLARITY(hpssi->Init.ClockPolarity)); in HAL_PSSI_Init()
260 assert_param(IS_PSSI_DE_POLARITY(hpssi->Init.DataEnablePolarity)); in HAL_PSSI_Init()
261 assert_param(IS_PSSI_RDY_POLARITY(hpssi->Init.ReadyPolarity)); in HAL_PSSI_Init()
263 if (hpssi->State == HAL_PSSI_STATE_RESET) in HAL_PSSI_Init()
266 hpssi->Lock = HAL_UNLOCKED; in HAL_PSSI_Init()
270 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_Init()
271 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_Init()
272 …hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_Init()
273 …hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_Init()
275 if (hpssi->MspInitCallback == NULL) in HAL_PSSI_Init()
277 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_Init()
281 hpssi->MspInitCallback(hpssi); in HAL_PSSI_Init()
284 HAL_PSSI_MspInit(hpssi); in HAL_PSSI_Init()
288 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Init()
291 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Init()
296 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DERDYCFG | PSSI_CR_EDM | PSSI_CR_DEPOL | PSSI_CR_RDYPOL, in HAL_PSSI_Init()
297 hpssi->Init.ControlSignal | hpssi->Init.DataEnablePolarity | in HAL_PSSI_Init()
298 hpssi->Init.ReadyPolarity | hpssi->Init.BusWidth); in HAL_PSSI_Init()
300 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Init()
301 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Init()
312 HAL_StatusTypeDef HAL_PSSI_DeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_DeInit() argument
315 if (hpssi == NULL) in HAL_PSSI_DeInit()
321 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_DeInit()
323 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_DeInit()
326 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_DeInit()
329 if (hpssi->MspDeInitCallback == NULL) in HAL_PSSI_DeInit()
331 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_DeInit()
335 hpssi->MspDeInitCallback(hpssi); in HAL_PSSI_DeInit()
338 HAL_PSSI_MspDeInit(hpssi); in HAL_PSSI_DeInit()
341 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_DeInit()
342 hpssi->State = HAL_PSSI_STATE_RESET; in HAL_PSSI_DeInit()
345 __HAL_UNLOCK(hpssi); in HAL_PSSI_DeInit()
356 __weak void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspInit() argument
359 UNUSED(hpssi); in HAL_PSSI_MspInit()
372 __weak void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspDeInit() argument
375 UNUSED(hpssi); in HAL_PSSI_MspDeInit()
402 HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef C… in HAL_PSSI_RegisterCallback() argument
410 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
415 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_RegisterCallback()
420 hpssi->TxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
424 hpssi->RxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
428 hpssi->ErrorCallback = pCallback; in HAL_PSSI_RegisterCallback()
432 hpssi->AbortCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
436 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
440 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
445 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
452 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_RegisterCallback()
457 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
461 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
466 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
476 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
503 HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef… in HAL_PSSI_UnRegisterCallback() argument
507 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_UnRegisterCallback()
512 … hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
516 … hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
520 … hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_UnRegisterCallback()
524 … hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_UnRegisterCallback()
528 … hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
532 … hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
537 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
544 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_UnRegisterCallback()
549 … hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
553 … hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
558 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
568 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
630 HAL_StatusTypeDef HAL_PSSI_Transmit(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint3… in HAL_PSSI_Transmit() argument
635 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || in HAL_PSSI_Transmit()
636 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size % 2U) != 0U)) || in HAL_PSSI_Transmit()
637 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size % 4U) != 0U))) in HAL_PSSI_Transmit()
639 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
642 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit()
645 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit()
647 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Transmit()
648 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit()
651 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
654 hpssi->Instance->CR |= PSSI_CR_OUTEN_OUTPUT | in HAL_PSSI_Transmit()
655 … ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL); in HAL_PSSI_Transmit()
659 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Transmit()
663 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit()
665 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Transmit()
673 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
675 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
676 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
678 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
682 *(__IO uint8_t *)(&hpssi->Instance->DR) = *(uint8_t *)pbuffer; in HAL_PSSI_Transmit()
690 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Transmit()
693 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Transmit()
700 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
702 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
703 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
705 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
716 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Transmit()
724 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
726 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
727 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
729 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
733 *(__IO uint32_t *)(&hpssi->Instance->DR) = *pbuffer; in HAL_PSSI_Transmit()
742 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
743 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
745 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
750 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Transmit()
752 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit()
753 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
754 hpssi->ErrorCode = HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_Transmit()
755 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
757 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
761 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
764 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
783 HAL_StatusTypeDef HAL_PSSI_Receive(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32… in HAL_PSSI_Receive() argument
788 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || in HAL_PSSI_Receive()
789 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size % 2U) != 0U)) || in HAL_PSSI_Receive()
790 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size % 4U) != 0U))) in HAL_PSSI_Receive()
792 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Receive()
796 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive()
799 __HAL_LOCK(hpssi); in HAL_PSSI_Receive()
801 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Receive()
802 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive()
805 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive()
807 hpssi->Instance->CR |= PSSI_CR_OUTEN_INPUT | in HAL_PSSI_Receive()
808 … ((hpssi->Init.ClockPolarity == HAL_PSSI_FALLING_EDGE) ? 0U : PSSI_CR_CKPOL); in HAL_PSSI_Receive()
812 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Receive()
816 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive()
817 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Receive()
826 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
828 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
829 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
831 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
835 *pbuffer = *(__IO uint8_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
840 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Receive()
843 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
850 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
852 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
853 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
855 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
865 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Receive()
874 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
876 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
877 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
879 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
884 *pbuffer = *(__IO uint32_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
891 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Receive()
892 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
894 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
899 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Receive()
901 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive()
902 hpssi->ErrorCode = HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_Receive()
903 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
907 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
910 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
929 HAL_StatusTypeDef HAL_PSSI_Transmit_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Transmit_DMA() argument
933 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit_DMA()
937 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit_DMA()
939 hpssi->State = HAL_PSSI_STATE_BUSY_TX; in HAL_PSSI_Transmit_DMA()
940 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit_DMA()
943 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit_DMA()
946 hpssi->pBuffPtr = pData; in HAL_PSSI_Transmit_DMA()
947 hpssi->XferCount = Size; in HAL_PSSI_Transmit_DMA()
949 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Transmit_DMA()
951 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Transmit_DMA()
955 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Transmit_DMA()
958 if (hpssi->XferSize > 0U) in HAL_PSSI_Transmit_DMA()
960 if (hpssi->hdmatx != NULL) in HAL_PSSI_Transmit_DMA()
964 if (hpssi->hdmatx->Init.DestDataWidth == DMA_DEST_DATAWIDTH_BYTE) in HAL_PSSI_Transmit_DMA()
966 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Transmit_DMA()
968 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
972 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Transmit_DMA()
973 PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | PSSI_CR_OUTEN_OUTPUT | in HAL_PSSI_Transmit_DMA()
974 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
978 hpssi->hdmatx->XferCpltCallback = PSSI_DMATransmitCplt; in HAL_PSSI_Transmit_DMA()
981 hpssi->hdmatx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Transmit_DMA()
984 hpssi->hdmatx->XferHalfCpltCallback = NULL; in HAL_PSSI_Transmit_DMA()
985 hpssi->hdmatx->XferAbortCallback = NULL; in HAL_PSSI_Transmit_DMA()
988 if ((hpssi->hdmatx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) in HAL_PSSI_Transmit_DMA()
990 if (hpssi->hdmatx->LinkedListQueue != NULL) in HAL_PSSI_Transmit_DMA()
994 … hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
996 … hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CSAR_DEFAULT_OFFSET] = (uint32_t)pData; in HAL_PSSI_Transmit_DMA()
998 hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CDAR_DEFAULT_OFFSET] = in HAL_PSSI_Transmit_DMA()
999 (uint32_t)&hpssi->Instance->DR; in HAL_PSSI_Transmit_DMA()
1001 dmaxferstatus = HAL_DMAEx_List_Start_IT(hpssi->hdmatx); in HAL_PSSI_Transmit_DMA()
1011 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmatx, (uint32_t)pData, (uint32_t)&hpssi->Instance->DR, in HAL_PSSI_Transmit_DMA()
1012 hpssi->XferSize); in HAL_PSSI_Transmit_DMA()
1018 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1021 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1024 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1032 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
1035 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1041 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1044 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Transmit_DMA()
1046 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit_DMA()
1051 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1054 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1057 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1065 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1073 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1091 HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Receive_DMA() argument
1096 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive_DMA()
1100 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive_DMA()
1102 __HAL_LOCK(hpssi); in HAL_PSSI_Receive_DMA()
1104 hpssi->State = HAL_PSSI_STATE_BUSY_RX; in HAL_PSSI_Receive_DMA()
1105 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive_DMA()
1108 hpssi->pBuffPtr = pData; in HAL_PSSI_Receive_DMA()
1109 hpssi->XferCount = Size; in HAL_PSSI_Receive_DMA()
1111 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Receive_DMA()
1113 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Receive_DMA()
1117 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Receive_DMA()
1120 if (hpssi->XferSize > 0U) in HAL_PSSI_Receive_DMA()
1122 if (hpssi->hdmarx != NULL) in HAL_PSSI_Receive_DMA()
1125 if (hpssi->hdmatx->Init.SrcDataWidth == DMA_SRC_DATAWIDTH_BYTE) in HAL_PSSI_Receive_DMA()
1127 …MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, PSSI_CR_DMA_ENABLE | in HAL_PSSI_Receive_DMA()
1128 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1132 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Receive_DMA()
1133 PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | in HAL_PSSI_Receive_DMA()
1134 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1138 hpssi->hdmarx->XferCpltCallback = PSSI_DMAReceiveCplt; in HAL_PSSI_Receive_DMA()
1141 hpssi->hdmarx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Receive_DMA()
1144 hpssi->hdmarx->XferHalfCpltCallback = NULL; in HAL_PSSI_Receive_DMA()
1145 hpssi->hdmarx->XferAbortCallback = NULL; in HAL_PSSI_Receive_DMA()
1148 if ((hpssi->hdmarx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) in HAL_PSSI_Receive_DMA()
1150 if (hpssi->hdmarx->LinkedListQueue != NULL) in HAL_PSSI_Receive_DMA()
1154 … hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1156 hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CSAR_DEFAULT_OFFSET] = in HAL_PSSI_Receive_DMA()
1157 (uint32_t)&hpssi->Instance->DR; in HAL_PSSI_Receive_DMA()
1159 … hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CDAR_DEFAULT_OFFSET] = (uint32_t)pData; in HAL_PSSI_Receive_DMA()
1161 dmaxferstatus = HAL_DMAEx_List_Start_IT(hpssi->hdmarx); in HAL_PSSI_Receive_DMA()
1171 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmarx, (uint32_t)&hpssi->Instance->DR, (uint32_t)pData, in HAL_PSSI_Receive_DMA()
1172 hpssi->XferSize); in HAL_PSSI_Receive_DMA()
1178 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1181 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1184 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1192 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1195 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1201 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1204 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Receive_DMA()
1206 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive_DMA()
1211 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1214 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1217 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1225 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1228 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1245 HAL_StatusTypeDef HAL_PSSI_Abort_DMA(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Abort_DMA() argument
1248 __HAL_LOCK(hpssi); in HAL_PSSI_Abort_DMA()
1251 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1254 hpssi->State = HAL_PSSI_STATE_ABORT; in HAL_PSSI_Abort_DMA()
1257 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_Abort_DMA()
1259 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_Abort_DMA()
1261 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1263 if (hpssi->hdmatx != NULL) in HAL_PSSI_Abort_DMA()
1267 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1270 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1273 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_Abort_DMA()
1278 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_Abort_DMA()
1280 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1282 if (hpssi->hdmarx != NULL) in HAL_PSSI_Abort_DMA()
1286 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1289 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1292 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_Abort_DMA()
1301 hpssi->ErrorCallback(hpssi); in HAL_PSSI_Abort_DMA()
1303 HAL_PSSI_ErrorCallback(hpssi); in HAL_PSSI_Abort_DMA()
1309 __HAL_UNLOCK(hpssi); in HAL_PSSI_Abort_DMA()
1314 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1334 void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_IRQHandler() argument
1337 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_MIS) != 0U) in HAL_PSSI_IRQHandler()
1340 hpssi->XferCount = 0U; in HAL_PSSI_IRQHandler()
1343 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_IRQHandler()
1347 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_IRQHandler()
1349 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_IRQHandler()
1352 hpssi->ErrorCode |= HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_IRQHandler()
1354 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1356 if (hpssi->hdmatx != NULL) in HAL_PSSI_IRQHandler()
1360 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1363 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1366 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_IRQHandler()
1369 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_IRQHandler()
1374 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_IRQHandler()
1377 hpssi->ErrorCode |= HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_IRQHandler()
1379 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1381 if (hpssi->hdmarx != NULL) in HAL_PSSI_IRQHandler()
1385 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1388 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1391 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_IRQHandler()
1394 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_IRQHandler()
1402 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1404 HAL_PSSI_ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1411 if (hpssi->State == HAL_PSSI_STATE_ABORT) in HAL_PSSI_IRQHandler()
1413 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1416 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1420 hpssi->AbortCpltCallback(hpssi); in HAL_PSSI_IRQHandler()
1422 HAL_PSSI_AbortCpltCallback(hpssi); in HAL_PSSI_IRQHandler()
1428 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1430 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1434 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1436 HAL_PSSI_ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1448 __weak void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_TxCpltCallback() argument
1451 UNUSED(hpssi); in HAL_PSSI_TxCpltCallback()
1464 __weak void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_RxCpltCallback() argument
1467 UNUSED(hpssi); in HAL_PSSI_RxCpltCallback()
1480 __weak void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_ErrorCallback() argument
1483 UNUSED(hpssi); in HAL_PSSI_ErrorCallback()
1496 __weak void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_AbortCpltCallback() argument
1499 UNUSED(hpssi); in HAL_PSSI_AbortCpltCallback()
1531 HAL_PSSI_StateTypeDef HAL_PSSI_GetState(const PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetState() argument
1534 return hpssi->State; in HAL_PSSI_GetState()
1543 uint32_t HAL_PSSI_GetError(const PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetError() argument
1545 return hpssi->ErrorCode; in HAL_PSSI_GetError()
1566 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode) in PSSI_Error() argument
1569 hpssi->XferCount = 0U; in PSSI_Error()
1572 hpssi->ErrorCode |= ErrorCode; in PSSI_Error()
1575 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_Error()
1579 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in PSSI_Error()
1581 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in PSSI_Error()
1583 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1585 if (hpssi->hdmatx != NULL) in PSSI_Error()
1589 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1592 __HAL_UNLOCK(hpssi); in PSSI_Error()
1595 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in PSSI_Error()
1598 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in PSSI_Error()
1603 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in PSSI_Error()
1605 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1607 if (hpssi->hdmarx != NULL) in PSSI_Error()
1611 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1614 __HAL_UNLOCK(hpssi); in PSSI_Error()
1617 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in PSSI_Error()
1620 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in PSSI_Error()
1632 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_Error()
1634 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1637 __HAL_UNLOCK(hpssi); in PSSI_Error()
1641 hpssi->AbortCpltCallback(hpssi); in PSSI_Error()
1643 HAL_PSSI_AbortCpltCallback(hpssi); in PSSI_Error()
1649 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1652 __HAL_UNLOCK(hpssi); in PSSI_Error()
1656 hpssi->ErrorCallback(hpssi); in PSSI_Error()
1658 HAL_PSSI_ErrorCallback(hpssi); in PSSI_Error()
1672 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMATransmitCplt() local
1677 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMATransmitCplt()
1680 tmperror = hpssi->ErrorCode; in PSSI_DMATransmitCplt()
1683 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMATransmitCplt()
1686 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMATransmitCplt()
1691 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMATransmitCplt()
1694 __HAL_UNLOCK(hpssi); in PSSI_DMATransmitCplt()
1698 hpssi->TxCpltCallback(hpssi); in PSSI_DMATransmitCplt()
1700 HAL_PSSI_TxCpltCallback(hpssi); in PSSI_DMATransmitCplt()
1713 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAReceiveCplt() local
1718 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAReceiveCplt()
1721 tmperror = hpssi->ErrorCode; in PSSI_DMAReceiveCplt()
1724 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAReceiveCplt()
1727 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAReceiveCplt()
1732 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAReceiveCplt()
1735 __HAL_UNLOCK(hpssi); in PSSI_DMAReceiveCplt()
1739 hpssi->RxCpltCallback(hpssi); in PSSI_DMAReceiveCplt()
1741 HAL_PSSI_RxCpltCallback(hpssi); in PSSI_DMAReceiveCplt()
1755 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAAbort() local
1758 hpssi->hdmatx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1759 hpssi->hdmarx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1762 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_DMAAbort()
1764 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAAbort()
1768 hpssi->AbortCpltCallback(hpssi); in PSSI_DMAAbort()
1770 HAL_PSSI_AbortCpltCallback(hpssi); in PSSI_DMAAbort()
1777 hpssi->ErrorCallback(hpssi); in PSSI_DMAAbort()
1779 HAL_PSSI_ErrorCallback(hpssi); in PSSI_DMAAbort()
1795 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl… in PSSI_WaitOnStatusUntilTimeout() argument
1798 while ((HAL_PSSI_GET_STATUS(hpssi, Flag) & Flag) == (uint32_t)Status) in PSSI_WaitOnStatusUntilTimeout()
1805 hpssi->ErrorCode |= HAL_PSSI_ERROR_TIMEOUT; in PSSI_WaitOnStatusUntilTimeout()
1806 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_WaitOnStatusUntilTimeout()
1809 __HAL_UNLOCK(hpssi); in PSSI_WaitOnStatusUntilTimeout()
1822 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAError() local
1827 HAL_PSSI_DISABLE(hpssi); in PSSI_DMAError()
1830 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAError()
1833 tmperror = hpssi->ErrorCode; in PSSI_DMAError()
1836 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAError()
1839 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAError()
1843 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAError()
1846 __HAL_UNLOCK(hpssi); in PSSI_DMAError()
1850 hpssi->ErrorCallback(hpssi); in PSSI_DMAError()
1852 HAL_PSSI_ErrorCallback(hpssi); in PSSI_DMAError()