|
1 | 1 | /////////////////////////////////////////////////////////////////////////////// |
2 | | -// Copyright Christopher Kormanyos 2022 - 2024. |
| 2 | +// Copyright Christopher Kormanyos 2022 - 2025. |
3 | 3 | // Distributed under the Boost Software License, |
4 | 4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt |
5 | 5 | // or copy at http://www.boost.org/LICENSE_1_0.txt) |
|
8 | 8 | #ifndef MCAL_GPT_ARM_SYS_TICK_2022_11_30_H |
9 | 9 | #define MCAL_GPT_ARM_SYS_TICK_2022_11_30_H |
10 | 10 |
|
| 11 | + #include <cstddef> |
11 | 12 | #include <cstdint> |
12 | 13 | #include <limits> |
13 | 14 |
|
|
48 | 49 |
|
49 | 50 | template<const std::uint32_t SysTickMHz, |
50 | 51 | typename ValueType = std::uint64_t> |
51 | | - class arm_sys_tick : private arm_sys_tick_base<SysTickMHz, ValueType, std::uint32_t, std::uint32_t> |
| 52 | + class arm_sys_tick : private arm_sys_tick_base<SysTickMHz, ValueType, std::uintptr_t, std::uint32_t> |
52 | 53 | { |
53 | 54 | private: |
54 | | - using base_class_type = arm_sys_tick_base<SysTickMHz, ValueType, std::uint32_t, std::uint32_t>; |
| 55 | + using base_class_type = arm_sys_tick_base<SysTickMHz, ValueType, std::uintptr_t, std::uint32_t>; |
55 | 56 |
|
56 | 57 | using register_address_type = typename base_class_type::register_address_type; |
57 | 58 | using register_value_type = typename base_class_type::register_value_type; |
|
112 | 113 | // Return the system tick using a multiple read to ensure data consistency. |
113 | 114 |
|
114 | 115 | // Do the first read of the sys-tick counter and the sys-tick |
115 | | - // value. Handle reverse counting for sys-tick counter, which is |
116 | | - // counting down. |
| 116 | + // value. Also handle reverse counting for the sys-tick counter, |
| 117 | + // since this timer counts down. |
117 | 118 |
|
118 | 119 | const auto sys_tick_counter_1 = |
119 | 120 | static_cast<register_value_type> |
|
128 | 129 | const value_type sys_tick_value { my_sys_tick_value }; |
129 | 130 |
|
130 | 131 | // Do the second read of the sys-tick counter and the sys-tick |
131 | | - // value. Handle reverse counting for sys-tick counter, which is |
132 | | - // counting down. |
| 132 | + // value. Also handle reverse counting for the sys-tick counter, |
| 133 | + // since this timer counts down. |
133 | 134 |
|
134 | 135 | const auto sys_tick_counter_2 = |
135 | 136 | static_cast<register_value_type> |
|
0 commit comments