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