/* This is the the 40-bits of eventx counter. The value in this register increments each time the event selected in PMCRx occurs.  */
uint64_t SYSPM_GetEventCounter(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)
/* This is the the 40-bits of eventx counter. The value in this register increments each time the event selected in PMCRx occurs.  */
uint64_t SYSPM_GetEventCounter(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)
{
    uint32_t highOld;
    uint32_t high;
    uint32_t low;
    highOld = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].HI;
    while (true)
    {
        low  = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].LO;
        high = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].HI;
        if (high == highOld)
        {
            break;
        }
        else
        {
            highOld = high;
        }
    }
    return ((uint64_t)high << 32U) + low;
}