This source file includes following definitions.
- lp_int_out
- lp_int_busy
- lp_int_pout
- lp_int_online
- lp_int_interrupt
- lp_internal_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <linux/config.h>
18 #include <linux/lp_intern.h>
19 #include <linux/kernel.h>
20 #ifdef CONFIG_AMIGA
21 #include <asm/amigahw.h>
22 #endif
23 #ifdef CONFIG_ATARI
24 #include <linux/delay.h>
25 #include <linux/sched.h>
26 #include <linux/interrupt.h>
27 #include <asm/atarihw.h>
28 #endif
29
30
31 static void lp_int_out(int, int);
32 static int lp_int_busy(int);
33 static int lp_int_pout(int);
34 static int lp_int_online(int);
35 static int lp_int_interrupt(int);
36
37 int lp_internal_init(struct lp_struct *, int, int, int);
38
39
40 static void
41 lp_int_out (int c, int dev)
42 {
43 switch (boot_info.machtype)
44 {
45 #ifdef CONFIG_AMIGA
46 case MACH_AMIGA:
47 {
48 int wait = 0;
49 while (wait != lp_table[dev].wait) wait++;
50 ciaa.prb = c;
51 }
52 break;
53 #endif
54 #ifdef CONFIG_ATARI
55 case MACH_ATARI:
56 {
57 int wait = 0;
58 sound_ym.rd_data_reg_sel = 15;
59 sound_ym.wd_data = c;
60 sound_ym.rd_data_reg_sel = 14;
61 while (wait != lp_table[dev].wait) wait++;
62 sound_ym.wd_data = sound_ym.rd_data_reg_sel & ~(1 << 5);
63 while (wait) wait--;
64 sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5);
65 break;
66 }
67 #endif
68 }
69 }
70
71 static int
72 lp_int_busy (int dev)
73 {
74 switch (boot_info.machtype)
75 {
76 #ifdef CONFIG_AMIGA
77 case MACH_AMIGA:
78 return ciab.pra & 1;
79 #endif
80 #ifdef CONFIG_ATARI
81 case MACH_ATARI:
82 return mfp.par_dt_reg & 1;
83 #endif
84 default:
85 return 0;
86 }
87 }
88
89 static int
90 lp_int_pout (int dev)
91 {
92 switch (boot_info.machtype)
93 {
94 #ifdef CONFIG_AMIGA
95 case MACH_AMIGA:
96 return ciab.pra & 2;
97 #endif
98 #ifdef CONFIG_ATARI
99 case MACH_ATARI:
100 #endif
101 default:
102 return 0;
103 }
104 }
105
106 static int
107 lp_int_online (int dev)
108 {
109 switch (boot_info.machtype)
110 {
111 #ifdef CONFIG_AMIGA
112 case MACH_AMIGA:
113 return ciab.pra & 4;
114 #endif
115 #ifdef CONFIG_ATARI
116 case MACH_ATARI:
117 return !(mfp.par_dt_reg & 1);
118 #endif
119 default:
120 return 0;
121 }
122 }
123
124 static int lp_int_interrupt(int dev)
125 {
126 return 1;
127 }
128
129 int lp_internal_init(struct lp_struct *lp_table, int entry,
130 int max_lp, int irq)
131 {
132 if (max_lp-entry < 1)
133 return 0;
134 #ifdef CONFIG_AMIGA
135 if (MACH_IS_AMIGA)
136 {
137 ciaa.ddrb = 0xff;
138 ciab.ddra &= 0xf8;
139 }
140 #endif
141 #ifdef CONFIG_ATARI
142 if (MACH_IS_ATARI)
143 {
144 unsigned long flags;
145
146 save_flags(flags);
147 cli();
148 sound_ym.rd_data_reg_sel = 7;
149 sound_ym.wd_data = (sound_ym.rd_data_reg_sel & 0x3f) | 0xc0;
150 restore_flags(flags);
151 }
152 #endif
153 lp_table[entry].name = "Builtin LP";
154 lp_table[entry].lp_out = lp_int_out;
155 lp_table[entry].lp_is_busy = lp_int_busy;
156 lp_table[entry].lp_has_pout = lp_int_pout;
157 lp_table[entry].lp_is_online = lp_int_online;
158 lp_table[entry].lp_my_interrupt = lp_int_interrupt;
159 lp_table[entry].flags = LP_EXIST;
160 lp_table[entry].chars = LP_INIT_CHAR;
161 lp_table[entry].time = LP_INIT_TIME;
162 lp_table[entry].wait = LP_INIT_WAIT;
163 lp_table[entry].lp_wait_q = NULL;
164
165 printk("lp%d: internal port\n", entry);
166
167 return 1;
168 }
169