Lines Matching refs:hpssi

189 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode);
196 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl…
246 HAL_StatusTypeDef HAL_PSSI_Init(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Init() argument
249 if (hpssi == NULL) in HAL_PSSI_Init()
255 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_Init()
256 assert_param(IS_PSSI_CONTROL_SIGNAL(hpssi->Init.ControlSignal)); in HAL_PSSI_Init()
257 assert_param(IS_PSSI_BUSWIDTH(hpssi->Init.BusWidth)); in HAL_PSSI_Init()
258 assert_param(IS_PSSI_CLOCK_POLARITY(hpssi->Init.ClockPolarity)); in HAL_PSSI_Init()
259 assert_param(IS_PSSI_DE_POLARITY(hpssi->Init.DataEnablePolarity)); in HAL_PSSI_Init()
260 assert_param(IS_PSSI_RDY_POLARITY(hpssi->Init.ReadyPolarity)); in HAL_PSSI_Init()
262 if (hpssi->State == HAL_PSSI_STATE_RESET) in HAL_PSSI_Init()
265 hpssi->Lock = HAL_UNLOCKED; in HAL_PSSI_Init()
268 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_Init()
269 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_Init()
270hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_Init()
271hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_Init()
273 if (hpssi->MspInitCallback == NULL) in HAL_PSSI_Init()
275 hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_Init()
279 hpssi->MspInitCallback(hpssi); in HAL_PSSI_Init()
283 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_Init()
286 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Init()
291 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DERDYCFG | PSSI_CR_EDM | PSSI_CR_DEPOL | PSSI_CR_RDYPOL, in HAL_PSSI_Init()
292 hpssi->Init.ControlSignal | hpssi->Init.DataEnablePolarity | in HAL_PSSI_Init()
293 hpssi->Init.ReadyPolarity | hpssi->Init.BusWidth); in HAL_PSSI_Init()
295 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Init()
296 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Init()
307 HAL_StatusTypeDef HAL_PSSI_DeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_DeInit() argument
310 if (hpssi == NULL) in HAL_PSSI_DeInit()
316 assert_param(IS_PSSI_ALL_INSTANCE(hpssi->Instance)); in HAL_PSSI_DeInit()
318 hpssi->State = HAL_PSSI_STATE_BUSY; in HAL_PSSI_DeInit()
321 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_DeInit()
323 if (hpssi->MspDeInitCallback == NULL) in HAL_PSSI_DeInit()
325 hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_DeInit()
329 hpssi->MspDeInitCallback(hpssi); in HAL_PSSI_DeInit()
331 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_DeInit()
332 hpssi->State = HAL_PSSI_STATE_RESET; in HAL_PSSI_DeInit()
335 __HAL_UNLOCK(hpssi); in HAL_PSSI_DeInit()
346 __weak void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspInit() argument
349 UNUSED(hpssi); in HAL_PSSI_MspInit()
362 __weak void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_MspDeInit() argument
365 UNUSED(hpssi); in HAL_PSSI_MspDeInit()
391 HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef C… in HAL_PSSI_RegisterCallback() argument
399 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
404 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_RegisterCallback()
409 hpssi->TxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
413 hpssi->RxCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
417 hpssi->ErrorCallback = pCallback; in HAL_PSSI_RegisterCallback()
421 hpssi->AbortCpltCallback = pCallback; in HAL_PSSI_RegisterCallback()
425 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
429 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
434 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
441 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_RegisterCallback()
446 hpssi->MspInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
450 hpssi->MspDeInitCallback = pCallback; in HAL_PSSI_RegisterCallback()
455 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
465 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_RegisterCallback()
492 HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef… in HAL_PSSI_UnRegisterCallback() argument
496 if (HAL_PSSI_STATE_READY == hpssi->State) in HAL_PSSI_UnRegisterCallback()
501 hpssi->TxCpltCallback = HAL_PSSI_TxCpltCallback; /* Legacy weak TxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
505 hpssi->RxCpltCallback = HAL_PSSI_RxCpltCallback; /* Legacy weak RxCpltCallback */ in HAL_PSSI_UnRegisterCallback()
509hpssi->ErrorCallback = HAL_PSSI_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_PSSI_UnRegisterCallback()
513hpssi->AbortCpltCallback = HAL_PSSI_AbortCpltCallback; /* Legacy weak AbortCpltCallback */ in HAL_PSSI_UnRegisterCallback()
517hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
521hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
526 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
533 else if (HAL_PSSI_STATE_RESET == hpssi->State) in HAL_PSSI_UnRegisterCallback()
538hpssi->MspInitCallback = HAL_PSSI_MspInit; /* Legacy weak MspInit */ in HAL_PSSI_UnRegisterCallback()
542hpssi->MspDeInitCallback = HAL_PSSI_MspDeInit; /* Legacy weak MspDeInit */ in HAL_PSSI_UnRegisterCallback()
547 hpssi->ErrorCode |= HAL_PSSI_ERROR_INVALID_CALLBACK; in HAL_PSSI_UnRegisterCallback()
557 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()
645 hpssi->Instance->CR &= PSSI_CR_DMA_DISABLE; in HAL_PSSI_Transmit()
648 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit()
650 if (hpssi->Init.DataWidth == HAL_PSSI_8BITS) in HAL_PSSI_Transmit()
658 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT1B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
660 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
661 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
663 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
667 *(__IO uint8_t *)(&hpssi->Instance->DR) = *(uint8_t *)pbuffer; in HAL_PSSI_Transmit()
675 else if (hpssi->Init.DataWidth == HAL_PSSI_16BITS) in HAL_PSSI_Transmit()
678 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Transmit()
685 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
687 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
688 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
690 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
702 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Transmit()
710 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Transmit()
712 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Transmit()
713 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit()
715 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit()
719 *(__IO uint32_t *)(&hpssi->Instance->DR) = *pbuffer; 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 | in HAL_PSSI_Receive()
796 … ((hpssi->Init.ClockPolarity == HAL_PSSI_FALLING_EDGE) ? 0U : PSSI_CR_CKPOL); 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()
829 __IO uint16_t *dr = (__IO uint16_t *)(&hpssi->Instance->DR); in HAL_PSSI_Receive()
836 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
838 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
839 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
841 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
852 else if (hpssi->Init.DataWidth == HAL_PSSI_32BITS) in HAL_PSSI_Receive()
861 … if (PSSI_WaitOnStatusUntilTimeout(hpssi, PSSI_FLAG_RTT4B, RESET, Timeout, tickstart) != HAL_OK) in HAL_PSSI_Receive()
863 hpssi->ErrorCode = HAL_PSSI_ERROR_TIMEOUT; in HAL_PSSI_Receive()
864 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
866 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive()
871 *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()
896 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive()
899 __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.PeriphDataAlignment == DMA_PDATAALIGN_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 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmatx, (uint32_t)pData, (uint32_t)&hpssi->Instance->DR, in HAL_PSSI_Transmit_DMA()
977 hpssi->XferSize); in HAL_PSSI_Transmit_DMA()
982 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
985 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
988 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
998 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Transmit_DMA()
1001 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1007 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1010 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Transmit_DMA()
1012 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Transmit_DMA()
1017 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Transmit_DMA()
1020 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Transmit_DMA()
1023 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1031 __HAL_UNLOCK(hpssi); in HAL_PSSI_Transmit_DMA()
1039 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Transmit_DMA()
1058 HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size) in HAL_PSSI_Receive_DMA() argument
1063 if (hpssi->State == HAL_PSSI_STATE_READY) in HAL_PSSI_Receive_DMA()
1067 HAL_PSSI_DISABLE(hpssi); in HAL_PSSI_Receive_DMA()
1069 __HAL_LOCK(hpssi); in HAL_PSSI_Receive_DMA()
1071 hpssi->State = HAL_PSSI_STATE_BUSY_RX; in HAL_PSSI_Receive_DMA()
1072 hpssi->ErrorCode = HAL_PSSI_ERROR_NONE; in HAL_PSSI_Receive_DMA()
1075 hpssi->pBuffPtr = pData; in HAL_PSSI_Receive_DMA()
1076 hpssi->XferCount = Size; in HAL_PSSI_Receive_DMA()
1078 if (hpssi->XferCount > PSSI_MAX_NBYTE_SIZE) in HAL_PSSI_Receive_DMA()
1080 hpssi->XferSize = PSSI_MAX_NBYTE_SIZE; in HAL_PSSI_Receive_DMA()
1084 hpssi->XferSize = hpssi->XferCount; in HAL_PSSI_Receive_DMA()
1087 if (hpssi->XferSize > 0U) in HAL_PSSI_Receive_DMA()
1089 if (hpssi->hdmarx != NULL) in HAL_PSSI_Receive_DMA()
1093 if (hpssi->hdmatx->Init.PeriphDataAlignment == DMA_PDATAALIGN_BYTE) in HAL_PSSI_Receive_DMA()
1095 …MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, PSSI_CR_DMA_ENABLE | in HAL_PSSI_Receive_DMA()
1096 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1100 MODIFY_REG(hpssi->Instance->CR, PSSI_CR_DMAEN | PSSI_CR_OUTEN | PSSI_CR_CKPOL, in HAL_PSSI_Receive_DMA()
1101 PSSI_CR_DMA_ENABLE | hpssi->Init.BusWidth | in HAL_PSSI_Receive_DMA()
1102 ((hpssi->Init.ClockPolarity == HAL_PSSI_RISING_EDGE) ? PSSI_CR_CKPOL : 0U)); in HAL_PSSI_Receive_DMA()
1106 hpssi->hdmarx->XferCpltCallback = PSSI_DMAReceiveCplt; in HAL_PSSI_Receive_DMA()
1109 hpssi->hdmarx->XferErrorCallback = PSSI_DMAError; in HAL_PSSI_Receive_DMA()
1112 hpssi->hdmarx->XferHalfCpltCallback = NULL; in HAL_PSSI_Receive_DMA()
1113 hpssi->hdmarx->XferAbortCallback = NULL; in HAL_PSSI_Receive_DMA()
1116 … dmaxferstatus = HAL_DMA_Start_IT(hpssi->hdmarx, (uint32_t)&hpssi->Instance->DR, (uint32_t)pData, in HAL_PSSI_Receive_DMA()
1117 hpssi->XferSize); in HAL_PSSI_Receive_DMA()
1122 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1125 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1128 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1136 hpssi->XferCount -= hpssi->XferSize; in HAL_PSSI_Receive_DMA()
1139 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1145 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1148 hpssi->Instance->CR |= PSSI_CR_DMA_ENABLE; in HAL_PSSI_Receive_DMA()
1150 HAL_PSSI_ENABLE(hpssi); in HAL_PSSI_Receive_DMA()
1155 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_Receive_DMA()
1158 hpssi->ErrorCode |= HAL_PSSI_ERROR_DMA; in HAL_PSSI_Receive_DMA()
1161 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1170 __HAL_UNLOCK(hpssi); in HAL_PSSI_Receive_DMA()
1173 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Receive_DMA()
1192 HAL_StatusTypeDef HAL_PSSI_Abort_DMA(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_Abort_DMA() argument
1196 __HAL_LOCK(hpssi); in HAL_PSSI_Abort_DMA()
1199 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1202 hpssi->State = HAL_PSSI_STATE_ABORT; in HAL_PSSI_Abort_DMA()
1205 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_Abort_DMA()
1207 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_Abort_DMA()
1210 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1212 if (hpssi->hdmatx != NULL) in HAL_PSSI_Abort_DMA()
1216 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1219 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1222 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_Abort_DMA()
1228 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_Abort_DMA()
1231 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_Abort_DMA()
1233 if (hpssi->hdmarx != NULL) in HAL_PSSI_Abort_DMA()
1237 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_Abort_DMA()
1240 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_Abort_DMA()
1243 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_Abort_DMA()
1250 hpssi->ErrorCallback(hpssi); in HAL_PSSI_Abort_DMA()
1256 __HAL_UNLOCK(hpssi); in HAL_PSSI_Abort_DMA()
1261 HAL_PSSI_ENABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_Abort_DMA()
1281 void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_IRQHandler() argument
1284 if (HAL_PSSI_GET_FLAG(hpssi, PSSI_FLAG_OVR_MIS) != 0U) in HAL_PSSI_IRQHandler()
1288 hpssi->XferCount = 0U; in HAL_PSSI_IRQHandler()
1291 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in HAL_PSSI_IRQHandler()
1295 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in HAL_PSSI_IRQHandler()
1297 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in HAL_PSSI_IRQHandler()
1300 hpssi->ErrorCode |= HAL_PSSI_ERROR_UNDER_RUN; in HAL_PSSI_IRQHandler()
1302 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1304 if (hpssi->hdmatx != NULL) in HAL_PSSI_IRQHandler()
1308 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1311 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1314 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in HAL_PSSI_IRQHandler()
1317 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in HAL_PSSI_IRQHandler()
1323 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in HAL_PSSI_IRQHandler()
1326 hpssi->ErrorCode |= HAL_PSSI_ERROR_OVER_RUN; in HAL_PSSI_IRQHandler()
1328 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in HAL_PSSI_IRQHandler()
1330 if (hpssi->hdmarx != NULL) in HAL_PSSI_IRQHandler()
1334 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in HAL_PSSI_IRQHandler()
1337 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1340 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in HAL_PSSI_IRQHandler()
1343 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in HAL_PSSI_IRQHandler()
1350 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1355 if (hpssi->State == HAL_PSSI_STATE_ABORT) in HAL_PSSI_IRQHandler()
1357 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1360 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1363 hpssi->AbortCpltCallback(hpssi); in HAL_PSSI_IRQHandler()
1369 hpssi->State = HAL_PSSI_STATE_READY; in HAL_PSSI_IRQHandler()
1371 __HAL_UNLOCK(hpssi); in HAL_PSSI_IRQHandler()
1374 hpssi->ErrorCallback(hpssi); in HAL_PSSI_IRQHandler()
1388 __weak void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_TxCpltCallback() argument
1391 UNUSED(hpssi); in HAL_PSSI_TxCpltCallback()
1404 __weak void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_RxCpltCallback() argument
1407 UNUSED(hpssi); in HAL_PSSI_RxCpltCallback()
1421 __weak void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_ErrorCallback() argument
1424 UNUSED(hpssi); in HAL_PSSI_ErrorCallback()
1437 __weak void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_AbortCpltCallback() argument
1440 UNUSED(hpssi); in HAL_PSSI_AbortCpltCallback()
1472 HAL_PSSI_StateTypeDef HAL_PSSI_GetState(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetState() argument
1475 return hpssi->State; in HAL_PSSI_GetState()
1485 uint32_t HAL_PSSI_GetError(PSSI_HandleTypeDef *hpssi) in HAL_PSSI_GetError() argument
1487 return hpssi->ErrorCode; in HAL_PSSI_GetError()
1508 static void PSSI_Error(PSSI_HandleTypeDef *hpssi, uint32_t ErrorCode) in PSSI_Error() argument
1513 hpssi->XferCount = 0U; in PSSI_Error()
1516 hpssi->ErrorCode |= ErrorCode; in PSSI_Error()
1519 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_Error()
1523 if ((hpssi->Instance->CR & PSSI_CR_DMAEN) == PSSI_CR_DMAEN) in PSSI_Error()
1525 if (hpssi->State == HAL_PSSI_STATE_BUSY_TX) in PSSI_Error()
1527 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1529 if (hpssi->hdmatx != NULL) in PSSI_Error()
1533 hpssi->hdmatx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1536 __HAL_UNLOCK(hpssi); in PSSI_Error()
1539 if (HAL_DMA_Abort_IT(hpssi->hdmatx) != HAL_OK) in PSSI_Error()
1542 hpssi->hdmatx->XferAbortCallback(hpssi->hdmatx); in PSSI_Error()
1548 else if (hpssi->State == HAL_PSSI_STATE_BUSY_RX) in PSSI_Error()
1550 hpssi->Instance->CR &= ~PSSI_CR_DMAEN; in PSSI_Error()
1552 if (hpssi->hdmarx != NULL) in PSSI_Error()
1556 hpssi->hdmarx->XferAbortCallback = PSSI_DMAAbort; in PSSI_Error()
1559 __HAL_UNLOCK(hpssi); in PSSI_Error()
1562 if (HAL_DMA_Abort_IT(hpssi->hdmarx) != HAL_OK) in PSSI_Error()
1565 hpssi->hdmarx->XferAbortCallback(hpssi->hdmarx); in PSSI_Error()
1576 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_Error()
1578 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1581 __HAL_UNLOCK(hpssi); in PSSI_Error()
1585 hpssi->AbortCpltCallback(hpssi); in PSSI_Error()
1591 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_Error()
1594 __HAL_UNLOCK(hpssi); in PSSI_Error()
1597 hpssi->ErrorCallback(hpssi); in PSSI_Error()
1610 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMATransmitCplt() local
1616 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMATransmitCplt()
1619 tmperror = hpssi->ErrorCode; in PSSI_DMATransmitCplt()
1622 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMATransmitCplt()
1625 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMATransmitCplt()
1630 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMATransmitCplt()
1633 __HAL_UNLOCK(hpssi); in PSSI_DMATransmitCplt()
1637 hpssi->TxCpltCallback(hpssi); in PSSI_DMATransmitCplt()
1652 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAReceiveCplt() local
1658 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAReceiveCplt()
1661 tmperror = hpssi->ErrorCode; in PSSI_DMAReceiveCplt()
1664 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAReceiveCplt()
1667 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAReceiveCplt()
1672 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAReceiveCplt()
1675 __HAL_UNLOCK(hpssi); in PSSI_DMAReceiveCplt()
1678 hpssi->RxCpltCallback(hpssi); in PSSI_DMAReceiveCplt()
1694 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAAbort() local
1697 hpssi->hdmatx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1698 hpssi->hdmarx->XferAbortCallback = NULL; in PSSI_DMAAbort()
1701 if (hpssi->State == HAL_PSSI_STATE_ABORT) in PSSI_DMAAbort()
1703 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAAbort()
1707 hpssi->AbortCpltCallback(hpssi); in PSSI_DMAAbort()
1713 hpssi->ErrorCallback(hpssi); in PSSI_DMAAbort()
1727 static HAL_StatusTypeDef PSSI_WaitOnStatusUntilTimeout(PSSI_HandleTypeDef *hpssi, uint32_t Flag, Fl… in PSSI_WaitOnStatusUntilTimeout() argument
1730 while ((HAL_PSSI_GET_STATUS(hpssi, Flag) & Flag) == (uint32_t)Status) in PSSI_WaitOnStatusUntilTimeout()
1737 hpssi->ErrorCode |= HAL_PSSI_ERROR_TIMEOUT; in PSSI_WaitOnStatusUntilTimeout()
1738 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_WaitOnStatusUntilTimeout()
1741 __HAL_UNLOCK(hpssi); in PSSI_WaitOnStatusUntilTimeout()
1752 PSSI_HandleTypeDef *hpssi = (PSSI_HandleTypeDef *)(((DMA_HandleTypeDef *)hdma)->Parent); in PSSI_DMAError() local
1758 HAL_PSSI_DISABLE(hpssi); in PSSI_DMAError()
1761 HAL_PSSI_DISABLE_IT(hpssi, PSSI_FLAG_OVR_RIS); in PSSI_DMAError()
1764 tmperror = hpssi->ErrorCode; in PSSI_DMAError()
1767 if ((hpssi->State == HAL_PSSI_STATE_ABORT) || (tmperror != HAL_PSSI_ERROR_NONE)) in PSSI_DMAError()
1770 PSSI_Error(hpssi, hpssi->ErrorCode); in PSSI_DMAError()
1774 hpssi->State = HAL_PSSI_STATE_READY; in PSSI_DMAError()
1777 __HAL_UNLOCK(hpssi); in PSSI_DMAError()
1780 hpssi->ErrorCallback(hpssi); in PSSI_DMAError()