-
Notifications
You must be signed in to change notification settings - Fork 8.2k
arch: arm: Add z_arch_irq_current_prio function #17301
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,8 +153,21 @@ extern void z_irq_spurious(void *unused); | |
| extern void _isr_wrapper(void); | ||
| #endif | ||
|
|
||
| /** | ||
|
||
| * @brief Check if current context can be preempted by given interrupt. | ||
| * | ||
| * @note Function does not check if interrupt is enabled. | ||
| * | ||
| * @param irq_line Interrupt ID. | ||
| * | ||
| * @return true if current context can be preempted by given interrupt, false | ||
| * otherwise. | ||
| */ | ||
| extern bool z_arm_irq_can_preempt(u32_t irq_line); | ||
|
|
||
| #endif /* _ASMLANGUAGE */ | ||
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
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.
Is this really what we want, here? What if the irq_line is, in fact, not enabled, and the priority is a trash value? Can this actually happen?
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.
current use case is using it in the driver which handles
irq_line. I wouldn't involve enabling checking into that. What to return if interrupt is disabled?falsewould be correct because disabled interrupt cannot be preempt current context but that is not what we wanted to check.By default priority in nvic is set to 0 (highest). I can add a note that only priority is checked and not the state of the interrupt.
Uh oh!
There was an error while loading. Please reload this page.
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 all depends on what API we want to provide, see the discussion below. So, if the irq_line is not enabled, this function should return false; that's my opinion. And of course, we document this nicely. Since we named it as _can_preempt(), we need to see if it can really preempt..