Exemplo n.º 1
0
/*****************************************************************************
 * FUNCTION: RawGetByte
 *
 * RETURNS: error code
 *
 * PARAMS:
 *      rawId   - RAW ID
 *      pBuffer - Buffer to read bytes into
 *      length  - number of bytes to read
 *
 *  NOTES: Reads bytes from the RAW engine
 *****************************************************************************/
void RawGetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length)
{
    UINT8 regId;
#if defined(OUTPUT_RAW_TX_RX)
	char buf[8];
#endif

    /* if reading a data message do following check */
    if (!g_WaitingForMgmtResponse)
    {
        // if RAW index previously set out of range and caller is trying to do illegal read
        if ((rawId == RAW_RX_ID)		&&
			g_rxIndexSetBeyondBuffer	&& 
			(GetRawWindowState(RAW_RX_ID) == WF_RAW_DATA_MOUNTED))
        {
            WF_ASSERT(FALSE);  /* attempting to read past end of RAW buffer */
        }
    }

    regId = (rawId == RAW_ID_0) ? RAW_0_DATA_REG : RAW_1_DATA_REG;
    ReadWFArray(regId, pBuffer, length);

#if defined(OUTPUT_RAW_TX_RX)
	putrsUART("R:");
    while (length-- != 0)
    {
        sprintf(buf," %02X", *pBuffer++);
        putsUART(buf);
    }
	putrsUART("\r\n");
#endif

}
Exemplo n.º 2
0
/*****************************************************************************
 * FUNCTION: RawGetByte
 *
 * RETURNS: error code
 *
 * PARAMS:
 *      rawId   - RAW ID
 *      pBuffer - Buffer to read bytes into
 *      length  - number of bytes to read
 *
 *  NOTES: Reads bytes from the RAW engine
 *****************************************************************************/
void RawGetByte(uint16_t rawId, uint8_t *pBuffer, uint16_t length)
{
    uint8_t regId;
#if defined(OUTPUT_RAW_TX_RX)
    uint16_t i;
#endif

    /* if reading a data message do following check */
    if (!g_WaitingForMgmtResponse)
    {
        // if RAW index previously set out of range and caller is trying to do illegal read
        if ( (rawId==RAW_RX_ID)         && 
              g_rxIndexSetBeyondBuffer  && 
              (GetRawWindowState(RAW_RX_ID) == WF_RAW_DATA_MOUNTED) ) 
        {
            SYS_ASSERT(false, "");  /* attempting to read past end of RAW buffer */
        }
    }

    regId = (rawId==RAW_ID_0)?RAW_0_DATA_REG:RAW_1_DATA_REG;
    ReadWFArray(regId, pBuffer, length);

#if defined(OUTPUT_RAW_TX_RX)
    for (i = 0; i < length; ++i)
    {
        char buf[16];
        sprintf(buf,"R: %#x\r\n", pBuffer[i]);
        SYS_CONSOLE_MESSAGE(buf);
    }    
#endif

}
Exemplo n.º 3
0
/*****************************************************************************
 * FUNCTION: RawGetByte
 *
 * RETURNS: error code
 *
 * PARAMS:
 *      rawId   - RAW ID
 *      pBuffer - Buffer to read bytes into
 *      length  - number of bytes to read
 *
 *  NOTES: Reads bytes from the RAW engine
 *****************************************************************************/
void RawGetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length)
{
    UINT8 regId;
#if defined(OUTPUT_RAW_TX_RX)
    UINT16 i;
#endif

    /* if reading a data message do following check */
    if (!g_MgmtResponseInProgress)
    {
        // if RAW index previously set out of range and caller is trying to do illegal read
        if ( (rawId==RAW_RX_ID)         &&
                g_rxIndexSetBeyondBuffer  &&
                (GetRawWindowState(RAW_RX_ID) == WF_RAW_DATA_MOUNTED) )
        {
            WF_ASSERT(FALSE);  /* attempting to read past end of RAW buffer */
        }
    }

    regId = (rawId==RAW_ID_0)?RAW_0_DATA_REG:RAW_1_DATA_REG;
    ReadWFArray(regId, pBuffer, length);

#if defined(OUTPUT_RAW_TX_RX)
    for (i = 0; i < length; ++i)
    {
        char buf[16];
        sprintf(buf,"R: %#x\r\n", pBuffer[i]);
        putsUART(buf);
    }
#endif

}
Exemplo n.º 4
0
/*****************************************************************************
 * FUNCTION: RawGetByte
 *
 * RETURNS: error code
 *
 * PARAMS:
 *      rawId   - RAW ID
 *      pBuffer - Buffer to read bytes into
 *      length  - number of bytes to read
 *
 *  NOTES: Reads bytes from the RAW engine
 *****************************************************************************/
void RawGetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length)
{
    UINT8 regId;

    WF_ASSERT(!isIndexOutOfBounds(rawId)); /* attempting to read past end of RAW buffer */

    regId = g_RawDataReg[rawId];
    ReadWFArray(regId, pBuffer, length);
}
Exemplo n.º 5
0
/*****************************************************************************
 * FUNCTION: RawGetByte
 *
 * RETURNS: error code
 *
 * PARAMS:
 *      rawId   - RAW ID
 *      pBuffer - Buffer to read bytes into
 *      length  - number of bytes to read
 *
 *  NOTES: Reads bytes from the RAW engine
 *****************************************************************************/
void RawGetByte(uint16_t rawId, uint8_t *pBuffer, uint16_t length)
{
    uint8_t regId;

    SYS_ASSERT(!isIndexOutOfBounds(rawId), ""); /* attempting to read past end of RAW buffer */

    regId = g_RawDataReg[rawId];
    ReadWFArray(regId, pBuffer, length);
}
Exemplo n.º 6
0
/*
 * Read bytes from the specified raw window.
 * Returns error code.
 *
 * Parameters:
 *  rawId   - RAW ID
 *  pBuffer - Buffer to read bytes into
 *  length  - number of bytes to read
 */
void RawGetByte(uint16_t rawId, uint8_t *pBuffer, uint16_t length)
{
    uint8_t regId;

    // if the raw index was previously set out of bounds
    if (isIndexOutOfBounds(rawId)) {
        // trying to read past end of raw window
        EventEnqueue(WF_EVENT_ERROR, UD_ERROR_RAW_GET_BYTE_OUT_OF_BOUNDS);
    }

    regId = g_RawDataReg[rawId];
    ReadWFArray(regId, pBuffer, length);
}