Moved crc calculation into its own class, renamed function to show which
crc is calculated.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#include <framework/datalinklayer/DataLinkLayer.h>
|
||||
#include <framework/globalfunctions/crc_ccitt.h>
|
||||
#include <framework/globalfunctions/CRC.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw,
|
||||
@ -60,7 +60,7 @@ ReturnValue_t DataLinkLayer::frameValidationCheck() {
|
||||
}
|
||||
|
||||
ReturnValue_t DataLinkLayer::frameCheckCRC() {
|
||||
uint16_t checkValue = ::Calculate_CRC(this->currentFrame.getFullFrame(),
|
||||
uint16_t checkValue = CRC::crc16ccitt(this->currentFrame.getFullFrame(),
|
||||
this->currentFrame.getFullSize());
|
||||
if (checkValue == 0) {
|
||||
return RETURN_OK;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <framework/datalinklayer/TcTransferFrameLocal.h>
|
||||
#include <framework/globalfunctions/crc_ccitt.h>
|
||||
#include <framework/globalfunctions/CRC.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -25,7 +25,7 @@ TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uin
|
||||
uint16_t totalSize = sizeof(TcTransferFramePrimaryHeader) + dataSize + FRAME_CRC_SIZE -1;
|
||||
frame->header.vcidAndLength_h |= (totalSize & 0x0300) >> 8;
|
||||
frame->header.length_l = (totalSize & 0x00FF);
|
||||
uint16_t crc = ::Calculate_CRC(getFullFrame(), getFullSize() -2);
|
||||
uint16_t crc = CRC::crc16ccitt(getFullFrame(), getFullSize() -2);
|
||||
this->getFullFrame()[getFullSize()-2] = (crc & 0xFF00) >> 8;
|
||||
this->getFullFrame()[getFullSize()-1] = (crc & 0x00FF);
|
||||
} else if (dataSize <= 1016) {
|
||||
@ -33,7 +33,7 @@ TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uin
|
||||
uint16_t dataCrcSize = sizeof(TcTransferFramePrimaryHeader) + 1 + dataSize + FRAME_CRC_SIZE -1;
|
||||
frame->header.vcidAndLength_h |= (dataCrcSize & 0x0300) >> 8;
|
||||
frame->header.length_l = (dataCrcSize & 0x00FF);
|
||||
uint16_t crc = ::Calculate_CRC(getFullFrame(), getFullSize() -2);
|
||||
uint16_t crc = CRC::crc16ccitt(getFullFrame(), getFullSize() -2);
|
||||
this->getFullFrame()[getFullSize()-2] = (crc & 0xFF00) >> 8;
|
||||
this->getFullFrame()[getFullSize()-1] = (crc & 0x00FF);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user