TI中文支持网
TI专业的中文技术问题咨询交流网站

CC1310: 关于callback 参数传递的问题

Part Number:CC1310

比如在rfWakeOnRadioRx_CC1310_LAUNCHXL_tirtos_ccs例程中:

我的问题是调用callback时的里面的参数是在哪传递的?( RF_Handle h, RF_CmdHandle ch, RF_EventMask e),没有看到相应的赋值。

还是应该理解成类似RF_runCmd()函数是封装好了,调用Callback时传的参数是固定的这3个。

帮忙解答下,谢谢

Kevin Qiu1:

RF回调函数参数由RF_postCmd() 或 RF_runCmd()提供:

typedef void(* RF_Callback) (RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
Handles events related to RF command execution.RF command callbacks notify the application of any events happening during RF command execution. Events may either refer to RF core interrupts (RF_Core_Events) or may be generated by the RF driver (RF_Driver_Events).RF command callbacks are set up as parameter to RF_postCmd() or RF_runCmd() and provide:the relevant driver client handle h which was returned by RF_open(),
the relevant radio operation command handle ch,
an event mask e containing the occurred events.
RF command callbacks are executed in Software Interrupt (SWI) context and must not perform any blocking operation. The priority is configurable via RFCC26XX_HWAttrsV2 in the board file or RF_CTRL_SET_SWI_PRIORITY in RF_control().The RF_Callback function type is also used for signaling power events and errors. These are set in RF_Params::pPowerCb and RF_Params::pErrCb respectively. In case of a power event, ch can be ignored and e has RF_EventPowerUp set. In case of an error callback, ch contains an error code instead of a command handle and e has the RF_EventError flag set.

,

wei xin xin:

谢谢,找到了

,

Kevin Qiu1:

不客气

,

wei xin xin:

追问下:在FRCC26XX_singleMode.c看了RF_postCmd和RF_runCmd函数里面,没找到参数传递给Callback参数语句

,

wei xin xin:

找到了!

static void RF_radioOpDoneCb(void)

{…

/* Issue callback, free container and dequeue */ if (pCmd->pCb) { /* If any of the cancel events are set, mask out the other events. */ RF_EventMask exclusiveEvents = (RF_EventCmdCancelled | RF_EventCmdAborted | RF_EventCmdStopped | RF_EventCmdPreempted);

/* All other events are masked out if any of the above is present. */ if (events & exclusiveEvents) { events &= exclusiveEvents; }

/* Invoke the use callback */ pCmd->pCb(pCmd->pClient, pCmd->ch, events);//在这里传递参数了 }

}

赞(0)
未经允许不得转载:TI中文支持网 » CC1310: 关于callback 参数传递的问题
分享到: 更多 (0)