/**************************************************************
gpio_to_irq(S5PV210_GPH2(0))
**************************************************************/
 4 #define gpio_to_irq      __gpio_to_irq
 5 
 6 int __gpio_to_irq(unsigned gpio)
 7 {
 8     struct gpio_chip    *chip;
 9     chip = gpio_to_chip(S5PV210_GPH2(0));
static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
{
    return gpio_desc[S5PV210_GPH2(0)].chip; 
    //参考gpio-s5pv210.c中
    //samsung_gpiolib_add_4bit_chips(s5pv210_gpio_4bit, nr_chips)函数
    //gpio_desc[id].chip = chip;
}
10     return chip->to_irq ? chip->to_irq(chip, gpio - chip->base) : -ENXIO;
11     //s5pv210_gpio_4bit
12 }
int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
{
//获得gpio_chip结构体所在的父结构体s3c_gpio_chip的指针 
struct s3c_gpio_chip *s3c_chip = container_of(chip,struct s3c_gpio_chip, chip);
//获取虚拟映射机制中定义的终端号
return s3c_chip->irq_base + offset;

#define IRQ_EINT(x)        ((x) < 16 ? ((x) + S5P_EINT_BASE1) \
                    : ((x) - 16 + S5P_EINT_BASE2))
#define S5P_EINT_BASE2        (IRQ_VIC_END + 1)
#define IRQ_VIC_END        S5P_IRQ_VIC3(31)
#define S5P_IRQ_VIC3(x)        (S5P_VIC3_BASE + (x))
#define S5P_VIC3_BASE        S5P_IRQ(96)
#define S5P_IRQ(x)        ((x) + S5P_IRQ_OFFSET)
#define S5P_IRQ_OFFSET        (32)

#define S5P_EINT_BASE1        (S5P_IRQ_VIC0(0))
#define S5P_IRQ_VIC0(x)        (S5P_VIC0_BASE + (x))
#define S5P_VIC0_BASE        S5P_IRQ(0)
IRQ_EINT(16)

}

 

相关文章:

  • 2021-10-25
  • 2022-12-23
  • 2021-12-17
  • 2022-01-17
  • 2021-04-01
  • 2021-10-12
  • 2021-04-06
  • 2021-07-28
猜你喜欢
  • 2022-12-23
  • 2021-07-09
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-08-29
相关资源
相似解决方案