/***************************************************************************** * 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); }
/***************************************************************************** * 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); }
/***************************************************************************** * FUNCTION: RawSetByte * * RETURNS: None * * PARAMS: * rawId - RAW ID * pBuffer - Buffer containing bytes to write * length - number of bytes to read * * NOTES: Writes bytes to RAW window *****************************************************************************/ void RawSetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length) { UINT8 regId; WF_ASSERT(!isIndexOutOfBounds(rawId)); /* attempting to write past end of RAW buffer */ /* write data to raw window */ regId = g_RawDataReg[rawId]; WriteWFArray(regId, pBuffer, length); }
/***************************************************************************** * FUNCTION: RawSetByte * * RETURNS: None * * PARAMS: * rawId - RAW ID * pBuffer - Buffer containing bytes to write * length - number of bytes to read * * NOTES: Writes bytes to RAW window *****************************************************************************/ void RawSetByte(uint16_t rawId, uint8_t *pBuffer, uint16_t length) { uint8_t regId; SYS_ASSERT(!isIndexOutOfBounds(rawId), ""); /* attempting to write past end of RAW buffer */ /* write data to raw window */ regId = g_RawDataReg[rawId]; WriteWFArray(regId, pBuffer, length); }
/* * 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); }
/* * Write bytes to RAW window. * Parameters: * rawId - RAW ID * pBuffer - Buffer containing bytes to write * length - number of bytes to read */ void RawSetByte(uint16_t rawId, const uint8_t *p_buffer, uint16_t length) { uint8_t regId; // if trying to write past end of raw window if (isIndexOutOfBounds(rawId)) { EventEnqueue(WF_EVENT_ERROR, UD_ERROR_RAW_SET_BYTE_OUT_OF_BOUNDS); } /* write data to raw window */ regId = g_RawDataReg[rawId]; WriteWFArray(regId, p_buffer, length); }