-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2449, crc calculation refactor #2450
Conversation
64f3dca
to
1942c01
Compare
Sample of functional test output after this fix.
Notably, CRC values in the range of 0x8000 - 0xFFFF are returned correctly now. Previously, they were reported as a 32-bit sign-extended value, e.g. 0xFFFFE493 (4294960275) instead of 0xE493 (58515). Although the lower 16 bits still matched, a user would have to mask those out to check it. Now, it matches properly. |
Move the current CRC-16 algorithm to a separate source file and better structure the code to support future CRC algorithm alternatives. Improve documentation to better indicate what the current algorithm is and what to expect going forward. Also corrects for issues in the CRC functional test: - Use the standard check input and compare against the standard check value for CRC-16/ARC. - Change cases from MIR to a normal test case - given a specific algorithm with specific input, the return value should be the same.
1942c01
to
e437420
Compare
return Crc; | ||
} | ||
|
||
CFE_ES_ComputeCRC_Params_t *CFE_ES_ComputeCRC_GetParams(CFE_ES_CrcType_Enum_t CrcType) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion
#include "common_types.h" | ||
#include "cfe_es.h" | ||
|
||
typedef uint32 (*const CFE_ES_ComputeCRC_Algo_t)(const void *DataPtr, size_t DataLength, uint32 InputCRC); |
Check notice
Code scanning / CodeQL-coding-standard
Hidden pointer indirection
*Combines:* cFE v7.0.0-rc4+dev395 osal v6.0.0-rc4+dev239 **Includes:** *cFE* - nasa/cFE#2440 - nasa/cFE#2450 *osal* - nasa/osal#1422 Co-authored by: Justin Figueroa <[email protected]> Co-authored by: Jacob Hageman <[email protected]> Co-authored by: Joseph Hickey <[email protected]>
*Combines:* cFE v7.0.0-rc4+dev395 osal v6.0.0-rc4+dev239 **Includes:** *cFE* - nasa/cFE#2440 - nasa/cFE#2450 *osal* - nasa/osal#1422 Co-authored by: Justin Figueroa <[email protected]> Co-authored by: Jacob Hageman <[email protected]> Co-authored by: Joseph Hickey <[email protected]>
Checklist (Please check before submitting)
Describe the contribution
Move the current CRC-16 algorithm to a separate source file and better structure the code to support future CRC algorithm alternatives. Improve documentation to better indicate what the current algorithm is and what to expect going forward.
Also corrects for issues in the CRC functional test:
Fixes #2449
Testing performed
Build and run coverage test and functional test
Expected behavior changes
CRC algorithms are better documented, code better abstracted in a separate source file to more easily permit additional routines to be implemented in the future.
Functional test cases are fixed and should be comparable to 3rd party implementation of the same algorithm.
System(s) tested on
Debian
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.