-
Notifications
You must be signed in to change notification settings - Fork 576
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
os/drivers/serial: avoid board sleep in UART RX #6485
base: master
Are you sure you want to change the base?
Conversation
This commit make use of PM APIs to avoid board sleep during uart_recvchars operation. This will ensure UART RX IRQ can be handled by application without board sleep.
81020bd
to
e2480c5
Compare
Test Results : Building and booting is fine. |
dev->received(dev); | ||
#ifdef CONFIG_PM | ||
/* Enable board sleep after completing received operation */ | ||
(void)pm_resume(pm_uart_domain_id); |
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.
it should be in serial_read().
@@ -75,6 +75,12 @@ | |||
* Pre-processor Definitions | |||
************************************************************************************/ | |||
|
|||
/* The UART Domain name, that needs to register with PM */ |
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.
A header in os/include is for outside usages. But only serial uses those two definitions inside. Let's move them in some header in os/drivers/serial.
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.
avoiding board to sleep in uart rx this fixes the issue, change is good to merge.
DEBUGASSERT(pm_uart_domain_id != -1); | ||
/* Suspend board sleep if application is wating for UART data */ | ||
(void)pm_suspend(pm_uart_domain_id); | ||
#endif | ||
dev->received(dev); |
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 will just post a semaphore and not perform the actual read operation. So, pm can still go into sleep if we resume here. pm_resume must be called at the end of uart_read when we know that the app has actually read the data.
This commit make use of PM APIs to avoid board sleep during uart_recvchars operation. This will ensure UART RX IRQ can be handled by application without board sleep.