PM_SAFETY_CHECKERS

PM safety checkers library APIs are integrated into the safety application to verify the PSC/PLL configurations and validate the current PSC/PLL configurations against golden reference. Also provides the PLL lock API which is responsible for locking a PLL control module registers by preventing the stray writes.

Features Supported

The module supports below API’s for the application

  • API to get the configurations registers for PSC , PLL and RM modules.

  • API to read PLL and PSC registers at run time and validate they are matching with golden state for modules in the safety loop.

  • API to lock the PLL configuration registers.

SysConfig Features

  • None

Features NOT Supported

  • None

Important Usage Guidelines

  • None

Example Usage

The following shows an example of PM safety checkers API usage

Include the below file to access the APIs

#include "../../src/safety_checkers_pm.h"

return the pscRegCfg with register configuration for PSC module.

SafetyCheckers_pmGetPscRegCfg(pscRegCfg, size);

compares the pscRegCfg (golden reference) with runtime PSC configuration values and return success or failure.

if(gflag == 1)
{
    gflag = 0;
    retVal = SafetyCheckers_pmVerifyPscRegCfg(pscRegCfg, size);

    if(retVal != 0)
    {
        DebugP_log("Register Mismatch\r\n");
    } else{
        DebugP_log("No Register Mismatch\r\n");
    }
}

return the pllRegCfg with register configuration for PLL module.

SafetyCheckers_pmGetPllRegCfg(pllRegCfg, size);

compares the pllRegCfg (golden reference) with runtime PLL configuration values and return success or failure.

if(gflag == 1)
{
    gflag = 0;
    retVal = SafetyCheckers_pmVerifyPllRegCfg(pllRegCfg, size);

    if(retVal != 0)
    {
        DebugP_log("Register Mismatch\r\n");
    } else{
        DebugP_log("No Register Mismatch\r\n");
    }
}

lock the PLL control module registers.

if(gflag == 1)
{
    gflag = 0;
    retVal = SafetyCheckers_pmRegisterLock();

    if(retVal != 0)
    {
        DebugP_log("PLL register lock failed\r\n");
    } else{
        DebugP_log("PLL register lock passes\r\n");
    }
}

API Reference

This file contains PM safety checkers library interfaces and related data structures.

Functions

int32_t SafetyCheckers_pmGetPscRegCfg(uintptr_t *pscRegCfg, uint32_t size)

API to get register configuration for PSC module. E.g. When the PSC register config is requested, SafetyCheckers_pmGetPscRegCfg API collects the PSC configuration for devices present on the given platform. Register configuration includes PDSTAT and MDSTAT register values. The collected configuration will be stored in pscRegCfg array.

Parameters:
  • pscRegCfg – [IN/OUT] Pointer to store the PSC Register configuration

  • size – [IN] Size of register configuration memory

Returns:

SAFETY_CHECKERS_SOK in case of success, else failure.

int32_t SafetyCheckers_pmVerifyPscRegCfg(const uintptr_t *pscRegCfg, uint32_t size)

API to read back and compares the current register configuration for PSC module. E.g. When the PSC register verify is requested, SafetyCheckers_pmVerifyPscRegCfg API collects the PSC configuration for devices present on the given platform and compares with the received register configuration.

Parameters:
  • pscRegCfg – [IN/OUT] Pointer to store the PSC golden register configuration

  • size – [IN] Size of golden configuration memory

Returns:

SAFETY_CHECKERS_SOK in case of success, else failure.

int32_t SafetyCheckers_pmGetPllRegCfg(uintptr_t *pllRegCfg, uint32_t size)

API to get register configuration for PLL module. E.g. When the PLL register config is requested, SafetyCheckers_pmGetPllRegCfg API collects the PLL configuration for devices present on the given platform. Register configuration includes PLL register values. The collected configuration will be stored in pllRegCfg array.

Parameters:
  • pllRegCfg – [IN/OUT] Pointer to store the PLL Register configuration

  • size – [IN] Size of register configuration memory

Returns:

SAFETY_CHECKERS_SOK in case of success, else failure.

int32_t SafetyCheckers_pmVerifyPllRegCfg(const uintptr_t *pllRegCfg, uint32_t size)

API to read back and compares the current register configuration for PLL module. E.g. When the PLL register verify is requested, SafetyCheckers_pmVerifyPllRegCfg API collects the PLL configuration for devices present on the given platform and compares with the received register configuration.

Parameters:
  • pllRegCfg – [IN/OUT] Pointer to store the PLL golden register configuration

  • size – [IN] Size of golden configuration memory

Returns:

SAFETY_CHECKERS_SOK in case of success, else failure.

int32_t SafetyCheckers_pmRegisterLock(void)

API to lock the PLL control module registers. E.g. When the PLL register lock is requested, SafetyCheckers_pmRegisterLock API performs write operations to KICK registers which prevents the stray writes to PLL control module registers.

Returns:

SAFETY_CHECKERS_SOK in case of success, else failure.

struct SafetyCheckers_PmPllData
#include <safety_checkers_pm.h>

Structure to hold the base address and the length of PLLs.

Public Members

uint32_t baseAddr
uint32_t *regOffsetArr
uint32_t length
struct SafetyCheckers_PmPscData
#include <safety_checkers_pm.h>

Structure to hold the base address and the number of Module Domain(MD) stat and Power Domain(PD) stat registers of PSC.

Public Members

uint32_t baseAddr
uint32_t pdStat
uint32_t mdStat