mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-04-23 12:19:04 +02:00
dm36x uart: Allow UART write from interrupt context.
This commit is contained in:
@@ -243,8 +243,8 @@ int uart_write (const char *ptr, int len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Block thread on private access to the UART */
|
/* Block thread on private access to the UART unless at interrupt context */
|
||||||
if (atomOSStarted && atomMutexGet(&uart_mutex, 0) == ATOM_OK)
|
if (atomOSStarted && ((atomCurrentContext() == NULL) || (atomMutexGet(&uart_mutex, 0) == ATOM_OK)))
|
||||||
{
|
{
|
||||||
/* Loop through all bytes to write */
|
/* Loop through all bytes to write */
|
||||||
for (todo = 0; todo < len; todo++)
|
for (todo = 0; todo < len; todo++)
|
||||||
@@ -257,8 +257,8 @@ int uart_write (const char *ptr, int len)
|
|||||||
uart_write_char(*ptr++);
|
uart_write_char(*ptr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return mutex access */
|
/* Return mutex access if not at interrupt context */
|
||||||
if (atomOSStarted)
|
if (atomOSStarted && (atomCurrentContext() != NULL))
|
||||||
{
|
{
|
||||||
atomMutexPut(&uart_mutex);
|
atomMutexPut(&uart_mutex);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user