449 lines
6.8 KiB
C
449 lines
6.8 KiB
C
/*
|
|
* Copyright (c) 2006-2024, RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2024/05/24 unicornx first version
|
|
*/
|
|
#ifndef __DRV_PINMUX_H__
|
|
#define __DRV_PINMUX_H__
|
|
|
|
/**
|
|
* @brief Function Selection Type
|
|
*
|
|
* FIXME: At present, we only define the ones we will use,
|
|
* not all of them. We will need to add them later.
|
|
*/
|
|
typedef enum _fs_type
|
|
{
|
|
fs_none = 0,
|
|
AUX0,
|
|
AUX1,
|
|
AUX2,
|
|
CAM_HS0,
|
|
CAM_MCLK0,
|
|
CAM_MCLK1,
|
|
CAM_VS0,
|
|
CLK25M,
|
|
CLK32K,
|
|
DBG_0,
|
|
DBG_1,
|
|
DBG_2,
|
|
DBG_3,
|
|
DBG_4,
|
|
DBG_5,
|
|
DBG_6,
|
|
DBG_7,
|
|
DBG_8,
|
|
DBG_9,
|
|
DBG_10,
|
|
DBG_11,
|
|
DBG_12,
|
|
DBG_13,
|
|
DBG_14,
|
|
DBG_15,
|
|
DBG_16,
|
|
DBG_18,
|
|
DBG_19,
|
|
EMMC_CLK,
|
|
EMMC_CMD,
|
|
EMMC_DAT_0,
|
|
EMMC_DAT_1,
|
|
EMMC_DAT_2,
|
|
EMMC_DAT_3,
|
|
EMMC_RSTN,
|
|
EPHY_LNK_LED,
|
|
EPHY_SPD_LED,
|
|
IIC0_SCL,
|
|
IIC0_SDA,
|
|
IIC1_SCL,
|
|
IIC1_SDA,
|
|
IIC2_SCL,
|
|
IIC2_SDA,
|
|
IIC3_SCL,
|
|
IIC3_SDA,
|
|
IIC4_SCL,
|
|
IIC4_SDA,
|
|
IIS1_BCLK,
|
|
IIS1_DI,
|
|
IIS1_DO,
|
|
IIS1_LRCK,
|
|
IIS1_MCLK,
|
|
IIS2_BCLK,
|
|
IIS2_DI,
|
|
IIS2_DO,
|
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OA_17,
|
|
XGPIOA_18,
|
|
XGPIOA_19,
|
|
XGPIOA_20,
|
|
XGPIOA_21,
|
|
XGPIOA_22,
|
|
XGPIOA_23,
|
|
XGPIOA_24,
|
|
XGPIOA_25,
|
|
XGPIOA_26,
|
|
XGPIOA_27,
|
|
XGPIOA_28,
|
|
XGPIOA_29,
|
|
XGPIOA_30,
|
|
XGPIOB_0,
|
|
XGPIOB_1,
|
|
XGPIOB_2,
|
|
XGPIOB_3,
|
|
XGPIOB_4,
|
|
XGPIOB_5,
|
|
XGPIOB_6,
|
|
XGPIOB_7,
|
|
XGPIOB_8,
|
|
XGPIOB_9,
|
|
XGPIOB_10,
|
|
XGPIOB_11,
|
|
XGPIOB_12,
|
|
XGPIOB_13,
|
|
XGPIOB_14,
|
|
XGPIOB_15,
|
|
XGPIOB_16,
|
|
XGPIOB_17,
|
|
XGPIOB_18,
|
|
XGPIOB_19,
|
|
XGPIOB_20,
|
|
XGPIOB_21,
|
|
XGPIOB_22,
|
|
XGPIOB_23,
|
|
XGPIOB_24,
|
|
XGPIOB_25,
|
|
XGPIOB_26,
|
|
XGPIOB_27,
|
|
XGPIOC_0,
|
|
XGPIOC_1,
|
|
XGPIOC_2,
|
|
XGPIOC_3,
|
|
XGPIOC_4,
|
|
XGPIOC_5,
|
|
XGPIOC_6,
|
|
XGPIOC_7,
|
|
XGPIOC_8,
|
|
XGPIOC_9,
|
|
XGPIOC_10,
|
|
XGPIOC_11,
|
|
XGPIOC_12,
|
|
XGPIOC_13,
|
|
XGPIOC_14,
|
|
XGPIOC_15,
|
|
XGPIOC_16,
|
|
XGPIOC_17,
|
|
XGPIOC_18,
|
|
XGPIOC_19,
|
|
XGPIOC_20,
|
|
XGPIOC_21,
|
|
XGPIOC_22,
|
|
XGPIOC_23,
|
|
XGPIOC_24,
|
|
XGPIOC_25,
|
|
} fs_type;
|
|
|
|
/**
|
|
* @brief configure pin multiplex
|
|
*
|
|
* @param pin_name pin name string
|
|
* @param func_type function type enum
|
|
* @param whitelist pin name whilelist which is allowed to set. Ignore check
|
|
* if NULL.
|
|
* NOTE: whitelist should be a string list ended with NULL.
|
|
*
|
|
* @return RT_EOK if succeeded
|
|
* else: something wrong occurred and config is abandoned.
|
|
*/
|
|
extern int pinmux_config(const char *pin_name, fs_type func_type, const char *whitelist[]);
|
|
|
|
#endif
|