
MC1322x SMAC Primitives
MC1322x SMAC Reference Manual, Rev. 1.7
Freescale Semiconductor
3-13
Returns
{gFailNoResourcesAvailable_c} When there is no space in the messages queue.
{gSuccess_c}
When the message can be added to the message queue.
Usage
•
Create a message object
•
Associate a buffer with such message object, this buffer will used to store the received data. Use
the macro MSG_INIT
•
Set length to the maximum bytes to receive in that buffer, this can be done by accessing direct to
the message [msg].u8BufSize = [length] or using the macro set_rx_datasize([message],[length])
•
Call MLMERXEnableRequest() passing the message as parameter. Success response means that
the message has been added to the message queue, to validate the successful transition of the
message check the [msg].u8Status.msg_state
•
Ensure that the process_radio_msg() is called since this function processes the pending messages
This function does not perform blocking which is different than previous SMAC versions.
Notes
u32Timeout value of zero causes the receiver to never timeout and stay in receive mode until a data packet
is received or the MLMERXDisableRequest function is called. At those points, the radio returns to idle
mode.
NOTE
Consider all the possible messages states as explained in
Chapter 2,
MC1322x SMAC Software Architecture
, in order to implement the proper
message state handling logic. For instance, consider the following example
for handling of the different receive action messages states..
...
if(MSG_RX_ACTION_COMPLETE_SUCCESS == RX_msg.u8Status.msg_state){
/* Go to idle*/
}
else if((MSG_RX_ACTION_COMPLETE_FAIL == RX_msg.u8Status.msg_state) ||
(MSG_RX_TIMEOUT_FAIL == RX_msg.u8Status.msg_state)){
RX_msg.u8BufSize = RX_SIZE;
MLMERXEnableRequest(&RX_msg, 0x000F0000);
}
...
3.2.18
MLMEScanRequest
This function scans the predefined channels and stores the scanned Energy Detect value on every channel.
Energy detect values range from 0x00 to 0xFF
0x00
The channel has practically no activity
0xFF
The channel has heavy traffic and is very busy