Skip to content

Commit

Permalink
Clean up the CRC routines a little.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Feb 22, 2016
1 parent 0881df6 commit 7852bd5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
23 changes: 1 addition & 22 deletions CRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const uint16_t CCITT16_TABLE2[] = {
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 };


bool CCRC::checkFiveBit(bool* in, unsigned int tcrc)
{
assert(in != NULL);
Expand All @@ -144,28 +145,6 @@ void CCRC::encodeFiveBit(const bool* in, unsigned int& tcrc)
tcrc = total;
}

unsigned char CCRC::encodeEightBit(const unsigned char *in, unsigned int length)
{
assert(in != NULL);

unsigned char crc = 0x00U;

for (unsigned int i = 0U; i < length; i++) {
crc ^= in[i];

for (unsigned int j = 0U; j < 8U; j++) {
if ((crc & 0x80U) == 0x80U) {
crc <<= 1;
crc ^= 0x07U;
} else {
crc <<= 1;
}
}
}

return crc;
}

void CCRC::addCCITT162(unsigned char *in, unsigned int length)
{
assert(in != NULL);
Expand Down
2 changes: 0 additions & 2 deletions CRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class CCRC
static bool checkCCITT161(const unsigned char* in, unsigned int length);
static bool checkCCITT162(const unsigned char* in, unsigned int length);

static unsigned char encodeEightBit(const unsigned char* in, unsigned int length);

static unsigned char crc8(const unsigned char* in, unsigned int length);

static bool crcFICH(const unsigned char* fich);
Expand Down
2 changes: 1 addition & 1 deletion DMRControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool CDMRControl::processWakeup(const unsigned char* data)

unsigned int bsId = csbk.getBSId();
if (bsId == 0xFFFFFFU) {
LogMessage("CSBK BS_Dwn_Act for any received from %u", csbk.getSrcId());
LogMessage("CSBK BS_Dwn_Act for ANY received from %u", csbk.getSrcId());
return true;
} else if (bsId == m_id) {
LogMessage("CSBK BS_Dwn_Act for %u received from %u", bsId, csbk.getSrcId());
Expand Down

0 comments on commit 7852bd5

Please sign in to comment.