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.

[参考译文] AM263P4-Q1:锁定/解锁 Spinlock API

Guru**** 2454880 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1496720/am263p4-q1-lock-unlock-spinlock-api

器件型号:AM263P4-Q1

工具与软件:

大家好、团队成员:

我收到客户关于自旋锁的问题。  

在中断期间可以通过调用 SPINLOCK API 来锁定/解锁吗?

https://software-dl.ti.com/mcu-plus-sdk/esd/AM263PX/09_02_00_56/exports/docs/api_guide_am263px/group__DRV__SPINLOCK__MODULE.html

此致、

Mari Tsunoda.

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

    嗨、Mari、

    在中断服务例程期间锁定/解锁是一个合理的用例。 只需记住 通过自旋锁模块访问共享数据结构的3个互斥要求。

    1. 保持锁的时间可预测并且很短。
    2. 在按住锁定时、无法抢占、暂停或中断锁定任务。 (这会使保持时间过大并且无法预测。)
    3. 锁是轻争,这是任何其他过程(或处理器)试图获取锁,而保持它的机会很小。

    上面列表中的#2也许是需要考虑的问题、这取决于 ISR 的预期。

    此致、

    Zackary Fleenor