[HAL][UART] Removal of HAL_LOCK/HAL_UNLOCK calls in HAL UART Tx and Rx APIs
diff --git a/Src/stm32f1xx_hal_uart.c b/Src/stm32f1xx_hal_uart.c
index 2551fa6..d265c4f 100644
--- a/Src/stm32f1xx_hal_uart.c
+++ b/Src/stm32f1xx_hal_uart.c
@@ -1156,9 +1156,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->gState = HAL_UART_STATE_BUSY_TX;
@@ -1180,9 +1177,6 @@
pdata16bits = NULL;
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
while (huart->TxXferCount > 0U)
{
if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK)
@@ -1244,9 +1238,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->RxState = HAL_UART_STATE_BUSY_RX;
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
@@ -1269,9 +1260,6 @@
pdata16bits = NULL;
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
/* Check the remain data to be received */
while (huart->RxXferCount > 0U)
{
@@ -1331,9 +1319,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->pTxBuffPtr = (uint8_t *) pData;
huart->TxXferSize = Size;
huart->TxXferCount = Size;
@@ -1341,9 +1326,6 @@
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->gState = HAL_UART_STATE_BUSY_TX;
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
/* Enable the UART Transmit data register empty Interrupt */
__HAL_UART_ENABLE_IT(huart, UART_IT_TXE);
@@ -1376,9 +1358,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
/* Set Reception type to Standard reception */
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
@@ -1413,9 +1392,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->pTxBuffPtr = (uint8_t *) pData;
huart->TxXferSize = Size;
huart->TxXferCount = Size;
@@ -1442,9 +1418,6 @@
/* Clear the TC flag in the SR register by writing 0 to it */
__HAL_UART_CLEAR_FLAG(huart, UART_FLAG_TC);
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
/* Enable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAT);
@@ -1479,9 +1452,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
/* Set Reception type to Standard reception */
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
@@ -1503,9 +1473,6 @@
{
uint32_t dmarequest = 0x00U;
- /* Process Locked */
- __HAL_LOCK(huart);
-
dmarequest = HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAT);
if ((huart->gState == HAL_UART_STATE_BUSY_TX) && dmarequest)
{
@@ -1524,9 +1491,6 @@
ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR);
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
return HAL_OK;
}
@@ -1538,8 +1502,6 @@
*/
HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart)
{
- /* Process Locked */
- __HAL_LOCK(huart);
if (huart->gState == HAL_UART_STATE_BUSY_TX)
{
@@ -1563,9 +1525,6 @@
ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR);
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
return HAL_OK;
}
@@ -1645,8 +1604,6 @@
return HAL_ERROR;
}
- __HAL_LOCK(huart);
-
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->RxState = HAL_UART_STATE_BUSY_RX;
huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
@@ -1670,8 +1627,6 @@
pdata16bits = NULL;
}
- __HAL_UNLOCK(huart);
-
/* Initialize output number of received elements */
*RxLen = 0U;
@@ -1771,8 +1726,6 @@
return HAL_ERROR;
}
- __HAL_LOCK(huart);
-
/* Set Reception type to reception till IDLE Event*/
huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
huart->RxEventType = HAL_UART_RXEVENT_TC;
@@ -1833,8 +1786,6 @@
return HAL_ERROR;
}
- __HAL_LOCK(huart);
-
/* Set Reception type to reception till IDLE Event*/
huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE;
huart->RxEventType = HAL_UART_RXEVENT_TC;
@@ -3283,9 +3234,6 @@
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->RxState = HAL_UART_STATE_BUSY_RX;
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
if (huart->Init.Parity != UART_PARITY_NONE)
{
/* Enable the UART Parity Error Interrupt */
@@ -3341,9 +3289,6 @@
/* Clear the Overrun flag just before enabling the DMA Rx request: can be mandatory for the second transfer */
__HAL_UART_CLEAR_OREFLAG(huart);
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
if (huart->Init.Parity != UART_PARITY_NONE)
{
/* Enable the UART Parity Error Interrupt */