Ejemplo n.º 1
0
/*****************************************************************************
 * FUNCTION: SendRAWDataFrame
 *
 * RETURNS: TRUE or FALSE
 *
 * PARAMS:
 *      UINT8* pBuf -> pointer to the command buffer.
 *      UINT16 bufLen -> length in bytes of the buffer (pBuf).
 *
 *
 *  NOTES: SendRAWDataFrame sends a Data Transmit request to the WF chip
 *          using the Random Access Window (RAW) interface.  The pre-buffer
 *          is used by the WF MAC to send routing information for the packet
 *          while pBuf is the request that was submitted by the application.
 *          The order of operations are
 *              1) reserve a memory buffer of sufficient length on the WF chip
 *              using RawMove.
 *              2) Write the bytes for the pre-buffer and then the buffer
 *              using the RawSetByte. Because the bytes are written
 *              sequentially there is no need to call WFRawSetIndex
 *              to adjust the write position.
 *              3) instruct the WF chip that the command is ready for
 *              processing.
 *              4) perform any necessary cleanup.
 *****************************************************************************/
void SendRAWDataFrame(UINT16 bufLen)
{
    UINT8 txDataPreamble[4] = { WF_DATA_REQUEST_TYPE, WF_STD_DATA_MSG_SUBTYPE, 1, 0};

    RawWrite(RAW_TX_ID, 0, sizeof(txDataPreamble), txDataPreamble);
    
    RawSendTxBuffer(bufLen);
}
Ejemplo n.º 2
0
/*
*********************************************************************************************************
*                                   WF_TxDataSendPacket()
*
* Description : Directs the MRF24WB0M to transmit a Tx data packet to the 802.11 network.
*
* Argument(s) : length - length, in bytes, of data packet
*
* Return(s)   : Error code
*
* Caller(s)   : Application
*
* Notes:      : (1) MRF24WB0M Tx data block must first be allocated via WF_TxDataAllocateBuffer()
*
*               (2) Current support only for full length Tx data messaages. In other words, startIndex
*                   must be 0, and length must be the total length of the Tx data packet.
*
*********************************************************************************************************
*/
void WF_TxDataSendPacket(uint16_t length)
{
    tTxDataPreamble txPreamble;

    /* fill in tx data preamble with correct header */
    txPreamble.type    = WF_DATA_REQUEST_TYPE;
    txPreamble.subType = WF_STD_DATA_MSG_SUBTYPE;
    txPreamble.h2      = 1;
    txPreamble.h3      = 0;

    /* Ensure the MRF24WB0M is awake (only applies if PS-Poll was enabled) */
    EnsureWFisAwake();

    /* write out preamble to MRF24WB0M buffer to the two extra bytes at start of allocated buffer */
    RawSetIndex(RAW_TX_ID, 0);
    WriteWFArray(RAW_1_DATA_REG, (uint8_t *)&txPreamble, WF_SIZE_OF_TX_DATA_PREAMBLE );

    /* now tell MRF24WB0M to transmit the tx data packet */
    RawSendTxBuffer(length);
}