aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-05-17 10:21:45 -0400
committerJonathan Corbet <corbet@lwn.net>2017-07-14 15:57:57 -0400
commitbe9d0411f1608ad62c2334d3a289a68e4259e48c (patch)
tree7cacbb213713d7081b16580a6fcb2b0cc1349a0c
parent7576b2b98dc9aa8a3ce8921df4a5fbb354269ed8 (diff)
parport-lowlevel.txt: standardize document format
Each text file under Documentation follows a different format. This one uses a man-page like approach. Change its representation to be closer to the adopted standard, using ReST markups for it to be parseable by Sphinx: - Mark titles; - Mark literals and literal blocks; - Adjust identation. Still, the best would be to move its contents to kernel-docs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r--Documentation/parport-lowlevel.txt1321
1 files changed, 841 insertions, 480 deletions
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt
index 120eb20dbb09..0633d70ffda7 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -1,11 +1,12 @@
1===============================
1PARPORT interface documentation 2PARPORT interface documentation
2------------------------------- 3===============================
3 4
4Time-stamp: <2000-02-24 13:30:20 twaugh> 5:Time-stamp: <2000-02-24 13:30:20 twaugh>
5 6
6Described here are the following functions: 7Described here are the following functions:
7 8
8Global functions: 9Global functions::
9 parport_register_driver 10 parport_register_driver
10 parport_unregister_driver 11 parport_unregister_driver
11 parport_enumerate 12 parport_enumerate
@@ -31,7 +32,8 @@ Global functions:
31 parport_set_timeout 32 parport_set_timeout
32 33
33Port functions (can be overridden by low-level drivers): 34Port functions (can be overridden by low-level drivers):
34 SPP: 35
36 SPP::
35 port->ops->read_data 37 port->ops->read_data
36 port->ops->write_data 38 port->ops->write_data
37 port->ops->read_status 39 port->ops->read_status
@@ -43,23 +45,23 @@ Port functions (can be overridden by low-level drivers):
43 port->ops->data_forward 45 port->ops->data_forward
44 port->ops->data_reverse 46 port->ops->data_reverse
45 47
46 EPP: 48 EPP::
47 port->ops->epp_write_data 49 port->ops->epp_write_data
48 port->ops->epp_read_data 50 port->ops->epp_read_data
49 port->ops->epp_write_addr 51 port->ops->epp_write_addr
50 port->ops->epp_read_addr 52 port->ops->epp_read_addr
51 53
52 ECP: 54 ECP::
53 port->ops->ecp_write_data 55 port->ops->ecp_write_data
54 port->ops->ecp_read_data 56 port->ops->ecp_read_data
55 port->ops->ecp_write_addr 57 port->ops->ecp_write_addr
56 58
57 Other: 59 Other::
58 port->ops->nibble_read_data 60 port->ops->nibble_read_data
59 port->ops->byte_read_data 61 port->ops->byte_read_data
60 port->ops->compat_write_data 62 port->ops->compat_write_data
61 63
62The parport subsystem comprises 'parport' (the core port-sharing 64The parport subsystem comprises ``parport`` (the core port-sharing
63code), and a variety of low-level drivers that actually do the port 65code), and a variety of low-level drivers that actually do the port
64accesses. Each low-level driver handles a particular style of port 66accesses. Each low-level driver handles a particular style of port
65(PC, Amiga, and so on). 67(PC, Amiga, and so on).
@@ -70,14 +72,14 @@ into global functions and port functions.
70The global functions are mostly for communicating between the device 72The global functions are mostly for communicating between the device
71driver and the parport subsystem: acquiring a list of available ports, 73driver and the parport subsystem: acquiring a list of available ports,
72claiming a port for exclusive use, and so on. They also include 74claiming a port for exclusive use, and so on. They also include
73'generic' functions for doing standard things that will work on any 75``generic`` functions for doing standard things that will work on any
74IEEE 1284-capable architecture. 76IEEE 1284-capable architecture.
75 77
76The port functions are provided by the low-level drivers, although the 78The port functions are provided by the low-level drivers, although the
77core parport module provides generic 'defaults' for some routines. 79core parport module provides generic ``defaults`` for some routines.
78The port functions can be split into three groups: SPP, EPP, and ECP. 80The port functions can be split into three groups: SPP, EPP, and ECP.
79 81
80SPP (Standard Parallel Port) functions modify so-called 'SPP' 82SPP (Standard Parallel Port) functions modify so-called ``SPP``
81registers: data, status, and control. The hardware may not actually 83registers: data, status, and control. The hardware may not actually
82have registers exactly like that, but the PC does and this interface is 84have registers exactly like that, but the PC does and this interface is
83modelled after common PC implementations. Other low-level drivers may 85modelled after common PC implementations. Other low-level drivers may
@@ -95,58 +97,63 @@ to cope with peripherals that only tenuously support IEEE 1284, a
95low-level driver specific function is provided, for altering 'fudge 97low-level driver specific function is provided, for altering 'fudge
96factors'. 98factors'.
97 99
98GLOBAL FUNCTIONS 100Global functions
99---------------- 101================
100 102
101parport_register_driver - register a device driver with parport 103parport_register_driver - register a device driver with parport
102----------------------- 104---------------------------------------------------------------
103 105
104SYNOPSIS 106SYNOPSIS
107^^^^^^^^
108
109::
105 110
106#include <linux/parport.h> 111 #include <linux/parport.h>
107 112
108struct parport_driver { 113 struct parport_driver {
109 const char *name; 114 const char *name;
110 void (*attach) (struct parport *); 115 void (*attach) (struct parport *);
111 void (*detach) (struct parport *); 116 void (*detach) (struct parport *);
112 struct parport_driver *next; 117 struct parport_driver *next;
113}; 118 };
114int parport_register_driver (struct parport_driver *driver); 119 int parport_register_driver (struct parport_driver *driver);
115 120
116DESCRIPTION 121DESCRIPTION
122^^^^^^^^^^^
117 123
118In order to be notified about parallel ports when they are detected, 124In order to be notified about parallel ports when they are detected,
119parport_register_driver should be called. Your driver will 125parport_register_driver should be called. Your driver will
120immediately be notified of all ports that have already been detected, 126immediately be notified of all ports that have already been detected,
121and of each new port as low-level drivers are loaded. 127and of each new port as low-level drivers are loaded.
122 128
123A 'struct parport_driver' contains the textual name of your driver, 129A ``struct parport_driver`` contains the textual name of your driver,
124a pointer to a function to handle new ports, and a pointer to a 130a pointer to a function to handle new ports, and a pointer to a
125function to handle ports going away due to a low-level driver 131function to handle ports going away due to a low-level driver
126unloading. Ports will only be detached if they are not being used 132unloading. Ports will only be detached if they are not being used
127(i.e. there are no devices registered on them). 133(i.e. there are no devices registered on them).
128 134
129The visible parts of the 'struct parport *' argument given to 135The visible parts of the ``struct parport *`` argument given to
130attach/detach are: 136attach/detach are::
131 137
132struct parport 138 struct parport
133{ 139 {
134 struct parport *next; /* next parport in list */ 140 struct parport *next; /* next parport in list */
135 const char *name; /* port's name */ 141 const char *name; /* port's name */
136 unsigned int modes; /* bitfield of hardware modes */ 142 unsigned int modes; /* bitfield of hardware modes */
137 struct parport_device_info probe_info; 143 struct parport_device_info probe_info;
138 /* IEEE1284 info */ 144 /* IEEE1284 info */
139 int number; /* parport index */ 145 int number; /* parport index */
140 struct parport_operations *ops; 146 struct parport_operations *ops;
141 ... 147 ...
142}; 148 };
143 149
144There are other members of the structure, but they should not be 150There are other members of the structure, but they should not be
145touched. 151touched.
146 152
147The 'modes' member summarises the capabilities of the underlying 153The ``modes`` member summarises the capabilities of the underlying
148hardware. It consists of flags which may be bitwise-ored together: 154hardware. It consists of flags which may be bitwise-ored together:
149 155
156 ============================= ===============================================
150 PARPORT_MODE_PCSPP IBM PC registers are available, 157 PARPORT_MODE_PCSPP IBM PC registers are available,
151 i.e. functions that act on data, 158 i.e. functions that act on data,
152 control and status registers are 159 control and status registers are
@@ -169,297 +176,351 @@ hardware. It consists of flags which may be bitwise-ored together:
169 GFP_DMA flag with kmalloc) to the 176 GFP_DMA flag with kmalloc) to the
170 low-level driver in order to take 177 low-level driver in order to take
171 advantage of it. 178 advantage of it.
179 ============================= ===============================================
172 180
173There may be other flags in 'modes' as well. 181There may be other flags in ``modes`` as well.
174 182
175The contents of 'modes' is advisory only. For example, if the 183The contents of ``modes`` is advisory only. For example, if the
176hardware is capable of DMA, and PARPORT_MODE_DMA is in 'modes', it 184hardware is capable of DMA, and PARPORT_MODE_DMA is in ``modes``, it
177doesn't necessarily mean that DMA will always be used when possible. 185doesn't necessarily mean that DMA will always be used when possible.
178Similarly, hardware that is capable of assisting ECP transfers won't 186Similarly, hardware that is capable of assisting ECP transfers won't
179necessarily be used. 187necessarily be used.
180 188
181RETURN VALUE 189RETURN VALUE
190^^^^^^^^^^^^
182 191
183Zero on success, otherwise an error code. 192Zero on success, otherwise an error code.
184 193
185ERRORS 194ERRORS
195^^^^^^
186 196
187None. (Can it fail? Why return int?) 197None. (Can it fail? Why return int?)
188 198
189EXAMPLE 199EXAMPLE
200^^^^^^^
190 201
191static void lp_attach (struct parport *port) 202::
192{
193 ...
194 private = kmalloc (...);
195 dev[count++] = parport_register_device (...);
196 ...
197}
198 203
199static void lp_detach (struct parport *port) 204 static void lp_attach (struct parport *port)
200{ 205 {
201 ... 206 ...
202} 207 private = kmalloc (...);
208 dev[count++] = parport_register_device (...);
209 ...
210 }
203 211
204static struct parport_driver lp_driver = { 212 static void lp_detach (struct parport *port)
205 "lp", 213 {
206 lp_attach, 214 ...
207 lp_detach, 215 }
208 NULL /* always put NULL here */
209};
210 216
211int lp_init (void) 217 static struct parport_driver lp_driver = {
212{ 218 "lp",
213 ... 219 lp_attach,
214 if (parport_register_driver (&lp_driver)) { 220 lp_detach,
215 /* Failed; nothing we can do. */ 221 NULL /* always put NULL here */
216 return -EIO; 222 };
223
224 int lp_init (void)
225 {
226 ...
227 if (parport_register_driver (&lp_driver)) {
228 /* Failed; nothing we can do. */
229 return -EIO;
230 }
231 ...
217 } 232 }
218 ... 233
219}
220 234
221SEE ALSO 235SEE ALSO
236^^^^^^^^
222 237
223parport_unregister_driver, parport_register_device, parport_enumerate 238parport_unregister_driver, parport_register_device, parport_enumerate
224 239
240
241
225parport_unregister_driver - tell parport to forget about this driver 242parport_unregister_driver - tell parport to forget about this driver
226------------------------- 243--------------------------------------------------------------------
227 244
228SYNOPSIS 245SYNOPSIS
246^^^^^^^^
229 247
230#include <linux/parport.h> 248::
231 249
232struct parport_driver { 250 #include <linux/parport.h>
233 const char *name; 251
234 void (*attach) (struct parport *); 252 struct parport_driver {
235 void (*detach) (struct parport *); 253 const char *name;
236 struct parport_driver *next; 254 void (*attach) (struct parport *);
237}; 255 void (*detach) (struct parport *);
238void parport_unregister_driver (struct parport_driver *driver); 256 struct parport_driver *next;
257 };
258 void parport_unregister_driver (struct parport_driver *driver);
239 259
240DESCRIPTION 260DESCRIPTION
261^^^^^^^^^^^
241 262
242This tells parport not to notify the device driver of new ports or of 263This tells parport not to notify the device driver of new ports or of
243ports going away. Registered devices belonging to that driver are NOT 264ports going away. Registered devices belonging to that driver are NOT
244unregistered: parport_unregister_device must be used for each one. 265unregistered: parport_unregister_device must be used for each one.
245 266
246EXAMPLE 267EXAMPLE
268^^^^^^^
247 269
248void cleanup_module (void) 270::
249{
250 ...
251 /* Stop notifications. */
252 parport_unregister_driver (&lp_driver);
253 271
254 /* Unregister devices. */ 272 void cleanup_module (void)
255 for (i = 0; i < NUM_DEVS; i++) 273 {
256 parport_unregister_device (dev[i]); 274 ...
257 ... 275 /* Stop notifications. */
258} 276 parport_unregister_driver (&lp_driver);
277
278 /* Unregister devices. */
279 for (i = 0; i < NUM_DEVS; i++)
280 parport_unregister_device (dev[i]);
281 ...
282 }
259 283
260SEE ALSO 284SEE ALSO
285^^^^^^^^
261 286
262parport_register_driver, parport_enumerate 287parport_register_driver, parport_enumerate
263 288
289
290
264parport_enumerate - retrieve a list of parallel ports (DEPRECATED) 291parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
265----------------- 292------------------------------------------------------------------
266 293
267SYNOPSIS 294SYNOPSIS
295^^^^^^^^
268 296
269#include <linux/parport.h> 297::
270 298
271struct parport *parport_enumerate (void); 299 #include <linux/parport.h>
300
301 struct parport *parport_enumerate (void);
272 302
273DESCRIPTION 303DESCRIPTION
304^^^^^^^^^^^
274 305
275Retrieve the first of a list of valid parallel ports for this machine. 306Retrieve the first of a list of valid parallel ports for this machine.
276Successive parallel ports can be found using the 'struct parport 307Successive parallel ports can be found using the ``struct parport
277*next' element of the 'struct parport *' that is returned. If 'next' 308*next`` element of the ``struct parport *`` that is returned. If ``next``
278is NULL, there are no more parallel ports in the list. The number of 309is NULL, there are no more parallel ports in the list. The number of
279ports in the list will not exceed PARPORT_MAX. 310ports in the list will not exceed PARPORT_MAX.
280 311
281RETURN VALUE 312RETURN VALUE
313^^^^^^^^^^^^
282 314
283A 'struct parport *' describing a valid parallel port for the machine, 315A ``struct parport *`` describing a valid parallel port for the machine,
284or NULL if there are none. 316or NULL if there are none.
285 317
286ERRORS 318ERRORS
319^^^^^^
287 320
288This function can return NULL to indicate that there are no parallel 321This function can return NULL to indicate that there are no parallel
289ports to use. 322ports to use.
290 323
291EXAMPLE 324EXAMPLE
325^^^^^^^
326
327::
292 328
293int detect_device (void) 329 int detect_device (void)
294{ 330 {
295 struct parport *port; 331 struct parport *port;
332
333 for (port = parport_enumerate ();
334 port != NULL;
335 port = port->next) {
336 /* Try to detect a device on the port... */
337 ...
338 }
339 }
296 340
297 for (port = parport_enumerate ();
298 port != NULL;
299 port = port->next) {
300 /* Try to detect a device on the port... */
301 ... 341 ...
302 }
303 } 342 }
304 343
305 ...
306}
307
308NOTES 344NOTES
345^^^^^
309 346
310parport_enumerate is deprecated; parport_register_driver should be 347parport_enumerate is deprecated; parport_register_driver should be
311used instead. 348used instead.
312 349
313SEE ALSO 350SEE ALSO
351^^^^^^^^
314 352
315parport_register_driver, parport_unregister_driver 353parport_register_driver, parport_unregister_driver
316 354
355
356
317parport_register_device - register to use a port 357parport_register_device - register to use a port
318----------------------- 358------------------------------------------------
319 359
320SYNOPSIS 360SYNOPSIS
361^^^^^^^^
321 362
322#include <linux/parport.h> 363::
323 364
324typedef int (*preempt_func) (void *handle); 365 #include <linux/parport.h>
325typedef void (*wakeup_func) (void *handle);
326typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
327 366
328struct pardevice *parport_register_device(struct parport *port, 367 typedef int (*preempt_func) (void *handle);
329 const char *name, 368 typedef void (*wakeup_func) (void *handle);
330 preempt_func preempt, 369 typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
331 wakeup_func wakeup, 370
332 irq_func irq, 371 struct pardevice *parport_register_device(struct parport *port,
333 int flags, 372 const char *name,
334 void *handle); 373 preempt_func preempt,
374 wakeup_func wakeup,
375 irq_func irq,
376 int flags,
377 void *handle);
335 378
336DESCRIPTION 379DESCRIPTION
380^^^^^^^^^^^
337 381
338Use this function to register your device driver on a parallel port 382Use this function to register your device driver on a parallel port
339('port'). Once you have done that, you will be able to use 383(``port``). Once you have done that, you will be able to use
340parport_claim and parport_release in order to use the port. 384parport_claim and parport_release in order to use the port.
341 385
342The ('name') argument is the name of the device that appears in /proc 386The (``name``) argument is the name of the device that appears in /proc
343filesystem. The string must be valid for the whole lifetime of the 387filesystem. The string must be valid for the whole lifetime of the
344device (until parport_unregister_device is called). 388device (until parport_unregister_device is called).
345 389
346This function will register three callbacks into your driver: 390This function will register three callbacks into your driver:
347'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to 391``preempt``, ``wakeup`` and ``irq``. Each of these may be NULL in order to
348indicate that you do not want a callback. 392indicate that you do not want a callback.
349 393
350When the 'preempt' function is called, it is because another driver 394When the ``preempt`` function is called, it is because another driver
351wishes to use the parallel port. The 'preempt' function should return 395wishes to use the parallel port. The ``preempt`` function should return
352non-zero if the parallel port cannot be released yet -- if zero is 396non-zero if the parallel port cannot be released yet -- if zero is
353returned, the port is lost to another driver and the port must be 397returned, the port is lost to another driver and the port must be
354re-claimed before use. 398re-claimed before use.
355 399
356The 'wakeup' function is called once another driver has released the 400The ``wakeup`` function is called once another driver has released the
357port and no other driver has yet claimed it. You can claim the 401port and no other driver has yet claimed it. You can claim the
358parallel port from within the 'wakeup' function (in which case the 402parallel port from within the ``wakeup`` function (in which case the
359claim is guaranteed to succeed), or choose not to if you don't need it 403claim is guaranteed to succeed), or choose not to if you don't need it
360now. 404now.
361 405
362If an interrupt occurs on the parallel port your driver has claimed, 406If an interrupt occurs on the parallel port your driver has claimed,
363the 'irq' function will be called. (Write something about shared 407the ``irq`` function will be called. (Write something about shared
364interrupts here.) 408interrupts here.)
365 409
366The 'handle' is a pointer to driver-specific data, and is passed to 410The ``handle`` is a pointer to driver-specific data, and is passed to
367the callback functions. 411the callback functions.
368 412
369'flags' may be a bitwise combination of the following flags: 413``flags`` may be a bitwise combination of the following flags:
370 414
415 ===================== =================================================
371 Flag Meaning 416 Flag Meaning
417 ===================== =================================================
372 PARPORT_DEV_EXCL The device cannot share the parallel port at all. 418 PARPORT_DEV_EXCL The device cannot share the parallel port at all.
373 Use this only when absolutely necessary. 419 Use this only when absolutely necessary.
420 ===================== =================================================
374 421
375The typedefs are not actually defined -- they are only shown in order 422The typedefs are not actually defined -- they are only shown in order
376to make the function prototype more readable. 423to make the function prototype more readable.
377 424
378The visible parts of the returned 'struct pardevice' are: 425The visible parts of the returned ``struct pardevice`` are::
379 426
380struct pardevice { 427 struct pardevice {
381 struct parport *port; /* Associated port */ 428 struct parport *port; /* Associated port */
382 void *private; /* Device driver's 'handle' */ 429 void *private; /* Device driver's 'handle' */
383 ... 430 ...
384}; 431 };
385 432
386RETURN VALUE 433RETURN VALUE
434^^^^^^^^^^^^
387 435
388A 'struct pardevice *': a handle to the registered parallel port 436A ``struct pardevice *``: a handle to the registered parallel port
389device that can be used for parport_claim, parport_release, etc. 437device that can be used for parport_claim, parport_release, etc.
390 438
391ERRORS 439ERRORS
440^^^^^^
392 441
393A return value of NULL indicates that there was a problem registering 442A return value of NULL indicates that there was a problem registering
394a device on that port. 443a device on that port.
395 444
396EXAMPLE 445EXAMPLE
446^^^^^^^
447
448::
449
450 static int preempt (void *handle)
451 {
452 if (busy_right_now)
453 return 1;
454
455 must_reclaim_port = 1;
456 return 0;
457 }
458
459 static void wakeup (void *handle)
460 {
461 struct toaster *private = handle;
462 struct pardevice *dev = private->dev;
463 if (!dev) return; /* avoid races */
464
465 if (want_port)
466 parport_claim (dev);
467 }
468
469 static int toaster_detect (struct toaster *private, struct parport *port)
470 {
471 private->dev = parport_register_device (port, "toaster", preempt,
472 wakeup, NULL, 0,
473 private);
474 if (!private->dev)
475 /* Couldn't register with parport. */
476 return -EIO;
397 477
398static int preempt (void *handle)
399{
400 if (busy_right_now)
401 return 1;
402
403 must_reclaim_port = 1;
404 return 0;
405}
406
407static void wakeup (void *handle)
408{
409 struct toaster *private = handle;
410 struct pardevice *dev = private->dev;
411 if (!dev) return; /* avoid races */
412
413 if (want_port)
414 parport_claim (dev);
415}
416
417static int toaster_detect (struct toaster *private, struct parport *port)
418{
419 private->dev = parport_register_device (port, "toaster", preempt,
420 wakeup, NULL, 0,
421 private);
422 if (!private->dev)
423 /* Couldn't register with parport. */
424 return -EIO;
425
426 must_reclaim_port = 0;
427 busy_right_now = 1;
428 parport_claim_or_block (private->dev);
429 ...
430 /* Don't need the port while the toaster warms up. */
431 busy_right_now = 0;
432 ...
433 busy_right_now = 1;
434 if (must_reclaim_port) {
435 parport_claim_or_block (private->dev);
436 must_reclaim_port = 0; 478 must_reclaim_port = 0;
479 busy_right_now = 1;
480 parport_claim_or_block (private->dev);
481 ...
482 /* Don't need the port while the toaster warms up. */
483 busy_right_now = 0;
484 ...
485 busy_right_now = 1;
486 if (must_reclaim_port) {
487 parport_claim_or_block (private->dev);
488 must_reclaim_port = 0;
489 }
490 ...
437 } 491 }
438 ...
439}
440 492
441SEE ALSO 493SEE ALSO
494^^^^^^^^
442 495
443parport_unregister_device, parport_claim 496parport_unregister_device, parport_claim
497
498
444 499
445parport_unregister_device - finish using a port 500parport_unregister_device - finish using a port
446------------------------- 501-----------------------------------------------
447 502
448SYNPOPSIS 503SYNPOPSIS
449 504
450#include <linux/parport.h> 505::
506
507 #include <linux/parport.h>
451 508
452void parport_unregister_device (struct pardevice *dev); 509 void parport_unregister_device (struct pardevice *dev);
453 510
454DESCRIPTION 511DESCRIPTION
512^^^^^^^^^^^
455 513
456This function is the opposite of parport_register_device. After using 514This function is the opposite of parport_register_device. After using
457parport_unregister_device, 'dev' is no longer a valid device handle. 515parport_unregister_device, ``dev`` is no longer a valid device handle.
458 516
459You should not unregister a device that is currently claimed, although 517You should not unregister a device that is currently claimed, although
460if you do it will be released automatically. 518if you do it will be released automatically.
461 519
462EXAMPLE 520EXAMPLE
521^^^^^^^
522
523::
463 524
464 ... 525 ...
465 kfree (dev->private); /* before we lose the pointer */ 526 kfree (dev->private); /* before we lose the pointer */
@@ -467,460 +528,602 @@ EXAMPLE
467 ... 528 ...
468 529
469SEE ALSO 530SEE ALSO
531^^^^^^^^
532
470 533
471parport_unregister_driver 534parport_unregister_driver
472 535
473parport_claim, parport_claim_or_block - claim the parallel port for a device 536parport_claim, parport_claim_or_block - claim the parallel port for a device
474------------------------------------- 537----------------------------------------------------------------------------
475 538
476SYNOPSIS 539SYNOPSIS
540^^^^^^^^
541
542::
477 543
478#include <linux/parport.h> 544 #include <linux/parport.h>
479 545
480int parport_claim (struct pardevice *dev); 546 int parport_claim (struct pardevice *dev);
481int parport_claim_or_block (struct pardevice *dev); 547 int parport_claim_or_block (struct pardevice *dev);
482 548
483DESCRIPTION 549DESCRIPTION
550^^^^^^^^^^^
484 551
485These functions attempt to gain control of the parallel port on which 552These functions attempt to gain control of the parallel port on which
486'dev' is registered. 'parport_claim' does not block, but 553``dev`` is registered. ``parport_claim`` does not block, but
487'parport_claim_or_block' may do. (Put something here about blocking 554``parport_claim_or_block`` may do. (Put something here about blocking
488interruptibly or non-interruptibly.) 555interruptibly or non-interruptibly.)
489 556
490You should not try to claim a port that you have already claimed. 557You should not try to claim a port that you have already claimed.
491 558
492RETURN VALUE 559RETURN VALUE
560^^^^^^^^^^^^
493 561
494A return value of zero indicates that the port was successfully 562A return value of zero indicates that the port was successfully
495claimed, and the caller now has possession of the parallel port. 563claimed, and the caller now has possession of the parallel port.
496 564
497If 'parport_claim_or_block' blocks before returning successfully, the 565If ``parport_claim_or_block`` blocks before returning successfully, the
498return value is positive. 566return value is positive.
499 567
500ERRORS 568ERRORS
569^^^^^^
501 570
571========== ==========================================================
502 -EAGAIN The port is unavailable at the moment, but another attempt 572 -EAGAIN The port is unavailable at the moment, but another attempt
503 to claim it may succeed. 573 to claim it may succeed.
574========== ==========================================================
504 575
505SEE ALSO 576SEE ALSO
577^^^^^^^^
578
506 579
507parport_release 580parport_release
508 581
509parport_release - release the parallel port 582parport_release - release the parallel port
510--------------- 583-------------------------------------------
511 584
512SYNOPSIS 585SYNOPSIS
586^^^^^^^^
587
588::
513 589
514#include <linux/parport.h> 590 #include <linux/parport.h>
515 591
516void parport_release (struct pardevice *dev); 592 void parport_release (struct pardevice *dev);
517 593
518DESCRIPTION 594DESCRIPTION
595^^^^^^^^^^^
519 596
520Once a parallel port device has been claimed, it can be released using 597Once a parallel port device has been claimed, it can be released using
521'parport_release'. It cannot fail, but you should not release a 598``parport_release``. It cannot fail, but you should not release a
522device that you do not have possession of. 599device that you do not have possession of.
523 600
524EXAMPLE 601EXAMPLE
602^^^^^^^
525 603
526static size_t write (struct pardevice *dev, const void *buf, 604::
527 size_t len) 605
528{ 606 static size_t write (struct pardevice *dev, const void *buf,
529 ... 607 size_t len)
530 written = dev->port->ops->write_ecp_data (dev->port, buf, 608 {
531 len); 609 ...
532 parport_release (dev); 610 written = dev->port->ops->write_ecp_data (dev->port, buf,
533 ... 611 len);
534} 612 parport_release (dev);
613 ...
614 }
535 615
536 616
537SEE ALSO 617SEE ALSO
618^^^^^^^^
538 619
539change_mode, parport_claim, parport_claim_or_block, parport_yield 620change_mode, parport_claim, parport_claim_or_block, parport_yield
540 621
622
623
541parport_yield, parport_yield_blocking - temporarily release a parallel port 624parport_yield, parport_yield_blocking - temporarily release a parallel port
542------------------------------------- 625---------------------------------------------------------------------------
543 626
544SYNOPSIS 627SYNOPSIS
628^^^^^^^^
629
630::
545 631
546#include <linux/parport.h> 632 #include <linux/parport.h>
547 633
548int parport_yield (struct pardevice *dev) 634 int parport_yield (struct pardevice *dev)
549int parport_yield_blocking (struct pardevice *dev); 635 int parport_yield_blocking (struct pardevice *dev);
550 636
551DESCRIPTION 637DESCRIPTION
638^^^^^^^^^^^
552 639
553When a driver has control of a parallel port, it may allow another 640When a driver has control of a parallel port, it may allow another
554driver to temporarily 'borrow' it. 'parport_yield' does not block; 641driver to temporarily ``borrow`` it. ``parport_yield`` does not block;
555'parport_yield_blocking' may do. 642``parport_yield_blocking`` may do.
556 643
557RETURN VALUE 644RETURN VALUE
645^^^^^^^^^^^^
558 646
559A return value of zero indicates that the caller still owns the port 647A return value of zero indicates that the caller still owns the port
560and the call did not block. 648and the call did not block.
561 649
562A positive return value from 'parport_yield_blocking' indicates that 650A positive return value from ``parport_yield_blocking`` indicates that
563the caller still owns the port and the call blocked. 651the caller still owns the port and the call blocked.
564 652
565A return value of -EAGAIN indicates that the caller no longer owns the 653A return value of -EAGAIN indicates that the caller no longer owns the
566port, and it must be re-claimed before use. 654port, and it must be re-claimed before use.
567 655
568ERRORS 656ERRORS
657^^^^^^
569 658
659========= ==========================================================
570 -EAGAIN Ownership of the parallel port was given away. 660 -EAGAIN Ownership of the parallel port was given away.
661========= ==========================================================
571 662
572SEE ALSO 663SEE ALSO
664^^^^^^^^
573 665
574parport_release 666parport_release
667
668
575 669
576parport_wait_peripheral - wait for status lines, up to 35ms 670parport_wait_peripheral - wait for status lines, up to 35ms
577----------------------- 671-----------------------------------------------------------
578 672
579SYNOPSIS 673SYNOPSIS
674^^^^^^^^
675
676::
580 677
581#include <linux/parport.h> 678 #include <linux/parport.h>
582 679
583int parport_wait_peripheral (struct parport *port, 680 int parport_wait_peripheral (struct parport *port,
584 unsigned char mask, 681 unsigned char mask,
585 unsigned char val); 682 unsigned char val);
586 683
587DESCRIPTION 684DESCRIPTION
685^^^^^^^^^^^
588 686
589Wait for the status lines in mask to match the values in val. 687Wait for the status lines in mask to match the values in val.
590 688
591RETURN VALUE 689RETURN VALUE
690^^^^^^^^^^^^
592 691
692======== ==========================================================
593 -EINTR a signal is pending 693 -EINTR a signal is pending
594 0 the status lines in mask have values in val 694 0 the status lines in mask have values in val
595 1 timed out while waiting (35ms elapsed) 695 1 timed out while waiting (35ms elapsed)
696======== ==========================================================
596 697
597SEE ALSO 698SEE ALSO
699^^^^^^^^
598 700
599parport_poll_peripheral 701parport_poll_peripheral
702
703
600 704
601parport_poll_peripheral - wait for status lines, in usec 705parport_poll_peripheral - wait for status lines, in usec
602----------------------- 706--------------------------------------------------------
603 707
604SYNOPSIS 708SYNOPSIS
709^^^^^^^^
710
711::
605 712
606#include <linux/parport.h> 713 #include <linux/parport.h>
607 714
608int parport_poll_peripheral (struct parport *port, 715 int parport_poll_peripheral (struct parport *port,
609 unsigned char mask, 716 unsigned char mask,
610 unsigned char val, 717 unsigned char val,
611 int usec); 718 int usec);
612 719
613DESCRIPTION 720DESCRIPTION
721^^^^^^^^^^^
614 722
615Wait for the status lines in mask to match the values in val. 723Wait for the status lines in mask to match the values in val.
616 724
617RETURN VALUE 725RETURN VALUE
726^^^^^^^^^^^^
618 727
728======== ==========================================================
619 -EINTR a signal is pending 729 -EINTR a signal is pending
620 0 the status lines in mask have values in val 730 0 the status lines in mask have values in val
621 1 timed out while waiting (usec microseconds have elapsed) 731 1 timed out while waiting (usec microseconds have elapsed)
732======== ==========================================================
622 733
623SEE ALSO 734SEE ALSO
735^^^^^^^^
624 736
625parport_wait_peripheral 737parport_wait_peripheral
626 738
739
740
627parport_wait_event - wait for an event on a port 741parport_wait_event - wait for an event on a port
628------------------ 742------------------------------------------------
629 743
630SYNOPSIS 744SYNOPSIS
745^^^^^^^^
631 746
632#include <linux/parport.h> 747::
633 748
634int parport_wait_event (struct parport *port, signed long timeout) 749 #include <linux/parport.h>
750
751 int parport_wait_event (struct parport *port, signed long timeout)
635 752
636DESCRIPTION 753DESCRIPTION
754^^^^^^^^^^^
637 755
638Wait for an event (e.g. interrupt) on a port. The timeout is in 756Wait for an event (e.g. interrupt) on a port. The timeout is in
639jiffies. 757jiffies.
640 758
641RETURN VALUE 759RETURN VALUE
760^^^^^^^^^^^^
642 761
762======= ==========================================================
643 0 success 763 0 success
644 <0 error (exit as soon as possible) 764 <0 error (exit as soon as possible)
645 >0 timed out 765 >0 timed out
646 766======= ==========================================================
767
647parport_negotiate - perform IEEE 1284 negotiation 768parport_negotiate - perform IEEE 1284 negotiation
648----------------- 769-------------------------------------------------
649 770
650SYNOPSIS 771SYNOPSIS
772^^^^^^^^
773
774::
651 775
652#include <linux/parport.h> 776 #include <linux/parport.h>
653 777
654int parport_negotiate (struct parport *, int mode); 778 int parport_negotiate (struct parport *, int mode);
655 779
656DESCRIPTION 780DESCRIPTION
781^^^^^^^^^^^
657 782
658Perform IEEE 1284 negotiation. 783Perform IEEE 1284 negotiation.
659 784
660RETURN VALUE 785RETURN VALUE
786^^^^^^^^^^^^
661 787
788======= ==========================================================
662 0 handshake OK; IEEE 1284 peripheral and mode available 789 0 handshake OK; IEEE 1284 peripheral and mode available
663 -1 handshake failed; peripheral not compliant (or none present) 790 -1 handshake failed; peripheral not compliant (or none present)
664 1 handshake OK; IEEE 1284 peripheral present but mode not 791 1 handshake OK; IEEE 1284 peripheral present but mode not
665 available 792 available
793======= ==========================================================
666 794
667SEE ALSO 795SEE ALSO
796^^^^^^^^
668 797
669parport_read, parport_write 798parport_read, parport_write
670 799
800
801
671parport_read - read data from device 802parport_read - read data from device
672------------ 803------------------------------------
673 804
674SYNOPSIS 805SYNOPSIS
806^^^^^^^^
807
808::
675 809
676#include <linux/parport.h> 810 #include <linux/parport.h>
677 811
678ssize_t parport_read (struct parport *, void *buf, size_t len); 812 ssize_t parport_read (struct parport *, void *buf, size_t len);
679 813
680DESCRIPTION 814DESCRIPTION
815^^^^^^^^^^^
681 816
682Read data from device in current IEEE 1284 transfer mode. This only 817Read data from device in current IEEE 1284 transfer mode. This only
683works for modes that support reverse data transfer. 818works for modes that support reverse data transfer.
684 819
685RETURN VALUE 820RETURN VALUE
821^^^^^^^^^^^^
686 822
687If negative, an error code; otherwise the number of bytes transferred. 823If negative, an error code; otherwise the number of bytes transferred.
688 824
689SEE ALSO 825SEE ALSO
826^^^^^^^^
690 827
691parport_write, parport_negotiate 828parport_write, parport_negotiate
692 829
830
831
693parport_write - write data to device 832parport_write - write data to device
694------------- 833------------------------------------
695 834
696SYNOPSIS 835SYNOPSIS
836^^^^^^^^
837
838::
697 839
698#include <linux/parport.h> 840 #include <linux/parport.h>
699 841
700ssize_t parport_write (struct parport *, const void *buf, size_t len); 842 ssize_t parport_write (struct parport *, const void *buf, size_t len);
701 843
702DESCRIPTION 844DESCRIPTION
845^^^^^^^^^^^
703 846
704Write data to device in current IEEE 1284 transfer mode. This only 847Write data to device in current IEEE 1284 transfer mode. This only
705works for modes that support forward data transfer. 848works for modes that support forward data transfer.
706 849
707RETURN VALUE 850RETURN VALUE
851^^^^^^^^^^^^
708 852
709If negative, an error code; otherwise the number of bytes transferred. 853If negative, an error code; otherwise the number of bytes transferred.
710 854
711SEE ALSO 855SEE ALSO
856^^^^^^^^
712 857
713parport_read, parport_negotiate 858parport_read, parport_negotiate
859
860
714 861
715parport_open - register device for particular device number 862parport_open - register device for particular device number
716------------ 863-----------------------------------------------------------
717 864
718SYNOPSIS 865SYNOPSIS
866^^^^^^^^
719 867
720#include <linux/parport.h> 868::
721 869
722struct pardevice *parport_open (int devnum, const char *name, 870 #include <linux/parport.h>
723 int (*pf) (void *), 871
724 void (*kf) (void *), 872 struct pardevice *parport_open (int devnum, const char *name,
725 void (*irqf) (int, void *, 873 int (*pf) (void *),
726 struct pt_regs *), 874 void (*kf) (void *),
727 int flags, void *handle); 875 void (*irqf) (int, void *,
876 struct pt_regs *),
877 int flags, void *handle);
728 878
729DESCRIPTION 879DESCRIPTION
880^^^^^^^^^^^
730 881
731This is like parport_register_device but takes a device number instead 882This is like parport_register_device but takes a device number instead
732of a pointer to a struct parport. 883of a pointer to a struct parport.
733 884
734RETURN VALUE 885RETURN VALUE
886^^^^^^^^^^^^
735 887
736See parport_register_device. If no device is associated with devnum, 888See parport_register_device. If no device is associated with devnum,
737NULL is returned. 889NULL is returned.
738 890
739SEE ALSO 891SEE ALSO
892^^^^^^^^
740 893
741parport_register_device 894parport_register_device
742 895
896
897
743parport_close - unregister device for particular device number 898parport_close - unregister device for particular device number
744------------- 899--------------------------------------------------------------
745 900
746SYNOPSIS 901SYNOPSIS
902^^^^^^^^
903
904::
747 905
748#include <linux/parport.h> 906 #include <linux/parport.h>
749 907
750void parport_close (struct pardevice *dev); 908 void parport_close (struct pardevice *dev);
751 909
752DESCRIPTION 910DESCRIPTION
911^^^^^^^^^^^
753 912
754This is the equivalent of parport_unregister_device for parport_open. 913This is the equivalent of parport_unregister_device for parport_open.
755 914
756SEE ALSO 915SEE ALSO
916^^^^^^^^
757 917
758parport_unregister_device, parport_open 918parport_unregister_device, parport_open
759 919
920
921
760parport_device_id - obtain IEEE 1284 Device ID 922parport_device_id - obtain IEEE 1284 Device ID
761----------------- 923----------------------------------------------
762 924
763SYNOPSIS 925SYNOPSIS
926^^^^^^^^
927
928::
764 929
765#include <linux/parport.h> 930 #include <linux/parport.h>
766 931
767ssize_t parport_device_id (int devnum, char *buffer, size_t len); 932 ssize_t parport_device_id (int devnum, char *buffer, size_t len);
768 933
769DESCRIPTION 934DESCRIPTION
935^^^^^^^^^^^
770 936
771Obtains the IEEE 1284 Device ID associated with a given device. 937Obtains the IEEE 1284 Device ID associated with a given device.
772 938
773RETURN VALUE 939RETURN VALUE
940^^^^^^^^^^^^
774 941
775If negative, an error code; otherwise, the number of bytes of buffer 942If negative, an error code; otherwise, the number of bytes of buffer
776that contain the device ID. The format of the device ID is as 943that contain the device ID. The format of the device ID is as
777follows: 944follows::
778 945
779[length][ID] 946 [length][ID]
780 947
781The first two bytes indicate the inclusive length of the entire Device 948The first two bytes indicate the inclusive length of the entire Device
782ID, and are in big-endian order. The ID is a sequence of pairs of the 949ID, and are in big-endian order. The ID is a sequence of pairs of the
783form: 950form::
784 951
785key:value; 952 key:value;
786 953
787NOTES 954NOTES
955^^^^^
788 956
789Many devices have ill-formed IEEE 1284 Device IDs. 957Many devices have ill-formed IEEE 1284 Device IDs.
790 958
791SEE ALSO 959SEE ALSO
960^^^^^^^^
792 961
793parport_find_class, parport_find_device 962parport_find_class, parport_find_device
794 963
964
965
795parport_device_coords - convert device number to device coordinates 966parport_device_coords - convert device number to device coordinates
796------------------ 967-------------------------------------------------------------------
797 968
798SYNOPSIS 969SYNOPSIS
970^^^^^^^^
971
972::
799 973
800#include <linux/parport.h> 974 #include <linux/parport.h>
801 975
802int parport_device_coords (int devnum, int *parport, int *mux, 976 int parport_device_coords (int devnum, int *parport, int *mux,
803 int *daisy); 977 int *daisy);
804 978
805DESCRIPTION 979DESCRIPTION
980^^^^^^^^^^^
806 981
807Convert between device number (zero-based) and device coordinates 982Convert between device number (zero-based) and device coordinates
808(port, multiplexor, daisy chain address). 983(port, multiplexor, daisy chain address).
809 984
810RETURN VALUE 985RETURN VALUE
986^^^^^^^^^^^^
811 987
812Zero on success, in which case the coordinates are (*parport, *mux, 988Zero on success, in which case the coordinates are (``*parport``, ``*mux``,
813*daisy). 989``*daisy``).
814 990
815SEE ALSO 991SEE ALSO
992^^^^^^^^
816 993
817parport_open, parport_device_id 994parport_open, parport_device_id
818 995
996
997
819parport_find_class - find a device by its class 998parport_find_class - find a device by its class
820------------------ 999-----------------------------------------------
821 1000
822SYNOPSIS 1001SYNOPSIS
823 1002^^^^^^^^
824#include <linux/parport.h> 1003
825 1004::
826typedef enum { 1005
827 PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */ 1006 #include <linux/parport.h>
828 PARPORT_CLASS_PRINTER, 1007
829 PARPORT_CLASS_MODEM, 1008 typedef enum {
830 PARPORT_CLASS_NET, 1009 PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
831 PARPORT_CLASS_HDC, /* Hard disk controller */ 1010 PARPORT_CLASS_PRINTER,
832 PARPORT_CLASS_PCMCIA, 1011 PARPORT_CLASS_MODEM,
833 PARPORT_CLASS_MEDIA, /* Multimedia device */ 1012 PARPORT_CLASS_NET,
834 PARPORT_CLASS_FDC, /* Floppy disk controller */ 1013 PARPORT_CLASS_HDC, /* Hard disk controller */
835 PARPORT_CLASS_PORTS, 1014 PARPORT_CLASS_PCMCIA,
836 PARPORT_CLASS_SCANNER, 1015 PARPORT_CLASS_MEDIA, /* Multimedia device */
837 PARPORT_CLASS_DIGCAM, 1016 PARPORT_CLASS_FDC, /* Floppy disk controller */
838 PARPORT_CLASS_OTHER, /* Anything else */ 1017 PARPORT_CLASS_PORTS,
839 PARPORT_CLASS_UNSPEC, /* No CLS field in ID */ 1018 PARPORT_CLASS_SCANNER,
840 PARPORT_CLASS_SCSIADAPTER 1019 PARPORT_CLASS_DIGCAM,
841} parport_device_class; 1020 PARPORT_CLASS_OTHER, /* Anything else */
842 1021 PARPORT_CLASS_UNSPEC, /* No CLS field in ID */
843int parport_find_class (parport_device_class cls, int from); 1022 PARPORT_CLASS_SCSIADAPTER
1023 } parport_device_class;
1024
1025 int parport_find_class (parport_device_class cls, int from);
844 1026
845DESCRIPTION 1027DESCRIPTION
1028^^^^^^^^^^^
846 1029
847Find a device by class. The search starts from device number from+1. 1030Find a device by class. The search starts from device number from+1.
848 1031
849RETURN VALUE 1032RETURN VALUE
1033^^^^^^^^^^^^
850 1034
851The device number of the next device in that class, or -1 if no such 1035The device number of the next device in that class, or -1 if no such
852device exists. 1036device exists.
853 1037
854NOTES 1038NOTES
1039^^^^^
855 1040
856Example usage: 1041Example usage::
857 1042
858int devnum = -1; 1043 int devnum = -1;
859while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) { 1044 while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
860 struct pardevice *dev = parport_open (devnum, ...); 1045 struct pardevice *dev = parport_open (devnum, ...);
861 ... 1046 ...
862} 1047 }
863 1048
864SEE ALSO 1049SEE ALSO
1050^^^^^^^^
865 1051
866parport_find_device, parport_open, parport_device_id 1052parport_find_device, parport_open, parport_device_id
867 1053
1054
1055
868parport_find_device - find a device by its class 1056parport_find_device - find a device by its class
869------------------ 1057------------------------------------------------
870 1058
871SYNOPSIS 1059SYNOPSIS
1060^^^^^^^^
872 1061
873#include <linux/parport.h> 1062::
874 1063
875int parport_find_device (const char *mfg, const char *mdl, int from); 1064 #include <linux/parport.h>
1065
1066 int parport_find_device (const char *mfg, const char *mdl, int from);
876 1067
877DESCRIPTION 1068DESCRIPTION
1069^^^^^^^^^^^
878 1070
879Find a device by vendor and model. The search starts from device 1071Find a device by vendor and model. The search starts from device
880number from+1. 1072number from+1.
881 1073
882RETURN VALUE 1074RETURN VALUE
1075^^^^^^^^^^^^
883 1076
884The device number of the next device matching the specifications, or 1077The device number of the next device matching the specifications, or
885-1 if no such device exists. 1078-1 if no such device exists.
886 1079
887NOTES 1080NOTES
1081^^^^^
888 1082
889Example usage: 1083Example usage::
890 1084
891int devnum = -1; 1085 int devnum = -1;
892while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) { 1086 while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
893 struct pardevice *dev = parport_open (devnum, ...); 1087 struct pardevice *dev = parport_open (devnum, ...);
894 ... 1088 ...
895} 1089 }
896 1090
897SEE ALSO 1091SEE ALSO
1092^^^^^^^^
898 1093
899parport_find_class, parport_open, parport_device_id 1094parport_find_class, parport_open, parport_device_id
1095
1096
900 1097
901parport_set_timeout - set the inactivity timeout 1098parport_set_timeout - set the inactivity timeout
902------------------- 1099------------------------------------------------
903 1100
904SYNOPSIS 1101SYNOPSIS
1102^^^^^^^^
1103
1104::
905 1105
906#include <linux/parport.h> 1106 #include <linux/parport.h>
907 1107
908long parport_set_timeout (struct pardevice *dev, long inactivity); 1108 long parport_set_timeout (struct pardevice *dev, long inactivity);
909 1109
910DESCRIPTION 1110DESCRIPTION
1111^^^^^^^^^^^
911 1112
912Set the inactivity timeout, in jiffies, for a registered device. The 1113Set the inactivity timeout, in jiffies, for a registered device. The
913previous timeout is returned. 1114previous timeout is returned.
914 1115
915RETURN VALUE 1116RETURN VALUE
1117^^^^^^^^^^^^
916 1118
917The previous timeout, in jiffies. 1119The previous timeout, in jiffies.
918 1120
919NOTES 1121NOTES
1122^^^^^
920 1123
921Some of the port->ops functions for a parport may take time, owing to 1124Some of the port->ops functions for a parport may take time, owing to
922delays at the peripheral. After the peripheral has not responded for 1125delays at the peripheral. After the peripheral has not responded for
923'inactivity' jiffies, a timeout will occur and the blocking function 1126``inactivity`` jiffies, a timeout will occur and the blocking function
924will return. 1127will return.
925 1128
926A timeout of 0 jiffies is a special case: the function must do as much 1129A timeout of 0 jiffies is a special case: the function must do as much
@@ -932,29 +1135,37 @@ Once set for a registered device, the timeout will remain at the set
932value until set again. 1135value until set again.
933 1136
934SEE ALSO 1137SEE ALSO
1138^^^^^^^^
935 1139
936port->ops->xxx_read/write_yyy 1140port->ops->xxx_read/write_yyy
937 1141
1142
1143
1144
938PORT FUNCTIONS 1145PORT FUNCTIONS
939-------------- 1146==============
940 1147
941The functions in the port->ops structure (struct parport_operations) 1148The functions in the port->ops structure (struct parport_operations)
942are provided by the low-level driver responsible for that port. 1149are provided by the low-level driver responsible for that port.
943 1150
944port->ops->read_data - read the data register 1151port->ops->read_data - read the data register
945-------------------- 1152---------------------------------------------
946 1153
947SYNOPSIS 1154SYNOPSIS
1155^^^^^^^^
948 1156
949#include <linux/parport.h> 1157::
950 1158
951struct parport_operations { 1159 #include <linux/parport.h>
952 ... 1160
953 unsigned char (*read_data) (struct parport *port); 1161 struct parport_operations {
954 ... 1162 ...
955}; 1163 unsigned char (*read_data) (struct parport *port);
1164 ...
1165 };
956 1166
957DESCRIPTION 1167DESCRIPTION
1168^^^^^^^^^^^
958 1169
959If port->modes contains the PARPORT_MODE_TRISTATE flag and the 1170If port->modes contains the PARPORT_MODE_TRISTATE flag and the
960PARPORT_CONTROL_DIRECTION bit in the control register is set, this 1171PARPORT_CONTROL_DIRECTION bit in the control register is set, this
@@ -964,45 +1175,59 @@ not set, the return value _may_ be the last value written to the data
964register. Otherwise the return value is undefined. 1175register. Otherwise the return value is undefined.
965 1176
966SEE ALSO 1177SEE ALSO
1178^^^^^^^^
967 1179
968write_data, read_status, write_control 1180write_data, read_status, write_control
1181
1182
969 1183
970port->ops->write_data - write the data register 1184port->ops->write_data - write the data register
971--------------------- 1185-----------------------------------------------
972 1186
973SYNOPSIS 1187SYNOPSIS
1188^^^^^^^^
974 1189
975#include <linux/parport.h> 1190::
976 1191
977struct parport_operations { 1192 #include <linux/parport.h>
978 ... 1193
979 void (*write_data) (struct parport *port, unsigned char d); 1194 struct parport_operations {
980 ... 1195 ...
981}; 1196 void (*write_data) (struct parport *port, unsigned char d);
1197 ...
1198 };
982 1199
983DESCRIPTION 1200DESCRIPTION
1201^^^^^^^^^^^
984 1202
985Writes to the data register. May have side-effects (a STROBE pulse, 1203Writes to the data register. May have side-effects (a STROBE pulse,
986for instance). 1204for instance).
987 1205
988SEE ALSO 1206SEE ALSO
1207^^^^^^^^
989 1208
990read_data, read_status, write_control 1209read_data, read_status, write_control
1210
1211
991 1212
992port->ops->read_status - read the status register 1213port->ops->read_status - read the status register
993---------------------- 1214-------------------------------------------------
994 1215
995SYNOPSIS 1216SYNOPSIS
1217^^^^^^^^
996 1218
997#include <linux/parport.h> 1219::
998 1220
999struct parport_operations { 1221 #include <linux/parport.h>
1000 ... 1222
1001 unsigned char (*read_status) (struct parport *port); 1223 struct parport_operations {
1002 ... 1224 ...
1003}; 1225 unsigned char (*read_status) (struct parport *port);
1226 ...
1227 };
1004 1228
1005DESCRIPTION 1229DESCRIPTION
1230^^^^^^^^^^^
1006 1231
1007Reads from the status register. This is a bitmask: 1232Reads from the status register. This is a bitmask:
1008 1233
@@ -1015,76 +1240,98 @@ Reads from the status register. This is a bitmask:
1015There may be other bits set. 1240There may be other bits set.
1016 1241
1017SEE ALSO 1242SEE ALSO
1243^^^^^^^^
1018 1244
1019read_data, write_data, write_control 1245read_data, write_data, write_control
1246
1247
1020 1248
1021port->ops->read_control - read the control register 1249port->ops->read_control - read the control register
1022----------------------- 1250---------------------------------------------------
1023 1251
1024SYNOPSIS 1252SYNOPSIS
1253^^^^^^^^
1025 1254
1026#include <linux/parport.h> 1255::
1027 1256
1028struct parport_operations { 1257 #include <linux/parport.h>
1029 ... 1258
1030 unsigned char (*read_control) (struct parport *port); 1259 struct parport_operations {
1031 ... 1260 ...
1032}; 1261 unsigned char (*read_control) (struct parport *port);
1262 ...
1263 };
1033 1264
1034DESCRIPTION 1265DESCRIPTION
1266^^^^^^^^^^^
1035 1267
1036Returns the last value written to the control register (either from 1268Returns the last value written to the control register (either from
1037write_control or frob_control). No port access is performed. 1269write_control or frob_control). No port access is performed.
1038 1270
1039SEE ALSO 1271SEE ALSO
1272^^^^^^^^
1040 1273
1041read_data, write_data, read_status, write_control 1274read_data, write_data, read_status, write_control
1275
1276
1042 1277
1043port->ops->write_control - write the control register 1278port->ops->write_control - write the control register
1044------------------------ 1279-----------------------------------------------------
1045 1280
1046SYNOPSIS 1281SYNOPSIS
1282^^^^^^^^
1047 1283
1048#include <linux/parport.h> 1284::
1049 1285
1050struct parport_operations { 1286 #include <linux/parport.h>
1051 ... 1287
1052 void (*write_control) (struct parport *port, unsigned char s); 1288 struct parport_operations {
1053 ... 1289 ...
1054}; 1290 void (*write_control) (struct parport *port, unsigned char s);
1291 ...
1292 };
1055 1293
1056DESCRIPTION 1294DESCRIPTION
1295^^^^^^^^^^^
1057 1296
1058Writes to the control register. This is a bitmask: 1297Writes to the control register. This is a bitmask::
1059 _______ 1298
1060- PARPORT_CONTROL_STROBE (nStrobe) 1299 _______
1061 _______ 1300 - PARPORT_CONTROL_STROBE (nStrobe)
1062- PARPORT_CONTROL_AUTOFD (nAutoFd) 1301 _______
1063 _____ 1302 - PARPORT_CONTROL_AUTOFD (nAutoFd)
1064- PARPORT_CONTROL_INIT (nInit) 1303 _____
1065 _________ 1304 - PARPORT_CONTROL_INIT (nInit)
1066- PARPORT_CONTROL_SELECT (nSelectIn) 1305 _________
1306 - PARPORT_CONTROL_SELECT (nSelectIn)
1067 1307
1068SEE ALSO 1308SEE ALSO
1309^^^^^^^^
1069 1310
1070read_data, write_data, read_status, frob_control 1311read_data, write_data, read_status, frob_control
1312
1313
1071 1314
1072port->ops->frob_control - write control register bits 1315port->ops->frob_control - write control register bits
1073----------------------- 1316-----------------------------------------------------
1074 1317
1075SYNOPSIS 1318SYNOPSIS
1319^^^^^^^^
1076 1320
1077#include <linux/parport.h> 1321::
1078 1322
1079struct parport_operations { 1323 #include <linux/parport.h>
1080 ... 1324
1081 unsigned char (*frob_control) (struct parport *port, 1325 struct parport_operations {
1082 unsigned char mask, 1326 ...
1083 unsigned char val); 1327 unsigned char (*frob_control) (struct parport *port,
1084 ... 1328 unsigned char mask,
1085}; 1329 unsigned char val);
1330 ...
1331 };
1086 1332
1087DESCRIPTION 1333DESCRIPTION
1334^^^^^^^^^^^
1088 1335
1089This is equivalent to reading from the control register, masking out 1336This is equivalent to reading from the control register, masking out
1090the bits in mask, exclusive-or'ing with the bits in val, and writing 1337the bits in mask, exclusive-or'ing with the bits in val, and writing
@@ -1095,23 +1342,30 @@ of its contents is maintained, so frob_control is in fact only one
1095port access. 1342port access.
1096 1343
1097SEE ALSO 1344SEE ALSO
1345^^^^^^^^
1098 1346
1099read_data, write_data, read_status, write_control 1347read_data, write_data, read_status, write_control
1348
1349
1100 1350
1101port->ops->enable_irq - enable interrupt generation 1351port->ops->enable_irq - enable interrupt generation
1102--------------------- 1352---------------------------------------------------
1103 1353
1104SYNOPSIS 1354SYNOPSIS
1355^^^^^^^^
1105 1356
1106#include <linux/parport.h> 1357::
1107 1358
1108struct parport_operations { 1359 #include <linux/parport.h>
1109 ... 1360
1110 void (*enable_irq) (struct parport *port); 1361 struct parport_operations {
1111 ... 1362 ...
1112}; 1363 void (*enable_irq) (struct parport *port);
1364 ...
1365 };
1113 1366
1114DESCRIPTION 1367DESCRIPTION
1368^^^^^^^^^^^
1115 1369
1116The parallel port hardware is instructed to generate interrupts at 1370The parallel port hardware is instructed to generate interrupts at
1117appropriate moments, although those moments are 1371appropriate moments, although those moments are
@@ -1119,353 +1373,460 @@ architecture-specific. For the PC architecture, interrupts are
1119commonly generated on the rising edge of nAck. 1373commonly generated on the rising edge of nAck.
1120 1374
1121SEE ALSO 1375SEE ALSO
1376^^^^^^^^
1122 1377
1123disable_irq 1378disable_irq
1379
1380
1124 1381
1125port->ops->disable_irq - disable interrupt generation 1382port->ops->disable_irq - disable interrupt generation
1126---------------------- 1383-----------------------------------------------------
1127 1384
1128SYNOPSIS 1385SYNOPSIS
1386^^^^^^^^
1129 1387
1130#include <linux/parport.h> 1388::
1131 1389
1132struct parport_operations { 1390 #include <linux/parport.h>
1133 ... 1391
1134 void (*disable_irq) (struct parport *port); 1392 struct parport_operations {
1135 ... 1393 ...
1136}; 1394 void (*disable_irq) (struct parport *port);
1395 ...
1396 };
1137 1397
1138DESCRIPTION 1398DESCRIPTION
1399^^^^^^^^^^^
1139 1400
1140The parallel port hardware is instructed not to generate interrupts. 1401The parallel port hardware is instructed not to generate interrupts.
1141The interrupt itself is not masked. 1402The interrupt itself is not masked.
1142 1403
1143SEE ALSO 1404SEE ALSO
1405^^^^^^^^
1144 1406
1145enable_irq 1407enable_irq
1146 1408
1409
1410
1147port->ops->data_forward - enable data drivers 1411port->ops->data_forward - enable data drivers
1148----------------------- 1412---------------------------------------------
1149 1413
1150SYNOPSIS 1414SYNOPSIS
1415^^^^^^^^
1151 1416
1152#include <linux/parport.h> 1417::
1153 1418
1154struct parport_operations { 1419 #include <linux/parport.h>
1155 ... 1420
1156 void (*data_forward) (struct parport *port); 1421 struct parport_operations {
1157 ... 1422 ...
1158}; 1423 void (*data_forward) (struct parport *port);
1424 ...
1425 };
1159 1426
1160DESCRIPTION 1427DESCRIPTION
1428^^^^^^^^^^^
1161 1429
1162Enables the data line drivers, for 8-bit host-to-peripheral 1430Enables the data line drivers, for 8-bit host-to-peripheral
1163communications. 1431communications.
1164 1432
1165SEE ALSO 1433SEE ALSO
1434^^^^^^^^
1166 1435
1167data_reverse 1436data_reverse
1437
1438
1168 1439
1169port->ops->data_reverse - tristate the buffer 1440port->ops->data_reverse - tristate the buffer
1170----------------------- 1441---------------------------------------------
1171 1442
1172SYNOPSIS 1443SYNOPSIS
1444^^^^^^^^
1173 1445
1174#include <linux/parport.h> 1446::
1175 1447
1176struct parport_operations { 1448 #include <linux/parport.h>
1177 ... 1449
1178 void (*data_reverse) (struct parport *port); 1450 struct parport_operations {
1179 ... 1451 ...
1180}; 1452 void (*data_reverse) (struct parport *port);
1453 ...
1454 };
1181 1455
1182DESCRIPTION 1456DESCRIPTION
1457^^^^^^^^^^^
1183 1458
1184Places the data bus in a high impedance state, if port->modes has the 1459Places the data bus in a high impedance state, if port->modes has the
1185PARPORT_MODE_TRISTATE bit set. 1460PARPORT_MODE_TRISTATE bit set.
1186 1461
1187SEE ALSO 1462SEE ALSO
1463^^^^^^^^
1188 1464
1189data_forward 1465data_forward
1190 1466
1467
1468
1191port->ops->epp_write_data - write EPP data 1469port->ops->epp_write_data - write EPP data
1192------------------------- 1470------------------------------------------
1193 1471
1194SYNOPSIS 1472SYNOPSIS
1473^^^^^^^^
1195 1474
1196#include <linux/parport.h> 1475::
1197 1476
1198struct parport_operations { 1477 #include <linux/parport.h>
1199 ... 1478
1200 size_t (*epp_write_data) (struct parport *port, const void *buf, 1479 struct parport_operations {
1201 size_t len, int flags); 1480 ...
1202 ... 1481 size_t (*epp_write_data) (struct parport *port, const void *buf,
1203}; 1482 size_t len, int flags);
1483 ...
1484 };
1204 1485
1205DESCRIPTION 1486DESCRIPTION
1487^^^^^^^^^^^
1206 1488
1207Writes data in EPP mode, and returns the number of bytes written. 1489Writes data in EPP mode, and returns the number of bytes written.
1208 1490
1209The 'flags' parameter may be one or more of the following, 1491The ``flags`` parameter may be one or more of the following,
1210bitwise-or'ed together: 1492bitwise-or'ed together:
1211 1493
1494======================= =================================================
1212PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and 1495PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1213 32-bit registers. However, if a transfer 1496 32-bit registers. However, if a transfer
1214 times out, the return value may be unreliable. 1497 times out, the return value may be unreliable.
1498======================= =================================================
1215 1499
1216SEE ALSO 1500SEE ALSO
1501^^^^^^^^
1217 1502
1218epp_read_data, epp_write_addr, epp_read_addr 1503epp_read_data, epp_write_addr, epp_read_addr
1504
1505
1219 1506
1220port->ops->epp_read_data - read EPP data 1507port->ops->epp_read_data - read EPP data
1221------------------------ 1508----------------------------------------
1222 1509
1223SYNOPSIS 1510SYNOPSIS
1511^^^^^^^^
1224 1512
1225#include <linux/parport.h> 1513::
1226 1514
1227struct parport_operations { 1515 #include <linux/parport.h>
1228 ... 1516
1229 size_t (*epp_read_data) (struct parport *port, void *buf, 1517 struct parport_operations {
1230 size_t len, int flags); 1518 ...
1231 ... 1519 size_t (*epp_read_data) (struct parport *port, void *buf,
1232}; 1520 size_t len, int flags);
1521 ...
1522 };
1233 1523
1234DESCRIPTION 1524DESCRIPTION
1525^^^^^^^^^^^
1235 1526
1236Reads data in EPP mode, and returns the number of bytes read. 1527Reads data in EPP mode, and returns the number of bytes read.
1237 1528
1238The 'flags' parameter may be one or more of the following, 1529The ``flags`` parameter may be one or more of the following,
1239bitwise-or'ed together: 1530bitwise-or'ed together:
1240 1531
1532======================= =================================================
1241PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and 1533PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1242 32-bit registers. However, if a transfer 1534 32-bit registers. However, if a transfer
1243 times out, the return value may be unreliable. 1535 times out, the return value may be unreliable.
1536======================= =================================================
1244 1537
1245SEE ALSO 1538SEE ALSO
1539^^^^^^^^
1246 1540
1247epp_write_data, epp_write_addr, epp_read_addr 1541epp_write_data, epp_write_addr, epp_read_addr
1248 1542
1543
1544
1249port->ops->epp_write_addr - write EPP address 1545port->ops->epp_write_addr - write EPP address
1250------------------------- 1546---------------------------------------------
1251 1547
1252SYNOPSIS 1548SYNOPSIS
1549^^^^^^^^
1253 1550
1254#include <linux/parport.h> 1551::
1255 1552
1256struct parport_operations { 1553 #include <linux/parport.h>
1257 ... 1554
1258 size_t (*epp_write_addr) (struct parport *port, 1555 struct parport_operations {
1259 const void *buf, size_t len, int flags); 1556 ...
1260 ... 1557 size_t (*epp_write_addr) (struct parport *port,
1261}; 1558 const void *buf, size_t len, int flags);
1559 ...
1560 };
1262 1561
1263DESCRIPTION 1562DESCRIPTION
1563^^^^^^^^^^^
1264 1564
1265Writes EPP addresses (8 bits each), and returns the number written. 1565Writes EPP addresses (8 bits each), and returns the number written.
1266 1566
1267The 'flags' parameter may be one or more of the following, 1567The ``flags`` parameter may be one or more of the following,
1268bitwise-or'ed together: 1568bitwise-or'ed together:
1269 1569
1570======================= =================================================
1270PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and 1571PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1271 32-bit registers. However, if a transfer 1572 32-bit registers. However, if a transfer
1272 times out, the return value may be unreliable. 1573 times out, the return value may be unreliable.
1574======================= =================================================
1273 1575
1274(Does PARPORT_EPP_FAST make sense for this function?) 1576(Does PARPORT_EPP_FAST make sense for this function?)
1275 1577
1276SEE ALSO 1578SEE ALSO
1579^^^^^^^^
1277 1580
1278epp_write_data, epp_read_data, epp_read_addr 1581epp_write_data, epp_read_data, epp_read_addr
1582
1583
1279 1584
1280port->ops->epp_read_addr - read EPP address 1585port->ops->epp_read_addr - read EPP address
1281------------------------ 1586-------------------------------------------
1282 1587
1283SYNOPSIS 1588SYNOPSIS
1589^^^^^^^^
1284 1590
1285#include <linux/parport.h> 1591::
1286 1592
1287struct parport_operations { 1593 #include <linux/parport.h>
1288 ... 1594
1289 size_t (*epp_read_addr) (struct parport *port, void *buf, 1595 struct parport_operations {
1290 size_t len, int flags); 1596 ...
1291 ... 1597 size_t (*epp_read_addr) (struct parport *port, void *buf,
1292}; 1598 size_t len, int flags);
1599 ...
1600 };
1293 1601
1294DESCRIPTION 1602DESCRIPTION
1603^^^^^^^^^^^
1295 1604
1296Reads EPP addresses (8 bits each), and returns the number read. 1605Reads EPP addresses (8 bits each), and returns the number read.
1297 1606
1298The 'flags' parameter may be one or more of the following, 1607The ``flags`` parameter may be one or more of the following,
1299bitwise-or'ed together: 1608bitwise-or'ed together:
1300 1609
1610======================= =================================================
1301PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and 1611PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
1302 32-bit registers. However, if a transfer 1612 32-bit registers. However, if a transfer
1303 times out, the return value may be unreliable. 1613 times out, the return value may be unreliable.
1614======================= =================================================
1304 1615
1305(Does PARPORT_EPP_FAST make sense for this function?) 1616(Does PARPORT_EPP_FAST make sense for this function?)
1306 1617
1307SEE ALSO 1618SEE ALSO
1619^^^^^^^^
1308 1620
1309epp_write_data, epp_read_data, epp_write_addr 1621epp_write_data, epp_read_data, epp_write_addr
1622
1623
1310 1624
1311port->ops->ecp_write_data - write a block of ECP data 1625port->ops->ecp_write_data - write a block of ECP data
1312------------------------- 1626-----------------------------------------------------
1313 1627
1314SYNOPSIS 1628SYNOPSIS
1629^^^^^^^^
1315 1630
1316#include <linux/parport.h> 1631::
1317 1632
1318struct parport_operations { 1633 #include <linux/parport.h>
1319 ... 1634
1320 size_t (*ecp_write_data) (struct parport *port, 1635 struct parport_operations {
1321 const void *buf, size_t len, int flags); 1636 ...
1322 ... 1637 size_t (*ecp_write_data) (struct parport *port,
1323}; 1638 const void *buf, size_t len, int flags);
1639 ...
1640 };
1324 1641
1325DESCRIPTION 1642DESCRIPTION
1643^^^^^^^^^^^
1326 1644
1327Writes a block of ECP data. The 'flags' parameter is ignored. 1645Writes a block of ECP data. The ``flags`` parameter is ignored.
1328 1646
1329RETURN VALUE 1647RETURN VALUE
1648^^^^^^^^^^^^
1330 1649
1331The number of bytes written. 1650The number of bytes written.
1332 1651
1333SEE ALSO 1652SEE ALSO
1653^^^^^^^^
1334 1654
1335ecp_read_data, ecp_write_addr 1655ecp_read_data, ecp_write_addr
1336 1656
1657
1658
1337port->ops->ecp_read_data - read a block of ECP data 1659port->ops->ecp_read_data - read a block of ECP data
1338------------------------ 1660---------------------------------------------------
1339 1661
1340SYNOPSIS 1662SYNOPSIS
1663^^^^^^^^
1341 1664
1342#include <linux/parport.h> 1665::
1343 1666
1344struct parport_operations { 1667 #include <linux/parport.h>
1345 ... 1668
1346 size_t (*ecp_read_data) (struct parport *port, 1669 struct parport_operations {
1347 void *buf, size_t len, int flags); 1670 ...
1348 ... 1671 size_t (*ecp_read_data) (struct parport *port,
1349}; 1672 void *buf, size_t len, int flags);
1673 ...
1674 };
1350 1675
1351DESCRIPTION 1676DESCRIPTION
1677^^^^^^^^^^^
1352 1678
1353Reads a block of ECP data. The 'flags' parameter is ignored. 1679Reads a block of ECP data. The ``flags`` parameter is ignored.
1354 1680
1355RETURN VALUE 1681RETURN VALUE
1682^^^^^^^^^^^^
1356 1683
1357The number of bytes read. NB. There may be more unread data in a 1684The number of bytes read. NB. There may be more unread data in a
1358FIFO. Is there a way of stunning the FIFO to prevent this? 1685FIFO. Is there a way of stunning the FIFO to prevent this?
1359 1686
1360SEE ALSO 1687SEE ALSO
1688^^^^^^^^
1361 1689
1362ecp_write_block, ecp_write_addr 1690ecp_write_block, ecp_write_addr
1363 1691
1692
1693
1364port->ops->ecp_write_addr - write a block of ECP addresses 1694port->ops->ecp_write_addr - write a block of ECP addresses
1365------------------------- 1695----------------------------------------------------------
1366 1696
1367SYNOPSIS 1697SYNOPSIS
1698^^^^^^^^
1368 1699
1369#include <linux/parport.h> 1700::
1370 1701
1371struct parport_operations { 1702 #include <linux/parport.h>
1372 ... 1703
1373 size_t (*ecp_write_addr) (struct parport *port, 1704 struct parport_operations {
1374 const void *buf, size_t len, int flags); 1705 ...
1375 ... 1706 size_t (*ecp_write_addr) (struct parport *port,
1376}; 1707 const void *buf, size_t len, int flags);
1708 ...
1709 };
1377 1710
1378DESCRIPTION 1711DESCRIPTION
1712^^^^^^^^^^^
1379 1713
1380Writes a block of ECP addresses. The 'flags' parameter is ignored. 1714Writes a block of ECP addresses. The ``flags`` parameter is ignored.
1381 1715
1382RETURN VALUE 1716RETURN VALUE
1717^^^^^^^^^^^^
1383 1718
1384The number of bytes written. 1719The number of bytes written.
1385 1720
1386NOTES 1721NOTES
1722^^^^^
1387 1723
1388This may use a FIFO, and if so shall not return until the FIFO is empty. 1724This may use a FIFO, and if so shall not return until the FIFO is empty.
1389 1725
1390SEE ALSO 1726SEE ALSO
1727^^^^^^^^
1391 1728
1392ecp_read_data, ecp_write_data 1729ecp_read_data, ecp_write_data
1393 1730
1731
1732
1394port->ops->nibble_read_data - read a block of data in nibble mode 1733port->ops->nibble_read_data - read a block of data in nibble mode
1395--------------------------- 1734-----------------------------------------------------------------
1396 1735
1397SYNOPSIS 1736SYNOPSIS
1737^^^^^^^^
1398 1738
1399#include <linux/parport.h> 1739::
1400 1740
1401struct parport_operations { 1741 #include <linux/parport.h>
1402 ... 1742
1403 size_t (*nibble_read_data) (struct parport *port, 1743 struct parport_operations {
1404 void *buf, size_t len, int flags); 1744 ...
1405 ... 1745 size_t (*nibble_read_data) (struct parport *port,
1406}; 1746 void *buf, size_t len, int flags);
1747 ...
1748 };
1407 1749
1408DESCRIPTION 1750DESCRIPTION
1751^^^^^^^^^^^
1409 1752
1410Reads a block of data in nibble mode. The 'flags' parameter is ignored. 1753Reads a block of data in nibble mode. The ``flags`` parameter is ignored.
1411 1754
1412RETURN VALUE 1755RETURN VALUE
1756^^^^^^^^^^^^
1413 1757
1414The number of whole bytes read. 1758The number of whole bytes read.
1415 1759
1416SEE ALSO 1760SEE ALSO
1761^^^^^^^^
1417 1762
1418byte_read_data, compat_write_data 1763byte_read_data, compat_write_data
1764
1765
1419 1766
1420port->ops->byte_read_data - read a block of data in byte mode 1767port->ops->byte_read_data - read a block of data in byte mode
1421------------------------- 1768-------------------------------------------------------------
1422 1769
1423SYNOPSIS 1770SYNOPSIS
1771^^^^^^^^
1424 1772
1425#include <linux/parport.h> 1773::
1426 1774
1427struct parport_operations { 1775 #include <linux/parport.h>
1428 ... 1776
1429 size_t (*byte_read_data) (struct parport *port, 1777 struct parport_operations {
1430 void *buf, size_t len, int flags); 1778 ...
1431 ... 1779 size_t (*byte_read_data) (struct parport *port,
1432}; 1780 void *buf, size_t len, int flags);
1781 ...
1782 };
1433 1783
1434DESCRIPTION 1784DESCRIPTION
1785^^^^^^^^^^^
1435 1786
1436Reads a block of data in byte mode. The 'flags' parameter is ignored. 1787Reads a block of data in byte mode. The ``flags`` parameter is ignored.
1437 1788
1438RETURN VALUE 1789RETURN VALUE
1790^^^^^^^^^^^^
1439 1791
1440The number of bytes read. 1792The number of bytes read.
1441 1793
1442SEE ALSO 1794SEE ALSO
1795^^^^^^^^
1443 1796
1444nibble_read_data, compat_write_data 1797nibble_read_data, compat_write_data
1798
1799
1445 1800
1446port->ops->compat_write_data - write a block of data in compatibility mode 1801port->ops->compat_write_data - write a block of data in compatibility mode
1447---------------------------- 1802--------------------------------------------------------------------------
1448 1803
1449SYNOPSIS 1804SYNOPSIS
1805^^^^^^^^
1450 1806
1451#include <linux/parport.h> 1807::
1452 1808
1453struct parport_operations { 1809 #include <linux/parport.h>
1454 ... 1810
1455 size_t (*compat_write_data) (struct parport *port, 1811 struct parport_operations {
1456 const void *buf, size_t len, int flags); 1812 ...
1457 ... 1813 size_t (*compat_write_data) (struct parport *port,
1458}; 1814 const void *buf, size_t len, int flags);
1815 ...
1816 };
1459 1817
1460DESCRIPTION 1818DESCRIPTION
1819^^^^^^^^^^^
1461 1820
1462Writes a block of data in compatibility mode. The 'flags' parameter 1821Writes a block of data in compatibility mode. The ``flags`` parameter
1463is ignored. 1822is ignored.
1464 1823
1465RETURN VALUE 1824RETURN VALUE
1825^^^^^^^^^^^^
1466 1826
1467The number of bytes written. 1827The number of bytes written.
1468 1828
1469SEE ALSO 1829SEE ALSO
1830^^^^^^^^
1470 1831
1471nibble_read_data, byte_read_data 1832nibble_read_data, byte_read_data