* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / arch / m68k / apollo / config.c
blobe3b54b40e40c4405c39c9bb2e87a94bff6b89c14
1 #include <linux/config.h>
2 #include <linux/types.h>
3 #include <linux/kernel.h>
4 #include <linux/mm.h>
5 #include <linux/kd.h>
6 #include <linux/tty.h>
7 #include <linux/console.h>
9 #include <asm/setup.h>
10 #include <asm/system.h>
11 #include <asm/pgtable.h>
12 #include <asm/apollohw.h>
13 #include <asm/irq.h>
14 #include <asm/machdep.h>
16 extern void dn_sched_init(void (*handler)(int,void *,struct pt_regs *));
17 extern int dn_keyb_init(void);
18 extern int dn_dummy_kbdrate(struct kbd_repeat *);
19 extern void dn_init_IRQ(void);
20 #if 0
21 extern void (*dn_default_handler[])(int,void *,struct pt_regs *);
22 #endif
23 extern int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
24 extern void dn_free_irq(unsigned int irq, void *dev_id);
25 extern void dn_enable_irq(unsigned int);
26 extern void dn_disable_irq(unsigned int);
27 extern int dn_get_irq_list(char *);
28 extern unsigned long dn_gettimeoffset(void);
29 extern void dn_gettod(int *, int *, int *, int *, int *, int *);
30 extern int dn_dummy_hwclk(int, struct hwclk_time *);
31 extern int dn_dummy_set_clock_mmss(unsigned long);
32 extern void dn_mksound(unsigned int count, unsigned int ticks);
33 extern void dn_dummy_reset(void);
34 extern void dn_dummy_waitbut(void);
35 extern struct fb_info *dn_fb_init(long *);
36 extern void dn_dummy_debug_init(void);
37 extern void (*kd_mksound)(unsigned int, unsigned int);
38 extern void dn_dummy_video_setup(char *,int *);
39 extern void dn_process_int(int irq, struct pt_regs *fp);
41 static struct console dn_console_driver;
42 static void dn_debug_init(void);
43 static void dn_timer_int(int irq,void *, struct pt_regs *);
44 static void (*sched_timer_handler)(int, void *, struct pt_regs *)=NULL;
46 int dn_serial_console_wait_key(void) {
48 while(!(sio01.srb_csrb & 1))
49 barrier();
50 return sio01.rhrb_thrb;
53 void dn_serial_console_write (const char *str,unsigned int count)
55 while(count--) {
56 if (*str == '\n') {
57 sio01.rhrb_thrb = (unsigned char)'\r';
58 while (!(sio01.srb_csrb & 0x4))
61 sio01.rhrb_thrb = (unsigned char)*str++;
62 while (!(sio01.srb_csrb & 0x4))
67 void dn_serial_print (const char *str)
69 while (*str) {
70 if (*str == '\n') {
71 sio01.rhrb_thrb = (unsigned char)'\r';
72 while (!(sio01.srb_csrb & 0x4))
75 sio01.rhrb_thrb = (unsigned char)*str++;
76 while (!(sio01.srb_csrb & 0x4))
81 void config_apollo(void) {
83 dn_serial_print("Config apollo !\n");
84 #if 0
85 dn_debug_init();
86 #endif
87 printk("Config apollo !\n");
90 mach_sched_init=dn_sched_init; /* */
91 mach_keyb_init=dn_keyb_init;
92 mach_kbdrate=dn_dummy_kbdrate;
93 mach_init_IRQ=dn_init_IRQ;
94 mach_default_handler=NULL;
95 mach_request_irq = dn_request_irq;
96 mach_free_irq = dn_free_irq;
97 enable_irq = dn_enable_irq;
98 disable_irq = dn_disable_irq;
99 mach_get_irq_list = dn_get_irq_list;
100 mach_gettimeoffset = dn_gettimeoffset;
101 mach_gettod = dn_gettod; /* */
102 mach_max_dma_address = 0xffffffff;
103 mach_hwclk = dn_dummy_hwclk; /* */
104 mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
105 mach_process_int = dn_process_int;
106 #ifdef CONFIG_BLK_DEV_FD
107 mach_floppy_init = dn_dummy_floppy_init;
108 mach_floppy_setup = dn_dummy_floppy_setup;
109 #endif
110 mach_reset = dn_dummy_reset; /* */
111 #ifdef CONFIG_DUMMY_CONSOLE
112 conswitchp = &dummy_con;
113 #endif
114 #if 0
115 mach_fb_init = dn_fb_init;
116 mach_video_setup = dn_dummy_video_setup;
117 #endif
118 kd_mksound = dn_mksound;
122 void dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) {
124 volatile unsigned char x;
126 sched_timer_handler(irq,dev_id,fp);
128 x=*(volatile unsigned char *)(IO_BASE+0x10803);
129 x=*(volatile unsigned char *)(IO_BASE+0x10805);
133 void dn_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) {
135 dn_serial_print("dn sched_init\n");
137 #if 0
138 /* program timer 2 */
139 *(volatile unsigned char *)(IO_BASE+0x10803)=0x00;
140 *(volatile unsigned char *)(IO_BASE+0x10809)=0;
141 *(volatile unsigned char *)(IO_BASE+0x1080b)=50;
143 /* program timer 3 */
144 *(volatile unsigned char *)(IO_BASE+0x10801)=0x00;
145 *(volatile unsigned char *)(IO_BASE+0x1080c)=0;
146 *(volatile unsigned char *)(IO_BASE+0x1080f)=50;
147 #endif
148 /* program timer 1 */
149 *(volatile unsigned char *)(IO_BASE+0x10803)=0x01;
150 *(volatile unsigned char *)(IO_BASE+0x10801)=0x40;
151 *(volatile unsigned char *)(IO_BASE+0x10805)=0x09;
152 *(volatile unsigned char *)(IO_BASE+0x10807)=0xc4;
154 /* enable IRQ of PIC B */
155 *(volatile unsigned char *)(IO_BASE+PICA+1)&=(~8);
159 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(IO_BASE+0x10803));
160 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(IO_BASE+0x10803));
162 sched_timer_handler=timer_routine;
163 request_irq(0,dn_timer_int,0,NULL,NULL);
168 unsigned long dn_gettimeoffset(void) {
170 return 0xdeadbeef;
174 void dn_gettod(int *yearp, int *monp, int *dayp,
175 int *hourp, int *minp, int *secp) {
177 *yearp=rtc->year;
178 *monp=rtc->month;
179 *dayp=rtc->day_of_month;
180 *hourp=rtc->hours;
181 *minp=rtc->minute;
182 *secp=rtc->second;
184 printk("gettod: %d %d %d %d %d %d\n",*yearp,*monp,*dayp,*hourp,*minp,*secp);
188 int dn_dummy_hwclk(int op, struct hwclk_time *t) {
190 dn_serial_print("hwclk !\n");
192 if(!op) { /* read */
193 t->sec=rtc->second;
194 t->min=rtc->minute;
195 t->hour=rtc->hours;
196 t->day=rtc->day_of_month;
197 t->wday=rtc->day_of_week;
198 t->mon=rtc->month;
199 t->year=rtc->year;
200 } else {
201 rtc->second=t->sec;
202 rtc->minute=t->min;
203 rtc->hours=t->hour;
204 rtc->day_of_month=t->day;
205 if(t->wday!=-1)
206 rtc->day_of_week=t->wday;
207 rtc->month=t->mon;
208 rtc->year=t->year;
211 dn_serial_print("hwclk end!\n");
212 return 0;
216 int dn_dummy_set_clock_mmss(unsigned long nowtime) {
218 printk("set_clock_mmss\n");
220 return 0;
224 void dn_dummy_reset(void) {
226 dn_serial_print("The end !\n");
228 for(;;);
232 void dn_dummy_waitbut(void) {
234 dn_serial_print("waitbut\n");
238 #if 0
239 void dn_debug_init(void) {
241 dn_console_driver.write=dn_serial_console_write;
242 register_console(&dn_console_driver);
245 #endif