TianoCore EDK2 master
Loading...
Searching...
No Matches
EmbeddedGpio.h File Reference

Go to the source code of this file.

Data Structures

struct  _EMBEDDED_GPIO_PPI
 

Macros

#define GPIO(Port, Pin)   ((EMBEDDED_GPIO_PIN)(((Port) << (16)) | (Pin)))
 
#define GPIO_PIN(x)   ((EMBEDDED_GPIO_PIN)(x) & (0xFFFF))
 
#define GPIO_PORT(x)   ((EMBEDDED_GPIO_PIN)(x) >> (16))
 

Typedefs

typedef struct _EMBEDDED_GPIO_PPI EMBEDDED_GPIO_PPI
 
typedef UINTN EMBEDDED_GPIO_PIN
 
typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT UINTN *Value)
 
typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)
 
typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET_MODE) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT EMBEDDED_GPIO_MODE *Mode)
 
typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET_PULL) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_PULL Direction)
 

Enumerations

enum  EMBEDDED_GPIO_MODE {
  GPIO_MODE_INPUT = 0x00 , GPIO_MODE_OUTPUT_0 = 0x0E , GPIO_MODE_OUTPUT_1 = 0x0F , GPIO_MODE_SPECIAL_FUNCTION_2 = 0x02 ,
  GPIO_MODE_SPECIAL_FUNCTION_3 = 0x03 , GPIO_MODE_SPECIAL_FUNCTION_4 = 0x04 , GPIO_MODE_SPECIAL_FUNCTION_5 = 0x05 , GPIO_MODE_SPECIAL_FUNCTION_6 = 0x06 ,
  GPIO_MODE_SPECIAL_FUNCTION_7 = 0x07 , GPIO_MODE_INPUT = 0x00 , GPIO_MODE_OUTPUT_0 = 0x0E , GPIO_MODE_OUTPUT_1 = 0x0F ,
  GPIO_MODE_SPECIAL_FUNCTION_2 = 0x02 , GPIO_MODE_SPECIAL_FUNCTION_3 = 0x03 , GPIO_MODE_SPECIAL_FUNCTION_4 = 0x04 , GPIO_MODE_SPECIAL_FUNCTION_5 = 0x05 ,
  GPIO_MODE_SPECIAL_FUNCTION_6 = 0x06 , GPIO_MODE_SPECIAL_FUNCTION_7 = 0x07
}
 
enum  EMBEDDED_GPIO_PULL {
  GPIO_PULL_NONE , GPIO_PULL_UP , GPIO_PULL_DOWN , GPIO_PULL_NONE ,
  GPIO_PULL_UP , GPIO_PULL_DOWN
}
 

Variables

EFI_GUID gEmbeddedGpioPpiGuid
 

Detailed Description

Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Copyright (c) 2017, Linaro, Ltd. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file EmbeddedGpio.h.

Macro Definition Documentation

◆ GPIO

#define GPIO (   Port,
  Pin 
)    ((EMBEDDED_GPIO_PIN)(((Port) << (16)) | (Pin)))

Definition at line 23 of file EmbeddedGpio.h.

◆ GPIO_PIN

#define GPIO_PIN (   x)    ((EMBEDDED_GPIO_PIN)(x) & (0xFFFF))

Definition at line 24 of file EmbeddedGpio.h.

◆ GPIO_PORT

#define GPIO_PORT (   x)    ((EMBEDDED_GPIO_PIN)(x) >> (16))

Definition at line 25 of file EmbeddedGpio.h.

Typedef Documentation

◆ EMBEDDED_GPIO_GET

typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT UINTN *Value)

Gets the state of a GPIO pin

Parameters
ThisPointer to protocol
GpioWhich pin to read
ValueState of the pin
Return values
EFI_SUCCESSGPIO state returned in Value
EFI_INVALID_PARAMETERValue is NULL
EFI_NOT_FOUNDPin does not exit

Definition at line 63 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_GET_MODE

typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET_MODE) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT EMBEDDED_GPIO_MODE *Mode)

Gets the mode (function) of a GPIO pin

Parameters
ThisPointer to protocol
GpioWhich pin
ModePointer to output mode value
Return values
EFI_SUCCESSMode value retrieved
EFI_INVALID_PARAMETERMode is NULL
EFI_NOT_FOUNDPin does not exit

Definition at line 105 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_PIN

typedef UINTN EMBEDDED_GPIO_PIN

Definition at line 21 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_PPI

Definition at line 16 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_SET

typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)

Sets the state of a GPIO pin

Parameters
ThisPointer to protocol
GpioWhich pin to modify
ModeMode to set
Return values
EFI_SUCCESSGPIO set as requested
EFI_INVALID_PARAMETERInvalid mode
EFI_NOT_FOUNDPin does not exit

Definition at line 84 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_SET_PULL

typedef EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET_PULL) (IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_PULL Direction)

Sets the pull-up / pull-down resistor of a GPIO pin

Parameters
ThisPointer to PPI
GpioPort/pin index
PullThe pullup/pulldown mode to set
Return values
EFI_SUCCESSMode was set
EFI_NOT_FOUNDPin does not exist
EFI_UNSUPPORTEDAction not supported

Definition at line 126 of file EmbeddedGpio.h.

Enumeration Type Documentation

◆ EMBEDDED_GPIO_MODE

enum EMBEDDED_GPIO_MODE

Definition at line 27 of file EmbeddedGpio.h.

◆ EMBEDDED_GPIO_PULL

enum EMBEDDED_GPIO_PULL

Definition at line 39 of file EmbeddedGpio.h.