21#ifndef PF1550_SEQUENCER_HPP
22#define PF1550_SEQUENCER_HPP
55 std::array<uint8_t, kRailCount>
order{};
71inline constexpr std::array<std::array<uint8_t, kRailCount>, 9> kPowerUpOrder = {{
72 {1, 2, 3, 4, 4, 5, 5},
73 {5, 5, 1, 1, 1, 1, 5},
74 {3, 3, 3, 3, 2, 3, 3},
75 {4, 3, 2, 1, 2, 1, 3},
76 {3, 3, 3, 3, 2, 3, 3},
77 {3, 3, 3, 3, 2, 3, 3},
78 {3, 3, 3, 3, 2, 3, 3},
79 {3, 3, 3, 3, 2, 3, 3},
80 {3, 3, 3, 3, 3, 3, 3},
84inline constexpr std::array<bool, 9> kSw1Dvs = {
false,
true,
true,
true,
true,
85 true,
true,
true,
false};
87inline constexpr std::array<bool, 9> kSw2Dvs = {
true,
false,
false,
true,
false,
88 false,
false,
false,
false};
99 const auto n =
static_cast<std::size_t
>(detail::ToUnderlying(option));
100 if ((n < 1U) || (n > detail::kPowerUpOrder.size())) {
104 p.
order = detail::kPowerUpOrder[n - 1U];
107 p.sw1_dvs = detail::kSw1Dvs[n - 1U];
108 p.sw2_dvs = detail::kSw2Dvs[n - 1U];
119 const uint32_t order =
120 profile.order[
static_cast<std::size_t
>(detail::ToUnderlying(rail)) %
kRailCount];
121 return (order > 1U) ? ((order - 1U) * profile.slot_us) : 0U;
130 uint32_t longest = 0U;
131 for (
const uint8_t order : profile.order) {
132 const uint32_t d = (order > 1U) ? ((
static_cast<uint32_t
>(order) - 1U) * profile.slot_us) : 0U;
133 longest = (d > longest) ? d : longest;
144 constexpr std::array<uint32_t, 8> kMs = {2, 0, 4, 8, 16, 128, 256, 1024};
145 if ((code >= kMs.size()) || (kMs[code] == 0U)) {
160 uint32_t por_dly_code)
noexcept {
175 bool bypassed =
true;
176 for (
const uint8_t order : sequence.order) {
177 bypassed = bypassed && (order == 0U);
191 uint32_t highest = 0U;
192 for (
const uint8_t order : sequence.order) {
193 highest = (order > highest) ? order : highest;
196 sequence.order[
static_cast<std::size_t
>(detail::ToUnderlying(rail)) %
kRailCount];
206 uint32_t highest = 0U;
207 for (
const uint8_t order : sequence.order) {
208 highest = (order > highest) ? order : highest;
221 s.
order = profile.order;
constexpr uint32_t PowerDownDurationUs(const PowerDownSequence &sequence) noexcept
How long the power-down sequence takes: the delay of the last rail.
Definition pf1550_sequencer.hpp:205
constexpr uint32_t PowerUpDelayUs(const StartupProfile &profile, Rail rail) noexcept
When a rail turns on, counted from the start of the first power-up slot.
Definition pf1550_sequencer.hpp:118
constexpr bool IsPowerDownBypassed(const PowerDownSequence &sequence) noexcept
Whether the power-down sequencer is bypassed: every order is 0 (section 10.7).
Definition pf1550_sequencer.hpp:174
constexpr Result< uint32_t > ResetReleaseDelayMs(uint32_t code) noexcept
The delay of RESETBMCU after the last regulator, from POR_DLY[2:0] (Table 135).
Definition pf1550_sequencer.hpp:143
constexpr uint32_t kPowerDownStepUs
Power-down delay between regulators, microseconds (tD5 typical 2.0 ms).
Definition pf1550_sequencer.hpp:48
constexpr PowerDownSequence MirrorOf(const StartupProfile &profile) noexcept
The power-down order that mirrors the power-up order of an option, as the registers hold it after res...
Definition pf1550_sequencer.hpp:219
constexpr Result< uint32_t > ColdStartToResetReleaseUs(const StartupProfile &profile, uint32_t por_dly_code) noexcept
From a cold start to RESETBMCU high, for an option and a POR_DLY code (Table 84).
Definition pf1550_sequencer.hpp:159
constexpr uint32_t kVsnvsTurnOnDelayUs
Turn-on delay of VSNVS after a cold start, microseconds (Table 84, tD1 typical 0.6 ms).
Definition pf1550_sequencer.hpp:40
constexpr uint8_t kMaxSequenceNumber
Largest sequence number a *_PWRUP_SEQ or *_PWRDN_SEQ field holds.
Definition pf1550_sequencer.hpp:50
constexpr uint32_t kSlotFastUs
Power-up slot with OTP_SEQ_CLK_SPEED = 0, microseconds (tD3 typical 0.5 ms).
Definition pf1550_sequencer.hpp:44
constexpr uint32_t kVsnvsRiseUs
Rise time of VSNVS, microseconds (tR1 typical 0.1 ms).
Definition pf1550_sequencer.hpp:42
constexpr Result< StartupProfile > StartupProfileOf(Option option) noexcept
The pre-programmed start-up sequence of an option (Table 85).
Definition pf1550_sequencer.hpp:98
constexpr uint32_t PowerUpDurationUs(const StartupProfile &profile) noexcept
How long the power-up sequencer runs: the start of the last slot used.
Definition pf1550_sequencer.hpp:129
constexpr uint32_t kSlotSlowUs
Power-up slot with OTP_SEQ_CLK_SPEED = 1, microseconds (tD3 typical 2.0 ms).
Definition pf1550_sequencer.hpp:46
constexpr uint32_t PowerDownDelayUs(const PowerDownSequence &sequence, Rail rail) noexcept
When a rail turns off in a power-down, counted from the start of the sequence.
Definition pf1550_sequencer.hpp:190
constexpr std::size_t kRailCount
Number of rails.
Definition pf1550_types.hpp:259
Option
The start-up option of the part (OTP_FLAVOR, Table 87; ordering codes A0 to A9).
Definition pf1550_types.hpp:215
Rail
The power rails the driver configures.
Definition pf1550_types.hpp:249
@ Unknown
A flavour byte the data sheet does not list (ambiguity C10).
@ A0
Not programmed: internal validation only; nothing is assumed about it.
@ A8
Option A8 (edge-sensitive PWRON).
@ Ldo1
LDO1, 300 mA, load switch capable.
The PF1550 driver: everything it declares lives here; internals in detail.
Definition pf1550.hpp:39
Compile-time helpers of the PF1550 driver: typed integer literals, exact hook matching,...
Public types of the PF1550 driver: errors, Result<T>, enumerations, units, status and interrupt types...
The registers of the power-down sequence (Tables 139 to 145).
Definition pf1550_types.hpp:582
std::array< uint8_t, kRailCount > order
Definition pf1550_types.hpp:585
The value of a call, or why there is none.
Definition pf1550_types.hpp:123
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition pf1550_types.hpp:149
static constexpr Result Success(T v) noexcept
A successful result.
Definition pf1550_types.hpp:141
T value
The value; T{} when the call failed.
Definition pf1550_types.hpp:124
constexpr bool ok() const noexcept
Definition pf1550_types.hpp:128
The start-up behaviour of one pre-programmed option (Table 85).
Definition pf1550_sequencer.hpp:53
bool sw2_dvs
OTP_SW2_DVS_SEL: true for DVS mode (C57).
Definition pf1550_sequencer.hpp:64
bool pwron_edge
OTP_PWRON_CFG: true when PWRON is edge sensitive (option A8), false for level.
Definition pf1550_sequencer.hpp:59
bool sw1_dvs
Definition pf1550_sequencer.hpp:62
uint32_t slot_us
Length of one power-up slot in microseconds: 500 for OTP_SEQ_CLK_SPEED = 0, 2000 for 1.
Definition pf1550_sequencer.hpp:57
std::array< uint8_t, kRailCount > order
OTP_xxx_PWRUP_SEQ[2:0] per rail, indexed by Rail.
Definition pf1550_sequencer.hpp:55