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.

[参考译文] TMS320F280039C:想知道为什么 SPI_setcharLength 具有新的"originalStatus"添加了布尔逻辑(driverlib)

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1444297/tms320f280039c-wondering-why-spi_setcharlength-has-new-originalstatus-boolean-logic-added-driverlib

器件型号:TMS320F280039C

工具与软件:

从电机控制 SDK 5.02变为5.03、我看到 SPI_setcharLength 函数具有新的检查。 新的"bool originalStatus =..."行的用途是什么、然后在启用模块之前检查新的 IF 标记。 我没有看到发行说明或修复说明或任何东西,没有问题拿起它,我只是困惑的原因它改变。 如果我们正在进行软件复位、该任务有什么意义呢?

静态内联空
SPI_setcharLength (uint32_t base、uint16_t charLength)

   //
   //检查参数。
   //
   assert ((charLength >= 1U)&&(charLength <= 16U);

   BOOL originalStatus =((HWREGH (BASE + SPI_O_CCR)&(SPI_CCR_SPISWRESET))
                                                   == SPI_CCR_SPISWRESET );

   SPI_disableModule (base);
   HWREGH (BASE + SPI_O_CCR)=(HWREGH (BASE + SPI_O_CCR)&~SPI_CCR_SPICHAR_M)|
                              (字符长度- 1U);
   //
   //恢复原始状态
   //
   if (originalStatus){
       SPI_enableModule (base);
   }
}

该函数的差值介于5.02和5.03之间: