1#include <linux/types.h>
2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <linux/kernel_stat.h>
5
6#include <asm/system.h>
7#include <asm/irq.h>
8#include <asm/traps.h>
9#include <asm/page.h>
10#include <asm/machdep.h>
11#include <asm/apollohw.h>
12
13static irq_handler_t dn_irqs[16];
14
15void dn_process_int(int irq, struct pt_regs *fp) {
16
17
18  if(dn_irqs[irq-160].handler) {
19    dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
20  }
21  else {
22    printk("spurious irq %d occurred\n",irq);
23  }
24
25  *(volatile unsigned char *)(pica)=0x20;
26  *(volatile unsigned char *)(picb)=0x20;
27
28}
29
30void dn_init_IRQ(void) {
31
32  int i;
33
34  for(i=0;i<16;i++) {
35    dn_irqs[i].handler=NULL;
36    dn_irqs[i].flags=IRQ_FLG_STD;
37    dn_irqs[i].dev_id=NULL;
38    dn_irqs[i].devname=NULL;
39  }
40
41}
42
43int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
44
45  if((irq<0) || (irq>15)) {
46    printk("Trying to request illegal IRQ\n");
47    return -ENXIO;
48  }
49
50  if(!dn_irqs[irq].handler) {
51    dn_irqs[irq].handler=handler;
52    dn_irqs[irq].flags=IRQ_FLG_STD;
53    dn_irqs[irq].dev_id=dev_id;
54    dn_irqs[irq].devname=devname;
55    if(irq<8)
56      *(volatile unsigned char *)(pica+1)&=~(1<<irq);
57    else
58      *(volatile unsigned char *)(picb+1)&=~(1<<(irq-8));
59
60    return 0;
61  }
62  else {
63    printk("Trying to request already assigned irq %d\n",irq);
64    return -ENXIO;
65  }
66
67}
68
69void dn_free_irq(unsigned int irq, void *dev_id) {
70
71  if((irq<0) || (irq>15)) {
72    printk("Trying to free illegal IRQ\n");
73    return ;
74  }
75
76  if(irq<8)
77    *(volatile unsigned char *)(pica+1)|=(1<<irq);
78  else
79    *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
80
81  dn_irqs[irq].handler=NULL;
82  dn_irqs[irq].flags=IRQ_FLG_STD;
83  dn_irqs[irq].dev_id=NULL;
84  dn_irqs[irq].devname=NULL;
85
86  return ;
87
88}
89
90void dn_enable_irq(unsigned int irq) {
91
92  printk("dn enable irq\n");
93
94}
95
96void dn_disable_irq(unsigned int irq) {
97
98  printk("dn disable irq\n");
99
100}
101
102int dn_get_irq_list(char *buf) {
103
104  printk("dn get irq list\n");
105
106  return 0;
107
108}
109
110struct fb_info *dn_dummy_fb_init(long *mem_start) {
111
112  printk("fb init\n");
113
114  return NULL;
115
116}
117
118#ifdef CONFIG_VT
119extern void write_keyb_cmd(u_short length, u_char *cmd);
120static char BellOnCommand[] =  { 0xFF, 0x21, 0x81 },
121		    BellOffCommand[] = { 0xFF, 0x21, 0x82 };
122
123static void dn_nosound (unsigned long ignored) {
124
125	write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
126
127}
128
129void dn_mksound( unsigned int count, unsigned int ticks ) {
130
131	static struct timer_list sound_timer = { function: dn_nosound };
132
133	del_timer( &sound_timer );
134	if(count) {
135		write_keyb_cmd(sizeof(BellOnCommand),BellOnCommand);
136		if (ticks) {
137       		sound_timer.expires = jiffies + ticks;
138			add_timer( &sound_timer );
139		}
140	}
141	else
142		write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
143}
144#endif /* CONFIG_VT */
145
146
147void dn_dummy_video_setup(char *options,int *ints) {
148
149  printk("no video yet\n");
150
151}
152