parport-lowlevel.rst 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. ===============================
  2. PARPORT interface documentation
  3. ===============================
  4. :Time-stamp: <2000-02-24 13:30:20 twaugh>
  5. Described here are the following functions:
  6. Global functions::
  7. parport_register_driver
  8. parport_unregister_driver
  9. parport_enumerate
  10. parport_register_device
  11. parport_unregister_device
  12. parport_claim
  13. parport_claim_or_block
  14. parport_release
  15. parport_yield
  16. parport_yield_blocking
  17. parport_wait_peripheral
  18. parport_poll_peripheral
  19. parport_wait_event
  20. parport_negotiate
  21. parport_read
  22. parport_write
  23. parport_open
  24. parport_close
  25. parport_device_id
  26. parport_device_coords
  27. parport_find_class
  28. parport_find_device
  29. parport_set_timeout
  30. Port functions (can be overridden by low-level drivers):
  31. SPP::
  32. port->ops->read_data
  33. port->ops->write_data
  34. port->ops->read_status
  35. port->ops->read_control
  36. port->ops->write_control
  37. port->ops->frob_control
  38. port->ops->enable_irq
  39. port->ops->disable_irq
  40. port->ops->data_forward
  41. port->ops->data_reverse
  42. EPP::
  43. port->ops->epp_write_data
  44. port->ops->epp_read_data
  45. port->ops->epp_write_addr
  46. port->ops->epp_read_addr
  47. ECP::
  48. port->ops->ecp_write_data
  49. port->ops->ecp_read_data
  50. port->ops->ecp_write_addr
  51. Other::
  52. port->ops->nibble_read_data
  53. port->ops->byte_read_data
  54. port->ops->compat_write_data
  55. The parport subsystem comprises ``parport`` (the core port-sharing
  56. code), and a variety of low-level drivers that actually do the port
  57. accesses. Each low-level driver handles a particular style of port
  58. (PC, Amiga, and so on).
  59. The parport interface to the device driver author can be broken down
  60. into global functions and port functions.
  61. The global functions are mostly for communicating between the device
  62. driver and the parport subsystem: acquiring a list of available ports,
  63. claiming a port for exclusive use, and so on. They also include
  64. ``generic`` functions for doing standard things that will work on any
  65. IEEE 1284-capable architecture.
  66. The port functions are provided by the low-level drivers, although the
  67. core parport module provides generic ``defaults`` for some routines.
  68. The port functions can be split into three groups: SPP, EPP, and ECP.
  69. SPP (Standard Parallel Port) functions modify so-called ``SPP``
  70. registers: data, status, and control. The hardware may not actually
  71. have registers exactly like that, but the PC does and this interface is
  72. modelled after common PC implementations. Other low-level drivers may
  73. be able to emulate most of the functionality.
  74. EPP (Enhanced Parallel Port) functions are provided for reading and
  75. writing in IEEE 1284 EPP mode, and ECP (Extended Capabilities Port)
  76. functions are used for IEEE 1284 ECP mode. (What about BECP? Does
  77. anyone care?)
  78. Hardware assistance for EPP and/or ECP transfers may or may not be
  79. available, and if it is available it may or may not be used. If
  80. hardware is not used, the transfer will be software-driven. In order
  81. to cope with peripherals that only tenuously support IEEE 1284, a
  82. low-level driver specific function is provided, for altering 'fudge
  83. factors'.
  84. Global functions
  85. ================
  86. parport_register_driver - register a device driver with parport
  87. ---------------------------------------------------------------
  88. SYNOPSIS
  89. ^^^^^^^^
  90. ::
  91. #include <linux/parport.h>
  92. struct parport_driver {
  93. const char *name;
  94. void (*attach) (struct parport *);
  95. void (*detach) (struct parport *);
  96. struct parport_driver *next;
  97. };
  98. int parport_register_driver (struct parport_driver *driver);
  99. DESCRIPTION
  100. ^^^^^^^^^^^
  101. In order to be notified about parallel ports when they are detected,
  102. parport_register_driver should be called. Your driver will
  103. immediately be notified of all ports that have already been detected,
  104. and of each new port as low-level drivers are loaded.
  105. A ``struct parport_driver`` contains the textual name of your driver,
  106. a pointer to a function to handle new ports, and a pointer to a
  107. function to handle ports going away due to a low-level driver
  108. unloading. Ports will only be detached if they are not being used
  109. (i.e. there are no devices registered on them).
  110. The visible parts of the ``struct parport *`` argument given to
  111. attach/detach are::
  112. struct parport
  113. {
  114. struct parport *next; /* next parport in list */
  115. const char *name; /* port's name */
  116. unsigned int modes; /* bitfield of hardware modes */
  117. struct parport_device_info probe_info;
  118. /* IEEE1284 info */
  119. int number; /* parport index */
  120. struct parport_operations *ops;
  121. ...
  122. };
  123. There are other members of the structure, but they should not be
  124. touched.
  125. The ``modes`` member summarises the capabilities of the underlying
  126. hardware. It consists of flags which may be bitwise-ored together:
  127. ============================= ===============================================
  128. PARPORT_MODE_PCSPP IBM PC registers are available,
  129. i.e. functions that act on data,
  130. control and status registers are
  131. probably writing directly to the
  132. hardware.
  133. PARPORT_MODE_TRISTATE The data drivers may be turned off.
  134. This allows the data lines to be used
  135. for reverse (peripheral to host)
  136. transfers.
  137. PARPORT_MODE_COMPAT The hardware can assist with
  138. compatibility-mode (printer)
  139. transfers, i.e. compat_write_block.
  140. PARPORT_MODE_EPP The hardware can assist with EPP
  141. transfers.
  142. PARPORT_MODE_ECP The hardware can assist with ECP
  143. transfers.
  144. PARPORT_MODE_DMA The hardware can use DMA, so you might
  145. want to pass ISA DMA-able memory
  146. (i.e. memory allocated using the
  147. GFP_DMA flag with kmalloc) to the
  148. low-level driver in order to take
  149. advantage of it.
  150. ============================= ===============================================
  151. There may be other flags in ``modes`` as well.
  152. The contents of ``modes`` is advisory only. For example, if the
  153. hardware is capable of DMA, and PARPORT_MODE_DMA is in ``modes``, it
  154. doesn't necessarily mean that DMA will always be used when possible.
  155. Similarly, hardware that is capable of assisting ECP transfers won't
  156. necessarily be used.
  157. RETURN VALUE
  158. ^^^^^^^^^^^^
  159. Zero on success, otherwise an error code.
  160. ERRORS
  161. ^^^^^^
  162. None. (Can it fail? Why return int?)
  163. EXAMPLE
  164. ^^^^^^^
  165. ::
  166. static void lp_attach (struct parport *port)
  167. {
  168. ...
  169. private = kmalloc (...);
  170. dev[count++] = parport_register_device (...);
  171. ...
  172. }
  173. static void lp_detach (struct parport *port)
  174. {
  175. ...
  176. }
  177. static struct parport_driver lp_driver = {
  178. "lp",
  179. lp_attach,
  180. lp_detach,
  181. NULL /* always put NULL here */
  182. };
  183. int lp_init (void)
  184. {
  185. ...
  186. if (parport_register_driver (&lp_driver)) {
  187. /* Failed; nothing we can do. */
  188. return -EIO;
  189. }
  190. ...
  191. }
  192. SEE ALSO
  193. ^^^^^^^^
  194. parport_unregister_driver, parport_register_device, parport_enumerate
  195. parport_unregister_driver - tell parport to forget about this driver
  196. --------------------------------------------------------------------
  197. SYNOPSIS
  198. ^^^^^^^^
  199. ::
  200. #include <linux/parport.h>
  201. struct parport_driver {
  202. const char *name;
  203. void (*attach) (struct parport *);
  204. void (*detach) (struct parport *);
  205. struct parport_driver *next;
  206. };
  207. void parport_unregister_driver (struct parport_driver *driver);
  208. DESCRIPTION
  209. ^^^^^^^^^^^
  210. This tells parport not to notify the device driver of new ports or of
  211. ports going away. Registered devices belonging to that driver are NOT
  212. unregistered: parport_unregister_device must be used for each one.
  213. EXAMPLE
  214. ^^^^^^^
  215. ::
  216. void cleanup_module (void)
  217. {
  218. ...
  219. /* Stop notifications. */
  220. parport_unregister_driver (&lp_driver);
  221. /* Unregister devices. */
  222. for (i = 0; i < NUM_DEVS; i++)
  223. parport_unregister_device (dev[i]);
  224. ...
  225. }
  226. SEE ALSO
  227. ^^^^^^^^
  228. parport_register_driver, parport_enumerate
  229. parport_enumerate - retrieve a list of parallel ports (DEPRECATED)
  230. ------------------------------------------------------------------
  231. SYNOPSIS
  232. ^^^^^^^^
  233. ::
  234. #include <linux/parport.h>
  235. struct parport *parport_enumerate (void);
  236. DESCRIPTION
  237. ^^^^^^^^^^^
  238. Retrieve the first of a list of valid parallel ports for this machine.
  239. Successive parallel ports can be found using the ``struct parport
  240. *next`` element of the ``struct parport *`` that is returned. If ``next``
  241. is NULL, there are no more parallel ports in the list. The number of
  242. ports in the list will not exceed PARPORT_MAX.
  243. RETURN VALUE
  244. ^^^^^^^^^^^^
  245. A ``struct parport *`` describing a valid parallel port for the machine,
  246. or NULL if there are none.
  247. ERRORS
  248. ^^^^^^
  249. This function can return NULL to indicate that there are no parallel
  250. ports to use.
  251. EXAMPLE
  252. ^^^^^^^
  253. ::
  254. int detect_device (void)
  255. {
  256. struct parport *port;
  257. for (port = parport_enumerate ();
  258. port != NULL;
  259. port = port->next) {
  260. /* Try to detect a device on the port... */
  261. ...
  262. }
  263. }
  264. ...
  265. }
  266. NOTES
  267. ^^^^^
  268. parport_enumerate is deprecated; parport_register_driver should be
  269. used instead.
  270. SEE ALSO
  271. ^^^^^^^^
  272. parport_register_driver, parport_unregister_driver
  273. parport_register_device - register to use a port
  274. ------------------------------------------------
  275. SYNOPSIS
  276. ^^^^^^^^
  277. ::
  278. #include <linux/parport.h>
  279. typedef int (*preempt_func) (void *handle);
  280. typedef void (*wakeup_func) (void *handle);
  281. typedef int (*irq_func) (int irq, void *handle, struct pt_regs *);
  282. struct pardevice *parport_register_device(struct parport *port,
  283. const char *name,
  284. preempt_func preempt,
  285. wakeup_func wakeup,
  286. irq_func irq,
  287. int flags,
  288. void *handle);
  289. DESCRIPTION
  290. ^^^^^^^^^^^
  291. Use this function to register your device driver on a parallel port
  292. (``port``). Once you have done that, you will be able to use
  293. parport_claim and parport_release in order to use the port.
  294. The (``name``) argument is the name of the device that appears in /proc
  295. filesystem. The string must be valid for the whole lifetime of the
  296. device (until parport_unregister_device is called).
  297. This function will register three callbacks into your driver:
  298. ``preempt``, ``wakeup`` and ``irq``. Each of these may be NULL in order to
  299. indicate that you do not want a callback.
  300. When the ``preempt`` function is called, it is because another driver
  301. wishes to use the parallel port. The ``preempt`` function should return
  302. non-zero if the parallel port cannot be released yet -- if zero is
  303. returned, the port is lost to another driver and the port must be
  304. re-claimed before use.
  305. The ``wakeup`` function is called once another driver has released the
  306. port and no other driver has yet claimed it. You can claim the
  307. parallel port from within the ``wakeup`` function (in which case the
  308. claim is guaranteed to succeed), or choose not to if you don't need it
  309. now.
  310. If an interrupt occurs on the parallel port your driver has claimed,
  311. the ``irq`` function will be called. (Write something about shared
  312. interrupts here.)
  313. The ``handle`` is a pointer to driver-specific data, and is passed to
  314. the callback functions.
  315. ``flags`` may be a bitwise combination of the following flags:
  316. ===================== =================================================
  317. Flag Meaning
  318. ===================== =================================================
  319. PARPORT_DEV_EXCL The device cannot share the parallel port at all.
  320. Use this only when absolutely necessary.
  321. ===================== =================================================
  322. The typedefs are not actually defined -- they are only shown in order
  323. to make the function prototype more readable.
  324. The visible parts of the returned ``struct pardevice`` are::
  325. struct pardevice {
  326. struct parport *port; /* Associated port */
  327. void *private; /* Device driver's 'handle' */
  328. ...
  329. };
  330. RETURN VALUE
  331. ^^^^^^^^^^^^
  332. A ``struct pardevice *``: a handle to the registered parallel port
  333. device that can be used for parport_claim, parport_release, etc.
  334. ERRORS
  335. ^^^^^^
  336. A return value of NULL indicates that there was a problem registering
  337. a device on that port.
  338. EXAMPLE
  339. ^^^^^^^
  340. ::
  341. static int preempt (void *handle)
  342. {
  343. if (busy_right_now)
  344. return 1;
  345. must_reclaim_port = 1;
  346. return 0;
  347. }
  348. static void wakeup (void *handle)
  349. {
  350. struct toaster *private = handle;
  351. struct pardevice *dev = private->dev;
  352. if (!dev) return; /* avoid races */
  353. if (want_port)
  354. parport_claim (dev);
  355. }
  356. static int toaster_detect (struct toaster *private, struct parport *port)
  357. {
  358. private->dev = parport_register_device (port, "toaster", preempt,
  359. wakeup, NULL, 0,
  360. private);
  361. if (!private->dev)
  362. /* Couldn't register with parport. */
  363. return -EIO;
  364. must_reclaim_port = 0;
  365. busy_right_now = 1;
  366. parport_claim_or_block (private->dev);
  367. ...
  368. /* Don't need the port while the toaster warms up. */
  369. busy_right_now = 0;
  370. ...
  371. busy_right_now = 1;
  372. if (must_reclaim_port) {
  373. parport_claim_or_block (private->dev);
  374. must_reclaim_port = 0;
  375. }
  376. ...
  377. }
  378. SEE ALSO
  379. ^^^^^^^^
  380. parport_unregister_device, parport_claim
  381. parport_unregister_device - finish using a port
  382. -----------------------------------------------
  383. SYNPOPSIS
  384. ::
  385. #include <linux/parport.h>
  386. void parport_unregister_device (struct pardevice *dev);
  387. DESCRIPTION
  388. ^^^^^^^^^^^
  389. This function is the opposite of parport_register_device. After using
  390. parport_unregister_device, ``dev`` is no longer a valid device handle.
  391. You should not unregister a device that is currently claimed, although
  392. if you do it will be released automatically.
  393. EXAMPLE
  394. ^^^^^^^
  395. ::
  396. ...
  397. kfree (dev->private); /* before we lose the pointer */
  398. parport_unregister_device (dev);
  399. ...
  400. SEE ALSO
  401. ^^^^^^^^
  402. parport_unregister_driver
  403. parport_claim, parport_claim_or_block - claim the parallel port for a device
  404. ----------------------------------------------------------------------------
  405. SYNOPSIS
  406. ^^^^^^^^
  407. ::
  408. #include <linux/parport.h>
  409. int parport_claim (struct pardevice *dev);
  410. int parport_claim_or_block (struct pardevice *dev);
  411. DESCRIPTION
  412. ^^^^^^^^^^^
  413. These functions attempt to gain control of the parallel port on which
  414. ``dev`` is registered. ``parport_claim`` does not block, but
  415. ``parport_claim_or_block`` may do. (Put something here about blocking
  416. interruptibly or non-interruptibly.)
  417. You should not try to claim a port that you have already claimed.
  418. RETURN VALUE
  419. ^^^^^^^^^^^^
  420. A return value of zero indicates that the port was successfully
  421. claimed, and the caller now has possession of the parallel port.
  422. If ``parport_claim_or_block`` blocks before returning successfully, the
  423. return value is positive.
  424. ERRORS
  425. ^^^^^^
  426. ========== ==========================================================
  427. -EAGAIN The port is unavailable at the moment, but another attempt
  428. to claim it may succeed.
  429. ========== ==========================================================
  430. SEE ALSO
  431. ^^^^^^^^
  432. parport_release
  433. parport_release - release the parallel port
  434. -------------------------------------------
  435. SYNOPSIS
  436. ^^^^^^^^
  437. ::
  438. #include <linux/parport.h>
  439. void parport_release (struct pardevice *dev);
  440. DESCRIPTION
  441. ^^^^^^^^^^^
  442. Once a parallel port device has been claimed, it can be released using
  443. ``parport_release``. It cannot fail, but you should not release a
  444. device that you do not have possession of.
  445. EXAMPLE
  446. ^^^^^^^
  447. ::
  448. static size_t write (struct pardevice *dev, const void *buf,
  449. size_t len)
  450. {
  451. ...
  452. written = dev->port->ops->write_ecp_data (dev->port, buf,
  453. len);
  454. parport_release (dev);
  455. ...
  456. }
  457. SEE ALSO
  458. ^^^^^^^^
  459. change_mode, parport_claim, parport_claim_or_block, parport_yield
  460. parport_yield, parport_yield_blocking - temporarily release a parallel port
  461. ---------------------------------------------------------------------------
  462. SYNOPSIS
  463. ^^^^^^^^
  464. ::
  465. #include <linux/parport.h>
  466. int parport_yield (struct pardevice *dev)
  467. int parport_yield_blocking (struct pardevice *dev);
  468. DESCRIPTION
  469. ^^^^^^^^^^^
  470. When a driver has control of a parallel port, it may allow another
  471. driver to temporarily ``borrow`` it. ``parport_yield`` does not block;
  472. ``parport_yield_blocking`` may do.
  473. RETURN VALUE
  474. ^^^^^^^^^^^^
  475. A return value of zero indicates that the caller still owns the port
  476. and the call did not block.
  477. A positive return value from ``parport_yield_blocking`` indicates that
  478. the caller still owns the port and the call blocked.
  479. A return value of -EAGAIN indicates that the caller no longer owns the
  480. port, and it must be re-claimed before use.
  481. ERRORS
  482. ^^^^^^
  483. ========= ==========================================================
  484. -EAGAIN Ownership of the parallel port was given away.
  485. ========= ==========================================================
  486. SEE ALSO
  487. ^^^^^^^^
  488. parport_release
  489. parport_wait_peripheral - wait for status lines, up to 35ms
  490. -----------------------------------------------------------
  491. SYNOPSIS
  492. ^^^^^^^^
  493. ::
  494. #include <linux/parport.h>
  495. int parport_wait_peripheral (struct parport *port,
  496. unsigned char mask,
  497. unsigned char val);
  498. DESCRIPTION
  499. ^^^^^^^^^^^
  500. Wait for the status lines in mask to match the values in val.
  501. RETURN VALUE
  502. ^^^^^^^^^^^^
  503. ======== ==========================================================
  504. -EINTR a signal is pending
  505. 0 the status lines in mask have values in val
  506. 1 timed out while waiting (35ms elapsed)
  507. ======== ==========================================================
  508. SEE ALSO
  509. ^^^^^^^^
  510. parport_poll_peripheral
  511. parport_poll_peripheral - wait for status lines, in usec
  512. --------------------------------------------------------
  513. SYNOPSIS
  514. ^^^^^^^^
  515. ::
  516. #include <linux/parport.h>
  517. int parport_poll_peripheral (struct parport *port,
  518. unsigned char mask,
  519. unsigned char val,
  520. int usec);
  521. DESCRIPTION
  522. ^^^^^^^^^^^
  523. Wait for the status lines in mask to match the values in val.
  524. RETURN VALUE
  525. ^^^^^^^^^^^^
  526. ======== ==========================================================
  527. -EINTR a signal is pending
  528. 0 the status lines in mask have values in val
  529. 1 timed out while waiting (usec microseconds have elapsed)
  530. ======== ==========================================================
  531. SEE ALSO
  532. ^^^^^^^^
  533. parport_wait_peripheral
  534. parport_wait_event - wait for an event on a port
  535. ------------------------------------------------
  536. SYNOPSIS
  537. ^^^^^^^^
  538. ::
  539. #include <linux/parport.h>
  540. int parport_wait_event (struct parport *port, signed long timeout)
  541. DESCRIPTION
  542. ^^^^^^^^^^^
  543. Wait for an event (e.g. interrupt) on a port. The timeout is in
  544. jiffies.
  545. RETURN VALUE
  546. ^^^^^^^^^^^^
  547. ======= ==========================================================
  548. 0 success
  549. <0 error (exit as soon as possible)
  550. >0 timed out
  551. ======= ==========================================================
  552. parport_negotiate - perform IEEE 1284 negotiation
  553. -------------------------------------------------
  554. SYNOPSIS
  555. ^^^^^^^^
  556. ::
  557. #include <linux/parport.h>
  558. int parport_negotiate (struct parport *, int mode);
  559. DESCRIPTION
  560. ^^^^^^^^^^^
  561. Perform IEEE 1284 negotiation.
  562. RETURN VALUE
  563. ^^^^^^^^^^^^
  564. ======= ==========================================================
  565. 0 handshake OK; IEEE 1284 peripheral and mode available
  566. -1 handshake failed; peripheral not compliant (or none present)
  567. 1 handshake OK; IEEE 1284 peripheral present but mode not
  568. available
  569. ======= ==========================================================
  570. SEE ALSO
  571. ^^^^^^^^
  572. parport_read, parport_write
  573. parport_read - read data from device
  574. ------------------------------------
  575. SYNOPSIS
  576. ^^^^^^^^
  577. ::
  578. #include <linux/parport.h>
  579. ssize_t parport_read (struct parport *, void *buf, size_t len);
  580. DESCRIPTION
  581. ^^^^^^^^^^^
  582. Read data from device in current IEEE 1284 transfer mode. This only
  583. works for modes that support reverse data transfer.
  584. RETURN VALUE
  585. ^^^^^^^^^^^^
  586. If negative, an error code; otherwise the number of bytes transferred.
  587. SEE ALSO
  588. ^^^^^^^^
  589. parport_write, parport_negotiate
  590. parport_write - write data to device
  591. ------------------------------------
  592. SYNOPSIS
  593. ^^^^^^^^
  594. ::
  595. #include <linux/parport.h>
  596. ssize_t parport_write (struct parport *, const void *buf, size_t len);
  597. DESCRIPTION
  598. ^^^^^^^^^^^
  599. Write data to device in current IEEE 1284 transfer mode. This only
  600. works for modes that support forward data transfer.
  601. RETURN VALUE
  602. ^^^^^^^^^^^^
  603. If negative, an error code; otherwise the number of bytes transferred.
  604. SEE ALSO
  605. ^^^^^^^^
  606. parport_read, parport_negotiate
  607. parport_open - register device for particular device number
  608. -----------------------------------------------------------
  609. SYNOPSIS
  610. ^^^^^^^^
  611. ::
  612. #include <linux/parport.h>
  613. struct pardevice *parport_open (int devnum, const char *name,
  614. int (*pf) (void *),
  615. void (*kf) (void *),
  616. void (*irqf) (int, void *,
  617. struct pt_regs *),
  618. int flags, void *handle);
  619. DESCRIPTION
  620. ^^^^^^^^^^^
  621. This is like parport_register_device but takes a device number instead
  622. of a pointer to a struct parport.
  623. RETURN VALUE
  624. ^^^^^^^^^^^^
  625. See parport_register_device. If no device is associated with devnum,
  626. NULL is returned.
  627. SEE ALSO
  628. ^^^^^^^^
  629. parport_register_device
  630. parport_close - unregister device for particular device number
  631. --------------------------------------------------------------
  632. SYNOPSIS
  633. ^^^^^^^^
  634. ::
  635. #include <linux/parport.h>
  636. void parport_close (struct pardevice *dev);
  637. DESCRIPTION
  638. ^^^^^^^^^^^
  639. This is the equivalent of parport_unregister_device for parport_open.
  640. SEE ALSO
  641. ^^^^^^^^
  642. parport_unregister_device, parport_open
  643. parport_device_id - obtain IEEE 1284 Device ID
  644. ----------------------------------------------
  645. SYNOPSIS
  646. ^^^^^^^^
  647. ::
  648. #include <linux/parport.h>
  649. ssize_t parport_device_id (int devnum, char *buffer, size_t len);
  650. DESCRIPTION
  651. ^^^^^^^^^^^
  652. Obtains the IEEE 1284 Device ID associated with a given device.
  653. RETURN VALUE
  654. ^^^^^^^^^^^^
  655. If negative, an error code; otherwise, the number of bytes of buffer
  656. that contain the device ID. The format of the device ID is as
  657. follows::
  658. [length][ID]
  659. The first two bytes indicate the inclusive length of the entire Device
  660. ID, and are in big-endian order. The ID is a sequence of pairs of the
  661. form::
  662. key:value;
  663. NOTES
  664. ^^^^^
  665. Many devices have ill-formed IEEE 1284 Device IDs.
  666. SEE ALSO
  667. ^^^^^^^^
  668. parport_find_class, parport_find_device
  669. parport_device_coords - convert device number to device coordinates
  670. -------------------------------------------------------------------
  671. SYNOPSIS
  672. ^^^^^^^^
  673. ::
  674. #include <linux/parport.h>
  675. int parport_device_coords (int devnum, int *parport, int *mux,
  676. int *daisy);
  677. DESCRIPTION
  678. ^^^^^^^^^^^
  679. Convert between device number (zero-based) and device coordinates
  680. (port, multiplexor, daisy chain address).
  681. RETURN VALUE
  682. ^^^^^^^^^^^^
  683. Zero on success, in which case the coordinates are (``*parport``, ``*mux``,
  684. ``*daisy``).
  685. SEE ALSO
  686. ^^^^^^^^
  687. parport_open, parport_device_id
  688. parport_find_class - find a device by its class
  689. -----------------------------------------------
  690. SYNOPSIS
  691. ^^^^^^^^
  692. ::
  693. #include <linux/parport.h>
  694. typedef enum {
  695. PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
  696. PARPORT_CLASS_PRINTER,
  697. PARPORT_CLASS_MODEM,
  698. PARPORT_CLASS_NET,
  699. PARPORT_CLASS_HDC, /* Hard disk controller */
  700. PARPORT_CLASS_PCMCIA,
  701. PARPORT_CLASS_MEDIA, /* Multimedia device */
  702. PARPORT_CLASS_FDC, /* Floppy disk controller */
  703. PARPORT_CLASS_PORTS,
  704. PARPORT_CLASS_SCANNER,
  705. PARPORT_CLASS_DIGCAM,
  706. PARPORT_CLASS_OTHER, /* Anything else */
  707. PARPORT_CLASS_UNSPEC, /* No CLS field in ID */
  708. PARPORT_CLASS_SCSIADAPTER
  709. } parport_device_class;
  710. int parport_find_class (parport_device_class cls, int from);
  711. DESCRIPTION
  712. ^^^^^^^^^^^
  713. Find a device by class. The search starts from device number from+1.
  714. RETURN VALUE
  715. ^^^^^^^^^^^^
  716. The device number of the next device in that class, or -1 if no such
  717. device exists.
  718. NOTES
  719. ^^^^^
  720. Example usage::
  721. int devnum = -1;
  722. while ((devnum = parport_find_class (PARPORT_CLASS_DIGCAM, devnum)) != -1) {
  723. struct pardevice *dev = parport_open (devnum, ...);
  724. ...
  725. }
  726. SEE ALSO
  727. ^^^^^^^^
  728. parport_find_device, parport_open, parport_device_id
  729. parport_find_device - find a device by its class
  730. ------------------------------------------------
  731. SYNOPSIS
  732. ^^^^^^^^
  733. ::
  734. #include <linux/parport.h>
  735. int parport_find_device (const char *mfg, const char *mdl, int from);
  736. DESCRIPTION
  737. ^^^^^^^^^^^
  738. Find a device by vendor and model. The search starts from device
  739. number from+1.
  740. RETURN VALUE
  741. ^^^^^^^^^^^^
  742. The device number of the next device matching the specifications, or
  743. -1 if no such device exists.
  744. NOTES
  745. ^^^^^
  746. Example usage::
  747. int devnum = -1;
  748. while ((devnum = parport_find_device ("IOMEGA", "ZIP+", devnum)) != -1) {
  749. struct pardevice *dev = parport_open (devnum, ...);
  750. ...
  751. }
  752. SEE ALSO
  753. ^^^^^^^^
  754. parport_find_class, parport_open, parport_device_id
  755. parport_set_timeout - set the inactivity timeout
  756. ------------------------------------------------
  757. SYNOPSIS
  758. ^^^^^^^^
  759. ::
  760. #include <linux/parport.h>
  761. long parport_set_timeout (struct pardevice *dev, long inactivity);
  762. DESCRIPTION
  763. ^^^^^^^^^^^
  764. Set the inactivity timeout, in jiffies, for a registered device. The
  765. previous timeout is returned.
  766. RETURN VALUE
  767. ^^^^^^^^^^^^
  768. The previous timeout, in jiffies.
  769. NOTES
  770. ^^^^^
  771. Some of the port->ops functions for a parport may take time, owing to
  772. delays at the peripheral. After the peripheral has not responded for
  773. ``inactivity`` jiffies, a timeout will occur and the blocking function
  774. will return.
  775. A timeout of 0 jiffies is a special case: the function must do as much
  776. as it can without blocking or leaving the hardware in an unknown
  777. state. If port operations are performed from within an interrupt
  778. handler, for instance, a timeout of 0 jiffies should be used.
  779. Once set for a registered device, the timeout will remain at the set
  780. value until set again.
  781. SEE ALSO
  782. ^^^^^^^^
  783. port->ops->xxx_read/write_yyy
  784. PORT FUNCTIONS
  785. ==============
  786. The functions in the port->ops structure (struct parport_operations)
  787. are provided by the low-level driver responsible for that port.
  788. port->ops->read_data - read the data register
  789. ---------------------------------------------
  790. SYNOPSIS
  791. ^^^^^^^^
  792. ::
  793. #include <linux/parport.h>
  794. struct parport_operations {
  795. ...
  796. unsigned char (*read_data) (struct parport *port);
  797. ...
  798. };
  799. DESCRIPTION
  800. ^^^^^^^^^^^
  801. If port->modes contains the PARPORT_MODE_TRISTATE flag and the
  802. PARPORT_CONTROL_DIRECTION bit in the control register is set, this
  803. returns the value on the data pins. If port->modes contains the
  804. PARPORT_MODE_TRISTATE flag and the PARPORT_CONTROL_DIRECTION bit is
  805. not set, the return value _may_ be the last value written to the data
  806. register. Otherwise the return value is undefined.
  807. SEE ALSO
  808. ^^^^^^^^
  809. write_data, read_status, write_control
  810. port->ops->write_data - write the data register
  811. -----------------------------------------------
  812. SYNOPSIS
  813. ^^^^^^^^
  814. ::
  815. #include <linux/parport.h>
  816. struct parport_operations {
  817. ...
  818. void (*write_data) (struct parport *port, unsigned char d);
  819. ...
  820. };
  821. DESCRIPTION
  822. ^^^^^^^^^^^
  823. Writes to the data register. May have side-effects (a STROBE pulse,
  824. for instance).
  825. SEE ALSO
  826. ^^^^^^^^
  827. read_data, read_status, write_control
  828. port->ops->read_status - read the status register
  829. -------------------------------------------------
  830. SYNOPSIS
  831. ^^^^^^^^
  832. ::
  833. #include <linux/parport.h>
  834. struct parport_operations {
  835. ...
  836. unsigned char (*read_status) (struct parport *port);
  837. ...
  838. };
  839. DESCRIPTION
  840. ^^^^^^^^^^^
  841. Reads from the status register. This is a bitmask:
  842. - PARPORT_STATUS_ERROR (printer fault, "nFault")
  843. - PARPORT_STATUS_SELECT (on-line, "Select")
  844. - PARPORT_STATUS_PAPEROUT (no paper, "PError")
  845. - PARPORT_STATUS_ACK (handshake, "nAck")
  846. - PARPORT_STATUS_BUSY (busy, "Busy")
  847. There may be other bits set.
  848. SEE ALSO
  849. ^^^^^^^^
  850. read_data, write_data, write_control
  851. port->ops->read_control - read the control register
  852. ---------------------------------------------------
  853. SYNOPSIS
  854. ^^^^^^^^
  855. ::
  856. #include <linux/parport.h>
  857. struct parport_operations {
  858. ...
  859. unsigned char (*read_control) (struct parport *port);
  860. ...
  861. };
  862. DESCRIPTION
  863. ^^^^^^^^^^^
  864. Returns the last value written to the control register (either from
  865. write_control or frob_control). No port access is performed.
  866. SEE ALSO
  867. ^^^^^^^^
  868. read_data, write_data, read_status, write_control
  869. port->ops->write_control - write the control register
  870. -----------------------------------------------------
  871. SYNOPSIS
  872. ^^^^^^^^
  873. ::
  874. #include <linux/parport.h>
  875. struct parport_operations {
  876. ...
  877. void (*write_control) (struct parport *port, unsigned char s);
  878. ...
  879. };
  880. DESCRIPTION
  881. ^^^^^^^^^^^
  882. Writes to the control register. This is a bitmask::
  883. _______
  884. - PARPORT_CONTROL_STROBE (nStrobe)
  885. _______
  886. - PARPORT_CONTROL_AUTOFD (nAutoFd)
  887. _____
  888. - PARPORT_CONTROL_INIT (nInit)
  889. _________
  890. - PARPORT_CONTROL_SELECT (nSelectIn)
  891. SEE ALSO
  892. ^^^^^^^^
  893. read_data, write_data, read_status, frob_control
  894. port->ops->frob_control - write control register bits
  895. -----------------------------------------------------
  896. SYNOPSIS
  897. ^^^^^^^^
  898. ::
  899. #include <linux/parport.h>
  900. struct parport_operations {
  901. ...
  902. unsigned char (*frob_control) (struct parport *port,
  903. unsigned char mask,
  904. unsigned char val);
  905. ...
  906. };
  907. DESCRIPTION
  908. ^^^^^^^^^^^
  909. This is equivalent to reading from the control register, masking out
  910. the bits in mask, exclusive-or'ing with the bits in val, and writing
  911. the result to the control register.
  912. As some ports don't allow reads from the control port, a software copy
  913. of its contents is maintained, so frob_control is in fact only one
  914. port access.
  915. SEE ALSO
  916. ^^^^^^^^
  917. read_data, write_data, read_status, write_control
  918. port->ops->enable_irq - enable interrupt generation
  919. ---------------------------------------------------
  920. SYNOPSIS
  921. ^^^^^^^^
  922. ::
  923. #include <linux/parport.h>
  924. struct parport_operations {
  925. ...
  926. void (*enable_irq) (struct parport *port);
  927. ...
  928. };
  929. DESCRIPTION
  930. ^^^^^^^^^^^
  931. The parallel port hardware is instructed to generate interrupts at
  932. appropriate moments, although those moments are
  933. architecture-specific. For the PC architecture, interrupts are
  934. commonly generated on the rising edge of nAck.
  935. SEE ALSO
  936. ^^^^^^^^
  937. disable_irq
  938. port->ops->disable_irq - disable interrupt generation
  939. -----------------------------------------------------
  940. SYNOPSIS
  941. ^^^^^^^^
  942. ::
  943. #include <linux/parport.h>
  944. struct parport_operations {
  945. ...
  946. void (*disable_irq) (struct parport *port);
  947. ...
  948. };
  949. DESCRIPTION
  950. ^^^^^^^^^^^
  951. The parallel port hardware is instructed not to generate interrupts.
  952. The interrupt itself is not masked.
  953. SEE ALSO
  954. ^^^^^^^^
  955. enable_irq
  956. port->ops->data_forward - enable data drivers
  957. ---------------------------------------------
  958. SYNOPSIS
  959. ^^^^^^^^
  960. ::
  961. #include <linux/parport.h>
  962. struct parport_operations {
  963. ...
  964. void (*data_forward) (struct parport *port);
  965. ...
  966. };
  967. DESCRIPTION
  968. ^^^^^^^^^^^
  969. Enables the data line drivers, for 8-bit host-to-peripheral
  970. communications.
  971. SEE ALSO
  972. ^^^^^^^^
  973. data_reverse
  974. port->ops->data_reverse - tristate the buffer
  975. ---------------------------------------------
  976. SYNOPSIS
  977. ^^^^^^^^
  978. ::
  979. #include <linux/parport.h>
  980. struct parport_operations {
  981. ...
  982. void (*data_reverse) (struct parport *port);
  983. ...
  984. };
  985. DESCRIPTION
  986. ^^^^^^^^^^^
  987. Places the data bus in a high impedance state, if port->modes has the
  988. PARPORT_MODE_TRISTATE bit set.
  989. SEE ALSO
  990. ^^^^^^^^
  991. data_forward
  992. port->ops->epp_write_data - write EPP data
  993. ------------------------------------------
  994. SYNOPSIS
  995. ^^^^^^^^
  996. ::
  997. #include <linux/parport.h>
  998. struct parport_operations {
  999. ...
  1000. size_t (*epp_write_data) (struct parport *port, const void *buf,
  1001. size_t len, int flags);
  1002. ...
  1003. };
  1004. DESCRIPTION
  1005. ^^^^^^^^^^^
  1006. Writes data in EPP mode, and returns the number of bytes written.
  1007. The ``flags`` parameter may be one or more of the following,
  1008. bitwise-or'ed together:
  1009. ======================= =================================================
  1010. PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
  1011. 32-bit registers. However, if a transfer
  1012. times out, the return value may be unreliable.
  1013. ======================= =================================================
  1014. SEE ALSO
  1015. ^^^^^^^^
  1016. epp_read_data, epp_write_addr, epp_read_addr
  1017. port->ops->epp_read_data - read EPP data
  1018. ----------------------------------------
  1019. SYNOPSIS
  1020. ^^^^^^^^
  1021. ::
  1022. #include <linux/parport.h>
  1023. struct parport_operations {
  1024. ...
  1025. size_t (*epp_read_data) (struct parport *port, void *buf,
  1026. size_t len, int flags);
  1027. ...
  1028. };
  1029. DESCRIPTION
  1030. ^^^^^^^^^^^
  1031. Reads data in EPP mode, and returns the number of bytes read.
  1032. The ``flags`` parameter may be one or more of the following,
  1033. bitwise-or'ed together:
  1034. ======================= =================================================
  1035. PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
  1036. 32-bit registers. However, if a transfer
  1037. times out, the return value may be unreliable.
  1038. ======================= =================================================
  1039. SEE ALSO
  1040. ^^^^^^^^
  1041. epp_write_data, epp_write_addr, epp_read_addr
  1042. port->ops->epp_write_addr - write EPP address
  1043. ---------------------------------------------
  1044. SYNOPSIS
  1045. ^^^^^^^^
  1046. ::
  1047. #include <linux/parport.h>
  1048. struct parport_operations {
  1049. ...
  1050. size_t (*epp_write_addr) (struct parport *port,
  1051. const void *buf, size_t len, int flags);
  1052. ...
  1053. };
  1054. DESCRIPTION
  1055. ^^^^^^^^^^^
  1056. Writes EPP addresses (8 bits each), and returns the number written.
  1057. The ``flags`` parameter may be one or more of the following,
  1058. bitwise-or'ed together:
  1059. ======================= =================================================
  1060. PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
  1061. 32-bit registers. However, if a transfer
  1062. times out, the return value may be unreliable.
  1063. ======================= =================================================
  1064. (Does PARPORT_EPP_FAST make sense for this function?)
  1065. SEE ALSO
  1066. ^^^^^^^^
  1067. epp_write_data, epp_read_data, epp_read_addr
  1068. port->ops->epp_read_addr - read EPP address
  1069. -------------------------------------------
  1070. SYNOPSIS
  1071. ^^^^^^^^
  1072. ::
  1073. #include <linux/parport.h>
  1074. struct parport_operations {
  1075. ...
  1076. size_t (*epp_read_addr) (struct parport *port, void *buf,
  1077. size_t len, int flags);
  1078. ...
  1079. };
  1080. DESCRIPTION
  1081. ^^^^^^^^^^^
  1082. Reads EPP addresses (8 bits each), and returns the number read.
  1083. The ``flags`` parameter may be one or more of the following,
  1084. bitwise-or'ed together:
  1085. ======================= =================================================
  1086. PARPORT_EPP_FAST Use fast transfers. Some chips provide 16-bit and
  1087. 32-bit registers. However, if a transfer
  1088. times out, the return value may be unreliable.
  1089. ======================= =================================================
  1090. (Does PARPORT_EPP_FAST make sense for this function?)
  1091. SEE ALSO
  1092. ^^^^^^^^
  1093. epp_write_data, epp_read_data, epp_write_addr
  1094. port->ops->ecp_write_data - write a block of ECP data
  1095. -----------------------------------------------------
  1096. SYNOPSIS
  1097. ^^^^^^^^
  1098. ::
  1099. #include <linux/parport.h>
  1100. struct parport_operations {
  1101. ...
  1102. size_t (*ecp_write_data) (struct parport *port,
  1103. const void *buf, size_t len, int flags);
  1104. ...
  1105. };
  1106. DESCRIPTION
  1107. ^^^^^^^^^^^
  1108. Writes a block of ECP data. The ``flags`` parameter is ignored.
  1109. RETURN VALUE
  1110. ^^^^^^^^^^^^
  1111. The number of bytes written.
  1112. SEE ALSO
  1113. ^^^^^^^^
  1114. ecp_read_data, ecp_write_addr
  1115. port->ops->ecp_read_data - read a block of ECP data
  1116. ---------------------------------------------------
  1117. SYNOPSIS
  1118. ^^^^^^^^
  1119. ::
  1120. #include <linux/parport.h>
  1121. struct parport_operations {
  1122. ...
  1123. size_t (*ecp_read_data) (struct parport *port,
  1124. void *buf, size_t len, int flags);
  1125. ...
  1126. };
  1127. DESCRIPTION
  1128. ^^^^^^^^^^^
  1129. Reads a block of ECP data. The ``flags`` parameter is ignored.
  1130. RETURN VALUE
  1131. ^^^^^^^^^^^^
  1132. The number of bytes read. NB. There may be more unread data in a
  1133. FIFO. Is there a way of stunning the FIFO to prevent this?
  1134. SEE ALSO
  1135. ^^^^^^^^
  1136. ecp_write_block, ecp_write_addr
  1137. port->ops->ecp_write_addr - write a block of ECP addresses
  1138. ----------------------------------------------------------
  1139. SYNOPSIS
  1140. ^^^^^^^^
  1141. ::
  1142. #include <linux/parport.h>
  1143. struct parport_operations {
  1144. ...
  1145. size_t (*ecp_write_addr) (struct parport *port,
  1146. const void *buf, size_t len, int flags);
  1147. ...
  1148. };
  1149. DESCRIPTION
  1150. ^^^^^^^^^^^
  1151. Writes a block of ECP addresses. The ``flags`` parameter is ignored.
  1152. RETURN VALUE
  1153. ^^^^^^^^^^^^
  1154. The number of bytes written.
  1155. NOTES
  1156. ^^^^^
  1157. This may use a FIFO, and if so shall not return until the FIFO is empty.
  1158. SEE ALSO
  1159. ^^^^^^^^
  1160. ecp_read_data, ecp_write_data
  1161. port->ops->nibble_read_data - read a block of data in nibble mode
  1162. -----------------------------------------------------------------
  1163. SYNOPSIS
  1164. ^^^^^^^^
  1165. ::
  1166. #include <linux/parport.h>
  1167. struct parport_operations {
  1168. ...
  1169. size_t (*nibble_read_data) (struct parport *port,
  1170. void *buf, size_t len, int flags);
  1171. ...
  1172. };
  1173. DESCRIPTION
  1174. ^^^^^^^^^^^
  1175. Reads a block of data in nibble mode. The ``flags`` parameter is ignored.
  1176. RETURN VALUE
  1177. ^^^^^^^^^^^^
  1178. The number of whole bytes read.
  1179. SEE ALSO
  1180. ^^^^^^^^
  1181. byte_read_data, compat_write_data
  1182. port->ops->byte_read_data - read a block of data in byte mode
  1183. -------------------------------------------------------------
  1184. SYNOPSIS
  1185. ^^^^^^^^
  1186. ::
  1187. #include <linux/parport.h>
  1188. struct parport_operations {
  1189. ...
  1190. size_t (*byte_read_data) (struct parport *port,
  1191. void *buf, size_t len, int flags);
  1192. ...
  1193. };
  1194. DESCRIPTION
  1195. ^^^^^^^^^^^
  1196. Reads a block of data in byte mode. The ``flags`` parameter is ignored.
  1197. RETURN VALUE
  1198. ^^^^^^^^^^^^
  1199. The number of bytes read.
  1200. SEE ALSO
  1201. ^^^^^^^^
  1202. nibble_read_data, compat_write_data
  1203. port->ops->compat_write_data - write a block of data in compatibility mode
  1204. --------------------------------------------------------------------------
  1205. SYNOPSIS
  1206. ^^^^^^^^
  1207. ::
  1208. #include <linux/parport.h>
  1209. struct parport_operations {
  1210. ...
  1211. size_t (*compat_write_data) (struct parport *port,
  1212. const void *buf, size_t len, int flags);
  1213. ...
  1214. };
  1215. DESCRIPTION
  1216. ^^^^^^^^^^^
  1217. Writes a block of data in compatibility mode. The ``flags`` parameter
  1218. is ignored.
  1219. RETURN VALUE
  1220. ^^^^^^^^^^^^
  1221. The number of bytes written.
  1222. SEE ALSO
  1223. ^^^^^^^^
  1224. nibble_read_data, byte_read_data