This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LP-CC1311P3:是否可以从 readCallback 函数调用 UART2_READ?

Guru**** 1794070 points
Other Parts Discussed in Thread: LP-CC1311P3
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1236978/lp-cc1311p3-can-i-call-uart2_read-from-readcallback-function

器件型号:LP-CC1311P3

您好!

我使用 LP-CC1311P3、并 编写了一个回调函数来从 UART 接收数据。

我正在使用 TI 的 UART2驱动程序。

下面列出了我的回调函数:

void ReceiveUartCallback(UART2_Handle handle, void *buffer, size_t count, void *userArg, int_fast16_t status)
{
    size_t i;
    size_t numBytesRead;
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;

    if (handle == uart)
    {
        if (status == UART2_STATUS_SUCCESS)
        {
            numBytesRead = count;
            if (numBytesRead > 0)
            {
                for (i = 0; i < numBytesRead; i++)
                {
                    xQueueSendFromISR(queueConsoleRx, &buffer[i], &xHigherPriorityTaskWoken);
                }

                UART2_read(uart, consoleBufferRx, CONSOLE_BUFFER_LEN_RX, NULL);
                portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
            }
        }
    }
}

我的问题是:

我可以从 readCallback 函数内部调用"UART2_Read"吗?

'UART2_Read'函数 ISR 是否安全?

OBS:我假设  读回 函数是从 ISR (硬件中断上下文)调用的。

谢谢。

法比亚诺