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

Fix card size with CSD v2.00 #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

giuseppedandrea
Copy link

Fix position of "c_size_high" in struct "csd2_t" and cast 8 bits variable ("csd.v2.c_size_mid") to allow left shift by 8 in cardSize() method.

Byte 7 of register CSD v2.00 is so composed: the first 2 bits for "reserved3" and the remaining 6 bits for "c_size_high". Because of how the bits are arranged on little-endian systems, "c_size_high" must be positioned before "reserved3" in order to have "c_size_high", "c_size_mid" and "c_size_low" arraged contiguously.
Type of csd.v2.c_size_mid is uint8_t (8 bits). In order to left shift by 8 bits csd.v2.c_size_mid without losing informations (bits), is necessary to cast the variable to uint32_t.
@TravisBuddy
Copy link

Travis tests have failed

Hey @giuseppedandrea,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: dc865a00-e7b5-11e9-8e12-4bc655cb216a

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Apr 17, 2022
@per1234
Copy link
Contributor

per1234 commented Apr 17, 2022

This would supersede #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants