-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: i2c: sam0: Continue write/read if next message allows it #38482
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
drivers: i2c: sam0: Continue write/read if next message allows it #38482
Conversation
|
It's not immediately obvious - what necessitated all of the changes from |
data->msgs and data->num_msgs are now shared variables with the isr. The isr will update these variables if it directly continues on with the next message. This could be changed so that the isr instead only receives pointers to the old variables for less code change. |
ee7d890 to
f6cd68b
Compare
drivers/i2c/i2c_sam0.c
Outdated
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.
The restart flag should be checked on the next message, not the current one.
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.
Fixed, also updated line 149 to make it more readable.
Hmm... Zephyr-style ISR handlers do have a data pointer but presumably that would used by the driver instance. I see no reason to block (once @anangl's comment is addressed), but it would be great if you could look into that later @rustypig91. |
f6cd68b to
4d1f6dd
Compare
drivers/i2c/i2c_sam0.c
Outdated
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.
This comment became inaccurate after the recent change regarding the restart flag. It would be nice to update it.
Update sam0 i2c driver to directly send/receive next message if it is in the same direction and the current message has no stop or restart flags. Seems like in some drivers this is the expected behaviour. Fixes zephyrproject-rtos#36857 Signed-off-by: Christoffer Zakrisson <[email protected]>
4d1f6dd to
625a97e
Compare
|
How was this tested? This change causes every byte read to get NACK'd if num_msgs == 1 |
Tested against an ssd1306 so unfortunately limited testing on read messages :/ |
PR zephyrproject-rtos#38482 made the sam0 i2c send NACK when receiving a single message Fixes zephyrproject-rtos#38878 Fixes zephyrproject-rtos#41016 Signed-off-by: Christoffer Zakrisson <[email protected]>
PR #38482 made the sam0 i2c send NACK when receiving a single message Fixes #38878 Fixes #41016 Signed-off-by: Christoffer Zakrisson <[email protected]>
Update sam0 i2c driver to directly send/receive next message if it is
in the same direction and the current message has no stop or restart
flags. Seems like in some drivers this is the expected behaviour.
Fixes #36857
Signed-off-by: Christoffer Zakrisson [email protected]