/** @file
|
Header file for GPIO Lib implementation.
|
|
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
**/
|
#ifndef _GPIO_LIBRARY_H_
|
#define _GPIO_LIBRARY_H_
|
|
#include <Base.h>
|
#include <Uefi/UefiBaseType.h>
|
#include <Library/IoLib.h>
|
#include <Library/DebugLib.h>
|
#include <Library/BaseMemoryLib.h>
|
#include <Library/GpioLib.h>
|
#include <Library/GpioNativeLib.h>
|
#include <Library/GpioPrivateLib.h>
|
#include <Library/PchInfoLib.h>
|
#include <Library/SataLib.h>
|
#include <Library/PchCycleDecodingLib.h>
|
#include <Library/PchSbiAccessLib.h>
|
#include <Library/PmcPrivateLib.h>
|
#include <Library/GpioHelpersLib.h>
|
#include <Register/GpioRegs.h>
|
|
//
|
// Number of PADCFG_DW registers
|
//
|
#define GPIO_PADCFG_DW_REG_NUMBER 4
|
|
/**
|
This internal procedure will calculate GPIO_RESET_CONFIG value (new type)
|
based on provided PadRstCfg for a specific GPIO Pad.
|
|
@param[in] GpioPad GPIO Pad
|
@param[in] PadRstCfg GPIO PadRstCfg value
|
|
@retval GpioResetConfig GPIO Reset configuration (new type)
|
**/
|
GPIO_RESET_CONFIG
|
GpioResetConfigFromPadRstCfg (
|
IN GPIO_PAD GpioPad,
|
IN UINT32 PadRstCfg
|
);
|
|
/**
|
This internal procedure will calculate PadRstCfg register value based
|
on provided GPIO Reset configuration for a certain pad.
|
|
@param[in] GpioPad GPIO Pad
|
@param[in] GpioResetConfig GPIO Reset configuration
|
@param[out] PadRstCfg GPIO PadRstCfg value
|
|
@retval EFI_SUCCESS The function completed successfully
|
@retval EFI_INVALID_PARAMETER Invalid configuration
|
**/
|
EFI_STATUS
|
GpioPadRstCfgFromResetConfig (
|
IN GPIO_PAD GpioPad,
|
IN GPIO_RESET_CONFIG GpioResetConfig,
|
OUT UINT32 *PadRstCfg
|
);
|
|
/**
|
This procedure will calculate PADCFG register value based on GpioConfig data
|
|
@param[in] GpioPad GPIO Pad
|
@param[in] GpioConfig GPIO Configuration data
|
@param[out] PadCfgDwReg PADCFG DWx register value
|
@param[out] PadCfgDwRegMask Mask with PADCFG DWx register bits to be modified
|
|
@retval Status
|
**/
|
EFI_STATUS
|
GpioPadCfgRegValueFromGpioConfig (
|
IN GPIO_PAD GpioPad,
|
IN CONST GPIO_CONFIG *GpioConfig,
|
OUT UINT32 *PadCfgDwReg,
|
OUT UINT32 *PadCfgDwRegMask
|
);
|
|
#endif // _GPIO_LIBRARY_H_
|