~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/parport/init.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* Parallel-port initialisation code.
  2  * 
  3  * Authors: David Campbell <campbell@torque.net>
  4  *          Tim Waugh <tim@cyberelk.demon.co.uk>
  5  *          Jose Renau <renau@acm.org>
  6  *
  7  * based on work by Grant Guenther <grant@torque.net>
  8  *              and Philip Blundell <Philip.Blundell@pobox.com>
  9  */
 10 
 11 #include <linux/config.h>
 12 #include <linux/module.h>
 13 #include <linux/threads.h>
 14 #include <linux/string.h>
 15 #include <linux/parport.h>
 16 #include <linux/errno.h>
 17 #include <linux/kernel.h>
 18 #include <linux/malloc.h>
 19 #include <linux/init.h>
 20 
 21 #ifndef MODULE
 22 static int io[PARPORT_MAX+1] __initdata = { [0 ... PARPORT_MAX] = 0 };
 23 #ifdef CONFIG_PARPORT_PC
 24 static int io_hi[PARPORT_MAX+1] __initdata = { [0 ... PARPORT_MAX] = 0 };
 25 #endif
 26 static int irq[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_IRQ_PROBEONLY };
 27 static int dma[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_DMA_NONE };
 28 
 29 extern int parport_pc_init(int *io, int *io_hi, int *irq, int *dma);
 30 extern int parport_sunbpp_init(void);
 31 extern int parport_amiga_init(void);
 32 extern int parport_mfc3_init(void);
 33 
 34 static int parport_setup_ptr __initdata = 0;
 35 
 36 /*
 37  * Acceptable parameters:
 38  *
 39  * parport=0
 40  * parport=auto
 41  * parport=0xBASE[,IRQ[,DMA]]
 42  *
 43  * IRQ/DMA may be numeric or 'auto' or 'none'
 44  */
 45 static int __init parport_setup (char *str)
 46 {
 47         char *endptr;
 48         char *sep;
 49         int val;
 50 
 51         if (!str || !*str || (*str == '' && !*(str+1))) {
 52                 /* Disable parport if "parport=0" in cmdline */
 53                 io[0] = PARPORT_DISABLE;
 54                 return 1;
 55         }
 56 
 57         if (!strncmp (str, "auto", 4)) {
 58                 irq[0] = PARPORT_IRQ_AUTO;
 59                 dma[0] = PARPORT_DMA_AUTO;
 60                 return 1;
 61         }
 62 
 63         val = simple_strtoul (str, &endptr, 0);
 64         if (endptr == str) {
 65                 printk (KERN_WARNING "parport=%s not understood\n", str);
 66                 return 1;
 67         }
 68 
 69         if (parport_setup_ptr == PARPORT_MAX) {
 70                 printk(KERN_ERR "parport=%s ignored, too many ports\n", str);
 71                 return 1;
 72         }
 73         
 74         io[parport_setup_ptr] = val;
 75         irq[parport_setup_ptr] = PARPORT_IRQ_NONE;
 76         dma[parport_setup_ptr] = PARPORT_DMA_NONE;
 77 
 78         sep = strchr (str, ',');
 79         if (sep++) {
 80                 if (!strncmp (sep, "auto", 4))
 81                         irq[parport_setup_ptr] = PARPORT_IRQ_AUTO;
 82                 else if (strncmp (sep, "none", 4)) {
 83                         val = simple_strtoul (sep, &endptr, 0);
 84                         if (endptr == sep) {
 85                                 printk (KERN_WARNING
 86                                         "parport=%s: irq not understood\n",
 87                                         str);
 88                                 return 1;
 89                         }
 90                         irq[parport_setup_ptr] = val;
 91                 }
 92         }
 93 
 94         sep = strchr (sep, ',');
 95         if (sep++) {
 96                 if (!strncmp (sep, "auto", 4))
 97                         dma[parport_setup_ptr] = PARPORT_DMA_AUTO;
 98                 else if (!strncmp (sep, "nofifo", 6))
 99                         dma[parport_setup_ptr] = PARPORT_DMA_NOFIFO;
100                 else if (strncmp (sep, "none", 4)) {
101                         val = simple_strtoul (sep, &endptr, 0);
102                         if (endptr == sep) {
103                                 printk (KERN_WARNING
104                                         "parport=%s: dma not understood\n",
105                                         str);
106                                 return 1;
107                         }
108                         dma[parport_setup_ptr] = val;
109                 }
110         }
111 
112         parport_setup_ptr++;
113         return 1;
114 }
115 
116 __setup ("parport=", parport_setup);
117 
118 #endif
119 
120 #ifdef MODULE
121 int init_module(void)
122 {
123 #ifdef CONFIG_SYSCTL
124         parport_default_proc_register ();
125 #endif
126         return 0;
127 }
128 
129 void cleanup_module(void)
130 {
131 #ifdef CONFIG_SYSCTL
132         parport_default_proc_unregister ();
133 #endif
134 }
135 
136 #else
137 
138 int __init parport_init (void)
139 {
140         if (io[0] == PARPORT_DISABLE) 
141                 return 1;
142 
143 #ifdef CONFIG_SYSCTL
144         parport_default_proc_register ();
145 #endif
146 
147 #ifdef CONFIG_PARPORT_PC
148         parport_pc_init(io, io_hi, irq, dma);
149 #endif
150 #ifdef CONFIG_PARPORT_AMIGA
151         parport_amiga_init();
152 #endif
153 #ifdef CONFIG_PARPORT_MFC3
154         parport_mfc3_init();
155 #endif
156 #ifdef CONFIG_PARPORT_ATARI
157         parport_atari_init();
158 #endif
159 #ifdef CONFIG_PARPORT_ARC
160         parport_arc_init();
161 #endif
162 #ifdef CONFIG_PARPORT_SUNBPP
163         parport_sunbpp_init();
164 #endif
165         return 0;
166 }
167 
168 #endif
169 
170 /* Exported symbols for modules. */
171 
172 EXPORT_SYMBOL(parport_claim);
173 EXPORT_SYMBOL(parport_claim_or_block);
174 EXPORT_SYMBOL(parport_release);
175 EXPORT_SYMBOL(parport_register_port);
176 EXPORT_SYMBOL(parport_announce_port);
177 EXPORT_SYMBOL(parport_unregister_port);
178 EXPORT_SYMBOL(parport_register_driver);
179 EXPORT_SYMBOL(parport_unregister_driver);
180 EXPORT_SYMBOL(parport_register_device);
181 EXPORT_SYMBOL(parport_unregister_device);
182 EXPORT_SYMBOL(parport_enumerate);
183 EXPORT_SYMBOL(parport_get_port);
184 EXPORT_SYMBOL(parport_put_port);
185 EXPORT_SYMBOL(parport_find_number);
186 EXPORT_SYMBOL(parport_find_base);
187 EXPORT_SYMBOL(parport_negotiate);
188 EXPORT_SYMBOL(parport_write);
189 EXPORT_SYMBOL(parport_read);
190 EXPORT_SYMBOL(parport_ieee1284_wakeup);
191 EXPORT_SYMBOL(parport_wait_peripheral);
192 EXPORT_SYMBOL(parport_poll_peripheral);
193 EXPORT_SYMBOL(parport_wait_event);
194 EXPORT_SYMBOL(parport_set_timeout);
195 EXPORT_SYMBOL(parport_ieee1284_interrupt);
196 EXPORT_SYMBOL(parport_ieee1284_ecp_write_data);
197 EXPORT_SYMBOL(parport_ieee1284_ecp_read_data);
198 EXPORT_SYMBOL(parport_ieee1284_ecp_write_addr);
199 EXPORT_SYMBOL(parport_ieee1284_write_compat);
200 EXPORT_SYMBOL(parport_ieee1284_read_nibble);
201 EXPORT_SYMBOL(parport_ieee1284_read_byte);
202 EXPORT_SYMBOL(parport_ieee1284_epp_write_data);
203 EXPORT_SYMBOL(parport_ieee1284_epp_read_data);
204 EXPORT_SYMBOL(parport_ieee1284_epp_write_addr);
205 EXPORT_SYMBOL(parport_ieee1284_epp_read_addr);
206 EXPORT_SYMBOL(parport_proc_register);
207 EXPORT_SYMBOL(parport_proc_unregister);
208 EXPORT_SYMBOL(parport_device_proc_register);
209 EXPORT_SYMBOL(parport_device_proc_unregister);
210 EXPORT_SYMBOL(parport_default_proc_register);
211 EXPORT_SYMBOL(parport_default_proc_unregister);
212 EXPORT_SYMBOL(parport_parse_irqs);
213 EXPORT_SYMBOL(parport_parse_dmas);
214 #ifdef CONFIG_PARPORT_1284
215 EXPORT_SYMBOL(parport_open);
216 EXPORT_SYMBOL(parport_close);
217 EXPORT_SYMBOL(parport_device_id);
218 EXPORT_SYMBOL(parport_device_num);
219 EXPORT_SYMBOL(parport_device_coords);
220 EXPORT_SYMBOL(parport_daisy_deselect_all);
221 EXPORT_SYMBOL(parport_daisy_select);
222 EXPORT_SYMBOL(parport_daisy_init);
223 EXPORT_SYMBOL(parport_find_device);
224 EXPORT_SYMBOL(parport_find_class);
225 #endif
226 
227 void inc_parport_count(void)
228 {
229 #ifdef MODULE
230         MOD_INC_USE_COUNT;
231 #endif
232 }
233 
234 void dec_parport_count(void)
235 {
236 #ifdef MODULE
237         MOD_DEC_USE_COUNT;
238 #endif
239 }
240 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.