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.

systembios中gatemutex的用法咨询

Other Parts Discussed in Thread: SYSBIOS

你好,我目前在把dspbios的代码移植到systembios中,由于多个任务同时使用同一个I2C总线,所以我在dspbios中使用了LCK_pend(Lck_I2c, wTimeOut)和LCK_post(Lck_I2c),目前移植到bios_6_45_01_29的sysbios中,看到TI文档介绍应当使用gatemutex代替,在使用gatemutex时有几点疑问:

1)GateMutex_enter(gatemutex)中没有timeout参数,是不是可以认为如果申请不成功,此函数就不会返回?没有超时的说法?

2)我查看gatemutex.c文件中,函数GateMutex_enter(gatemutex)的说明,返回0表示申请到此资源,返回1表示嵌套使用了,若返回1,在调用GateMutex_leave时,不会释放资源,这样理解是否正确?

3)从我的测试情况来着,若连续调用两次GateMutex_enter,再调用一次GateMutex_leave,则其他任务在申请此资源调用时会申请不成功,GateMutex_enter不能返回。GateMutex_enter和GateMutex_leave是否必须成对出现,能不能连续调用两次GateMutex_enter然后再调用一次GateMutex_leave?

谢谢!