21 #ifndef ARCH_FLASH_HPP_INCLUDED 22 #define ARCH_FLASH_HPP_INCLUDED 32 template<
typename pwr_type >
33 struct prefetch_buffer_enable_impl {
34 static_assert(pwr_type::system_voltage >=
volt(2.1),
"prefetch buffer must be disabled when the supply voltage is below 2.1V");
41 (system_voltage <=
volt(2.1)) ?
42 ((hclk_freq <=
mhz(20)) ? 0 :
43 (hclk_freq <=
mhz(40)) ? 1 :
44 (hclk_freq <=
mhz(60)) ? 2 :
45 (hclk_freq <=
mhz(80)) ? 3 :
46 (hclk_freq <=
mhz(100)) ? 4 :
47 (hclk_freq <=
mhz(120)) ? 5 :
48 (hclk_freq <=
mhz(140)) ? 6 :
49 (hclk_freq <=
mhz(160)) ? 7 :
51 (system_voltage <=
volt(2.4)) ?
52 ((hclk_freq <=
mhz(22)) ? 0 :
53 (hclk_freq <=
mhz(44)) ? 1 :
54 (hclk_freq <=
mhz(66)) ? 2 :
55 (hclk_freq <=
mhz(88)) ? 3 :
56 (hclk_freq <=
mhz(110)) ? 4 :
57 (hclk_freq <=
mhz(132)) ? 5 :
58 (hclk_freq <=
mhz(154)) ? 6 :
59 (hclk_freq <=
mhz(168)) ? 7 :
61 (system_voltage <=
volt(2.7)) ?
62 ((hclk_freq <=
mhz(24)) ? 0 :
63 (hclk_freq <=
mhz(48)) ? 1 :
64 (hclk_freq <=
mhz(72)) ? 2 :
65 (hclk_freq <=
mhz(96)) ? 3 :
66 (hclk_freq <=
mhz(120)) ? 4 :
67 (hclk_freq <=
mhz(144)) ? 5 :
68 (hclk_freq <=
mhz(168)) ? 6 :
70 (system_voltage <=
volt(3.6)) ?
71 ((hclk_freq <=
mhz(30)) ? 0 :
72 (hclk_freq <=
mhz(60)) ? 1 :
73 (hclk_freq <=
mhz(90)) ? 2 :
74 (hclk_freq <=
mhz(120)) ? 3 :
75 (hclk_freq <=
mhz(150)) ? 4 :
76 (hclk_freq <=
mhz(168)) ? 5 :
82 template<
typename pwr_type >
94 template<
typename system_clock_type,
typename pwr_type >
97 min_latency(system_clock_type::hclk_freq, pwr_type::system_voltage)
100 template<
unsigned ws >
109 template<
typename... Tp >
111 reglist< Tp... >::template strict_reset_to< FLASH::ACR >();
117 #endif // ARCH_FLASH_HPP_INCLUDED
typename Tp::value_type value_type
typename prefetch_buffer_enable_impl< pwr_type >::type prefetch_buffer_enable
Definition: flash.hpp:83
static constexpr voltage_t volt(long double x)
static constexpr freq_t mhz(unsigned long long x)
regbits< type, 0, 3 > LATENCY
Latency.
Definition: flash.hpp:53
static void configure(void)
Configure FLASH register using configuration traits (Tp).
Definition: flash.hpp:110