-
Notifications
You must be signed in to change notification settings - Fork 3k
Introduce qspi_inst_t type for QSPI instructions #11604
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
Split from #11531 , see discussion at #11531 (comment) |
@kyle-cypress, thank you for your changes. |
drivers/QSPI.h
Outdated
@@ -39,6 +41,10 @@ namespace mbed { | |||
* @{ | |||
*/ | |||
|
|||
/** Type representing a QSPI instruction | |||
*/ | |||
typedef uint8_t qspi_inst_t; |
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.
qspi_status_t
in the HAL defines the instruction as uint8_t
. However, the drivers use "fundamental types", see other drivers like SPI. See https://os.mbed.com/handbook/C-Data-Types for details.
Although we use C99 types in HAL.
For consistency, I would leave this as it is or at least go with "unsigned char". We could challenge using these fundamental types in drivers, I recall we were asked previously. Like this one: https://os.mbed.com/questions/1749/What-are-the-preferred-data-types-for-mb/
We should fix the storage if they use unsigned for whatever reason to use the same 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.
Updated the typdef to use char
instead.
1a1819b
to
bcd98ab
Compare
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.
Looks good and shouldn't break source backward compatibility.
{ | ||
memset(&_qspi_command, 0, sizeof(qspi_command_t)); | ||
//Set up instruction phase parameters | ||
_qspi_command.instruction.bus_width = _inst_width; | ||
if (instruction != -1) { | ||
if (instruction != QSPI_NO_INST) { |
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.
Switch from -1
to 0
was intentional? Is there some other PR which is related to this change?
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.
Since qspi_inst_t is now an unsigned char, -1 is not a valid value. The #define is additionally introduced to improve clarity.
This did however prompt me to check and I noticed that there were two locations where -1 was still being passed to _qspi_build_command; I've pushed up a change updating those to use QSPI_NO_INST.
bcd98ab
to
6ae6a82
Compare
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.
Looks good to me.
@ARMmbed/mbed-os-maintainers - it looks like @0xc0170's requests have been addressed. Can this be merged? @ARMmbed/mbed-os-core - can you review and approve? |
CI started |
Test run: FAILEDSummary: 3 of 4 test jobs failed Failed test jobs:
|
I fixed the build failure directly on your branch, restarting CI |
Before I start internal tests, I'll wait for Travis, this might need a rebase, will try to do it :) |
Looks like travis passed (little fs only ongoing), starting CI |
Test run: FAILEDSummary: 3 of 4 test jobs failed Failed test jobs:
|
Looks like there are genuine, related CI failures on this PR. @kyle-cypress please investigate |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
drivers/QSPI.h
Outdated
@@ -28,6 +28,8 @@ | |||
|
|||
#define ONE_MHZ 1000000 | |||
|
|||
#define QSPI_NO_INST 0x00 |
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.
One additional request, please send new PR: Is this documented anywhere? There are in doxygen notes about: "use this value for this phase to be ignored" . This would be good to have there as well otherwise this define is not known to a user.
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.
Submitted #11691
What about the code that used previously
I would challenge this one to be functionality change rather or even breaking change. |
Pushed 021ecd0 to change the typedef's underlying type to |
Encourage the usage of consistent types (there are currently a mix of `int` and `unsigned int` used for qspi instructions) QSPI commands are limited to 8 bits, to this is a typdef to char
Existing code may a dependency on the old behavior of "-1" to mean "no instruction". Therefore, update the typedef, and the value of QSPI_NO_INST, to avoid breaking those uses.
021ecd0
to
555140a
Compare
Rebased on latest master to enable rebasing #11531 on this (to test with the changes to qspi_inst_t and QSPI_NO_INST). |
CI started So this will need one more rebase ? |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Set as needs: review , otherwise it looks ready |
Hi |
No, no further rebase is required. The rebase I pushed yesterday is off of master; the comment about #11531 was simply to provide context for the force-push (since there were no merge conflicts that would have prompted a rebase). |
Description
Encourage the usage of consistent types (there are currently a mix of
int
andunsigned int
used for qspi instructions)QSPI commands are limited to 8 bits, to this is a typdef to uint8_t
Pull request type
Reviewers
Release Notes