Skip to content
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

Update CRC to be capable of calculating CRC when data is received in chunks #61

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

Igor-Misic
Copy link
Member

@Igor-Misic Igor-Misic commented Sep 26, 2023

Description

We have addressed the issue where CRC variants could not be utilized for data chunks. An example of its use is when receiving large data, such as a firmware file, which cannot be received in a single operation.

When data arrives in chunks, it is necessary to continue calculating the CRC when new data arrives. This is where we can store the last calculated CRC value and provide it when the next set of data arrives. To enable this functionality, we have introduced a pointer called last_crc_ptr. For the first data chunk, we need to use the initial CRC value, so the first operation will require a NULL_PTR (internal logic will interpret it as initial CRC value) . For every subsequent data chunk, we use the pointer to access the last CRC value.

Things become more complex for CRC variants that also involve final XOR and output reflection. This operation only occurs during the last CRC operation, so it is the user's responsibility to determine when the last operation is taking place (when the last data chunk has arrived) and provide information through the final_crc flag."

Checklist

Please check off the following items by putting an "x" in the box:

  • I have read and understood the contribution guidelines.
  • I have added any necessary documentation (if appropriate).
  • I have added unit tests (if appropriate).
  • I have run make cppcheck on my code and fixed any reported issues.
  • I have run make astyle on my code and ensured that it adheres to the project's formatting guidelines.
  • Test coverage is at 100% for the modified code.

Additional Notes

For more information on how to use it properly with data chunks see tests with the comment "// Test with message in chunks"
Example: https://github.com/IMProject/IMUtility/pull/61/files#diff-3606d33130e3178a90da898bed06d65b10f0163b4ba0ceb8255f25540943aba8R173-R177

github-advanced-security[bot]

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f762fdc) 99.83% compared to head (815d106) 99.87%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   99.83%   99.87%   +0.04%     
==========================================
  Files          56       56              
  Lines         599      832     +233     
  Branches       97      170      +73     
==========================================
+ Hits          598      831     +233     
  Partials        1        1              
Files Coverage Δ
Src/crc/crc16_base.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_a.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_arc.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_aug_ccit.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_buypass.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_ccit_false.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_ccit_zero.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_cdma2000.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_dds110.c 100.00% <100.00%> (ø)
Src/crc/crc16_variants/crc16_dect_r.c 100.00% <100.00%> (ø)
... and 36 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Igor-Misic Igor-Misic force-pushed the pr-update_crc_with_laast_crc_value branch from 3d2eed4 to 815d106 Compare September 26, 2023 11:35
@Igor-Misic Igor-Misic changed the title Pr update crc with laast crc value Update CRC to be capable of calculating CRC when data is received in chunks Sep 26, 2023
Copy link
Member

@jciberlin jciberlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@jciberlin jciberlin merged commit 67a5ed9 into main Sep 27, 2023
9 checks passed
@jciberlin jciberlin deleted the pr-update_crc_with_laast_crc_value branch September 27, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants