EmbeddedPkg[all]  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EmbeddedGpio.h File Reference

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 IN EMBEDDED_GPIO_PIN Gpio
 
typedef IN EMBEDDED_GPIO_PIN
OUT UINTN * 
Value
 
typedef IN EMBEDDED_GPIO_PIN
IN EMBEDDED_GPIO_MODE 
Mode
 
typedef IN EMBEDDED_GPIO_PIN
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
}
 

Functions

typedef EFI_STATUS (EFIAPI *EMBEDDED_GPIO_GET)(IN EMBEDDED_GPIO_PPI *This
 

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

Macro Definition Documentation

#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))

Typedef Documentation

typedef UINTN EMBEDDED_GPIO_PIN
typedef IN EMBEDDED_GPIO_PIN Gpio
typedef IN EMBEDDED_GPIO_PIN OUT UINTN* Value

Enumeration Type Documentation

Enumerator
GPIO_MODE_INPUT 
GPIO_MODE_OUTPUT_0 
GPIO_MODE_OUTPUT_1 
GPIO_MODE_SPECIAL_FUNCTION_2 
GPIO_MODE_SPECIAL_FUNCTION_3 
GPIO_MODE_SPECIAL_FUNCTION_4 
GPIO_MODE_SPECIAL_FUNCTION_5 
GPIO_MODE_SPECIAL_FUNCTION_6 
GPIO_MODE_SPECIAL_FUNCTION_7 
GPIO_MODE_INPUT 
GPIO_MODE_OUTPUT_0 
GPIO_MODE_OUTPUT_1 
GPIO_MODE_SPECIAL_FUNCTION_2 
GPIO_MODE_SPECIAL_FUNCTION_3 
GPIO_MODE_SPECIAL_FUNCTION_4 
GPIO_MODE_SPECIAL_FUNCTION_5 
GPIO_MODE_SPECIAL_FUNCTION_6 
GPIO_MODE_SPECIAL_FUNCTION_7 
Enumerator
GPIO_PULL_NONE 
GPIO_PULL_UP 
GPIO_PULL_DOWN 
GPIO_PULL_NONE 
GPIO_PULL_UP 
GPIO_PULL_DOWN 

Function Documentation

typedef EFI_STATUS ( EFIAPI *  EMBEDDED_GPIO_GET)

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

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

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

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

Enable interrupt source Source.

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
Return values
EFI_SUCCESSSource interrupt enabled.
EFI_DEVICE_ERRORHardware could not be programmed.

Disable interrupt source Source.

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
Return values
EFI_SUCCESSSource interrupt disabled.
EFI_DEVICE_ERRORHardware could not be programmed.

Return current state of interrupt source Source.

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
InterruptStateTRUE: source enabled, FALSE: source disabled.
Return values
EFI_SUCCESSInterruptState is valid
EFI_DEVICE_ERRORInterruptState is not valid

Signal to the hardware that the End Of Interrupt state has been reached.

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
Return values
EFI_SUCCESSSource interrupt EOI'ed.
EFI_DEVICE_ERRORHardware could not be programmed.

Return the configured trigger type for an interrupt source

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
TriggerTypeThe configured trigger type
Return values
EFI_SUCCESSOperation successful
EFI_DEVICE_ERRORInformation could not be returned

Configure the trigger type for an interrupt source

Parameters
ThisInstance pointer for this protocol
SourceHardware source of the interrupt
TriggerTypeThe trigger type to configure
Return values
EFI_SUCCESSOperation successful
EFI_DEVICE_ERRORHardware could not be programmed.

Variable Documentation

EFI_GUID gEmbeddedGpioPpiGuid