PDK API Guide for J721E
pmic_gpio.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *****************************************************************************/
54 #ifndef PMIC_GPIO_H_
55 #define PMIC_GPIO_H_
56 
57 /* ========================================================================== */
58 /* Include Files */
59 /* ========================================================================== */
60 #include <pmic_core.h>
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* ========================================================================== */
69 /* Macros & Typedefs */
70 /* ========================================================================== */
71 
78 #define PMIC_GPIO_DEGLITCH_DISABLE (0U)
79 #define PMIC_GPIO_DEGLITCH_ENABLE (1U)
80 /* @} */
81 
88 #define PMIC_GPIO_INPUT (0U)
89 #define PMIC_GPIO_OUTPUT (1U)
90 /* @} */
91 
98 #define PMIC_GPIO_PUSH_PULL_OUTPUT (0U)
99 #define PMIC_GPIO_OPEN_DRAIN_OUTPUT (1U)
100 /* @} */
101 
108 #define PMIC_GPIO_LOW (0U)
109 #define PMIC_GPIO_HIGH (1U)
110 /* @} */
111 
118 #define PMIC_GPIO_PD_SELECT (0U)
119 #define PMIC_GPIO_PU_SELECT (1U)
120 /* @} */
121 
128 #define PMIC_GPIO_PU_PD_DISABLE (0U)
129 #define PMIC_GPIO_PU_PD_ENABLE (1U)
130 /* @} */
131 
140 #define PMIC_GPIO_CFG_DIR_VALID (0x00U)
141 
143 #define PMIC_GPIO_CFG_OD_VALID (0x01U)
144 
146 #define PMIC_GPIO_CFG_PULL_VALID (0x02U)
147 
149 #define PMIC_GPIO_CFG_DEGLITCH_VALID (0x03U)
150 
151 #define PMIC_GPIO_CFG_PINFUNC_VALID (0x04U)
152 
155 #define PMIC_ENABLE_CFG_POLARITY_VALID (0x05U)
156 /* @} */
157 
167 #define PMIC_GPIO_CFG_DIR_VALID_SHIFT \
168  (0x01U << PMIC_GPIO_CFG_DIR_VALID)
169 #define PMIC_GPIO_CFG_OD_VALID_SHIFT \
170  (0x01U << PMIC_GPIO_CFG_OD_VALID)
171 #define PMIC_GPIO_CFG_PULL_VALID_SHIFT \
172  (0x01U << PMIC_GPIO_CFG_PULL_VALID)
173 #define PMIC_GPIO_CFG_DEGLITCH_VALID_SHIFT \
174  (0x01U << PMIC_GPIO_CFG_DEGLITCH_VALID)
175 #define PMIC_GPIO_CFG_PINFUNC_VALID_SHIFT \
176  (0x01U << PMIC_GPIO_CFG_PINFUNC_VALID)
177 #define PMIC_ENABLE_CFG_POLARITY_VALID_SHIFT \
178  (0x01U << PMIC_ENABLE_CFG_POLARITY_VALID)
179 /* @} */
180 
187 #define PMIC_GPIO_PULL_DISABLED (0x0U)
188 #define PMIC_GPIO_PULL_DOWN (0x1U)
189 #define PMIC_GPIO_PULL_UP (0x2U)
190 /* @} */
191 
198 #define PMIC_GPIO_FALL_INTERRUPT (0U)
199 #define PMIC_GPIO_RISE_INTERRUPT (1U)
200 #define PMIC_GPIO_FALL_RISE_INTERRUPT (2U)
201 #define PMIC_GPIO_DISABLE_INTERRUPT (3U)
202 /* @} */
203 
210 #define PMIC_GPIO_POL_LOW (0U)
211 #define PMIC_GPIO_POL_HIGH (1U)
212 /* @} */
213 
214 /*==========================================================================*/
215 /* Structures and Enums */
216 /*==========================================================================*/
217 
258 typedef struct Pmic_GpioCfg_s
259 {
260  uint8_t validParams;
261  uint8_t pinDir;
263  uint8_t pullCtrl;
264  uint8_t deglitchEnable;
265  uint8_t pinFunc;
266  uint8_t pinPolarity;
268 
269 /*==========================================================================*/
270 /* Function Declarations */
271 /*==========================================================================*/
301 int32_t Pmic_gpioSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
302  const uint8_t pin,
303  const Pmic_GpioCfg_t gpioCfg);
304 
329 int32_t Pmic_gpioGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
330  const uint8_t pin,
331  Pmic_GpioCfg_t *pGpioCfg);
332 
356 int32_t Pmic_gpioSetValue(Pmic_CoreHandle_t *pPmicCoreHandle,
357  const uint8_t pin,
358  const uint8_t pinValue);
359 
360 int32_t Pmic_gpioSetDir(Pmic_CoreHandle_t *pPmicCoreHandle,
361  const uint8_t pin,
362  const uint8_t pinDir);
363 
385 int32_t Pmic_gpioGetValue(Pmic_CoreHandle_t *pPmicCoreHandle,
386  const uint8_t pin,
387  uint8_t *pPinValue);
388 
412 int32_t Pmic_gpioSetIntr(Pmic_CoreHandle_t *pPmicCoreHandle,
413  const uint8_t pin,
414  const uint8_t intrType,
415  const uint8_t maskPol);
416 
443  Pmic_CoreHandle_t *pPmicCoreHandle,
444  const Pmic_GpioCfg_t gpioCfg);
445 
472  Pmic_CoreHandle_t *pPmicCoreHandle,
473  Pmic_GpioCfg_t *pGpioCfg);
474 
475 #ifdef __cplusplus
476 }
477 #endif /* __cplusplus */
478 
479 #endif /* PMIC_GPIO_H_ */
480 
481 /* @} */
uint8_t deglitchEnable
Definition: pmic_gpio.h:264
int32_t Pmic_gpioGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, Pmic_GpioCfg_t *pGpioCfg)
API to get PMIC GPIO configuration.
int32_t Pmic_gpioSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, const Pmic_GpioCfg_t gpioCfg)
API to set PMIC GPIO configuration.
int32_t Pmic_gpioSetIntr(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, const uint8_t intrType, const uint8_t maskPol)
API to enable/disable GPIO interrupt.
int32_t Pmic_gpioSetNPwronEnablePinConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_GpioCfg_t gpioCfg)
API to set configuration for NPWRON/Enable pin.
int32_t Pmic_gpioSetDir(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, const uint8_t pinDir)
PMIC Interface Handle. Contains various PMIC driver instance specific information....
Definition: pmic_types.h:148
uint8_t pinPolarity
Definition: pmic_gpio.h:266
uint8_t pullCtrl
Definition: pmic_gpio.h:263
int32_t Pmic_gpioGetNPwronEnablePinConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_GpioCfg_t *pGpioCfg)
API to get configuration for NPWRON/Enable pin.
int32_t Pmic_gpioSetValue(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, const uint8_t pinValue)
API to set PMIC GPIO value.
PMIC Driver Common API/interface file.
PMIC GPIO/NPWRON/ENABLE pin configuration structure. Note: validParams is input param for all Set and...
Definition: pmic_gpio.h:258
int32_t Pmic_gpioGetValue(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pin, uint8_t *pPinValue)
API to get PMIC GPIO value.
uint8_t pinDir
Definition: pmic_gpio.h:261
uint8_t pinFunc
Definition: pmic_gpio.h:265
PMIC TPS6594x Leo PMIC GPIO API/interface file.
uint8_t validParams
Definition: pmic_gpio.h:260
PMIC LP8764x Hera PMIC GPIO API/interface file.
uint8_t outputSignalType
Definition: pmic_gpio.h:262