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()
269 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_Init()
270 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_Init()
271 …hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_Init()
272 …hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_Init()
274 if (hpssi->MspInitCallback == NULL) in HAL_PSSI_Init()
276 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_Init()
280 hpssi->MspInitCallback(hpssi); in HAL_PSSI_Init()
284 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Init()
287 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Init()
292 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DERDYCFG | PSSI_CR_EDM | PSSI_CR_DEPOL | PSSI_CR_RDYPOL, in HAL_PSSI_Init()
293 hpssi->Init.ControlSignal | hpssi->Init.DataEnablePolarity | in HAL_PSSI_Init()
294 hpssi->Init.ReadyPolarity | hpssi->Init.BusWidth); in HAL_PSSI_Init()
296 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Init()
297 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Init()
308 HAL_StatusTypeDef HAL_PSSI_DeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_DeInit() argument
311 if (hpssi == NULL) in HAL_PSSI_DeInit()
317 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_DeInit()
319 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_DeInit()
322 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_DeInit()
324 if (hpssi->MspDeInitCallback == NULL) in HAL_PSSI_DeInit()
326 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_DeInit()
330 hpssi->MspDeInitCallback(hpssi); in HAL_PSSI_DeInit()
332 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_DeInit()
333 hpssi->State = HAL_PSSI_STATE_RESET; in HAL_PSSI_DeInit()
336 __HAL_UNLOCK(hpssi); in HAL_PSSI_DeInit()
347 __weak void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspInit() argument
350 UNUSED(hpssi); in HAL_PSSI_MspInit()
363 __weak void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspDeInit() argument
366 UNUSED(hpssi); in HAL_PSSI_MspDeInit()
392 HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef C… in HAL_PSSI_RegisterCallback() argument
400 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
405 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_RegisterCallback()
410 hpssi->TxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
414 hpssi->RxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
418 hpssi->ErrorCallback = pCallback; in HAL_PSSI_RegisterCallback()
422 hpssi->AbortCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
426 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
430 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
435 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
442 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_RegisterCallback()
447 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
451 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
456 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
466 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
493 HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef… in HAL_PSSI_UnRegisterCallback() argument
497 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_UnRegisterCallback()
502 … hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
506 … hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
510 … hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_UnRegisterCallback()
514 … hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_UnRegisterCallback()
518 … hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
522 … hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
527 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
534 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_UnRegisterCallback()
539 … hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
543 … hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
548 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
558 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
618 HAL_StatusTypeDef HAL_PSSI_Transmit(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint3… in HAL_PSSI_Transmit() argument
623 if (((hpssi->Init.DataWidth == HAL_PSSI_8BITS) && (hpssi->Init.BusWidth != HAL_PSSI_8LINES)) || in HAL_PSSI_Transmit()
624 ((hpssi->Init.DataWidth == HAL_PSSI_16BITS) && ((Size % 2U) != 0U)) || in HAL_PSSI_Transmit()
625 ((hpssi->Init.DataWidth == HAL_PSSI_32BITS) && ((Size % 4U) != 0U))) in HAL_PSSI_Transmit()
627 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
630 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit()
633 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit()
635 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Transmit()
636 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit()
639 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
642 hpssi->Instance->CR |= PSSI_CR_OUTEN_OUTPUT | in HAL_PSSI_Transmit()
643 … ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL); in HAL_PSSI_Transmit()
647 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Transmit()
651 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit()
653 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Transmit()
661 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
663 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
664 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
666 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
670 *(__IO uint8_t *)(&hpssi->Instance->DR) = *(uint8_t *)pbuffer; in HAL_PSSI_Transmit()
678 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Transmit()
681 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Transmit()
688 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
690 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
691 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
693 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
704 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Transmit()
712 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
714 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
715 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
717 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
721 *(__IO uint32_t *)(&hpssi->Instance->DR) = *pbuffer; in HAL_PSSI_Transmit()
730 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Transmit()
731 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
733 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
738 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Transmit()
740 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit()
741 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit()
742 hpssi->ErrorCode = HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_Transmit()
743 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
745 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
749 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
752 __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 | in HAL_PSSI_Receive()
796 … ((hpssi->Init.ClockPolarity == HAL_PSSI_FALLING_EDGE) ? 0U : PSSI_CR_CKPOL); in HAL_PSSI_Receive()
800 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Receive()
804 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive()
805 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Receive()
814 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
816 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
817 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
819 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
823 *pbuffer = *(__IO uint8_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
828 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Receive()
831 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
838 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
840 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
841 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
843 __HAL_UNLOCK(hpssi); 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 *pbuffer = *(__IO uint32_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
879 hpssi->ErrorCode = HAL_PSSI_ERROR_NOT_SUPPORTED; in HAL_PSSI_Receive()
880 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
882 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
887 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_RIS) != 0U) in HAL_PSSI_Receive()
889 HAL_PSSI_CLEAR_FLAG(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive()
890 hpssi->ErrorCode = HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_Receive()
891 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
895 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
898 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
917 HAL_StatusTypeDef HAL_PSSI_Transmit_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Transmit_DMA() argument
921 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Transmit_DMA()
925 __HAL_LOCK(hpssi); in HAL_PSSI_Transmit_DMA()
927 hpssi->State = HAL_PSSI_STATE_BUSY_TX; in HAL_PSSI_Transmit_DMA()
928 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Transmit_DMA()
931 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Transmit_DMA()
934 hpssi->pBuffPtr = pData; in HAL_PSSI_Transmit_DMA()
935 hpssi->XferCount = Size; in HAL_PSSI_Transmit_DMA()
937 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Transmit_DMA()
939 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Transmit_DMA()
943 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Transmit_DMA()
946 if (hpssi->XferSize > 0U) in HAL_PSSI_Transmit_DMA()
948 if (hpssi->hdmatx != NULL) in HAL_PSSI_Transmit_DMA()
952 if (hpssi->hdmatx->Init.DestDataWidth == DMA_DEST_DATAWIDTH_BYTE) in HAL_PSSI_Transmit_DMA()
954 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Transmit_DMA()
956 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
960 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Transmit_DMA()
961 PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | PSSI_CR_OUTEN_OUTPUT | in HAL_PSSI_Transmit_DMA()
962 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? 0U : PSSI_CR_CKPOL)); in HAL_PSSI_Transmit_DMA()
966 hpssi->hdmatx->XferCpltCallback = PSSI_DMATransmitCplt; in HAL_PSSI_Transmit_DMA()
969 hpssi->hdmatx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Transmit_DMA()
972 hpssi->hdmatx->XferHalfCpltCallback = NULL; in HAL_PSSI_Transmit_DMA()
973 hpssi->hdmatx->XferAbortCallback = NULL; in HAL_PSSI_Transmit_DMA()
976 if ((hpssi->hdmatx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) in HAL_PSSI_Transmit_DMA()
978 if (hpssi->hdmatx->LinkedListQueue != NULL) in HAL_PSSI_Transmit_DMA()
982 … hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
984 … hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CSAR_DEFAULT_OFFSET] = (uint32_t)pData; in HAL_PSSI_Transmit_DMA()
986 hpssi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CDAR_DEFAULT_OFFSET] = in HAL_PSSI_Transmit_DMA()
987 (uint32_t)&hpssi->Instance->DR; in HAL_PSSI_Transmit_DMA()
989 dmaxferstatus = HAL_DMAEx_List_Start_IT(hpssi->hdmatx); in HAL_PSSI_Transmit_DMA()
999 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmatx, (uint32_t)pData, (uint32_t)&hpssi->Instance->DR, in HAL_PSSI_Transmit_DMA()
1000 hpssi->XferSize); in HAL_PSSI_Transmit_DMA()
1006 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1009 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1012 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1020 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
1023 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1029 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1032 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Transmit_DMA()
1034 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit_DMA()
1039 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1042 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1045 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1053 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1061 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1079 HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Receive_DMA() argument
1084 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive_DMA()
1088 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive_DMA()
1090 __HAL_LOCK(hpssi); in HAL_PSSI_Receive_DMA()
1092 hpssi->State = HAL_PSSI_STATE_BUSY_RX; in HAL_PSSI_Receive_DMA()
1093 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive_DMA()
1096 hpssi->pBuffPtr = pData; in HAL_PSSI_Receive_DMA()
1097 hpssi->XferCount = Size; in HAL_PSSI_Receive_DMA()
1099 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Receive_DMA()
1101 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Receive_DMA()
1105 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Receive_DMA()
1108 if (hpssi->XferSize > 0U) in HAL_PSSI_Receive_DMA()
1110 if (hpssi->hdmarx != NULL) in HAL_PSSI_Receive_DMA()
1113 if (hpssi->hdmatx->Init.SrcDataWidth == DMA_SRC_DATAWIDTH_BYTE) in HAL_PSSI_Receive_DMA()
1115 …MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, PSSI_CR_DMA_ENABLE | in HAL_PSSI_Receive_DMA()
1116 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1120 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Receive_DMA()
1121 PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | in HAL_PSSI_Receive_DMA()
1122 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1126 hpssi->hdmarx->XferCpltCallback = PSSI_DMAReceiveCplt; in HAL_PSSI_Receive_DMA()
1129 hpssi->hdmarx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Receive_DMA()
1132 hpssi->hdmarx->XferHalfCpltCallback = NULL; in HAL_PSSI_Receive_DMA()
1133 hpssi->hdmarx->XferAbortCallback = NULL; in HAL_PSSI_Receive_DMA()
1136 if ((hpssi->hdmarx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) in HAL_PSSI_Receive_DMA()
1138 if (hpssi->hdmarx->LinkedListQueue != NULL) in HAL_PSSI_Receive_DMA()
1142 … hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1144 hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CSAR_DEFAULT_OFFSET] = in HAL_PSSI_Receive_DMA()
1145 (uint32_t)&hpssi->Instance->DR; in HAL_PSSI_Receive_DMA()
1147 … hpssi->hdmarx->LinkedListQueue->Head->LinkRegisters[NODE_CDAR_DEFAULT_OFFSET] = (uint32_t)pData; in HAL_PSSI_Receive_DMA()
1149 dmaxferstatus = HAL_DMAEx_List_Start_IT(hpssi->hdmarx); in HAL_PSSI_Receive_DMA()
1159 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmarx, (uint32_t)&hpssi->Instance->DR, (uint32_t)pData, in HAL_PSSI_Receive_DMA()
1160 hpssi->XferSize); in HAL_PSSI_Receive_DMA()
1166 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1169 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1172 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1180 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1183 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1189 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1192 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Receive_DMA()
1194 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive_DMA()
1199 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1202 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1205 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1213 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1216 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1233 HAL_StatusTypeDef HAL_PSSI_Abort_DMA(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Abort_DMA() argument
1236 __HAL_LOCK(hpssi); in HAL_PSSI_Abort_DMA()
1239 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1242 hpssi->State = HAL_PSSI_STATE_ABORT; in HAL_PSSI_Abort_DMA()
1245 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_Abort_DMA()
1247 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_Abort_DMA()
1249 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1251 if (hpssi->hdmatx != NULL) in HAL_PSSI_Abort_DMA()
1255 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1258 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1261 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_Abort_DMA()
1266 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_Abort_DMA()
1268 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1270 if (hpssi->hdmarx != NULL) in HAL_PSSI_Abort_DMA()
1274 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1277 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1280 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_Abort_DMA()
1287 hpssi->ErrorCallback(hpssi); in HAL_PSSI_Abort_DMA()
1292 __HAL_UNLOCK(hpssi); in HAL_PSSI_Abort_DMA()
1297 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1317 void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_IRQHandler() argument
1320 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_MIS) != 0U) in HAL_PSSI_IRQHandler()
1323 hpssi->XferCount = 0U; in HAL_PSSI_IRQHandler()
1326 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_IRQHandler()
1330 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_IRQHandler()
1332 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_IRQHandler()
1335 hpssi->ErrorCode |= HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_IRQHandler()
1337 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1339 if (hpssi->hdmatx != NULL) in HAL_PSSI_IRQHandler()
1343 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1346 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1349 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_IRQHandler()
1352 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_IRQHandler()
1357 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_IRQHandler()
1360 hpssi->ErrorCode |= HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_IRQHandler()
1362 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1364 if (hpssi->hdmarx != NULL) in HAL_PSSI_IRQHandler()
1368 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1371 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1374 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_IRQHandler()
1377 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_IRQHandler()
1384 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1390 if (hpssi->State == HAL_PSSI_STATE_ABORT) in HAL_PSSI_IRQHandler()
1392 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1395 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1398 hpssi->AbortCpltCallback(hpssi); in HAL_PSSI_IRQHandler()
1403 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1405 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1408 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1419 __weak void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_TxCpltCallback() argument
1422 UNUSED(hpssi); in HAL_PSSI_TxCpltCallback()
1435 __weak void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_RxCpltCallback() argument
1438 UNUSED(hpssi); in HAL_PSSI_RxCpltCallback()
1451 __weak void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_ErrorCallback() argument
1454 UNUSED(hpssi); in HAL_PSSI_ErrorCallback()
1467 __weak void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_AbortCpltCallback() argument
1470 UNUSED(hpssi); in HAL_PSSI_AbortCpltCallback()
1502 HAL_PSSI_StateTypeDef HAL_PSSI_GetState(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetState() argument
1505 return hpssi->State; in HAL_PSSI_GetState()
1514 uint32_t HAL_PSSI_GetError(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetError() argument
1516 return hpssi->ErrorCode; in HAL_PSSI_GetError()
1537 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode) in PSSI_Error() argument
1540 hpssi->XferCount = 0U; in PSSI_Error()
1543 hpssi->ErrorCode |= ErrorCode; in PSSI_Error()
1546 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_Error()
1550 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in PSSI_Error()
1552 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in PSSI_Error()
1554 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1556 if (hpssi->hdmatx != NULL) in PSSI_Error()
1560 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1563 __HAL_UNLOCK(hpssi); in PSSI_Error()
1566 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in PSSI_Error()
1569 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in PSSI_Error()
1574 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in PSSI_Error()
1576 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1578 if (hpssi->hdmarx != NULL) in PSSI_Error()
1582 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1585 __HAL_UNLOCK(hpssi); in PSSI_Error()
1588 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in PSSI_Error()
1591 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in PSSI_Error()
1603 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_Error()
1605 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1608 __HAL_UNLOCK(hpssi); in PSSI_Error()
1612 hpssi->AbortCpltCallback(hpssi); in PSSI_Error()
1617 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1620 __HAL_UNLOCK(hpssi); in PSSI_Error()
1623 hpssi->ErrorCallback(hpssi); in PSSI_Error()
1636 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMATransmitCplt() local
1641 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMATransmitCplt()
1644 tmperror = hpssi->ErrorCode; in PSSI_DMATransmitCplt()
1647 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMATransmitCplt()
1650 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMATransmitCplt()
1655 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMATransmitCplt()
1658 __HAL_UNLOCK(hpssi); in PSSI_DMATransmitCplt()
1662 hpssi->TxCpltCallback(hpssi); in PSSI_DMATransmitCplt()
1674 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAReceiveCplt() local
1679 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAReceiveCplt()
1682 tmperror = hpssi->ErrorCode; in PSSI_DMAReceiveCplt()
1685 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAReceiveCplt()
1688 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAReceiveCplt()
1693 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAReceiveCplt()
1696 __HAL_UNLOCK(hpssi); in PSSI_DMAReceiveCplt()
1699 hpssi->RxCpltCallback(hpssi); in PSSI_DMAReceiveCplt()
1712 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAAbort() local
1715 hpssi->hdmatx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1716 hpssi->hdmarx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1719 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_DMAAbort()
1721 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAAbort()
1725 hpssi->AbortCpltCallback(hpssi); in PSSI_DMAAbort()
1730 hpssi->ErrorCallback(hpssi); in PSSI_DMAAbort()
1745 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl… in PSSI_WaitOnStatusUntilTimeout() argument
1748 while ((HAL_PSSI_GET_STATUS(hpssi, Flag) & Flag) == (uint32_t)Status) in PSSI_WaitOnStatusUntilTimeout()
1755 hpssi->ErrorCode |= HAL_PSSI_ERROR_TIMEOUT; in PSSI_WaitOnStatusUntilTimeout()
1756 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_WaitOnStatusUntilTimeout()
1759 __HAL_UNLOCK(hpssi); in PSSI_WaitOnStatusUntilTimeout()
1772 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAError() local
1777 HAL_PSSI_DISABLE(hpssi); in PSSI_DMAError()
1780 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAError()
1783 tmperror = hpssi->ErrorCode; in PSSI_DMAError()
1786 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAError()
1789 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAError()
1793 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAError()
1796 __HAL_UNLOCK(hpssi); in PSSI_DMAError()
1799 hpssi->ErrorCallback(hpssi); in PSSI_DMAError()