CC1310- TI RTOS 相关困惑,请理解TI RTOS工作的朋友帮解惑?!
时间:12-23
整理:3721RD
点击:
// Initialize client state & variables memset(&pObj->state, 0, sizeof(pObj->state)); // Initialize client semaphore and clock object union { Semaphore_Params sp; Clock_Params cp; } paramsUnion; Semaphore_Params_init(¶msUnion.sp); paramsUnion.sp.mode = Semaphore_Mode_BINARY; Semaphore_construct(&pObj->state.semSync, 0, ¶msUnion.sp); Clock_Params_init(¶msUnion.cp); paramsUnion.cp.arg = (UArg)pObj; Clock_construct(&pObj->state.clkInactivity, (Clock_FuncPtr)clkInactivityFxn, 0, ¶msUnion.cp);
CC1310 例程中 RF_open() 里有这段,有几个里方让我困惑:
1. pObj->state 被清成0,,Clock_construct(&pObj->state.clkInactivity, (Clock_FuncPtr)clkInactivityFxn, 0, ¶msUnion.cp); ? 这里的 &pObj->state.clkInactivity, == NULL ??
2. // Initialize client semaphore and clock object union { Semaphore_Params sp; Clock_Params cp; } paramsUnion; 联合? 两类变量;
还有 变量在函数里定义了,并初始化了,但是退出去不是又变不可见了。。。。
这个参数变量会在clock_construct中赋值到Clock_Object中去,所以局部变量也可以。