亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 熟悉at91rm9200的內(nèi)核源碼請進(jìn) 尤其是MCI這一部分的 [打印本頁]

作者: lovesunshine    時(shí)間: 2008-10-30 20:39
標(biāo)題: 熟悉at91rm9200的內(nèi)核源碼請進(jìn) 尤其是MCI這一部分的
include/asm-arm/arch-at91/gpio.h里面
#define        AT91_PIN_PA0        (PIN_BASE + 0x00 + 0)
#define        AT91_PIN_PA1        (PIN_BASE + 0x00 + 1)
#define        AT91_PIN_PA2        (PIN_BASE + 0x00 + 2)
#define        AT91_PIN_PA3        (PIN_BASE + 0x00 + 3)
................
有很多這種定義
我看了下
#define PIN_BASE                NR_AIC_IRQS
#define NR_AIC_IRQS 32

請問上面的#define        AT91_PIN_PA0        (PIN_BASE + 0x00 + 0)這些定義是在定義引腳 ,按這樣的定義 PA0的值就為32了,看了芯片的封裝 DATASHEET里這個(gè)引腳序號為42啊,AT91_PIN_PAi,AT91_PIN_PBi之類的值都與DATASHEET里的引腳序號值不符合
怎么回事呢,而且我也沒看到DATASHEET里AT91_PIN_PB27 復(fù)用為了MCI的DETECT_PIN啊
怎么在 linux/drivers/mmc/host/at91_mci.c - ATMEL AT91 MCI Driverl文件里有:
static int __init at91_mci_probe(struct platform_device *pdev)
{
        struct mmc_host *mmc;
        struct at91mci_host *host;
        struct resource *res;
        int ret;

        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
                return -ENXIO;

。。。。。。。。。。。。。。。。。。
        /*
         * monitor card insertion/removal if we can
         */
        if (host->board->det_pin) {
                ret = request_irq(gpio_to_irq(host->board->det_pin),
                                at91_mmc_det_irq, 0, mmc_hostname(mmc), host);
                if (ret)
                        dev_warn(&pdev->dev, "request MMC detect irq failed\n");
                else
                        device_init_wakeup(&pdev->dev, 1);
        }

                return ret;
}
據(jù)我的理解 正對EK開發(fā)板host->board->det_pin這個(gè)值就是在在linux/arch/arm/mach-at91/board-ek.c;里的初始化的ek_mmc_data .det_pin這個(gè)值
static struct at91_mmc_data __initdata ek_mmc_data = {
        .det_pin        = AT91_PIN_PB27,
        .slot_b                = 0,
        .wire4                = 1,
        .wp_pin                = AT91_PIN_PA17,
};
不明白怎么把一個(gè)引腳跟系統(tǒng)的中斷號給對應(yīng)了起來,和調(diào)用request_irq(gpio_to_irq(host->board->det_pin),at91_mmc_det_irq, 0, mmc_hostname(mmc), host);來注冊中斷
作者: Roemer    時(shí)間: 2008-10-30 23:47
對對寄存器,和封裝沒有關(guān)系~~
作者: gbc737    時(shí)間: 2008-10-31 08:44
由:
include/asm-arm/arch-at91/gpio.h里面
static inline int gpio_to_irq(unsigned gpio)
{
        return gpio;
}

static inline int irq_to_gpio(unsigned irq)
{
        return irq;
}

可知:
===============================================
include/asm-arm/arch-at91/gpio.h里面
#define        AT91_PIN_PA0        (PIN_BASE + 0x00 + 0)
#define        AT91_PIN_PA1        (PIN_BASE + 0x00 + 1)
#define        AT91_PIN_PA2        (PIN_BASE + 0x00 + 2)
#define        AT91_PIN_PA3        (PIN_BASE + 0x00 + 3)
................
有很多這種定義
我看了下
#define PIN_BASE                NR_AIC_IRQS
#define NR_AIC_IRQS 32
===============================================
上面給出的是引腳的中斷號,不是DATASHEET里的引腳序號。
gpio的中斷號是接著AIC中斷號的從32開始
作者: lovesunshine    時(shí)間: 2008-10-31 15:21
include/asm-arm/arch-at91/gpio.h里面
#define        AT91_PIN_PA0        (PIN_BASE + 0x00 + 0)
#define        AT91_PIN_PA1        (PIN_BASE + 0x00 + 1)
#define        AT91_PIN_PA2        (PIN_BASE + 0x00 + 2)
#define        AT91_PIN_PA3        (PIN_BASE + 0x00 + 3)
這些PIN引腳都有中斷號?中斷號可以隨便分配??是不是除了0~31這32個(gè)值不能用外,其余的值都可以分配給這些PIN引腳?不明白怎么把這些引腳跟中斷號對應(yīng)起來的???
作者: gbc737    時(shí)間: 2008-10-31 17:21
引腳中斷號是我的習(xí)慣說法,
在內(nèi)核中,每個(gè)架構(gòu)都有一個(gè)中斷的結(jié)構(gòu)體數(shù)組,irq_desc[]
上面說的中斷號 就是那數(shù)組的下標(biāo),
前面32個(gè)分給aic了所以引腳中斷被分在緊跟aic在后面,
每個(gè)結(jié)構(gòu)體包含對應(yīng)中斷的詳細(xì)信息如下:
struct irq_desc {
        irq_flow_handler_t        handle_irq;
        struct irq_chip                *chip;
        struct msi_desc                *msi_desc;
        void                        *handler_data;
        void                        *chip_data;
        struct irqaction        *action;        /* IRQ action list */
        unsigned int                status;                /* IRQ status */

        unsigned int                depth;                /* nested irq disables */
        unsigned int                wake_depth;        /* nested wake enables */
        unsigned int                irq_count;        /* For detecting broken IRQs */
        unsigned int                irqs_unhandled;
        unsigned long                last_unhandled;        /* Aging timer for unhandled count */
        spinlock_t                lock;
#ifdef CONFIG_SMP
        cpumask_t                affinity;
        unsigned int                cpu;
#endif
#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
        cpumask_t                pending_mask;
#endif
#ifdef CONFIG_PROC_FS
        struct proc_dir_entry        *dir;
#endif
        const char                *name;
} ____cacheline_internodealigned_in_smp;
這樣,當(dāng)分配中斷服務(wù)程序等操作,就可以通過操作以上結(jié)果體數(shù)組完成。

[ 本帖最后由 gbc737 于 2008-10-31 17:24 編輯 ]




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2