TianoCore EDK2 master
Loading...
Searching...
No Matches
EmbeddedGpio.h
Go to the documentation of this file.
1
10#ifndef __EMBEDDED_GPIO_PPI_H__
11#define __EMBEDDED_GPIO_PPI_H__
12
13//
14// Protocol interface structure
15//
17
18//
19// Data Types
20//
21typedef UINTN EMBEDDED_GPIO_PIN;
22
23#define GPIO(Port, Pin) ((EMBEDDED_GPIO_PIN)(((Port) << (16)) | (Pin)))
24#define GPIO_PIN(x) ((EMBEDDED_GPIO_PIN)(x) & (0xFFFF))
25#define GPIO_PORT(x) ((EMBEDDED_GPIO_PIN)(x) >> (16))
26
27typedef enum {
28 GPIO_MODE_INPUT = 0x00,
29 GPIO_MODE_OUTPUT_0 = 0x0E,
30 GPIO_MODE_OUTPUT_1 = 0x0F,
31 GPIO_MODE_SPECIAL_FUNCTION_2 = 0x02,
32 GPIO_MODE_SPECIAL_FUNCTION_3 = 0x03,
33 GPIO_MODE_SPECIAL_FUNCTION_4 = 0x04,
34 GPIO_MODE_SPECIAL_FUNCTION_5 = 0x05,
35 GPIO_MODE_SPECIAL_FUNCTION_6 = 0x06,
36 GPIO_MODE_SPECIAL_FUNCTION_7 = 0x07
37} EMBEDDED_GPIO_MODE;
38
39typedef enum {
40 GPIO_PULL_NONE,
41 GPIO_PULL_UP,
42 GPIO_PULL_DOWN
43} EMBEDDED_GPIO_PULL;
44
45//
46// Function Prototypes
47//
48
62typedef
64(EFIAPI *EMBEDDED_GPIO_GET)(
66 IN EMBEDDED_GPIO_PIN Gpio,
67 OUT UINTN *Value
68 );
69
83typedef
85(EFIAPI *EMBEDDED_GPIO_SET)(
87 IN EMBEDDED_GPIO_PIN Gpio,
88 IN EMBEDDED_GPIO_MODE Mode
89 );
90
104typedef
106(EFIAPI *EMBEDDED_GPIO_GET_MODE)(
107 IN EMBEDDED_GPIO_PPI *This,
108 IN EMBEDDED_GPIO_PIN Gpio,
109 OUT EMBEDDED_GPIO_MODE *Mode
110 );
111
125typedef
127(EFIAPI *EMBEDDED_GPIO_SET_PULL)(
128 IN EMBEDDED_GPIO_PPI *This,
129 IN EMBEDDED_GPIO_PIN Gpio,
130 IN EMBEDDED_GPIO_PULL Direction
131 );
132
138};
139
140extern EFI_GUID gEmbeddedGpioPpiGuid;
141
142#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET)(IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT UINTN *Value)
Definition: EmbeddedGpio.h:64
EFI_STATUS(EFIAPI * EMBEDDED_GPIO_GET_MODE)(IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, OUT EMBEDDED_GPIO_MODE *Mode)
Definition: EmbeddedGpio.h:106
EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET_PULL)(IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_PULL Direction)
Definition: EmbeddedGpio.h:127
EFI_STATUS(EFIAPI * EMBEDDED_GPIO_SET)(IN EMBEDDED_GPIO_PPI *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)
Definition: EmbeddedGpio.h:85
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
Definition: Base.h:213