21#ifndef SBL_SYSTEM_PORT_TICK_REQUIREMENTS_HPP_
22#define SBL_SYSTEM_PORT_TICK_REQUIREMENTS_HPP_
31template<
typename T,
typename =
void>
32struct has_tick_init : std::false_type {};
34struct has_tick_init<T, std::void_t<decltype(T::init())>> : std::true_type {};
36template<
typename T,
typename =
void>
37struct has_tick_setup : std::false_type {};
39struct has_tick_setup<T, std::void_t<decltype(T::setup(std::declval<void (*)()>()))>> : std::true_type {};
41template<
typename T,
typename =
void>
42struct has_tick_enable : std::false_type {};
44struct has_tick_enable<T, std::void_t<decltype(T::enable()), decltype(T::disable())>> : std::true_type {};
46template<
typename T,
typename =
void>
47struct has_tick_overflow : std::false_type {};
49struct has_tick_overflow<T, std::void_t<decltype(T::acknowledge()), decltype(T::overflow())>>
50 : std::is_same<decltype(T::overflow()), bool> {};
52template<
typename T,
typename =
void>
53struct has_tick_count : std::false_type {};
55struct has_tick_count<T, std::void_t<decltype(T::count())>> : std::is_same<decltype(T::count()), uint32_t> {};
57template<
typename T,
typename =
void>
58struct has_tick_rate : std::false_type {};
60struct has_tick_rate<T, std::void_t<decltype(T::rate())>> : std::is_same<decltype(T::rate()), uint32_t> {};
65template<
typename Port>
67 static_assert(detail::has_tick_init<Port>::value,
"SBL ERROR: tick port missing init().\n"
68 "Required: static void init()");
69 static_assert(detail::has_tick_setup<Port>::value,
"SBL ERROR: tick port missing setup(handler).\n"
70 "Required: static void setup(void (*handler)())");
71 static_assert(detail::has_tick_enable<Port>::value,
"SBL ERROR: tick port missing enable()/disable().\n"
72 "Required: static void enable(), static void disable()");
73 static_assert(detail::has_tick_overflow<Port>::value,
74 "SBL ERROR: tick port missing acknowledge()/overflow().\n"
75 "Required: static void acknowledge(), static bool overflow()");
76 static_assert(detail::has_tick_count<Port>::value,
"SBL ERROR: tick port missing count().\n"
77 "Required: static uint32_t count()");
78 static_assert(detail::has_tick_rate<Port>::value,
"SBL ERROR: tick port missing rate().\n"
79 "Required: static constexpr uint32_t rate()");
80 static constexpr bool value = detail::has_tick_init<Port>::value && detail::has_tick_setup<Port>::value &&
81 detail::has_tick_enable<Port>::value && detail::has_tick_overflow<Port>::value &&
82 detail::has_tick_count<Port>::value && detail::has_tick_rate<Port>::value;
85template<
typename Port>