33inline constexpr std::array<IrqLocation, kIrqSourceCount>
kIrqLocations = {{
65inline constexpr std::array<uint8_t, kIrqGroups>
kIrqDefinedBits = {0xEF, 0x07, 0x07, 0x03,
66 0x07, 0x05, 0x3F, 0x1F};
111 const auto i =
static_cast<std::size_t
>(detail::ToUnderlying(source));
122 const uint32_t
byte =
123 events.status[
static_cast<std::size_t
>(detail::ToUnderlying(loc.
group)) %
kIrqGroups];
124 return ((
byte >> (loc.
bit & 7U)) & 1U) != 0U;
134 constexpr uint32_t kFaultSources = (0x3FU << 7) | (0x7U << 15) | (1U << 19) | (1U << 30);
135 const auto i =
static_cast<uint32_t
>(detail::ToUnderlying(source));
142constexpr bool HasFault(
const std::array<uint8_t, kIrqGroups>& status)
noexcept {
146 const auto source =
static_cast<IrqSource>(i);
159 return mask.masked[
static_cast<std::size_t
>(detail::ToUnderlying(group)) %
kIrqGroups];
165template <std::
size_t N>
170 auto&
byte = m.masked[
static_cast<std::size_t
>(detail::ToUnderlying(loc.
group)) %
kIrqGroups];
171 byte =
static_cast<uint8_t
>(
static_cast<uint32_t
>(byte) & ~(1U << (loc.
bit & 7U)));
constexpr bool Has(const InterruptEvents &events, IrqSource source) noexcept
Definition pf1550_irq.hpp:120
constexpr IrqMask UnmaskOnly(const std::array< IrqSource, N > &sources) noexcept
Definition pf1550_irq.hpp:166
constexpr std::array< uint8_t, kIrqGroups > kIrqSenseRegs
The sense register of each group (the charger's is CHG_INT_OK).
Definition pf1550_irq.hpp:61
constexpr uint8_t MaskByteFor(const IrqMask &mask, IrqGroup group) noexcept
Definition pf1550_irq.hpp:158
constexpr std::array< IrqLocation, kIrqSourceCount > kIrqLocations
The location of every source, indexed by IrqSource (Tables 90 to 110 and 150).
Definition pf1550_irq.hpp:33
constexpr uint8_t kCategoryMisc
MISC_INT.
Definition pf1550_irq.hpp:79
constexpr bool IsFaultSource(IrqSource source) noexcept
Definition pf1550_irq.hpp:131
constexpr uint8_t kCategoryTemp
TEMP_INT.
Definition pf1550_irq.hpp:77
constexpr uint8_t kCategorySw
SW1_INT, SW2_INT and SW3_INT.
Definition pf1550_irq.hpp:71
constexpr IrqLocation LocationOf(IrqSource source) noexcept
Definition pf1550_irq.hpp:110
constexpr uint8_t kCategoryOnkey
ONKEY_INT.
Definition pf1550_irq.hpp:75
constexpr std::array< uint8_t, kIrqGroups > kIrqMaskRegs
The mask register of each group.
Definition pf1550_irq.hpp:57
constexpr std::array< uint8_t, kIrqGroups > kIrqDefinedBits
The bits that carry a source in each group; the others are reserved and preserved.
Definition pf1550_irq.hpp:65
constexpr bool HasFault(const std::array< uint8_t, kIrqGroups > &status) noexcept
Definition pf1550_irq.hpp:142
constexpr std::array< uint8_t, kIrqGroups > kIrqStatRegs
The status register of each group, indexed by IrqGroup.
Definition pf1550_irq.hpp:53
constexpr uint8_t kCategoryLdo
LDO_INT.
Definition pf1550_irq.hpp:73
constexpr uint8_t kCategoryCharger
INT_CATEGORY bit of a group's summary (the three SW groups share bits 1 to 3 by rail).
Definition pf1550_irq.hpp:69
constexpr uint8_t CategoryBitsOf(IrqGroup group) noexcept
Definition pf1550_irq.hpp:84
constexpr uint8_t kSwIntStat2
SW_INT_STAT2: SW1 and SW2 DVS done.
Definition pf1550_registers.hpp:46
constexpr uint8_t kSwIntSense0
SW_INT_SENSE0.
Definition pf1550_registers.hpp:42
constexpr uint8_t kSwIntMask2
SW_INT_MASK2.
Definition pf1550_registers.hpp:47
constexpr uint8_t kTempIntMask0
TEMP_INT_MASK0.
Definition pf1550_registers.hpp:53
constexpr uint8_t kMiscIntStat0
MISC_INT_STAT0: power-up/down, PWRON, VSYS.
Definition pf1550_registers.hpp:58
constexpr uint8_t kChgIntMask
CHG_INT_MASK (reset: all masked).
Definition pf1550_registers.hpp:115
constexpr uint8_t kMiscIntSense0
MISC_INT_SENSE0.
Definition pf1550_registers.hpp:60
constexpr uint8_t kTempIntStat0
TEMP_INT_STAT0: die temperature 110 and 125 C.
Definition pf1550_registers.hpp:52
constexpr uint8_t kChgIntOk
CHG_INT_OK (R): live state of the sources.
Definition pf1550_registers.hpp:116
constexpr uint8_t kSwIntSense1
SW_INT_SENSE1.
Definition pf1550_registers.hpp:45
constexpr uint8_t kSwIntSense2
SW_INT_SENSE2.
Definition pf1550_registers.hpp:48
constexpr uint8_t kLdoIntMask0
LDO_INT_MASK0.
Definition pf1550_registers.hpp:50
constexpr uint8_t kSwIntStat0
SW_INT_STAT0: SWx low-side current limit.
Definition pf1550_registers.hpp:40
constexpr uint8_t kMiscIntMask0
MISC_INT_MASK0.
Definition pf1550_registers.hpp:59
constexpr uint8_t kChgInt
CHG_INT: charger interrupt status.
Definition pf1550_registers.hpp:114
constexpr uint8_t kLdoIntStat0
LDO_INT_STAT0: LDOx current-limit faults.
Definition pf1550_registers.hpp:49
constexpr uint8_t kOnkeyIntStat0
ONKEY_INT_STAT0: push and 1, 2, 3, 4, 8 s.
Definition pf1550_registers.hpp:55
constexpr uint8_t kSwIntStat1
SW_INT_STAT1: SWx high-side current limit.
Definition pf1550_registers.hpp:43
constexpr uint8_t kOnkeyIntMask0
ONKEY_INT_MASK0.
Definition pf1550_registers.hpp:56
constexpr uint8_t kLdoIntSense0
LDO_INT_SENSE0.
Definition pf1550_registers.hpp:51
constexpr uint8_t kSwIntMask1
SW_INT_MASK1.
Definition pf1550_registers.hpp:44
constexpr uint8_t kTempIntSense0
TEMP_INT_SENSE0.
Definition pf1550_registers.hpp:54
constexpr uint8_t kOnkeyIntSense0
ONKEY_INT_SENSE0.
Definition pf1550_registers.hpp:57
constexpr uint8_t kSwIntMask0
SW_INT_MASK0.
Definition pf1550_registers.hpp:41
constexpr std::size_t kIrqSourceCount
Number of interrupt sources.
Definition pf1550_types.hpp:550
IrqGroup
Interrupt groups, one status/mask/sense register triple each.
Definition pf1550_types.hpp:504
IrqSource
Every interrupt source of Tables 90 to 110 and 150 (31 sources).
Definition pf1550_types.hpp:516
constexpr std::size_t kIrqGroups
Number of interrupt groups.
Definition pf1550_types.hpp:212
@ SwHighSide
SW_INT_STAT1.
@ SysOvervoltage
SYS_OVLO_I.
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,...
PF1550 register map: addresses, bit fields, reset values and the access table (datasheet section 12).
Public types of the PF1550 driver: errors, Result<T>, enumerations, units, status and interrupt types...
Interrupt events returned by ServiceInterrupts(), one status byte per group.
Definition pf1550_types.hpp:562
std::array< uint8_t, kIrqGroups > status
The status bytes as read, before any clear.
Definition pf1550_types.hpp:563
Where one interrupt source lives.
Definition pf1550_irq.hpp:27
IrqGroup group
The group (one status, mask and sense register).
Definition pf1550_irq.hpp:28
uint8_t bit
Bit number in those registers.
Definition pf1550_irq.hpp:29
Interrupt masks, one byte per group; a set bit masks the source. The default masks every source,...
Definition pf1550_types.hpp:556