-
Notifications
You must be signed in to change notification settings - Fork 7.6k
drivers: spi_bitbang: Increase supported word size to 32 bits #80773
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
Conversation
|
||
/* As there is no uint24_t, it is assumed uint32_t will be used as the buffer base type. */ | ||
if (data->dfs == 3) { | ||
data->dfs = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that does not sound right, see line 233: you will advance into tx/rx buffers by 4 even for dfs of 3.
So far it seems you can remove that changes, as you anyway coalesce case 3 into case 4 in subsequent switches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see line 233: you will advance into tx/rx buffers by 4 even for dfs of 3
Yes, this is intended. Removing that line would force users to use uint24_t (which doesn't exist in zephyr, so probably uint8_t[3] would be required as a base type for the buffer). Not sure this is best idea, as for some platforms it could cause issues regarding misalignment.
If you wish, I can change it, but I believe some hardware implementations accepts 4 bytes input, even when the dfs
is 3, to avoid the misalignment mentioned above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, your explanation makes sense
This change introduces support for words up to 32 bits size to the spi_bitbang driver Signed-off-by: Michal Morsisko <[email protected]>
ed9dc70
to
1d56f54
Compare
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
bump to remove stale label |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
comment to remove stale label |
This change introduces support for words up to 32 bits size for the spi_bitbang driver.
As there is no uint24_t type for words size in range 17-24 bits, it is assumed that uint32_t will be used as a base type for the data buffer (instead of using uint8_t[3] which could introduce issues related to alignment).
For 20 bits word size:

For 32 bits word size:
