SmartSnippets DA1459x SDK
Macros | Enumerations | Functions | Variables

Definition of API for the GPIO Low Level Driver. More...

#include <stdbool.h>
#include <stdint.h>
#include "sdk_defs.h"

Go to the source code of this file.

Macros

#define HW_GPIO_SET_PIN_FUNCTION(X)   hw_gpio_set_pin_function(X##_PORT, X##_PIN, X##_MODE, X##_FUNC);
 
#define HW_GPIO_NUM_PORTS   (2)
 
#define HW_GPIO_NUM_PINS   (HW_GPIO_PORT_0_NUM_PINS + HW_GPIO_PORT_1_NUM_PINS)
 
#define HW_GPIO_PIN_BITS   (4)
 
#define HW_GPIO_PORT_0_NUM_PINS   (16)
 
#define HW_GPIO_PORT_1_NUM_PINS   (16)
 
#define HW_GPIO_PORT_NONE   (HW_GPIO_PORT_MAX)
 
#define HW_GPIO_PIN_NONE   (HW_GPIO_PIN_MAX)
 
#define HW_GPIO_MODE_NONE   (HW_GPIO_MODE_INVALID)
 
#define HW_GPIO_PINCONFIG(xport, xpin, xmode, xfunc, xhigh)
 GPIO pin configuration for gpio_config. More...
 
#define HW_GPIO_PINCONFIG_RESERVE(xport, xpin, xmode, xfunc, xhigh)
 GPIO pin configuration and reservation for gpio_config. More...
 
#define HW_GPIO_PINCONFIG_END
 Macro to properly terminate array of gpio_config definition. More...
 

Enumerations

enum  HW_GPIO_MODE {
  HW_GPIO_MODE_INPUT = 0, HW_GPIO_MODE_INPUT_PULLUP = 0x100, HW_GPIO_MODE_INPUT_PULLDOWN = 0x200, HW_GPIO_MODE_OUTPUT = 0x300,
  HW_GPIO_MODE_OUTPUT_PUSH_PULL = 0x300, HW_GPIO_MODE_OUTPUT_OPEN_DRAIN = 0x700, HW_GPIO_MODE_INVALID = 0xFFF
}
 GPIO input/output mode. More...
 
enum  HW_GPIO_PORT { HW_GPIO_PORT_0 = 0, HW_GPIO_PORT_1 = 1, HW_GPIO_PORT_MAX }
 GPIO port number. More...
 
enum  HW_GPIO_PIN {
  HW_GPIO_PIN_0 = 0, HW_GPIO_PIN_1 = 1, HW_GPIO_PIN_2 = 2, HW_GPIO_PIN_3 = 3,
  HW_GPIO_PIN_4 = 4, HW_GPIO_PIN_5 = 5, HW_GPIO_PIN_6 = 6, HW_GPIO_PIN_7 = 7,
  HW_GPIO_PIN_8 = 8, HW_GPIO_PIN_9 = 9, HW_GPIO_PIN_10 = 10, HW_GPIO_PIN_11 = 11,
  HW_GPIO_PIN_12 = 12, HW_GPIO_PIN_13 = 13, HW_GPIO_PIN_14 = 14, HW_GPIO_PIN_15 = 15,
  HW_GPIO_PIN_MAX
}
 GPIO pin number. More...
 
enum  HW_GPIO_FUNC {
  HW_GPIO_FUNC_GPIO = 0, HW_GPIO_FUNC_UART_RX = 1, HW_GPIO_FUNC_UART_TX = 2, HW_GPIO_FUNC_UART2_RX = 3,
  HW_GPIO_FUNC_UART2_TX = 4, HW_GPIO_FUNC_UART2_CTSN = 5, HW_GPIO_FUNC_UART2_RTSN = 6, HW_GPIO_FUNC_ISO_CLK = 7,
  HW_GPIO_FUNC_ISO_DATA = 8, HW_GPIO_FUNC_SPI_DI = 9, HW_GPIO_FUNC_SPI_DO = 10, HW_GPIO_FUNC_SPI_CLK = 11,
  HW_GPIO_FUNC_SPI_EN = 12, HW_GPIO_FUNC_SPI_EN2 = 13, HW_GPIO_FUNC_I2C_SCL = 14, HW_GPIO_FUNC_I2C_SDA = 15,
  HW_GPIO_FUNC_ADC = 16, HW_GPIO_FUNC_PCM_DI = 17, HW_GPIO_FUNC_PCM_DO = 18, HW_GPIO_FUNC_PCM_FSC = 19,
  HW_GPIO_FUNC_PCM_CLK = 20, HW_GPIO_FUNC_PDM_DATA = 21, HW_GPIO_FUNC_PDM_CLK = 22, HW_GPIO_FUNC_CLOCK = 23,
  HW_GPIO_FUNC_TIM_PWM = 24, HW_GPIO_FUNC_TIM2_PWM = 25, HW_GPIO_FUNC_TIM_1SHOT = 26, HW_GPIO_FUNC_TIM2_1SHOT = 27,
  HW_GPIO_FUNC_TIM3_PWM = 28, HW_GPIO_FUNC_TIM4_PWM = 29, HW_GPIO_FUNC_COEX_EXT_ACT = 30, HW_GPIO_FUNC_COEX_SMART_ACT = 31,
  HW_GPIO_FUNC_COEX_SMART_PRI = 32, HW_GPIO_FUNC_PORT0_DCF = 33, HW_GPIO_FUNC_PORT1_DCF = 34, HW_GPIO_FUNC_PORT2_DCF = 35,
  HW_GPIO_FUNC_PORT3_DCF = 36, HW_GPIO_FUNC_PORT4_DCF = 37, HW_GPIO_FUNC_CMAC_DIAG0 = 38, HW_GPIO_FUNC_CMAC_DIAG1 = 39,
  HW_GPIO_FUNC_CMAC_DIAG2 = 40, HW_GPIO_FUNC_CMAC_DIAG3 = 41, HW_GPIO_FUNC_CMAC_DIAG4 = 42, HW_GPIO_FUNC_CMAC_DIAG5 = 43,
  HW_GPIO_FUNC_CMAC_DIAG6 = 44, HW_GPIO_FUNC_CMAC_DIAG7 = 45, HW_GPIO_FUNC_CMAC_DIAG8 = 46, HW_GPIO_FUNC_CMAC_DIAG9 = 47,
  HW_GPIO_FUNC_CMAC_DIAG10 = 48, HW_GPIO_FUNC_CMAC_DIAG11 = 49, HW_GPIO_FUNC_CMAC_DIAG12 = 50, HW_GPIO_FUNC_CMAC_DIAG13 = 51,
  HW_GPIO_FUNC_CMAC_DIAG14 = 52, HW_GPIO_FUNC_CMAC_DIAG15 = 53
}
 GPIO function. More...
 
enum  HW_GPIO_CLK
 Clocks that can be mapped to GPIOs. More...
 
enum  HW_GPIO_DRIVE_STRENGTH { HW_GPIO_DRIVE_STRENGTH_NORMAL = 0, HW_GPIO_DRIVE_STRENGTH_WEAK }
 GPIOs Drive Strength. More...
 

Functions

void hw_gpio_configure (const gpio_config cfg[])
 GPIO configuration. More...
 
bool hw_gpio_reserve_pin (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Reserve GPIO pin. More...
 
bool hw_gpio_reserve_and_configure_pin (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_GPIO_MODE mode, HW_GPIO_FUNC function, bool high)
 Reserve GPIO pin and set pin function. More...
 
void hw_gpio_unreserve_pin (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Unreserve GPIO pin. More...
 
void hw_gpio_set_pin_function (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_GPIO_MODE mode, HW_GPIO_FUNC function)
 Set the pin type and mode. More...
 
void hw_gpio_get_pin_function (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_GPIO_MODE *mode, HW_GPIO_FUNC *function)
 Get the pin type and mode. More...
 
void hw_gpio_set_pin_drive_strength (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_GPIO_DRIVE_STRENGTH strength)
 Set the pin drive strength. More...
 
HW_GPIO_DRIVE_STRENGTH hw_gpio_get_pin_drive_strength (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Get the pin drive strength. More...
 
void hw_gpio_configure_pin (HW_GPIO_PORT port, HW_GPIO_PIN pin, HW_GPIO_MODE mode, HW_GPIO_FUNC function, const bool high)
 Combined function to set the state and the type and mode of the GPIO pin. More...
 
void hw_gpio_set_active (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Set a GPIO in high state. More...
 
void hw_gpio_set_inactive (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Set a GPIO in low state. More...
 
bool hw_gpio_get_pin_status (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Get the GPIO status. More...
 
void hw_gpio_toggle (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Toggle GPIO pin state. More...
 
int hw_gpio_get_pins_with_function (HW_GPIO_FUNC func, uint8_t *buf, int buf_size)
 Find pins with specific function. More...
 
__STATIC_FORCEINLINE void hw_gpio_pad_latch_disable_all (void)
 Disables the latches of all gpios. More...
 
__STATIC_FORCEINLINE void hw_gpio_pad_latch_enable_all (void)
 Enables the latches of all gpios. More...
 
__STATIC_FORCEINLINE void hw_gpio_pad_latch_enable (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Enables the latch for the specific gpio. More...
 
__STATIC_FORCEINLINE void hw_gpio_pad_latch_disable (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Disables the latch for the specific gpio. More...
 
__STATIC_FORCEINLINE bool hw_gpio_pad_latch_is_enabled (HW_GPIO_PORT port, HW_GPIO_PIN pin)
 Checks if the specific GPIO is latched or not. More...
 
bool hw_gpio_get_pin_with_function (HW_GPIO_FUNC func, HW_GPIO_PORT *port, HW_GPIO_PIN *pin)
 Find GPIO with specific function. More...
 
__STATIC_INLINE void hw_gpio_clk_output_enable (HW_GPIO_CLK clk)
 Enable mapping of selected clock to the respective GPIO. More...
 
__STATIC_INLINE void hw_gpio_clk_output_disable (HW_GPIO_CLK clk)
 Disable mapping of selected clock to the respective GPIO. More...
 
__STATIC_INLINE void hw_gpio_clk_func_enable (void)
 Enable the mapping of the selected clock signal, according to FUNC_CLOCK_SEL bit-field. More...
 
__STATIC_INLINE void hw_gpio_clk_func_disable (void)
 Disable the mapping of the selected clock signal, according to FUNC_CLOCK_SEL bit-field. More...
 
__STATIC_INLINE void hw_gpio_clk_func_sel (HW_GPIO_CLK clk_src)
 Select which clock to map when GPIO function is FUNC_CLOCK. More...
 
__STATIC_INLINE void hw_gpio_configure_por_pin (HW_GPIO_PORT port, HW_GPIO_PIN pin, bool polarity)
 Select a pin as a POR trigger source. More...
 

Variables

typedef __PACKED_STRUCT
 GPIO pin configuration. More...
 
HW_GPIO_MODE mode
 
HW_GPIO_FUNC func
 
bool high
 

Detailed Description

Definition of API for the GPIO Low Level Driver.

Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates. All rights reserved. Confidential Information.

This software ("Software") is supplied by Renesas Electronics Corporation and/or its affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable, revocable, non-sub-licensable right and license to use the Software, solely if used in or together with Renesas products. You may make copies of this Software, provided this copyright notice and disclaimer ("Notice") is included in all such copies. Renesas reserves the right to change or discontinue the Software at any time without notice.

THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS SOFTWARE.