11// /////////////////////////////////////////////////////////////////////////////
2- // Copyright Christopher Kormanyos 2007 - 2018 .
2+ // Copyright Christopher Kormanyos 2007 - 2025 .
33// Distributed under the Boost Software License,
44// Version 1.0. (See accompanying file LICENSE_1_0.txt
55// or copy at http://www.boost.org/LICENSE_1_0.txt)
66//
77
8- #include < algorithm>
9- #include < array>
10- #include < iterator>
118#include < mcal_irq.h>
129#include < mcal_led_sys_start_interface.h>
1310#include < os/os.h>
1411#include < os/os_task_control_block.h>
1512
13+ #include < algorithm>
14+ #include < array>
15+ #include < iterator>
16+
1617namespace
1718{
18- typedef std::array<os::task_control_block, OS_TASK_COUNT> task_list_type ;
19+ using task_list_type = std::array<os::task_control_block, OS_TASK_COUNT>;
1920
20- typedef std::uint_fast8_t task_index_type ;
21+ using task_index_type = std::uint_fast8_t ;
2122
2223 // The one (and only one) operating system task list.
2324 task_list_type os_task_list (OS_TASK_LIST);
2425
2526 // The index of the running task.
26- task_index_type os_task_index;
27+ task_index_type os_task_index { } ;
2728}
2829
29- void os::start_os ()
30+ auto os::start_os () -> void
3031{
3132 // Initialize each task once (and only once) before the task scheduling begins.
3233 auto const it_init_func = std::for_each (os_task_list.cbegin (),
@@ -50,7 +51,7 @@ void os::start_os()
5051 // In this way, each task in the loop will be checked for being
5152 // ready using the same time-point.
5253
53- const os::tick_type timepoint_of_ckeck_ready = os::timer_type::get_mark ();
54+ const os::tick_type timepoint_of_ckeck_ready { os::timer_type::get_mark () } ;
5455
5556 os_task_index = static_cast <task_index_type>(0U );
5657
@@ -74,7 +75,7 @@ void os::start_os()
7475 }
7576}
7677
77- bool os::set_event (const task_id_type task_id, const event_type& event_to_set)
78+ auto os::set_event (const task_id_type task_id, const event_type& event_to_set) -> bool
7879{
7980 if (task_id < task_id_end)
8081 {
@@ -98,7 +99,7 @@ bool os::set_event(const task_id_type task_id, const event_type& event_to_set)
9899 }
99100}
100101
101- void os::get_event (event_type& event_to_get)
102+ auto os::get_event (event_type& event_to_get) -> void
102103{
103104 // Get the iterator of the control block of the running task.
104105 const auto it_running_task = (os_task_list.cbegin () + os_task_index);
@@ -108,7 +109,7 @@ void os::get_event(event_type& event_to_get)
108109 // Get the event of the running task.
109110 mcal::irq::disable_all ();
110111
111- const volatile event_type the_event = it_running_task->my_event ;
112+ const volatile event_type the_event { it_running_task->my_event } ;
112113
113114 mcal::irq::enable_all ();
114115
@@ -120,14 +121,14 @@ void os::get_event(event_type& event_to_get)
120121 }
121122}
122123
123- void os::clear_event (const event_type& event_to_clear)
124+ auto os::clear_event (const event_type& event_to_clear) -> void
124125{
125126 // Get the iterator of the control block of the running task.
126127 const auto it_running_task = (os_task_list.begin () + os_task_index);
127128
128129 if (it_running_task != os_task_list.end ())
129130 {
130- const volatile event_type event_clear_mask (~event_to_clear);
131+ const volatile event_type event_clear_mask { static_cast <event_type> (~event_to_clear) } ;
131132
132133 // Clear the event of the running task.
133134 mcal::irq::disable_all ();
0 commit comments