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.

[参考译文] LAUNCHXL-CC26X2R1:uart_write()的 iCall_free()

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/889317/launchxl-cc26x2r1-icall_free-for-uart_write

器件型号:LAUNCHXL-CC26X2R1

你(们)好  

我们将 UART 配置为回调模式、我们的问题是释放 UART TX 缓冲区的正确位置在哪里?

1.直接释放

静态空 uartTxSend()
{
uint8_t *pData =空;
pData = iCall_malloc (256);

if (pData = NULL)
{
//确保分配成功
返回(失败);
}

UART_WRITE (uartHandle、pData、256);
iCall_free (pData);
} 

2.释放回调函数  

静态空 uartWriteCallback (UART_Handle handle、void *txBuf、size_t size)
{
iCall_free (txBuf);
} 

谢谢。

BR

Trevor

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Trevor:

    在 UART 驱动程序发送数据之前、不得释放缓冲区。

    UART_write()函数不会复制作为参数传递的缓冲区内容。 UART_write()函数使用传递的地址并将其写入硬件。

    总之、您的第二个选项是正确的。

    此致、