cia.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) cia.c (b4290a23cfa9040e2f0de5ab57d6ea65abaf053b)
1/*
2 * linux/arch/m68k/amiga/cia.c - CIA support
3 *
4 * Copyright (C) 1996 Roman Zippel
5 *
6 * The concept of some functions bases on the original Amiga OS function
7 *
8 * This file is subject to the terms and conditions of the GNU General Public

--- 46 unchanged lines hidden (view full) ---

55 unsigned char old;
56
57 old = (base->icr_data |= base->cia->icr);
58 if (mask & CIA_ICR_SETCLR)
59 base->icr_data |= mask;
60 else
61 base->icr_data &= ~mask;
62 if (base->icr_data & base->icr_mask)
1/*
2 * linux/arch/m68k/amiga/cia.c - CIA support
3 *
4 * Copyright (C) 1996 Roman Zippel
5 *
6 * The concept of some functions bases on the original Amiga OS function
7 *
8 * This file is subject to the terms and conditions of the GNU General Public

--- 46 unchanged lines hidden (view full) ---

55 unsigned char old;
56
57 old = (base->icr_data |= base->cia->icr);
58 if (mask & CIA_ICR_SETCLR)
59 base->icr_data |= mask;
60 else
61 base->icr_data &= ~mask;
62 if (base->icr_data & base->icr_mask)
63 custom.intreq = IF_SETCLR | base->int_mask;
63 amiga_custom.intreq = IF_SETCLR | base->int_mask;
64 return old & base->icr_mask;
65}
66
67/*
68 * Enable or disable CIA interrupts, return old interrupt mask,
69 * interrupts will only be enabled if a handler exists
70 */
71

--- 12 unchanged lines hidden (view full) ---

84 base->icr_mask &= CIA_ICR_ALL;
85 for (i = 0, tmp = 1; i < CIA_IRQS; i++, tmp <<= 1) {
86 if ((tmp & base->icr_mask) && !base->irq_list[i].handler) {
87 base->icr_mask &= ~tmp;
88 base->cia->icr = tmp;
89 }
90 }
91 if (base->icr_data & base->icr_mask)
64 return old & base->icr_mask;
65}
66
67/*
68 * Enable or disable CIA interrupts, return old interrupt mask,
69 * interrupts will only be enabled if a handler exists
70 */
71

--- 12 unchanged lines hidden (view full) ---

84 base->icr_mask &= CIA_ICR_ALL;
85 for (i = 0, tmp = 1; i < CIA_IRQS; i++, tmp <<= 1) {
86 if ((tmp & base->icr_mask) && !base->irq_list[i].handler) {
87 base->icr_mask &= ~tmp;
88 base->cia->icr = tmp;
89 }
90 }
91 if (base->icr_data & base->icr_mask)
92 custom.intreq = IF_SETCLR | base->int_mask;
92 amiga_custom.intreq = IF_SETCLR | base->int_mask;
93 return old;
94}
95
96int cia_request_irq(struct ciabase *base, unsigned int irq,
97 irqreturn_t (*handler)(int, void *, struct pt_regs *),
98 unsigned long flags, const char *devname, void *dev_id)
99{
100 unsigned char mask;

--- 27 unchanged lines hidden (view full) ---

128{
129 struct ciabase *base = (struct ciabase *)dev_id;
130 int mach_irq, i;
131 unsigned char ints;
132
133 mach_irq = base->cia_irq;
134 irq = SYS_IRQS + mach_irq;
135 ints = cia_set_irq(base, CIA_ICR_ALL);
93 return old;
94}
95
96int cia_request_irq(struct ciabase *base, unsigned int irq,
97 irqreturn_t (*handler)(int, void *, struct pt_regs *),
98 unsigned long flags, const char *devname, void *dev_id)
99{
100 unsigned char mask;

--- 27 unchanged lines hidden (view full) ---

128{
129 struct ciabase *base = (struct ciabase *)dev_id;
130 int mach_irq, i;
131 unsigned char ints;
132
133 mach_irq = base->cia_irq;
134 irq = SYS_IRQS + mach_irq;
135 ints = cia_set_irq(base, CIA_ICR_ALL);
136 custom.intreq = base->int_mask;
136 amiga_custom.intreq = base->int_mask;
137 for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) {
138 if (ints & 1) {
139 kstat_cpu(0).irqs[irq]++;
140 base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp);
141 }
142 ints >>= 1;
143 }
144 amiga_do_irq_list(base->server_irq, fp);

--- 12 unchanged lines hidden (view full) ---

157
158 /* clear any pending interrupt and turn off all interrupts */
159 cia_set_irq(base, CIA_ICR_ALL);
160 cia_able_irq(base, CIA_ICR_ALL);
161
162 /* install CIA handler */
163 request_irq(base->handler_irq, cia_handler, 0, base->name, base);
164
137 for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) {
138 if (ints & 1) {
139 kstat_cpu(0).irqs[irq]++;
140 base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp);
141 }
142 ints >>= 1;
143 }
144 amiga_do_irq_list(base->server_irq, fp);

--- 12 unchanged lines hidden (view full) ---

157
158 /* clear any pending interrupt and turn off all interrupts */
159 cia_set_irq(base, CIA_ICR_ALL);
160 cia_able_irq(base, CIA_ICR_ALL);
161
162 /* install CIA handler */
163 request_irq(base->handler_irq, cia_handler, 0, base->name, base);
164
165 custom.intena = IF_SETCLR | base->int_mask;
165 amiga_custom.intena = IF_SETCLR | base->int_mask;
166}
167
168int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
169{
170 int i, j;
171
172 j = base->cia_irq;
173 for (i = 0; i < CIA_IRQS; i++) {
174 seq_printf(p, "cia %2d: %10d ", j + i,
175 kstat_cpu(0).irqs[SYS_IRQS + j + i]);
176 seq_puts(p, " ");
177 seq_printf(p, "%s\n", base->irq_list[i].devname);
178 }
179 return 0;
180}
166}
167
168int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
169{
170 int i, j;
171
172 j = base->cia_irq;
173 for (i = 0; i < CIA_IRQS; i++) {
174 seq_printf(p, "cia %2d: %10d ", j + i,
175 kstat_cpu(0).irqs[SYS_IRQS + j + i]);
176 seq_puts(p, " ");
177 seq_printf(p, "%s\n", base->irq_list[i].devname);
178 }
179 return 0;
180}