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.

[参考译文] AM2434:Profinet 注释函数返回与文档不一致的值

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1651760/am2434-profinet-annotation-functions-return-values-inconsistent-with-documentation

器件型号: AM2434

您好:

我想报告几个与 PROFINET 标注相关的函数的问题、这些函数看起来与它们定义的行为相反。 请通过以下与 PROFINET 相关的标注函数查看并更正返回值:
  • uint32_t PN_API_IOD_setDeviceType (***);
  • uint32_t PN_API_IOD_setDeviceOrderId (***);
  • uint32_t PN_API_IOD_setDeviceSerialNumber (***);
  • uint32_t PN_API_IOD_setDeviceHWRevision (***);
  • uint32_t PN_API_IOD_setDeviceVersionNumber (***);

根据文档、这些函数应返回:
 *\return     操作结果如 uint32_t
 *\retval     #PN_API_OK      成功。
 *\retval     #PN_API_NOT_OK   出错或 AR 正在运行。
 *\retval     #PN_API_ERR_PARAM 无效参数。

但是、在实践中、这些函数会始终返回取反值(即 1 表示成功、0 表示失败)、这与记录的 API 行为 (PN_API_OK =0) 相矛盾。
#define PN_API_OK              0x00000000U /*!<@简介无错误。 */

您能否请验证和更正实现以与文档保持一致(而不是修改文档)、从而保持 API 一致性?

提前感谢您的支持。

此致、
维特·特里斯卡

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

    你好、Vit、

    感谢您的 bug 报告!

    我只是看了实现,我确认了错误。 我已经创建了一个 TT 来为下一个版本修复它。

    此致、
    Kamil