Lines Matching refs:huart

202 static void UART_EndRxTransfer(UART_HandleTypeDef *huart);
203 static void UART_EndTxTransfer(UART_HandleTypeDef *huart);
214 static void UART_TxISR_8BIT(UART_HandleTypeDef *huart);
215 static void UART_TxISR_16BIT(UART_HandleTypeDef *huart);
216 static void UART_TxISR_8BIT_FIFOEN(UART_HandleTypeDef *huart);
217 static void UART_TxISR_16BIT_FIFOEN(UART_HandleTypeDef *huart);
218 static void UART_EndTransmit_IT(UART_HandleTypeDef *huart);
219 static void UART_RxISR_8BIT(UART_HandleTypeDef *huart);
220 static void UART_RxISR_16BIT(UART_HandleTypeDef *huart);
221 static void UART_RxISR_8BIT_FIFOEN(UART_HandleTypeDef *huart);
222 static void UART_RxISR_16BIT_FIFOEN(UART_HandleTypeDef *huart);
309 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart) in HAL_UART_Init() argument
312 if (huart == NULL) in HAL_UART_Init()
317 if (huart->Init.HwFlowCtl != UART_HWCONTROL_NONE) in HAL_UART_Init()
320 assert_param(IS_UART_HWFLOW_INSTANCE(huart->Instance)); in HAL_UART_Init()
326 assert_param((IS_UART_INSTANCE(huart->Instance)) || (IS_LPUART_INSTANCE(huart->Instance))); in HAL_UART_Init()
328 assert_param(IS_UART_INSTANCE(huart->Instance)); in HAL_UART_Init()
332 if (huart->gState == HAL_UART_STATE_RESET) in HAL_UART_Init()
335 huart->Lock = HAL_UNLOCKED; in HAL_UART_Init()
338 UART_InitCallbacksToDefault(huart); in HAL_UART_Init()
340 if (huart->MspInitCallback == NULL) in HAL_UART_Init()
342 huart->MspInitCallback = HAL_UART_MspInit; in HAL_UART_Init()
346 huart->MspInitCallback(huart); in HAL_UART_Init()
349 HAL_UART_MspInit(huart); in HAL_UART_Init()
353 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_Init()
355 __HAL_UART_DISABLE(huart); in HAL_UART_Init()
359 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_UART_Init()
361 UART_AdvFeatureConfig(huart); in HAL_UART_Init()
365 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_UART_Init()
373 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_UART_Init()
374 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); in HAL_UART_Init()
376 __HAL_UART_ENABLE(huart); in HAL_UART_Init()
379 return (UART_CheckIdleState(huart)); in HAL_UART_Init()
388 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart) in HAL_HalfDuplex_Init() argument
391 if (huart == NULL) in HAL_HalfDuplex_Init()
397 assert_param(IS_UART_HALFDUPLEX_INSTANCE(huart->Instance)); in HAL_HalfDuplex_Init()
399 if (huart->gState == HAL_UART_STATE_RESET) in HAL_HalfDuplex_Init()
402 huart->Lock = HAL_UNLOCKED; in HAL_HalfDuplex_Init()
405 UART_InitCallbacksToDefault(huart); in HAL_HalfDuplex_Init()
407 if (huart->MspInitCallback == NULL) in HAL_HalfDuplex_Init()
409 huart->MspInitCallback = HAL_UART_MspInit; in HAL_HalfDuplex_Init()
413 huart->MspInitCallback(huart); in HAL_HalfDuplex_Init()
416 HAL_UART_MspInit(huart); in HAL_HalfDuplex_Init()
420 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_Init()
422 __HAL_UART_DISABLE(huart); in HAL_HalfDuplex_Init()
426 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_HalfDuplex_Init()
428 UART_AdvFeatureConfig(huart); in HAL_HalfDuplex_Init()
432 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_HalfDuplex_Init()
440 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_HalfDuplex_Init()
441 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_IREN | USART_CR3_SCEN)); in HAL_HalfDuplex_Init()
444 SET_BIT(huart->Instance->CR3, USART_CR3_HDSEL); in HAL_HalfDuplex_Init()
446 __HAL_UART_ENABLE(huart); in HAL_HalfDuplex_Init()
449 return (UART_CheckIdleState(huart)); in HAL_HalfDuplex_Init()
463 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength) in HAL_LIN_Init() argument
466 if (huart == NULL) in HAL_LIN_Init()
472 assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); in HAL_LIN_Init()
477 if (huart->Init.OverSampling == UART_OVERSAMPLING_8) in HAL_LIN_Init()
482 if (huart->Init.WordLength != UART_WORDLENGTH_8B) in HAL_LIN_Init()
487 if (huart->gState == HAL_UART_STATE_RESET) in HAL_LIN_Init()
490 huart->Lock = HAL_UNLOCKED; in HAL_LIN_Init()
493 UART_InitCallbacksToDefault(huart); in HAL_LIN_Init()
495 if (huart->MspInitCallback == NULL) in HAL_LIN_Init()
497 huart->MspInitCallback = HAL_UART_MspInit; in HAL_LIN_Init()
501 huart->MspInitCallback(huart); in HAL_LIN_Init()
504 HAL_UART_MspInit(huart); in HAL_LIN_Init()
508 huart->gState = HAL_UART_STATE_BUSY; in HAL_LIN_Init()
510 __HAL_UART_DISABLE(huart); in HAL_LIN_Init()
514 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_LIN_Init()
516 UART_AdvFeatureConfig(huart); in HAL_LIN_Init()
520 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_LIN_Init()
528 CLEAR_BIT(huart->Instance->CR2, USART_CR2_CLKEN); in HAL_LIN_Init()
529 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_HDSEL | USART_CR3_IREN | USART_CR3_SCEN)); in HAL_LIN_Init()
532 SET_BIT(huart->Instance->CR2, USART_CR2_LINEN); in HAL_LIN_Init()
535 MODIFY_REG(huart->Instance->CR2, USART_CR2_LBDL, BreakDetectLength); in HAL_LIN_Init()
537 __HAL_UART_ENABLE(huart); in HAL_LIN_Init()
540 return (UART_CheckIdleState(huart)); in HAL_LIN_Init()
562 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t Wake… in HAL_MultiProcessor_Init() argument
565 if (huart == NULL) in HAL_MultiProcessor_Init()
573 if (huart->gState == HAL_UART_STATE_RESET) in HAL_MultiProcessor_Init()
576 huart->Lock = HAL_UNLOCKED; in HAL_MultiProcessor_Init()
579 UART_InitCallbacksToDefault(huart); in HAL_MultiProcessor_Init()
581 if (huart->MspInitCallback == NULL) in HAL_MultiProcessor_Init()
583 huart->MspInitCallback = HAL_UART_MspInit; in HAL_MultiProcessor_Init()
587 huart->MspInitCallback(huart); in HAL_MultiProcessor_Init()
590 HAL_UART_MspInit(huart); in HAL_MultiProcessor_Init()
594 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_Init()
596 __HAL_UART_DISABLE(huart); in HAL_MultiProcessor_Init()
600 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_MultiProcessor_Init()
602 UART_AdvFeatureConfig(huart); in HAL_MultiProcessor_Init()
606 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_MultiProcessor_Init()
614 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_MultiProcessor_Init()
615 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); in HAL_MultiProcessor_Init()
620 … MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)Address << UART_CR2_ADDRESS_LSB_POS)); in HAL_MultiProcessor_Init()
624 MODIFY_REG(huart->Instance->CR1, USART_CR1_WAKE, WakeUpMethod); in HAL_MultiProcessor_Init()
626 __HAL_UART_ENABLE(huart); in HAL_MultiProcessor_Init()
629 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_Init()
638 HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart) in HAL_UART_DeInit() argument
641 if (huart == NULL) in HAL_UART_DeInit()
648 assert_param((IS_UART_INSTANCE(huart->Instance)) || (IS_LPUART_INSTANCE(huart->Instance))); in HAL_UART_DeInit()
650 assert_param(IS_UART_INSTANCE(huart->Instance)); in HAL_UART_DeInit()
653 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_DeInit()
655 __HAL_UART_DISABLE(huart); in HAL_UART_DeInit()
657 huart->Instance->CR1 = 0x0U; in HAL_UART_DeInit()
658 huart->Instance->CR2 = 0x0U; in HAL_UART_DeInit()
659 huart->Instance->CR3 = 0x0U; in HAL_UART_DeInit()
662 if (huart->MspDeInitCallback == NULL) in HAL_UART_DeInit()
664 huart->MspDeInitCallback = HAL_UART_MspDeInit; in HAL_UART_DeInit()
667 huart->MspDeInitCallback(huart); in HAL_UART_DeInit()
670 HAL_UART_MspDeInit(huart); in HAL_UART_DeInit()
673 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_DeInit()
674 huart->gState = HAL_UART_STATE_RESET; in HAL_UART_DeInit()
675 huart->RxState = HAL_UART_STATE_RESET; in HAL_UART_DeInit()
676 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_DeInit()
677 huart->RxEventType = HAL_UART_RXEVENT_TC; in HAL_UART_DeInit()
679 __HAL_UNLOCK(huart); in HAL_UART_DeInit()
689 __weak void HAL_UART_MspInit(UART_HandleTypeDef *huart) in HAL_UART_MspInit() argument
692 UNUSED(huart); in HAL_UART_MspInit()
704 __weak void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) in HAL_UART_MspDeInit() argument
707 UNUSED(huart); in HAL_UART_MspDeInit()
740 HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef C… in HAL_UART_RegisterCallback() argument
747 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
752 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_RegisterCallback()
757 huart->TxHalfCpltCallback = pCallback; in HAL_UART_RegisterCallback()
761 huart->TxCpltCallback = pCallback; in HAL_UART_RegisterCallback()
765 huart->RxHalfCpltCallback = pCallback; in HAL_UART_RegisterCallback()
769 huart->RxCpltCallback = pCallback; in HAL_UART_RegisterCallback()
773 huart->ErrorCallback = pCallback; in HAL_UART_RegisterCallback()
777 huart->AbortCpltCallback = pCallback; in HAL_UART_RegisterCallback()
781 huart->AbortTransmitCpltCallback = pCallback; in HAL_UART_RegisterCallback()
785 huart->AbortReceiveCpltCallback = pCallback; in HAL_UART_RegisterCallback()
789 huart->WakeupCallback = pCallback; in HAL_UART_RegisterCallback()
793 huart->RxFifoFullCallback = pCallback; in HAL_UART_RegisterCallback()
797 huart->TxFifoEmptyCallback = pCallback; in HAL_UART_RegisterCallback()
801 huart->MspInitCallback = pCallback; in HAL_UART_RegisterCallback()
805 huart->MspDeInitCallback = pCallback; in HAL_UART_RegisterCallback()
809 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
815 else if (huart->gState == HAL_UART_STATE_RESET) in HAL_UART_RegisterCallback()
820 huart->MspInitCallback = pCallback; in HAL_UART_RegisterCallback()
824 huart->MspDeInitCallback = pCallback; in HAL_UART_RegisterCallback()
828 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
836 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
868 HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef… in HAL_UART_UnRegisterCallback() argument
872 if (HAL_UART_STATE_READY == huart->gState) in HAL_UART_UnRegisterCallback()
877huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltC… in HAL_UART_UnRegisterCallback()
881huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallba… in HAL_UART_UnRegisterCallback()
885huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCa… in HAL_UART_UnRegisterCallback()
889huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallba… in HAL_UART_UnRegisterCallback()
893huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallbac… in HAL_UART_UnRegisterCallback()
897huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCal… in HAL_UART_UnRegisterCallback()
901 huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak in HAL_UART_UnRegisterCallback()
906 huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak in HAL_UART_UnRegisterCallback()
911huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallba… in HAL_UART_UnRegisterCallback()
915huart->RxFifoFullCallback = HAL_UARTEx_RxFifoFullCallback; /* Legacy weak RxFifoFullCa… in HAL_UART_UnRegisterCallback()
919huart->TxFifoEmptyCallback = HAL_UARTEx_TxFifoEmptyCallback; /* Legacy weak TxFifoEmptyC… in HAL_UART_UnRegisterCallback()
923huart->MspInitCallback = HAL_UART_MspInit; /* Legacy weak MspInitCallb… in HAL_UART_UnRegisterCallback()
927huart->MspDeInitCallback = HAL_UART_MspDeInit; /* Legacy weak MspDeInitCal… in HAL_UART_UnRegisterCallback()
931 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
937 else if (HAL_UART_STATE_RESET == huart->gState) in HAL_UART_UnRegisterCallback()
942 huart->MspInitCallback = HAL_UART_MspInit; in HAL_UART_UnRegisterCallback()
946 huart->MspDeInitCallback = HAL_UART_MspDeInit; in HAL_UART_UnRegisterCallback()
950 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
958 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
973 HAL_StatusTypeDef HAL_UART_RegisterRxEventCallback(UART_HandleTypeDef *huart, pUART_RxEventCallback… in HAL_UART_RegisterRxEventCallback() argument
979 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterRxEventCallback()
984 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_RegisterRxEventCallback()
986 huart->RxEventCallback = pCallback; in HAL_UART_RegisterRxEventCallback()
990 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterRxEventCallback()
1004 HAL_StatusTypeDef HAL_UART_UnRegisterRxEventCallback(UART_HandleTypeDef *huart) in HAL_UART_UnRegisterRxEventCallback() argument
1008 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_UnRegisterRxEventCallback()
1010 huart->RxEventCallback = HAL_UARTEx_RxEventCallback; /* Legacy weak UART Rx Event Callback */ in HAL_UART_UnRegisterRxEventCallback()
1014 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterRxEventCallback()
1127 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Size,… in HAL_UART_Transmit() argument
1134 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit()
1141 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit()
1142 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit()
1147 huart->TxXferSize = Size; in HAL_UART_Transmit()
1148 huart->TxXferCount = Size; in HAL_UART_Transmit()
1151 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Transmit()
1162 while (huart->TxXferCount > 0U) in HAL_UART_Transmit()
1164 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Transmit()
1167 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1173 huart->Instance->TDR = (uint16_t)(*pdata16bits & 0x01FFU); in HAL_UART_Transmit()
1178 huart->Instance->TDR = (uint8_t)(*pdata8bits & 0xFFU); in HAL_UART_Transmit()
1181 huart->TxXferCount--; in HAL_UART_Transmit()
1184 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TC, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Transmit()
1186 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1192 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1217 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32… in HAL_UART_Receive() argument
1225 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive()
1232 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Receive()
1233 huart->RxState = HAL_UART_STATE_BUSY_RX; in HAL_UART_Receive()
1234 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive()
1239 huart->RxXferSize = Size; in HAL_UART_Receive()
1240 huart->RxXferCount = Size; in HAL_UART_Receive()
1243 UART_MASK_COMPUTATION(huart); in HAL_UART_Receive()
1244 uhMask = huart->Mask; in HAL_UART_Receive()
1247 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Receive()
1259 while (huart->RxXferCount > 0U) in HAL_UART_Receive()
1261 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Receive()
1263 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Receive()
1269 *pdata16bits = (uint16_t)(huart->Instance->RDR & uhMask); in HAL_UART_Receive()
1274 *pdata8bits = (uint8_t)(huart->Instance->RDR & (uint8_t)uhMask); in HAL_UART_Receive()
1277 huart->RxXferCount--; in HAL_UART_Receive()
1281 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Receive()
1301 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Si… in HAL_UART_Transmit_IT() argument
1304 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit_IT()
1311 huart->pTxBuffPtr = pData; in HAL_UART_Transmit_IT()
1312 huart->TxXferSize = Size; in HAL_UART_Transmit_IT()
1313 huart->TxXferCount = Size; in HAL_UART_Transmit_IT()
1314 huart->TxISR = NULL; in HAL_UART_Transmit_IT()
1316 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit_IT()
1317 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit_IT()
1320 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in HAL_UART_Transmit_IT()
1323 … if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Transmit_IT()
1325 huart->TxISR = UART_TxISR_16BIT_FIFOEN; in HAL_UART_Transmit_IT()
1329 huart->TxISR = UART_TxISR_8BIT_FIFOEN; in HAL_UART_Transmit_IT()
1333 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_TXFTIE); in HAL_UART_Transmit_IT()
1338 … if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Transmit_IT()
1340 huart->TxISR = UART_TxISR_16BIT; in HAL_UART_Transmit_IT()
1344 huart->TxISR = UART_TxISR_8BIT; in HAL_UART_Transmit_IT()
1348 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TXEIE_TXFNFIE); in HAL_UART_Transmit_IT()
1369 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in HAL_UART_Receive_IT() argument
1372 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive_IT()
1380 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive_IT()
1383 if (!(IS_LPUART_INSTANCE(huart->Instance))) in HAL_UART_Receive_IT()
1386 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_IT()
1389 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_IT()
1394 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_IT()
1397 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_IT()
1401 return (UART_Start_Receive_IT(huart, pData, Size)); in HAL_UART_Receive_IT()
1419 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t S… in HAL_UART_Transmit_DMA() argument
1422 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit_DMA()
1429 huart->pTxBuffPtr = pData; in HAL_UART_Transmit_DMA()
1430 huart->TxXferSize = Size; in HAL_UART_Transmit_DMA()
1431 huart->TxXferCount = Size; in HAL_UART_Transmit_DMA()
1433 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit_DMA()
1434 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit_DMA()
1436 if (huart->hdmatx != NULL) in HAL_UART_Transmit_DMA()
1439 huart->hdmatx->XferCpltCallback = UART_DMATransmitCplt; in HAL_UART_Transmit_DMA()
1442 huart->hdmatx->XferHalfCpltCallback = UART_DMATxHalfCplt; in HAL_UART_Transmit_DMA()
1445 huart->hdmatx->XferErrorCallback = UART_DMAError; in HAL_UART_Transmit_DMA()
1448 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Transmit_DMA()
1451 …if (HAL_DMA_Start_IT(huart->hdmatx, (uint32_t)huart->pTxBuffPtr, (uint32_t)&huart->Instance->TDR, … in HAL_UART_Transmit_DMA()
1454 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Transmit_DMA()
1457 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit_DMA()
1463 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_TCF); in HAL_UART_Transmit_DMA()
1467 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Transmit_DMA()
1489 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in HAL_UART_Receive_DMA() argument
1492 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive_DMA()
1500 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive_DMA()
1503 if (!(IS_LPUART_INSTANCE(huart->Instance))) in HAL_UART_Receive_DMA()
1506 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_DMA()
1509 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_DMA()
1514 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_DMA()
1517 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_DMA()
1521 return (UART_Start_Receive_DMA(huart, pData, Size)); in HAL_UART_Receive_DMA()
1534 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart) in HAL_UART_DMAPause() argument
1536 const HAL_UART_StateTypeDef gstate = huart->gState; in HAL_UART_DMAPause()
1537 const HAL_UART_StateTypeDef rxstate = huart->RxState; in HAL_UART_DMAPause()
1539 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in HAL_UART_DMAPause()
1543 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAPause()
1545 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in HAL_UART_DMAPause()
1549 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_DMAPause()
1550 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_DMAPause()
1553 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAPause()
1564 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart) in HAL_UART_DMAResume() argument
1566 if (huart->gState == HAL_UART_STATE_BUSY_TX) in HAL_UART_DMAResume()
1569 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAResume()
1571 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in HAL_UART_DMAResume()
1574 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in HAL_UART_DMAResume()
1577 if (huart->Init.Parity != UART_PARITY_NONE) in HAL_UART_DMAResume()
1579 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_DMAResume()
1581 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_DMAResume()
1584 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAResume()
1595 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart) in HAL_UART_DMAStop() argument
1604 const HAL_UART_StateTypeDef gstate = huart->gState; in HAL_UART_DMAStop()
1605 const HAL_UART_StateTypeDef rxstate = huart->RxState; in HAL_UART_DMAStop()
1608 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in HAL_UART_DMAStop()
1611 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAStop()
1614 if (huart->hdmatx != NULL) in HAL_UART_DMAStop()
1616 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_DMAStop()
1618 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_DMAStop()
1621 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_DMAStop()
1628 UART_EndTxTransfer(huart); in HAL_UART_DMAStop()
1632 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in HAL_UART_DMAStop()
1635 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAStop()
1638 if (huart->hdmarx != NULL) in HAL_UART_DMAStop()
1640 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_DMAStop()
1642 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_DMAStop()
1645 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_DMAStop()
1652 UART_EndRxTransfer(huart); in HAL_UART_DMAStop()
1670 HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart) in HAL_UART_Abort() argument
1673 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE | in HAL_UART_Abort()
1675 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE | USART_CR3_RXFTIE | USART_CR3_TXFTIE); in HAL_UART_Abort()
1678 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_Abort()
1680 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_Abort()
1684 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort()
1687 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Abort()
1690 if (huart->hdmatx != NULL) in HAL_UART_Abort()
1694 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort()
1696 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_Abort()
1698 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_Abort()
1701 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Abort()
1710 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort()
1713 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_Abort()
1716 if (huart->hdmarx != NULL) in HAL_UART_Abort()
1720 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort()
1722 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_Abort()
1724 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_Abort()
1727 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Abort()
1736 huart->TxXferCount = 0U; in HAL_UART_Abort()
1737 huart->RxXferCount = 0U; in HAL_UART_Abort()
1740 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_Abort()
1743 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in HAL_UART_Abort()
1745 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in HAL_UART_Abort()
1749 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_Abort()
1752 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Abort()
1753 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Abort()
1754 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Abort()
1756 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Abort()
1773 HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmit() argument
1776 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TCIE | USART_CR1_TXEIE_TXFNFIE)); in HAL_UART_AbortTransmit()
1777 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_TXFTIE); in HAL_UART_AbortTransmit()
1780 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_AbortTransmit()
1783 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_AbortTransmit()
1786 if (huart->hdmatx != NULL) in HAL_UART_AbortTransmit()
1790 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_AbortTransmit()
1792 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_AbortTransmit()
1794 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_AbortTransmit()
1797 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_AbortTransmit()
1806 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit()
1809 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in HAL_UART_AbortTransmit()
1811 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in HAL_UART_AbortTransmit()
1815 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit()
1832 HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart) in HAL_UART_AbortReceive() argument
1835 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_PEIE | USART_CR1_RXNEIE_RXFNEIE)); in HAL_UART_AbortReceive()
1836 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE | USART_CR3_RXFTIE); in HAL_UART_AbortReceive()
1839 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_AbortReceive()
1841 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_AbortReceive()
1845 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_AbortReceive()
1848 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_AbortReceive()
1851 if (huart->hdmarx != NULL) in HAL_UART_AbortReceive()
1855 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_AbortReceive()
1857 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_AbortReceive()
1859 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_AbortReceive()
1862 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_AbortReceive()
1871 huart->RxXferCount = 0U; in HAL_UART_AbortReceive()
1874 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive()
1877 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_AbortReceive()
1880 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive()
1881 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive()
1900 HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart) in HAL_UART_Abort_IT() argument
1905 …ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_PEIE | USART_CR1_TCIE | USART_CR1_RXNEIE_RXFNEIE… in HAL_UART_Abort_IT()
1907 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE | USART_CR3_TXFTIE)); in HAL_UART_Abort_IT()
1910 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_Abort_IT()
1912 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_Abort_IT()
1918 if (huart->hdmatx != NULL) in HAL_UART_Abort_IT()
1922 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort_IT()
1924 huart->hdmatx->XferAbortCallback = UART_DMATxAbortCallback; in HAL_UART_Abort_IT()
1928 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1932 if (huart->hdmarx != NULL) in HAL_UART_Abort_IT()
1936 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort_IT()
1938 huart->hdmarx->XferAbortCallback = UART_DMARxAbortCallback; in HAL_UART_Abort_IT()
1942 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1947 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort_IT()
1950 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Abort_IT()
1953 if (huart->hdmatx != NULL) in HAL_UART_Abort_IT()
1959 if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) in HAL_UART_Abort_IT()
1961 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1971 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort_IT()
1974 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_Abort_IT()
1977 if (huart->hdmarx != NULL) in HAL_UART_Abort_IT()
1983 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_Abort_IT()
1985 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1999 huart->TxXferCount = 0U; in HAL_UART_Abort_IT()
2000 huart->RxXferCount = 0U; in HAL_UART_Abort_IT()
2003 huart->RxISR = NULL; in HAL_UART_Abort_IT()
2004 huart->TxISR = NULL; in HAL_UART_Abort_IT()
2007 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Abort_IT()
2010 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_Abort_IT()
2013 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in HAL_UART_Abort_IT()
2015 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in HAL_UART_Abort_IT()
2019 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_Abort_IT()
2022 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Abort_IT()
2023 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Abort_IT()
2024 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Abort_IT()
2029 huart->AbortCpltCallback(huart); in HAL_UART_Abort_IT()
2032 HAL_UART_AbortCpltCallback(huart); in HAL_UART_Abort_IT()
2053 HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmit_IT() argument
2056 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TCIE | USART_CR1_TXEIE_TXFNFIE)); in HAL_UART_AbortTransmit_IT()
2057 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_TXFTIE); in HAL_UART_AbortTransmit_IT()
2060 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_AbortTransmit_IT()
2063 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_AbortTransmit_IT()
2066 if (huart->hdmatx != NULL) in HAL_UART_AbortTransmit_IT()
2070 huart->hdmatx->XferAbortCallback = UART_DMATxOnlyAbortCallback; in HAL_UART_AbortTransmit_IT()
2073 if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) in HAL_UART_AbortTransmit_IT()
2076 huart->hdmatx->XferAbortCallback(huart->hdmatx); in HAL_UART_AbortTransmit_IT()
2082 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit_IT()
2085 huart->TxISR = NULL; in HAL_UART_AbortTransmit_IT()
2088 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit_IT()
2093 huart->AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2096 HAL_UART_AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2103 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit_IT()
2106 huart->TxISR = NULL; in HAL_UART_AbortTransmit_IT()
2109 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in HAL_UART_AbortTransmit_IT()
2111 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in HAL_UART_AbortTransmit_IT()
2115 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit_IT()
2120 huart->AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2123 HAL_UART_AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2144 HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart) in HAL_UART_AbortReceive_IT() argument
2147 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_PEIE | USART_CR1_RXNEIE_RXFNEIE)); in HAL_UART_AbortReceive_IT()
2148 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE)); in HAL_UART_AbortReceive_IT()
2151 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_AbortReceive_IT()
2153 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_AbortReceive_IT()
2157 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_AbortReceive_IT()
2160 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_AbortReceive_IT()
2163 if (huart->hdmarx != NULL) in HAL_UART_AbortReceive_IT()
2167 huart->hdmarx->XferAbortCallback = UART_DMARxOnlyAbortCallback; in HAL_UART_AbortReceive_IT()
2170 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_AbortReceive_IT()
2173 huart->hdmarx->XferAbortCallback(huart->hdmarx); in HAL_UART_AbortReceive_IT()
2179 huart->RxXferCount = 0U; in HAL_UART_AbortReceive_IT()
2182 huart->pRxBuffPtr = NULL; in HAL_UART_AbortReceive_IT()
2185 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive_IT()
2188 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_AbortReceive_IT()
2191 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive_IT()
2192 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive_IT()
2197 huart->AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2200 HAL_UART_AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2207 huart->RxXferCount = 0U; in HAL_UART_AbortReceive_IT()
2210 huart->pRxBuffPtr = NULL; in HAL_UART_AbortReceive_IT()
2213 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive_IT()
2216 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive_IT()
2217 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive_IT()
2222 huart->AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2225 HAL_UART_AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2237 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart) in HAL_UART_IRQHandler() argument
2239 uint32_t isrflags = READ_REG(huart->Instance->ISR); in HAL_UART_IRQHandler()
2240 uint32_t cr1its = READ_REG(huart->Instance->CR1); in HAL_UART_IRQHandler()
2241 uint32_t cr3its = READ_REG(huart->Instance->CR3); in HAL_UART_IRQHandler()
2255 if (huart->RxISR != NULL) in HAL_UART_IRQHandler()
2257 huart->RxISR(huart); in HAL_UART_IRQHandler()
2271 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_PEF); in HAL_UART_IRQHandler()
2273 huart->ErrorCode |= HAL_UART_ERROR_PE; in HAL_UART_IRQHandler()
2279 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_FEF); in HAL_UART_IRQHandler()
2281 huart->ErrorCode |= HAL_UART_ERROR_FE; in HAL_UART_IRQHandler()
2287 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_NEF); in HAL_UART_IRQHandler()
2289 huart->ErrorCode |= HAL_UART_ERROR_NE; in HAL_UART_IRQHandler()
2297 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in HAL_UART_IRQHandler()
2299 huart->ErrorCode |= HAL_UART_ERROR_ORE; in HAL_UART_IRQHandler()
2305 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); in HAL_UART_IRQHandler()
2307 huart->ErrorCode |= HAL_UART_ERROR_RTO; in HAL_UART_IRQHandler()
2311 if (huart->ErrorCode != HAL_UART_ERROR_NONE) in HAL_UART_IRQHandler()
2318 if (huart->RxISR != NULL) in HAL_UART_IRQHandler()
2320 huart->RxISR(huart); in HAL_UART_IRQHandler()
2329 errorcode = huart->ErrorCode; in HAL_UART_IRQHandler()
2330 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) || in HAL_UART_IRQHandler()
2336 UART_EndRxTransfer(huart); in HAL_UART_IRQHandler()
2339 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_IRQHandler()
2342 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_IRQHandler()
2345 if (huart->hdmarx != NULL) in HAL_UART_IRQHandler()
2349 huart->hdmarx->XferAbortCallback = UART_DMAAbortOnError; in HAL_UART_IRQHandler()
2352 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_IRQHandler()
2355 huart->hdmarx->XferAbortCallback(huart->hdmarx); in HAL_UART_IRQHandler()
2363 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2366 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2376 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2379 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2389 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2392 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2394 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_IRQHandler()
2403 if ((huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_IRQHandler()
2407 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in HAL_UART_IRQHandler()
2410 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_IRQHandler()
2416 uint16_t nb_remaining_rx_data = (uint16_t) __HAL_DMA_GET_COUNTER(huart->hdmarx); in HAL_UART_IRQHandler()
2418 && (nb_remaining_rx_data < huart->RxXferSize)) in HAL_UART_IRQHandler()
2421 huart->RxXferCount = nb_remaining_rx_data; in HAL_UART_IRQHandler()
2424 if (HAL_IS_BIT_CLR(huart->hdmarx->Instance->CCR, DMA_CCR_CIRC)) in HAL_UART_IRQHandler()
2427 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_IRQHandler()
2428 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_IRQHandler()
2432 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_IRQHandler()
2435 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_IRQHandler()
2436 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_IRQHandler()
2438 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in HAL_UART_IRQHandler()
2441 (void)HAL_DMA_Abort(huart->hdmarx); in HAL_UART_IRQHandler()
2446 huart->RxEventType = HAL_UART_RXEVENT_IDLE; in HAL_UART_IRQHandler()
2450 huart->RxEventCallback(huart, (huart->RxXferSize - huart->RxXferCount)); in HAL_UART_IRQHandler()
2453 HAL_UARTEx_RxEventCallback(huart, (huart->RxXferSize - huart->RxXferCount)); in HAL_UART_IRQHandler()
2460 if (nb_remaining_rx_data == huart->RxXferSize) in HAL_UART_IRQHandler()
2462 if (HAL_IS_BIT_SET(huart->hdmarx->Instance->CCR, DMA_CCR_CIRC)) in HAL_UART_IRQHandler()
2466 huart->RxEventType = HAL_UART_RXEVENT_IDLE; in HAL_UART_IRQHandler()
2470 huart->RxEventCallback(huart, huart->RxXferSize); in HAL_UART_IRQHandler()
2473 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in HAL_UART_IRQHandler()
2485 uint16_t nb_rx_data = huart->RxXferSize - huart->RxXferCount; in HAL_UART_IRQHandler()
2486 if ((huart->RxXferCount > 0U) in HAL_UART_IRQHandler()
2490 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE)); in HAL_UART_IRQHandler()
2493 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE)); in HAL_UART_IRQHandler()
2496 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_IRQHandler()
2497 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_IRQHandler()
2500 huart->RxISR = NULL; in HAL_UART_IRQHandler()
2502 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in HAL_UART_IRQHandler()
2506 huart->RxEventType = HAL_UART_RXEVENT_IDLE; in HAL_UART_IRQHandler()
2510 huart->RxEventCallback(huart, nb_rx_data); in HAL_UART_IRQHandler()
2513 HAL_UARTEx_RxEventCallback(huart, nb_rx_data); in HAL_UART_IRQHandler()
2523 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_WUF); in HAL_UART_IRQHandler()
2530 huart->WakeupCallback(huart); in HAL_UART_IRQHandler()
2533 HAL_UARTEx_WakeupCallback(huart); in HAL_UART_IRQHandler()
2543 if (huart->TxISR != NULL) in HAL_UART_IRQHandler()
2545 huart->TxISR(huart); in HAL_UART_IRQHandler()
2553 UART_EndTransmit_IT(huart); in HAL_UART_IRQHandler()
2562 huart->TxFifoEmptyCallback(huart); in HAL_UART_IRQHandler()
2565 HAL_UARTEx_TxFifoEmptyCallback(huart); in HAL_UART_IRQHandler()
2575 huart->RxFifoFullCallback(huart); in HAL_UART_IRQHandler()
2578 HAL_UARTEx_RxFifoFullCallback(huart); in HAL_UART_IRQHandler()
2589 __weak void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_TxCpltCallback() argument
2592 UNUSED(huart); in HAL_UART_TxCpltCallback()
2604 __weak void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_TxHalfCpltCallback() argument
2607 UNUSED(huart); in HAL_UART_TxHalfCpltCallback()
2619 __weak void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_RxCpltCallback() argument
2622 UNUSED(huart); in HAL_UART_RxCpltCallback()
2634 __weak void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_RxHalfCpltCallback() argument
2637 UNUSED(huart); in HAL_UART_RxHalfCpltCallback()
2649 __weak void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) in HAL_UART_ErrorCallback() argument
2652 UNUSED(huart); in HAL_UART_ErrorCallback()
2664 __weak void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortCpltCallback() argument
2667 UNUSED(huart); in HAL_UART_AbortCpltCallback()
2679 __weak void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmitCpltCallback() argument
2682 UNUSED(huart); in HAL_UART_AbortTransmitCpltCallback()
2694 __weak void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortReceiveCpltCallback() argument
2697 UNUSED(huart); in HAL_UART_AbortReceiveCpltCallback()
2711 __weak void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) in HAL_UARTEx_RxEventCallback() argument
2714 UNUSED(huart); in HAL_UARTEx_RxEventCallback()
2759 void HAL_UART_ReceiverTimeout_Config(UART_HandleTypeDef *huart, uint32_t TimeoutValue) in HAL_UART_ReceiverTimeout_Config() argument
2762 if (!(IS_LPUART_INSTANCE(huart->Instance))) in HAL_UART_ReceiverTimeout_Config()
2765 MODIFY_REG(huart->Instance->RTOR, USART_RTOR_RTO, TimeoutValue); in HAL_UART_ReceiverTimeout_Config()
2769 MODIFY_REG(huart->Instance->RTOR, USART_RTOR_RTO, TimeoutValue); in HAL_UART_ReceiverTimeout_Config()
2779 HAL_StatusTypeDef HAL_UART_EnableReceiverTimeout(UART_HandleTypeDef *huart) in HAL_UART_EnableReceiverTimeout() argument
2782 if (!(IS_LPUART_INSTANCE(huart->Instance))) in HAL_UART_EnableReceiverTimeout()
2784 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_EnableReceiverTimeout()
2787 __HAL_LOCK(huart); in HAL_UART_EnableReceiverTimeout()
2789 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_EnableReceiverTimeout()
2792 SET_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_EnableReceiverTimeout()
2794 huart->gState = HAL_UART_STATE_READY; in HAL_UART_EnableReceiverTimeout()
2797 __HAL_UNLOCK(huart); in HAL_UART_EnableReceiverTimeout()
2811 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_EnableReceiverTimeout()
2814 __HAL_LOCK(huart); in HAL_UART_EnableReceiverTimeout()
2816 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_EnableReceiverTimeout()
2819 SET_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_EnableReceiverTimeout()
2821 huart->gState = HAL_UART_STATE_READY; in HAL_UART_EnableReceiverTimeout()
2824 __HAL_UNLOCK(huart); in HAL_UART_EnableReceiverTimeout()
2841 HAL_StatusTypeDef HAL_UART_DisableReceiverTimeout(UART_HandleTypeDef *huart) in HAL_UART_DisableReceiverTimeout() argument
2844 if (!(IS_LPUART_INSTANCE(huart->Instance))) in HAL_UART_DisableReceiverTimeout()
2846 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_DisableReceiverTimeout()
2849 __HAL_LOCK(huart); in HAL_UART_DisableReceiverTimeout()
2851 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_DisableReceiverTimeout()
2854 CLEAR_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_DisableReceiverTimeout()
2856 huart->gState = HAL_UART_STATE_READY; in HAL_UART_DisableReceiverTimeout()
2859 __HAL_UNLOCK(huart); in HAL_UART_DisableReceiverTimeout()
2873 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_DisableReceiverTimeout()
2876 __HAL_LOCK(huart); in HAL_UART_DisableReceiverTimeout()
2878 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_DisableReceiverTimeout()
2881 CLEAR_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_DisableReceiverTimeout()
2883 huart->gState = HAL_UART_STATE_READY; in HAL_UART_DisableReceiverTimeout()
2886 __HAL_UNLOCK(huart); in HAL_UART_DisableReceiverTimeout()
2903 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_EnableMuteMode() argument
2905 __HAL_LOCK(huart); in HAL_MultiProcessor_EnableMuteMode()
2907 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_EnableMuteMode()
2910 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_MME); in HAL_MultiProcessor_EnableMuteMode()
2912 huart->gState = HAL_UART_STATE_READY; in HAL_MultiProcessor_EnableMuteMode()
2914 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_EnableMuteMode()
2923 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_DisableMuteMode() argument
2925 __HAL_LOCK(huart); in HAL_MultiProcessor_DisableMuteMode()
2927 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_DisableMuteMode()
2930 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_MME); in HAL_MultiProcessor_DisableMuteMode()
2932 huart->gState = HAL_UART_STATE_READY; in HAL_MultiProcessor_DisableMuteMode()
2934 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_DisableMuteMode()
2943 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_EnterMuteMode() argument
2945 __HAL_UART_SEND_REQ(huart, UART_MUTE_MODE_REQUEST); in HAL_MultiProcessor_EnterMuteMode()
2953 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart) in HAL_HalfDuplex_EnableTransmitter() argument
2955 __HAL_LOCK(huart); in HAL_HalfDuplex_EnableTransmitter()
2956 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_EnableTransmitter()
2959 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); in HAL_HalfDuplex_EnableTransmitter()
2962 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TE); in HAL_HalfDuplex_EnableTransmitter()
2964 huart->gState = HAL_UART_STATE_READY; in HAL_HalfDuplex_EnableTransmitter()
2966 __HAL_UNLOCK(huart); in HAL_HalfDuplex_EnableTransmitter()
2976 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart) in HAL_HalfDuplex_EnableReceiver() argument
2978 __HAL_LOCK(huart); in HAL_HalfDuplex_EnableReceiver()
2979 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_EnableReceiver()
2982 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); in HAL_HalfDuplex_EnableReceiver()
2985 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RE); in HAL_HalfDuplex_EnableReceiver()
2987 huart->gState = HAL_UART_STATE_READY; in HAL_HalfDuplex_EnableReceiver()
2989 __HAL_UNLOCK(huart); in HAL_HalfDuplex_EnableReceiver()
3000 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart) in HAL_LIN_SendBreak() argument
3003 assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); in HAL_LIN_SendBreak()
3005 __HAL_LOCK(huart); in HAL_LIN_SendBreak()
3007 huart->gState = HAL_UART_STATE_BUSY; in HAL_LIN_SendBreak()
3010 __HAL_UART_SEND_REQ(huart, UART_SENDBREAK_REQUEST); in HAL_LIN_SendBreak()
3012 huart->gState = HAL_UART_STATE_READY; in HAL_LIN_SendBreak()
3014 __HAL_UNLOCK(huart); in HAL_LIN_SendBreak()
3045 HAL_UART_StateTypeDef HAL_UART_GetState(const UART_HandleTypeDef *huart) in HAL_UART_GetState() argument
3049 temp1 = huart->gState; in HAL_UART_GetState()
3050 temp2 = huart->RxState; in HAL_UART_GetState()
3061 uint32_t HAL_UART_GetError(const UART_HandleTypeDef *huart) in HAL_UART_GetError() argument
3063 return huart->ErrorCode; in HAL_UART_GetError()
3083 void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart) in UART_InitCallbacksToDefault() argument
3086huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCa… in UART_InitCallbacksToDefault()
3087huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallba… in UART_InitCallbacksToDefault()
3088huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCa… in UART_InitCallbacksToDefault()
3089huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallba… in UART_InitCallbacksToDefault()
3090huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallbac… in UART_InitCallbacksToDefault()
3091huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCal… in UART_InitCallbacksToDefault()
3092huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak AbortTransmi… in UART_InitCallbacksToDefault()
3093huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak AbortReceive… in UART_InitCallbacksToDefault()
3094huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallba… in UART_InitCallbacksToDefault()
3095huart->RxFifoFullCallback = HAL_UARTEx_RxFifoFullCallback; /* Legacy weak RxFifoFullCa… in UART_InitCallbacksToDefault()
3096huart->TxFifoEmptyCallback = HAL_UARTEx_TxFifoEmptyCallback; /* Legacy weak TxFifoEmptyC… in UART_InitCallbacksToDefault()
3097huart->RxEventCallback = HAL_UARTEx_RxEventCallback; /* Legacy weak RxEventCallb… in UART_InitCallbacksToDefault()
3107 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart) in UART_SetConfig() argument
3120 assert_param(IS_UART_BAUDRATE(huart->Init.BaudRate)); in UART_SetConfig()
3121 assert_param(IS_UART_WORD_LENGTH(huart->Init.WordLength)); in UART_SetConfig()
3123 if (UART_INSTANCE_LOWPOWER(huart)) in UART_SetConfig()
3125 assert_param(IS_LPUART_STOPBITS(huart->Init.StopBits)); in UART_SetConfig()
3129 assert_param(IS_UART_STOPBITS(huart->Init.StopBits)); in UART_SetConfig()
3130 assert_param(IS_UART_ONE_BIT_SAMPLE(huart->Init.OneBitSampling)); in UART_SetConfig()
3133 assert_param(IS_UART_STOPBITS(huart->Init.StopBits)); in UART_SetConfig()
3134 assert_param(IS_UART_ONE_BIT_SAMPLE(huart->Init.OneBitSampling)); in UART_SetConfig()
3137 assert_param(IS_UART_PARITY(huart->Init.Parity)); in UART_SetConfig()
3138 assert_param(IS_UART_MODE(huart->Init.Mode)); in UART_SetConfig()
3139 assert_param(IS_UART_HARDWARE_FLOW_CONTROL(huart->Init.HwFlowCtl)); in UART_SetConfig()
3140 assert_param(IS_UART_OVERSAMPLING(huart->Init.OverSampling)); in UART_SetConfig()
3141 assert_param(IS_UART_PRESCALER(huart->Init.ClockPrescaler)); in UART_SetConfig()
3150 …tmpreg = (uint32_t)huart->Init.WordLength | huart->Init.Parity | huart->Init.Mode | huart->Init.Ov… in UART_SetConfig()
3151 MODIFY_REG(huart->Instance->CR1, USART_CR1_FIELDS, tmpreg); in UART_SetConfig()
3156 MODIFY_REG(huart->Instance->CR2, USART_CR2_STOP, huart->Init.StopBits); in UART_SetConfig()
3164 tmpreg = (uint32_t)huart->Init.HwFlowCtl; in UART_SetConfig()
3167 if (!(UART_INSTANCE_LOWPOWER(huart))) in UART_SetConfig()
3169 tmpreg |= huart->Init.OneBitSampling; in UART_SetConfig()
3172 tmpreg |= huart->Init.OneBitSampling; in UART_SetConfig()
3174 MODIFY_REG(huart->Instance->CR3, USART_CR3_FIELDS, tmpreg); in UART_SetConfig()
3179 MODIFY_REG(huart->Instance->PRESC, USART_PRESC_PRESCALER, huart->Init.ClockPrescaler); in UART_SetConfig()
3182 UART_GETCLOCKSOURCE(huart, clocksource); in UART_SetConfig()
3186 if (UART_INSTANCE_LOWPOWER(huart)) in UART_SetConfig()
3213 lpuart_ker_ck_pres = (pclk / UARTPrescTable[huart->Init.ClockPrescaler]); in UART_SetConfig()
3216 if ((lpuart_ker_ck_pres < (3U * huart->Init.BaudRate)) || in UART_SetConfig()
3217 (lpuart_ker_ck_pres > (4096U * huart->Init.BaudRate))) in UART_SetConfig()
3225 … usartdiv = (uint32_t)(UART_DIV_LPUART(pclk, huart->Init.BaudRate, huart->Init.ClockPrescaler)); in UART_SetConfig()
3228 huart->Instance->BRR = usartdiv; in UART_SetConfig()
3239 else if (huart->Init.OverSampling == UART_OVERSAMPLING_8) in UART_SetConfig()
3241 if (huart->Init.OverSampling == UART_OVERSAMPLING_8) in UART_SetConfig()
3267 … usartdiv = (uint32_t)(UART_DIV_SAMPLING8(pclk, huart->Init.BaudRate, huart->Init.ClockPrescaler)); in UART_SetConfig()
3272 huart->Instance->BRR = brrtemp; in UART_SetConfig()
3305 …usartdiv = (uint32_t)(UART_DIV_SAMPLING16(pclk, huart->Init.BaudRate, huart->Init.ClockPrescaler)); in UART_SetConfig()
3308 huart->Instance->BRR = (uint16_t)usartdiv; in UART_SetConfig()
3318 huart->NbTxDataToProcess = 1; in UART_SetConfig()
3319 huart->NbRxDataToProcess = 1; in UART_SetConfig()
3322 huart->RxISR = NULL; in UART_SetConfig()
3323 huart->TxISR = NULL; in UART_SetConfig()
3333 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart) in UART_AdvFeatureConfig() argument
3336 assert_param(IS_UART_ADVFEATURE_INIT(huart->AdvancedInit.AdvFeatureInit)); in UART_AdvFeatureConfig()
3339 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_SWAP_INIT)) in UART_AdvFeatureConfig()
3341 assert_param(IS_UART_ADVFEATURE_SWAP(huart->AdvancedInit.Swap)); in UART_AdvFeatureConfig()
3342 MODIFY_REG(huart->Instance->CR2, USART_CR2_SWAP, huart->AdvancedInit.Swap); in UART_AdvFeatureConfig()
3346 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_TXINVERT_INIT)) in UART_AdvFeatureConfig()
3348 assert_param(IS_UART_ADVFEATURE_TXINV(huart->AdvancedInit.TxPinLevelInvert)); in UART_AdvFeatureConfig()
3349 MODIFY_REG(huart->Instance->CR2, USART_CR2_TXINV, huart->AdvancedInit.TxPinLevelInvert); in UART_AdvFeatureConfig()
3353 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXINVERT_INIT)) in UART_AdvFeatureConfig()
3355 assert_param(IS_UART_ADVFEATURE_RXINV(huart->AdvancedInit.RxPinLevelInvert)); in UART_AdvFeatureConfig()
3356 MODIFY_REG(huart->Instance->CR2, USART_CR2_RXINV, huart->AdvancedInit.RxPinLevelInvert); in UART_AdvFeatureConfig()
3360 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DATAINVERT_INIT)) in UART_AdvFeatureConfig()
3362 assert_param(IS_UART_ADVFEATURE_DATAINV(huart->AdvancedInit.DataInvert)); in UART_AdvFeatureConfig()
3363 MODIFY_REG(huart->Instance->CR2, USART_CR2_DATAINV, huart->AdvancedInit.DataInvert); in UART_AdvFeatureConfig()
3367 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXOVERRUNDISABLE_INIT)) in UART_AdvFeatureConfig()
3369 assert_param(IS_UART_OVERRUN(huart->AdvancedInit.OverrunDisable)); in UART_AdvFeatureConfig()
3370 MODIFY_REG(huart->Instance->CR3, USART_CR3_OVRDIS, huart->AdvancedInit.OverrunDisable); in UART_AdvFeatureConfig()
3374 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DMADISABLEONERROR_INIT)) in UART_AdvFeatureConfig()
3376 assert_param(IS_UART_ADVFEATURE_DMAONRXERROR(huart->AdvancedInit.DMADisableonRxError)); in UART_AdvFeatureConfig()
3377 MODIFY_REG(huart->Instance->CR3, USART_CR3_DDRE, huart->AdvancedInit.DMADisableonRxError); in UART_AdvFeatureConfig()
3381 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_AUTOBAUDRATE_INIT)) in UART_AdvFeatureConfig()
3383 assert_param(IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(huart->Instance)); in UART_AdvFeatureConfig()
3384 assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATE(huart->AdvancedInit.AutoBaudRateEnable)); in UART_AdvFeatureConfig()
3385 MODIFY_REG(huart->Instance->CR2, USART_CR2_ABREN, huart->AdvancedInit.AutoBaudRateEnable); in UART_AdvFeatureConfig()
3387 if (huart->AdvancedInit.AutoBaudRateEnable == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE) in UART_AdvFeatureConfig()
3389 assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(huart->AdvancedInit.AutoBaudRateMode)); in UART_AdvFeatureConfig()
3390 MODIFY_REG(huart->Instance->CR2, USART_CR2_ABRMODE, huart->AdvancedInit.AutoBaudRateMode); in UART_AdvFeatureConfig()
3395 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_MSBFIRST_INIT)) in UART_AdvFeatureConfig()
3397 assert_param(IS_UART_ADVFEATURE_MSBFIRST(huart->AdvancedInit.MSBFirst)); in UART_AdvFeatureConfig()
3398 MODIFY_REG(huart->Instance->CR2, USART_CR2_MSBFIRST, huart->AdvancedInit.MSBFirst); in UART_AdvFeatureConfig()
3407 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart) in UART_CheckIdleState() argument
3412 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_CheckIdleState()
3418 if ((huart->Instance->CR1 & USART_CR1_TE) == USART_CR1_TE) in UART_CheckIdleState()
3421 …if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_TEACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) … in UART_CheckIdleState()
3424 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE_TXFNFIE)); in UART_CheckIdleState()
3426 huart->gState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3428 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3436 if ((huart->Instance->CR1 & USART_CR1_RE) == USART_CR1_RE) in UART_CheckIdleState()
3439 …if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_REACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) … in UART_CheckIdleState()
3443 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE)); in UART_CheckIdleState()
3444 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_CheckIdleState()
3446 huart->RxState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3448 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3456 huart->gState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3457 huart->RxState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3458 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_CheckIdleState()
3459 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_CheckIdleState()
3461 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3476 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus … in UART_WaitOnFlagUntilTimeout() argument
3480 while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status) in UART_WaitOnFlagUntilTimeout()
3491 …if ((READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) && (Flag != UART_FLAG_TXE) && (Flag != UA… in UART_WaitOnFlagUntilTimeout()
3493 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) == SET) in UART_WaitOnFlagUntilTimeout()
3496 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in UART_WaitOnFlagUntilTimeout()
3501 UART_EndRxTransfer(huart); in UART_WaitOnFlagUntilTimeout()
3503 huart->ErrorCode = HAL_UART_ERROR_ORE; in UART_WaitOnFlagUntilTimeout()
3506 __HAL_UNLOCK(huart); in UART_WaitOnFlagUntilTimeout()
3510 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RTOF) == SET) in UART_WaitOnFlagUntilTimeout()
3513 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); in UART_WaitOnFlagUntilTimeout()
3518 UART_EndRxTransfer(huart); in UART_WaitOnFlagUntilTimeout()
3520 huart->ErrorCode = HAL_UART_ERROR_RTO; in UART_WaitOnFlagUntilTimeout()
3523 __HAL_UNLOCK(huart); in UART_WaitOnFlagUntilTimeout()
3544 HAL_StatusTypeDef UART_Start_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in UART_Start_Receive_IT() argument
3546 huart->pRxBuffPtr = pData; in UART_Start_Receive_IT()
3547 huart->RxXferSize = Size; in UART_Start_Receive_IT()
3548 huart->RxXferCount = Size; in UART_Start_Receive_IT()
3549 huart->RxISR = NULL; in UART_Start_Receive_IT()
3552 UART_MASK_COMPUTATION(huart); in UART_Start_Receive_IT()
3554 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_Start_Receive_IT()
3555 huart->RxState = HAL_UART_STATE_BUSY_RX; in UART_Start_Receive_IT()
3558 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_Start_Receive_IT()
3561 if ((huart->FifoMode == UART_FIFOMODE_ENABLE) && (Size >= huart->NbRxDataToProcess)) in UART_Start_Receive_IT()
3564 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in UART_Start_Receive_IT()
3566 huart->RxISR = UART_RxISR_16BIT_FIFOEN; in UART_Start_Receive_IT()
3570 huart->RxISR = UART_RxISR_8BIT_FIFOEN; in UART_Start_Receive_IT()
3574 if (huart->Init.Parity != UART_PARITY_NONE) in UART_Start_Receive_IT()
3576 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_Start_Receive_IT()
3578 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_RXFTIE); in UART_Start_Receive_IT()
3583 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in UART_Start_Receive_IT()
3585 huart->RxISR = UART_RxISR_16BIT; in UART_Start_Receive_IT()
3589 huart->RxISR = UART_RxISR_8BIT; in UART_Start_Receive_IT()
3593 if (huart->Init.Parity != UART_PARITY_NONE) in UART_Start_Receive_IT()
3595 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE | USART_CR1_RXNEIE_RXFNEIE); in UART_Start_Receive_IT()
3599 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RXNEIE_RXFNEIE); in UART_Start_Receive_IT()
3616 HAL_StatusTypeDef UART_Start_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in UART_Start_Receive_DMA() argument
3618 huart->pRxBuffPtr = pData; in UART_Start_Receive_DMA()
3619 huart->RxXferSize = Size; in UART_Start_Receive_DMA()
3621 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_Start_Receive_DMA()
3622 huart->RxState = HAL_UART_STATE_BUSY_RX; in UART_Start_Receive_DMA()
3624 if (huart->hdmarx != NULL) in UART_Start_Receive_DMA()
3627 huart->hdmarx->XferCpltCallback = UART_DMAReceiveCplt; in UART_Start_Receive_DMA()
3630 huart->hdmarx->XferHalfCpltCallback = UART_DMARxHalfCplt; in UART_Start_Receive_DMA()
3633 huart->hdmarx->XferErrorCallback = UART_DMAError; in UART_Start_Receive_DMA()
3636 huart->hdmarx->XferAbortCallback = NULL; in UART_Start_Receive_DMA()
3639 …if (HAL_DMA_Start_IT(huart->hdmarx, (uint32_t)&huart->Instance->RDR, (uint32_t)huart->pRxBuffPtr, … in UART_Start_Receive_DMA()
3642 huart->ErrorCode = HAL_UART_ERROR_DMA; in UART_Start_Receive_DMA()
3645 huart->RxState = HAL_UART_STATE_READY; in UART_Start_Receive_DMA()
3652 if (huart->Init.Parity != UART_PARITY_NONE) in UART_Start_Receive_DMA()
3654 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_Start_Receive_DMA()
3658 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_Start_Receive_DMA()
3662 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); in UART_Start_Receive_DMA()
3673 static void UART_EndTxTransfer(UART_HandleTypeDef *huart) in UART_EndTxTransfer() argument
3676 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE_TXFNFIE | USART_CR1_TCIE)); in UART_EndTxTransfer()
3677 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_TXFTIE)); in UART_EndTxTransfer()
3680 huart->gState = HAL_UART_STATE_READY; in UART_EndTxTransfer()
3689 static void UART_EndRxTransfer(UART_HandleTypeDef *huart) in UART_EndRxTransfer() argument
3692 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE)); in UART_EndRxTransfer()
3693 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE)); in UART_EndRxTransfer()
3696 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_EndRxTransfer()
3698 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_EndRxTransfer()
3702 huart->RxState = HAL_UART_STATE_READY; in UART_EndRxTransfer()
3703 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_EndRxTransfer()
3706 huart->RxISR = NULL; in UART_EndRxTransfer()
3717 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATransmitCplt() local
3722 huart->TxXferCount = 0U; in UART_DMATransmitCplt()
3726 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in UART_DMATransmitCplt()
3729 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_DMATransmitCplt()
3736 huart->TxCpltCallback(huart); in UART_DMATransmitCplt()
3739 HAL_UART_TxCpltCallback(huart); in UART_DMATransmitCplt()
3751 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxHalfCplt() local
3755 huart->TxHalfCpltCallback(huart); in UART_DMATxHalfCplt()
3758 HAL_UART_TxHalfCpltCallback(huart); in UART_DMATxHalfCplt()
3769 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAReceiveCplt() local
3774 huart->RxXferCount = 0U; in UART_DMAReceiveCplt()
3777 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_DMAReceiveCplt()
3778 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_DMAReceiveCplt()
3782 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in UART_DMAReceiveCplt()
3785 huart->RxState = HAL_UART_STATE_READY; in UART_DMAReceiveCplt()
3788 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMAReceiveCplt()
3790 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_DMAReceiveCplt()
3796 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_DMAReceiveCplt()
3800 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMAReceiveCplt()
3804 huart->RxEventCallback(huart, huart->RxXferSize); in UART_DMAReceiveCplt()
3807 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_DMAReceiveCplt()
3815 huart->RxCpltCallback(huart); in UART_DMAReceiveCplt()
3818 HAL_UART_RxCpltCallback(huart); in UART_DMAReceiveCplt()
3830 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMARxHalfCplt() local
3834 huart->RxEventType = HAL_UART_RXEVENT_HT; in UART_DMARxHalfCplt()
3838 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMARxHalfCplt()
3842 huart->RxEventCallback(huart, huart->RxXferSize / 2U); in UART_DMARxHalfCplt()
3845 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize / 2U); in UART_DMARxHalfCplt()
3853 huart->RxHalfCpltCallback(huart); in UART_DMARxHalfCplt()
3856 HAL_UART_RxHalfCpltCallback(huart); in UART_DMARxHalfCplt()
3868 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAError() local
3870 const HAL_UART_StateTypeDef gstate = huart->gState; in UART_DMAError()
3871 const HAL_UART_StateTypeDef rxstate = huart->RxState; in UART_DMAError()
3874 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in UART_DMAError()
3877 huart->TxXferCount = 0U; in UART_DMAError()
3878 UART_EndTxTransfer(huart); in UART_DMAError()
3882 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in UART_DMAError()
3885 huart->RxXferCount = 0U; in UART_DMAError()
3886 UART_EndRxTransfer(huart); in UART_DMAError()
3889 huart->ErrorCode |= HAL_UART_ERROR_DMA; in UART_DMAError()
3893 huart->ErrorCallback(huart); in UART_DMAError()
3896 HAL_UART_ErrorCallback(huart); in UART_DMAError()
3908 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAAbortOnError() local
3909 huart->RxXferCount = 0U; in UART_DMAAbortOnError()
3910 huart->TxXferCount = 0U; in UART_DMAAbortOnError()
3914 huart->ErrorCallback(huart); in UART_DMAAbortOnError()
3917 HAL_UART_ErrorCallback(huart); in UART_DMAAbortOnError()
3931 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxAbortCallback() local
3933 huart->hdmatx->XferAbortCallback = NULL; in UART_DMATxAbortCallback()
3936 if (huart->hdmarx != NULL) in UART_DMATxAbortCallback()
3938 if (huart->hdmarx->XferAbortCallback != NULL) in UART_DMATxAbortCallback()
3945 huart->TxXferCount = 0U; in UART_DMATxAbortCallback()
3946 huart->RxXferCount = 0U; in UART_DMATxAbortCallback()
3949 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_DMATxAbortCallback()
3952 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMATxAbortCallback()
3955 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in UART_DMATxAbortCallback()
3957 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in UART_DMATxAbortCallback()
3961 huart->gState = HAL_UART_STATE_READY; in UART_DMATxAbortCallback()
3962 huart->RxState = HAL_UART_STATE_READY; in UART_DMATxAbortCallback()
3963 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMATxAbortCallback()
3968 huart->AbortCpltCallback(huart); in UART_DMATxAbortCallback()
3971 HAL_UART_AbortCpltCallback(huart); in UART_DMATxAbortCallback()
3986 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMARxAbortCallback() local
3988 huart->hdmarx->XferAbortCallback = NULL; in UART_DMARxAbortCallback()
3991 if (huart->hdmatx != NULL) in UART_DMARxAbortCallback()
3993 if (huart->hdmatx->XferAbortCallback != NULL) in UART_DMARxAbortCallback()
4000 huart->TxXferCount = 0U; in UART_DMARxAbortCallback()
4001 huart->RxXferCount = 0U; in UART_DMARxAbortCallback()
4004 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_DMARxAbortCallback()
4007 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMARxAbortCallback()
4010 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_DMARxAbortCallback()
4013 huart->gState = HAL_UART_STATE_READY; in UART_DMARxAbortCallback()
4014 huart->RxState = HAL_UART_STATE_READY; in UART_DMARxAbortCallback()
4015 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMARxAbortCallback()
4020 huart->AbortCpltCallback(huart); in UART_DMARxAbortCallback()
4023 HAL_UART_AbortCpltCallback(huart); in UART_DMARxAbortCallback()
4038 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxOnlyAbortCallback() local
4040 huart->TxXferCount = 0U; in UART_DMATxOnlyAbortCallback()
4043 if (huart->FifoMode == UART_FIFOMODE_ENABLE) in UART_DMATxOnlyAbortCallback()
4045 __HAL_UART_SEND_REQ(huart, UART_TXDATA_FLUSH_REQUEST); in UART_DMATxOnlyAbortCallback()
4049 huart->gState = HAL_UART_STATE_READY; in UART_DMATxOnlyAbortCallback()
4054 huart->AbortTransmitCpltCallback(huart); in UART_DMATxOnlyAbortCallback()
4057 HAL_UART_AbortTransmitCpltCallback(huart); in UART_DMATxOnlyAbortCallback()
4071 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; in UART_DMARxOnlyAbortCallback() local
4073 huart->RxXferCount = 0U; in UART_DMARxOnlyAbortCallback()
4076 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMARxOnlyAbortCallback()
4079 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_DMARxOnlyAbortCallback()
4082 huart->RxState = HAL_UART_STATE_READY; in UART_DMARxOnlyAbortCallback()
4083 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMARxOnlyAbortCallback()
4088 huart->AbortReceiveCpltCallback(huart); in UART_DMARxOnlyAbortCallback()
4091 HAL_UART_AbortReceiveCpltCallback(huart); in UART_DMARxOnlyAbortCallback()
4102 static void UART_TxISR_8BIT(UART_HandleTypeDef *huart) in UART_TxISR_8BIT() argument
4105 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_8BIT()
4107 if (huart->TxXferCount == 0U) in UART_TxISR_8BIT()
4110 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE_TXFNFIE); in UART_TxISR_8BIT()
4113 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_8BIT()
4117 huart->Instance->TDR = (uint8_t)(*huart->pTxBuffPtr & (uint8_t)0xFF); in UART_TxISR_8BIT()
4118 huart->pTxBuffPtr++; in UART_TxISR_8BIT()
4119 huart->TxXferCount--; in UART_TxISR_8BIT()
4131 static void UART_TxISR_16BIT(UART_HandleTypeDef *huart) in UART_TxISR_16BIT() argument
4136 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_16BIT()
4138 if (huart->TxXferCount == 0U) in UART_TxISR_16BIT()
4141 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE_TXFNFIE); in UART_TxISR_16BIT()
4144 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_16BIT()
4148 tmp = (const uint16_t *) huart->pTxBuffPtr; in UART_TxISR_16BIT()
4149 huart->Instance->TDR = (((uint32_t)(*tmp)) & 0x01FFUL); in UART_TxISR_16BIT()
4150 huart->pTxBuffPtr += 2U; in UART_TxISR_16BIT()
4151 huart->TxXferCount--; in UART_TxISR_16BIT()
4163 static void UART_TxISR_8BIT_FIFOEN(UART_HandleTypeDef *huart) in UART_TxISR_8BIT_FIFOEN() argument
4168 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_8BIT_FIFOEN()
4170 for (nb_tx_data = huart->NbTxDataToProcess ; nb_tx_data > 0U ; nb_tx_data--) in UART_TxISR_8BIT_FIFOEN()
4172 if (huart->TxXferCount == 0U) in UART_TxISR_8BIT_FIFOEN()
4175 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_TXFTIE); in UART_TxISR_8BIT_FIFOEN()
4178 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_8BIT_FIFOEN()
4182 else if (READ_BIT(huart->Instance->ISR, USART_ISR_TXE_TXFNF) != 0U) in UART_TxISR_8BIT_FIFOEN()
4184 huart->Instance->TDR = (uint8_t)(*huart->pTxBuffPtr & (uint8_t)0xFF); in UART_TxISR_8BIT_FIFOEN()
4185 huart->pTxBuffPtr++; in UART_TxISR_8BIT_FIFOEN()
4186 huart->TxXferCount--; in UART_TxISR_8BIT_FIFOEN()
4203 static void UART_TxISR_16BIT_FIFOEN(UART_HandleTypeDef *huart) in UART_TxISR_16BIT_FIFOEN() argument
4209 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_16BIT_FIFOEN()
4211 for (nb_tx_data = huart->NbTxDataToProcess ; nb_tx_data > 0U ; nb_tx_data--) in UART_TxISR_16BIT_FIFOEN()
4213 if (huart->TxXferCount == 0U) in UART_TxISR_16BIT_FIFOEN()
4216 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_TXFTIE); in UART_TxISR_16BIT_FIFOEN()
4219 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_16BIT_FIFOEN()
4223 else if (READ_BIT(huart->Instance->ISR, USART_ISR_TXE_TXFNF) != 0U) in UART_TxISR_16BIT_FIFOEN()
4225 tmp = (const uint16_t *) huart->pTxBuffPtr; in UART_TxISR_16BIT_FIFOEN()
4226 huart->Instance->TDR = (((uint32_t)(*tmp)) & 0x01FFUL); in UART_TxISR_16BIT_FIFOEN()
4227 huart->pTxBuffPtr += 2U; in UART_TxISR_16BIT_FIFOEN()
4228 huart->TxXferCount--; in UART_TxISR_16BIT_FIFOEN()
4244 static void UART_EndTransmit_IT(UART_HandleTypeDef *huart) in UART_EndTransmit_IT() argument
4247 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_EndTransmit_IT()
4250 huart->gState = HAL_UART_STATE_READY; in UART_EndTransmit_IT()
4253 huart->TxISR = NULL; in UART_EndTransmit_IT()
4257 huart->TxCpltCallback(huart); in UART_EndTransmit_IT()
4260 HAL_UART_TxCpltCallback(huart); in UART_EndTransmit_IT()
4269 static void UART_RxISR_8BIT(UART_HandleTypeDef *huart) in UART_RxISR_8BIT() argument
4271 uint16_t uhMask = huart->Mask; in UART_RxISR_8BIT()
4275 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_8BIT()
4277 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_8BIT()
4278 *huart->pRxBuffPtr = (uint8_t)(uhdata & (uint8_t)uhMask); in UART_RxISR_8BIT()
4279 huart->pRxBuffPtr++; in UART_RxISR_8BIT()
4280 huart->RxXferCount--; in UART_RxISR_8BIT()
4282 if (huart->RxXferCount == 0U) in UART_RxISR_8BIT()
4285 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE)); in UART_RxISR_8BIT()
4288 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_RxISR_8BIT()
4291 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_8BIT()
4294 huart->RxISR = NULL; in UART_RxISR_8BIT()
4297 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_8BIT()
4300 if (!(IS_LPUART_INSTANCE(huart->Instance))) in UART_RxISR_8BIT()
4303 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_8BIT()
4306 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_8BIT()
4311 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_8BIT()
4314 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_8BIT()
4320 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_8BIT()
4323 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_8BIT()
4326 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_8BIT()
4328 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_8BIT()
4331 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_8BIT()
4336 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT()
4339 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT()
4347 huart->RxCpltCallback(huart); in UART_RxISR_8BIT()
4350 HAL_UART_RxCpltCallback(huart); in UART_RxISR_8BIT()
4358 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_8BIT()
4369 static void UART_RxISR_16BIT(UART_HandleTypeDef *huart) in UART_RxISR_16BIT() argument
4372 uint16_t uhMask = huart->Mask; in UART_RxISR_16BIT()
4376 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_16BIT()
4378 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_16BIT()
4379 tmp = (uint16_t *) huart->pRxBuffPtr ; in UART_RxISR_16BIT()
4381 huart->pRxBuffPtr += 2U; in UART_RxISR_16BIT()
4382 huart->RxXferCount--; in UART_RxISR_16BIT()
4384 if (huart->RxXferCount == 0U) in UART_RxISR_16BIT()
4387 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE_RXFNEIE | USART_CR1_PEIE)); in UART_RxISR_16BIT()
4390 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_RxISR_16BIT()
4393 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_16BIT()
4396 huart->RxISR = NULL; in UART_RxISR_16BIT()
4399 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_16BIT()
4402 if (!(IS_LPUART_INSTANCE(huart->Instance))) in UART_RxISR_16BIT()
4405 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_16BIT()
4408 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_16BIT()
4413 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_16BIT()
4416 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_16BIT()
4422 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_16BIT()
4425 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_16BIT()
4428 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_16BIT()
4430 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_16BIT()
4433 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_16BIT()
4438 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT()
4441 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT()
4449 huart->RxCpltCallback(huart); in UART_RxISR_16BIT()
4452 HAL_UART_RxCpltCallback(huart); in UART_RxISR_16BIT()
4460 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_16BIT()
4471 static void UART_RxISR_8BIT_FIFOEN(UART_HandleTypeDef *huart) in UART_RxISR_8BIT_FIFOEN() argument
4473 uint16_t uhMask = huart->Mask; in UART_RxISR_8BIT_FIFOEN()
4477 uint32_t isrflags = READ_REG(huart->Instance->ISR); in UART_RxISR_8BIT_FIFOEN()
4478 uint32_t cr1its = READ_REG(huart->Instance->CR1); in UART_RxISR_8BIT_FIFOEN()
4479 uint32_t cr3its = READ_REG(huart->Instance->CR3); in UART_RxISR_8BIT_FIFOEN()
4482 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_8BIT_FIFOEN()
4484 nb_rx_data = huart->NbRxDataToProcess; in UART_RxISR_8BIT_FIFOEN()
4487 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_8BIT_FIFOEN()
4488 *huart->pRxBuffPtr = (uint8_t)(uhdata & (uint8_t)uhMask); in UART_RxISR_8BIT_FIFOEN()
4489 huart->pRxBuffPtr++; in UART_RxISR_8BIT_FIFOEN()
4490 huart->RxXferCount--; in UART_RxISR_8BIT_FIFOEN()
4491 isrflags = READ_REG(huart->Instance->ISR); in UART_RxISR_8BIT_FIFOEN()
4499 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_PEF); in UART_RxISR_8BIT_FIFOEN()
4501 huart->ErrorCode |= HAL_UART_ERROR_PE; in UART_RxISR_8BIT_FIFOEN()
4507 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_FEF); in UART_RxISR_8BIT_FIFOEN()
4509 huart->ErrorCode |= HAL_UART_ERROR_FE; in UART_RxISR_8BIT_FIFOEN()
4515 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_NEF); in UART_RxISR_8BIT_FIFOEN()
4517 huart->ErrorCode |= HAL_UART_ERROR_NE; in UART_RxISR_8BIT_FIFOEN()
4521 if (huart->ErrorCode != HAL_UART_ERROR_NONE) in UART_RxISR_8BIT_FIFOEN()
4527 huart->ErrorCallback(huart); in UART_RxISR_8BIT_FIFOEN()
4530 HAL_UART_ErrorCallback(huart); in UART_RxISR_8BIT_FIFOEN()
4532 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_RxISR_8BIT_FIFOEN()
4536 if (huart->RxXferCount == 0U) in UART_RxISR_8BIT_FIFOEN()
4539 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_RxISR_8BIT_FIFOEN()
4543 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE)); in UART_RxISR_8BIT_FIFOEN()
4546 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_8BIT_FIFOEN()
4549 huart->RxISR = NULL; in UART_RxISR_8BIT_FIFOEN()
4552 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_8BIT_FIFOEN()
4555 if (!(IS_LPUART_INSTANCE(huart->Instance))) in UART_RxISR_8BIT_FIFOEN()
4558 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_8BIT_FIFOEN()
4561 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_8BIT_FIFOEN()
4566 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_8BIT_FIFOEN()
4569 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_8BIT_FIFOEN()
4575 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_8BIT_FIFOEN()
4578 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_8BIT_FIFOEN()
4581 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_8BIT_FIFOEN()
4583 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_8BIT_FIFOEN()
4586 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_8BIT_FIFOEN()
4591 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT_FIFOEN()
4594 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT_FIFOEN()
4602 huart->RxCpltCallback(huart); in UART_RxISR_8BIT_FIFOEN()
4605 HAL_UART_RxCpltCallback(huart); in UART_RxISR_8BIT_FIFOEN()
4615 rxdatacount = huart->RxXferCount; in UART_RxISR_8BIT_FIFOEN()
4616 if ((rxdatacount != 0U) && (rxdatacount < huart->NbRxDataToProcess)) in UART_RxISR_8BIT_FIFOEN()
4619 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_RXFTIE); in UART_RxISR_8BIT_FIFOEN()
4622 huart->RxISR = UART_RxISR_8BIT; in UART_RxISR_8BIT_FIFOEN()
4625 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RXNEIE_RXFNEIE); in UART_RxISR_8BIT_FIFOEN()
4631 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_8BIT_FIFOEN()
4642 static void UART_RxISR_16BIT_FIFOEN(UART_HandleTypeDef *huart) in UART_RxISR_16BIT_FIFOEN() argument
4645 uint16_t uhMask = huart->Mask; in UART_RxISR_16BIT_FIFOEN()
4649 uint32_t isrflags = READ_REG(huart->Instance->ISR); in UART_RxISR_16BIT_FIFOEN()
4650 uint32_t cr1its = READ_REG(huart->Instance->CR1); in UART_RxISR_16BIT_FIFOEN()
4651 uint32_t cr3its = READ_REG(huart->Instance->CR3); in UART_RxISR_16BIT_FIFOEN()
4654 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_16BIT_FIFOEN()
4656 nb_rx_data = huart->NbRxDataToProcess; in UART_RxISR_16BIT_FIFOEN()
4659 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_16BIT_FIFOEN()
4660 tmp = (uint16_t *) huart->pRxBuffPtr ; in UART_RxISR_16BIT_FIFOEN()
4662 huart->pRxBuffPtr += 2U; in UART_RxISR_16BIT_FIFOEN()
4663 huart->RxXferCount--; in UART_RxISR_16BIT_FIFOEN()
4664 isrflags = READ_REG(huart->Instance->ISR); in UART_RxISR_16BIT_FIFOEN()
4672 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_PEF); in UART_RxISR_16BIT_FIFOEN()
4674 huart->ErrorCode |= HAL_UART_ERROR_PE; in UART_RxISR_16BIT_FIFOEN()
4680 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_FEF); in UART_RxISR_16BIT_FIFOEN()
4682 huart->ErrorCode |= HAL_UART_ERROR_FE; in UART_RxISR_16BIT_FIFOEN()
4688 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_NEF); in UART_RxISR_16BIT_FIFOEN()
4690 huart->ErrorCode |= HAL_UART_ERROR_NE; in UART_RxISR_16BIT_FIFOEN()
4694 if (huart->ErrorCode != HAL_UART_ERROR_NONE) in UART_RxISR_16BIT_FIFOEN()
4700 huart->ErrorCallback(huart); in UART_RxISR_16BIT_FIFOEN()
4703 HAL_UART_ErrorCallback(huart); in UART_RxISR_16BIT_FIFOEN()
4705 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_RxISR_16BIT_FIFOEN()
4709 if (huart->RxXferCount == 0U) in UART_RxISR_16BIT_FIFOEN()
4712 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_RxISR_16BIT_FIFOEN()
4716 ATOMIC_CLEAR_BIT(huart->Instance->CR3, (USART_CR3_EIE | USART_CR3_RXFTIE)); in UART_RxISR_16BIT_FIFOEN()
4719 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_16BIT_FIFOEN()
4722 huart->RxISR = NULL; in UART_RxISR_16BIT_FIFOEN()
4725 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_16BIT_FIFOEN()
4728 if (!(IS_LPUART_INSTANCE(huart->Instance))) in UART_RxISR_16BIT_FIFOEN()
4731 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_16BIT_FIFOEN()
4734 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_16BIT_FIFOEN()
4739 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_16BIT_FIFOEN()
4742 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_16BIT_FIFOEN()
4748 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_16BIT_FIFOEN()
4751 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_16BIT_FIFOEN()
4754 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_16BIT_FIFOEN()
4756 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_16BIT_FIFOEN()
4759 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_16BIT_FIFOEN()
4764 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT_FIFOEN()
4767 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT_FIFOEN()
4775 huart->RxCpltCallback(huart); in UART_RxISR_16BIT_FIFOEN()
4778 HAL_UART_RxCpltCallback(huart); in UART_RxISR_16BIT_FIFOEN()
4788 rxdatacount = huart->RxXferCount; in UART_RxISR_16BIT_FIFOEN()
4789 if ((rxdatacount != 0U) && (rxdatacount < huart->NbRxDataToProcess)) in UART_RxISR_16BIT_FIFOEN()
4792 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_RXFTIE); in UART_RxISR_16BIT_FIFOEN()
4795 huart->RxISR = UART_RxISR_16BIT; in UART_RxISR_16BIT_FIFOEN()
4798 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RXNEIE_RXFNEIE); in UART_RxISR_16BIT_FIFOEN()
4804 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_16BIT_FIFOEN()