-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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: serial: nrfx_uarte: UART shim based on nrfx_uarte driver #65155
drivers: serial: nrfx_uarte: UART shim based on nrfx_uarte driver #65155
Conversation
b027a7a
to
83e124b
Compare
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
a6e25db
to
c92d171
Compare
946e8e6
to
d58bbf3
Compare
d58bbf3
to
a273de8
Compare
a273de8
to
33cffd8
Compare
drivers/serial/uart_nrfx_uarte2.c
Outdated
if ((IS_INT_DRIVEN_API(dev) || IS_POLLING_API(dev)) && | ||
!(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { |
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.
For consistency with PM_DEVICE_ACTION_RESUME
:
if ((IS_INT_DRIVEN_API(dev) || IS_POLLING_API(dev)) && | |
!(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { | |
if (!IS_ASYNC_API(dev) && !(cfg->flags & UARTE_CFG_FLAG_NO_RX)) { |
drivers/serial/uart_async_to_irq.c
Outdated
|
||
static const struct uart_async_to_irq_config *get_config(const struct device *dev) | ||
{ | ||
const struct uart_async_to_irq_config **config = dev->config; |
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.
Sorry, I missed that one const
in my previous comment.
const struct uart_async_to_irq_config **config = dev->config; | |
const struct uart_async_to_irq_config *const *config = dev->config; |
560afe1
to
d882b8e
Compare
Add adaptation layer which allows to provide interrupt driven API for drivers which exposes only asynchronous API. Signed-off-by: Krzysztof Chruściński <[email protected]>
Since it takes 400 bytes of code and it is rarely used disable by default this feature. Signed-off-by: Krzysztof Chruściński <[email protected]>
Add Kconfig options to new configuration flags for nrfx_uarte. Signed-off-by: Krzysztof Chruściński <[email protected]>
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.
IMHO this should be fixed better https://github.com/zephyrproject-rtos/zephyr/pull/65155/files#r1450353386, but let's move on.
drivers/serial/uart_nrfx_uarte2.c
Outdated
k_msleep(1); | ||
} | ||
Z_SPIN_DELAY(3); | ||
} while (err != NRFX_ERROR_BUSY); |
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.
Isn't this a bug? shouldn't it be
} while (err != NRFX_SUCCESS);
?
Otherwise the same byte would be enqueued again if nrfx_uarte_tx()
enqueued it right away, or?
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.
Yes, it should be while (err == NRFX_ERROR_BUSY)
.
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 #65155 (comment).
d882b8e
to
cfa4d58
Compare
Add new shim which is based on nrfx driver. Legacy shim is kept for transition period. It can be used after setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM. Signed-off-by: Krzysztof Chruściński <[email protected]>
Align test configurations to the new uart driver based on nrfx_uarte. Signed-off-by: Krzysztof Chruściński <[email protected]>
Add configuration which tests legacy nrf uart driver. Prevent tests on nrf52_bsim of the new driver (it is requiring adjustments for the simulation). It will be fixed by another patch. Signed-off-by: Krzysztof Chruściński <[email protected]>
New nrf uart shim requires addiotional work around PM. Use legacy version for those tests until it is fixed. Signed-off-by: Krzysztof Chruściński <[email protected]>
New UART shim must be adapted to work in the simulated environment. Use legacy version until it is fixed. Signed-off-by: Krzysztof Chruściński <[email protected]>
Add adaptation layer which allows to provide interrupt driven API for drivers which exposes only asynchronous API. Cherry-picked from zephyrproject-rtos#65155. This commit should not be reviewed in this PR. Signed-off-by: Krzysztof Chruściński <[email protected]>
Since it takes 400 bytes of code and it is rarely used disable by default this feature. Cherry picked from zephyrproject-rtos#65155. This commit should not be reviewed in this PR. Signed-off-by: Krzysztof Chruściński <[email protected]>
Add new shim which is based on nrfx driver. Legacy shim is kept for transition period. It can be used after setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM. Cherry-picked from zephyrproject-rtos#65155. This commit should not be reviewd in this PR. Signed-off-by: Krzysztof Chruściński <[email protected]>
Align test configurations to the new uart driver based on nrfx_uarte. Cherry picked from zephyrproject-rtos#65155. This commit should not be review in this PR. Signed-off-by: Krzysztof Chruściński <[email protected]>
Check was complaining when Kconfig flag was build using concatenation via a macro (it was covering explicit token pasting ##). Added negative lookbehind for CAT( which should cover exisiting concatenation macros (UTIL_CAT, CONCAT, CAT). Cherry picked from zephyrproject-rtos#65155. This commit should not be review in this PR. Signed-off-by: Krzysztof Chruściński <[email protected]>
PR adds new Nordic UART shim which is based on the nrfx_uarte driver. Legacy shim is kept for now and can be used after
CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y
.New shim implements only polling and asynchronous API. Interrupt driven API is implemented via generic asynchronous to interrupt driven adaptation layer. New shim is using different approach to RX bytes counting (legacy shim was using RXDRDY interrupt or dedicated TIMER peripheral).
New approach changes the behavior of the RX while being compliant with the API. When there is no RX activity for the specified amount of time UART RX is restarted (stopped with ENDRX_STARTRX short being set). With this approach there is no need for byte counting since DMA transfer ends on timeout and AMOUNT register is updated. However, it means that every
UART_RX_RDY
event comes with the new buffer (offset inuart_rx_event
is always 0).PR contains asynchronous to interrupt driven adaptation layer which is using
uart_async_rx
helper added by #63967.PR is based on #65113 and #63967.