Linux Audio

Check our new training course

Loading...
v3.1
  1 /*
  2 * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code
  3 *
  4 * This file is subject to the terms and conditions of the GNU General Public
  5 * License.  See the file COPYING in the main directory of this archive
  6 * for more details.
  7 */
  8
  9#include <linux/types.h>
 10#include <linux/kernel.h>
 11#include <linux/sched.h>
 12#include <linux/kernel_stat.h>
 13#include <linux/interrupt.h>
 14#include <asm/segment.h>
 15#include <asm/intersil.h>
 16#include <asm/oplib.h>
 17#include <asm/sun3ints.h>
 18#include <asm/irq_regs.h>
 19#include <linux/seq_file.h>
 20
 21extern void sun3_leds (unsigned char);
 22
 23void sun3_disable_interrupts(void)
 24{
 25	sun3_disable_irq(0);
 26}
 27
 28void sun3_enable_interrupts(void)
 29{
 30	sun3_enable_irq(0);
 31}
 32
 33static int led_pattern[8] = {
 34       ~(0x80), ~(0x01),
 35       ~(0x40), ~(0x02),
 36       ~(0x20), ~(0x04),
 37       ~(0x10), ~(0x08)
 38};
 39
 40volatile unsigned char* sun3_intreg;
 41
 42void sun3_enable_irq(unsigned int irq)
 43{
 44	*sun3_intreg |=  (1 << irq);
 45}
 46
 47void sun3_disable_irq(unsigned int irq)
 48{
 49	*sun3_intreg &= ~(1 << irq);
 50}
 51
 52static irqreturn_t sun3_int7(int irq, void *dev_id)
 53{
 54	*sun3_intreg |=  (1 << irq);
 55	if (!(kstat_cpu(0).irqs[irq] % 2000))
 56		sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]);
 
 
 57	return IRQ_HANDLED;
 58}
 59
 60static irqreturn_t sun3_int5(int irq, void *dev_id)
 61{
 
 
 
 
 62#ifdef CONFIG_SUN3
 63	intersil_clear();
 64#endif
 65        *sun3_intreg |=  (1 << irq);
 
 66#ifdef CONFIG_SUN3
 67	intersil_clear();
 68#endif
 69	xtime_update(1);
 70	update_process_times(user_mode(get_irq_regs()));
 71        if (!(kstat_cpu(0).irqs[irq] % 20))
 72                sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
 
 73	return IRQ_HANDLED;
 74}
 75
 76static irqreturn_t sun3_vec255(int irq, void *dev_id)
 77{
 78//	intersil_clear();
 79	return IRQ_HANDLED;
 80}
 81
 82static void sun3_inthandle(unsigned int irq, struct pt_regs *fp)
 83{
 84        *sun3_intreg &= ~(1 << irq);
 85
 86	__m68k_handle_int(irq, fp);
 87}
 88
 89static struct irq_controller sun3_irq_controller = {
 90	.name		= "sun3",
 91	.lock		= __SPIN_LOCK_UNLOCKED(sun3_irq_controller.lock),
 92	.startup	= m68k_irq_startup,
 93	.shutdown	= m68k_irq_shutdown,
 94	.enable		= sun3_enable_irq,
 95	.disable	= sun3_disable_irq,
 96};
 97
 98void __init sun3_init_IRQ(void)
 99{
100	*sun3_intreg = 1;
101
102	m68k_setup_auto_interrupt(sun3_inthandle);
103	m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7);
104	m68k_setup_user_interrupt(VEC_USER, 128, NULL);
105
106	if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL))
107		pr_err("Couldn't register %s interrupt\n", "int5");
108	if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL))
109		pr_err("Couldn't register %s interrupt\n", "int7");
110	if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
111		pr_err("Couldn't register %s interrupt\n", "vec255");
112}
v5.14.15
  1 /*
  2 * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code
  3 *
  4 * This file is subject to the terms and conditions of the GNU General Public
  5 * License.  See the file COPYING in the main directory of this archive
  6 * for more details.
  7 */
  8
  9#include <linux/types.h>
 10#include <linux/kernel.h>
 11#include <linux/sched.h>
 12#include <linux/kernel_stat.h>
 13#include <linux/interrupt.h>
 14#include <asm/segment.h>
 15#include <asm/intersil.h>
 16#include <asm/oplib.h>
 17#include <asm/sun3ints.h>
 18#include <asm/irq_regs.h>
 19#include <linux/seq_file.h>
 20
 21extern void sun3_leds (unsigned char);
 22
 23void sun3_disable_interrupts(void)
 24{
 25	sun3_disable_irq(0);
 26}
 27
 28void sun3_enable_interrupts(void)
 29{
 30	sun3_enable_irq(0);
 31}
 32
 33static int led_pattern[8] = {
 34       ~(0x80), ~(0x01),
 35       ~(0x40), ~(0x02),
 36       ~(0x20), ~(0x04),
 37       ~(0x10), ~(0x08)
 38};
 39
 40volatile unsigned char* sun3_intreg;
 41
 42void sun3_enable_irq(unsigned int irq)
 43{
 44	*sun3_intreg |=  (1 << irq);
 45}
 46
 47void sun3_disable_irq(unsigned int irq)
 48{
 49	*sun3_intreg &= ~(1 << irq);
 50}
 51
 52static irqreturn_t sun3_int7(int irq, void *dev_id)
 53{
 54	unsigned int cnt;
 55
 56	cnt = kstat_irqs_cpu(irq, 0);
 57	if (!(cnt % 2000))
 58		sun3_leds(led_pattern[cnt % 16000 / 2000]);
 59	return IRQ_HANDLED;
 60}
 61
 62static irqreturn_t sun3_int5(int irq, void *dev_id)
 63{
 64	unsigned long flags;
 65	unsigned int cnt;
 66
 67	local_irq_save(flags);
 68#ifdef CONFIG_SUN3
 69	intersil_clear();
 70#endif
 71	sun3_disable_irq(5);
 72	sun3_enable_irq(5);
 73#ifdef CONFIG_SUN3
 74	intersil_clear();
 75#endif
 76	legacy_timer_tick(1);
 77	cnt = kstat_irqs_cpu(irq, 0);
 78	if (!(cnt % 20))
 79		sun3_leds(led_pattern[cnt % 160 / 20]);
 80	local_irq_restore(flags);
 81	return IRQ_HANDLED;
 82}
 83
 84static irqreturn_t sun3_vec255(int irq, void *dev_id)
 85{
 
 86	return IRQ_HANDLED;
 87}
 88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 89void __init sun3_init_IRQ(void)
 90{
 91	*sun3_intreg = 1;
 92
 93	m68k_setup_user_interrupt(VEC_USER, 128);
 
 
 94
 95	if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL))
 96		pr_err("Couldn't register %s interrupt\n", "int5");
 97	if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL))
 98		pr_err("Couldn't register %s interrupt\n", "int7");
 99	if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
100		pr_err("Couldn't register %s interrupt\n", "vec255");
101}