7 #ifndef ZPP_INCLUDE_ZPP_THREAD_PRIO_HPP
8 #define ZPP_INCLUDE_ZPP_THREAD_PRIO_HPP
10 #include <zephyr/kernel.h>
11 #include <zephyr/sys/__assert.h>
35 if (m_prio < -CONFIG_NUM_COOP_PRIORITIES) {
36 m_prio = -CONFIG_NUM_COOP_PRIORITIES;
37 }
else if (m_prio > (CONFIG_NUM_PREEMPT_PRIORITIES - 1)) {
38 m_prio = CONFIG_NUM_PREEMPT_PRIORITIES - 1;
41 __ASSERT_NO_MSG(m_prio == prio);
91 return thread_prio(CONFIG_NUM_PREEMPT_PRIORITIES - 1);
188 return (prio >= CONFIG_NUM_PREEMPT_PRIORITIES) ?
207 return (lhs.native_value() == rhs.native_value());
221 return (lhs.native_value() != rhs.native_value());
232 constexpr thread_prio
246 constexpr thread_prio
259 printk(
"%d", prio.native_value());
static constexpr thread_prio coop(int prio) noexcept
Create a cooperative priority value.
constexpr thread_prio() noexcept
Default constructor initializing priority to zero.
static constexpr thread_prio max_preempt_numeric() noexcept
Get the minium preempt numeric value.
static constexpr thread_prio min_numeric() noexcept
Get the minium numeric value.
static constexpr thread_prio highest_coop() noexcept
Get the most prior cooperative priority.
static constexpr thread_prio max_numeric() noexcept
Get the maxium numeric value.
static constexpr thread_prio lowest_preempt() noexcept
Get the least prior preemptive priority.
static constexpr thread_prio min_coop_numeric() noexcept
Get the minium coop numeric value.
static constexpr thread_prio min_preempt_numeric() noexcept
Get the minium preempt numeric value.
constexpr thread_prio(int prio) noexcept
Constructor initializing priority to prio.
static constexpr thread_prio preempt(int prio) noexcept
Create a preemptive priority value.
constexpr int native_value() const noexcept
Get the Zephyr native priority value.
static constexpr thread_prio lowest_coop() noexcept
Get the least prior cooperative priority.
static constexpr thread_prio highest_preempt() noexcept
Get the most prior preemptive priority.
static constexpr thread_prio max_coop_numeric() noexcept
Get the minium coop numeric value.
constexpr thread_prio operator+(thread_prio lhs, int rhs) noexcept
Increase priority by rhs.
constexpr bool operator==(const result< T_Ok, T_Error > &lhs, bool rhs) noexcept
compare result with bool
constexpr thread_prio operator-(thread_prio lhs, int rhs) noexcept
Reduce priority by rhs.
void print_arg(thread_id id) noexcept
Helper to output the ID with zpp::print("{}", id)
constexpr bool operator!=(const result< T_Ok, T_Error > &lhs, bool rhs) noexcept
compare result with bool