如题!
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.
如题!
下面是关于EasyLink_transmit和EasyLink_transmitAsync两个API的功能描述。
EasyLink_transmit是blocking call,只有等到发送完成后才能继续执行后面的语句。代码执行会block在下面标黄的RF_pendCmd处,直到EasyLink_cmdPropTx命令执行完成后,才继续往下执行。
代码不是被block在Event_pend处,所以,你post event看起来没有效果。
//*****************************************************************************
//
//! \brief Sends a Packet with blocking call.
//!
//! This function is a blocking call to send a packet. If the Tx is
//! successfully scheduled then the function will block until the Tx is
//! complete.
//!
//! \param txPacket - The descriptor for the packet to be Tx'ed.
//!
//! \return EasyLink_Status
//
//*****************************************************************************
extern EasyLink_Status EasyLink_transmit(EasyLink_TxPacket *txPacket);
//*****************************************************************************
//
//! \brief Sends a Packet with non blocking call.
//!
//! This function is a non blocking call to send a packet. If the Tx is
//! successfully scheduled then the callback will be call once the Tx is
//! complete. The Tx will timeout if EasyLink_Ctrl_AsyncTx_TimeOut
//! ctrl message is used to set the timeout to something other than 0.
//!
//! \param txPacket - The descriptor for the packet to be Tx'ed.
//! \param cb - The tx done function pointer.
//!
//! \return EasyLink_Status
//
//*****************************************************************************
extern EasyLink_Status EasyLink_transmitAsync(EasyLink_TxPacket *txPacket,
EasyLink_TxDoneCb cb);
EasyLink_Status EasyLink_transmit(EasyLink_TxPacket *txPacket)
{
…………
// Send packet
RF_CmdHandle cmdHdl = RF_postCmd(rfHandle, (RF_Op*)&EasyLink_cmdPropTx,
RF_PriorityNormal, 0, EASYLINK_RF_EVENT_MASK);
// Wait for Command to complete
RF_EventMask result = RF_pendCmd(rfHandle, cmdHdl, (RF_EventLastCmdDone |
RF_EventCmdError));
…………
}