Lines Matching refs:huart

194 static void UART_EndRxTransfer(UART_HandleTypeDef *huart);
195 static void UART_EndTxTransfer(UART_HandleTypeDef *huart);
206 static void UART_TxISR_8BIT(UART_HandleTypeDef *huart);
207 static void UART_TxISR_16BIT(UART_HandleTypeDef *huart);
208 static void UART_EndTransmit_IT(UART_HandleTypeDef *huart);
209 static void UART_RxISR_8BIT(UART_HandleTypeDef *huart);
210 static void UART_RxISR_16BIT(UART_HandleTypeDef *huart);
289 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart) in HAL_UART_Init() argument
292 if (huart == NULL) in HAL_UART_Init()
297 if (huart->Init.HwFlowCtl != UART_HWCONTROL_NONE) in HAL_UART_Init()
300 assert_param(IS_UART_HWFLOW_INSTANCE(huart->Instance)); in HAL_UART_Init()
305 assert_param(IS_UART_INSTANCE(huart->Instance)); in HAL_UART_Init()
308 if (huart->gState == HAL_UART_STATE_RESET) in HAL_UART_Init()
311 huart->Lock = HAL_UNLOCKED; in HAL_UART_Init()
314 UART_InitCallbacksToDefault(huart); in HAL_UART_Init()
316 if (huart->MspInitCallback == NULL) in HAL_UART_Init()
318 huart->MspInitCallback = HAL_UART_MspInit; in HAL_UART_Init()
322 huart->MspInitCallback(huart); in HAL_UART_Init()
325 HAL_UART_MspInit(huart); in HAL_UART_Init()
329 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_Init()
331 __HAL_UART_DISABLE(huart); in HAL_UART_Init()
335 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_UART_Init()
337 UART_AdvFeatureConfig(huart); in HAL_UART_Init()
341 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_UART_Init()
349 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_UART_Init()
350 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); in HAL_UART_Init()
352 __HAL_UART_ENABLE(huart); in HAL_UART_Init()
355 return (UART_CheckIdleState(huart)); in HAL_UART_Init()
364 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart) in HAL_HalfDuplex_Init() argument
367 if (huart == NULL) in HAL_HalfDuplex_Init()
373 assert_param(IS_UART_HALFDUPLEX_INSTANCE(huart->Instance)); in HAL_HalfDuplex_Init()
375 if (huart->gState == HAL_UART_STATE_RESET) in HAL_HalfDuplex_Init()
378 huart->Lock = HAL_UNLOCKED; in HAL_HalfDuplex_Init()
381 UART_InitCallbacksToDefault(huart); in HAL_HalfDuplex_Init()
383 if (huart->MspInitCallback == NULL) in HAL_HalfDuplex_Init()
385 huart->MspInitCallback = HAL_UART_MspInit; in HAL_HalfDuplex_Init()
389 huart->MspInitCallback(huart); in HAL_HalfDuplex_Init()
392 HAL_UART_MspInit(huart); in HAL_HalfDuplex_Init()
396 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_Init()
398 __HAL_UART_DISABLE(huart); in HAL_HalfDuplex_Init()
402 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_HalfDuplex_Init()
404 UART_AdvFeatureConfig(huart); in HAL_HalfDuplex_Init()
408 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_HalfDuplex_Init()
416 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_HalfDuplex_Init()
417 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_IREN | USART_CR3_SCEN)); in HAL_HalfDuplex_Init()
420 SET_BIT(huart->Instance->CR3, USART_CR3_HDSEL); in HAL_HalfDuplex_Init()
422 __HAL_UART_ENABLE(huart); in HAL_HalfDuplex_Init()
425 return (UART_CheckIdleState(huart)); in HAL_HalfDuplex_Init()
439 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength) in HAL_LIN_Init() argument
442 if (huart == NULL) in HAL_LIN_Init()
448 assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); in HAL_LIN_Init()
453 if (huart->Init.OverSampling == UART_OVERSAMPLING_8) in HAL_LIN_Init()
458 if (huart->Init.WordLength != UART_WORDLENGTH_8B) in HAL_LIN_Init()
463 if (huart->gState == HAL_UART_STATE_RESET) in HAL_LIN_Init()
466 huart->Lock = HAL_UNLOCKED; in HAL_LIN_Init()
469 UART_InitCallbacksToDefault(huart); in HAL_LIN_Init()
471 if (huart->MspInitCallback == NULL) in HAL_LIN_Init()
473 huart->MspInitCallback = HAL_UART_MspInit; in HAL_LIN_Init()
477 huart->MspInitCallback(huart); in HAL_LIN_Init()
480 HAL_UART_MspInit(huart); in HAL_LIN_Init()
484 huart->gState = HAL_UART_STATE_BUSY; in HAL_LIN_Init()
486 __HAL_UART_DISABLE(huart); in HAL_LIN_Init()
490 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_LIN_Init()
492 UART_AdvFeatureConfig(huart); in HAL_LIN_Init()
496 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_LIN_Init()
504 CLEAR_BIT(huart->Instance->CR2, USART_CR2_CLKEN); in HAL_LIN_Init()
505 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_HDSEL | USART_CR3_IREN | USART_CR3_SCEN)); in HAL_LIN_Init()
508 SET_BIT(huart->Instance->CR2, USART_CR2_LINEN); in HAL_LIN_Init()
511 MODIFY_REG(huart->Instance->CR2, USART_CR2_LBDL, BreakDetectLength); in HAL_LIN_Init()
513 __HAL_UART_ENABLE(huart); in HAL_LIN_Init()
516 return (UART_CheckIdleState(huart)); in HAL_LIN_Init()
538 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t Wake… in HAL_MultiProcessor_Init() argument
541 if (huart == NULL) in HAL_MultiProcessor_Init()
549 if (huart->gState == HAL_UART_STATE_RESET) in HAL_MultiProcessor_Init()
552 huart->Lock = HAL_UNLOCKED; in HAL_MultiProcessor_Init()
555 UART_InitCallbacksToDefault(huart); in HAL_MultiProcessor_Init()
557 if (huart->MspInitCallback == NULL) in HAL_MultiProcessor_Init()
559 huart->MspInitCallback = HAL_UART_MspInit; in HAL_MultiProcessor_Init()
563 huart->MspInitCallback(huart); in HAL_MultiProcessor_Init()
566 HAL_UART_MspInit(huart); in HAL_MultiProcessor_Init()
570 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_Init()
572 __HAL_UART_DISABLE(huart); in HAL_MultiProcessor_Init()
576 if (huart->AdvancedInit.AdvFeatureInit != UART_ADVFEATURE_NO_INIT) in HAL_MultiProcessor_Init()
578 UART_AdvFeatureConfig(huart); in HAL_MultiProcessor_Init()
582 if (UART_SetConfig(huart) == HAL_ERROR) in HAL_MultiProcessor_Init()
590 CLEAR_BIT(huart->Instance->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN)); in HAL_MultiProcessor_Init()
591 CLEAR_BIT(huart->Instance->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN)); in HAL_MultiProcessor_Init()
596 … MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)Address << UART_CR2_ADDRESS_LSB_POS)); in HAL_MultiProcessor_Init()
600 MODIFY_REG(huart->Instance->CR1, USART_CR1_WAKE, WakeUpMethod); in HAL_MultiProcessor_Init()
602 __HAL_UART_ENABLE(huart); in HAL_MultiProcessor_Init()
605 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_Init()
614 HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart) in HAL_UART_DeInit() argument
617 if (huart == NULL) in HAL_UART_DeInit()
623 assert_param(IS_UART_INSTANCE(huart->Instance)); in HAL_UART_DeInit()
625 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_DeInit()
627 __HAL_UART_DISABLE(huart); in HAL_UART_DeInit()
629 huart->Instance->CR1 = 0x0U; in HAL_UART_DeInit()
630 huart->Instance->CR2 = 0x0U; in HAL_UART_DeInit()
631 huart->Instance->CR3 = 0x0U; in HAL_UART_DeInit()
634 if (huart->MspDeInitCallback == NULL) in HAL_UART_DeInit()
636 huart->MspDeInitCallback = HAL_UART_MspDeInit; in HAL_UART_DeInit()
639 huart->MspDeInitCallback(huart); in HAL_UART_DeInit()
642 HAL_UART_MspDeInit(huart); in HAL_UART_DeInit()
645 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_DeInit()
646 huart->gState = HAL_UART_STATE_RESET; in HAL_UART_DeInit()
647 huart->RxState = HAL_UART_STATE_RESET; in HAL_UART_DeInit()
648 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_DeInit()
649 huart->RxEventType = HAL_UART_RXEVENT_TC; in HAL_UART_DeInit()
651 __HAL_UNLOCK(huart); in HAL_UART_DeInit()
661 __weak void HAL_UART_MspInit(UART_HandleTypeDef *huart) in HAL_UART_MspInit() argument
664 UNUSED(huart); in HAL_UART_MspInit()
676 __weak void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) in HAL_UART_MspDeInit() argument
679 UNUSED(huart); in HAL_UART_MspDeInit()
710 HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef C… in HAL_UART_RegisterCallback() argument
717 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
722 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_RegisterCallback()
727 huart->TxHalfCpltCallback = pCallback; in HAL_UART_RegisterCallback()
731 huart->TxCpltCallback = pCallback; in HAL_UART_RegisterCallback()
735 huart->RxHalfCpltCallback = pCallback; in HAL_UART_RegisterCallback()
739 huart->RxCpltCallback = pCallback; in HAL_UART_RegisterCallback()
743 huart->ErrorCallback = pCallback; in HAL_UART_RegisterCallback()
747 huart->AbortCpltCallback = pCallback; in HAL_UART_RegisterCallback()
751 huart->AbortTransmitCpltCallback = pCallback; in HAL_UART_RegisterCallback()
755 huart->AbortReceiveCpltCallback = pCallback; in HAL_UART_RegisterCallback()
759 huart->WakeupCallback = pCallback; in HAL_UART_RegisterCallback()
764 huart->MspInitCallback = pCallback; in HAL_UART_RegisterCallback()
768 huart->MspDeInitCallback = pCallback; in HAL_UART_RegisterCallback()
772 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
778 else if (huart->gState == HAL_UART_STATE_RESET) in HAL_UART_RegisterCallback()
783 huart->MspInitCallback = pCallback; in HAL_UART_RegisterCallback()
787 huart->MspDeInitCallback = pCallback; in HAL_UART_RegisterCallback()
791 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
799 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterCallback()
829 HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef… in HAL_UART_UnRegisterCallback() argument
833 if (HAL_UART_STATE_READY == huart->gState) in HAL_UART_UnRegisterCallback()
838huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltC… in HAL_UART_UnRegisterCallback()
842huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallba… in HAL_UART_UnRegisterCallback()
846huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCa… in HAL_UART_UnRegisterCallback()
850huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallba… in HAL_UART_UnRegisterCallback()
854huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallbac… in HAL_UART_UnRegisterCallback()
858huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCal… in HAL_UART_UnRegisterCallback()
862 huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak in HAL_UART_UnRegisterCallback()
867 huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak in HAL_UART_UnRegisterCallback()
872huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallba… in HAL_UART_UnRegisterCallback()
876huart->MspInitCallback = HAL_UART_MspInit; /* Legacy weak MspInitCallb… in HAL_UART_UnRegisterCallback()
880huart->MspDeInitCallback = HAL_UART_MspDeInit; /* Legacy weak MspDeInitCal… in HAL_UART_UnRegisterCallback()
884 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
890 else if (HAL_UART_STATE_RESET == huart->gState) in HAL_UART_UnRegisterCallback()
895 huart->MspInitCallback = HAL_UART_MspInit; in HAL_UART_UnRegisterCallback()
899 huart->MspDeInitCallback = HAL_UART_MspDeInit; in HAL_UART_UnRegisterCallback()
903 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
911 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterCallback()
926 HAL_StatusTypeDef HAL_UART_RegisterRxEventCallback(UART_HandleTypeDef *huart, pUART_RxEventCallback… in HAL_UART_RegisterRxEventCallback() argument
932 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterRxEventCallback()
937 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_RegisterRxEventCallback()
939 huart->RxEventCallback = pCallback; in HAL_UART_RegisterRxEventCallback()
943 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_RegisterRxEventCallback()
957 HAL_StatusTypeDef HAL_UART_UnRegisterRxEventCallback(UART_HandleTypeDef *huart) in HAL_UART_UnRegisterRxEventCallback() argument
961 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_UnRegisterRxEventCallback()
963 huart->RxEventCallback = HAL_UARTEx_RxEventCallback; /* Legacy weak UART Rx Event Callback */ in HAL_UART_UnRegisterRxEventCallback()
967 huart->ErrorCode |= HAL_UART_ERROR_INVALID_CALLBACK; in HAL_UART_UnRegisterRxEventCallback()
1076 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Size,… in HAL_UART_Transmit() argument
1083 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit()
1090 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit()
1091 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit()
1096 huart->TxXferSize = Size; in HAL_UART_Transmit()
1097 huart->TxXferCount = Size; in HAL_UART_Transmit()
1100 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Transmit()
1111 while (huart->TxXferCount > 0U) in HAL_UART_Transmit()
1113 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Transmit()
1116 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1122 huart->Instance->TDR = (uint16_t)(*pdata16bits & 0x01FFU); in HAL_UART_Transmit()
1127 huart->Instance->TDR = (uint8_t)(*pdata8bits & 0xFFU); in HAL_UART_Transmit()
1130 huart->TxXferCount--; in HAL_UART_Transmit()
1133 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TC, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Transmit()
1135 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1141 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit()
1162 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32… in HAL_UART_Receive() argument
1170 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive()
1177 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Receive()
1178 huart->RxState = HAL_UART_STATE_BUSY_RX; in HAL_UART_Receive()
1179 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive()
1184 huart->RxXferSize = Size; in HAL_UART_Receive()
1185 huart->RxXferCount = Size; in HAL_UART_Receive()
1188 UART_MASK_COMPUTATION(huart); in HAL_UART_Receive()
1189 uhMask = huart->Mask; in HAL_UART_Receive()
1192 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Receive()
1204 while (huart->RxXferCount > 0U) in HAL_UART_Receive()
1206 if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK) in HAL_UART_Receive()
1208 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Receive()
1214 *pdata16bits = (uint16_t)(huart->Instance->RDR & uhMask); in HAL_UART_Receive()
1219 *pdata8bits = (uint8_t)(huart->Instance->RDR & (uint8_t)uhMask); in HAL_UART_Receive()
1222 huart->RxXferCount--; in HAL_UART_Receive()
1226 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Receive()
1246 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Si… in HAL_UART_Transmit_IT() argument
1249 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit_IT()
1256 huart->pTxBuffPtr = pData; in HAL_UART_Transmit_IT()
1257 huart->TxXferSize = Size; in HAL_UART_Transmit_IT()
1258 huart->TxXferCount = Size; in HAL_UART_Transmit_IT()
1259 huart->TxISR = NULL; in HAL_UART_Transmit_IT()
1261 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit_IT()
1262 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit_IT()
1265 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in HAL_UART_Transmit_IT()
1267 huart->TxISR = UART_TxISR_16BIT; in HAL_UART_Transmit_IT()
1271 huart->TxISR = UART_TxISR_8BIT; in HAL_UART_Transmit_IT()
1275 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TXEIE); in HAL_UART_Transmit_IT()
1295 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in HAL_UART_Receive_IT() argument
1298 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive_IT()
1306 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive_IT()
1309 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_IT()
1312 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_IT()
1315 return (UART_Start_Receive_IT(huart, pData, Size)); in HAL_UART_Receive_IT()
1333 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t S… in HAL_UART_Transmit_DMA() argument
1336 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_Transmit_DMA()
1343 huart->pTxBuffPtr = pData; in HAL_UART_Transmit_DMA()
1344 huart->TxXferSize = Size; in HAL_UART_Transmit_DMA()
1345 huart->TxXferCount = Size; in HAL_UART_Transmit_DMA()
1347 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Transmit_DMA()
1348 huart->gState = HAL_UART_STATE_BUSY_TX; in HAL_UART_Transmit_DMA()
1350 if (huart->hdmatx != NULL) in HAL_UART_Transmit_DMA()
1353 huart->hdmatx->XferCpltCallback = UART_DMATransmitCplt; in HAL_UART_Transmit_DMA()
1356 huart->hdmatx->XferHalfCpltCallback = UART_DMATxHalfCplt; in HAL_UART_Transmit_DMA()
1359 huart->hdmatx->XferErrorCallback = UART_DMAError; in HAL_UART_Transmit_DMA()
1362 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Transmit_DMA()
1365 …if (HAL_DMA_Start_IT(huart->hdmatx, (uint32_t)huart->pTxBuffPtr, (uint32_t)&huart->Instance->TDR, … in HAL_UART_Transmit_DMA()
1368 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Transmit_DMA()
1371 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Transmit_DMA()
1377 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_TCF); in HAL_UART_Transmit_DMA()
1381 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Transmit_DMA()
1403 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in HAL_UART_Receive_DMA() argument
1406 if (huart->RxState == HAL_UART_STATE_READY) in HAL_UART_Receive_DMA()
1414 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Receive_DMA()
1417 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in HAL_UART_Receive_DMA()
1420 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in HAL_UART_Receive_DMA()
1423 return (UART_Start_Receive_DMA(huart, pData, Size)); in HAL_UART_Receive_DMA()
1436 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart) in HAL_UART_DMAPause() argument
1438 const HAL_UART_StateTypeDef gstate = huart->gState; in HAL_UART_DMAPause()
1439 const HAL_UART_StateTypeDef rxstate = huart->RxState; in HAL_UART_DMAPause()
1441 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in HAL_UART_DMAPause()
1445 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAPause()
1447 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in HAL_UART_DMAPause()
1451 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_DMAPause()
1452 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_DMAPause()
1455 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAPause()
1466 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart) in HAL_UART_DMAResume() argument
1468 if (huart->gState == HAL_UART_STATE_BUSY_TX) in HAL_UART_DMAResume()
1471 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAResume()
1473 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in HAL_UART_DMAResume()
1476 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in HAL_UART_DMAResume()
1479 if (huart->Init.Parity != UART_PARITY_NONE) in HAL_UART_DMAResume()
1481 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_DMAResume()
1483 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_DMAResume()
1486 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAResume()
1497 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart) in HAL_UART_DMAStop() argument
1506 const HAL_UART_StateTypeDef gstate = huart->gState; in HAL_UART_DMAStop()
1507 const HAL_UART_StateTypeDef rxstate = huart->RxState; in HAL_UART_DMAStop()
1510 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in HAL_UART_DMAStop()
1513 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_DMAStop()
1516 if (huart->hdmatx != NULL) in HAL_UART_DMAStop()
1518 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_DMAStop()
1520 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_DMAStop()
1523 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_DMAStop()
1530 UART_EndTxTransfer(huart); in HAL_UART_DMAStop()
1534 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in HAL_UART_DMAStop()
1537 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_DMAStop()
1540 if (huart->hdmarx != NULL) in HAL_UART_DMAStop()
1542 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_DMAStop()
1544 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_DMAStop()
1547 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_DMAStop()
1554 UART_EndRxTransfer(huart); in HAL_UART_DMAStop()
1572 HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart) in HAL_UART_Abort() argument
1575 …ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USAR… in HAL_UART_Abort()
1576 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_Abort()
1579 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_Abort()
1581 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_Abort()
1585 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort()
1588 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Abort()
1591 if (huart->hdmatx != NULL) in HAL_UART_Abort()
1595 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort()
1597 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_Abort()
1599 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_Abort()
1602 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Abort()
1611 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort()
1614 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_Abort()
1617 if (huart->hdmarx != NULL) in HAL_UART_Abort()
1621 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort()
1623 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_Abort()
1625 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_Abort()
1628 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_Abort()
1637 huart->TxXferCount = 0U; in HAL_UART_Abort()
1638 huart->RxXferCount = 0U; in HAL_UART_Abort()
1641 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_Abort()
1645 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_Abort()
1648 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Abort()
1649 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Abort()
1650 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Abort()
1652 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Abort()
1669 HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmit() argument
1672 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); in HAL_UART_AbortTransmit()
1675 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_AbortTransmit()
1678 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_AbortTransmit()
1681 if (huart->hdmatx != NULL) in HAL_UART_AbortTransmit()
1685 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_AbortTransmit()
1687 if (HAL_DMA_Abort(huart->hdmatx) != HAL_OK) in HAL_UART_AbortTransmit()
1689 if (HAL_DMA_GetError(huart->hdmatx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_AbortTransmit()
1692 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_AbortTransmit()
1701 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit()
1705 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit()
1722 HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart) in HAL_UART_AbortReceive() argument
1725 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in HAL_UART_AbortReceive()
1726 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_AbortReceive()
1729 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_AbortReceive()
1731 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_AbortReceive()
1735 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_AbortReceive()
1738 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_AbortReceive()
1741 if (huart->hdmarx != NULL) in HAL_UART_AbortReceive()
1745 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_AbortReceive()
1747 if (HAL_DMA_Abort(huart->hdmarx) != HAL_OK) in HAL_UART_AbortReceive()
1749 if (HAL_DMA_GetError(huart->hdmarx) == HAL_DMA_ERROR_TIMEOUT) in HAL_UART_AbortReceive()
1752 huart->ErrorCode = HAL_UART_ERROR_DMA; in HAL_UART_AbortReceive()
1761 huart->RxXferCount = 0U; in HAL_UART_AbortReceive()
1764 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive()
1767 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_AbortReceive()
1770 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive()
1771 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive()
1790 HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart) in HAL_UART_Abort_IT() argument
1795 …ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE | USART_CR1_TXEIE | USAR… in HAL_UART_Abort_IT()
1796 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_Abort_IT()
1799 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_Abort_IT()
1801 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_Abort_IT()
1807 if (huart->hdmatx != NULL) in HAL_UART_Abort_IT()
1811 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort_IT()
1813 huart->hdmatx->XferAbortCallback = UART_DMATxAbortCallback; in HAL_UART_Abort_IT()
1817 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1821 if (huart->hdmarx != NULL) in HAL_UART_Abort_IT()
1825 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort_IT()
1827 huart->hdmarx->XferAbortCallback = UART_DMARxAbortCallback; in HAL_UART_Abort_IT()
1831 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1836 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_Abort_IT()
1839 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_Abort_IT()
1842 if (huart->hdmatx != NULL) in HAL_UART_Abort_IT()
1848 if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) in HAL_UART_Abort_IT()
1850 huart->hdmatx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1860 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_Abort_IT()
1863 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_Abort_IT()
1866 if (huart->hdmarx != NULL) in HAL_UART_Abort_IT()
1872 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_Abort_IT()
1874 huart->hdmarx->XferAbortCallback = NULL; in HAL_UART_Abort_IT()
1888 huart->TxXferCount = 0U; in HAL_UART_Abort_IT()
1889 huart->RxXferCount = 0U; in HAL_UART_Abort_IT()
1892 huart->RxISR = NULL; in HAL_UART_Abort_IT()
1893 huart->TxISR = NULL; in HAL_UART_Abort_IT()
1896 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_Abort_IT()
1899 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_Abort_IT()
1903 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_Abort_IT()
1906 huart->gState = HAL_UART_STATE_READY; in HAL_UART_Abort_IT()
1907 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_Abort_IT()
1908 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_Abort_IT()
1913 huart->AbortCpltCallback(huart); in HAL_UART_Abort_IT()
1916 HAL_UART_AbortCpltCallback(huart); in HAL_UART_Abort_IT()
1937 HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmit_IT() argument
1940 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); in HAL_UART_AbortTransmit_IT()
1943 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) in HAL_UART_AbortTransmit_IT()
1946 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in HAL_UART_AbortTransmit_IT()
1949 if (huart->hdmatx != NULL) in HAL_UART_AbortTransmit_IT()
1953 huart->hdmatx->XferAbortCallback = UART_DMATxOnlyAbortCallback; in HAL_UART_AbortTransmit_IT()
1956 if (HAL_DMA_Abort_IT(huart->hdmatx) != HAL_OK) in HAL_UART_AbortTransmit_IT()
1959 huart->hdmatx->XferAbortCallback(huart->hdmatx); in HAL_UART_AbortTransmit_IT()
1965 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit_IT()
1968 huart->TxISR = NULL; in HAL_UART_AbortTransmit_IT()
1971 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit_IT()
1976 huart->AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
1979 HAL_UART_AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
1986 huart->TxXferCount = 0U; in HAL_UART_AbortTransmit_IT()
1989 huart->TxISR = NULL; in HAL_UART_AbortTransmit_IT()
1993 huart->gState = HAL_UART_STATE_READY; in HAL_UART_AbortTransmit_IT()
1998 huart->AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2001 HAL_UART_AbortTransmitCpltCallback(huart); in HAL_UART_AbortTransmit_IT()
2022 HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart) in HAL_UART_AbortReceive_IT() argument
2025 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in HAL_UART_AbortReceive_IT()
2026 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_AbortReceive_IT()
2029 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_AbortReceive_IT()
2031 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_IDLEIE)); in HAL_UART_AbortReceive_IT()
2035 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_AbortReceive_IT()
2038 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_AbortReceive_IT()
2041 if (huart->hdmarx != NULL) in HAL_UART_AbortReceive_IT()
2045 huart->hdmarx->XferAbortCallback = UART_DMARxOnlyAbortCallback; in HAL_UART_AbortReceive_IT()
2048 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_AbortReceive_IT()
2051 huart->hdmarx->XferAbortCallback(huart->hdmarx); in HAL_UART_AbortReceive_IT()
2057 huart->RxXferCount = 0U; in HAL_UART_AbortReceive_IT()
2060 huart->pRxBuffPtr = NULL; in HAL_UART_AbortReceive_IT()
2063 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive_IT()
2066 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in HAL_UART_AbortReceive_IT()
2069 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive_IT()
2070 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive_IT()
2075 huart->AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2078 HAL_UART_AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2085 huart->RxXferCount = 0U; in HAL_UART_AbortReceive_IT()
2088 huart->pRxBuffPtr = NULL; in HAL_UART_AbortReceive_IT()
2091 … __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in HAL_UART_AbortReceive_IT()
2094 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_AbortReceive_IT()
2095 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_AbortReceive_IT()
2100 huart->AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2103 HAL_UART_AbortReceiveCpltCallback(huart); in HAL_UART_AbortReceive_IT()
2115 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart) in HAL_UART_IRQHandler() argument
2117 uint32_t isrflags = READ_REG(huart->Instance->ISR); in HAL_UART_IRQHandler()
2118 uint32_t cr1its = READ_REG(huart->Instance->CR1); in HAL_UART_IRQHandler()
2119 uint32_t cr3its = READ_REG(huart->Instance->CR3); in HAL_UART_IRQHandler()
2132 if (huart->RxISR != NULL) in HAL_UART_IRQHandler()
2134 huart->RxISR(huart); in HAL_UART_IRQHandler()
2148 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_PEF); in HAL_UART_IRQHandler()
2150 huart->ErrorCode |= HAL_UART_ERROR_PE; in HAL_UART_IRQHandler()
2156 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_FEF); in HAL_UART_IRQHandler()
2158 huart->ErrorCode |= HAL_UART_ERROR_FE; in HAL_UART_IRQHandler()
2164 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_NEF); in HAL_UART_IRQHandler()
2166 huart->ErrorCode |= HAL_UART_ERROR_NE; in HAL_UART_IRQHandler()
2174 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in HAL_UART_IRQHandler()
2176 huart->ErrorCode |= HAL_UART_ERROR_ORE; in HAL_UART_IRQHandler()
2182 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); in HAL_UART_IRQHandler()
2184 huart->ErrorCode |= HAL_UART_ERROR_RTO; in HAL_UART_IRQHandler()
2188 if (huart->ErrorCode != HAL_UART_ERROR_NONE) in HAL_UART_IRQHandler()
2194 if (huart->RxISR != NULL) in HAL_UART_IRQHandler()
2196 huart->RxISR(huart); in HAL_UART_IRQHandler()
2205 errorcode = huart->ErrorCode; in HAL_UART_IRQHandler()
2206 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) || in HAL_UART_IRQHandler()
2212 UART_EndRxTransfer(huart); in HAL_UART_IRQHandler()
2215 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_IRQHandler()
2218 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_IRQHandler()
2221 if (huart->hdmarx != NULL) in HAL_UART_IRQHandler()
2225 huart->hdmarx->XferAbortCallback = UART_DMAAbortOnError; in HAL_UART_IRQHandler()
2228 if (HAL_DMA_Abort_IT(huart->hdmarx) != HAL_OK) in HAL_UART_IRQHandler()
2231 huart->hdmarx->XferAbortCallback(huart->hdmarx); in HAL_UART_IRQHandler()
2239 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2242 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2252 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2255 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2265 huart->ErrorCallback(huart); in HAL_UART_IRQHandler()
2268 HAL_UART_ErrorCallback(huart); in HAL_UART_IRQHandler()
2270 huart->ErrorCode = HAL_UART_ERROR_NONE; in HAL_UART_IRQHandler()
2279 if ((huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in HAL_UART_IRQHandler()
2283 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in HAL_UART_IRQHandler()
2286 if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) in HAL_UART_IRQHandler()
2292 uint16_t nb_remaining_rx_data = (uint16_t) __HAL_DMA_GET_COUNTER(huart->hdmarx); in HAL_UART_IRQHandler()
2294 && (nb_remaining_rx_data < huart->RxXferSize)) in HAL_UART_IRQHandler()
2297 huart->RxXferCount = nb_remaining_rx_data; in HAL_UART_IRQHandler()
2300 if (huart->hdmarx->Init.Mode != DMA_CIRCULAR) in HAL_UART_IRQHandler()
2303 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in HAL_UART_IRQHandler()
2304 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_IRQHandler()
2308 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in HAL_UART_IRQHandler()
2311 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_IRQHandler()
2312 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_IRQHandler()
2314 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in HAL_UART_IRQHandler()
2317 (void)HAL_DMA_Abort(huart->hdmarx); in HAL_UART_IRQHandler()
2322 huart->RxEventType = HAL_UART_RXEVENT_IDLE; in HAL_UART_IRQHandler()
2326 huart->RxEventCallback(huart, (huart->RxXferSize - huart->RxXferCount)); in HAL_UART_IRQHandler()
2329 HAL_UARTEx_RxEventCallback(huart, (huart->RxXferSize - huart->RxXferCount)); in HAL_UART_IRQHandler()
2339 uint16_t nb_rx_data = huart->RxXferSize - huart->RxXferCount; in HAL_UART_IRQHandler()
2340 if ((huart->RxXferCount > 0U) in HAL_UART_IRQHandler()
2344 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in HAL_UART_IRQHandler()
2347 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in HAL_UART_IRQHandler()
2350 huart->RxState = HAL_UART_STATE_READY; in HAL_UART_IRQHandler()
2351 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in HAL_UART_IRQHandler()
2354 huart->RxISR = NULL; in HAL_UART_IRQHandler()
2356 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in HAL_UART_IRQHandler()
2360 huart->RxEventType = HAL_UART_RXEVENT_IDLE; in HAL_UART_IRQHandler()
2364 huart->RxEventCallback(huart, nb_rx_data); in HAL_UART_IRQHandler()
2367 HAL_UARTEx_RxEventCallback(huart, nb_rx_data); in HAL_UART_IRQHandler()
2377 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_WUF); in HAL_UART_IRQHandler()
2384 huart->WakeupCallback(huart); in HAL_UART_IRQHandler()
2387 HAL_UARTEx_WakeupCallback(huart); in HAL_UART_IRQHandler()
2396 if (huart->TxISR != NULL) in HAL_UART_IRQHandler()
2398 huart->TxISR(huart); in HAL_UART_IRQHandler()
2406 UART_EndTransmit_IT(huart); in HAL_UART_IRQHandler()
2417 __weak void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_TxCpltCallback() argument
2420 UNUSED(huart); in HAL_UART_TxCpltCallback()
2432 __weak void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_TxHalfCpltCallback() argument
2435 UNUSED(huart); in HAL_UART_TxHalfCpltCallback()
2447 __weak void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_RxCpltCallback() argument
2450 UNUSED(huart); in HAL_UART_RxCpltCallback()
2462 __weak void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_RxHalfCpltCallback() argument
2465 UNUSED(huart); in HAL_UART_RxHalfCpltCallback()
2477 __weak void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) in HAL_UART_ErrorCallback() argument
2480 UNUSED(huart); in HAL_UART_ErrorCallback()
2492 __weak void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortCpltCallback() argument
2495 UNUSED(huart); in HAL_UART_AbortCpltCallback()
2507 __weak void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortTransmitCpltCallback() argument
2510 UNUSED(huart); in HAL_UART_AbortTransmitCpltCallback()
2522 __weak void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart) in HAL_UART_AbortReceiveCpltCallback() argument
2525 UNUSED(huart); in HAL_UART_AbortReceiveCpltCallback()
2539 __weak void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) in HAL_UARTEx_RxEventCallback() argument
2542 UNUSED(huart); in HAL_UARTEx_RxEventCallback()
2587 void HAL_UART_ReceiverTimeout_Config(UART_HandleTypeDef *huart, uint32_t TimeoutValue) in HAL_UART_ReceiverTimeout_Config() argument
2590 MODIFY_REG(huart->Instance->RTOR, USART_RTOR_RTO, TimeoutValue); in HAL_UART_ReceiverTimeout_Config()
2599 HAL_StatusTypeDef HAL_UART_EnableReceiverTimeout(UART_HandleTypeDef *huart) in HAL_UART_EnableReceiverTimeout() argument
2601 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_EnableReceiverTimeout()
2604 __HAL_LOCK(huart); in HAL_UART_EnableReceiverTimeout()
2606 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_EnableReceiverTimeout()
2609 SET_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_EnableReceiverTimeout()
2611 huart->gState = HAL_UART_STATE_READY; in HAL_UART_EnableReceiverTimeout()
2614 __HAL_UNLOCK(huart); in HAL_UART_EnableReceiverTimeout()
2630 HAL_StatusTypeDef HAL_UART_DisableReceiverTimeout(UART_HandleTypeDef *huart) in HAL_UART_DisableReceiverTimeout() argument
2632 if (huart->gState == HAL_UART_STATE_READY) in HAL_UART_DisableReceiverTimeout()
2635 __HAL_LOCK(huart); in HAL_UART_DisableReceiverTimeout()
2637 huart->gState = HAL_UART_STATE_BUSY; in HAL_UART_DisableReceiverTimeout()
2640 CLEAR_BIT(huart->Instance->CR2, USART_CR2_RTOEN); in HAL_UART_DisableReceiverTimeout()
2642 huart->gState = HAL_UART_STATE_READY; in HAL_UART_DisableReceiverTimeout()
2645 __HAL_UNLOCK(huart); in HAL_UART_DisableReceiverTimeout()
2661 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_EnableMuteMode() argument
2663 __HAL_LOCK(huart); in HAL_MultiProcessor_EnableMuteMode()
2665 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_EnableMuteMode()
2668 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_MME); in HAL_MultiProcessor_EnableMuteMode()
2670 huart->gState = HAL_UART_STATE_READY; in HAL_MultiProcessor_EnableMuteMode()
2672 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_EnableMuteMode()
2681 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_DisableMuteMode() argument
2683 __HAL_LOCK(huart); in HAL_MultiProcessor_DisableMuteMode()
2685 huart->gState = HAL_UART_STATE_BUSY; in HAL_MultiProcessor_DisableMuteMode()
2688 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_MME); in HAL_MultiProcessor_DisableMuteMode()
2690 huart->gState = HAL_UART_STATE_READY; in HAL_MultiProcessor_DisableMuteMode()
2692 return (UART_CheckIdleState(huart)); in HAL_MultiProcessor_DisableMuteMode()
2701 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart) in HAL_MultiProcessor_EnterMuteMode() argument
2703 __HAL_UART_SEND_REQ(huart, UART_MUTE_MODE_REQUEST); in HAL_MultiProcessor_EnterMuteMode()
2711 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart) in HAL_HalfDuplex_EnableTransmitter() argument
2713 __HAL_LOCK(huart); in HAL_HalfDuplex_EnableTransmitter()
2714 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_EnableTransmitter()
2717 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); in HAL_HalfDuplex_EnableTransmitter()
2720 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TE); in HAL_HalfDuplex_EnableTransmitter()
2722 huart->gState = HAL_UART_STATE_READY; in HAL_HalfDuplex_EnableTransmitter()
2724 __HAL_UNLOCK(huart); in HAL_HalfDuplex_EnableTransmitter()
2734 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart) in HAL_HalfDuplex_EnableReceiver() argument
2736 __HAL_LOCK(huart); in HAL_HalfDuplex_EnableReceiver()
2737 huart->gState = HAL_UART_STATE_BUSY; in HAL_HalfDuplex_EnableReceiver()
2740 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TE | USART_CR1_RE)); in HAL_HalfDuplex_EnableReceiver()
2743 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RE); in HAL_HalfDuplex_EnableReceiver()
2745 huart->gState = HAL_UART_STATE_READY; in HAL_HalfDuplex_EnableReceiver()
2747 __HAL_UNLOCK(huart); in HAL_HalfDuplex_EnableReceiver()
2758 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart) in HAL_LIN_SendBreak() argument
2761 assert_param(IS_UART_LIN_INSTANCE(huart->Instance)); in HAL_LIN_SendBreak()
2763 __HAL_LOCK(huart); in HAL_LIN_SendBreak()
2765 huart->gState = HAL_UART_STATE_BUSY; in HAL_LIN_SendBreak()
2768 __HAL_UART_SEND_REQ(huart, UART_SENDBREAK_REQUEST); in HAL_LIN_SendBreak()
2770 huart->gState = HAL_UART_STATE_READY; in HAL_LIN_SendBreak()
2772 __HAL_UNLOCK(huart); in HAL_LIN_SendBreak()
2803 HAL_UART_StateTypeDef HAL_UART_GetState(const UART_HandleTypeDef *huart) in HAL_UART_GetState() argument
2807 temp1 = huart->gState; in HAL_UART_GetState()
2808 temp2 = huart->RxState; in HAL_UART_GetState()
2819 uint32_t HAL_UART_GetError(const UART_HandleTypeDef *huart) in HAL_UART_GetError() argument
2821 return huart->ErrorCode; in HAL_UART_GetError()
2841 void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart) in UART_InitCallbacksToDefault() argument
2844huart->TxHalfCpltCallback = HAL_UART_TxHalfCpltCallback; /* Legacy weak TxHalfCpltCa… in UART_InitCallbacksToDefault()
2845huart->TxCpltCallback = HAL_UART_TxCpltCallback; /* Legacy weak TxCpltCallba… in UART_InitCallbacksToDefault()
2846huart->RxHalfCpltCallback = HAL_UART_RxHalfCpltCallback; /* Legacy weak RxHalfCpltCa… in UART_InitCallbacksToDefault()
2847huart->RxCpltCallback = HAL_UART_RxCpltCallback; /* Legacy weak RxCpltCallba… in UART_InitCallbacksToDefault()
2848huart->ErrorCallback = HAL_UART_ErrorCallback; /* Legacy weak ErrorCallbac… in UART_InitCallbacksToDefault()
2849huart->AbortCpltCallback = HAL_UART_AbortCpltCallback; /* Legacy weak AbortCpltCal… in UART_InitCallbacksToDefault()
2850huart->AbortTransmitCpltCallback = HAL_UART_AbortTransmitCpltCallback; /* Legacy weak AbortTransmi… in UART_InitCallbacksToDefault()
2851huart->AbortReceiveCpltCallback = HAL_UART_AbortReceiveCpltCallback; /* Legacy weak AbortReceive… in UART_InitCallbacksToDefault()
2852huart->WakeupCallback = HAL_UARTEx_WakeupCallback; /* Legacy weak WakeupCallba… in UART_InitCallbacksToDefault()
2853huart->RxEventCallback = HAL_UARTEx_RxEventCallback; /* Legacy weak RxEventCallb… in UART_InitCallbacksToDefault()
2863 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart) in UART_SetConfig() argument
2873 assert_param(IS_UART_BAUDRATE(huart->Init.BaudRate)); in UART_SetConfig()
2874 assert_param(IS_UART_WORD_LENGTH(huart->Init.WordLength)); in UART_SetConfig()
2875 assert_param(IS_UART_STOPBITS(huart->Init.StopBits)); in UART_SetConfig()
2876 assert_param(IS_UART_ONE_BIT_SAMPLE(huart->Init.OneBitSampling)); in UART_SetConfig()
2878 assert_param(IS_UART_PARITY(huart->Init.Parity)); in UART_SetConfig()
2879 assert_param(IS_UART_MODE(huart->Init.Mode)); in UART_SetConfig()
2880 assert_param(IS_UART_HARDWARE_FLOW_CONTROL(huart->Init.HwFlowCtl)); in UART_SetConfig()
2881 assert_param(IS_UART_OVERSAMPLING(huart->Init.OverSampling)); in UART_SetConfig()
2890 …tmpreg = (uint32_t)huart->Init.WordLength | huart->Init.Parity | huart->Init.Mode | huart->Init.Ov… in UART_SetConfig()
2891 MODIFY_REG(huart->Instance->CR1, USART_CR1_FIELDS, tmpreg); in UART_SetConfig()
2896 MODIFY_REG(huart->Instance->CR2, USART_CR2_STOP, huart->Init.StopBits); in UART_SetConfig()
2904 tmpreg = (uint32_t)huart->Init.HwFlowCtl; in UART_SetConfig()
2906 tmpreg |= huart->Init.OneBitSampling; in UART_SetConfig()
2907 MODIFY_REG(huart->Instance->CR3, USART_CR3_FIELDS, tmpreg); in UART_SetConfig()
2911 UART_GETCLOCKSOURCE(huart, clocksource); in UART_SetConfig()
2913 if (huart->Init.OverSampling == UART_OVERSAMPLING_8) in UART_SetConfig()
2941 usartdiv = (uint32_t)(UART_DIV_SAMPLING8(pclk, huart->Init.BaudRate)); in UART_SetConfig()
2946 huart->Instance->BRR = brrtemp; in UART_SetConfig()
2982 usartdiv = (uint32_t)(UART_DIV_SAMPLING16(pclk, huart->Init.BaudRate)); in UART_SetConfig()
2985 huart->Instance->BRR = (uint16_t)usartdiv; in UART_SetConfig()
2996 huart->RxISR = NULL; in UART_SetConfig()
2997 huart->TxISR = NULL; in UART_SetConfig()
3007 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart) in UART_AdvFeatureConfig() argument
3010 assert_param(IS_UART_ADVFEATURE_INIT(huart->AdvancedInit.AdvFeatureInit)); in UART_AdvFeatureConfig()
3013 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_SWAP_INIT)) in UART_AdvFeatureConfig()
3015 assert_param(IS_UART_ADVFEATURE_SWAP(huart->AdvancedInit.Swap)); in UART_AdvFeatureConfig()
3016 MODIFY_REG(huart->Instance->CR2, USART_CR2_SWAP, huart->AdvancedInit.Swap); in UART_AdvFeatureConfig()
3020 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_TXINVERT_INIT)) in UART_AdvFeatureConfig()
3022 assert_param(IS_UART_ADVFEATURE_TXINV(huart->AdvancedInit.TxPinLevelInvert)); in UART_AdvFeatureConfig()
3023 MODIFY_REG(huart->Instance->CR2, USART_CR2_TXINV, huart->AdvancedInit.TxPinLevelInvert); in UART_AdvFeatureConfig()
3027 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXINVERT_INIT)) in UART_AdvFeatureConfig()
3029 assert_param(IS_UART_ADVFEATURE_RXINV(huart->AdvancedInit.RxPinLevelInvert)); in UART_AdvFeatureConfig()
3030 MODIFY_REG(huart->Instance->CR2, USART_CR2_RXINV, huart->AdvancedInit.RxPinLevelInvert); in UART_AdvFeatureConfig()
3034 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DATAINVERT_INIT)) in UART_AdvFeatureConfig()
3036 assert_param(IS_UART_ADVFEATURE_DATAINV(huart->AdvancedInit.DataInvert)); in UART_AdvFeatureConfig()
3037 MODIFY_REG(huart->Instance->CR2, USART_CR2_DATAINV, huart->AdvancedInit.DataInvert); in UART_AdvFeatureConfig()
3041 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_RXOVERRUNDISABLE_INIT)) in UART_AdvFeatureConfig()
3043 assert_param(IS_UART_OVERRUN(huart->AdvancedInit.OverrunDisable)); in UART_AdvFeatureConfig()
3044 MODIFY_REG(huart->Instance->CR3, USART_CR3_OVRDIS, huart->AdvancedInit.OverrunDisable); in UART_AdvFeatureConfig()
3048 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_DMADISABLEONERROR_INIT)) in UART_AdvFeatureConfig()
3050 assert_param(IS_UART_ADVFEATURE_DMAONRXERROR(huart->AdvancedInit.DMADisableonRxError)); in UART_AdvFeatureConfig()
3051 MODIFY_REG(huart->Instance->CR3, USART_CR3_DDRE, huart->AdvancedInit.DMADisableonRxError); in UART_AdvFeatureConfig()
3055 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_AUTOBAUDRATE_INIT)) in UART_AdvFeatureConfig()
3057 assert_param(IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(huart->Instance)); in UART_AdvFeatureConfig()
3058 assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATE(huart->AdvancedInit.AutoBaudRateEnable)); in UART_AdvFeatureConfig()
3059 MODIFY_REG(huart->Instance->CR2, USART_CR2_ABREN, huart->AdvancedInit.AutoBaudRateEnable); in UART_AdvFeatureConfig()
3061 if (huart->AdvancedInit.AutoBaudRateEnable == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE) in UART_AdvFeatureConfig()
3063 assert_param(IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(huart->AdvancedInit.AutoBaudRateMode)); in UART_AdvFeatureConfig()
3064 MODIFY_REG(huart->Instance->CR2, USART_CR2_ABRMODE, huart->AdvancedInit.AutoBaudRateMode); in UART_AdvFeatureConfig()
3069 if (HAL_IS_BIT_SET(huart->AdvancedInit.AdvFeatureInit, UART_ADVFEATURE_MSBFIRST_INIT)) in UART_AdvFeatureConfig()
3071 assert_param(IS_UART_ADVFEATURE_MSBFIRST(huart->AdvancedInit.MSBFirst)); in UART_AdvFeatureConfig()
3072 MODIFY_REG(huart->Instance->CR2, USART_CR2_MSBFIRST, huart->AdvancedInit.MSBFirst); in UART_AdvFeatureConfig()
3081 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart) in UART_CheckIdleState() argument
3086 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_CheckIdleState()
3092 if ((huart->Instance->CR1 & USART_CR1_TE) == USART_CR1_TE) in UART_CheckIdleState()
3095 …if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_TEACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) … in UART_CheckIdleState()
3098 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE)); in UART_CheckIdleState()
3100 huart->gState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3102 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3110 if ((huart->Instance->CR1 & USART_CR1_RE) == USART_CR1_RE) in UART_CheckIdleState()
3113 …if (UART_WaitOnFlagUntilTimeout(huart, USART_ISR_REACK, RESET, tickstart, HAL_UART_TIMEOUT_VALUE) … in UART_CheckIdleState()
3117 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in UART_CheckIdleState()
3118 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_CheckIdleState()
3120 huart->RxState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3122 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3130 huart->gState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3131 huart->RxState = HAL_UART_STATE_READY; in UART_CheckIdleState()
3132 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_CheckIdleState()
3133 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_CheckIdleState()
3135 __HAL_UNLOCK(huart); in UART_CheckIdleState()
3150 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus … in UART_WaitOnFlagUntilTimeout() argument
3154 while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status) in UART_WaitOnFlagUntilTimeout()
3165 …if ((READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) && (Flag != UART_FLAG_TXE) && (Flag != UA… in UART_WaitOnFlagUntilTimeout()
3167 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) == SET) in UART_WaitOnFlagUntilTimeout()
3170 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF); in UART_WaitOnFlagUntilTimeout()
3175 UART_EndRxTransfer(huart); in UART_WaitOnFlagUntilTimeout()
3177 huart->ErrorCode = HAL_UART_ERROR_ORE; in UART_WaitOnFlagUntilTimeout()
3180 __HAL_UNLOCK(huart); in UART_WaitOnFlagUntilTimeout()
3184 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RTOF) == SET) in UART_WaitOnFlagUntilTimeout()
3187 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); in UART_WaitOnFlagUntilTimeout()
3192 UART_EndRxTransfer(huart); in UART_WaitOnFlagUntilTimeout()
3194 huart->ErrorCode = HAL_UART_ERROR_RTO; in UART_WaitOnFlagUntilTimeout()
3197 __HAL_UNLOCK(huart); in UART_WaitOnFlagUntilTimeout()
3218 HAL_StatusTypeDef UART_Start_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in UART_Start_Receive_IT() argument
3220 huart->pRxBuffPtr = pData; in UART_Start_Receive_IT()
3221 huart->RxXferSize = Size; in UART_Start_Receive_IT()
3222 huart->RxXferCount = Size; in UART_Start_Receive_IT()
3223 huart->RxISR = NULL; in UART_Start_Receive_IT()
3226 UART_MASK_COMPUTATION(huart); in UART_Start_Receive_IT()
3228 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_Start_Receive_IT()
3229 huart->RxState = HAL_UART_STATE_BUSY_RX; in UART_Start_Receive_IT()
3232 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_Start_Receive_IT()
3235 if ((huart->Init.WordLength == UART_WORDLENGTH_9B) && (huart->Init.Parity == UART_PARITY_NONE)) in UART_Start_Receive_IT()
3237 huart->RxISR = UART_RxISR_16BIT; in UART_Start_Receive_IT()
3241 huart->RxISR = UART_RxISR_8BIT; in UART_Start_Receive_IT()
3245 if (huart->Init.Parity != UART_PARITY_NONE) in UART_Start_Receive_IT()
3247 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE | USART_CR1_RXNEIE); in UART_Start_Receive_IT()
3251 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_RXNEIE); in UART_Start_Receive_IT()
3267 HAL_StatusTypeDef UART_Start_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size) in UART_Start_Receive_DMA() argument
3269 huart->pRxBuffPtr = pData; in UART_Start_Receive_DMA()
3270 huart->RxXferSize = Size; in UART_Start_Receive_DMA()
3272 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_Start_Receive_DMA()
3273 huart->RxState = HAL_UART_STATE_BUSY_RX; in UART_Start_Receive_DMA()
3275 if (huart->hdmarx != NULL) in UART_Start_Receive_DMA()
3278 huart->hdmarx->XferCpltCallback = UART_DMAReceiveCplt; in UART_Start_Receive_DMA()
3281 huart->hdmarx->XferHalfCpltCallback = UART_DMARxHalfCplt; in UART_Start_Receive_DMA()
3284 huart->hdmarx->XferErrorCallback = UART_DMAError; in UART_Start_Receive_DMA()
3287 huart->hdmarx->XferAbortCallback = NULL; in UART_Start_Receive_DMA()
3290 …if (HAL_DMA_Start_IT(huart->hdmarx, (uint32_t)&huart->Instance->RDR, (uint32_t)huart->pRxBuffPtr, … in UART_Start_Receive_DMA()
3293 huart->ErrorCode = HAL_UART_ERROR_DMA; in UART_Start_Receive_DMA()
3296 huart->RxState = HAL_UART_STATE_READY; in UART_Start_Receive_DMA()
3303 if (huart->Init.Parity != UART_PARITY_NONE) in UART_Start_Receive_DMA()
3305 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_Start_Receive_DMA()
3309 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_Start_Receive_DMA()
3313 ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); in UART_Start_Receive_DMA()
3324 static void UART_EndTxTransfer(UART_HandleTypeDef *huart) in UART_EndTxTransfer() argument
3327 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_TXEIE | USART_CR1_TCIE)); in UART_EndTxTransfer()
3330 huart->gState = HAL_UART_STATE_READY; in UART_EndTxTransfer()
3339 static void UART_EndRxTransfer(UART_HandleTypeDef *huart) in UART_EndRxTransfer() argument
3342 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in UART_EndRxTransfer()
3343 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_EndRxTransfer()
3346 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_EndRxTransfer()
3348 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_EndRxTransfer()
3352 huart->RxState = HAL_UART_STATE_READY; in UART_EndRxTransfer()
3353 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_EndRxTransfer()
3356 huart->RxISR = NULL; in UART_EndRxTransfer()
3367 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATransmitCplt() local
3372 huart->TxXferCount = 0U; in UART_DMATransmitCplt()
3376 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); in UART_DMATransmitCplt()
3379 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_DMATransmitCplt()
3386 huart->TxCpltCallback(huart); in UART_DMATransmitCplt()
3389 HAL_UART_TxCpltCallback(huart); in UART_DMATransmitCplt()
3401 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxHalfCplt() local
3405 huart->TxHalfCpltCallback(huart); in UART_DMATxHalfCplt()
3408 HAL_UART_TxHalfCpltCallback(huart); in UART_DMATxHalfCplt()
3419 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAReceiveCplt() local
3424 huart->RxXferCount = 0U; in UART_DMAReceiveCplt()
3427 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_PEIE); in UART_DMAReceiveCplt()
3428 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_DMAReceiveCplt()
3432 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); in UART_DMAReceiveCplt()
3435 huart->RxState = HAL_UART_STATE_READY; in UART_DMAReceiveCplt()
3438 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMAReceiveCplt()
3440 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_DMAReceiveCplt()
3446 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_DMAReceiveCplt()
3450 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMAReceiveCplt()
3454 huart->RxEventCallback(huart, huart->RxXferSize); in UART_DMAReceiveCplt()
3457 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_DMAReceiveCplt()
3465 huart->RxCpltCallback(huart); in UART_DMAReceiveCplt()
3468 HAL_UART_RxCpltCallback(huart); in UART_DMAReceiveCplt()
3480 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMARxHalfCplt() local
3484 huart->RxEventType = HAL_UART_RXEVENT_HT; in UART_DMARxHalfCplt()
3488 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_DMARxHalfCplt()
3492 huart->RxEventCallback(huart, huart->RxXferSize / 2U); in UART_DMARxHalfCplt()
3495 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize / 2U); in UART_DMARxHalfCplt()
3503 huart->RxHalfCpltCallback(huart); in UART_DMARxHalfCplt()
3506 HAL_UART_RxHalfCpltCallback(huart); in UART_DMARxHalfCplt()
3518 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAError() local
3520 const HAL_UART_StateTypeDef gstate = huart->gState; in UART_DMAError()
3521 const HAL_UART_StateTypeDef rxstate = huart->RxState; in UART_DMAError()
3524 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT)) && in UART_DMAError()
3527 huart->TxXferCount = 0U; in UART_DMAError()
3528 UART_EndTxTransfer(huart); in UART_DMAError()
3532 if ((HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) && in UART_DMAError()
3535 huart->RxXferCount = 0U; in UART_DMAError()
3536 UART_EndRxTransfer(huart); in UART_DMAError()
3539 huart->ErrorCode |= HAL_UART_ERROR_DMA; in UART_DMAError()
3543 huart->ErrorCallback(huart); in UART_DMAError()
3546 HAL_UART_ErrorCallback(huart); in UART_DMAError()
3558 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMAAbortOnError() local
3559 huart->RxXferCount = 0U; in UART_DMAAbortOnError()
3560 huart->TxXferCount = 0U; in UART_DMAAbortOnError()
3564 huart->ErrorCallback(huart); in UART_DMAAbortOnError()
3567 HAL_UART_ErrorCallback(huart); in UART_DMAAbortOnError()
3581 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxAbortCallback() local
3583 huart->hdmatx->XferAbortCallback = NULL; in UART_DMATxAbortCallback()
3586 if (huart->hdmarx != NULL) in UART_DMATxAbortCallback()
3588 if (huart->hdmarx->XferAbortCallback != NULL) in UART_DMATxAbortCallback()
3595 huart->TxXferCount = 0U; in UART_DMATxAbortCallback()
3596 huart->RxXferCount = 0U; in UART_DMATxAbortCallback()
3599 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_DMATxAbortCallback()
3602 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMATxAbortCallback()
3606 huart->gState = HAL_UART_STATE_READY; in UART_DMATxAbortCallback()
3607 huart->RxState = HAL_UART_STATE_READY; in UART_DMATxAbortCallback()
3608 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMATxAbortCallback()
3613 huart->AbortCpltCallback(huart); in UART_DMATxAbortCallback()
3616 HAL_UART_AbortCpltCallback(huart); in UART_DMATxAbortCallback()
3631 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMARxAbortCallback() local
3633 huart->hdmarx->XferAbortCallback = NULL; in UART_DMARxAbortCallback()
3636 if (huart->hdmatx != NULL) in UART_DMARxAbortCallback()
3638 if (huart->hdmatx->XferAbortCallback != NULL) in UART_DMARxAbortCallback()
3645 huart->TxXferCount = 0U; in UART_DMARxAbortCallback()
3646 huart->RxXferCount = 0U; in UART_DMARxAbortCallback()
3649 huart->ErrorCode = HAL_UART_ERROR_NONE; in UART_DMARxAbortCallback()
3652 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMARxAbortCallback()
3655 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_DMARxAbortCallback()
3658 huart->gState = HAL_UART_STATE_READY; in UART_DMARxAbortCallback()
3659 huart->RxState = HAL_UART_STATE_READY; in UART_DMARxAbortCallback()
3660 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMARxAbortCallback()
3665 huart->AbortCpltCallback(huart); in UART_DMARxAbortCallback()
3668 HAL_UART_AbortCpltCallback(huart); in UART_DMARxAbortCallback()
3683 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)(hdma->Parent); in UART_DMATxOnlyAbortCallback() local
3685 huart->TxXferCount = 0U; in UART_DMATxOnlyAbortCallback()
3689 huart->gState = HAL_UART_STATE_READY; in UART_DMATxOnlyAbortCallback()
3694 huart->AbortTransmitCpltCallback(huart); in UART_DMATxOnlyAbortCallback()
3697 HAL_UART_AbortTransmitCpltCallback(huart); in UART_DMATxOnlyAbortCallback()
3711 UART_HandleTypeDef *huart = (UART_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; in UART_DMARxOnlyAbortCallback() local
3713 huart->RxXferCount = 0U; in UART_DMARxOnlyAbortCallback()
3716 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF | UART_CLEAR_NEF | UART_CLEAR_PEF | UART_CLEAR_FEF); in UART_DMARxOnlyAbortCallback()
3719 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_DMARxOnlyAbortCallback()
3722 huart->RxState = HAL_UART_STATE_READY; in UART_DMARxOnlyAbortCallback()
3723 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_DMARxOnlyAbortCallback()
3728 huart->AbortReceiveCpltCallback(huart); in UART_DMARxOnlyAbortCallback()
3731 HAL_UART_AbortReceiveCpltCallback(huart); in UART_DMARxOnlyAbortCallback()
3742 static void UART_TxISR_8BIT(UART_HandleTypeDef *huart) in UART_TxISR_8BIT() argument
3745 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_8BIT()
3747 if (huart->TxXferCount == 0U) in UART_TxISR_8BIT()
3750 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE); in UART_TxISR_8BIT()
3753 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_8BIT()
3757 huart->Instance->TDR = (uint8_t)(*huart->pTxBuffPtr & (uint8_t)0xFF); in UART_TxISR_8BIT()
3758 huart->pTxBuffPtr++; in UART_TxISR_8BIT()
3759 huart->TxXferCount--; in UART_TxISR_8BIT()
3771 static void UART_TxISR_16BIT(UART_HandleTypeDef *huart) in UART_TxISR_16BIT() argument
3776 if (huart->gState == HAL_UART_STATE_BUSY_TX) in UART_TxISR_16BIT()
3778 if (huart->TxXferCount == 0U) in UART_TxISR_16BIT()
3781 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TXEIE); in UART_TxISR_16BIT()
3784 ATOMIC_SET_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_TxISR_16BIT()
3788 tmp = (const uint16_t *) huart->pTxBuffPtr; in UART_TxISR_16BIT()
3789 huart->Instance->TDR = (((uint32_t)(*tmp)) & 0x01FFUL); in UART_TxISR_16BIT()
3790 huart->pTxBuffPtr += 2U; in UART_TxISR_16BIT()
3791 huart->TxXferCount--; in UART_TxISR_16BIT()
3803 static void UART_EndTransmit_IT(UART_HandleTypeDef *huart) in UART_EndTransmit_IT() argument
3806 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_TCIE); in UART_EndTransmit_IT()
3809 huart->gState = HAL_UART_STATE_READY; in UART_EndTransmit_IT()
3812 huart->TxISR = NULL; in UART_EndTransmit_IT()
3816 huart->TxCpltCallback(huart); in UART_EndTransmit_IT()
3819 HAL_UART_TxCpltCallback(huart); in UART_EndTransmit_IT()
3828 static void UART_RxISR_8BIT(UART_HandleTypeDef *huart) in UART_RxISR_8BIT() argument
3830 uint16_t uhMask = huart->Mask; in UART_RxISR_8BIT()
3834 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_8BIT()
3836 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_8BIT()
3837 *huart->pRxBuffPtr = (uint8_t)(uhdata & (uint8_t)uhMask); in UART_RxISR_8BIT()
3838 huart->pRxBuffPtr++; in UART_RxISR_8BIT()
3839 huart->RxXferCount--; in UART_RxISR_8BIT()
3841 if (huart->RxXferCount == 0U) in UART_RxISR_8BIT()
3844 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in UART_RxISR_8BIT()
3847 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_RxISR_8BIT()
3850 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_8BIT()
3853 huart->RxISR = NULL; in UART_RxISR_8BIT()
3856 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_8BIT()
3859 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_8BIT()
3862 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_8BIT()
3867 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_8BIT()
3870 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_8BIT()
3873 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_8BIT()
3875 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_8BIT()
3878 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_8BIT()
3883 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT()
3886 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_8BIT()
3894 huart->RxCpltCallback(huart); in UART_RxISR_8BIT()
3897 HAL_UART_RxCpltCallback(huart); in UART_RxISR_8BIT()
3905 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_8BIT()
3916 static void UART_RxISR_16BIT(UART_HandleTypeDef *huart) in UART_RxISR_16BIT() argument
3919 uint16_t uhMask = huart->Mask; in UART_RxISR_16BIT()
3923 if (huart->RxState == HAL_UART_STATE_BUSY_RX) in UART_RxISR_16BIT()
3925 uhdata = (uint16_t) READ_REG(huart->Instance->RDR); in UART_RxISR_16BIT()
3926 tmp = (uint16_t *) huart->pRxBuffPtr ; in UART_RxISR_16BIT()
3928 huart->pRxBuffPtr += 2U; in UART_RxISR_16BIT()
3929 huart->RxXferCount--; in UART_RxISR_16BIT()
3931 if (huart->RxXferCount == 0U) in UART_RxISR_16BIT()
3934 ATOMIC_CLEAR_BIT(huart->Instance->CR1, (USART_CR1_RXNEIE | USART_CR1_PEIE)); in UART_RxISR_16BIT()
3937 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); in UART_RxISR_16BIT()
3940 huart->RxState = HAL_UART_STATE_READY; in UART_RxISR_16BIT()
3943 huart->RxISR = NULL; in UART_RxISR_16BIT()
3946 huart->RxEventType = HAL_UART_RXEVENT_TC; in UART_RxISR_16BIT()
3949 if (READ_BIT(huart->Instance->CR2, USART_CR2_RTOEN) != 0U) in UART_RxISR_16BIT()
3952 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_RTOIE); in UART_RxISR_16BIT()
3957 if (huart->ReceptionType == HAL_UART_RECEPTION_TOIDLE) in UART_RxISR_16BIT()
3960 huart->ReceptionType = HAL_UART_RECEPTION_STANDARD; in UART_RxISR_16BIT()
3963 ATOMIC_CLEAR_BIT(huart->Instance->CR1, USART_CR1_IDLEIE); in UART_RxISR_16BIT()
3965 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) == SET) in UART_RxISR_16BIT()
3968 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_IDLEF); in UART_RxISR_16BIT()
3973 huart->RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT()
3976 HAL_UARTEx_RxEventCallback(huart, huart->RxXferSize); in UART_RxISR_16BIT()
3984 huart->RxCpltCallback(huart); in UART_RxISR_16BIT()
3987 HAL_UART_RxCpltCallback(huart); in UART_RxISR_16BIT()
3995 __HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST); in UART_RxISR_16BIT()