• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pin_to_controller函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pin_to_controller函数的典型用法代码示例。如果您正苦于以下问题:C++ pin_to_controller函数的具体用法?C++ pin_to_controller怎么用?C++ pin_to_controller使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pin_to_controller函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cpu9260_macb_hw_init

static void cpu9260_macb_hw_init(void)
{
	unsigned long rstc;

	/* Enable clock */
	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC);

	/*
	 * Disable pull-up on:
	 *	RXDV (PA17) => PHY normal mode (not Test mode)
	 *	ERX0 (PA14) => PHY ADDR0
	 *	ERX1 (PA15) => PHY ADDR1
	 *	ERX2 (PA25) => PHY ADDR2
	 *	ERX3 (PA26) => PHY ADDR3
	 *	ECRS (PA28) => PHY ADDR4  => PHYADDR = 0x0
	 *
	 * PHY has internal pull-down
	 */
	writel(pin_to_mask(AT91_PIN_PA14) |
	       pin_to_mask(AT91_PIN_PA15) |
	       pin_to_mask(AT91_PIN_PA17) |
	       pin_to_mask(AT91_PIN_PA25) |
	       pin_to_mask(AT91_PIN_PA26) |
	       pin_to_mask(AT91_PIN_PA28),
	       pin_to_controller(AT91_PIN_PA0) + PIO_PUDR);

	rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;

	/* Need to reset PHY -> 500ms reset */
	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
		       (AT91_RSTC_ERSTL & (0x0D << 8)) |
		       AT91_RSTC_URSTEN);

	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST);

	/* Wait for end hardware reset */
	while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL))
		;

	/* Restore NRST value */
	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
		       (rstc) |
		       AT91_RSTC_URSTEN);

	/* Re-enable pull-up */
	writel(pin_to_mask(AT91_PIN_PA14) |
	       pin_to_mask(AT91_PIN_PA15) |
	       pin_to_mask(AT91_PIN_PA17) |
	       pin_to_mask(AT91_PIN_PA25) |
	       pin_to_mask(AT91_PIN_PA26) |
	       pin_to_mask(AT91_PIN_PA28),
	       pin_to_controller(AT91_PIN_PA0) + PIO_PUER);

	at91_macb_hw_init();
}
开发者ID:247a,项目名称:lenovo_b6000-8000_kernel_source,代码行数:55,代码来源:cpu9260.c


示例2: at91_gpio_show

static int at91_gpio_show(struct seq_file *s, void *unused)
{
	int bank, j;

	/* print heading */
	seq_printf(s, "Pin\t");
	for (bank = 0; bank < gpio_banks; bank++) {
		seq_printf(s, "PIO%c\t\t", 'A' + bank);
	};
	seq_printf(s, "\n\n");

	/* print pin status */
	for (j = 0; j < 32; j++) {
		seq_printf(s, "%i:\t", j);

		for (bank = 0; bank < gpio_banks; bank++) {
			unsigned	pin  = (32 * bank) + j;
			void __iomem	*pio = pin_to_controller(pin);
			unsigned	mask = pin_to_mask(pin);

			if (__raw_readl(pio + PIO_PSR) & mask)
				gpio_printf(s, pio, mask);
			else
				seq_printf(s, "%c\t\t",
						peripheral_function(pio, mask));
		}

		seq_printf(s, "\n");
	}

	return 0;
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:32,代码来源:gpio.c


示例3: gpio_irq_unmask

static void gpio_irq_unmask(unsigned pin)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (pio)
		__raw_writel(mask, pio + PIO_IER);
}
开发者ID:ivucica,项目名称:linux,代码行数:8,代码来源:gpio.c


示例4: gpio_irq_unmask

static void gpio_irq_unmask(unsigned pin)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);

	if (pio)
		__raw_writel(mask, &pio->ier);
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:8,代码来源:gpio.c


示例5: at91_set_gpio_value

/*
 * assuming the pin is muxed as a gpio output, set its value.
 */
int at91_set_gpio_value(unsigned pin, int value)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;
	__raw_writel(mask, value ? &pio->sodr : &pio->codr);
	return 0;
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:13,代码来源:gpio.c


示例6: at91_set_deglitch

/*
 * enable/disable the glitch filter; mostly used with IRQ handling.
 */
int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;
	__raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
	return 0;
}
开发者ID:ivucica,项目名称:linux,代码行数:13,代码来源:gpio.c


示例7: at91_set_deglitch

/*
 * enable/disable the glitch filter; mostly used with IRQ handling.
 */
int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;
	__raw_writel(mask, is_on ? &pio->ifer : &pio->ifdr);
	return 0;
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:13,代码来源:gpio.c


示例8: at91_set_gpio_value

int at91_set_gpio_value(unsigned pin, int value)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;
	__raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
	return 0;
}
开发者ID:ESLab,项目名称:rtdl,代码行数:10,代码来源:smc_driverL.c


示例9: gpio_direction_input

int gpio_direction_input(unsigned pin)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !(__raw_readl(pio + PIO_PSR) & mask))
		return -EINVAL;
	__raw_writel(mask, pio + PIO_ODR);
	return 0;
}
开发者ID:ForayJones,项目名称:iods,代码行数:10,代码来源:gpio.c


示例10: at91_get_gpio_value

/*
 * read the pin's value (works even if it's not muxed as a gpio).
 */
int at91_get_gpio_value(unsigned pin)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);
	u32				pdsr;

	if (!pio)
		return -EINVAL;
	pdsr = __raw_readl(&pio->pdsr);
	return (pdsr & mask) != 0;
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:14,代码来源:gpio.c


示例11: at91_get_gpio_value

/*
 * read the pin's value (works even if it's not muxed as a gpio).
 */
int at91_get_gpio_value(unsigned pin)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);
	u32		pdsr;

	if (!pio)
		return -EINVAL;
	pdsr = __raw_readl(pio + PIO_PDSR);
	return (pdsr & mask) != 0;
}
开发者ID:ivucica,项目名称:linux,代码行数:14,代码来源:gpio.c


示例12: gpio_direction_output

int gpio_direction_output(unsigned pin, int value)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !(__raw_readl(pio + PIO_PSR) & mask))
		return -EINVAL;
	__raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
	__raw_writel(mask, pio + PIO_OER);
	return 0;
}
开发者ID:ForayJones,项目名称:iods,代码行数:11,代码来源:gpio.c


示例13: at91_disable_schmitt_trig

/*
 * disable Schmitt trigger
 */
int __init_or_module at91_disable_schmitt_trig(unsigned pin)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !has_pio3())
		return -EINVAL;

	__raw_writel(__raw_readl(pio + PIO_SCHMITT) | mask, pio + PIO_SCHMITT);
	return 0;
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:14,代码来源:gpio.c


示例14: at91_set_pulldown

/*
 * enable/disable the pull-down.
 * If pull-up already enabled while calling the function, we disable it.
 */
int __init_or_module at91_set_pulldown(unsigned pin, int is_on)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !has_pio3())
		return -EINVAL;

	/* Disable pull-up anyway */
	__raw_writel(mask, pio + PIO_PUDR);
	__raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
	return 0;
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:17,代码来源:gpio.c


示例15: at91_set_B_periph

/*
 * mux the pin to the "B" internal peripheral role.
 */
int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;

	__raw_writel(mask, &pio->idr);
	__raw_writel(mask, use_pullup ? &pio->puer : &pio->pudr);
	__raw_writel(mask, &pio->bsr);
	__raw_writel(mask, &pio->pdr);
	return 0;
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:17,代码来源:gpio.c


示例16: at91_set_D_periph

/*
 * mux the pin to the "D" internal peripheral role.
 */
int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !has_pio3())
		return -EINVAL;

	__raw_writel(mask, pio + PIO_IDR);
	__raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
	__raw_writel(__raw_readl(pio + PIO_ABCDSR1) | mask, pio + PIO_ABCDSR1);
	__raw_writel(__raw_readl(pio + PIO_ABCDSR2) | mask, pio + PIO_ABCDSR2);
	__raw_writel(mask, pio + PIO_PDR);
	return 0;
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:18,代码来源:gpio.c


示例17: at91_set_gpio_output

int __init_or_module at91_set_gpio_output(unsigned pin, int value)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;

	__raw_writel(mask, pio + PIO_IDR);
	__raw_writel(mask, pio + PIO_PUDR);
	__raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
	__raw_writel(mask, pio + PIO_OER);
	__raw_writel(mask, pio + PIO_PER);
	return 0;
}
开发者ID:ESLab,项目名称:rtdl,代码行数:15,代码来源:smc_driverL.c


示例18: at91_set_A_periph

int at91_set_A_periph(unsigned pin, int use_pullup)
{
	//void __iomem	*pio = pin_to_controller(pin);
	void *pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio)
		//return -EINVAL;
	  return 1;

	writel(mask, pio + PIO_IDR);
	writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
	writel(mask, pio + PIO_ASR);
	writel(mask, pio + PIO_PDR);
	return 0;
}
开发者ID:ESLab,项目名称:rtdl,代码行数:16,代码来源:smc_driverL.c


示例19: at91_set_debounce

/*
 * enable/disable the debounce filter;
 */
int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div)
{
	void __iomem	*pio = pin_to_controller(pin);
	unsigned	mask = pin_to_mask(pin);

	if (!pio || !has_pio3())
		return -EINVAL;

	if (is_on) {
		__raw_writel(mask, pio + PIO_IFSCER);
		__raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR);
		__raw_writel(mask, pio + PIO_IFER);
	} else {
		__raw_writel(mask, pio + PIO_IFDR);
	}
	return 0;
}
开发者ID:01org,项目名称:KVMGT-kernel,代码行数:20,代码来源:gpio.c


示例20: at91_set_gpio_direction

/*
 * mux the pin to the gpio controller (instead of "A" or "B" peripheral).
 *  for input, mode == use_pullup
 *  for output, mode == initial value
 */
int __init_or_module at91_set_gpio_direction(unsigned pin, int is_input, int mode)
{
	struct pio_controller __iomem	*pio = pin_to_controller(pin);
	unsigned			mask = pin_to_mask(pin);

	if (!pio)
		return -EINVAL;

	__raw_writel(mask, &pio->idr);
	if (is_input) {
		__raw_writel(mask, mode ? &pio->puer : &pio->pudr);
		__raw_writel(mask, &pio->odr);
	} else {
		__raw_writel(mask, &pio->pudr);
		__raw_writel(mask, mode ? &pio->sodr : &pio->codr);
		__raw_writel(mask, &pio->oer);
	}
	__raw_writel(mask, &pio->per);
	return 0;
}
开发者ID:sisilet,项目名称:linux-imx21,代码行数:25,代码来源:gpio.c



注:本文中的pin_to_controller函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pin_to_mask函数代码示例发布时间:2022-05-30
下一篇:
C++ pin_mode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap