Skip to content

Commit

Permalink
Merge pull request #573 from intel/lukevalenty/fix_shared_sub_irq_ena…
Browse files Browse the repository at this point in the history
…bles

fix shared_sub_irq issue where top level enable is not set
  • Loading branch information
mjcaisse-intel authored Jul 12, 2024
2 parents 90ba326 + a718e12 commit 49e43f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion include/interrupt/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ struct shared_sub_irq_impl : Config {
using Config::status_field;

[[nodiscard]] static auto get_interrupt_enables() {
return stdx::tuple_cat(Subs::get_interrupt_enables()...);
if constexpr (active) {
return stdx::tuple_cat(stdx::make_tuple(enable_field),
Subs::get_interrupt_enables()...);
} else {
return stdx::tuple{};
}
}

static auto run() -> void {
Expand Down
8 changes: 6 additions & 2 deletions test/interrupt/shared_sub_irq_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ TEST_CASE(
using impl_t =
interrupt::shared_sub_irq_impl<flow_config_t<std::true_type>,
active_sub_impl_t, inactive_sub_impl_t>;
CHECK(impl_t::get_interrupt_enables() ==
stdx::tuple{enable_field_t<17>{}, enable_field_t<0>{}});

auto expected = stdx::tuple{enable_field_t<0>{}, enable_field_t<17>{}};
auto actual = impl_t::get_interrupt_enables();

CHECK(std::size(expected) == std::size(actual));
CHECK(expected == actual);
}

0 comments on commit 49e43f9

Please sign in to comment.