[HAL][UART] Remove HAL_LOCK/HAL_UNLOCK calls in HAL UART Tx and Rx APIs
diff --git a/Src/stm32f2xx_hal_uart.c b/Src/stm32f2xx_hal_uart.c
index 8014374..53649fa 100644
--- a/Src/stm32f2xx_hal_uart.c
+++ b/Src/stm32f2xx_hal_uart.c
@@ -1146,9 +1146,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->ErrorCode = HAL_UART_ERROR_NONE;
huart->gState = HAL_UART_STATE_BUSY_TX;
@@ -1170,9 +1167,6 @@
pdata16bits = NULL;
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
while (huart->TxXferCount > 0U)
{
if (UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK)
@@ -1234,9 +1228,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;
@@ -1259,9 +1250,6 @@
pdata16bits = NULL;
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
/* Check the remain data to be received */
while (huart->RxXferCount > 0U)
{
@@ -1321,9 +1309,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->pTxBuffPtr = (uint8_t *) pData;
huart->TxXferSize = Size;
huart->TxXferCount = Size;
@@ -1331,9 +1316,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);
@@ -1366,9 +1348,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
/* Set Reception type to Standard reception */
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
@@ -1403,9 +1382,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
huart->pTxBuffPtr = (uint8_t *) pData;
huart->TxXferSize = Size;
huart->TxXferCount = Size;
@@ -1432,9 +1408,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);
@@ -1469,9 +1442,6 @@
return HAL_ERROR;
}
- /* Process Locked */
- __HAL_LOCK(huart);
-
/* Set Reception type to Standard reception */
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
@@ -1493,9 +1463,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)
{
@@ -1514,9 +1481,6 @@
ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR);
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
return HAL_OK;
}
@@ -1528,8 +1492,6 @@
*/
HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart)
{
- /* Process Locked */
- __HAL_LOCK(huart);
if (huart->gState == HAL_UART_STATE_BUSY_TX)
{
@@ -1553,9 +1515,6 @@
ATOMIC_SET_BIT(huart->Instance->CR3, USART_CR3_DMAR);
}
- /* Process Unlocked */
- __HAL_UNLOCK(huart);
-
return HAL_OK;
}
@@ -1635,8 +1594,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;
@@ -1660,8 +1617,6 @@
pdata16bits = NULL;
}
- __HAL_UNLOCK(huart);
-
/* Initialize output number of received elements */
*RxLen = 0U;
@@ -1761,8 +1716,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;
@@ -1823,8 +1776,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;
@@ -3273,9 +3224,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 */
@@ -3331,9 +3279,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 */