After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 25 KiB |
@ -1,96 +0,0 @@ |
|||
/*
|
|||
* Copyright : (C) 2022 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_g.c |
|||
* Date: 2022-02-10 14:53:42 |
|||
* LastEditTime: 2022-02-18 08:25:29 |
|||
* Description: This files is for GPIO static configuration implementation |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2022/3/1 init commit |
|||
* 2.0 zhugengyu 2022/7/1 support e2000 |
|||
*/ |
|||
|
|||
|
|||
/***************************** Include Files *********************************/ |
|||
#include "fparameters.h" |
|||
|
|||
#include "fgpio_hw.h" |
|||
#include "fgpio.h" |
|||
|
|||
/************************** Constant Definitions *****************************/ |
|||
|
|||
/**************************** Type Definitions *******************************/ |
|||
|
|||
/***************** Macros (Inline Functions) Definitions *********************/ |
|||
|
|||
/************************** Function Prototypes ******************************/ |
|||
|
|||
/************************** Variable Definitions *****************************/ |
|||
|
|||
/*****************************************************************************/ |
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
[FGPIO0_ID] = |
|||
{ |
|||
.instance_id = FGPIO0_ID, |
|||
.base_addr = FGPIO0_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO0_CAPACITY |
|||
}, |
|||
[FGPIO1_ID] = |
|||
{ |
|||
.instance_id = FGPIO1_ID, |
|||
.base_addr = FGPIO1_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO1_CAPACITY |
|||
}, |
|||
#if defined(FGPIO2_ID) |
|||
[FGPIO2_ID] = |
|||
{ |
|||
.instance_id = FGPIO2_ID, |
|||
.base_addr = FGPIO2_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO2_CAPACITY |
|||
}, |
|||
#endif |
|||
#if defined(FGPIO3_ID) |
|||
[FGPIO3_ID] = |
|||
{ |
|||
.instance_id = FGPIO3_ID, |
|||
.base_addr = FGPIO3_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO3_CAPACITY |
|||
}, |
|||
#endif |
|||
#if defined(FGPIO4_ID) |
|||
[FGPIO4_ID] = |
|||
{ |
|||
.instance_id = FGPIO4_ID, |
|||
.base_addr = FGPIO4_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO4_CAPACITY |
|||
}, |
|||
#endif |
|||
#if defined(FGPIO5_ID) |
|||
[FGPIO5_ID] = |
|||
{ |
|||
.instance_id = FGPIO5_ID, |
|||
.base_addr = FGPIO5_BASE_ADDR, |
|||
.irq_priority = 0, |
|||
.caps = FGPIO5_CAPACITY |
|||
} |
|||
#endif |
|||
}; |
@ -0,0 +1,235 @@ |
|||
CONFIG_USE_BAREMETAL=y |
|||
|
|||
# |
|||
# Arch configuration |
|||
# |
|||
CONFIG_TARGET_ARMv8=y |
|||
CONFIG_ARCH_NAME="armv8" |
|||
|
|||
# |
|||
# Arm architecture configuration |
|||
# |
|||
# CONFIG_ARCH_ARMV8_AARCH64 is not set |
|||
CONFIG_ARCH_ARMV8_AARCH32=y |
|||
|
|||
# |
|||
# Compiler configuration |
|||
# |
|||
CONFIG_ARM_GCC_SELECT=y |
|||
# CONFIG_ARM_CLANG_SELECT is not set |
|||
CONFIG_TOOLCHAIN_NAME="gcc" |
|||
CONFIG_TARGET_ARMV8_AARCH32=y |
|||
CONFIG_ARCH_EXECUTION_STATE="aarch32" |
|||
|
|||
# |
|||
# Fpu configuration |
|||
# |
|||
CONFIG_CRYPTO_NEON_FP_ARMV8=y |
|||
# CONFIG_VFPV4 is not set |
|||
# CONFIG_VFPV4_D16 is not set |
|||
# CONFIG_VFPV3 is not set |
|||
# CONFIG_VFPV3_D16 is not set |
|||
CONFIG_ARM_MFPU="crypto-neon-fp-armv8" |
|||
CONFIG_MFLOAT_ABI_HARD=y |
|||
# CONFIG_MFLOAT_ABI_SOFTFP is not set |
|||
CONFIG_ARM_MFLOAT_ABI="hard" |
|||
# end of Fpu configuration |
|||
# end of Compiler configuration |
|||
|
|||
CONFIG_USE_CACHE=y |
|||
# CONFIG_USE_L3CACHE is not set |
|||
CONFIG_USE_MMU=y |
|||
CONFIG_USE_AARCH64_L1_TO_AARCH32=y |
|||
# end of Arm architecture configuration |
|||
# end of Arch configuration |
|||
|
|||
# |
|||
# Soc configuration |
|||
# |
|||
# CONFIG_TARGET_PHYTIUMPI is not set |
|||
# CONFIG_TARGET_E2000Q is not set |
|||
# CONFIG_TARGET_E2000D is not set |
|||
# CONFIG_TARGET_E2000S is not set |
|||
# CONFIG_TARGET_FT2004 is not set |
|||
CONFIG_TARGET_D2000=y |
|||
# CONFIG_TARGET_PD2308 is not set |
|||
CONFIG_SOC_NAME="d2000" |
|||
CONFIG_SOC_CORE_NUM=8 |
|||
CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 |
|||
CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 |
|||
CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 |
|||
CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 |
|||
CONFIG_DEFAULT_DEBUG_PRINT_UART1=y |
|||
# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set |
|||
# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set |
|||
# end of Soc configuration |
|||
|
|||
# |
|||
# Board Configuration |
|||
# |
|||
CONFIG_BOARD_NAME="test" |
|||
CONFIG_D2000_TEST_BOARD=y |
|||
|
|||
# |
|||
# IO mux configuration when board start up |
|||
# |
|||
# CONFIG_CUS_DEMO_BOARD is not set |
|||
|
|||
# |
|||
# Build project name |
|||
# |
|||
CONFIG_TARGET_NAME="pin" |
|||
# end of Build project name |
|||
# end of Board Configuration |
|||
|
|||
# |
|||
# Sdk common configuration |
|||
# |
|||
# CONFIG_LOG_VERBOS is not set |
|||
# CONFIG_LOG_DEBUG is not set |
|||
# CONFIG_LOG_INFO is not set |
|||
# CONFIG_LOG_WARN is not set |
|||
CONFIG_LOG_ERROR=y |
|||
# CONFIG_LOG_NONE is not set |
|||
CONFIG_LOG_EXTRA_INFO=y |
|||
# CONFIG_LOG_DISPALY_CORE_NUM is not set |
|||
# CONFIG_BOOTUP_DEBUG_PRINTS is not set |
|||
CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y |
|||
CONFIG_INTERRUPT_ROLE_MASTER=y |
|||
# CONFIG_INTERRUPT_ROLE_SLAVE is not set |
|||
# end of Sdk common configuration |
|||
|
|||
# |
|||
# Image information configuration |
|||
# |
|||
# CONFIG_IMAGE_INFO is not set |
|||
# end of Image information configuration |
|||
|
|||
# |
|||
# Drivers configuration |
|||
# |
|||
CONFIG_USE_IOMUX=y |
|||
CONFIG_ENABLE_IOCTRL=y |
|||
# CONFIG_ENABLE_IOPAD is not set |
|||
# CONFIG_USE_SPI is not set |
|||
# CONFIG_USE_QSPI is not set |
|||
CONFIG_USE_SERIAL=y |
|||
|
|||
# |
|||
# Usart Configuration |
|||
# |
|||
CONFIG_ENABLE_Pl011_UART=y |
|||
# end of Usart Configuration |
|||
|
|||
CONFIG_USE_GPIO=y |
|||
CONFIG_ENABLE_FGPIO=y |
|||
# CONFIG_USE_ETH is not set |
|||
# CONFIG_USE_CAN is not set |
|||
# CONFIG_USE_I2C is not set |
|||
# CONFIG_USE_TIMER is not set |
|||
# CONFIG_USE_MIO is not set |
|||
# CONFIG_USE_SDMMC is not set |
|||
# CONFIG_USE_PCIE is not set |
|||
# CONFIG_USE_WDT is not set |
|||
# CONFIG_USE_DMA is not set |
|||
# CONFIG_USE_NAND is not set |
|||
# CONFIG_USE_RTC is not set |
|||
# CONFIG_USE_SATA is not set |
|||
# CONFIG_USE_USB is not set |
|||
# CONFIG_USE_ADC is not set |
|||
# CONFIG_USE_PWM is not set |
|||
# CONFIG_USE_IPC is not set |
|||
# CONFIG_USE_MEDIA is not set |
|||
# CONFIG_USE_SCMI_MHU is not set |
|||
# CONFIG_USE_I2S is not set |
|||
# CONFIG_USE_I3C is not set |
|||
# end of Drivers configuration |
|||
|
|||
# |
|||
# Third-party configuration |
|||
# |
|||
# CONFIG_USE_LWIP is not set |
|||
CONFIG_USE_LETTER_SHELL=y |
|||
|
|||
# |
|||
# Letter shell configuration |
|||
# |
|||
CONFIG_LS_PL011_UART=y |
|||
CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y |
|||
# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set |
|||
# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set |
|||
# end of Letter shell configuration |
|||
|
|||
# CONFIG_USE_AMP is not set |
|||
# CONFIG_USE_YMODEM is not set |
|||
# CONFIG_USE_SFUD is not set |
|||
# CONFIG_USE_FATFS_0_1_4 is not set |
|||
CONFIG_USE_TLSF=y |
|||
# CONFIG_USE_SPIFFS is not set |
|||
# CONFIG_USE_LITTLE_FS is not set |
|||
# CONFIG_USE_LVGL is not set |
|||
# CONFIG_USE_FREEMODBUS is not set |
|||
# CONFIG_USE_FSL_SDMMC is not set |
|||
# CONFIG_USE_MICROPYTHON is not set |
|||
# CONFIG_USE_TINYMAIX is not set |
|||
# end of Third-party configuration |
|||
|
|||
# |
|||
# Build setup |
|||
# |
|||
CONFIG_CHECK_DEPS=y |
|||
CONFIG_OUTPUT_BINARY=y |
|||
|
|||
# |
|||
# Optimization options |
|||
# |
|||
# CONFIG_DEBUG_NOOPT is not set |
|||
# CONFIG_DEBUG_CUSTOMOPT is not set |
|||
CONFIG_DEBUG_FULLOPT=y |
|||
CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y |
|||
CONFIG_DEBUG_LINK_MAP=y |
|||
# CONFIG_CCACHE is not set |
|||
# CONFIG_ARCH_COVERAGE is not set |
|||
# CONFIG_LTO_FULL is not set |
|||
# end of Optimization options |
|||
|
|||
# |
|||
# Debug options |
|||
# |
|||
# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set |
|||
# CONFIG_WALL_WARNING_ERROR is not set |
|||
# CONFIG_STRICT_PROTOTYPES is not set |
|||
# CONFIG_DEBUG_SYMBOLS is not set |
|||
# CONFIG_FRAME_POINTER is not set |
|||
# CONFIG_OUTPUT_ASM_DIS is not set |
|||
# CONFIG_ENABLE_WSHADOW is not set |
|||
# CONFIG_ENABLE_WUNDEF is not set |
|||
CONFIG_DOWNGRADE_DIAG_WARNING=y |
|||
# end of Debug options |
|||
|
|||
# |
|||
# Lib |
|||
# |
|||
CONFIG_USE_COMPILE_CHAIN=y |
|||
# CONFIG_USE_NEWLIB is not set |
|||
# CONFIG_USE_USER_DEFINED is not set |
|||
# end of Lib |
|||
|
|||
# CONFIG_ENABLE_CXX is not set |
|||
|
|||
# |
|||
# Linker Options |
|||
# |
|||
CONFIG_DEFAULT_LINKER_SCRIPT=y |
|||
# CONFIG_USER_DEFINED_LD is not set |
|||
CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 |
|||
CONFIG_IMAGE_MAX_LENGTH=0x1000000 |
|||
CONFIG_HEAP_SIZE=2 |
|||
CONFIG_SVC_STACK_SIZE=0x1000 |
|||
CONFIG_SYS_STACK_SIZE=0x1000 |
|||
CONFIG_IRQ_STACK_SIZE=0x1000 |
|||
CONFIG_ABORT_STACK_SIZE=0x1000 |
|||
CONFIG_FIQ_STACK_SIZE=0x1000 |
|||
CONFIG_UNDEF_STACK_SIZE=0x1000 |
|||
# end of Linker Options |
|||
# end of Build setup |
@ -0,0 +1,224 @@ |
|||
CONFIG_USE_BAREMETAL=y |
|||
|
|||
# |
|||
# Arch configuration |
|||
# |
|||
CONFIG_TARGET_ARMv8=y |
|||
CONFIG_ARCH_NAME="armv8" |
|||
|
|||
# |
|||
# Arm architecture configuration |
|||
# |
|||
CONFIG_ARCH_ARMV8_AARCH64=y |
|||
# CONFIG_ARCH_ARMV8_AARCH32 is not set |
|||
|
|||
# |
|||
# Compiler configuration |
|||
# |
|||
CONFIG_ARM_GCC_SELECT=y |
|||
# CONFIG_ARM_CLANG_SELECT is not set |
|||
CONFIG_TOOLCHAIN_NAME="gcc" |
|||
CONFIG_TARGET_ARMV8_AARCH64=y |
|||
CONFIG_ARCH_EXECUTION_STATE="aarch64" |
|||
CONFIG_ARM_NEON=y |
|||
CONFIG_ARM_CRC=y |
|||
CONFIG_ARM_CRYPTO=y |
|||
CONFIG_ARM_FLOAT_POINT=y |
|||
# CONFIG_GCC_CODE_MODEL_TINY is not set |
|||
CONFIG_GCC_CODE_MODEL_SMALL=y |
|||
# CONFIG_GCC_CODE_MODEL_LARGE is not set |
|||
# end of Compiler configuration |
|||
|
|||
CONFIG_USE_CACHE=y |
|||
# CONFIG_USE_L3CACHE is not set |
|||
CONFIG_USE_MMU=y |
|||
CONFIG_BOOT_WITH_FLUSH_CACHE=y |
|||
# CONFIG_MMU_DEBUG_PRINTS is not set |
|||
# end of Arm architecture configuration |
|||
# end of Arch configuration |
|||
|
|||
# |
|||
# Soc configuration |
|||
# |
|||
# CONFIG_TARGET_PHYTIUMPI is not set |
|||
# CONFIG_TARGET_E2000Q is not set |
|||
# CONFIG_TARGET_E2000D is not set |
|||
# CONFIG_TARGET_E2000S is not set |
|||
# CONFIG_TARGET_FT2004 is not set |
|||
CONFIG_TARGET_D2000=y |
|||
# CONFIG_TARGET_PD2308 is not set |
|||
CONFIG_SOC_NAME="d2000" |
|||
CONFIG_SOC_CORE_NUM=8 |
|||
CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 |
|||
CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 |
|||
CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 |
|||
CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 |
|||
CONFIG_DEFAULT_DEBUG_PRINT_UART1=y |
|||
# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set |
|||
# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set |
|||
# end of Soc configuration |
|||
|
|||
# |
|||
# Board Configuration |
|||
# |
|||
CONFIG_BOARD_NAME="test" |
|||
CONFIG_D2000_TEST_BOARD=y |
|||
|
|||
# |
|||
# IO mux configuration when board start up |
|||
# |
|||
# CONFIG_CUS_DEMO_BOARD is not set |
|||
|
|||
# |
|||
# Build project name |
|||
# |
|||
CONFIG_TARGET_NAME="pin" |
|||
# end of Build project name |
|||
# end of Board Configuration |
|||
|
|||
# |
|||
# Sdk common configuration |
|||
# |
|||
# CONFIG_LOG_VERBOS is not set |
|||
# CONFIG_LOG_DEBUG is not set |
|||
# CONFIG_LOG_INFO is not set |
|||
# CONFIG_LOG_WARN is not set |
|||
CONFIG_LOG_ERROR=y |
|||
# CONFIG_LOG_NONE is not set |
|||
CONFIG_LOG_EXTRA_INFO=y |
|||
# CONFIG_LOG_DISPALY_CORE_NUM is not set |
|||
# CONFIG_BOOTUP_DEBUG_PRINTS is not set |
|||
CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y |
|||
CONFIG_INTERRUPT_ROLE_MASTER=y |
|||
# CONFIG_INTERRUPT_ROLE_SLAVE is not set |
|||
# end of Sdk common configuration |
|||
|
|||
# |
|||
# Image information configuration |
|||
# |
|||
# CONFIG_IMAGE_INFO is not set |
|||
# end of Image information configuration |
|||
|
|||
# |
|||
# Drivers configuration |
|||
# |
|||
CONFIG_USE_IOMUX=y |
|||
CONFIG_ENABLE_IOCTRL=y |
|||
# CONFIG_ENABLE_IOPAD is not set |
|||
# CONFIG_USE_SPI is not set |
|||
# CONFIG_USE_QSPI is not set |
|||
CONFIG_USE_SERIAL=y |
|||
|
|||
# |
|||
# Usart Configuration |
|||
# |
|||
CONFIG_ENABLE_Pl011_UART=y |
|||
# end of Usart Configuration |
|||
|
|||
CONFIG_USE_GPIO=y |
|||
CONFIG_ENABLE_FGPIO=y |
|||
# CONFIG_USE_ETH is not set |
|||
# CONFIG_USE_CAN is not set |
|||
# CONFIG_USE_I2C is not set |
|||
# CONFIG_USE_TIMER is not set |
|||
# CONFIG_USE_MIO is not set |
|||
# CONFIG_USE_SDMMC is not set |
|||
# CONFIG_USE_PCIE is not set |
|||
# CONFIG_USE_WDT is not set |
|||
# CONFIG_USE_DMA is not set |
|||
# CONFIG_USE_NAND is not set |
|||
# CONFIG_USE_RTC is not set |
|||
# CONFIG_USE_SATA is not set |
|||
# CONFIG_USE_USB is not set |
|||
# CONFIG_USE_ADC is not set |
|||
# CONFIG_USE_PWM is not set |
|||
# CONFIG_USE_IPC is not set |
|||
# CONFIG_USE_MEDIA is not set |
|||
# CONFIG_USE_SCMI_MHU is not set |
|||
# CONFIG_USE_I2S is not set |
|||
# CONFIG_USE_I3C is not set |
|||
# end of Drivers configuration |
|||
|
|||
# |
|||
# Third-party configuration |
|||
# |
|||
# CONFIG_USE_LWIP is not set |
|||
CONFIG_USE_LETTER_SHELL=y |
|||
|
|||
# |
|||
# Letter shell configuration |
|||
# |
|||
CONFIG_LS_PL011_UART=y |
|||
CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y |
|||
# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set |
|||
# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set |
|||
# end of Letter shell configuration |
|||
|
|||
# CONFIG_USE_AMP is not set |
|||
# CONFIG_USE_YMODEM is not set |
|||
# CONFIG_USE_SFUD is not set |
|||
# CONFIG_USE_FATFS_0_1_4 is not set |
|||
CONFIG_USE_TLSF=y |
|||
# CONFIG_USE_SPIFFS is not set |
|||
# CONFIG_USE_LITTLE_FS is not set |
|||
# CONFIG_USE_LVGL is not set |
|||
# CONFIG_USE_FREEMODBUS is not set |
|||
# CONFIG_USE_FSL_SDMMC is not set |
|||
# CONFIG_USE_MICROPYTHON is not set |
|||
# CONFIG_USE_TINYMAIX is not set |
|||
# end of Third-party configuration |
|||
|
|||
# |
|||
# Build setup |
|||
# |
|||
CONFIG_CHECK_DEPS=y |
|||
CONFIG_OUTPUT_BINARY=y |
|||
|
|||
# |
|||
# Optimization options |
|||
# |
|||
# CONFIG_DEBUG_NOOPT is not set |
|||
# CONFIG_DEBUG_CUSTOMOPT is not set |
|||
CONFIG_DEBUG_FULLOPT=y |
|||
CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y |
|||
CONFIG_DEBUG_LINK_MAP=y |
|||
# CONFIG_CCACHE is not set |
|||
# CONFIG_ARCH_COVERAGE is not set |
|||
# CONFIG_LTO_FULL is not set |
|||
# end of Optimization options |
|||
|
|||
# |
|||
# Debug options |
|||
# |
|||
# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set |
|||
# CONFIG_WALL_WARNING_ERROR is not set |
|||
# CONFIG_STRICT_PROTOTYPES is not set |
|||
# CONFIG_DEBUG_SYMBOLS is not set |
|||
# CONFIG_FRAME_POINTER is not set |
|||
# CONFIG_OUTPUT_ASM_DIS is not set |
|||
# CONFIG_ENABLE_WSHADOW is not set |
|||
# CONFIG_ENABLE_WUNDEF is not set |
|||
CONFIG_DOWNGRADE_DIAG_WARNING=y |
|||
# end of Debug options |
|||
|
|||
# |
|||
# Lib |
|||
# |
|||
CONFIG_USE_COMPILE_CHAIN=y |
|||
# CONFIG_USE_NEWLIB is not set |
|||
# CONFIG_USE_USER_DEFINED is not set |
|||
# end of Lib |
|||
|
|||
# CONFIG_ENABLE_CXX is not set |
|||
|
|||
# |
|||
# Linker Options |
|||
# |
|||
CONFIG_DEFAULT_LINKER_SCRIPT=y |
|||
# CONFIG_USER_DEFINED_LD is not set |
|||
CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 |
|||
CONFIG_IMAGE_MAX_LENGTH=0x1000000 |
|||
CONFIG_HEAP_SIZE=2 |
|||
CONFIG_STACK_SIZE=0x400 |
|||
# end of Linker Options |
|||
# end of Build setup |
After Width: | Height: | Size: 891 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 769 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 3.9 MiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 571 KiB |
Before Width: | Height: | Size: 4.5 MiB After Width: | Height: | Size: 591 KiB |
Before Width: | Height: | Size: 17 MiB After Width: | Height: | Size: 644 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 328 KiB |
@ -0,0 +1,44 @@ |
|||
/*
|
|||
* Copyright : (C) 2023 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: pin_gpio_multi_input_example.h |
|||
* Date: 2022-03-01 16:58:44 |
|||
* LastEditTime: 2022-03-05 12:46:07 |
|||
* Description: This file is for gpio interrupt tigger function definition. |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------- -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/05/09 first commit |
|||
*/ |
|||
|
|||
#ifndef PIN_GPIO_MULTI_INPUT_EXAMPLE_H |
|||
#define PIN_GPIO_MULTI_INPUT_EXAMPLE_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" |
|||
{ |
|||
#endif |
|||
/***************************** Include Files *********************************/ |
|||
#include "ftypes.h" |
|||
#include "fgpio.h" |
|||
#include "fkernel.h" |
|||
/**************************** Type Definitions *******************************/ |
|||
|
|||
/************************** Function Prototypes ******************************/ |
|||
int FPinGpioMultiInputExample(void); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif |
@ -0,0 +1,214 @@ |
|||
/*
|
|||
* Copyright : (C) 2023 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: pin_gpio_intr_example.c |
|||
* Date: 2022-03-01 12:54:42 |
|||
* LastEditTime: 2022-03-05 17:28:07 |
|||
* Description: This file is for pin gpio interrupt tigger example function implmentation. |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------- -------- -------------------------------------- |
|||
* 1.0 liqiaozhong 2023/03/05 first commit |
|||
* 1.1 liqiaozhong 2023/8/11 adapt to new iomux |
|||
* 2.0 zhugengyu 2024/5/8 update interface to use gpio by pin |
|||
*/ |
|||
|
|||
|
|||
/***************************** Include Files *********************************/ |
|||
#include "sdkconfig.h" |
|||
#ifndef SDK_CONFIG_H__ |
|||
#warning "Please include sdkconfig.h" |
|||
#endif |
|||
|
|||
#include <string.h> |
|||
#include <stdio.h> |
|||
#include "strto.h" |
|||
|
|||
#include "ftypes.h" |
|||
#include "fdebug.h" |
|||
#include "fassert.h" |
|||
#include "fsleep.h" |
|||
#include "finterrupt.h" |
|||
#include "fcpu_info.h" |
|||
#include "fio_mux.h" |
|||
|
|||
#include "fparameters.h" |
|||
|
|||
#include "fgpio.h" |
|||
|
|||
#include "pin_common.h" |
|||
#include "pin_gpio_intr_example.h" |
|||
/************************** Constant Definitions *****************************/ |
|||
#if defined(CONFIG_FIREFLY_DEMO_BOARD) |
|||
#define GPIO_INPUT_PIN_NUM 3U |
|||
|
|||
static const u32 pin_index_array[GPIO_INPUT_PIN_NUM] = |
|||
{ |
|||
FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_13), /* IRQ 189 */ |
|||
FGPIO_ID(FGPIO_CTRL_0, FGPIO_PIN_0), /* IRQ 140 */ |
|||
FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_12) /* IRQ 189 */ |
|||
}; |
|||
#elif defined(CONFIG_E2000Q_DEMO_BOARD) || defined(CONFIG_E2000D_DEMO_BOARD) |
|||
#define GPIO_INPUT_PIN_NUM 2U |
|||
|
|||
static const u32 pin_index_array[GPIO_INPUT_PIN_NUM] = |
|||
{ |
|||
FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_11), |
|||
FGPIO_ID(FGPIO_CTRL_4, FGPIO_PIN_12) |
|||
}; |
|||
#elif defined(CONFIG_PD2308_DEMO_BOARD) |
|||
#define GPIO_INPUT_PIN_NUM 2U |
|||
|
|||
static const u32 pin_index_array[GPIO_INPUT_PIN_NUM] = |
|||
{ |
|||
FGPIO_ID(FGPIO_CTRL_0, FGPIO_PIN_8), |
|||
FGPIO_ID(FGPIO_CTRL_0, FGPIO_PIN_10) |
|||
}; |
|||
#elif defined(CONFIG_D2000_TEST_BOARD) |
|||
#define GPIO_INPUT_PIN_NUM 2U |
|||
|
|||
static const u32 pin_index_array[GPIO_INPUT_PIN_NUM] = |
|||
{ |
|||
FGPIO_ID(FGPIO_CTRL_1, FGPIO_PORT_A, FGPIO_PIN_6), |
|||
FGPIO_ID(FGPIO_CTRL_1, FGPIO_PORT_A, FGPIO_PIN_7) |
|||
}; |
|||
#endif |
|||
|
|||
static FGpioIrqType irq_type = FGPIO_IRQ_TYPE_LEVEL_LOW; |
|||
static const char *irq_type_names[] = |
|||
{ |
|||
[FGPIO_IRQ_TYPE_EDGE_FALLING] = "falling edge", |
|||
[FGPIO_IRQ_TYPE_EDGE_RISING] = "rising edge", |
|||
[FGPIO_IRQ_TYPE_LEVEL_LOW] = "level low", |
|||
[FGPIO_IRQ_TYPE_LEVEL_HIGH] = "level high" |
|||
}; |
|||
/**************************** Type Definitions *******************************/ |
|||
|
|||
/************************** Variable Definitions *****************************/ |
|||
static int intr_count = 0; |
|||
static FGpio pin_array[GPIO_INPUT_PIN_NUM]; |
|||
static FGpioConfig pin_config_array[GPIO_INPUT_PIN_NUM]; |
|||
/***************** Macros (Inline Functions) Definitions *********************/ |
|||
|
|||
/************************** Function Prototypes ******************************/ |
|||
|
|||
/************************** Function *****************************************/ |
|||
static void FPinAckPinIrq(s32 vector, void *param) |
|||
{ |
|||
FGpio *pin = (FGpio *)param; |
|||
printf("Assert %s for gpio %d-%c-%d !!!\n", |
|||
irq_type_names[irq_type], |
|||
pin->config.ctrl, |
|||
(pin->config.port == FGPIO_PORT_A)?'a':'b', |
|||
pin->config.pin); |
|||
|
|||
intr_count++; |
|||
|
|||
/* level-sensitive interrupts keeps comming if not disabled */ |
|||
if ((FGPIO_IRQ_TYPE_LEVEL_LOW == irq_type) || (FGPIO_IRQ_TYPE_LEVEL_HIGH == irq_type)) |
|||
{ |
|||
FGpioSetInterruptMask(pin, FALSE); /* disable pin irq */ |
|||
} |
|||
} |
|||
|
|||
int FPinGpioMultiInputExample(void) |
|||
{ |
|||
int ret = 0; |
|||
u32 cpu_id; |
|||
u32 irq_priority = 0; |
|||
|
|||
intr_count = 0; |
|||
memset(&pin_array, 0, sizeof(pin_array)); |
|||
|
|||
GetCpuId(&cpu_id); |
|||
FPIN_TEST_INFO("cpu_id is cpu_id %d", cpu_id); |
|||
|
|||
FIOMuxInit(); |
|||
|
|||
for (int i = 0; i < GPIO_INPUT_PIN_NUM; i++) |
|||
{ |
|||
pin_config_array[i] = *FGpioLookupConfig(pin_index_array[i]); |
|||
|
|||
/* init input pins */ |
|||
ret = FGpioCfgInitialize(&pin_array[i], &pin_config_array[i]); |
|||
FASSERT(ret == FT_SUCCESS); |
|||
|
|||
/* set iomux for input inputs */ |
|||
#if defined(CONFIG_D2000_TEST_BOARD) |
|||
FIOPadSetGpioMux(pin_array[i].config.ctrl, pin_array[i].config.port, pin_array[i].config.pin); |
|||
#else |
|||
FIOPadSetGpioMux(pin_array[i].config.ctrl, pin_array[i].config.pin); |
|||
#endif |
|||
|
|||
/* set pin direction as input */ |
|||
FGpioSetDirection(&pin_array[i], FGPIO_DIR_INPUT); |
|||
|
|||
/* check if input pin support interrupt */ |
|||
if (pin_array[i].config.cap & FGPIO_CAP_IRQ_NONE) |
|||
{ |
|||
printf("interrupt not supported !!!"); |
|||
goto exit; |
|||
} |
|||
|
|||
/* register pin intr callback */ |
|||
FGpioRegisterInterruptCB(&pin_array[i], |
|||
FPinAckPinIrq, |
|||
&pin_array[i]); |
|||
|
|||
/* setup interrupt for input pin, if multi pin shared the same interrupt id, interrupt callback
|
|||
will be handle by interrupt map internally */ |
|||
InterruptInstall(pin_array[i].config.irq_num, |
|||
FGpioInterruptHandler, |
|||
NULL, |
|||
NULL); /* register intr handler */ |
|||
|
|||
FPIN_TEST_INFO("pin %d-%d irq = %d", |
|||
pin_array[i].config.ctrl, |
|||
pin_array[i].config.pin, |
|||
pin_array[i].config.irq_num); |
|||
|
|||
InterruptSetTargetCpus(pin_array[i].config.irq_num, cpu_id); |
|||
InterruptSetPriority(pin_array[i].config.irq_num, irq_priority); |
|||
InterruptUmask(pin_array[i].config.irq_num); |
|||
|
|||
FGpioSetInterruptMask(&pin_array[i], TRUE); |
|||
} |
|||
|
|||
/* wait interrupt handle done */ |
|||
fsleep_millisec(10); |
|||
|
|||
for (int i = 0; i < GPIO_INPUT_PIN_NUM; i++) |
|||
{ |
|||
FGpioSetInterruptMask(&pin_array[i], FALSE); |
|||
|
|||
InterruptUmask(pin_array[i].config.irq_num); |
|||
|
|||
FGpioDeInitialize(&pin_array[i]); |
|||
} |
|||
|
|||
FIOMuxDeInit(); |
|||
|
|||
exit: |
|||
/* print message on example run result */ |
|||
if (intr_count == GPIO_INPUT_PIN_NUM) |
|||
{ |
|||
printf("%s@%d: pin GPIO intr example [success].\r\n", __func__, __LINE__); |
|||
return 0; |
|||
} |
|||
else |
|||
{ |
|||
printf("%s@%d: pin GPIO intr example [failure].\r\n", __func__, __LINE__); |
|||
return 1; |
|||
} |
|||
} |
@ -0,0 +1,121 @@ |
|||
/*
|
|||
* Copyright : (C) 2024 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_table.c |
|||
* Date: 2023-11-6 10:33:28 |
|||
* LastEditTime: 2023-11-6 10:33:28 |
|||
* Description: This file is for GPIO pin definition |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/5/9 init commit |
|||
*/ |
|||
|
|||
#include "fparameters.h" |
|||
#include "fgpio.h" |
|||
|
|||
#define FGPIO_PIN_CONFIG(_base, _ctrl, _port, _pin, _irq, _cap) \ |
|||
{ \ |
|||
.id = FGPIO_ID(_ctrl, _port, _pin), \ |
|||
.ctrl = _ctrl, \ |
|||
.port = _port, \ |
|||
.pin = _pin, \ |
|||
.base_addr = _base, \ |
|||
.irq_num = _irq, \ |
|||
.cap = _cap \ |
|||
} |
|||
|
|||
#define FGPIO_PIN_CONFIG_0_A(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_0_B(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_B, (pin), (irq), FGPIO_CAP_IRQ_NONE) |
|||
#define FGPIO_PIN_CONFIG_1_A(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_1_B(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_B, (pin), (irq), FGPIO_CAP_IRQ_NONE) |
|||
|
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
/* GPIO 0-A, IRQ 42 */ |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_0, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_1, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_2, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_3, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_4, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_5, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_6, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_7, 42U), |
|||
|
|||
/* GPIO 0-B, None IRQ */ |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_0, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_1, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_2, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_3, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_4, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_5, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_6, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_7, 0U), |
|||
|
|||
/* GPIO 1-A IRQ 43 */ |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_0, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_1, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_2, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_3, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_4, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_5, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_6, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_7, 43U), |
|||
|
|||
/* GPIO 1-B None IRQ */ |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_0, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_1, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_2, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_3, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_4, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_5, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_6, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_7, 0U) |
|||
}; |
|||
|
|||
#define FGPIO_INTR_MAP_CONFIG(_base) \ |
|||
{ \ |
|||
.base_addr = _base, \ |
|||
.irq_cbs = {NULL}, \ |
|||
.irq_cb_params = {NULL},\ |
|||
} |
|||
|
|||
FGpioIntrMap fgpio_intr_map[FGPIO_CTRL_NUM] = |
|||
{ |
|||
/* GPIO 0 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO0_BASE_ADDR), |
|||
|
|||
/* GPIO 1 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO1_BASE_ADDR) |
|||
}; |
|||
|
|||
const FGpioConfig *FGpioLookupConfigByIrqNum(s32 irq_num) |
|||
{ |
|||
u32 index; |
|||
const FGpioConfig *ptr = NULL; |
|||
|
|||
for (index = 0; index < FGPIO_NUM; index++) |
|||
{ |
|||
/* 如果引脚单独上报中断,返回对应引脚的配置
|
|||
如果引脚通过控制器统一上报中断,共用中断号,返回使用该中断号的第一个引脚的配置 |
|||
如果引脚不支持中断,返回 NULL */ |
|||
if (fgpio_cfg_tbl[index].irq_num == irq_num) |
|||
{ |
|||
ptr = &fgpio_cfg_tbl[index]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return ptr; |
|||
} |
@ -0,0 +1,203 @@ |
|||
/*
|
|||
* Copyright : (C) 2024 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_table.c |
|||
* Date: 2023-11-6 10:33:28 |
|||
* LastEditTime: 2023-11-6 10:33:28 |
|||
* Description: This file is for GPIO pin definition |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/5/9 init commit |
|||
*/ |
|||
|
|||
#include "fparameters.h" |
|||
#include "fgpio.h" |
|||
|
|||
#define FGPIO_PIN_CONFIG(_base, _ctrl, _port, _pin, _irq, _cap) \ |
|||
{ \ |
|||
.id = FGPIO_ID(_ctrl, _pin), \ |
|||
.ctrl = _ctrl, \ |
|||
.port = _port, \ |
|||
.pin = _pin, \ |
|||
.base_addr = _base, \ |
|||
.irq_num = _irq, \ |
|||
.cap = _cap \ |
|||
} |
|||
|
|||
#define FGPIO_PIN_CONFIG_0(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_1(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_2(pin, irq) FGPIO_PIN_CONFIG(FGPIO2_BASE_ADDR, FGPIO_CTRL_2, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_3(pin, irq) FGPIO_PIN_CONFIG(FGPIO3_BASE_ADDR, FGPIO_CTRL_3, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_4(pin, irq) FGPIO_PIN_CONFIG(FGPIO4_BASE_ADDR, FGPIO_CTRL_4, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_5(pin, irq) FGPIO_PIN_CONFIG(FGPIO5_BASE_ADDR, FGPIO_CTRL_5, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
|
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
/* GPIO 0, IRQ 140 ~ 155 */ |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_0, 140U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_1, 141U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_2, 142U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_3, 143U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_4, 144U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_5, 145U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_6, 146U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_7, 147U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_8, 148U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_9, 149U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_10, 150U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_11, 151U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_12, 152U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_13, 153U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_14, 154U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_15, 155U), |
|||
|
|||
/* GPIO 1, IRQ 156 ~ 171 */ |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_0, 156U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_1, 157U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_2, 158U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_3, 159U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_4, 160U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_5, 161U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_6, 162U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_7, 163U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_8, 164U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_9, 165U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_10, 166U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_11, 167U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_12, 168U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_13, 169U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_14, 170U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_15, 171U), |
|||
|
|||
/* GPIO 2, IRQ 172 ~ 187 */ |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_0, 172U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_1, 173U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_2, 174U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_3, 175U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_4, 176U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_5, 177U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_6, 178U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_7, 179U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_8, 180U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_9, 181U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_10, 182U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_11, 183U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_12, 184U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_13, 185U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_14, 186U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_15, 187U), |
|||
|
|||
/* GPIO 3, IRQ 188 */ |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_0, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_1, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_2, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_3, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_4, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_5, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_6, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_7, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_8, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_9, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_10, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_11, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_12, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_13, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_14, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_15, 188U), |
|||
|
|||
/* GPIO 4, IRQ 189 */ |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_0, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_1, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_2, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_3, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_4, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_5, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_6, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_7, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_8, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_9, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_10, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_11, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_12, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_13, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_14, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_15, 189U), |
|||
|
|||
/* GPIO 5, IRQ 190 */ |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_0, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_1, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_2, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_3, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_4, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_5, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_6, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_7, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_8, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_9, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_10, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_11, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_12, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_13, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_14, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_15, 190U) |
|||
}; |
|||
|
|||
#define FGPIO_INTR_MAP_CONFIG(_base) \ |
|||
{ \ |
|||
.base_addr = _base, \ |
|||
.irq_cbs = {NULL}, \ |
|||
.irq_cb_params = {NULL},\ |
|||
} |
|||
|
|||
FGpioIntrMap fgpio_intr_map[FGPIO_CTRL_NUM] = |
|||
{ |
|||
/* GPIO 0 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO0_BASE_ADDR), |
|||
|
|||
/* GPIO 1 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO1_BASE_ADDR), |
|||
|
|||
/* GPIO 2 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO2_BASE_ADDR), |
|||
|
|||
/* GPIO 3 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO3_BASE_ADDR), |
|||
|
|||
/* GPIO 4 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO4_BASE_ADDR), |
|||
|
|||
/* GPIO 5 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO5_BASE_ADDR) |
|||
}; |
|||
|
|||
const FGpioConfig *FGpioLookupConfigByIrqNum(s32 irq_num) |
|||
{ |
|||
u32 index; |
|||
const FGpioConfig *ptr = NULL; |
|||
|
|||
for (index = 0; index < FGPIO_NUM; index++) |
|||
{ |
|||
/* 如果引脚单独上报中断,返回对应引脚的配置
|
|||
如果引脚通过控制器统一上报中断,共用中断号,返回使用该中断号的第一个引脚的配置 |
|||
如果引脚不支持中断,返回 NULL */ |
|||
if (fgpio_cfg_tbl[index].irq_num == irq_num) |
|||
{ |
|||
ptr = &fgpio_cfg_tbl[index]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return ptr; |
|||
} |
@ -0,0 +1,121 @@ |
|||
/*
|
|||
* Copyright : (C) 2024 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_table.c |
|||
* Date: 2023-11-6 10:33:28 |
|||
* LastEditTime: 2023-11-6 10:33:28 |
|||
* Description: This file is for GPIO pin definition |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/5/9 init commit |
|||
*/ |
|||
|
|||
#include "fparameters.h" |
|||
#include "fgpio.h" |
|||
|
|||
#define FGPIO_PIN_CONFIG(_base, _ctrl, _port, _pin, _irq, _cap) \ |
|||
{ \ |
|||
.id = FGPIO_ID(_ctrl, _port, _pin), \ |
|||
.ctrl = _ctrl, \ |
|||
.port = _port, \ |
|||
.pin = _pin, \ |
|||
.base_addr = _base, \ |
|||
.irq_num = _irq, \ |
|||
.cap = _cap \ |
|||
} |
|||
|
|||
#define FGPIO_PIN_CONFIG_0_A(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_0_B(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_B, (pin), (irq), FGPIO_CAP_IRQ_NONE) |
|||
#define FGPIO_PIN_CONFIG_1_A(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_1_B(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_B, (pin), (irq), FGPIO_CAP_IRQ_NONE) |
|||
|
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
/* GPIO 0-A, IRQ 42 */ |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_0, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_1, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_2, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_3, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_4, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_5, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_6, 42U), |
|||
FGPIO_PIN_CONFIG_0_A(FGPIO_PIN_7, 42U), |
|||
|
|||
/* GPIO 0-B, None IRQ */ |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_0, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_1, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_2, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_3, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_4, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_5, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_6, 0U), |
|||
FGPIO_PIN_CONFIG_0_B(FGPIO_PIN_7, 0U), |
|||
|
|||
/* GPIO 1-A IRQ 43 */ |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_0, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_1, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_2, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_3, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_4, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_5, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_6, 43U), |
|||
FGPIO_PIN_CONFIG_1_A(FGPIO_PIN_7, 43U), |
|||
|
|||
/* GPIO 1-B None IRQ */ |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_0, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_1, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_2, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_3, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_4, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_5, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_6, 0U), |
|||
FGPIO_PIN_CONFIG_1_B(FGPIO_PIN_7, 0U) |
|||
}; |
|||
|
|||
#define FGPIO_INTR_MAP_CONFIG(_base) \ |
|||
{ \ |
|||
.base_addr = _base, \ |
|||
.irq_cbs = {NULL}, \ |
|||
.irq_cb_params = {NULL},\ |
|||
} |
|||
|
|||
FGpioIntrMap fgpio_intr_map[FGPIO_CTRL_NUM] = |
|||
{ |
|||
/* GPIO 0 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO0_BASE_ADDR), |
|||
|
|||
/* GPIO 1 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO1_BASE_ADDR) |
|||
}; |
|||
|
|||
const FGpioConfig *FGpioLookupConfigByIrqNum(s32 irq_num) |
|||
{ |
|||
u32 index; |
|||
const FGpioConfig *ptr = NULL; |
|||
|
|||
for (index = 0; index < FGPIO_NUM; index++) |
|||
{ |
|||
/* 如果引脚单独上报中断,返回对应引脚的配置
|
|||
如果引脚通过控制器统一上报中断,共用中断号,返回使用该中断号的第一个引脚的配置 |
|||
如果引脚不支持中断,返回 NULL */ |
|||
if (fgpio_cfg_tbl[index].irq_num == irq_num) |
|||
{ |
|||
ptr = &fgpio_cfg_tbl[index]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return ptr; |
|||
} |
@ -0,0 +1,160 @@ |
|||
/*
|
|||
* Copyright : (C) 2024 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_table.c |
|||
* Date: 2023-11-6 10:33:28 |
|||
* LastEditTime: 2023-11-6 10:33:28 |
|||
* Description: This file is for GPIO pin definition |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/5/9 init commit |
|||
*/ |
|||
|
|||
#include "fparameters.h" |
|||
#include "fgpio.h" |
|||
|
|||
#define FGPIO_PIN_CONFIG(_base, _ctrl, _port, _pin, _irq, _cap) \ |
|||
{ \ |
|||
.id = FGPIO_ID(_ctrl, _pin), \ |
|||
.ctrl = _ctrl, \ |
|||
.port = _port, \ |
|||
.pin = _pin, \ |
|||
.base_addr = _base, \ |
|||
.irq_num = _irq, \ |
|||
.cap = _cap \ |
|||
} |
|||
|
|||
#define FGPIO_PIN_CONFIG_0(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_1(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_2(pin, irq) FGPIO_PIN_CONFIG(FGPIO2_BASE_ADDR, FGPIO_CTRL_2, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_3(pin, irq) FGPIO_PIN_CONFIG(FGPIO3_BASE_ADDR, FGPIO_CTRL_3, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
|
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
/* GPIO-0, IRQ 128 ~ 143 */ |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_0, 128U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_1, 129U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_2, 130U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_3, 131U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_4, 132U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_5, 133U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_6, 134U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_7, 135U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_8, 136U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_9, 137U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_10, 138U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_11, 139U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_12, 140U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_13, 141U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_14, 142U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_15, 143U), |
|||
|
|||
/* GPIO-1, IRQ 144 ~ 159 */ |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_0, 144U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_1, 145U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_2, 146U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_3, 147U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_4, 148U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_5, 149U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_6, 150U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_7, 151U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_8, 152U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_9, 153U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_10, 154U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_11, 155U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_12, 156U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_13, 157U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_14, 158U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_15, 159U), |
|||
|
|||
/* GPIO-2, IRQ 160 */ |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_0, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_1, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_2, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_3, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_4, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_5, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_6, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_7, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_8, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_9, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_10, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_11, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_12, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_13, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_14, 160U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_15, 160U), |
|||
|
|||
/* GPIO-3 IRQ 161 */ |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_0, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_1, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_2, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_3, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_4, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_5, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_6, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_7, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_8, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_9, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_10, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_11, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_12, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_13, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_14, 161U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_15, 161U) |
|||
}; |
|||
|
|||
|
|||
#define FGPIO_INTR_MAP_CONFIG(_base) \ |
|||
{ \ |
|||
.base_addr = _base, \ |
|||
.irq_cbs = {NULL}, \ |
|||
.irq_cb_params = {NULL},\ |
|||
} |
|||
|
|||
FGpioIntrMap fgpio_intr_map[FGPIO_CTRL_NUM] = |
|||
{ |
|||
/* GPIO 0 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO0_BASE_ADDR), |
|||
|
|||
/* GPIO 1 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO1_BASE_ADDR), |
|||
|
|||
/* GPIO 2 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO2_BASE_ADDR), |
|||
|
|||
/* GPIO 3 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO3_BASE_ADDR) |
|||
}; |
|||
|
|||
const FGpioConfig *FGpioLookupConfigByIrqNum(s32 irq_num) |
|||
{ |
|||
u32 index; |
|||
const FGpioConfig *ptr = NULL; |
|||
|
|||
for (index = 0; index < FGPIO_NUM; index++) |
|||
{ |
|||
/* 如果引脚单独上报中断,返回对应引脚的配置
|
|||
如果引脚通过控制器统一上报中断,共用中断号,返回使用该中断号的第一个引脚的配置 |
|||
如果引脚不支持中断,返回 NULL */ |
|||
if (fgpio_cfg_tbl[index].irq_num == irq_num) |
|||
{ |
|||
ptr = &fgpio_cfg_tbl[index]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return ptr; |
|||
} |
@ -0,0 +1,203 @@ |
|||
/*
|
|||
* Copyright : (C) 2024 Phytium Information Technology, Inc. |
|||
* All Rights Reserved. |
|||
* |
|||
* This program is OPEN SOURCE software: you can redistribute it and/or modify it |
|||
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, |
|||
* either version 1.0 of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; |
|||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|||
* See the Phytium Public License for more details. |
|||
* |
|||
* |
|||
* FilePath: fgpio_table.c |
|||
* Date: 2023-11-6 10:33:28 |
|||
* LastEditTime: 2023-11-6 10:33:28 |
|||
* Description: This file is for GPIO pin definition |
|||
* |
|||
* Modify History: |
|||
* Ver Who Date Changes |
|||
* ----- ------ -------- -------------------------------------- |
|||
* 1.0 zhugengyu 2024/5/9 init commit |
|||
*/ |
|||
|
|||
#include "fparameters.h" |
|||
#include "fgpio.h" |
|||
|
|||
#define FGPIO_PIN_CONFIG(_base, _ctrl, _port, _pin, _irq, _cap) \ |
|||
{ \ |
|||
.id = FGPIO_ID(_ctrl, _pin), \ |
|||
.ctrl = _ctrl, \ |
|||
.port = _port, \ |
|||
.pin = _pin, \ |
|||
.base_addr = _base, \ |
|||
.irq_num = _irq, \ |
|||
.cap = _cap \ |
|||
} |
|||
|
|||
#define FGPIO_PIN_CONFIG_0(pin, irq) FGPIO_PIN_CONFIG(FGPIO0_BASE_ADDR, FGPIO_CTRL_0, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_1(pin, irq) FGPIO_PIN_CONFIG(FGPIO1_BASE_ADDR, FGPIO_CTRL_1, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_2(pin, irq) FGPIO_PIN_CONFIG(FGPIO2_BASE_ADDR, FGPIO_CTRL_2, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_PIN) |
|||
#define FGPIO_PIN_CONFIG_3(pin, irq) FGPIO_PIN_CONFIG(FGPIO3_BASE_ADDR, FGPIO_CTRL_3, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_4(pin, irq) FGPIO_PIN_CONFIG(FGPIO4_BASE_ADDR, FGPIO_CTRL_4, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
#define FGPIO_PIN_CONFIG_5(pin, irq) FGPIO_PIN_CONFIG(FGPIO5_BASE_ADDR, FGPIO_CTRL_5, FGPIO_PORT_A, (pin), (irq), FGPIO_CAP_IRQ_BY_CTRL) |
|||
|
|||
const FGpioConfig fgpio_cfg_tbl[FGPIO_NUM] = |
|||
{ |
|||
/* GPIO 0, IRQ 140 ~ 155 */ |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_0, 140U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_1, 141U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_2, 142U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_3, 143U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_4, 144U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_5, 145U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_6, 146U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_7, 147U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_8, 148U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_9, 149U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_10, 150U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_11, 151U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_12, 152U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_13, 153U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_14, 154U), |
|||
FGPIO_PIN_CONFIG_0(FGPIO_PIN_15, 155U), |
|||
|
|||
/* GPIO 1, IRQ 156 ~ 171 */ |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_0, 156U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_1, 157U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_2, 158U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_3, 159U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_4, 160U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_5, 161U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_6, 162U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_7, 163U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_8, 164U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_9, 165U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_10, 166U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_11, 167U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_12, 168U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_13, 169U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_14, 170U), |
|||
FGPIO_PIN_CONFIG_1(FGPIO_PIN_15, 171U), |
|||
|
|||
/* GPIO 2, IRQ 172 ~ 187 */ |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_0, 172U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_1, 173U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_2, 174U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_3, 175U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_4, 176U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_5, 177U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_6, 178U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_7, 179U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_8, 180U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_9, 181U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_10, 182U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_11, 183U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_12, 184U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_13, 185U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_14, 186U), |
|||
FGPIO_PIN_CONFIG_2(FGPIO_PIN_15, 187U), |
|||
|
|||
/* GPIO 3, IRQ 188 */ |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_0, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_1, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_2, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_3, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_4, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_5, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_6, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_7, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_8, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_9, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_10, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_11, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_12, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_13, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_14, 188U), |
|||
FGPIO_PIN_CONFIG_3(FGPIO_PIN_15, 188U), |
|||
|
|||
/* GPIO 4, IRQ 189 */ |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_0, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_1, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_2, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_3, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_4, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_5, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_6, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_7, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_8, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_9, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_10, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_11, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_12, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_13, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_14, 189U), |
|||
FGPIO_PIN_CONFIG_4(FGPIO_PIN_15, 189U), |
|||
|
|||
/* GPIO 5, IRQ 190 */ |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_0, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_1, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_2, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_3, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_4, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_5, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_6, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_7, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_8, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_9, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_10, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_11, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_12, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_13, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_14, 190U), |
|||
FGPIO_PIN_CONFIG_5(FGPIO_PIN_15, 190U) |
|||
}; |
|||
|
|||
#define FGPIO_INTR_MAP_CONFIG(_base) \ |
|||
{ \ |
|||
.base_addr = _base, \ |
|||
.irq_cbs = {NULL}, \ |
|||
.irq_cb_params = {NULL},\ |
|||
} |
|||
|
|||
FGpioIntrMap fgpio_intr_map[FGPIO_CTRL_NUM] = |
|||
{ |
|||
/* GPIO 0 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO0_BASE_ADDR), |
|||
|
|||
/* GPIO 1 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO1_BASE_ADDR), |
|||
|
|||
/* GPIO 2 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO2_BASE_ADDR), |
|||
|
|||
/* GPIO 3 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO3_BASE_ADDR), |
|||
|
|||
/* GPIO 4 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO4_BASE_ADDR), |
|||
|
|||
/* GPIO 5 IRQ Map */ |
|||
FGPIO_INTR_MAP_CONFIG(FGPIO5_BASE_ADDR) |
|||
}; |
|||
|
|||
const FGpioConfig *FGpioLookupConfigByIrqNum(s32 irq_num) |
|||
{ |
|||
u32 index; |
|||
const FGpioConfig *ptr = NULL; |
|||
|
|||
for (index = 0; index < FGPIO_NUM; index++) |
|||
{ |
|||
/* 如果引脚单独上报中断,返回对应引脚的配置
|
|||
如果引脚通过控制器统一上报中断,共用中断号,返回使用该中断号的第一个引脚的配置 |
|||
如果引脚不支持中断,返回 NULL */ |
|||
if (fgpio_cfg_tbl[index].irq_num == irq_num) |
|||
{ |
|||
ptr = &fgpio_cfg_tbl[index]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
return ptr; |
|||
} |