I.MX6 计算iomux Pin配置

/*********************************************************************************
 *                    I.MX6 计算iomux Pin配置
 * 说明:
 *     之前一般都自己算一下,左栋搞个程序算。
 *
 *                                       2017-11-13 深圳 南山平山村 曾剑锋
 ********************************************************************************/

#include <stdio.h>

#define PAD_CTL_HYS                     (1 << 16)
#define PAD_CTL_PUS_100K_DOWN           (0 << 14)
#define PAD_CTL_PUS_47K_UP              (1 << 14)
#define PAD_CTL_PUS_100K_UP             (2 << 14)
#define PAD_CTL_PUS_22K_UP              (3 << 14)
#define PAD_CTL_PUE                     (1 << 13)
#define PAD_CTL_PKE                     (1 << 12)
#define PAD_CTL_ODE                     (1 << 11)
#define PAD_CTL_SPEED_LOW               (1 << 6)
#define PAD_CTL_SPEED_MED               (2 << 6)
#define PAD_CTL_SPEED_HIGH              (3 << 6)
#define PAD_CTL_DSE_DISABLE             (0 << 3)
#define PAD_CTL_DSE_240ohm              (1 << 3)
#define PAD_CTL_DSE_120ohm              (2 << 3)
#define PAD_CTL_DSE_80ohm               (3 << 3)
#define PAD_CTL_DSE_60ohm               (4 << 3)
#define PAD_CTL_DSE_48ohm               (5 << 3)
#define PAD_CTL_DSE_40ohm               (6 << 3)
#define PAD_CTL_DSE_34ohm               (7 << 3)
#define PAD_CTL_SRE_FAST                (1 << 0)
#define PAD_CTL_SRE_SLOW                (0 << 0)

#define MX6DL_USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |        \
        PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |        \
        PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)

#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |            \
    PAD_CTL_SPEED_LOW | PAD_CTL_DSE_34ohm |            \
    PAD_CTL_SRE_FAST  | PAD_CTL_HYS)

int main(void)
{
    printf("hello world!\r\n");
    printf("MX6DL_USDHC_PAD_CTRL = %x\r\n", MX6DL_USDHC_PAD_CTRL);
    printf("USDHC_PAD_CTRL = %x\r\n", USDHC_PAD_CTRL);
}

 

posted on 2017-11-13 20:35  zengjf  阅读(743)  评论(0编辑  收藏  举报

导航