1 | /*
|
---|
2 | * Copyright (c) 2010 Jiri Svoboda
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup genarch
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /**
|
---|
33 | * @file
|
---|
34 | * @brief Samsung S3C24xx on-chip interrupt controller driver.
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef KERN_S3C24XX_IRQC_H_
|
---|
38 | #define KERN_S3C24XX_IRQC_H_
|
---|
39 |
|
---|
40 | #include <typedefs.h>
|
---|
41 |
|
---|
42 | /** Physical address where S3C24XX Interrupt controller is mapped */
|
---|
43 | #define S3C24XX_IRQC_ADDRESS 0x4a000000
|
---|
44 |
|
---|
45 | /** S3C24xx on-chip interrupt controller registers */
|
---|
46 | typedef struct {
|
---|
47 | ioport32_t srcpnd; /**< Source pending */
|
---|
48 | ioport32_t intmod; /**< Interrupt mode */
|
---|
49 | ioport32_t intmsk; /**< Interrupt mask */
|
---|
50 | ioport32_t priority; /**< Priority */
|
---|
51 | ioport32_t intpnd; /**< Interrupt pending */
|
---|
52 | ioport32_t intoffset; /**< Interrupt offset */
|
---|
53 | ioport32_t subsrcpnd; /**< Sub source pending */
|
---|
54 | ioport32_t intsubmsk; /** Interrupt sub mask */
|
---|
55 | } s3c24xx_irqc_regs_t;
|
---|
56 |
|
---|
57 | /** S3C24xx Interrupt source numbers.
|
---|
58 | *
|
---|
59 | * These correspond to bit numbers in srcpnd, intmod, intmsk and intpnd
|
---|
60 | * registers as well as to the values read from the intoffset register.
|
---|
61 | */
|
---|
62 | enum s3c24xx_int_source {
|
---|
63 | S3C24XX_INT_ADC = 31,
|
---|
64 | S3C24XX_INT_RTC = 30,
|
---|
65 | S3C24XX_INT_SPI1 = 29,
|
---|
66 | S3C24XX_INT_UART0 = 28,
|
---|
67 | S3C24XX_INT_IIC = 27,
|
---|
68 | S3C24XX_INT_USBH = 26,
|
---|
69 | S3C24XX_INT_USBD = 25,
|
---|
70 | S3C24XX_INT_NFCON = 24,
|
---|
71 | S3C24XX_INT_UART1 = 23,
|
---|
72 | S3C24XX_INT_SPI0 = 22,
|
---|
73 | S3C24XX_INT_SDI = 21,
|
---|
74 | S3C24XX_INT_DMA3 = 20,
|
---|
75 | S3C24XX_INT_DMA2 = 19,
|
---|
76 | S3C24XX_INT_DMA1 = 18,
|
---|
77 | S3C24XX_INT_DMA0 = 17,
|
---|
78 | S3C24XX_INT_LCD = 16,
|
---|
79 | S3C24XX_INT_UART2 = 15,
|
---|
80 | S3C24XX_INT_TIMER4 = 14,
|
---|
81 | S3C24XX_INT_TIMER3 = 13,
|
---|
82 | S3C24XX_INT_TIMER2 = 12,
|
---|
83 | S3C24XX_INT_TIMER1 = 11,
|
---|
84 | S3C24XX_INT_TIMER0 = 10,
|
---|
85 | S3C24XX_INT_WDT_AC97 = 9,
|
---|
86 | S3C24XX_INT_TICK = 8,
|
---|
87 | S3C24XX_nBATT_FLT = 7,
|
---|
88 | S3C24XX_INT_CAM = 6,
|
---|
89 | S3C24XX_EINT8_23 = 5,
|
---|
90 | S3C24XX_EINT4_7 = 4,
|
---|
91 | S3C24XX_EINT3 = 3,
|
---|
92 | S3C24XX_EINT2 = 2,
|
---|
93 | S3C24XX_EINT1 = 1,
|
---|
94 | S3C24XX_EINT0 = 0
|
---|
95 | };
|
---|
96 |
|
---|
97 | /** S3C24xx Interrupt sub-source numbers.
|
---|
98 | *
|
---|
99 | * These correspond to bit numbers in the intsubmsk register.
|
---|
100 | */
|
---|
101 | enum s3c24xx_int_subsource {
|
---|
102 | S3C24XX_SUBINT_AC97 = 14,
|
---|
103 | S3C24XX_SUBINT_WDT = 13,
|
---|
104 | S3C24XX_SUBINT_CAM_P = 12,
|
---|
105 | S3C24XX_SUBINT_CAM_C = 11,
|
---|
106 | S3C24XX_SUBINT_ADC_S = 10,
|
---|
107 | S3C24XX_SUBINT_TC = 9,
|
---|
108 | S3C24XX_SUBINT_ERR2 = 8,
|
---|
109 | S3C24XX_SUBINT_TXD2 = 7,
|
---|
110 | S3C24XX_SUBINT_RXD2 = 6,
|
---|
111 | S3C24XX_SUBINT_ERR1 = 5,
|
---|
112 | S3C24XX_SUBINT_TXD1 = 4,
|
---|
113 | S3C24XX_SUBINT_RXD1 = 3,
|
---|
114 | S3C24XX_SUBINT_ERR0 = 2,
|
---|
115 | S3C24XX_SUBINT_TXD0 = 1,
|
---|
116 | S3C24XX_SUBINT_RXD0 = 0
|
---|
117 | };
|
---|
118 |
|
---|
119 | #define S3C24XX_INT_BIT(source) (1 << (source))
|
---|
120 | #define S3C24XX_SUBINT_BIT(subsource) (1 << (subsource))
|
---|
121 |
|
---|
122 | typedef struct {
|
---|
123 | s3c24xx_irqc_regs_t *regs;
|
---|
124 | } s3c24xx_irqc_t;
|
---|
125 |
|
---|
126 | extern void s3c24xx_irqc_init(s3c24xx_irqc_t *, s3c24xx_irqc_regs_t *);
|
---|
127 | extern unsigned s3c24xx_irqc_inum_get(s3c24xx_irqc_t *);
|
---|
128 | extern void s3c24xx_irqc_clear(s3c24xx_irqc_t *, unsigned);
|
---|
129 | extern void s3c24xx_irqc_src_enable(s3c24xx_irqc_t *, unsigned);
|
---|
130 | extern void s3c24xx_irqc_src_disable(s3c24xx_irqc_t *, unsigned);
|
---|
131 | extern void s3c24xx_irqc_subsrc_enable(s3c24xx_irqc_t *, unsigned);
|
---|
132 | extern void s3c24xx_irqc_subsrc_disable(s3c24xx_irqc_t *, unsigned);
|
---|
133 |
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | /** @}
|
---|
137 | */
|
---|