本文整理汇总了C++中s3c_gpiolib_getchip函数的典型用法代码示例。如果您正苦于以下问题:C++ s3c_gpiolib_getchip函数的具体用法?C++ s3c_gpiolib_getchip怎么用?C++ s3c_gpiolib_getchip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s3c_gpiolib_getchip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: s3c2410_gpio_getpin
unsigned int s3c2410_gpio_getpin(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long offs = pin - chip->chip.base;
return __raw_readl(chip->base + 0x04) & (1<< offs);
}
示例2: s3c_gpio_slp_getpull_updown
s3c_gpio_pull_t s3c_gpio_slp_getpull_updown(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
unsigned long flags;
int offset;
u32 con;
int shift;
if (!chip)
return -EINVAL;
if((chip->base == (S3C64XX_GPK_BASE + 0x4)) ||
(chip->base == (S3C64XX_GPL_BASE + 0x4)) ||
(chip->base == S3C64XX_GPM_BASE) ||
(chip->base == S3C64XX_GPN_BASE))
{
return -EINVAL;
}
reg = chip->base + 0x10;
offset = pin - chip->chip.base;
shift = offset * 2;
local_irq_save(flags);
con = __raw_readl(reg);
con >>= shift;
con &= 0x3;
local_irq_restore(flags);
return (__force s3c_gpio_pull_t)con;
}
示例3: s3c_gpio_slp_setpull_updown
int s3c_gpio_slp_setpull_updown(unsigned int pin, unsigned int config)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
unsigned long flags;
int offset;
u32 con;
int shift;
if (!chip)
return -EINVAL;
if ((pin >= EXYNOS4_GPX0(0)) && (pin <= EXYNOS4_GPX3(7)))
return -EINVAL;
if (config > S3C_GPIO_PULL_UP)
return -EINVAL;
reg = chip->base + 0x14;
offset = pin - chip->chip.base;
shift = offset * 2;
local_irq_save(flags);
con = __raw_readl(reg);
con &= ~(3 << shift);
con |= config << shift;
__raw_writel(con, reg);
local_irq_restore(flags);
return 0;
}
示例4: s3c2412_gpio_set_sleepcfg
int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long offs = pin - chip->chip.base;
unsigned long flags;
unsigned long slpcon;
offs *= 2;
if (pin < S3C2410_GPB(0))
return -EINVAL;
if (pin >= S3C2410_GPF(0) &&
pin <= S3C2410_GPG(16))
return -EINVAL;
if (pin > S3C2410_GPH(16))
return -EINVAL;
local_irq_save(flags);
slpcon = __raw_readl(chip->base + 0x0C);
slpcon &= ~(3 << offs);
slpcon |= state << offs;
__raw_writel(slpcon, chip->base + 0x0C);
local_irq_restore(flags);
return 0;
}
示例5: s3c_gpio_get_slp_cfgpin
s3c_gpio_pull_t s3c_gpio_get_slp_cfgpin(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
unsigned long flags;
int offset;
u32 con;
int shift;
if (!chip)
return -EINVAL;
if ((pin >= EXYNOS4_GPX0(0)) && (pin <= EXYNOS4_GPX3(7)))
return -EINVAL;
reg = chip->base + 0x10;
offset = pin - chip->chip.base;
shift = offset * 2;
local_irq_save(flags);
con = __raw_readl(reg);
con >>= shift;
con &= 0x3;
local_irq_restore(flags);
return (__force s3c_gpio_pull_t)con;
}
示例6: s3c_gpio_getpull
s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
int offset;
u32 pup = 0;
if (chip) {
offset = pin - chip->chip.base;
s3c_gpio_lock(chip, flags);
pup = s3c_gpio_do_getpull(chip, offset);
s3c_gpio_unlock(chip, flags);
}
return (__force s3c_gpio_pull_t)pup;
}
示例7: s3c_gpio_getcfg
unsigned s3c_gpio_getcfg(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
unsigned ret = 0;
int offset;
if (chip) {
offset = pin - chip->chip.base;
s3c_gpio_lock(chip, flags);
ret = s3c_gpio_do_getcfg(chip, offset);
s3c_gpio_unlock(chip, flags);
}
return ret;
}
示例8: s3c_gpio_setpull
int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
int offset, ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
local_irq_save(flags);
ret = s3c_gpio_do_setpull(chip, offset, pull);
local_irq_restore(flags);
return ret;
}
示例9: s3c_gpio_setpull
int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
int offset, ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
s3c_gpio_lock(chip, flags);
ret = s3c_gpio_do_setpull(chip, offset, pull);
s3c_gpio_unlock(chip, flags);
return ret;
}
示例10: s3c_gpio_cfgpin
int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
int offset;
int ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
local_irq_save(flags);
ret = s3c_gpio_do_setcfg(chip, offset, config);
local_irq_restore(flags);
return ret;
}
示例11: s5p_gpio_get_drvstr
s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
int shift = off * 2;
u32 drvstr;
if (!chip)
return -EINVAL;
reg = chip->base + 0x0C;
drvstr = __raw_readl(reg);
drvstr = 0xffff & (0x3 << shift);
drvstr = drvstr >> shift;
return (__force s5p_gpio_drvstr_t)drvstr;
}
示例12: s3c_gpio_getpin
s3c_gpio_pull_t s3c_gpio_getpin(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned long flags;
int offset;
s3c_gpio_pull_t ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
local_irq_save(flags);
//ret = s3c_gpio_do_getpin(chip, offset, level);
ret = (chip->config->get_pin) (chip, offset);
local_irq_restore(flags);
return ret;
}
示例13: s5p_gpio_set_drvstr
int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off,
s5p_gpio_drvstr_t drvstr)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
int shift = off * 2;
u32 tmp;
if (!chip)
return -EINVAL;
reg = chip->base + 0x0C;
tmp = __raw_readl(reg);
tmp |= drvstr << shift;
__raw_writel(tmp, reg);
return 0;
}
示例14: s5p_gpio_get_drvstr
s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
unsigned int off;
void __iomem *reg;
int shift;
u32 drvstr;
if (!chip)
return -EINVAL;
off = pin - chip->chip.base;
shift = off * 2;
reg = chip->base + 0x0C;
drvstr = __raw_readl(reg);
drvstr = drvstr >> shift;
drvstr &= 0x3;
return (__force s5p_gpio_drvstr_t)drvstr;
}
示例15: s3c_gpio_slp_setpull_updown
int s3c_gpio_slp_setpull_updown(unsigned int pin, unsigned int config)
{
struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
void __iomem *reg;
unsigned long flags;
int offset;
u32 con;
int shift;
if (!chip)
return -EINVAL;
if((chip->base == (S3C64XX_GPK_BASE + 0x4)) ||
(chip->base == (S3C64XX_GPL_BASE + 0x4)) ||
(chip->base == S3C64XX_GPM_BASE) ||
(chip->base == S3C64XX_GPN_BASE))
{
return -EINVAL;
}
if(config > 3)
{
return -EINVAL;
}
reg = chip->base + 0x10;
offset = pin - chip->chip.base;
shift = offset * 2;
local_irq_save(flags);
con = __raw_readl(reg);
con &= ~(3 << shift);
con |= config << shift;
__raw_writel(con, reg);
con = __raw_readl(reg);
local_irq_restore(flags);
return 0;
}